Probleme mit Staff Posts 1.0.9

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
Holger
Beiträge: 2253
Registriert: Mi 17.Mär, 2004 18:09

Probleme mit Staff Posts 1.0.9

Beitrag von Holger »

Hallo,

nach dem Installieren von Staff Posts 1.0.9 bekomme ich folgende Fehlerrmeldung:
Could not get post information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

SELECT post_id, post_time, poster_id FROM xx_posts WHERE post_id =

Line : 419
File : index.php
Die entsprechende Stelle im index.php (Zeilen 413-421):

Code: Alles auswählen

                           $sql = 'SELECT post_id, post_time, poster_id 
                                 FROM ' . POSTS_TABLE . ' 
                                 WHERE post_id = ' . $topicinfo['topic_last_post_id']; 
                           $db->sql_freeresult($result); 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not get post information','',__LINE__,__FILE__,$sql); 
                           } 
                           $last_post_info = $db->sql_fetchrow($result);
Die Anweisung für index.php:

Code: Alles auswählen

# 
#-----[ OPEN ]------------------------------------------ 
# 
index.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
$sql = "SELECT t.forum_id, 
# 
#-----[ BEFORE, ADD ]----------------------------------- 
# 
      $checkstaff = ($userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD) ? ' AND t.topic_staff = 0' : ''; 
# 
#-----[ FIND ]------------------------------------------ 
# 
WHERE p.post_id = t.topic_last_post_id 
# 
#-----[ IN-LINE FIND ]---------------------------------- 
# 
t.topic_last_post_id 
# 
#-----[ IN-LINE AFTER, ADD ]---------------------------- 
# 
 $checkstaff 
# 
# 
#-----[ FIND ]------------------------------------------ 
# 
$posts = 
# 
#-----[ BEFORE, ADD ]----------------------------------- 
# 
                     if ($userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD) 
                     { 
                        $sql = 'SELECT topic_id 
                              FROM ' . TOPICS_TABLE . ' 
                              WHERE topic_staff = 1'; 
                        if (!$result = $db->sql_query($sql)) 
                        { 
                           message_die(GENERAL_ERROR,'Could not find topic information','',__LINE__,__FILE__,$sql); 
                        } 
                        $topic = $db->sql_fetchrowset($result); 
                        for ($k = 0; isset($topic[$k]); $k++) 
                        { 
                           $forum_data[$j]['forum_topics']--; 
                            
                           $sql = 'SELECT post_id 
                                 FROM ' . POSTS_TABLE . ' 
                                 WHERE topic_id = ' . $topic[$k]['topic_id']; 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR,'Could not find post information','',__LINE__,__FILE__,$sql); 
                           } 
                            
                           $forum_data[$j]['forum_posts'] -= $db->sql_numrows($result); 
                            
                        } 
                     } 
# 
#-----[ FIND ]------------------------------------------ 
# 
   if ( $forum_data[$j]['forum_last_post_id'] ) 
   { 
# 
#-----[ AFTER, ADD ]------------------------------------ 
# 
                        if ($userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD) 
                        { 
                           $sql = 'SELECT topic_last_post_id 
                                 FROM ' . TOPICS_TABLE . ' 
                                 WHERE forum_id = ' . $forum_id . ' 
                                 AND topic_staff = 0 
                                 ORDER BY topic_last_post_id DESC LIMIT 0,1'; 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not get topic information','',__LINE__,__FILE__,$sql); 
                           } 
                           $topicinfo = $db->sql_fetchrow($result); 
                            
                           $sql = 'SELECT post_id, post_time, poster_id 
                                 FROM ' . POSTS_TABLE . ' 
                                 WHERE post_id = ' . $topicinfo['topic_last_post_id']; 
                           $db->sql_freeresult($result); 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not get post information','',__LINE__,__FILE__,$sql); 
                           } 
                           $last_post_info = $db->sql_fetchrow($result); 
                            
                            
                           $db->sql_freeresult($result); 
                           $forum_data[$j]['post_time'] = $last_post_info['post_time']; 
                           $forum_data[$j]['user_id'] = $last_post_info['poster_id']; 
                            
                            
                           $sql = 'SELECT username 
                                 FROM . ' . USERS_TABLE . ' 
                                 WHERE user_id = ' . $last_post_info['poster_id']; 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not open users table','',__LINE__,__FILE__,$sql); 
                           } 
                           $userinfo = $db->sql_fetchrow($result); 
                            
                           $forum_data[$j]['post_username'] = $userinfo['username']; 
                           $forum_data[$j]['username'] = $userinfo['username']; 
                           $forum_data[$j]['forum_last_post_id'] = $last_post_info['post_id']; 
                        }
