為-面向-對像-而生的PHP5

轉載自 http://www.twbb.org/forum/?board=80;action=display;threadid=2919

 (閱讀全文)


plog 檔案中心的縮圖,如果無法正確產生,須修改 php.ini 的設定

php 預設的 memory limit 為  8M,
如果圖檔太大, 當 plog 呼叫  ImageCreateFromJPEG 時,會超過 8M ,造成錯誤

plog 在 class/gallery/resizers/gallerygdresizer.class.php 的縮圖處理, 將錯誤訊息隱藏 ,造成除錯的不易

$this->img["src"] = @ImageCreateFromJPEG ($imgfile);

修正方法: 將 /etc/php.ini 的  memory_limit = 8M  改大一些  如
memory_limit = 20M ,重新啟動 apache 即可解決!



wakka .hdaccess 設定備忘

wakka 在 apache 2 安裝好後須改 .hdaccess 這個檔,將預設的檔案改為

 

RewriteEngine on
RewriteRule ^(wakka.php?.*)$ - [S=1]
RewriteRule ^(.*)$ /wakka/wakka.php?wakka=$1 [QSA,PT,L]
 


再修改 /etc/httpd/conf/httpd.conf 加入
 

Alias /wakka/ /var/www/wakka/

AllowOverride All

重新啟動 apache

 (閱讀全文)


讓 plog 也可以收big5 的rss

1. 自己動手加入一個函式

vi class/xml/rssitem.class.php

加入 

 function getBig5Title()
                {
                        return iconv("Big5","UTF8",$this->_title);
                }

2.將 下列的語法加入你的樣版中(以 free.tnc.edu.tw 為例)

<div id="sectionHeader">free.tnc.edu.tw </div>
    <div id="sectionContent">
     {if $rss->parse("http://free.tnc.edu.tw/backend.php")}
  {foreach from=$rss->getItems() item=rssItem}
    <a href="{$rssItem->getLink()}">{$rssItem->getBig5Title()}</a><br/>
  {/foreach}
 {else}
   <b>There was an error parsign the feed!</b>
 {/if}

    </div>





在FreeBSD 下安裝 LDAP 伺服器

1. 利用port 安裝

# cd /usr/ports/net/openldap22-server/
# make install

2. 產生一個密碼檔

srv# /usr/local/sbin/slappasswd
New password:
Re-enter new password:
{SSHA}xuMYO0holC9CQHuwl9t8wFt3at9HXl+x


2.修改設定檔,並將 rootpw 改為 {SSHA}xuMYO0holC9CQHuwl9t8wFt3at9HXl+x

# ee /usr/local/etc/openldap/slapd.conf
...
#######################################
# ldbm database definitions
#######################################

database bdb
suffix "dc=tccboe"
rootdn "cn=admin,dc=tccboe"
rootpw {SSHA}xuMYO0holC9CQHuwl9t8wFt3at9HXl+x
....


 (閱讀全文)


在 LDAP 下使用中文

資料來源
http://netlab.cse.yzu.edu.tw/~statue/freebsd/zh-tut/ldap.html

如果是要將 .ldif 轉入,必須先將中文轉成 utf-8。

安裝 converter/iconv, 假設要轉碼的檔案是 big5.ldif,轉出來的檔案是 utf-8.ldif。

% iconv -f big5 -t utf-8 big5.ldif > utf-8.ldif

然後就可以用 ldapadd 來將 utf-8.ldif 轉入 ldap 了。




plog 修正檔 templateview.class.php

plog 使用者上傳自己的模版後,無法以 op=Template 的方式使用自己的樣板

trace 了一下程式,找到 class/view/templateview.class.php 中少傳了一個值

修正檔下載 5-templateview.class.txt

/**
* Renders the template
*/
function render()
{
$blogSettings = $this->_blogInfo->getSettings();
//少傳了$this->_blogInfo
$template =
$this->_templateService->Template( $this->_templateFile,
$blogSettings->getValue( "template" ),$this->_blogInfo);
$template->assign( $this->_params->getAsArray());

print( $template->fetch());
}
}



讓 mozilla 印得出中文

在 Linux 環境下,要印出中文字須修改

/usr/local/mozilla/defaults/pref/unix.js

372 pref("print.postscript.nativefont.x-western", "");
373 //pref("print.postscript.nativefont.zh-CN", "");
374 //pref("print.postscript.nativefont.zh-TW", "");
375 pref("print.postscript.nativefont.zh-CN", "BousungEG-Light-GB-GB-EUC-H");
376 pref("print.postscript.nativefont.zh-TW", "ShanHeiSun-Light-B5-H");
377 pref("print.postscript.nativecode.zh-CN", "gb2312");
378 pref("print.postscript.nativecode.zh-TW", "big5");