Seite 1 von 1

Simple Subforums - Fehler im Administrations Bereich

Verfasst: 08.04.2007 22:51
von Locou
Nach sehr langen suchen habe ich die Simple Subforums Mode 1.0.2 gefunden.
Nachdem ich es Installeirt habe, bekomme ich einen fehler im Adminstrations Bereich!
Wenn ich auf Forum/Einstellungen gehe bekomme ich diese Fehlermeldung:

Code: Alles auswählen

Parse error: syntax error, unexpected T_CASE in /usr/export/www/hosting/locou/phpBB2/includes/functions_admin.php on line 124
Line 124:

Code: Alles auswählen

		case 'all topics':

Ich habe die eXtreme Styles Mod erfolgreich installiert!

Hier noch meine functions_admin.php:
functions_admin.php

Auszug aus der install.txt für die Mod:

Code: Alles auswählen

#-----[ OPEN ]------------------------------------------
#
includes/functions_admin.php

#
#-----[ FIND ]------------------------------------------
#
	$sql = 'SELECT f.forum_id, f.forum_name

#
#-----[ IN-LINE FIND ]------------------------------------------
#
f.forum_name

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, f.forum_parent 

#
#-----[ FIND ]------------------------------------------
#
	$forum_list = '';

#
#-----[ REPLACE WITH ]------------------------------------------
#
	// Begin Simple Subforums MOD
	$list = array();
	// End Simple Subforums MOD

#
#-----[ FIND ]------------------------------------------
#
	while( $row = $db->sql_fetchrow($result) )
	{

#
#-----[ AFTER, ADD ]------------------------------------------
#
	// Begin Simple Subforums MOD
		$list[] = $row;
	}
	$forum_list = '';
	for( $i = 0; $i < count($list); $i++ )
	{
		if( !$list[$i]['forum_parent'] )
		{
			$row = $list[$i];
			$parent_hidden = true;
	// End Simple Subforums MOD

#
#-----[ FIND ]------------------------------------------
#
				$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>';

#
#-----[ AFTER, ADD ]------------------------------------------
#
			// Begin Simple Subforums MOD
				$parent_hidden = false;
			}
			if ( $is_auth_ary[$row['forum_id']]['auth_read'] )
			{
				$parent_id = $row['forum_id'];
				for($j=0; $j<count($list); $j++)
				{
					$row = $list[$j];
					if( $row['forum_parent'] == $parent_id && $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
					{
						if( $parent_hidden )
						{
							$forum_list .= '<option value="" disabled="disabled">' . $list[$i]['forum_name'] . '</option>';
							$parent_hidden = false;
						}
						$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';
						$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>-- ' . $row['forum_name'] . '</option>';
					}
				}			
			}
			// End Simple Subforums MOD

#

Verfasst: 09.04.2007 00:39
von SemiX
Jetzt ohne mir den MOD genau angeschaut zu haben, ähm... ersetze mal

Code: Alles auswählen

			}
		   	break;

		case 'all topics':
durch

Code: Alles auswählen

			}
    }
		   	break;

		case 'all topics':

Verfasst: 09.04.2007 00:59
von Locou
Hat leider nicht geholfen.
Aber jetzt bekomme ich eine andere Fehlermeldung:

Code: Alles auswählen

Parse error: syntax error, unexpected T_CASE in /usr/export/www/hosting/locou/phpBB2/includes/functions_admin.php on line 148
Dann hab ich mal die Zeile 148 angeschaut.

Code: Alles auswählen

			}
			break;

	  	case 'forum':
Ich habe dann einfach mal noch eine Klammer dazugepackt:

Code: Alles auswählen

			}
}
			break;

	  	case 'forum':
Hat auch geholfen, nur kann ich keine Unterforen erstellen...
es sieht so aus:
BILD

Aber ich könnte ein vorhandenes Forum in ein Subforum verwandeln (jedenfals hab ich die Option dazu):
[ externes Bild ]

Das geht dann aber wieder nicht, weil ich eine Fehlermeldung bekomme:

Code: Alles auswählen

