2012年1月4日 星期三

[研究] phpbb 3.0.10 安裝TOP5模組(Integrated Topiclist 2.0 beta)

[研究] phpbb 3.0.10 安裝TOP5模組(Integrated Topiclist 2.0 beta)

本篇是接續

[研究] phpbb 3.0.10 快速安裝程式 (CentOS 6.2 x86)
http://shaurong.blogspot.com/2012/01/phpbb-3.html
[研究] phpbb 3.0.10 安裝RSS模組(simple syndication 1.1.1b)
http://shaurong.blogspot.com/2012/01/phpbb-3010-rsssimple-syndication-111b.html


Integrated Topiclist 2.0 beta下載
http://phpbb-tw.net/phpbb/viewtopic.php?f=134&t=50165
http://phpbb-tw.net/phpbb/download/file.php?id=11

IT2.rar這個模組的缺點是只支援subsilver2,不支援prosilver。所以 phpbb 需要先將風格從預設的 prosilver 切換為 subsilver2







安裝步驟如下(這個寫快速安裝程式會累死):

打開 

代碼:
index.php

找到 

代碼:
// Assign index specific vars

在後面加入

代碼:
//
// Integrated Topiclist v 2.0 START
// 

// Topics text length
$MAX_STR_LEN = 40;
   
// Topics to display (Default: 5)
$MAX_TOPICS = 5;
   
// Order by
// topic_last_post_id (Default)
// topic_replies
// topic_views
$sortby="topic_last_post_id";

//
// Option of Toplist End
//

function cutStr($str) {
   global $MAX_STR_LEN;
   $str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
   return $str;


$raw_auth_forums = $auth->acl_getf('f_read');

$auth_forums = array();

while(list($k,$v)=each($raw_auth_forums)) if($v['f_read'] == 1) $auth_forums[] =$k;

$auth_forums_sql = implode(',',$auth_forums);

$sql_array['SELECT'] = array('t.topic_id','t.topic_replies','t.topic_views','t.forum_id','f.forum_name','t.topic_title','t.topic_first_poster_colour','t.topic_first_poster_name','t.topic_last_poster_id','t.topic_last_post_id','t.topic_last_poster_name','t.topic_last_poster_colour','t.topic_last_post_time','t.topic_poster');
$sql_array['FROM'] = array(TOPICS_TABLE      => 't',FORUMS_TABLE => 'f');

// SQL array for obtaining topics/stickies
$sql_array = array(
   'SELECT'      => implode(',',$sql_array['SELECT']),
   'FROM'         =>  $sql_array['FROM'],
   'WHERE'         => ' t.forum_id IN ('.$auth_forums_sql .') AND f.forum_id = t.forum_id',
   'ORDER_BY'      => 't.'.$sortby.' DESC'
);

$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query_limit($sql, $MAX_TOPICS, 0);

while ($row = $db->sql_fetchrow($result))
{
      $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $row['topic_id']);
      
      $template->assign_block_vars('topiclist', array(
            'TOPIC_TITLE' => cutStr($row['topic_title']),
            'FORUM_NAME' => $row['forum_name'],
            'FORUM_ID' => $row['forum_id'],
            
            'LAST_REPLY_TIME' => $user->format_date($row['topic_last_post_time']),
            'LAST_REPLYER' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
            
            'U_LAST_POST_POSTER'   => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
            
            'U_TOPIC_POSTER'      => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
            'TOPIC_REPLIES' => $row['topic_replies'],
            'TOPIC_VIEWS' => $row['topic_views'],
            'U_LAST_POST'         => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
            
            'TOPIC_POSTER' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
            
            'FORUM_ID' => $row['forum_id'],
            
            'FORUM_URL' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
            'TOPIC_URL'  => $view_topic_url
         )
      );
}
$db->sql_freeresult($result);
//
// Integrated Topiclist V 2.0 END
//


然後請打開

代碼:
styles/subsilver2/template/index_body.html

找到

代碼:
<!-- INCLUDE overall_footer.html -->

在其前加上
(原來版本)

代碼:
<!-- MOD: Integrated Topiclist 2.0 START -->
   <br clear="all" />
   <br>
   <table class="tablebg" width="95%" cellspacing="1">
      <tr>
         <th width="20%">&nbsp;{L_FORUM}&nbsp;</th>
         <th width="30%">&nbsp;{L_TOPICS}&nbsp;</th>
         <th width="20%">&nbsp;{L_AUTHOR}&nbsp;</th>
         <th width="5%">&nbsp;{L_REPLIES}&nbsp;</th>
         <th width="5%">&nbsp;{L_VIEWS}&nbsp;</th>
         <th width="20%">&nbsp;{L_LAST_POST}&nbsp;</th>
      </tr>
