[問題] 裝了Excerption 1,search.php 不能使用了

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
AL37
星球普通子民
星球普通子民
文章: 18
註冊時間: 2005-07-29 16:25

[問題] 裝了Excerption 1,search.php 不能使用了

文章 AL37 »

問題外掛:Excerption 1
參考連結: http://phpbb-tw.net/phpbb/viewtopic.php?t=33720
使用版本:phpBB 2.0.17
網站位置:localhost

小弟安裝 Excerption 1 時

當加了以下字句時

Search.php 就出錯了

被加的字句:

代碼: 選擇全部

#------------Action: Open search.php------------------------
#------------Action: Find-----------------------------------
			{
				if ( $userdata['session_logged_in'] )
				{
					$sql = "SELECT post_id 
						FROM " . POSTS_TABLE . " 
						WHERE poster_id = " . $userdata['user_id'];;
				}
				else
				{
					header("Location: login.$phpEx?redirect=search&search_id=egosearch");
					exit;
				}

				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
#------------Action: Add After-----------------------------
//Excerption Mod by Howard
			else if ( $search_id == 'excerption' )
			{
				if ( $userdata['session_logged_in'] )
				{
				$sql = "SELECT p.post_id 
					FROM " . TOPICS_TABLE . "  t, " . POSTS_TABLE . " p  
					WHERE t.topic_excerption = 1 AND p.topic_id=t.topic_id
						AND topic_moved_id = 0";
				}
				else
				{
					header("Location: login.$phpEx?redirect=search&search_id=excerption");
					exit;
				}
				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
			else if ( $search_id == 'excerption_forum' )
			{
				if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
				{
					$forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
				}
				else if( isset($HTTP_GET_VARS['forum']))
				{
					$forum_id = $HTTP_GET_VARS['forum'];
				}
				if ( $userdata['session_logged_in'] )
				{
				$sql = "SELECT p.post_id 
					FROM " . TOPICS_TABLE . "  t, " . POSTS_TABLE . " p  
					WHERE t.topic_excerption = 1 AND p.topic_id=t.topic_id
						AND t.forum_id=$forum_id AND topic_moved_id = 0";
				}
				else
				{
					header("Location: login.$phpEx?redirect=search&search_id=excerption_forum");
					exit;
				}

				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
//Excerption Mod end
出錯字碼\r

代碼: 選擇全部

Parse error: parse error, unexpected T_ELSE in c:\appserv\www\php3\search.php on line 181
附:

代碼: 選擇全部

######################################################## 
## Mod Title: Topic Excerption 
## Mod Version: 1.0.0 for RC4 03/22/2002
## Author: Howard Wang 
## Description: Allow admin/moderator set a topic in/out 
                excerption when viewing topic and in moderator 
                control pannel. And registered users can watch
                excerption topics of the site in index page and 
                watch excerption topics of forums after entering
                a forum.
## 
## Installation Level: easy 
## Installation Time: 3~4 Minutes 
## Files To Edit: 9 (5 files & 4 templates) 
## New gif file: $current_template_images/folder_excerption.gif
#########################################################
#
#------------Atcion: Modify table structure of topics-------
ALTER TABLE phpbb_topics ADD topic_excerption TINYINT not null after topic_status
#

#
#------------Action: Open /includes/pageheader.php----------
#------------Action: Find-----------------------------------
	"L_SEARCH_NEW" => $lang['Search_new'],
#------------Action: Add After------------------------------
//excerption Mod by Howard
	"L_SEARCH_EXCERPTION" => $lang['Search_excerption'],
	"L_SEARCH_EXCERPTION_FORUM" => $lang['Search_excerption_forum'],
//excerption Mod by Howard

#------------Action: Find-----------------------------------
	"U_SEARCH_NEW" => append_sid("search.$phpEx?search_id=newposts"),
#------------Action: Add After------------------------------
//excerption Mod by Howard
	"U_SEARCH_EXCERPTION" => append_sid("search.".$phpEx."?search_id=excerption"),
//excerption Mod end
#------------Action: Save and close page_header.php---------

#
#------------Action: Open viewforum.php---------------------
#------------Action: Find-----------------------------------
"U_MARK_READ" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics"))
#------------Action: Add Before-----------------------------
//Excerption Mod by Howard
	"U_SEARCH_EXCERPTION_FORUM" => append_sid("search.$phpEx?search_id=excerption_forum&". POST_FORUM_URL . "=$forum_id"),
//Excerption Mod end

#------------ACTION: Find-----------------------------------
$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
#------------ACTION: Add after------------------------------
//Excerption Mod by Howard
		if ($topic_rowset[$i]['topic_excerption'] == 1)	
		{
			$topic_title .= "<font color=red >[精華]</font>";
		}
//Excerption Mod end
#------------Action: Save and Close viewforum.php-----------

#
#------------Action: Open search.php------------------------
#------------ACTION: Find-----------------------------------
	if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_keywords != '' || $search_author != '' )
	{
		if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ))
#------------Action: Replace with---------------------------
	if ( $search_id == 'newposts' || $search_id == 'egosearch' || $search_id == 'unanswered' || $search_id == "excerption" || $search_id == "excerption_forum"|| $search_keywords != '' || $search_author != '' )
	{
		if ( $search_id == 'newposts' || $search_id == 'egosearch' || ( $search_author != '' && $search_keywords == '' ) || $search_id == "excerption" || $search_id == "excerption_forum")		
#------------Action: Find-----------------------------------
			{
				if ( $userdata['session_logged_in'] )
				{
					$sql = "SELECT post_id 
						FROM " . POSTS_TABLE . " 
						WHERE poster_id = " . $userdata['user_id'];;
				}
				else
				{
					header("Location: login.$phpEx?redirect=search&search_id=egosearch");
					exit;
				}

				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
#------------Action: Add After-----------------------------
//Excerption Mod by Howard
			else if ( $search_id == 'excerption' )
			{
				if ( $userdata['session_logged_in'] )
				{
				$sql = "SELECT p.post_id 
					FROM " . TOPICS_TABLE . "  t, " . POSTS_TABLE . " p  
					WHERE t.topic_excerption = 1 AND p.topic_id=t.topic_id
						AND topic_moved_id = 0";
				}
				else
				{
					header("Location: login.$phpEx?redirect=search&search_id=excerption");
					exit;
				}
				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
			else if ( $search_id == 'excerption_forum' )
			{
				if( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
				{
					$forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
				}
				else if( isset($HTTP_GET_VARS['forum']))
				{
					$forum_id = $HTTP_GET_VARS['forum'];
				}
				if ( $userdata['session_logged_in'] )
				{
				$sql = "SELECT p.post_id 
					FROM " . TOPICS_TABLE . "  t, " . POSTS_TABLE . " p  
					WHERE t.topic_excerption = 1 AND p.topic_id=t.topic_id
						AND t.forum_id=$forum_id AND topic_moved_id = 0";
				}
				else
				{
					header("Location: login.$phpEx?redirect=search&search_id=excerption_forum");
					exit;
				}

				$show_results = 'topics';
				$sort_by = 0;
				$sort_dir = 'DESC';
			}
//Excerption Mod end
#------------Action: Save and Close search.php-------------

#
#-------------ACTION: Open modcp.php-----------------------
#-------------ACTION: Find---------------------------------
$lock = ( isset($HTTP_POST_VARS['lock']) ) ? TRUE : FALSE;
$unlock = ( isset($HTTP_POST_VARS['unlock']) ) ? TRUE : FALSE;
#-------------ACTION: Add After----------------------------
//Excerption Mod by Howard
$excerption = (isset($HTTP_POST_VARS['excerption'])) ? TRUE : FALSE;
$unexcerption = (isset($HTTP_POST_VARS['unexcerption'])) ? TRUE : FALSE;
//Excerption Mod end

#-------------ACTION: Find---------------------------------
	else if($unlock)
	{
		$mode = 'unlock';
	}
#-------------ACTION: Add After----------------------------
//Excerption Mod By Howard
	else if($excerption)
	{
		$mode = 'excerption';
	}
	else if($unexcerption)
	{
		$mode = 'unexcerption';
	}
//Excerption Mod end

#-------------ACTION: Find---------------------------------
		$message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');

		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
		);

		message_die(GENERAL_MESSAGE, $lang['Topics_Unlocked'] . '<br /><br />' . $message);

		break;
#-------------ACTION: Add After----------------------------
//Excerption Mod by Howard 
   case 'excerption': 
      $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ?  $HTTP_POST_VARS['topic_id_list'] : array($topic_id); 

      $topic_id_sql = ""; 
      for($i = 0; $i < count($topics); $i++) 
      { 
         if( $topic_id_sql != "") 
         { 
            $topic_id_sql .= ", "; 
         } 
         $topic_id_sql .= $topics[$i]; 
      } 

      $sql = "UPDATE " . TOPICS_TABLE . " 
         SET topic_excerption = 1 
         WHERE topic_id IN ($topic_id_sql) 
            AND topic_moved_id = 0"; 
      if( !$result = $db->sql_query($sql) ) 
      { 
         message_die(GENERAL_ERROR, "Could not update topics table!", "Error", __LINE__, __FILE__, $sql); 
      } 

      if( !empty($topic_id) ) 
      { 
         $redirect_page = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id']; 
         $message = sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>'); 
      } 
      else 
      { 
         $redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id']; 
         $message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); 
      } 

      $message = $message . "<br \><br \>" . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); 

      $template->assign_vars(array( 
         "META" => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 
      ); 

      message_die(GENERAL_MESSAGE, $lang['Topics_Excerption'] . "<br /><br />" . $message); 

      break; 

   case 'unexcerption': 
      $topics = ( isset($HTTP_POST_VARS['topic_id_list']) ) ?  $HTTP_POST_VARS['topic_id_list'] : array($topic_id); 

      $topic_id_sql = ""; 
      for($i = 0; $i < count($topics); $i++) 
      { 
         if( $topic_id_sql != "") 
         { 
            $topic_id_sql .= ", "; 
         } 
         $topic_id_sql .= $topics[$i]; 
      } 

      $sql = "UPDATE " . TOPICS_TABLE . " 
         SET topic_excerption = 0 
         WHERE topic_id IN ($topic_id_sql) 
            AND topic_moved_id = 0"; 
      if( !$result = $db->sql_query($sql) ) 
      { 
         message_die(GENERAL_ERROR, "Could not update topics table!", "Error", __LINE__, __FILE__, $sql); 
      } 

      if( !empty($topic_id) ) 
      { 
         $redirect_page = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id']; 
         $message = sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>'); 
      } 
      else 
      { 
         $redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id']; 
         $message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>'); 
      } 

      $message = $message . "<br \><br \>" . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); 

      $template->assign_vars(array( 
         "META" => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">') 
      ); 

      message_die(GENERAL_MESSAGE, $lang['Topics_Unexcerption'] . "<br /><br />" . $message); 

      break; 
//Excerption Mod end
#-------------ACTION: Find---------------------------------
			if ( $row['topic_vote'] )
			{
				$topic_type .= $lang['Topic_Poll'] . ' ';
			}
	
			$topic_title = $row['topic_title'];
			if ( count($orig_word) )
			{
				$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
			}
#-------------Action: Add After----------------------------
			if ($row['topic_excerption'] == 1)
			{
				$topic_title .= "<font color=red>[精華]</font>";
			}

#-------------ACTION: Find---------------------------------
			'L_LOCK' => $lang['Lock'],
			'L_UNLOCK' => $lang['Unlock'],
#-------------ACTION: Add after----------------------------
//Excerption Mod by Howard
			"L_EXCERPTION" => $lang['Excerption'],
			"L_UNEXCERPTION" => $lang['Unexcerption'],
//Excerption Mod end
#------------Action: Save and Close modcp.php--------------

#
#-------------ACTION: Open Viewtopic.php-------------------
#-------------ACTION: Find---------------------------------
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . " 
	WHERE $join_sql
		AND f.forum_id = t.forum_id
		$order_sql";
#-------------Action: Replace with-------------------------
$sql = "SELECT t.topic_id, t.topic_excerption, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
	FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . " 
	WHERE $join_sql
		AND f.forum_id = t.forum_id
		$order_sql";

#-------------Action: Find---------------------------------
	$topic_mod .= ( $forum_row['topic_status'] == TOPIC_UNLOCKED ) ? '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock") . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a>&nbsp;' : '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock") . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a>&nbsp;';
#-------------ACTION: Add after----------------------
//Excerption Mod by Howard 
   $topic_mod .= ( $forum_topic_data['topic_excerption'] == 0 ) ? "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=excerption&sid=" . $userdata['session_id'] . '"><img src="' . $images['folder_excerption'] . '" alt="' . $lang['Excerption_topic'] . '" title="' . $lang['Excerption_topic'] . '" border="0" /></a> ' : "<a href=\"modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unexcerption&sid=" . $userdata['session_id'] . '"><img src="' . $images['folder'] . '" alt="' . $lang['Unexcerption_topic'] . '" title="' . $lang['Unexcerption_topic'] . '" border="0" /></a> '; 
//Excerption Mod end
#------------Action: Save and Close viewtopic.php----------


#
#-------------ACTION: Open lang_main.php-------------------
#-------------ACTION: Find---------------------------------
$lang['Search_unanswered'] = "View unanswered posts";
#-------------ACTION: Add after----------------------------
$lang['Search_excerption'] = "本站精華區";
$lang['Search_excerption_forum'] = "本區精華區";

#-------------ACTION: Find---------------------------------
$lang['Lock_topic'] = "Lock this topic";
$lang['Unlock_topic'] = "Unlock this topic";
#-------------ACTION: Add after----------------------------
$lang['Excerption_topic'] = "?#91;入精華區";
$lang['Unexcerption_topic'] = "從精華區刪除";

#-------------ACTION: Find---------------------------------
$lang['Lock'] = "Lock";
$lang['Unlock'] = "Unlock";
#-------------ACTION: Add after----------------------------
$lang['Excerption'] = "?#91;入精華區";
$lang['Unexcerption'] = "從精華區刪除";
#------------Action: Save and Close lang_main.php----------

#-------------ACTION: index.tpl----------------------------
#-------------ACTION: Find---------------------------------
<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a>
#-------------ACTION: Add before---------------------------
<a href="{U_SEARCH_EXCERPTION}" class="gentit">{L_SEARCH_EXCERPTION}</a><br />
#------------Action: Save and Close index.tpl--------------

#-------------ACTION: Open modcp_body.tpl------------------
#-------------ACTION: Find---------------------------------
		<input type="submit" name="lock" class="liteoption" value="{L_LOCK}" />
		&nbsp; 
		<input type="submit" name="unlock" class="liteoption" value="{L_UNLOCK}" />
#-------------ACTION: Add after----------------------------
		&nbsp; 
		<input type="submit" name="excerption" class="liteoption" value="{L_EXCERPTION}" />
		&nbsp; 
		<input type="submit" name="unexcerption" class="liteoption" value="{L_UNEXCERPTION}" />
#------------Action: Save and Close modcp_body.tpl---------

#-------------ACTION: Open viewforum_body.tpl--------------
#-------------ACTION: Find---------------------------------
<a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a>
#------------Action: Replace with -------------------------
	  <!-- BEGIN switch_user_logged_in -->
	  <a href="{U_SEARCH_EXCERPTION_FORUM}">{L_SEARCH_EXCERPTION_FORUM}</a>|
	  <!-- END switch_user_logged_in -->
	  <a href="{U_MARK_READ}">{L_MARK_TOPICS_READ}</a>
#------------Action: Save and Close viewforum_body.tpl-----

#-------------ACTION: Open yourtemplate.cfg----------------
#-------------ACTION: Find---------------------------------
$images['folder_sticky'] = "$current_template_images/folder_sticky.gif";
#-------------ACTION: Add after----------------------------
$images['folder_excerption'] = "$current_template_images/folder_excerption.gif";
#-------------ACTION: Save and close yourtemplate.cfg------
感謝各位幫忙!
最後由 AL37 於 2005-08-29 22:48 編輯,總共編輯了 1 次。
~倉木麻衣~
竹貓忠實會員
竹貓忠實會員
文章: 1405
註冊時間: 2004-03-21 21:00

文章 ~倉木麻衣~ »

  1. 張貼整個外掛的安裝內容並不會有助於問題的解決, 請附上重點資訊即可\r
  2. 標題麻煩請簡明扼要
  3. 儘量提供問題外掛的參考連結
  4. 建議你再檢查一下是否將外掛要求修改的位置弄錯, 或是附上附近上下10行左右的內容, 亦或是將該檔存成txt檔(或壓縮檔)供其它人下載回去檢查
謝絕所有私人訊息詢問外掛相關問題
有問題請直接於版上發表, 集思廣議絕對比專挑特定人士詢問來的好

竹貓禁止發表含破解相關的軟體, 違者砍文
不要跟我講別的地方都可以發, 為什麼竹貓就不行
免費不等於破解, 傻傻的搞不清楚
AL37
星球普通子民
星球普通子民
文章: 18
註冊時間: 2005-07-29 16:25

文章 AL37 »

~倉木麻衣~ 寫:
  1. 張貼整個外掛的安裝內容並不會有助於問題的解決, 請附上重點資訊即可\r
  2. 標題麻煩請簡明扼要
  3. 儘量提供問題外掛的參考連結
  4. 建議你再檢查一下是否將外掛要求修改的位置弄錯, 或是附上附近上下10行左右的內容, 亦或是將該檔存成txt檔(或壓縮檔)供其它人下載回去檢查
已修正\r\n
對於之前對大家做成的不便,小弟深感抱歉

另附:search.php

http://www.smallcampus.net/member_files ... search.txt
~倉木麻衣~
竹貓忠實會員
竹貓忠實會員
文章: 1405
註冊時間: 2004-03-21 21:00

文章 ~倉木麻衣~ »

很明顯的, 你改錯位置了
$sort_dir = 'DESC';
//Excerption Mod by Howard
else if ( $search_id == 'excerption' )

{
安裝文件是要你在這段底下加入程式碼, 請自行比較一下上頭及底下用紅字標示的部份
$show_results = 'topics';
$sort_by = 0;
$sort_dir = 'DESC';
}
謝絕所有私人訊息詢問外掛相關問題
有問題請直接於版上發表, 集思廣議絕對比專挑特定人士詢問來的好

竹貓禁止發表含破解相關的軟體, 違者砍文
不要跟我講別的地方都可以發, 為什麼竹貓就不行
免費不等於破解, 傻傻的搞不清楚
主題已鎖定

回到「外掛問題討論」