Allgemeiner Fehler
Couldn't update forum 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 '9, forum_desc = 'test', forum_status = 0, prune_enable = 0 WHERE forum_id =' at line 2

UPDATE phpbb_forums SET forum_name = 'test2', cat_id = 5, 9, forum_desc = 'test', forum_status = 0, prune_enable = 0 WHERE forum_id = 13

Line : 537
File : admin_forums.php

Verfasst: 10.04.2007 09:55
von Locou
Kann mir denn keine Helfen? Alle Informationen sind doch da... :(

Verfasst: 11.04.2007 23:36
von SemiX
hm. Hätte ich einen brauchbaren Tipp für dich, so hätte ich ihn längst genannt. Aber ich selber habe weder den XS-Mod installiert noch den Simple Subforums. Wenn ich mir aber so deine Probleme anschaue, dann scheint die ganze Installationsanleitung sowieso nicht ganz koscher so sein. Vergessene Klammern, unvollständige SQL-Abfragen, Input-Felder die fehlen (zumindest scheint es so, als wäre das Template nicht einmal editiert worden)...ein bisschen viel auf einmal, ist die Anleitung überhaupt vollständig? :-? (aktuelle Version)

Verfasst: 12.04.2007 01:39
von Yoshi
Hi,
Hmm.. wenn das deine function_admin ist die du gepostet hast, dann hast du aber die ersten beiden änderungen nicht gemacht. Die hier ist dann erst mal richtig denke ich:

Code: Alles auswählen

<?php
/***************************************************************************
 *                            functions_admin.php
 *                            -------------------
 *   begin                : Saturday, Feb 13, 2001
 *   copyright            : (C) 2001 The phpBB Group
 *   email                : support@phpbb.com
 *
 *   $Id: functions_admin.php,v 1.5.2.5 2005/09/14 19:16:21 acydburn Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 *
 ***************************************************************************/

//
// Simple version of jumpbox, just lists authed forums
//
function make_forum_select($box_name, $ignore_forum = false, $select_forum = '')
{
	global $db, $userdata;

	$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);

	$sql = 'SELECT f.forum_id, f.forum_name, f.forum_parent
		FROM ' . CATEGORIES_TABLE . ' c, ' . FORUMS_TABLE . ' f
		WHERE f.cat_id = c.cat_id 
		ORDER BY c.cat_order, f.forum_order';
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Couldn not obtain forums information', '', __LINE__, __FILE__, $sql);
	}

	// Begin Simple Subforums MOD
	$list = array();
	// End Simple Subforums MOD
	while( $row = $db->sql_fetchrow($result) )
	{	// Begin Simple Subforums MOD
		$list[] = $row;
	}
	 // Begin Simple Subforums MOD 
   $list = array(); 
   // End Simple Subforums MOD
	for( $i = 0; $i < count($list); $i++ )
	{
		if( !$list[$i]['forum_parent'] )
		{
			$row = $list[$i];
			$parent_hidden = true;
	// End Simple Subforums MOD
		if ( $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] )
		{
			$selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : '';
			$forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>' . $row['forum_name'] . '</option>';
         // Begin Simple Subforums MOD 
            $parent_hidden = false; 
         } 
         if ( $is_auth_ary[$row['forum_id']]['auth_read'] ) 
         { 
            $parent_id = $row['forum_id']; 
            for($j=0; $j<count($list); $j++) 
            { 
               $row = $list[$j]; 
               if( $row['forum_parent'] == $parent_id && $is_auth_ary[$row['forum_id']]['auth_read'] && $ignore_forum != $row['forum_id'] ) 
               { 
                  if( $parent_hidden ) 
                  { 
                     $forum_list .= '<option value="" disabled="disabled">' . $list[$i]['forum_name'] . '</option>'; 
                     $parent_hidden = false; 
                  } 
                  $selected = ( $select_forum == $row['forum_id'] ) ? ' selected="selected"' : ''; 
                  $forum_list .= '<option value="' . $row['forum_id'] . '"' . $selected .'>-- ' . $row['forum_name'] . '</option>'; 
               } 
            }          
         } 
         // End Simple Subforums MOD
		}
	}

	$forum_list = ( $forum_list == '' ) ? '<option value="-1">-- ! No Forums ! --</option>' : '<select name="' . $box_name . '">' . $forum_list . '</select>';

	return $forum_list;
}

