Posted in php on Jun 30th, 2010
在 phpBB2 的時候就有發現這問題了,當時並沒有想去解決這問題,然而至今到了 phpBB3,依然出現這問題,不過我想這是因為中文網址的盛行,以及像 Wiki 之類都會有中文標籤,例如:一分鐘教室-userChrome.css,解決方法可以透過 urlencode 函式來處理掉網址編碼問題,在 phpBB 處理文章儲存,會先經過 bbcode 的處理,將 標籤,會經過 get_preg_expression(‘url’) 這函式的驗證,看 url 是否合法,當然如果網址列有中文就不可能通過,所以必須在網址驗證之前,把網址編碼過,通過驗證之後再把網址解碼,這樣就沒問題了,底下為安裝步驟 打開 includes/message_parser.php 找尋 function validate_url($var1, $var2) 前面加入 /** * url encode * * @param string $string http url */ function encode_url($string) { $entities = array(’%21′, ‘%2A’, ‘%27′, ‘%28′, ‘%29′, ‘%3B’, ‘%3A’, ‘%40′, ‘%26′, ‘%3D’, ‘%2B’, ‘%24′, [...]
Read Full Post »
Posted in CodeIgniter, FreeBSD, php, wordpress on Jun 23rd, 2010
昨天升級了 FreeBSD 的 Apache, PHP, and MySQL,遇到很多地雷阿,最多的就是 PHP 的部份,因為本來自己使用 5.2.11 版本,但是在 commit port 的時候發生去裝 5.3.2 版本,所以就直接砍掉全部重練,先是遇到 MySQL 問題,原先在 database/mysql60-server 已經被 FreeBSD 移除,任何關於 mysql60 的相關 port 都被 remove 掉了,只好 downgrade 到 mysql 5.1.48 版本,移除同時順手把 apache PHP 相關都拿掉了。 移除 apache mysql php 相關 ports -rf 依序找尋相關 Mysql ports 移除 pkg_deinstall -rf mysql60-server 接下來安裝 MySQL 5.1.48 Server and [...]
Read Full Post »
Posted in Kernel, Linux on Jun 21st, 2010
來筆記如何在 Kernel 撰寫 hello world! module,在 Ubuntu Kernel 2.6.31-14 環境下撰寫,其實不難啦,首先先進入 Kernel 目錄,請在 /usr/src 底下看自己的系統版本,或者是利用 uname -r 來知道 Kernel 版本,底下是在 Ubuntu Kernel 2.6.31-14 Kernel 實做: 進入 Kernel 目錄 # # cd Kernel directory # cd /usr/src/linux-headers-2.6.31-14-generic-pae 建立 hello 目錄 # # mkdir directory # mkdir hello 建立 Makfile 以及 hello.c hello.c: #include <linux/kernel.h> /* pr_info 所需 [...]
Read Full Post »
Posted in wordpress on Jun 20th, 2010
WordPress 在6月17日 Release 3.0 版本名稱:Thelonious,官方部落格 WordPress 3.0 “Thelonious”,使用者可以在這裡下載,或者是利用後台方式升級,這次更新了 1,217 bug 修正以及功能增加,可以看底下官方網站影片: 大家可以參考 3.0 版本更詳細介紹,以及 long list of issues in Trac。感謝 218 位 contributors 為 3.0 的貢獻,目前官方也繼續開始邁向 3.1 的開發。
Read Full Post »
Posted in php on Jun 13th, 2010
前一篇提到:『[教學] phpBB3 使用者簽名檔 url 連結加上 rel=”nofollow”』,本篇會將其做成後台,方便管理者可以從後台管理,這次加上一個新功能:『限制使用者顯示簽名檔』,根據使用者文章數量來決定是否顯示簽名檔,可以避免想要來打廣告的新註冊使用者,限制文章數量是一種方式,但是也不是最好的方式,phpBB3 本身可以在後台限制是否顯示使用者簽名檔,不過我想各大站長都會開放此功能,好讓使用者可以放個人網站或者是部落格,底下是外掛安裝方式: 安裝 打開 includes/acp/acp_board.php 找尋 # # Find # ‘max_sig_img_height’ => array(’lang’ => ‘MAX_SIG_IMG_HEIGHT’, ’validate’ => ‘int:0′, ’type’ => ’text:5:4′, ‘explain’ => true, ‘append’ => ‘ ‘ . $user->lang[’PIXEL’]), 後面加上 # # after add # ‘max_sig_post_count_limit’ => array(’lang’ => ‘MAX_SIG_POSTS_LIMIT’, ‘validate’ => ‘int:0′, ’type’ [...]
Read Full Post »
Posted in php on Jun 10th, 2010
基於 Moztw 討論區 有大陸使用者註冊之後,在簽名檔加入一些廣告連結,為了降低 Google Page Rank,所以我們必須指示搜尋引擎「不要前往此網頁上的連結」或是「不要前往此連結」,可以參考 關於 rel=”nofollow”,phpBB3 編輯三個檔案就可以了,此修改不影響文章內容,只有針對簽名檔作用,底下是 patch 程式碼,可以參考看看 includes/bbcode.php — phpBB3/includes/bbcode.php 2010-03-06 04:37:23.000000000 +0800 +++ www/includes/bbcode.php 2010-06-10 20:58:02.000000000 +0800 @@ -2,7 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ +* @version $Id: bbcode.php 9461 2009-04-17 15:23:17Z acydburn $ +* @log 2010-06-10 appleboy $ * @copyright (c) 2005 [...]
Read Full Post »
Posted in CodeIgniter, php on Jun 7th, 2010
之前介紹過 javascript FireFox Debug 工具 FireBug (Using firebug for firefox 除錯 javascript),今天來介紹 PHP 除錯工具 FirePHP,它可以輸出 PHP 資料到 FireBug console 介面,方便解決 PHP 相關問題,而不會去影響線上網站的畫面,安裝方式非常簡單,請先安裝 FireFox addon for FirePHP,重新啟動 FireFox 這樣就安裝成功了,接下來就是 include FirePHP Library 檔案,就可以正常使用了。另外還會介紹如何安裝到 CodeIgniter PHP Framework Firebug: https://addons.mozilla.org/en-US/firefox/addon/1843 FirePHP: https://addons.mozilla.org/en-US/firefox/addon/6149 底下先看畫面: $array = array("a" => "1", "b" => "2"); $firephp->info($array, "info"); $firephp->warn($array, "warn"); $firephp->error($array, "error"); Install [...]
Read Full Post »