Seite 2 von 2

Verfasst: 14.03.2004 23:14
von Christian_W
Die "Â"-Zeichen stehen überall wo eigentlich TABs sein sollten so wie ich das sehe.
Evtl. mal einen anderen Editor benutzen, bzw. als anderes txt-Format abspeichern.

Gruß Christian

Verfasst: 15.03.2004 08:53
von mäci
anbei der txt der block_pic.php
Code:
<?php
/***************************************************************************
*                              block_pic.php
*                            --------------------------
*   begin                : Febuary 2003
*   copyright            : (C) 2002, 2003 Smartor
*                      (C) 2003 IK
*   email                : cms@kohl-net.de
*
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/


// VARIABLES
// EDIT THE VARIABLES BELOW TO MEET YOUR REQUIREMENTS


$Display = 'Recent'; // Replace 'XXXX' with 'Recent' or 'Random'.
$CategoryID = 0; // Replace 0 with a category ID. Otherwise, keep it as it is.


// DO NOT EDIT BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING !!!


// This first if statement is for the admin panel
if (($userdata['user_level']==ADMIN)&&($from_admin_panel))
{
   $block_name = "Last / Random Picture";
}

else{

$template->set_filenames(array(
      "block_pic" => "block_pic.tpl"));


$album_root_path = $phpbb_root_path . 'album_mod/';
include($album_root_path . 'album_common.'.$phpEx);

$sql = "SELECT c.*, COUNT(p.pic_id) AS count
      FROM ". ALBUM_CAT_TABLE ." AS c
         LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id
      WHERE cat_id <> 0
      GROUP BY cat_id
      ORDER BY cat_order ASC";
if( !($result = $db->sql_query($sql)) )
{
   message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql);
}

$catrows = array();

while( $row = $db->sql_fetchrow($result) )
{
   $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW
   if ($album_user_access['view'] == 1)
   {
      $catrows[] = $row;
   }
}

$allowed_cat = ''; // For Recent Public Pics below

//
// $catrows now stores all categories which this user can view. Dump them out!
//
for ($i = 0; $i < count($catrows); $i++)
{
   
   $allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
}


//
// BEGIN Random or Recent Photo
//


if ($Display == 'Random') {
if ($CategoryID != 0) {
$sql = "SELECT * FROM " . ALBUM_TABLE . " p, " . ALBUM_CAT_TABLE ." ct
   WHERE p.pic_cat_id=ct.cat_id AND p.pic_cat_id = $CategoryID
   AND p.pic_cat_id IN ($allowed_cat)
   AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
   ORDER BY RAND() LIMIT 1";
}
else {
$sql = "SELECT * FROM " . ALBUM_TABLE . " p, " . ALBUM_CAT_TABLE ." ct
   WHERE p.pic_cat_id=ct.cat_id AND p.pic_cat_id IN ($allowed_cat)
   AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
   ORDER BY RAND() LIMIT 1";
}
}
else if ($Display == 'Recent') {
if ($CategoryID != 0) {
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_time
   FROM " . ALBUM_TABLE . " p, " . ALBUM_CAT_TABLE ." ct
   WHERE p.pic_cat_id=ct.cat_id AND p.pic_cat_id = $CategoryID
   AND p.pic_cat_id IN ($allowed_cat)
   AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
   ORDER BY pic_time DESC LIMIT 0,1";
}
else {
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_time
   FROM " . ALBUM_TABLE . " p, " . ALBUM_CAT_TABLE ." ct
   WHERE p.pic_cat_id=ct.cat_id AND p.pic_cat_id IN ($allowed_cat)
   AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
   ORDER BY pic_time DESC LIMIT 0,1";
}
}

if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql);
}

$picrow = $db->sql_fetchrow($result);
//
// END Random or Recent Photo
//

$template->assign_vars(array(
   'L_NEWEST_PIC' => $lang['Newest_pic'],
   'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']),
   'PIC_TITLE' => $picrow['pic_title'],
   'PIC_POSTER' => $picrow['pic_username'],
   'U_PIC_LINK' => append_sid('album_page.' . $phpEx . '?pic_id=' . $picrow['pic_id']),
   'PIC_TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']),
   'L_GOTO_ALBUM' => $lang['goto_album'])
);

   $template->pparse("block_pic");

}

?>


Verfasst: 15.03.2004 09:37
von Christian_W
Das Problem ist nicht, dass wir die Datei nicht lesen können, sondern dass Du in Deiner Datei Sonderzeichen hast die da nicht hineingehören.
Was benutzt Du denn für einen Editor?

Deine Datei sollte eigentlich so aussehen: block_pic.txt

[edit]
Die kannst Du speichern und direkt verwenden ;)
[/edit]

Verfasst: 15.03.2004 13:48
von mäci
editor: pepper

die php datei schaut bei mir ja auch ganz normal aus ohne die Ä.

meint ihr die fehlermeldung beruht auf diese leerzeichen?

Verfasst: 15.03.2004 15:38
von Christian_W
pepper -> Mac -> hab ich nicht kann ich also auch nicht testen :-?

Wenn ich die Datei mit TextPad (Editor für Windows) öffne zeigt mir der auch keine "Â"-Zeichen an. Da sind sie aber trotzdem. Hast Du mit diesem Editor auch schon andere (PHP)-Dateien bearbeitet? Benutze einfach mal einen anderen Editor (der Mac hat doch sicher auch einen kleinen Standard-Texteditor. Evtl. liegt es auch an Deinem Browser. Ich vermute mal Du hast den Code aus dem Fenster herauskopiert und in eine neue Datei eingefügt.

Speichere die von mir oben angegebene Datei mal direkt (Rechtsklick, speichern unter) und versuch es mal mit der ohne sie vorher nochmal zu bearbeiten. (Die hat die "Â"-Zeichen definitiv nicht).

Die Zeile die in Deiner Fehlermeldung angegeben wird ist die erste in der die Zeichen vorkommen. In den vorhergehenden Zeilen sind entweder keine oder sie sind auskommentiert.

Gruß Christian

Verfasst: 15.03.2004 18:49
von mäci
ja, du hast recht. es lag daran. jetzt funktioniert es.

besten dank.