<!-- BEGIN topiclist -->
      <tr>
         <td class="row1" align="center"><a class="forumlink" href="{topiclist.FORUM_URL}">{topiclist.FORUM_NAME}</a></td>
         <td class="row2" align="center"><a href="{topiclist.TOPIC_URL}" class="topictitle">{topiclist.TOPIC_TITLE}</a></td>
         <td class="row1" align="center"><p class="topiclist"><a href="{topiclist.U_TOPIC_POSTER}">{topiclist.TOPIC_POSTER}</a></p></td>
         <td class="row2" align="center">{topiclist.TOPIC_REPLIES}</td>
         <td class="row1" align="center">{topiclist.TOPIC_VIEWS}</td>
         <td class="row2" align="center">{topiclist.LAST_REPLY_TIME}<br />{topiclist.LAST_REPLYER}<a href="{topiclist.U_LAST_POST}">{LAST_POST_IMG}</a></td>
      </tr>
<!-- END topiclist -->
   </table>
   <br>
<!-- MOD: Integrated Topiclist 2.0 END -->


(小弟的改良版本)

代碼:
<!-- MOD: Integrated Topiclist 2.0 START -->
   <br clear="all" />
   
   <table class="tablebg" width="100%" cellspacing="1">
      <tr>
         <th>&nbsp;{L_FORUM}&nbsp;</th>
         <th>&nbsp;{L_TOPICS}&nbsp;</th>
         <th>&nbsp;{L_AUTHOR}&nbsp;</th>
         <th>&nbsp;{L_REPLIES}&nbsp;</th>
         <th>&nbsp;{L_VIEWS}&nbsp;</th>
         <th>&nbsp;{L_LAST_POST}&nbsp;</th>
      </tr>
<!-- BEGIN topiclist -->
      <tr>
         <td class="row1" align="left"><a class="forumlink" href="{topiclist.FORUM_URL}">{topiclist.FORUM_NAME}</a></td>
         <td class="row2" align="left"><a href="{topiclist.TOPIC_URL}" class="topictitle">{topiclist.TOPIC_TITLE}</a></td>
         <td class="row1" align="left"><p class="topiclist"><a href="{topiclist.U_TOPIC_POSTER}">{topiclist.TOPIC_POSTER}</a></p></td>
         <td class="row2" align="left">{topiclist.TOPIC_REPLIES}</td>
         <td class="row1" align="left">{topiclist.TOPIC_VIEWS}</td>
         <td class="row2" align="left">{topiclist.LAST_REPLY_TIME}<br />{topiclist.LAST_REPLYER}<a href="{topiclist.U_LAST_POST}">{LAST_POST_IMG}</a></td>
      </tr>
<!-- END topiclist -->
   </table>
<!-- MOD: Integrated Topiclist 2.0 END -->


index.php補充說明

代碼:
// Topics text length
$MAX_STR_LEN = 40; 主題名稱最長長度(建議改400)

// Topics to display (Default: 5)
$MAX_TOPICS = 5; 顯示主題個數 (建議改20)

// Order by
// topic_last_post_id 發表時間(預設)
// topic_replies 回覆數
// topic_views 觀看數
$sortby="topic_last_post_id"; 依何而排? (自上方三種選來用)

//
// Option of Toplist End
//


如果畫面沒有變化,把 phpbb 根目錄下的 cache 子目錄下的檔案全砍。

若仍沒用,把

代碼:
$template->set_filenames(array(
   'body' => 'index_body.html')
);

改為

代碼:
$template->set_filenames(array(
   'body' => 'index_body2.html')
);


./styles/subsilver2/template 目錄中
把 index_body.html 改為 index_body2.html 

如果發生index_body載入過,怎麼修改都無效時,可每改一次index_body.html就換一次名稱。


(完)

[研究] phpbb 3.0.10 安裝RSS模組(simple syndication 1.1.1b)

安裝RSS模組(simple syndication 1.1.1b)

本篇是接續:
[研究] phpbb 3.0.10 快速安裝程式 (CentOS 6.2 x86)
http://shaurong.blogspot.com/2012/01/phpbb-3.html

simple syndication 1.1.1b RSS模組
http://www.phpbb.com/community/viewtopic.php?f=70&t=552465
http://downloads.sourceforge.net/canver/simple_syndication_1.1.1b.tar.gz
http://ncu.dl.sourceforge.net/project/canver/phpBB3%20MODs/simple%20syndication%201.1.1b/simple_syndication_1.1.1b.tar.gz

