[問題] 簡易子版面安裝問題(已解決)

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

版主: 版主管理群

主題已鎖定
hide99
星球普通子民
星球普通子民
文章: 20
註冊時間: 2003-10-16 21:48

[問題] 簡易子版面安裝問題(已解決)

文章 hide99 »

問題外掛: 簡易子版面1.2版
參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?t=36645
使用版本:phpBB 2.0.8
網站位置:http://www.ponmin.com
狀況描述:



安裝了簡易子版面1.2版
在後台出現了Parse error: parse error, unexpected T_ELSE in /home/ponmin/public_html/phpbb/admin/admin_forums.php on line 616
的錯誤訊息!!


我把程式碼錯誤的地方上下20行貼上來

代碼: 選擇全部

 if($get_sub_Id[id]>0) 
            { 
               message_die(GENERAL_ERROR, "此版面有其他子版面相連,無法?#93;定成子版面"); 
            } 
            $temp=split(",",$forum_set); 
            $c=intval($temp[0]); 
            $forum_sub=intval($temp[1]); 
            if(intval($HTTP_POST_VARS[POST_FORUM_URL])== $forum_sub) 
            { 
               $sort_sub=intval($temp[2]); 
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . $c . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_access = " . intval($HTTP_POST_VARS['forumaccess']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ",forum_sub=".$forum_sub.",sort_sub=".$sort_sub."
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
	} 
         } 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); 
         } 
//forum_sub end 		

               }else 
            { 
               if(intval($temp[1])>0) 
               { 
                  $sort_sub=intval($temp[2])+1; 
               }else 
               { 
                  $sort_sub=intval($temp[2]); 
               } 

                                                if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
			}

			if( $HTTP_POST_VARS['prune_enable'] == 1 )
			{
				if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
				{
					message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
				}

				$sql = "SELECT *
另外提供整個admin_forums.php檔案下載
http://www.ponmin.com/admin_forums.rar

懇求大大幫助我..
最後由 hide99 於 2005-09-30 23:27 編輯,總共編輯了 3 次。
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

查看您的 admin_forums.php
發現您在 $sql 的部分原來已經有新增兩個值( forum_icon, forum_access),
而針對簡易子版面外掛, 您在該處增值( forum_sub, sort_sub, main_sub) 的語法, 顯得有些錯亂.
以下的修改, 提供您參考:
#
#-----[ FIND ]-----
#

代碼: 選擇全部

			$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_icon, forum_access, prune_enable,forum_sub,sort_sub" . $field_sql . ")
				VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', " . intval($HTTP_POST_VARS['forumaccess']) . ", " . intval($HTTP_POST_VARS['prune_enable']). ", " .$forum_sub.",".$sort_sub."," . $value_sql . ")";
#
#-----[ REPLACE WITH ]-----
#
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, forum_sub, sort_sub, main_sub, forum_icon, forum_access, prune_enable " . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . $c . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . $forum_sub . ", " . $sort_sub . ", " . $main_sub . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', " . intval($HTTP_POST_VARS['forumaccess']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
#
#-----[ FIND ]-----
#

代碼: 選擇全部

                                                //forum_sub start 
         $forum_set=$HTTP_POST_VARS[POST_CAT_URL]; 
         if(empty($forum_set)) 
         { 
            message_die(GENERAL_ERROR, "?#93;定錯誤"); 
         } 
         else 
         { 
            $sql = "select count(forum_sub) as id from " . FORUMS_TABLE . " WHERE forum_sub = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
            if( !$result = $db->sql_query($sql) ) 
            { 
               message_die(GENERAL_ERROR, "?#93;定錯誤"); 
            } 
            $get_sub_Id = $db->sql_fetchrow($result); 
            if($get_sub_Id[id]>0) 
            { 
               message_die(GENERAL_ERROR, "此版面有其他子版面相連,無法?#93;定成子版面"); 
            } 
            $temp=split(",",$forum_set); 
            $c=intval($temp[0]); 
            $forum_sub=intval($temp[1]); 
            if(intval($HTTP_POST_VARS[POST_FORUM_URL])== $forum_sub) 
            { 
               $sort_sub=intval($temp[2]); 
			$sql = "UPDATE " . FORUMS_TABLE . "
				SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . $c . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_access = " . intval($HTTP_POST_VARS['forumaccess']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ",forum_sub=".$forum_sub.",sort_sub=".$sort_sub."
				WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
	} 
         } 
         if( !$result = $db->sql_query($sql) ) 
         { 
            message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); 
         } 
