二蛋 发布的文章

SeaCMS后台自定义采集增加别名采集

编辑 /include/collection.class.php 文件,找到:

$v_data['v_name']=getAreaValue($loopstr,"name",$html,$listconf["removecode"]);
$v_data['v_name']=$this->filterWord($v_data['v_name'],0);
$v_data['v_enname']=Pinyin($v_data['v_name']);
$v_data['v_name'] =  htmlspecialchars($v_data['v_name']);
$v_data['v_name'] = str_replace(array('\\','()','\''),'/',$v_data['v_name']);

在下方插入:

$v_data['v_nickname']=getAreaValue($loopstr,"nickname",$html,$listconf["removecode"]);
$v_data['v_nickname'] =  htmlspecialchars($v_data['v_nickname']);

编辑 /include/collection.func.php 文件,找到:

getTestAreaValue($loopstr,"name","影片名称",$html,$removecode);

在下方插入:

getTestAreaValue($loopstr,"nickname","影片别名",$html,$removecode);

- 阅读剩余部分 -

通过UserAgent判断进行移动适配

nginx版

PC ==>> 移动

if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)){rewrite ^/(.*)$ http://m.2dan.cc/$1 permanent;}

移动 ==>> PC

if ($http_user_agent !~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)){rewrite ^/(.*)$ http://www.2dan.cc.com/$1 permanent;}

js版

(function(){var ua=navigator.userAgent.toLowerCase();var bIsIpad=ua.match(/ipad/i)=="ipad";var bIsIphoneOs=ua.match(/iphone os/i)=="iphone os";var bIsAndroid=ua.match(/android/i)=="android";var bIsWM=ua.match(/windows mobile/i)=="windows mobile";
if(bIsIpad||bIsIphoneOs||bIsAndroid||bIsWM){}else{var url=window.location.href;url=url.replace("m","www");window.location.href=url}})();

SeaCMS获取当前页面URL以使用Meta标签移动适配

编辑 /include/mkhtml.func.php 文件,找到:

function makePlayByData($vType,$vId,$playArr,$content,$sdate,$enname,$stringecho)
{
    if($GLOBALS['cfg_ismakeplay']==1){
        for($i=0;$i<$playArr[0];$i++)
        {
            $tmp =$content;
            $tmp = str_replace("{playpage:from}",$playArr[1][$i],$tmp);
            foreach ($playArr[2][$i] as $n=>$play){
                $tmp1 =$tmp;
                $playLink = str_replace($GLOBALS['cfg_cmspath'],"",getPlayLink2($vType,$vId,$sdate,$enname,$i,$n));
                $tmp1 = str_replace("{playpage:part}",$play,$tmp1);

在下方插入:

$tmp1 = str_replace("{currentpageurl}",'http://'.$_SERVER['HTTP_HOST'].$playLink,$tmp1);

找到:

if($TotalResult == 0||strpos($content,'{/seacms:channellist}')===false){
        $channelLink=str_replace($GLOBALS['cfg_cmspath'],"",getChannelPagesLink($currentTypeId,1));
        $tempStr = str_replace("{channelpage:page}",1,$tempStr);
        $content=$tempStr;
        $content=$mainClassObj->ParsePageList($content,$typeIds,1,$pCount,$TotalResult,"channel",$currentTypeId);
        $content=$mainClassObj->parseIf($content);

在下方插入:

$content=str_replace("{currentpageurl}",'http://'.$_SERVER['HTTP_HOST'].$channelLink,$content);

- 阅读剩余部分 -

申请CloudFlare Partner计划以CNAME方式接入域名

1、申请Cloudflare partner计划

申请地址:https://www.cloudflare.com/partners/become-a-partner/
进入申请地址后,填写一些信息,网站个人博客也可以。
审核成功之后,邮箱会收到CF审核通过的邮件,点击邮件中的链接设置密码。
登录Partner账号,完善个人信息并生成api密钥。

2、Linux下使用cname接入Cloudflare

wget https://github.com/fffonion/cloudflare-partner-cli/raw/master/cloudflare-partner-cli.py
python ./cloudflare-partner-cli.py

输入api密钥。 可以从 https://partners.cloudflare.com/api-management 获得
验证成功后,输入要用来管理域名的账号的邮箱和密码,(你的个人账号,不是partner账号)
下面按照屏幕提示操作,成功添加后,会收到邮件。
源站地址(resolve_to)必须填写完整的dns,如google.com,不能填写ip