Wo kann der Fehler liegen?

Gruss
Holger
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Wie wärs hiermit:

Code: Alles auswählen

# 
#-----[ OPEN ]------------------------------------------ 
# 
index.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
                        if ($userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD) 
                        { 
                           $sql = 'SELECT topic_last_post_id 
                                 FROM ' . TOPICS_TABLE . ' 
                                 WHERE forum_id = ' . $forum_id . ' 
                                 AND topic_staff = 0 
                                 ORDER BY topic_last_post_id DESC LIMIT 0,1'; 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not get topic information','',__LINE__,__FILE__,$sql); 
                           } 
                           $topicinfo = $db->sql_fetchrow($result); 
                            
                           $sql = 'SELECT post_id, post_time, poster_id 
                                 FROM ' . POSTS_TABLE . ' 
                                 WHERE post_id = ' . $topicinfo['topic_last_post_id']; 
                           $db->sql_freeresult($result); 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not get post information','',__LINE__,__FILE__,$sql); 
                           } 
                           $last_post_info = $db->sql_fetchrow($result); 
                            
                            
                           $db->sql_freeresult($result); 
                           $forum_data[$j]['post_time'] = $last_post_info['post_time']; 
                           $forum_data[$j]['user_id'] = $last_post_info['poster_id']; 
                            
                            
                           $sql = 'SELECT username 
                                 FROM . ' . USERS_TABLE . ' 
                                 WHERE user_id = ' . $last_post_info['poster_id']; 
                           if (!$result = $db->sql_query($sql)) 
                           { 
                              message_die(GENERAL_ERROR, 'Could not open users table','',__LINE__,__FILE__,$sql); 
                           } 
                           $userinfo = $db->sql_fetchrow($result); 
                            
                           $forum_data[$j]['post_username'] = $userinfo['username']; 
                           $forum_data[$j]['username'] = $userinfo['username']; 
                           $forum_data[$j]['forum_last_post_id'] = $last_post_info['post_id']; 
                        }

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
		if ($userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD) 
		{ 
			$sql = "SELECT p.post_id, p.post_time, p.poster_id, u.username
				FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
				WHERE t.forum_id = $forum_id
					AND t.topic_staff = 0
					AND p.post_id = t.topic_last_post_id
					AND u.user_id = p.poster_id
				ORDER BY topic_last_post_id DESC LIMIT 0,1'; 
			if (!$result = $db->sql_query($sql)) 
			{ 
				message_die(GENERAL_ERROR, 'Could not get post information','',__LINE__,__FILE__,$sql); 
			} 
			$last_post_info = $db->sql_fetchrow($result); 
			$db->sql_freeresult($result); 

			$forum_data[$j]['post_time'] = $last_post_info['post_time']; 
			$forum_data[$j]['user_id'] = $last_post_info['poster_id']; 
			$forum_data[$j]['post_username'] = $last_post_info['username']; 
			$forum_data[$j]['username'] = $last_post_info['username']; 
			$forum_data[$j]['forum_last_post_id'] = $last_post_info['post_id']; 
		}
Spart zudem auch noch 2 Queries ;)
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Antworten