//forum_sub end 		

               }else 
            { 
               if(intval($temp[1])>0) 
               { 
                  $sort_sub=intval($temp[2])+1; 
               }else 
               { 
                  $sort_sub=intval($temp[2]); 
               } 
#
#-----[ REPLACE WITH ]-----
#
//forum_sub start
$forum_set=$HTTP_POST_VARS[POST_CAT_URL];
if(empty($forum_set))
{
message_die(GENERAL_ERROR, "設定錯誤");
}
else
{
$sql = "select count(forum_sub) as id from " . FORUMS_TABLE . " WHERE forum_sub = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "設定錯誤");
}
$get_sub_Id = $db->sql_fetchrow($result);
if($get_sub_Id[id]>0)
{
message_die(GENERAL_ERROR, "此版面有其他子版面相連,無法設定成子版面");
}
$temp=split(",",$forum_set);
$c=intval($temp[0]);
$forum_sub=intval($temp[1]);
$HTTP_POST_VARS['forumname']=str_replace("<","",$HTTP_POST_VARS['forumname']);
$HTTP_POST_VARS['forumdesc']=str_replace("<","",$HTTP_POST_VARS['forumdesc']);
if(intval($HTTP_POST_VARS[POST_FORUM_URL])== $forum_sub)
{
$sort_sub=intval($temp[2]);
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_access = " . intval($HTTP_POST_VARS['forumaccess']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
}else
{
if(intval($temp[1])>0)
{
$sort_sub=intval($temp[2])+1;
}else
{
$sort_sub=intval($temp[2]);
}
$main_sub=intval($temp[3]);
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . $c . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_access = " . intval($HTTP_POST_VARS['forumaccess']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ",forum_sub=".$forum_sub.",sort_sub=".$sort_sub.",main_sub=".$main_sub."
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
}
}
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
}
//forum_sub end
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
hide99
星球普通子民
星球普通子民
文章: 20
註冊時間: 2003-10-16 21:48

文章 hide99 »

感謝大大的指正...


不過現在錯誤卻跳到 }else 這一行了

似乎多了個 }....
:-|

代碼: 選擇全部

 //forum_sub start 
$forum_set=$HTTP_POST_VARS[POST_CAT_URL]; 
if(empty($forum_set)) 
{ 
message_die(GENERAL_ERROR, "?#93;定錯誤"); 
} 
else 
{ 
$sql = "select count(forum_sub) as id from " . FORUMS_TABLE . " WHERE forum_sub = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
if( !$result = $db->sql_query($sql) ) 
{ 
message_die(GENERAL_ERROR, "?#93;定錯誤"); 
} 
$get_sub_Id = $db->sql_fetchrow($result); 
if($get_sub_Id[id]>0) 
{ 
message_die(GENERAL_ERROR, "此版面有其他子版面相連,無法?#93;定成子版面"); 
} 
$temp=split(",",$forum_set); 
$c=intval($temp[0]); 
$forum_sub=intval($temp[1]); 
$HTTP_POST_VARS['forumname']=str_replace("<","",$HTTP_POST_VARS['forumname']); 
$HTTP_POST_VARS['forumdesc']=str_replace("<","",$HTTP_POST_VARS['forumdesc']); 
if(intval($HTTP_POST_VARS[POST_FORUM_URL])== $forum_sub) 
{ 
$sort_sub=intval($temp[2]); 
$sql = "UPDATE " . FORUMS_TABLE . " 
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_access = " . intval($HTTP_POST_VARS['forumaccess']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . " 
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
}else 
{ 
if(intval($temp[1])>0) 
{ 
$sort_sub=intval($temp[2])+1; 
}else 
{ 
$sort_sub=intval($temp[2]); 
} 
$main_sub=intval($temp[3]); 
$sql = "UPDATE " . FORUMS_TABLE . " 
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . $c . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_access = " . intval($HTTP_POST_VARS['forumaccess']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . ",forum_sub=".$forum_sub.",sort_sub=".$sort_sub.",main_sub=".$main_sub." 
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]); 
} 
} 
if( !$result = $db->sql_query($sql) ) 
{ 
message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql); 
} 

//forum_sub end 

}else   //錯誤出?#123;在這個地方!!!!!!!!!!!
            
