Pligg 禁用新用户注册

    我自己基于Pligg搭建的个人网摘www.yeeach.com/digg被狂灌水,而且越来越严重,极其厌烦天天浪费大量时间去手动把垃圾记录设为“discard”状态,由于要提交新内容必须登录,因此首先想到禁用新用户注册功能,但Pligg好像没有禁止注册的功能。手工修改一下禁用新用户注册功能。

1、修改login.tpl 内容

修改digg/templates/yget/sidebar_modules/login.tpl ,把整个文件内容都注释掉

{*
<div id="maintab" class="tlb2">
        <span><a href="#" rel="register" style="text-decoration:none">{#PLIGG_Visual_Register#}</a></span>
        <span class="selected"><a href="#" rel="login" style="text-decoration:none">{#PLIGG_Visual_Login_Title#}</a></span>
</div>

 

{literal}
<script type="text/javascript">
initializetabcontent("maintab")
</script>
{/literal}
*}

2、修改header.tpl

修改digg/templates/yget/header.tpl,注释掉头部的注册链接

{*
<a href=’{$URL_register}’>{#PLIGG_Visual_Register#}</a> &nbsp;&nbsp;
*}

3、修改.htaccess

修改digg/.htaccess ,将register请求重定向到index.php

RewriteRule ^register/?$ index.php

其实pligg提供了AntiSpam功能,但没有时间测试,先禁用新用户注册再看看,对老的注册用户如果还乱灌水,格杀勿论。

Technorati Tags: ,

pligg SEO支持

为了更好让pligg支持搜索引擎优化,按照SEO的基本原则进行如下一些处理

pligg版本:Pligg_Beta_9.8.2

1、meta keywords和descriptions的配置

Pligg缺省情况下以提交digg内容时候定义的keywords和summary作为页面的keywords和description内容。对于一些站点缺省的keyword或description的维护,可以直接修改tempaltes/meta.tpl,但这样很麻烦,可以通过“后台管理”提供的对lang.conf维护工具来实现keyworkds和descriptions缺省值进行动态维护和修改。

方法如下:

  • 在libs/lang.conf中增加如下内容:

//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Description = “ENTER YOUR DESCRIPTION HERE”
//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Keywords = “ENTER YOUR KEYWORD HERE”

  • 在templates/meta.tpl增加PLIGG_Meta_Description和PLIGG_Meta_Keywords
{* define your meta data here *}

{if $meta_description neq ""}
        <meta name="description" content="{$meta_description},{#PLIGG_Meta_Description#}" />
{else}
        <meta name="description" content="Yeeach.com" />
{/if}

{if $meta_keywords neq ""}
        <meta name="keywords" content="{$meta_keywords},{#PLIGG_Meta_Keywords#}" />
{else}
        <meta name="keywords" content="Yeeach.com" />
{/if}
        <meta name="Language" content="{#PLIGG_Visual_Meta_Language#}" />
        <meta name="Robots" content="All" />

{* the extra tabs are to make it lineup when viewing the source *}
 
  • 从“后台管理”->“设定配置”->“Modify Language”修改keyworkds和descriptions

2、URL搜索引擎友好

  • 从“后台管理”->“设定配置”->“Outgoing”将Outgoing links的值设定为id
  • 从“后台管理”->“设定配置”->“UrlMethod”将URL method将值设定为2
  • 从“后台管理”->“设定配置”->“FriendlyURLs”将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false
  • cp htaccess.default .htaccess
  • 登录“后台管理”->“类别管理”,得到最下方自动生成的RewriteRule,拷贝到.htaccess,替代如下内容后面的内容##### You can find the below lines pre-made for you in the category management section of the admin panel
  • 如果新增了类别,需要重新到“后台管理”->“类别管理”得到新的RewriteRule,然后拷贝到.htaccess中。
  • 之所以将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false,就是为了采用id号方式,避免中文编码urlencode后,mod_rewrite处理的问题。

http://forums.pligg.com/wiki-articles/8594-url-method.html

Dynamic vs Static urls

Dynamic urls contain variables and are typically seen on database driven sites like blogs and forums. A static url does not contain any variables and does not change. Static urls are easier for your users to read. They are also sometimes ranked higher by search engines.
Examples
Dynamic url: yoursite.com/pligg/story.php?title=storytitle
Static url: yoursite.com/pligg/news/yourstorytitle

Url Method options

There are three options on the Url Method page in the admin panel. Choose Url Method 2 to enable static urls.

  • Method 1 = dynamic urls (default)
  • Method 2 = static urls

.htaccess

If you enable Url Method 2 in the admin panel you should see static urls on your site but when you click on an internal link you’ll probably get a 404 this page can not be found error. In order to work properly Url Method 2 requires modifications to your .htaccess file so that so that the new friendly urls are properly mapped to the actual files they refer to.
There is a default .htaccess file included in your Pligg installation called htaccess.default that contains a long list of rewrite commands that are meant to get you started. But you will probably need to modify this file in order to get static urls working properly on your site.

Step by Step Instructions
  1. Check with your host to see if mod rewrite is allowed. If not buy a DreamHost package to help pligg dev.
  2. Check with your host that Apache is configured to use .htaccess files (AllowOverride All)
  3. Get the latest htaccess.default from the SVN on sourceforge.
  4. Go to your admin panel/category management. At the bottom there is a rewrite rule for the categories. Copy this whole line and in htaccess.default paste over You need to copy the line for this whole thing to work right. Paste over the line: RewriteRule ^(all|pligg|category1|category2)/([a-zA-Z0-9-]+)/?$ story.php?title=$2 [L]
  5. Upload htaccess.default to your webserver in the root directory of your install. Overwrite the existing one.
  6. Rename “htaccess.default” to “.htaccess” (no quotes). Note the period in front. That period denotes a hidden file, and may cause it to disappear from some FTP clients. (You might need to enable showing of hidden files or call it by name when downloading).
  7. Turn on URL Method 2 in the admin panel.
  8. Enjoy friendly URL’s

If your Pligg is installed in a subfolder

If Pligg is installed in a subfolder: (ie : yourdomain.com/pligg/) then you will need to modify the RewriteBase in .htaccess:
Change RewriteBase / to RewriteBase /pligg/

Rewrite rule for categories

Every time you add a new category to your site you need to update the mod rewrite rules for the category urls. Simply go back to the admin panel / category management page copy the new rewrite rule and paste it on top of the old one in your .htaccess file.

It’s not working. How do i go back?

If this doesn’t work, mod_rewrite probably isn’t enabled on your webserver. You can go back to the admin panel and set Url Method to 1 again. No harm was done to any files during the instructions above and your site should operate fine without friendly urls.

3、广告

http://www.maranan.us/archives/pligg-ad-placement-tutorial/

http://www.maranan.us/archives/pligg-adsense-tutorial-yget-template/

http://www.maranan.us/archives/putting-adsense-in-your-pligg-sites/

 

 

参考资料

Technorati 标签: , , ,

pligg 集成wysiwyg 编辑器tinymce

由于在自己的个人站点上用pligg来作为网摘工具,因此希望在摘录时候能够直接能够把内容及格式保留下来,而不是单纯的文字介绍,因此用tinymce(用空再试fckeditor)来替代pligg本身的textarea,记录一下集成过程:

1、下载tinymce

http://tinymce.moxiecode.com/download.php

2、上传安装tinymce安装包

上传tinymce到服务器pligg安装目录的3rdparty下并解压

tar zxvf tinymce_2_1_2.tgz

cp -r tinymce/jscripts/tiny_mce/ .

3、启用pligg的html标识支持

在pligg的“后台管理”->“设定配置”->”Submit”中设定“HTML tags to allow”的值为如下内容:

<br><font><img><p><a><strong><ul><li><ol><u><em><span><pre><h1><h2><h3><hr><embed>

4、确认pligg采用的模板文件

查看一下templates/templates.tpl,确认使用的模板为yget

<a href = “{$my_pligg_base}/settemplate.php?template=yget“>yget</a><br/>

5、修改pligg的模板文件pligg.tpl

修改pligg的模板文件templates/yget/pligg.tpl,在 {checkForJs} 后添加如下的内容

{if $pagename eq "submit" || $pagename eq "editlink"}
  <script language="javascript" type="text/javascript" src="{$my_pligg_base}/3rdparty/tiny_mce/tiny_mce.js"></
script>
{/if}

6、修改pligg的模板文件submit_step_2.tpl和comment_form.tpl和editlink_edit_center.tpl

修改pligg的模板文件templates/yget/submit_step_2.tpl,templates/yget/editlink_edit_center.tpl,在以上几个文件头的 {config_load file="/libs/lang.conf"} 后添加如下的内容
{literal}
    <script language="javascript" type="text/javascript">
        tinyMCE.init({
            mode : "exact",
            elements : "bodytext,summarytext",
            theme : "advanced",
            plugins : "advimage,advlink,emotions,iespell,insertdatetime,preview,media,visualchars,xhtmlxtras",
            theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,insertdate,inserttime,|,forecolor,backcolor,|,hr,removeformat,formatselect",
            theme_advanced_buttons2 : "link,unlink,image,media,|,undo,redo,cleanup,|,code,preview",
            theme_advanced_buttons3 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_path_location : "bottom",
            height:"350px",
            width:"550px",
            extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
            browsers : "msie,gecko,opera,safari"
        });
    </script>
{/literal}

主要注意的几个参数:

  • width及height元素:要修改tinyMCE wysiwyg的输入框大小,可以修改height和width值。
  • elements元素: elements : “bodytext,summarytext” 是指对<textarea name=”bodytext”..>和<textarea name=”summarytext” ..>这样的元素起作用;

tinymce的一些参数说明:

  • mode: textareas/specific_textareas/exact

textareas: 替换当前页的所有textarea为编辑器

specific_textareas: 不是很明白(特定的textarea??),要配合 textarea_trigger使用

exact: 替换指定ID的div或者textarea为编辑器,要配合elements使用。

  • theme: advanced/simple
    advanced: 高级模式,功能比较多一点。(默认)
    simple: 基本模式,只有基本的功能。
  • plugins: advhr/advimage/advlink/contextmenu/emotions/flash/autosave/style/layer/iespell/insertdatetime/paste/preview/print/save/noneditable/spellchecker/searchreplace/table/zoom/directionality/fullscreen/fullpage/inlinepopups/fullpage
    这些是自带的一些插件,看名字基本上都能明白它的功能。在网站上还有一些其它功能的插件,可以自己去下,放在插件目录下就可以了。
    (”-”加上可以让MCE不试图从插件目录加载这个插件,如plugins : “table,contextmenu,paste,-externalplugin”)
  • language: en/zh_cn/zh_cn_utf8……
    设置使用的语言,网站上也有的下,需要注意的是中文简体和繁体都有两种uft8的,要确定你使用的页面的编码。
    (eg:language : “en”)
  • width:
    height:
    设置编辑器的宽度和高度

具体可以参看http://wiki.moxiecode.com/index.php/TinyMCE:Index

7、参考资料:

http://forums.pligg.com/pligg-mods/5124-mod-tinymce-editor-story-submission-step-2-a.html

http://forums.pligg.com/pligg-mods/853-wysiwyg-editor.html

Technorati 标签:,,,

Pligg安装过程记录

打算使用pligg用于自己日常的网摘使用,以统一网摘内容,避免零散在各个网摘站点上。

这此记录一下自己在基于dreamhost虚拟主机环境下配置pligg的安装过程。

环境说明:

dreamhost虚拟主机环境、linux系统、mysql数据库

wordpress作为缺省主页程序,安装路径为yeeach.com,将pligg的程序安装到wordpress目录下,pligg的安装路径为yeeach.com/digg

1、安装pligg

直接用了dreamhost提供的One-Click Installs的pligg安装包(9.8版本),安装完成后

chmod 644 digg/libs/dbconnect.php
rm -rf digg/install

2、在wordpress中新增page作为导航,并将新增页面的点击操作重定向到pligg

假设pligg路径为http://www.yeeach.com/yeeach-digg

在.htaccess中配置RewriteRule,只在RewriteBase /后增加

RewriteRule yeeach-digg /digg [L]

.htaccess完整的内容如下:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule yeeach-digg /digg [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

3、备份digg库并修改字符集

由于dreamhost的mysql缺省字符集为latin1,需要修改为utf8.

登录phpmyadmin或直接用mysqldump导出digg库为sql文件,手工将DEFAULT CHARSET从latin1替换为utf8

4、删除digg库的库表(虚拟主机用户没有权限直接drop库,只能删除表),导入替换字符集后的sql

5、确认digg表的字符集为utf8_general_ci

6、以god/12345登录pligg,修改口令

7、下载中文语言包

关于Pligg 9.8中文乱码解决方案(Chinese gibberish on Pligg 9.8 solutions)下载libs.zip包,解压后上传到libs/下

8、到“后台管理”的“修改语言”,按照自己需要调整术语说法

9、到“后台管理”的“设定配置”处修改“Searching”为2 = uses MySQL LIKE and is much slower, but returns better results. Also supports “*” and “-”

10、关于前后台界面汉化

前台界面汉化:采用pligg站点上下载的lang.conf已经汉化了前台,需要用pligg下载的汉化包覆盖libs/lang.conf;

后台界面汉化:后台管理界面的汉化需要修改数据库。可以从http://bpdig.com/forum/viewtopic.php?t=73下载后台汉化包,建议不要汉化,汉化很不好用,如要修改,修改前备份数据库后,出错后好回滚。

 

参考资料:

http://blog.bpdig.com/?cat=1
http://forums.pligg.com/pligg-mods/8892-pligg-9-8-chinese-gibberish-pligg-9-8-solutions.html

 

 

Technorati 标签: , ,