安裝說明只支援prosiliver風格,必須自己再處理subsilver2風格,小弟安裝程式同時處理兩種。

要看RSS,除了使用支援RSS的瀏覽器,也可以使用專門的RSS Reader,例如:
GreatNews RSS Reader
http://www.curiostudio.com/download.html
教學
http://inote.tw/2007/05/greatnews-1.html

syndication.php預設輸出文章數設定為「全文輸出」,等於是在dump資料庫…

修改方法有兩種,一種是指定輸出文章數,第二種是修改預設輸出值。

第一種是把overall_header那邊的兩句改成
(使用者不加上count參數的話,等於是在dump資料庫…)
代碼:
syndication.php?type=rss&count=10


第二種是把syndication.php的第30行改成(小弟用這種)
代碼:
$count = request_var('count', 10);


快速安裝程式如下
代碼:
wget http://ncu.dl.sourceforge.net/project/canver/phpBB3%20MODs/simple%20syndication%201.1.1b/simple_syndication_1.1.1b.tar.gz
tar zxvf simple_syndication_1.1.1b.tar.gz

cp  "simple syndication [1.1.1b]/root/syndication.php"  /var/www/html/phpbb/syndication.php

cp  "simple syndication [1.1.1b]/root/styles/prosilver/template/syndication_atom.xml"  /var/www/html/phpbb/styles/prosilver/template/syndication_atom.xml
cp  "simple syndication [1.1.1b]/root/styles/prosilver/template/syndication_rss2.xml"  /var/www/html/phpbb/styles/prosilver/template/syndication_rss2.xml

# To support subsilver2
cp  "simple syndication [1.1.1b]/root/styles/prosilver/template/syndication_atom.xml"  /var/www/html/phpbb/styles/subsilver2/template/syndication_atom.xml
cp  "simple syndication [1.1.1b]/root/styles/prosilver/template/syndication_rss2.xml"  /var/www/html/phpbb/styles/subsilver2/template/syndication_rss2.xml

# To protect RSS from dumping Database.
sed -i -e "s@request_var('count', 0);@request_var('count', 50);@"  /var/www/html/phpbb/syndication.php

sed -i -e "/<\/head>/i<link rel=\"alternate\" type=\"application\/rss+xml\" title=\"{SITENAME}\" href=\"syndication.php?type=rss\" \/>"     /var/www/html/phpbb/styles/prosilver/template/overall_header.html
sed -i -e "/<\/head>/i<link rel=\"alternate\" type=\"application\/atom+xml\" title=\"{SITENAME}\" href=\"syndication.php?type=atom\" \/>"   /var/www/html/phpbb/styles/prosilver/template/overall_header.html

firefox http://localhost/phpbb/syndication.php &


(完)


後續文章:



[研究] phpbb 3.0.10 安裝TOP5模組(Integrated Topiclist 2.0 beta)
http://shaurong.blogspot.com/2012/01/top5integrated-topiclist-2.html

[研究] phpbb 3.0.10 快速安裝程式 (CentOS 6.2 x86)

[研究] phpbb 3.0.10 快速安裝程式 (CentOS 6.2 x86)


官方網站
http://www.phpbb.com/


繁體中文支援網站 - 竹貓星球
http://phpbb-tw.net/phpbb/


官網下載位置(英文完整套件):
http://www.phpbb.com/files/release/phpBB-3.0.10.tar.gz


資料庫名稱:phpbbDB
資料庫帳號:phpbbUser
資料庫密碼:phpbbPassword
可以依據自己喜好變更




# phpbb3.0.10_centos6.2x86_install
echo -e "\033[31;42m ********** Install phpbb 3.0.10 on CentOS 6.2 x86 ********** \033[0m"
echo -e "\033[31m 2012/01/04 ********** \033[0m"


service iptables stop
#service iptables start
#iptables  -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#iptables  -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
# Fedora
#iptables  -A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
#iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
#iptables -I RH-Firewall-1-INPUT -s 192.168.128.0/24 -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
#iptables -I RH-Firewall-1-INPUT -p tcp -m tcp --dport 5666 -j ACCEPT
# CentOS 5.4 x86
#iptables -I RH-Firewall-1-INPUT -s 192.168.128.0/24 -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
# Fedora 12 x86
#iptables -I INPUT -s 192.168.128.0/24 -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
#service iptables save
#service iptables restart


if [ "`cat /proc/version | grep centos | grep el6`" != "" ]; then
  OS="CentOS 6.x"
  echo "Detection your OS is CentOS 6.x"