//
// Synchronise functions for forums/topics
//
function sync($type, $id = false)
{
	global $db;

	switch($type)
	{
		case 'all forums':
			$sql = "SELECT forum_id
				FROM " . FORUMS_TABLE;
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get forum IDs', '', __LINE__, __FILE__, $sql);
			}

			while( $row = $db->sql_fetchrow($result) )
			{
   // Begin Simple Subforums MOD 
      $list[] = $row; 
   } 
   $forum_list = ''; 
   for( $i = 0; $i < count($list); $i++ ) 
   { 
      if( !$list[$i]['forum_parent'] ) 
      { 
         $row = $list[$i]; 
         $parent_hidden = true; 
   // End Simple Subforums MOD      
				sync('forum', $row['forum_id']);
			}
		   	break;

		case 'all topics':
			$sql = "SELECT topic_id
				FROM " . TOPICS_TABLE;
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
			}

			while( $row = $db->sql_fetchrow($result) )
			{	// Begin Simple Subforums MOD
		$list[] = $row;
	}
	$forum_list = '';
	for( $i = 0; $i < count($list); $i++ )
	{
		if( !$list[$i]['forum_parent'] )
		{
			$row = $list[$i];
			$parent_hidden = true;
	// End Simple Subforums MOD
				sync('topic', $row['topic_id']);
			}
			break;

	  	case 'forum':
			$sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total 
				FROM " . POSTS_TABLE . "  
				WHERE forum_id = $id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
			}

			if ( $row = $db->sql_fetchrow($result) )
			{
				$last_post = ( $row['last_post'] ) ? $row['last_post'] : 0;
				$total_posts = ($row['total']) ? $row['total'] : 0;
			}
			else
			{
				$last_post = 0;
				$total_posts = 0;
			}

			$sql = "SELECT COUNT(topic_id) AS total
				FROM " . TOPICS_TABLE . "
				WHERE forum_id = $id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get topic count', '', __LINE__, __FILE__, $sql);
			}

			$total_topics = ( $row = $db->sql_fetchrow($result) ) ? ( ( $row['total'] ) ? $row['total'] : 0 ) : 0;

			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_last_post_id = $last_post, forum_posts = $total_posts, forum_topics = $total_topics
				WHERE forum_id = $id";
			if ( !$db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, 'Could not update forum', '', __LINE__, __FILE__, $sql);
			}
			break;

		case 'topic':
			$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
				FROM " . POSTS_TABLE . "
				WHERE topic_id = $id";
			if ( !($result = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
			}

			if ( $row = $db->sql_fetchrow($result) )
			{
				if ($row['total_posts'])
				{
					// Correct the details of this topic
					$sql = 'UPDATE ' . TOPICS_TABLE . ' 
						SET topic_replies = ' . ($row['total_posts'] - 1) . ', topic_first_post_id = ' . $row['first_post'] . ', topic_last_post_id = ' . $row['last_post'] . "
						WHERE topic_id = $id";

					if (!$db->sql_query($sql))
					{
						message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
					}
				}
				else
				{
					// There are no replies to this topic
					// Check if it is a move stub
					$sql = 'SELECT topic_moved_id 
						FROM ' . TOPICS_TABLE . " 
						WHERE topic_id = $id";

					if (!($result = $db->sql_query($sql)))
					{
						message_die(GENERAL_ERROR, 'Could not get topic ID', '', __LINE__, __FILE__, $sql);
					}

					if ($row = $db->sql_fetchrow($result))
					{
						if (!$row['topic_moved_id'])
						{
							$sql = 'DELETE FROM ' . TOPICS_TABLE . " WHERE topic_id = $id";
			
							if (!$db->sql_query($sql))
							{
								message_die(GENERAL_ERROR, 'Could not remove topic', '', __LINE__, __FILE__, $sql);
							}
						}
					}

					$db->sql_freeresult($result);
				}
			}
			break;
	}
	
	return true;
}

?>