筍子工作雜記

十月 19, 2009

Liaise 1.27 sc 驗證碼無法顯示

Filed under: PHP,Programming,xoops — shinnlu @ 3:27 下午

前一陣子試用了 Liaise 1.27 加上驗證碼的版本,安裝完後卻發現驗證碼的圖片上只有一些線條,完全沒有英文或數字出現。
追了程式碼,發現在
liaise/class/chaptcha_x/class.captcha_x.php 209 行
if ( @putenv ( ‘GDFONTPATH=’ . $font_path) === false) {

某些環境不允許php 執行 putenv 的指令,而導致 225 行判斷失敗
if ( $no_putenv) {
只要將 225 行改為以下程式碼即可
if ( !$no_putenv) {

二月 10, 2009

C++ Builder: Winsock 1 和 Winsock 2 Header 重複的問題

Filed under: C++,Programming — 標籤:, , , — shinnlu @ 5:28 下午

使用 Indy 元件時,有時候會遇到元件引用的問題,在 Winsock1 和 Winsock2 的Header 裡,有不少是相同名字的宣告,而

發生時的錯誤訊息如下:
[C++ Error] winsock2.h(113): E2238 Multiple declaration for ‘fd_set’
[C++ Error] winsock.h(55): E2344 Earlier declaration of ‘fd_set’
[C++ Error] winsock2.h(116): E2146 Need an identifier to declare
[C++ Error] winsock2.h(157): E2238 Multiple declaration for ‘timeval’
[C++ Error] winsock.h(98): E2344 Earlier declaration of ‘timeval’ (more…)

一月 2, 2008

如何讓後台的跳轉頁面也套用前台的風格

Filed under: Uncategorized,xoops — shinnlu @ 1:59 下午

tested with xoops 2.016
所有呼叫 redirect_header都是執行這一個函式
/include/functions.php
line 364 function redirect_header($url, $time = 3, $message = “, $addredirect = true)

而在 372 行有一個判斷目前是前台,還是後台
if (defined(‘XOOPS_CPFUNC_LOADED’)) {
$theme = ‘default’;
} else {
$theme = $xoopsConfig['theme_set'];
}
只要讀到 XOOPS_CPFUNC_LOADED,就判定為後台,直接使用預設樣版
//include/cp_functions.php
line 27 //define(‘XOOPS_CPFUNC_LOADED’, 1);

把這一行 mark起來就可以了,目前使用起來沒什麼問題

八月 10, 2007

樣版中的路徑問題

Filed under: xoops — shinnlu @ 2:08 下午

這一陣子美工告訴我一個困擾他很久的問題
他做樣版時,假設樣版名稱是 default,如果遇到大改版,為了防止改壞掉的情況,都會把原始樣版保留,並把 default 目錄複製一份成為 default1,而對 default1 做修改,這時候會遇到一個問題
<{foreach item=block from=$xoops_lblocks}>
<{include file="default/theme_blockleft.html"}>
<{/foreach}>
上面紅色的部份是樣版的路徑,只要樣版路徑改變,他就需要手動把 default 改為 default1,下次則需要將 default1 改為 default2,其實解決方法很簡單,只需要在樣版中加入下面這一行,此行程式的用意是把目前樣版路徑指定給 themename 成為一個 smart 變數
<{assign var='themename' value=$xoTheme->path}>
樣版中的路徑即可使用以下的方式
<{foreach item=block from=$xoops_lblocks}>
<{include file="$themename/theme_blockleft.html"}>
<{/foreach}>

如果是 Xoops 2.2x 因為沒有 xoTheme 物件,則要使用以下的方式去拼出樣版路徑
<{assign var='themename1' value=/themes/$xoops_theme/}>
<{assign var='themename' value=$xoops_rootpath$themename1}>

而使用方式一樣

六月 17, 2007

iconv 轉碼問題

Filed under: PHP — shinnlu @ 12:02 上午

剛剛在處理 MsSQL(big5) 轉 MySQL(UTF8)時,採用了 iconv 去做轉碼的處理
一開始處理幾個 Table 都沒什麼問題,直到一個欄位裡面有中文全形"/」,引起 iconv 無法轉換而整個 SQL 句子中斷 (more…)

五月 12, 2007

xoops 2.0.x 區塊複製

Filed under: xoops — shinnlu @ 8:28 下午

在 xoops 2.2.x 的區塊管理下有一個非常實用的功能,就是區塊複製,在 2.0.x 上並沒有這個功能(其實是有的,只是因為某些原因程式碼被 mark 起來),以下的步驟記錄如何打開這個封印。 (more…)

四月 18, 2007

xoops system module 1.0 新增使用者時,多群組不能儲存的問題

Filed under: Uncategorized,xoops — shinnlu @ 5:19 下午

System 模組新增使用者時,選擇多個群組只會儲存第一個
此修正只適合 xoops 2.0.x版,2.3 沒有這個問題,修正方式如下:
\modules\system\admin\users\main.php (more…)

十二月 24, 2006

Xoops 控制台選單的產生方式

Filed under: Uncategorized,xoops — shinnlu @ 4:05 下午

/admin.php
case ‘generate’:
xoops_module_write_admin_menu(xoops_module_get_admin_menu());
/include/cp_functions.php
function xoops_module_get_admin_menu()
function xoops_module_write_admin_menu($content)
(more…)

十一月 28, 2006

userinfo.php 空白頁面懶人解決方法

Filed under: xoops — shinnlu @ 2:44 下午

這一陣子忙的昏天暗地,部落格上也雜草叢生了,以後如果真的很忙,可能會出現只有短短幾個字的文章,反正是工作雜記嘛…
modules/profile/userinfo.php
這一隻程式有時候會出現空白頁面,之前因為有時正常,有時不正常,所以沒有直接懷疑到程式碼身上,但最近出現的頻率太過頻繁,狠下心來做全面的 Debug. (more…)

七月 29, 2006

主選單生成分析

Filed under: xoops — shinnlu @ 8:08 下午

系統主選單是如何產生的呢,下面是分析步驟
由 index.php 引入 header.php 開始 (more…)

Older Posts »

Powered by WordPress