else
  echo "[ERROR] Only Support CentOS 6.x"
  exit
fi


# Check SELinux status
if  [ "`grep SELINUX=disabled /etc/selinux/config`" == "" ]; then


# disable SELinux now
/usr/sbin/setenforce 0


# disable SELinux after every reboot
# echo "/usr/sbin/setenforce 0" >> /etc/rc.local  


#or
# disable SELinux always
sed -i -e "s@SELINUX=enforcing@#SELINUX=enforcing@"   /etc/selinux/config
sed -i -e "s@SELINUX=permissive@#SELINUX=permissive@"   /etc/selinux/config
sed -i -e "/SELINUX=/aSELINUX=disabled"   /etc/selinux/config
fi


# Kill nptd on running...
ProcessID="`ps aux | grep ntpd | awk '{print $2}' `"
for i in $ProcessID
do
  echo $i
  kill -9 $i
done
ntpdate tick.stdtime.gov.tw


# Kill yum on running...
ProcessID="`ps aux | grep yum | awk '{print $2}' `"
for i in $ProcessID
do
  echo $i
  kill -9 $i
done


if  [ "`grep SELINUX=disabled /etc/selinux/config`" == "" ]; then
/usr/sbin/setenforce 0
echo "/usr/sbin/setenforce 0" >> /etc/rc.local  
fi


yum -y install mysql mysql-server httpd php php-mysql wget php-mbstring php-gd


chkconfig httpd on
chkconfig mysqld on
service httpd restart
service mysqld restart


if test -f phpBB-3.0.10.tar.bz2
then
    echo "phpbb 3.0.10.tar.bz2 exist"
else
    wget http://www.phpbb.com/files/release/phpBB-3.0.10.tar.bz2
fi


if test -f  "mandarin_chinese_traditional_script_1_0_3.zip"
then
    echo "mandarin_chinese_traditional_script_1_0_3.zip exist"
else
  wget http://www.phpbb.com/customise/db/download/id_82358
  mv id_82358 "mandarin_chinese_traditional_script_1_0_3.zip"
fi


tar jxvf phpBB-3.0.10.tar.bz2 -C /var/www/html/
mv /var/www/html/phpBB3  /var/www/html/phpbb


unzip "mandarin_chinese_traditional_script_1_0_3.zip"
cp -R "mandarin_chinese_(traditional_script)_1_0_3/mandarin_chinese_(traditional_script)_1_0_3/."  /var/www/html/phpbb


#[root@localhost ~]# find /var/www/html/phpbb -name zh_cmn_hant
#/var/www/html/phpbb/language/zh_cmn_hant
#/var/www/html/phpbb/styles/prosilver/imageset/zh_cmn_hant
#/var/www/html/phpbb/styles/subsilver2/imageset/zh_cmn_hant


mysql -e "create database phpbbDB"
mysql -e "show databases; "


mysql -e "grant all on phpbbDB.* to phpbbUser@localhost; "
mysql -e "set password for phpbbUser@localhost=password('phpbbPassword'); "
mysql -e "flush privileges; "
mysql -e "use mysql;  select Host,User,Password from user; "


chmod a+w  /var/www/html/phpbb/config.php


firefox http://localhost/phpbb &


echo "When you finish Web-based Installation, press any key to continue ..."
read


接下來要進行 Web 介面安裝










































繼續安裝,把config.php設定成唯讀,把 install 目錄改名或刪除
(可能再換上自己的 Logo)




chmod a+r-w  /var/www/html/phpbb/config.php
mv  /var/www/html/phpbb/install  /var/www/html/phpbb/install.backup


# Change you logo
#cp site_logo.gif  /var/www/html/phpbb/styles/prosilver/imageset/site_logo.gif
#cp site_logo.gif  /var/www/html/phpbb/styles/subsilver2/imageset/site_logo.gif






參考


[研究] phpbb 3.0.9 快速安裝程式 (CentOS 5.6 x86)
http://shaurong.blogspot.com/2011/07/phpbb-3.html


[研究] phpbb 3.0.8 快速安裝程式 (CentOS 5.5 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=19286


(完)


相關文章:



[研究] phpbb 3.0.10 安裝RSS模組(simple syndication 1.1.1b)
http://shaurong.blogspot.com/2012/01/phpbb-3010-rsssimple-syndication-111b.html


[研究] phpbb 3.0.10 安裝TOP5模組(Integrated Topiclist 2.0 beta)
http://shaurong.blogspot.com/2012/01/top5integrated-topiclist-2.html