Seite 1 von 1

Simple Subforen-Mod eingebaut= Fehler in der functions_admin

Verfasst: 24.09.2005 10:47
von ShateHunter
Hallo,

Ich habe den Simple Subforen-Mod von http://www.phpbbstyles.com eingebaut, und jetzt ist ein Fehler in der includes/functions_admin.php.

In der Fehlermeldung steht folgendes:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /usr/export/www/vhosts/funnetwork/hosting/shatehunter/phpBB2/includes/functions_admin.php on line 129
Und in der Zeile 129 steht:

Code: Alles auswählen

case 'all topics':
Hier ist mein includes/functions_admin.php:
http://shatehunter.sh.funpic.de/phpBB2/ ... _admin.txt
(Kopieren und in die Browserzeile einfügen)

Sorry, aber (da ich noch ziemlicher PHP-Neuling bin) versteh ich einfach nicht, was an dieser Code-Zeile falsch sein soll.

Außerdem habe ich noch eine Frage zu diesem Mod, und zwar:

Wieso muss man den eXtrem-Styles-Mod installieren, könnte das damit zusammenhängen?

Danke im Vorraus für Antworten.

ShateHunter

Verfasst: 24.09.2005 11:30
von Markus67
Hi ...

da hast du einen Teil 3 x eingebaut ... daher der Fehler ...
ersetze die komplette Datei mit der hier ...

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.3 2002/07/19 17:03:47 psotfx 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 forum_id, forum_name, forum_parent
		FROM " . FORUMS_TABLE . " 
		ORDER BY cat_id, 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;
	}
	$forum_list = '';
	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) )
			{
				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) )
			{
				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) )
			{
				$sql = ( $row['total_posts'] ) ? "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" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = $id";
				if ( !$db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
				}
			}
			break;
	}
	
	return true;
}

?>
Markus

Verfasst: 24.09.2005 11:31
von ShateHunter
Ok, danke

Edit:

Funktioniert! :)