{ 
               if(intval($temp[1])>0) 
               { 
                  $sort_sub=intval($temp[2])+1; 
               }else 
               { 
                  $sort_sub=intval($temp[2]); 
               } 

                                                if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't update forum information", "", __LINE__, __FILE__, $sql);
			}

			if( $HTTP_POST_VARS['prune_enable'] == 1 )
			{
				if( $HTTP_POST_VARS['prune_days'] == "" || $HTTP_POST_VARS['prune_freq'] == "" )
				{
					message_die(GENERAL_MESSAGE, $lang['Set_prune_data']);
				}

				$sql = "SELECT *
					FROM " . PRUNE_TABLE . "
					WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't get forum Prune Information","",__LINE__, __FILE__, $sql);
				}

				if( $db->sql_numrows($result) > 0 )
				{
					$sql = "UPDATE " . PRUNE_TABLE . "
						SET	prune_days = " . intval($HTTP_POST_VARS['prune_days']) . ",	prune_freq = " . intval($HTTP_POST_VARS['prune_freq']) . "
				 		WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
				}
				else
				{
					$sql = "INSERT INTO " . PRUNE_TABLE . " (forum_id, prune_days, prune_freq)
						VALUES(" . intval($HTTP_POST_VARS[POST_FORUM_URL]) . ", " . intval($HTTP_POST_VARS['prune_days']) . ", " . intval($HTTP_POST_VARS['prune_freq']) . ")";
				}

				if( !$result = $db->sql_query($sql) )
				{
					message_die(GENERAL_ERROR, "Couldn't Update Forum Prune Information","",__LINE__, __FILE__, $sql);
				}
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;
			
		case 'addcat':
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

To hide99:

我的建議修正裡頭, 應該是已經將該處( 紅字)移走了吧! :-?
//forum_sub end

}else

{
if(intval($temp[1])>0)
{
$sort_sub=intval($temp[2])+1;
}else
{
$sort_sub=intval($temp[2]);
}

if( !$result = $db->sql_query($sql) )
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
hide99
星球普通子民
星球普通子民
文章: 20
註冊時間: 2003-10-16 21:48

文章 hide99 »

終於解決了!!!


感謝心靈捕手大大...
多日的苦惱啊......
hide99
星球普通子民
星球普通子民
文章: 20
註冊時間: 2003-10-16 21:48

文章 hide99 »

剛剛有版主來回應
設定精華 置頂 或是移動文章等功能\r
都會出現Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ponmin/public_html/phpbb/modcp.php on line 959


可是我剛剛仔細檢查當時裝modcp.php有沒有遺漏或是錯誤
卻沒有呀....

該怎辦??
我順到把modcp語法貼上來好了
if( ( $total_posts = $db->sql_numrows($result) ) > 0 )
{
$postrow = $db->sql_fetchrowset($result);

$template->assign_vars(array(
'L_SPLIT_TOPIC' => $lang['Split_Topic'],
'L_SPLIT_TOPIC_EXPLAIN' => $lang['Split_Topic_explain'],
'L_AUTHOR' => $lang['Author'],
'L_MESSAGE' => $lang['Message'],
'L_SELECT' => $lang['Select'],
'L_SPLIT_SUBJECT' => $lang['Split_title'],
'L_SPLIT_FORUM' => $lang['Split_forum'],
'L_POSTED' => $lang['Posted'],
'L_SPLIT_POSTS' => $lang['Split_posts'],
'L_SUBMIT' => $lang['Submit'],
'L_SPLIT_AFTER' => $lang['Split_after'],
'L_POST_SUBJECT' => $lang['Post_subject'],
'L_MARK_ALL' => $lang['Mark_all'],
'L_UNMARK_ALL' => $lang['Unmark_all'],
'L_POST' => $lang['Post'],

'FORUM_NAME' => $forum_name,
'FORUM_PATH' => $forum_path,
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"),

'S_SPLIT_ACTION' => append_sid("modcp.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_FORUM_SELECT' => make_forum_select("new_forum_id", false, $forum_id))
'S_FORUM_SELECT_NAME' => '<select name="new_forum_id">', );錯誤的行數\r

//
// Define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);

for($i = 0; $i < $total_posts; $i++)
{
$post_id = $postrow[$i]['post_id'];
$poster_id = $postrow[$i]['poster_id'];
$poster = $postrow[$i]['username'];

$post_date = create_date('Y-m-d G:i', $postrow[$i]['post_time'], $board_config['board_timezone']);

$bbcode_uid = $postrow[$i]['bbcode_uid'];
$message = $postrow[$i]['post_text'];
$post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : $topic_title;

//
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
//
if ( !$board_config['allow_html'] )
{
if ( $postrow[$i]['enable_html'] )
{
$message = preg_replace('#(<)([\/]?.*?)(>)#is', '<\\\2>', $message);
}
}

if ( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
}

if ( count($orig_word) )
{
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
$message = preg_replace($orig_word, $replacement_word, $message);
hide99
星球普通子民
星球普通子民
文章: 20
註冊時間: 2003-10-16 21:48

文章 hide99 »

已解決\r

鋼在貼文章時

才發現\r

位置放錯了....真是不細心

下次我會檢查好 在上來的XD!!
主題已鎖定

回到「外掛問題討論」