LifeType 中文開發論壇

開發 => 外掛程式 => 主題作者是: TomexOu 於 一月 19, 2006, 06:30:54 上午



主題: [問題]如何預設幫全部用戶安裝且啟動某plugin?
作者: TomexOu一月 19, 2006, 06:30:54 上午
因為網誌系統被spam攻擊,資料庫大增
雖然裝了AuthImage防堵spam,
但85%的用戶根本就沒注意到這個插件發佈,
他們只會單純po文章,並抱怨好多垃圾迴響...
寫了教學文章讓他們自行啟動,效果不彰!!

因此我想替他們全部啟動該AuthImage插件,
我詳細觀察了plog_blogs表格,手動在其settings欄位尾部,插入以下的string設定值:

程式碼:

分析成功啟動插件之user設定值:
"plugin_authimage_enabled";b:1;s:23:"plugin_authimage_length";s:1:"6";s:20:"plugin_authimage_key";s:4:"pLog";s:28:"plugin_authimage_expiredtime";s:4:"3600";s:24:"plugin_authimage_default";s:9:"ocean.gif"


替代某未啟動user的值:
update plog_blogs set settings=REPLACE(settings, ';}}', '上述字串;}}) where id = xxx;


完成後,清除cache、/tmp,
再到該用戶的後台查看是否啟動auth image,沒有!!
到前台comment區看,當然也沒有被啟動。

請問為何這樣?
那我到底該怎麼啟動全部用戶的auth image插件呢?


主題: Re: [問題]如何預設幫全部用戶安裝且啟動某plugin?
作者: lss一月 19, 2006, 07:25:33 上午
hi tomex_ou:

你可以參考一下我寫的這篇文章:如何預設啟用外掛程式? (http://blog.nlhs.tyc.edu.tw/post/2/97),和這個討論串:默认启用外挂? (http://forum.lifetype.org.tw/index.php?topic=1714.0)

希望對你有幫助。

lss


主題: Re: [問題]如何預設幫全部用戶安裝且啟動某plugin?
作者: TomexOu一月 19, 2006, 08:39:17 上午
原來已有好文章呀,
唉~ 我什麼都不懂下硬要闖改db值,分析得好辛苦...

謝謝lss的好文章。


主題: Re: [問題]如何預設幫全部用戶安裝且啟動某plugin?
作者: TomexOu一月 19, 2006, 04:53:57 下午
我找了相關的資料,發現以下比較完整能顯示出認證圖片(ocean.gif):

在\plugins\authimage\pluginauthimage.class.php(64):
$blogSettings = $this->blogInfo->getSettings();

後面寫入:

程式碼:

        // 如果取出的設定值不存在,代表還沒有設定過,
        // 將設定值設為 true ,並重新取得設定值。
        $this->pluginEnabled = $blogSettings->getValue( "plugin_authimage_enabled" );
        if (empty($this->pluginEnabled))
        {
            $blogSettings->setValue("plugin_authimage_enabled", 1 );
            $blogSettings->setValue("plugin_authimage_length", 6 );
            $blogSettings->setValue("plugin_authimage_key", "pLog");
            $blogSettings->setValue("plugin_authimage_expiredtime", 3600 );
            $blogSettings->setValue("plugin_authimage_default", "ocean.gif" );
        }

    //原來的code
    $this->pluginEnabled = $blogSettings->getValue( "plugin_authimage_enabled" );
    ....

不過,我發現資料是進入該user的settings,但從後台進去看
它的enabled都沒有打勾,而其他欄位有值。

即使我第一行設為: $blogSettings->setValue("plugin_authimage_enabled", true );亦同
蠻奇怪的現象。

ps.該死的垃圾回響沒有啥規則,我連下sql指令清除效果有限!