| @@ -1,76 +0,0 @@ | |||||
| <?php | |||||
| /** | |||||
| * 百度新闻 | |||||
| * | |||||
| * @version $Id: baidunews.php 1 14:31 2010年7月12日Z tianya $ | |||||
| * @package DedeBIZ.Administrator | |||||
| * @copyright Copyright (c) 2022, DedeBIZ.COM | |||||
| * @license https://www.dedebiz.com/license | |||||
| * @link https://www.dedebiz.com | |||||
| */ | |||||
| require_once(dirname(__FILE__)."/config.php"); | |||||
| $filename = str_replace("..", "", $filename); | |||||
| $filename = str_replace("{cmspath}", $cfg_cmspath, $filename); | |||||
| if (empty($do)) { | |||||
| include DEDEADMIN.'/templets/baidunews.htm'; | |||||
| } else { | |||||
| $baidunews = "<?xml version=\"1.0\" encoding=\"".$cfg_soft_lang."\" ?>\n"; | |||||
| $baidunews .= "<document>\n"; | |||||
| $baidunews .= "<webSite>$cfg_webname </webSite>\n"; | |||||
| $baidunews .= "<webMaster>$cfg_adminemail </webMaster>\n"; | |||||
| $baidunews .= "<updatePeri>$cfg_updateperi </updatePeri>\n"; | |||||
| $limit = $cfg_baidunews_limit; | |||||
| if ($limit > 100 || $limit < 1) { | |||||
| $limit = 100; | |||||
| } | |||||
| $query = "SELECT maintable.*, addtable.body, arctype.typename | |||||
| FROM `#@__archives` maintable | |||||
| LEFT JOIN `#@__addonarticle` addtable ON addtable.aid=maintable.id | |||||
| LEFT JOIN `#@__arctype` arctype ON arctype.ID=maintable.typeid | |||||
| WHERE maintable.channel=1 and maintable.arcrank!=-1 ORDER BY maintable.pubdate DESC LIMIT $limit | |||||
| "; | |||||
| $dsql->SetQuery($query); | |||||
| $dsql->Execute(); | |||||
| $proto = IsSSL()? "https://" : "http://"; | |||||
| while ($row = $dsql->GetArray()) { | |||||
| $title = dede_htmlspecialchars($row['title']); | |||||
| $row1 = GetOneArchive($row['id']); | |||||
| if ((strpos($row1['arcurl'], 'http://') === false) || (strpos($row1['arcurl'], 'https://') === false)) { | |||||
| $link = ($cfg_basehost == '' ? $proto.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$row1['arcurl']; | |||||
| } else { | |||||
| $link = $row1['arcurl']; | |||||
| } | |||||
| $link = dede_htmlspecialchars($link); | |||||
| $description = dede_htmlspecialchars(strip_tags($row['description'])); | |||||
| $text = dede_htmlspecialchars(strip_tags($row['body'])); | |||||
| $image = $row['litpic'] == '' ? '' : $row['litpic']; | |||||
| if ($image != '' && (strpos($image, 'http://') === false) || (strpos($image, 'https://') === false)) { | |||||
| $image = ($cfg_basehost == '' ? $proto.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$image; | |||||
| } | |||||
| //$headlineimg = ''; | |||||
| $keywords = dede_htmlspecialchars($row['keywords']); | |||||
| $category = dede_htmlspecialchars($row['typename']); | |||||
| $author = dede_htmlspecialchars($row['writer']); | |||||
| $source = dede_htmlspecialchars($row['source']); | |||||
| $pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i', $row['pubdate'] + $cfg_cli_time * 3600)); | |||||
| $baidunews .= "<item>\n"; | |||||
| $baidunews .= "<title>$title </title>\n"; | |||||
| $baidunews .= "<link>$link </link>\n"; | |||||
| $baidunews .= "<description>$description </description>\n"; | |||||
| $baidunews .= "<text>$text </text>\n"; | |||||
| $baidunews .= "<image>$image </image>\n"; | |||||
| //$baidunews .= "<headlineimages/>\n"; | |||||
| $baidunews .= "<keywords>$keywords </keywords>\n"; | |||||
| $baidunews .= "<category>$category </category>\n"; | |||||
| $baidunews .= "<author>$author </author>\n"; | |||||
| $baidunews .= "<source>$source </source>\n"; | |||||
| $baidunews .= "<pubDate>$pubdate </pubDate>\n"; | |||||
| $baidunews .= "</item>\n"; | |||||
| } | |||||
| $baidunews .= "</document>\n"; | |||||
| $fname = str_replace("//","/",DEDEROOT.$filename) ; | |||||
| $fp = fopen($fname, 'w'); | |||||
| fwrite($fp, $baidunews); | |||||
| fclose($fp); | |||||
| showmsg("<a href='{$filename}' target=\"_blank\">{$filename}生成成功</a>", 'javascript:;'); | |||||
| } | |||||
| @@ -14,11 +14,11 @@ if (empty($uploadfile)) { | |||||
| $uploadfile = ""; | $uploadfile = ""; | ||||
| } | } | ||||
| if (!is_uploaded_file($uploadfile)) { | if (!is_uploaded_file($uploadfile)) { | ||||
| ShowMsg("您没有选择上传的文件!", "-1"); | |||||
| ShowMsg("您没有选择上传的文件", "-1"); | |||||
| exit(); | exit(); | ||||
| } | } | ||||
| if (!preg_match("#^text#", $uploadfile_type)) { | if (!preg_match("#^text#", $uploadfile_type)) { | ||||
| ShowMsg("您上传的不是文本类型附件!", "-1"); | |||||
| ShowMsg("您上传的不是文本类型附件", "-1"); | |||||
| exit(); | exit(); | ||||
| } | } | ||||
| if (!preg_match("#\.(".$cfg_txttype.")#i", $uploadfile_name)) { | if (!preg_match("#\.(".$cfg_txttype.")#i", $uploadfile_name)) { | ||||
| @@ -11,9 +11,9 @@ | |||||
| require_once(dirname(__FILE__)."/config.php"); | require_once(dirname(__FILE__)."/config.php"); | ||||
| require_once(DEDEINC."/datalistcp.class.php"); | require_once(DEDEINC."/datalistcp.class.php"); | ||||
| CheckPurview('shops_Operations'); | CheckPurview('shops_Operations'); | ||||
| if (!isset($oid)) exit("<a href='javascript:window.close()'>无效操作!</a>"); | |||||
| if (!isset($oid)) exit("<a href='javascript:window.close()'>无效操作</a>"); | |||||
| $oid = preg_replace("#[^-0-9A-Z]#", "", $oid); | $oid = preg_replace("#[^-0-9A-Z]#", "", $oid); | ||||
| if (empty($oid)) exit("<a href='javascript:window.close()'>无效订单号!</a>"); | |||||
| if (empty($oid)) exit("<a href='javascript:window.close()'>无效订单号</a>"); | |||||
| $row = $dsql->GetOne("SELECT * FROM `#@__shops_userinfo` WHERE oid='$oid'"); | $row = $dsql->GetOne("SELECT * FROM `#@__shops_userinfo` WHERE oid='$oid'"); | ||||
| $sql = "SELECT o.*,p.title,p.price as uprice,d.dname FROM `#@__shops_orders` as o left join `#@__shops_products` as p on o.oid=p.oid left join `#@__shops_delivery` as d on d.pid=o.pid WHERE o.oid='$oid'"; | $sql = "SELECT o.*,p.title,p.price as uprice,d.dname FROM `#@__shops_orders` as o left join `#@__shops_products` as p on o.oid=p.oid left join `#@__shops_delivery` as d on d.pid=o.pid WHERE o.oid='$oid'"; | ||||
| $dlist = new DataListCP(); | $dlist = new DataListCP(); | ||||
| @@ -10,13 +10,13 @@ | |||||
| */ | */ | ||||
| require_once(dirname(__FILE__)."/config.php"); | require_once(dirname(__FILE__)."/config.php"); | ||||
| CheckPurview('shops_Operations'); | CheckPurview('shops_Operations'); | ||||
| if (!isset($oid)) exit("<a href='javascript:window.close()'>无效操作!</a>"); | |||||
| if (!isset($oid)) exit("<a href='javascript:window.close()'>无效操作</a>"); | |||||
| $oid = preg_replace("#[^-0-9A-Z]#", "", $oid); | $oid = preg_replace("#[^-0-9A-Z]#", "", $oid); | ||||
| if (empty($oid)) exit("<a href='javascript:window.close()'>无效订单号!</a>"); | |||||
| if (empty($oid)) exit("<a href='javascript:window.close()'>无效订单号</a>"); | |||||
| $rows = $dsql->GetOne("SELECT * FROM `#@__shops_userinfo` WHERE oid='$oid' LIMIT 0,1"); | $rows = $dsql->GetOne("SELECT * FROM `#@__shops_userinfo` WHERE oid='$oid' LIMIT 0,1"); | ||||
| if (!is_array($rows)) { | if (!is_array($rows)) { | ||||
| $dsql->Close(); | $dsql->Close(); | ||||
| exit("<a href='javascript:window.close()'>该订单下没相关用户信息!</a>"); | |||||
| exit("<a href='javascript:window.close()'>该订单下没相关用户信息</a>"); | |||||
| } | } | ||||
| $row = $dsql->GetOne("SELECT pid,dprice FROM `#@__shops_orders` WHERE oid='$oid'"); | $row = $dsql->GetOne("SELECT pid,dprice FROM `#@__shops_orders` WHERE oid='$oid'"); | ||||
| if (is_array($row)) { | if (is_array($row)) { | ||||
| @@ -26,7 +26,7 @@ | |||||
| <tr> | <tr> | ||||
| <td align="center"> | <td align="center"> | ||||
| <table width="98%" cellspacing="0" cellpadding="5"> | <table width="98%" cellspacing="0" cellpadding="5"> | ||||
| <?php foreach ($row['soniterm'] as $rows) {?> | |||||
| <?php foreach ($row['soniterm'] as $rows) { ?> | |||||
| <tr> | <tr> | ||||
| <td align="left"><a href="<?php echo $rows['linkurl'] ?>" target="main"><?php echo $rows['title'] ?></a><br><?php echo $rows['description'] ?></td> | <td align="left"><a href="<?php echo $rows['linkurl'] ?>" target="main"><?php echo $rows['title'] ?></a><br><?php echo $rows['description'] ?></td> | ||||
| </tr> | </tr> | ||||
| @@ -1,41 +0,0 @@ | |||||
| <!DOCTYPE html> | |||||
| <html> | |||||
| <head> | |||||
| <meta charset="<?php echo $cfg_soft_lang; ?>"> | |||||
| <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> | |||||
| <title>百度新闻地图</title> | |||||
| <link rel="stylesheet" href="../static/web/css/bootstrap.min.css"> | |||||
| <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css"> | |||||
| <link rel="stylesheet" href="../static/web/css/admin.css"> | |||||
| </head> | |||||
| <body> | |||||
| <table width="98%" align="center" cellpadding="4" cellspacing="1" class="table maintable mt-3 mb-3"> | |||||
| <tr> | |||||
| <td colspan="2" background="../static/web/img/tbg.gif" style="padding-left:10px">百度新闻地图</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td colspan="2"> | |||||
| <p>《互联网新闻开放协议》是百度新闻搜索制定的搜索引擎新闻源收录标准,网站可将发布的新闻内容制作成遵循此开放协议的XML格式的网页(独立于原有的新闻发布形式)供搜索引擎索引</p> | |||||
| <p> <a href="http://news.baidu.com/newsop.html#kg" target="_blank">详情参见</a></p> | |||||
| <p>配置的相关参数在 <a href="sys_info.php">系统设置</a>-其他选项中调整</p> | |||||
| <p>只适用于文章频道,数据表为V6默认的</p> | |||||
| </td> | |||||
| </tr> | |||||
| <form id="form2" name="form1" method="post" action="?do=yes" target="stafrm"> | |||||
| <tr> | |||||
| <td>文件名:</td> | |||||
| <td><input name="filename" type="text" id="textfield" value="{cmspath}/a/baidunews.xml" size="30" class='alltxt' /></td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td height="26" bgcolor="#F8FCF1" colspan="2" align="center"><button name="button" type="submit" class="btn btn-success btn-sm" id="button">开始生成</button></td> | |||||
| </tr> | |||||
| </form> | |||||
| <tr> | |||||
| <td colspan="2">状态:</td> | |||||
| </tr> | |||||
| <tr> | |||||
| <td align="center" colspan="2"><iframe name="stafrm" frameborder="0" id="stafrm" width="96%" height="360px"></td> | |||||
| </tr> | |||||
| </table> | |||||
| </body> | |||||
| </html> | |||||
| @@ -17,7 +17,8 @@ | |||||
| <a href="friendlink_main.php">友情链接管理</a> | <a href="friendlink_main.php">友情链接管理</a> | ||||
| <a href="friendlink_add.php" class="btn btn-success btn-sm">增加链接</a> | <a href="friendlink_add.php" class="btn btn-success btn-sm">增加链接</a> | ||||
| <a href="friendlink_type.php" class="btn btn-success btn-sm">网站类型管理</a> | <a href="friendlink_type.php" class="btn btn-success btn-sm">网站类型管理</a> | ||||
| <a href='../apps/flink_add.php' target='_blank' class="btn btn-success btn-sm">外部申请表单</a></td> | |||||
| <a href='../apps/flink_add.php' target='_blank' class="btn btn-success btn-sm">外部申请表单</a> | |||||
| </td> | |||||
| </tr> | </tr> | ||||
| <tr bgcolor="#F8FCF1"> | <tr bgcolor="#F8FCF1"> | ||||
| <td width="4%" height="26" align="center">类型ID</td> | <td width="4%" height="26" align="center">类型ID</td> | ||||
| @@ -1,4 +1,4 @@ | |||||
| {dede:config.pagesize value="30"/} | |||||
| {dede:config.pagesize value='30'/} | |||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||
| <html> | <html> | ||||
| <head> | <head> | ||||
| @@ -1,4 +1,4 @@ | |||||
| {dede:config.pagesize value="30"/} | |||||
| {dede:config.pagesize value='30'/} | |||||
| <!DOCTYPE html> | <!DOCTYPE html> | ||||
| <html> | <html> | ||||
| <head> | <head> | ||||
| @@ -17,7 +17,7 @@ | |||||
| </td> | </td> | ||||
| </tr> | </tr> | ||||
| <tr> | <tr> | ||||
| <td height="26" colspan="2">下载的文件临时存放在文件夹(<span class='text-danger'>../data/<?php echo $tmpdir; ?></span>)内,如果某些基础类有重要的改动导致更新中途中错,您可以从这文件夹提取文件手工更新</td> | |||||
| <td height="26" colspan="2">下载的文件临时存放在文件夹<span class='text-danger'>../data/<?php echo $tmpdir; ?></span>内,如果某些基础类有重要的改动导致更新中途中错,您可以从这文件夹提取文件手工更新</td> | |||||
| </tr> | </tr> | ||||
| <?php echo $dirinfos; ?> | <?php echo $dirinfos; ?> | ||||
| <tr bgcolor="#F8FEDA"> | <tr bgcolor="#F8FEDA"> | ||||
| @@ -1,21 +1,17 @@ | |||||
| <?php | <?php | ||||
| /*--------------------------------------------------------------------------------------------- | /*--------------------------------------------------------------------------------------------- | ||||
| 文件远程发布目录更新配置(config.file.inc.php) | |||||
| 说明:本文件主要用于系统后台[生成]-[自动任务]-[远程服务器同步] | |||||
| 中的文件夹自定义更新配置所用,使用时候如果有特定目录需要进行同 | |||||
| 步,则需要在这个文件中进行配置,配置方式如下: | |||||
| 说明:本文件主要用于系统后台[生成]-[自动任务]-[远程服务器同步]文件远程发布目录更新配置(config.file.inc.php) | |||||
| 中的文件夹自定义更新配置所用,使用时候如果有特定目录需要进行同步,则需要在这个文件中进行配置,配置方式如下: | |||||
| $remotefile[] = array( | $remotefile[] = array( | ||||
| 'filedir' => '/yourdir', //同步文件夹目录 | 'filedir' => '/yourdir', //同步文件夹目录 | ||||
| 'description' => '这里是文件夹说明', | |||||
| 'dfserv' => '0', //默认服务器选项,可以在系统后台[系统设置]-[服务器分布/远程 ]中配置 | |||||
| 'state' => '0', //同步状态,0:未同步 1:已同步 | |||||
| 'description' => ' //这里是文件夹说明', | |||||
| 'dfserv' => '0', //默认服务器选项,可以在系统后台[系统设置]-[服务器分布/远程 ]中配置 | |||||
| 'state' => '0', //同步状态,0:未同步 1:已同步 | |||||
| ); | ); | ||||
| -----------------------------------------------------------------------------------------------*/ | -----------------------------------------------------------------------------------------------*/ | ||||
| global $remotefile; | global $remotefile; | ||||
| $remotefile = array(); | $remotefile = array(); | ||||
| //以下是必备同步配置项 | //以下是必备同步配置项 | ||||
| //@start_config 不要改动下面<>结构 | |||||
| #<s_config> | |||||
| $remotefile[0] = array( | $remotefile[0] = array( | ||||
| 'filedir'=>'/a', | 'filedir'=>'/a', | ||||
| 'description'=>'文档HTML默认保存路', | 'description'=>'文档HTML默认保存路', | ||||
| @@ -24,53 +20,17 @@ $remotefile[0] = array( | |||||
| 'issystem'=>1 | 'issystem'=>1 | ||||
| ); | ); | ||||
| $remotefile[1] = array( | $remotefile[1] = array( | ||||
| 'filedir'=>'/longhoo', | |||||
| 'description'=>'文档HTML默认保存路', | |||||
| 'filedir'=>'/static', | |||||
| 'description'=>'图片上传文件默认路径', | |||||
| 'dfserv'=>0, | 'dfserv'=>0, | ||||
| 'state'=>1, | 'state'=>1, | ||||
| 'issystem'=>1 | 'issystem'=>1 | ||||
| ); | ); | ||||
| $remotefile[2] = array( | $remotefile[2] = array( | ||||
| 'filedir'=>'/uploads', | |||||
| 'description'=>'图片/上传文件默认路径', | |||||
| 'dfserv'=>0, | |||||
| 'state'=>1, | |||||
| 'issystem'=>1 | |||||
| ); | |||||
| $remotefile[3] = array( | |||||
| 'filedir'=>'/special', | |||||
| 'filedir'=>'/apps/special', | |||||
| 'description'=>'专题目录', | 'description'=>'专题目录', | ||||
| 'dfserv'=>0, | 'dfserv'=>0, | ||||
| 'state'=>1, | 'state'=>1, | ||||
| 'issystem'=>1 | 'issystem'=>1 | ||||
| ); | ); | ||||
| $remotefile[4] = array( | |||||
| 'filedir'=>'/data/js', | |||||
| 'description'=>'生成js目录', | |||||
| 'dfserv'=>0, | |||||
| 'state'=>1, | |||||
| 'issystem'=>1 | |||||
| ); | |||||
| $remotefile[5] = array( | |||||
| 'filedir'=>'/images', | |||||
| 'description'=>'图片素材存放文件', | |||||
| 'dfserv'=>0, | |||||
| 'state'=>1, | |||||
| 'issystem'=>0 | |||||
| ); | |||||
| $remotefile[6] = array( | |||||
| 'filedir'=>'/templets/images', | |||||
| 'description'=>'模板文件图片存放目录', | |||||
| 'dfserv'=>0, | |||||
| 'state'=>1, | |||||
| 'issystem'=>0 | |||||
| ); | |||||
| $remotefile[7] = array( | |||||
| 'filedir'=>'/templets/style', | |||||
| 'description'=>'模板文件CSS样式存放目录', | |||||
| 'dfserv'=>0, | |||||
| 'state'=>1, | |||||
| 'issystem'=>0 | |||||
| ); | |||||
| #<e_config> | |||||
| ?> | ?> | ||||
| @@ -3946,11 +3946,11 @@ INSERT INTO `#@__sysconfig` VALUES | |||||
| ('2','cfg_cmspath','安装目录','2','string',''), | ('2','cfg_cmspath','安装目录','2','string',''), | ||||
| ('3','cfg_cookie_encode','Cookies加密码','2','string',''), | ('3','cfg_cookie_encode','Cookies加密码','2','string',''), | ||||
| ('4','cfg_indexurl','首页链接','1','string','/'), | ('4','cfg_indexurl','首页链接','1','string','/'), | ||||
| ('5','cfg_backup_dir','数据备份目录,在data文件夹里','2','string','backupdata'), | |||||
| ('5','cfg_backup_dir','数据备份目录,存data文件夹里','2','string','backupdata'), | |||||
| ('6','cfg_indexname','首页链接名','1','string','首页'), | ('6','cfg_indexname','首页链接名','1','string','首页'), | ||||
| ('7','cfg_webname','网站名称','1','string','某某公司'), | ('7','cfg_webname','网站名称','1','string','某某公司'), | ||||
| ('8','cfg_adminemail','网站发信邮箱','2','string','support@dedebiz.com'), | ('8','cfg_adminemail','网站发信邮箱','2','string','support@dedebiz.com'), | ||||
| ('9','cfg_html_editor','富文本(默认CKEditor可换修改其他富文本)','2','string','ckeditor'), | |||||
| ('9','cfg_html_editor','富文本,默认CKEditor可自行更换其它富文本','2','string','ckeditor'), | |||||
| ('10','cfg_arcdir','默认文档生成文件路径','1','string','/a'), | ('10','cfg_arcdir','默认文档生成文件路径','1','string','/a'), | ||||
| ('11','cfg_medias_dir','默认图片上传文件路径','1','string','/static'), | ('11','cfg_medias_dir','默认图片上传文件路径','1','string','/static'), | ||||
| ('12','cfg_ddimg_width','缩略图默认宽度','3','number','400'), | ('12','cfg_ddimg_width','缩略图默认宽度','3','number','400'), | ||||
| @@ -3961,7 +3961,7 @@ INSERT INTO `#@__sysconfig` VALUES | |||||
| ('17','cfg_mediatype','允许的多媒体文件类型','3','bstring','swf|rm|rmvb|mpg|mp3|mp4|wmv|wma|wav|mid|mov'), | ('17','cfg_mediatype','允许的多媒体文件类型','3','bstring','swf|rm|rmvb|mpg|mp3|mp4|wmv|wma|wav|mid|mov'), | ||||
| ('18','cfg_specnote','专题的最大节点数','2','number','10'), | ('18','cfg_specnote','专题的最大节点数','2','number','10'), | ||||
| ('19','cfg_list_symbol','栏目位置的间隔符号','2','string',''), | ('19','cfg_list_symbol','栏目位置的间隔符号','2','string',''), | ||||
| ('20','cfg_notallowstr','系统禁用词语,停止用户动作用“|”分开,但不要在结尾加“|”','5','bstring','神经病|废物'), | |||||
| ('20','cfg_notallowstr','系统禁用词语,用“|”分开,但不要在结尾加“|”','5','bstring','神经病|废物'), | |||||
| ('21','cfg_feedbackcheck','是否需审核评论及留言','5','bool','Y'), | ('21','cfg_feedbackcheck','是否需审核评论及留言','5','bool','Y'), | ||||
| ('22','cfg_keyword_replace','是否使用关键词替换功能,开启影响文档生成速度','2','bool','Y'), | ('22','cfg_keyword_replace','是否使用关键词替换功能,开启影响文档生成速度','2','bool','Y'), | ||||
| ('23','cfg_rewrite','是否使用伪静态,开启需添加伪静态规则','1','bool','N'), | ('23','cfg_rewrite','是否使用伪静态,开启需添加伪静态规则','1','bool','N'), | ||||
| @@ -4004,108 +4004,104 @@ INSERT INTO `#@__sysconfig` VALUES | |||||
| ('60','cfg_arc_autopic','提取第一张图片作为缩略图','7','bool','Y'), | ('60','cfg_arc_autopic','提取第一张图片作为缩略图','7','bool','Y'), | ||||
| ('61','cfg_arc_autokeyword','自动提取关键词','7','bool','N'), | ('61','cfg_arc_autokeyword','自动提取关键词','7','bool','N'), | ||||
| ('62','cfg_title_maxlen','文档标题最大长度,变量后需要手工修改数据表','7','number','250'), | ('62','cfg_title_maxlen','文档标题最大长度,变量后需要手工修改数据表','7','number','250'), | ||||
| ('64','cfg_album_row','图集多行多列样式默认行数','3','number','3'), | |||||
| ('65','cfg_album_col','图集多行多列样式默认列数','3','number','4'), | |||||
| ('66','cfg_album_pagesize','图集多页多图每页显示最大数','3','number','12'), | |||||
| ('67','cfg_album_style','图集默认样式(1为多页多图、2为多页单图、3为缩略图列表)','3','number','2'), | |||||
| ('68','cfg_album_ddwidth','图集默认缩略图大小','3','number','200'), | |||||
| ('69','cfg_mb_notallow','不允许注册的会员ID','4','bstring','www,bbs,ftp,mail,user,users,admin,administrator'), | |||||
| ('70','cfg_mb_idmin','用户ID最小长度','4','number','6'), | |||||
| ('71','cfg_mb_pwdmin','用户密码最小长度','4','number','6'), | |||||
| ('72','cfg_md_idurl','是否严格限定会员登录ID,允许会员使用二级域名必须设置此项','4','bool','N'), | |||||
| ('73','cfg_mb_rank','注册会员默认级别,会员权限管理中查看级别代表的数字','4','number','10'), | |||||
| ('74','cfg_feedback_time','两次评论至少间隔时间:秒','5','number','30'), | |||||
| ('75','cfg_feedback_numip','每个IP一小时内最大评论数','5','number','30'), | |||||
| ('76','cfg_md_mailtest','是否限制邮箱只能注册一个帐号','4','bool','Y'), | |||||
| ('77','cfg_mb_spacesta','会员使用权限开通状态(-10邮件验证、-1手工审核、0没限制)','4','number','-10'), | |||||
| ('78','cfg_mb_allowreg','是否允许新会员注册','4','bool','Y'), | |||||
| ('79','cfg_mb_adminlock','是否禁止访问管理员帐号的空间','4','bool','N'), | |||||
| ('80','cfg_vdcode_member','是否会员投稿验证码','5','bool','Y'), | |||||
| ('81','cfg_mb_cktitle','是否检测会员投稿重复标题','5','bool','Y'), | |||||
| ('82','cfg_mb_editday','投稿多少天后不能再修改','5','number','1'), | |||||
| ('83','cfg_sendarc_scores','投稿可获取积分','5','number','10'), | |||||
| ('84','cfg_caicai_sub','被踩扣除文章好评度','5','number','2'), | |||||
| ('85','cfg_caicai_add','被顶扣除文章好评度','5','number','2'), | |||||
| ('86','cfg_feedback_add','详细好评可获好评度','5','number','5'), | |||||
| ('87','cfg_feedback_sub','详细恶评扣除好评度','5','number','5'), | |||||
| ('88','cfg_sendfb_scores','参与评论可获积分','5','number','3'), | |||||
| ('89','cfg_search_max','最大搜索检查文档数','6','number','50000'), | |||||
| ('90','cfg_search_maxrc','最大返回搜索结果数','6','number','300'), | |||||
| ('91','cfg_search_time','搜索间隔时间:秒','6','number','3'), | |||||
| ('92','cfg_baidunews_limit','百度新闻更新新闻数量,最大100','8','string','100'), | |||||
| ('93','cfg_smtp_port','SMTP服务器端口','2','string','25'), | |||||
| ('94','cfg_sendmail_bysmtp','是否启用SMTP方式发送邮件','2','bool','Y'), | |||||
| ('95','cfg_smtp_server','SMTP服务器','2','string','smtp.qq.com'), | |||||
| ('96','cfg_smtp_usermail','SMTP服务器的用户邮箱','2','string','tianya@dedebiz.com'), | |||||
| ('97','cfg_smtp_user','SMTP服务器的用户帐号','2','string','tianya'), | |||||
| ('98','cfg_smtp_password','SMTP服务器的用户密码','2','string','tianya'), | |||||
| ('99','cfg_updateperi','百度新闻更新时间:分','8','string','15'), | |||||
| ('100','cfg_online_type','在线支付网关类型','2','string','nps'), | |||||
| ('101','cfg_upload_switch','删除文章文件同时删除相关附件文件','2','bool','Y'), | |||||
| ('102','cfg_fck_xhtml','是否使用富文本','2','bool','N'), | |||||
| ('103','cfg_allsearch_limit','网站全局搜索时间限制:秒','2','string','1'), | |||||
| ('104','cfg_delete','是否开启文章回收站','2','bool','Y'), | |||||
| ('105','cfg_keywords','站点默认关键词','1','string',''), | |||||
| ('106','cfg_description','站点描述','1','bstring',''), | |||||
| ('107','cfg_beian','网站备案号','1','string',''), | |||||
| ('108','cfg_need_typeid2','是否启用副栏目','6','bool','Y'), | |||||
| ('109','cfg_mb_pwdtype','前台密码验证类型:默认32—32位md5,可选:l16—前16位、r16—后16位、m16—中间16位','4','string','32'), | |||||
| ('110','cfg_cache_type','id 文档ID,content标签最终内容,修改此变量后必须更新系统缓存','6','string','id'), | |||||
| ('111','cfg_max_face','会员上传头像大小限制KB','3','number','100'), | |||||
| ('112','cfg_typedir_df','栏目网址使用目录名(不显示默认页,则是/a/b/c形式)','2','bool','Y'), | |||||
| ('113','cfg_make_andcat','发表文章后马上更新相关栏目','6','bool','N'), | |||||
| ('114','cfg_make_prenext','发表文章后马上更新上下篇','6','bool','N'), | |||||
| ('115','cfg_feedback_forbid','是否禁止所有评论,包括禁止顶踩等','5','bool','N'), | |||||
| ('116','cfg_addon_domainbind','是否绑定附件目录为指定的二级域名','7','bool','N'), | |||||
| ('117','cfg_addon_domain','附件目录的二级域名','7','string',''), | |||||
| ('118','cfg_df_dutyadmin','默认责任编辑名称','7','string','网站管理员'), | |||||
| ('119','cfg_mb_allowncarc','是否允许用户空间显示未审核文章','4','bool','Y'), | |||||
| ('120','cfg_mb_spaceallarc','会员空间中所有文档的频道ID(不限为0)','4','number','0'), | |||||
| ('121','cfg_face_adds','上传头像增加积分','5','number','10'), | |||||
| ('122','cfg_moreinfo_adds','填写详细资料增加积分','5','number','20'), | |||||
| ('123','cfg_money_scores','多少积分可以兑换一个金币','5','number','50'), | |||||
| ('124','cfg_mb_wnameone','是否允许用户昵称重复','4','bool','N'), | |||||
| ('125','cfg_arc_dirname','是否允许用目录作为文档文件名,文档命名规则:{typedir}/{aid}/index.html','7','bool','Y'), | |||||
| ('126','cfg_puccache_time','需缓存内容全局缓存时间:秒','6','number','36000'), | |||||
| ('127','cfg_arc_click','文档默认点击数(-1表示随机50-200)','7','number','-1'), | |||||
| ('128','cfg_addon_savetype','附件保存形式,按data函数日期参数(y年m月d日)','3','string','ymd'), | |||||
| ('129','cfg_qk_uploadlit','异步上传缩略图,空间太不稳定用户关闭此项','3','bool','Y'), | |||||
| ('130','cfg_login_adds','登录会员中心获积分','5','number','2'), | |||||
| ('131','cfg_userad_adds','会员推广获积分','5','number','10'), | |||||
| ('132','cfg_ddimg_full','是否使用缩略图强制大小,对背景填充','3','bool','N'), | |||||
| ('133','cfg_ddimg_bgcolor','缩略图空白背景填充颜色(0白,1黑)','3','number','0'), | |||||
| ('134','cfg_replace_num','文档内容关键词替换次数(0为全部替换)','7','number','1'), | |||||
| ('135','cfg_uplitpic_cut','是否上传缩略图后马上弹出裁剪框','3','bool','Y'), | |||||
| ('136','cfg_album_mark','是否使用图集水印,小图也会受影响','3','bool','N'), | |||||
| ('137','cfg_mb_feedcheck','是否需要会员动态审核','4','bool','N'), | |||||
| ('138','cfg_mb_msgischeck','是否需要会员状态审核','4','bool','N'), | |||||
| ('139','cfg_title_site','是否发布和编辑文档时远程发布,启用远程站点的前提下','2','bool','N'), | |||||
| ('140','cfg_mysql_type','数据库类型,支持MySQL和Mysqli','2','string','mysql'), | |||||
| ('141', 'cfg_domain_cookie', '跨域共享Cookie的域名,例如: www.dedebiz.com', 2, 'string', ''), | |||||
| ('142', 'cfg_cross_sectypeid', '支持交叉栏目显示副栏目内容', '7', 'bool', 'Y'), | |||||
| ('143', 'cfg_digg_update', '顶踩缓存异步更新间隔(0为不缓存)', '6', 'number', '0'), | |||||
| ('144', 'cfg_feedback_guest', '是否允许匿名评论', '5', 'bool', 'N'), | |||||
| ('145', 'cfg_feedback_msglen', '评论内容字数限定', 5, 'number', '250'), | |||||
| ('146', 'cfg_auth_code', '商业版授权码', 1, 'bstring', ''), | |||||
| ('147', 'cfg_bizcore_hostname', 'DedeBIZ Core地址', 1, 'string', '127.0.0.1'), | |||||
| ('148', 'cfg_bizcore_port', 'DedeBIZ Core端口', 1, 'number', '8181'), | |||||
| ('149', 'cfg_bizcore_appid', 'DedeBIZ Core应用ID', 1, 'string', ''), | |||||
| ('150', 'cfg_bizcore_key', 'DedeBIZ Core通信密钥', 1, 'string', ''), | |||||
| ('151', 'cfg_tags_dir', 'TAGS生成目录', 7, 'string', '{cmspath}/a/tags'); | |||||
| ('63','cfg_album_row','图集多行多列样式默认行数','3','number','3'), | |||||
| ('64','cfg_album_col','图集多行多列样式默认列数','3','number','4'), | |||||
| ('65','cfg_album_pagesize','图集多页多图每页显示最大数','3','number','12'), | |||||
| ('66','cfg_album_style','图集默认样式(1为多页多图、2为多页单图、3为缩略图列表)','3','number','2'), | |||||
| ('67','cfg_album_ddwidth','图集默认缩略图大小','3','number','200'), | |||||
| ('68','cfg_mb_notallow','不允许注册的会员ID','4','bstring','www,bbs,ftp,mail,user,users,admin,administrator'), | |||||
| ('69','cfg_mb_idmin','用户ID最小长度','4','number','6'), | |||||
| ('70','cfg_mb_pwdmin','用户密码最小长度','4','number','6'), | |||||
| ('71','cfg_md_idurl','是否严格限定会员登录ID,允许会员使用二级域名必须设置此项','4','bool','N'), | |||||
| ('72','cfg_mb_rank','注册会员默认级别,会员权限管理中查看级别代表的数字','4','number','10'), | |||||
| ('73','cfg_feedback_time','两次评论至少间隔时间:秒','5','number','30'), | |||||
| ('74','cfg_feedback_numip','每个IP一小时内最大评论数','5','number','30'), | |||||
| ('75','cfg_md_mailtest','是否限制邮箱只能注册一个帐号','4','bool','Y'), | |||||
| ('76','cfg_mb_spacesta','会员使用权限开通状态(-10邮件验证、-1手工审核、0没限制)','4','number','-10'), | |||||
| ('77','cfg_mb_allowreg','是否允许新会员注册','4','bool','Y'), | |||||
| ('78','cfg_mb_adminlock','是否禁止访问管理员帐号的空间','4','bool','N'), | |||||
| ('79','cfg_vdcode_member','是否会员投稿验证码','5','bool','Y'), | |||||
| ('80','cfg_mb_cktitle','是否检测会员投稿重复标题','5','bool','Y'), | |||||
| ('81','cfg_mb_editday','投稿多少天后不能再修改','5','number','1'), | |||||
| ('82','cfg_sendarc_scores','投稿可获取积分','5','number','10'), | |||||
| ('83','cfg_caicai_sub','被踩扣除文章好评度','5','number','2'), | |||||
| ('84','cfg_caicai_add','被顶扣除文章好评度','5','number','2'), | |||||
| ('85','cfg_feedback_add','详细好评可获好评度','5','number','5'), | |||||
| ('86','cfg_feedback_sub','详细恶评扣除好评度','5','number','5'), | |||||
| ('87','cfg_sendfb_scores','参与评论可获积分','5','number','3'), | |||||
| ('88','cfg_search_max','最大搜索检查文档数','6','number','50000'), | |||||
| ('89','cfg_search_maxrc','最大返回搜索结果数','6','number','300'), | |||||
| ('90','cfg_search_time','搜索间隔时间:秒','6','number','3'), | |||||
| ('91','cfg_smtp_port','SMTP服务器端口','2','string','25'), | |||||
| ('92','cfg_sendmail_bysmtp','是否启用SMTP方式发送邮件','2','bool','Y'), | |||||
| ('93','cfg_smtp_server','SMTP服务器','2','string','smtp.qq.com'), | |||||
| ('94','cfg_smtp_usermail','SMTP服务器的用户邮箱','2','string','tianya@dedebiz.com'), | |||||
| ('95','cfg_smtp_user','SMTP服务器的用户帐号','2','string','tianya'), | |||||
| ('96','cfg_smtp_password','SMTP服务器的用户密码','2','string','tianya'), | |||||
| ('97','cfg_updateperi','百度新闻更新时间:分','8','string','15'), | |||||
| ('98','cfg_online_type','在线支付网关类型','2','string','nps'), | |||||
| ('99','cfg_upload_switch','删除文章同时删除相关附件文件','2','bool','Y'), | |||||
| ('100','cfg_fck_xhtml','是否使用富文本','2','bool','N'), | |||||
| ('101','cfg_allsearch_limit','网站全局搜索时间限制:秒','2','string','1'), | |||||
| ('102','cfg_delete','是否开启文章回收站','2','bool','Y'), | |||||
| ('103','cfg_keywords','站点默认关键词','1','string',''), | |||||
| ('104','cfg_description','站点描述','1','bstring',''), | |||||
| ('105','cfg_beian','网站备案号','1','string',''), | |||||
| ('106','cfg_need_typeid2','是否启用副栏目','6','bool','Y'), | |||||
| ('107','cfg_mb_pwdtype','前台密码验证类型,默认32—32位md5(l16—前16位、r16—后16位、m16—中间16位)','4','string','32'), | |||||
| ('108','cfg_cache_type','id 文档ID,content标签最终内容,修改此变量后必须更新系统缓存','6','string','id'), | |||||
| ('109','cfg_max_face','会员上传头像大小限制KB','3','number','100'), | |||||
| ('110','cfg_typedir_df','栏目网址使用目录名(不显示默认页,则/a/b/c形式)','2','bool','Y'), | |||||
| ('111','cfg_make_andcat','发表文章后马上更新相关栏目','6','bool','N'), | |||||
| ('112','cfg_make_prenext','发表文章后马上更新上下篇','6','bool','N'), | |||||
| ('113','cfg_feedback_forbid','是否禁止所有评论,包括禁止顶踩等','5','bool','N'), | |||||
| ('114','cfg_addon_domainbind','是否绑定附件目录为指定的二级域名','7','bool','N'), | |||||
| ('115','cfg_addon_domain','附件目录的二级域名','7','string',''), | |||||
| ('116','cfg_df_dutyadmin','默认责任编辑名称','7','string','网站管理员'), | |||||
| ('118','cfg_mb_allowncarc','是否允许用户空间显示未审核文章','4','bool','Y'), | |||||
| ('119','cfg_mb_spaceallarc','会员空间中所有文档的频道ID(不限为0)','4','number','0'), | |||||
| ('120','cfg_face_adds','上传头像增加积分','5','number','10'), | |||||
| ('121','cfg_moreinfo_adds','填写详细资料增加积分','5','number','20'), | |||||
| ('122','cfg_money_scores','多少积分可以兑换一个金币','5','number','50'), | |||||
| ('123','cfg_mb_wnameone','是否允许用户昵称重复','4','bool','N'), | |||||
| ('124','cfg_arc_dirname','是否允许用目录作为文档文件名,文档命名规则:{typedir}/{aid}/index.html','7','bool','Y'), | |||||
| ('125','cfg_puccache_time','需缓存内容全局缓存时间:秒','6','number','36000'), | |||||
| ('126','cfg_arc_click','文档默认点击数(-1表示随机50-200)','7','number','-1'), | |||||
| ('127','cfg_addon_savetype','附件保存形式,按data函数日期参数(y年m月d日)','3','string','ymd'), | |||||
| ('128','cfg_qk_uploadlit','异步上传缩略图,空间太不稳定用户关闭此项','3','bool','Y'), | |||||
| ('129','cfg_login_adds','登录会员中心获积分','5','number','2'), | |||||
| ('130','cfg_userad_adds','会员推广获积分','5','number','10'), | |||||
| ('131','cfg_ddimg_full','是否使用缩略图强制大小,对背景填充','3','bool','N'), | |||||
| ('132','cfg_ddimg_bgcolor','缩略图空白背景填充颜色(0白,1黑)','3','number','0'), | |||||
| ('133','cfg_replace_num','文档内容关键词替换次数(0为全部替换)','7','number','1'), | |||||
| ('134','cfg_uplitpic_cut','是否上传缩略图后马上弹出裁剪框','3','bool','Y'), | |||||
| ('135','cfg_album_mark','是否使用图集水印,小图也会受影响','3','bool','N'), | |||||
| ('136','cfg_mb_feedcheck','是否需要会员动态审核','4','bool','N'), | |||||
| ('137','cfg_mb_msgischeck','是否需要会员状态审核','4','bool','N'), | |||||
| ('138','cfg_title_site','是否发布和编辑文档时远程发布,启用远程站点的前提下','2','bool','N'), | |||||
| ('139','cfg_mysql_type','数据库类型,支持MySQL和Mysqli','2','string','mysql'), | |||||
| ('140', 'cfg_domain_cookie', '跨域共享Cookie的域名,例如: www.dedebiz.com', 2, 'string', ''), | |||||
| ('141', 'cfg_cross_sectypeid', '支持交叉栏目显示副栏目内容', '7', 'bool', 'Y'), | |||||
| ('142', 'cfg_digg_update', '顶踩缓存异步更新间隔(0为不缓存)', '6', 'number', '0'), | |||||
| ('143', 'cfg_feedback_guest', '是否允许匿名评论', '5', 'bool', 'N'), | |||||
| ('144', 'cfg_feedback_msglen', '评论内容字数限定', 5, 'number', '250'), | |||||
| ('145', 'cfg_auth_code', '商业版授权码', 1, 'bstring', ''), | |||||
| ('146', 'cfg_bizcore_hostname', 'DedeBIZ Core地址', 1, 'string', '127.0.0.1'), | |||||
| ('147', 'cfg_bizcore_port', 'DedeBIZ Core端口', 1, 'number', '8181'), | |||||
| ('148', 'cfg_bizcore_appid', 'DedeBIZ Core应用ID', 1, 'string', ''), | |||||
| ('149', 'cfg_bizcore_key', 'DedeBIZ Core通信密钥', 1, 'string', ''), | |||||
| ('150', 'cfg_tags_dir', 'TAGS生成目录', 7, 'string', '{cmspath}/a/tags'); | |||||
| INSERT INTO `#@__sys_module` VALUES (1, '0cce60bc0238aa03804682c801584991', '百度新闻', '', '', 0, ''), | |||||
| (2, '1f35620fb42d452fa2bdc1dee1690f92', '文件管理器', '', '', 0, ''), | |||||
| (4, 'b437d85a7a7bc778c9c79b5ec36ab9aa', '友情链接', '', '', 0, ''), | |||||
| (5, 'acb8b88eb4a6d4bfc375c18534f9439e', '投票模块', '', '', 0, ''), | |||||
| (6, '572606600345b1a4bb8c810bbae434cc', '挑错管理', '', '', 0, ''); | |||||
| INSERT INTO `#@__sys_module` VALUES (1, '1f35620fb42d452fa2bdc1dee1690f92', '文件管理器', '', '', 0, ''), | |||||
| (2, 'b437d85a7a7bc778c9c79b5ec36ab9aa', '友情链接', '', '', 0, ''), | |||||
| (3, '72ffa6fabe3c236f9238a2b281bc0f93', '广告管理', '', '', 0, ''), | |||||
| (4, 'acb8b88eb4a6d4bfc375c18534f9439e', '投票模块', '', '', 0, ''), | |||||
| (5, '572606600345b1a4bb8c810bbae434cc', '挑错管理', '', '', 0, ''); | |||||
| INSERT INTO `#@__plus` VALUES (27, '友情链接模块', '<m:item name=''友情链接'' link=''friendlink_main.php'' rank=''plus_友情链接'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (24, '文件管理器', '<m:item name=''文件管理器'' link=''file_manage_main.php'' rank=''plus_文件管理器'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (23, '百度新闻', '<m:item name=''百度新闻'' link=''baidunews.php'' rank=''plus_百度新闻'' target=''main'' />', '', 'DedeBIZ', 1, 'baidunews.php'), | |||||
| (28, '投票模块', '<m:item name=''投票模块'' link=''vote_main.php'' rank=''plus_投票模块'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (25, '广告管理', '<m:item name=''广告管理'' link=''ad_main.php'' rank=''plus_广告管理'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (10, '挑错管理', '<m:item name=''挑错管理'' link=''erraddsave.php'' rank=''plus_挑错管理'' target=''main'' />', '', 'DedeBIZ', 1, '<m:item name=''挑错管理'' link=''catalog_do.php?dopost=erraddsave.php'' rank=''plus_挑错管理'' target=''main'' />'); | |||||
| INSERT INTO `#@__plus` VALUES (1, '文件管理器', '<m:item name=''文件管理器'' link=''file_manage_main.php'' rank=''plus_文件管理器'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (2, '友情链接模块', '<m:item name=''友情链接'' link=''friendlink_main.php'' rank=''plus_友情链接'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (3, '广告管理', '<m:item name=''广告管理'' link=''ad_main.php'' rank=''plus_广告管理'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (4, '投票模块', '<m:item name=''投票模块'' link=''vote_main.php'' rank=''plus_投票模块'' target=''main'' />', '', 'DedeBIZ', 1, ''), | |||||
| (5, '挑错管理', '<m:item name=''挑错管理'' link=''erraddsave.php'' rank=''plus_挑错管理'' target=''main'' />', '', 'DedeBIZ', 1, '<m:item name=''挑错管理'' link=''catalog_do.php?dopost=erraddsave.php'' rank=''plus_挑错管理'' target=''main'' />'); | |||||
| INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_disable_funs', '模板引擎禁用PHP函数', 7, 'bstring', ''); | |||||
| INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_disable_tags', '模板引擎禁用标签', 7, 'bstring', ''); | |||||
| ALTER TABLE `#@__arctiny` ADD INDEX `idx_typeid_arcrank_sortrank` (`typeid`, `arcrank`, `sortrank`); | ALTER TABLE `#@__arctiny` ADD INDEX `idx_typeid_arcrank_sortrank` (`typeid`, `arcrank`, `sortrank`); | ||||
| @@ -2,9 +2,7 @@ | |||||
| if (!defined('DEDEINC')) exit('dedebiz'); | if (!defined('DEDEINC')) exit('dedebiz'); | ||||
| require_once(DEDEINC."/libraries/crawlerdetect.class.php"); | require_once(DEDEINC."/libraries/crawlerdetect.class.php"); | ||||
| require_once(DEDEINC."/libraries/mobiledetect.class.php"); | require_once(DEDEINC."/libraries/mobiledetect.class.php"); | ||||
| // copyright https://github.com/jenssegers/agent | |||||
| //copyright https://github.com/jenssegers/agent | |||||
| class Agent extends Mobile_Detect | class Agent extends Mobile_Detect | ||||
| { | { | ||||
| /** | /** | ||||
| @@ -14,7 +12,6 @@ class Agent extends Mobile_Detect | |||||
| protected static $desktopDevices = [ | protected static $desktopDevices = [ | ||||
| 'Macintosh' => 'Macintosh', | 'Macintosh' => 'Macintosh', | ||||
| ]; | ]; | ||||
| /** | /** | ||||
| * List of additional operating systems. | * List of additional operating systems. | ||||
| * @var array | * @var array | ||||
| @@ -30,7 +27,6 @@ class Agent extends Mobile_Detect | |||||
| 'Linux' => 'Linux', | 'Linux' => 'Linux', | ||||
| 'ChromeOS' => 'CrOS', | 'ChromeOS' => 'CrOS', | ||||
| ]; | ]; | ||||
| /** | /** | ||||
| * List of additional browsers. | * List of additional browsers. | ||||
| * @var array | * @var array | ||||
| @@ -50,21 +46,19 @@ class Agent extends Mobile_Detect | |||||
| 'Mozilla' => 'Mozilla', | 'Mozilla' => 'Mozilla', | ||||
| 'WeChat' => 'MicroMessenger', | 'WeChat' => 'MicroMessenger', | ||||
| ]; | ]; | ||||
| /** | /** | ||||
| * List of additional properties. | * List of additional properties. | ||||
| * @var array | * @var array | ||||
| */ | */ | ||||
| protected static $additionalProperties = [ | protected static $additionalProperties = [ | ||||
| // Operating systems | |||||
| //Operating systems | |||||
| 'Windows' => 'Windows NT [VER]', | 'Windows' => 'Windows NT [VER]', | ||||
| 'Windows NT' => 'Windows NT [VER]', | 'Windows NT' => 'Windows NT [VER]', | ||||
| 'OS X' => 'OS X [VER]', | 'OS X' => 'OS X [VER]', | ||||
| 'BlackBerryOS' => ['BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'], | 'BlackBerryOS' => ['BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'], | ||||
| 'AndroidOS' => 'Android [VER]', | 'AndroidOS' => 'Android [VER]', | ||||
| 'ChromeOS' => 'CrOS x86_64 [VER]', | 'ChromeOS' => 'CrOS x86_64 [VER]', | ||||
| // Browsers | |||||
| //Browsers | |||||
| 'Opera Mini' => 'Opera Mini/[VER]', | 'Opera Mini' => 'Opera Mini/[VER]', | ||||
| 'Opera' => [' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]', 'Opera [VER]'], | 'Opera' => [' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]', 'Opera [VER]'], | ||||
| 'Netscape' => 'Netscape/[VER]', | 'Netscape' => 'Netscape/[VER]', | ||||
| @@ -74,12 +68,10 @@ class Agent extends Mobile_Detect | |||||
| 'Vivaldi' => 'Vivaldi/[VER]', | 'Vivaldi' => 'Vivaldi/[VER]', | ||||
| 'Coc Coc' => 'coc_coc_browser/[VER]', | 'Coc Coc' => 'coc_coc_browser/[VER]', | ||||
| ]; | ]; | ||||
| /** | /** | ||||
| * @var CrawlerDetect | * @var CrawlerDetect | ||||
| */ | */ | ||||
| protected static $crawlerDetect; | protected static $crawlerDetect; | ||||
| /** | /** | ||||
| * Get all detection rules. These rules include the additional | * Get all detection rules. These rules include the additional | ||||
| * platforms and browsers and utilities. | * platforms and browsers and utilities. | ||||
| @@ -88,32 +80,27 @@ class Agent extends Mobile_Detect | |||||
| public static function getDetectionRulesExtended() | public static function getDetectionRulesExtended() | ||||
| { | { | ||||
| static $rules; | static $rules; | ||||
| if (!$rules) { | if (!$rules) { | ||||
| $rules = static::mergeRules( | $rules = static::mergeRules( | ||||
| static::$desktopDevices, // NEW | |||||
| static::$desktopDevices, //NEW | |||||
| static::$phoneDevices, | static::$phoneDevices, | ||||
| static::$tabletDevices, | static::$tabletDevices, | ||||
| static::$operatingSystems, | static::$operatingSystems, | ||||
| static::$additionalOperatingSystems, // NEW | |||||
| static::$additionalOperatingSystems, //NEW | |||||
| static::$browsers, | static::$browsers, | ||||
| static::$additionalBrowsers, // NEW | |||||
| static::$additionalBrowsers, //NEW | |||||
| static::$utilities | static::$utilities | ||||
| ); | ); | ||||
| } | } | ||||
| return $rules; | return $rules; | ||||
| } | } | ||||
| public function getRules() | public function getRules() | ||||
| { | { | ||||
| if ($this->detectionType === static::DETECTION_TYPE_EXTENDED) { | if ($this->detectionType === static::DETECTION_TYPE_EXTENDED) { | ||||
| return static::getDetectionRulesExtended(); | return static::getDetectionRulesExtended(); | ||||
| } | } | ||||
| return static::getMobileDetectionRules(); | return static::getMobileDetectionRules(); | ||||
| } | } | ||||
| /** | /** | ||||
| * @return CrawlerDetect | * @return CrawlerDetect | ||||
| */ | */ | ||||
| @@ -122,10 +109,8 @@ class Agent extends Mobile_Detect | |||||
| if (static::$crawlerDetect === null) { | if (static::$crawlerDetect === null) { | ||||
| static::$crawlerDetect = new CrawlerDetect(); | static::$crawlerDetect = new CrawlerDetect(); | ||||
| } | } | ||||
| return static::$crawlerDetect; | return static::$crawlerDetect; | ||||
| } | } | ||||
| public static function getBrowsers() | public static function getBrowsers() | ||||
| { | { | ||||
| return static::mergeRules( | return static::mergeRules( | ||||
| @@ -133,7 +118,6 @@ class Agent extends Mobile_Detect | |||||
| static::$browsers | static::$browsers | ||||
| ); | ); | ||||
| } | } | ||||
| public static function getOperatingSystems() | public static function getOperatingSystems() | ||||
| { | { | ||||
| return static::mergeRules( | return static::mergeRules( | ||||
| @@ -141,7 +125,6 @@ class Agent extends Mobile_Detect | |||||
| static::$additionalOperatingSystems | static::$additionalOperatingSystems | ||||
| ); | ); | ||||
| } | } | ||||
| public static function getPlatforms() | public static function getPlatforms() | ||||
| { | { | ||||
| return static::mergeRules( | return static::mergeRules( | ||||
| @@ -149,12 +132,10 @@ class Agent extends Mobile_Detect | |||||
| static::$additionalOperatingSystems | static::$additionalOperatingSystems | ||||
| ); | ); | ||||
| } | } | ||||
| public static function getDesktopDevices() | public static function getDesktopDevices() | ||||
| { | { | ||||
| return static::$desktopDevices; | return static::$desktopDevices; | ||||
| } | } | ||||
| public static function getProperties() | public static function getProperties() | ||||
| { | { | ||||
| return static::mergeRules( | return static::mergeRules( | ||||
| @@ -162,7 +143,6 @@ class Agent extends Mobile_Detect | |||||
| static::$properties | static::$properties | ||||
| ); | ); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get accept languages. | * Get accept languages. | ||||
| * @param string $acceptLanguage | * @param string $acceptLanguage | ||||
| @@ -173,14 +153,11 @@ class Agent extends Mobile_Detect | |||||
| if ($acceptLanguage === null) { | if ($acceptLanguage === null) { | ||||
| $acceptLanguage = $this->getHttpHeader('HTTP_ACCEPT_LANGUAGE'); | $acceptLanguage = $this->getHttpHeader('HTTP_ACCEPT_LANGUAGE'); | ||||
| } | } | ||||
| if (!$acceptLanguage) { | if (!$acceptLanguage) { | ||||
| return []; | return []; | ||||
| } | } | ||||
| $languages = []; | $languages = []; | ||||
| // Parse accept language string. | |||||
| //Parse accept language string. | |||||
| foreach (explode(',', $acceptLanguage) as $piece) { | foreach (explode(',', $acceptLanguage) as $piece) { | ||||
| $parts = explode(';', $piece); | $parts = explode(';', $piece); | ||||
| $language = strtolower($parts[0]); | $language = strtolower($parts[0]); | ||||
| @@ -188,13 +165,10 @@ class Agent extends Mobile_Detect | |||||
| $languages[$language] = $priority; | $languages[$language] = $priority; | ||||
| } | } | ||||
| // Sort languages by priority. | |||||
| //Sort languages by priority. | |||||
| arsort($languages); | arsort($languages); | ||||
| return array_keys($languages); | return array_keys($languages); | ||||
| } | } | ||||
| /** | /** | ||||
| * Match a detection rule and return the matched key. | * Match a detection rule and return the matched key. | ||||
| * @param array $rules | * @param array $rules | ||||
| @@ -203,22 +177,19 @@ class Agent extends Mobile_Detect | |||||
| */ | */ | ||||
| protected function findDetectionRulesAgainstUA(array $rules, $userAgent = null) | protected function findDetectionRulesAgainstUA(array $rules, $userAgent = null) | ||||
| { | { | ||||
| // Loop given rules | |||||
| //Loop given rules | |||||
| foreach ($rules as $key => $regex) { | foreach ($rules as $key => $regex) { | ||||
| if (empty($regex)) { | if (empty($regex)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| // Check match | |||||
| //Check match | |||||
| if ($this->match($regex, $userAgent)) { | if ($this->match($regex, $userAgent)) { | ||||
| $val = (array)$this->matchesArray; | $val = (array)$this->matchesArray; | ||||
| return $key ?: reset($val); | return $key ?: reset($val); | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the browser name. | * Get the browser name. | ||||
| * @param string|null $userAgent | * @param string|null $userAgent | ||||
| @@ -228,7 +199,6 @@ class Agent extends Mobile_Detect | |||||
| { | { | ||||
| return $this->findDetectionRulesAgainstUA(static::getBrowsers(), $userAgent); | return $this->findDetectionRulesAgainstUA(static::getBrowsers(), $userAgent); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the platform name. | * Get the platform name. | ||||
| * @param string|null $userAgent | * @param string|null $userAgent | ||||
| @@ -238,7 +208,6 @@ class Agent extends Mobile_Detect | |||||
| { | { | ||||
| return $this->findDetectionRulesAgainstUA(static::getPlatforms(), $userAgent); | return $this->findDetectionRulesAgainstUA(static::getPlatforms(), $userAgent); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the device name. | * Get the device name. | ||||
| * @param string|null $userAgent | * @param string|null $userAgent | ||||
| @@ -252,10 +221,8 @@ class Agent extends Mobile_Detect | |||||
| static::getTabletDevices(), | static::getTabletDevices(), | ||||
| static::getUtilities() | static::getUtilities() | ||||
| ); | ); | ||||
| return $this->findDetectionRulesAgainstUA($rules, $userAgent); | return $this->findDetectionRulesAgainstUA($rules, $userAgent); | ||||
| } | } | ||||
| /** | /** | ||||
| * Check if the device is a desktop computer. | * Check if the device is a desktop computer. | ||||
| * @param string|null $userAgent deprecated | * @param string|null $userAgent deprecated | ||||
| @@ -264,17 +231,15 @@ class Agent extends Mobile_Detect | |||||
| */ | */ | ||||
| public function isDesktop($userAgent = null, $httpHeaders = null) | public function isDesktop($userAgent = null, $httpHeaders = null) | ||||
| { | { | ||||
| // Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront' | |||||
| //Check specifically for cloudfront headers if the useragent === 'Amazon CloudFront' | |||||
| if ($this->getUserAgent() === 'Amazon CloudFront') { | if ($this->getUserAgent() === 'Amazon CloudFront') { | ||||
| $cfHeaders = $this->getCfHeaders(); | $cfHeaders = $this->getCfHeaders(); | ||||
| if(array_key_exists('HTTP_CLOUDFRONT_IS_DESKTOP_VIEWER', $cfHeaders)) { | if(array_key_exists('HTTP_CLOUDFRONT_IS_DESKTOP_VIEWER', $cfHeaders)) { | ||||
| return $cfHeaders['HTTP_CLOUDFRONT_IS_DESKTOP_VIEWER'] === 'true'; | return $cfHeaders['HTTP_CLOUDFRONT_IS_DESKTOP_VIEWER'] === 'true'; | ||||
| } | } | ||||
| } | } | ||||
| return !$this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders) && !$this->isRobot($userAgent); | return !$this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders) && !$this->isRobot($userAgent); | ||||
| } | } | ||||
| /** | /** | ||||
| * Check if the device is a mobile phone. | * Check if the device is a mobile phone. | ||||
| * @param string|null $userAgent deprecated | * @param string|null $userAgent deprecated | ||||
| @@ -285,7 +250,6 @@ class Agent extends Mobile_Detect | |||||
| { | { | ||||
| return $this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders); | return $this->isMobile($userAgent, $httpHeaders) && !$this->isTablet($userAgent, $httpHeaders); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the robot name. | * Get the robot name. | ||||
| * @param string|null $userAgent | * @param string|null $userAgent | ||||
| @@ -299,7 +263,6 @@ class Agent extends Mobile_Detect | |||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Check if device is a robot. | * Check if device is a robot. | ||||
| * @param string|null $userAgent | * @param string|null $userAgent | ||||
| @@ -309,7 +272,6 @@ class Agent extends Mobile_Detect | |||||
| { | { | ||||
| return $this->getCrawlerDetect()->isCrawler($userAgent ?: $this->userAgent); | return $this->getCrawlerDetect()->isCrawler($userAgent ?: $this->userAgent); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the device type | * Get the device type | ||||
| * @param null $userAgent | * @param null $userAgent | ||||
| @@ -327,51 +289,38 @@ class Agent extends Mobile_Detect | |||||
| } elseif ($this->isRobot($userAgent)) { | } elseif ($this->isRobot($userAgent)) { | ||||
| return "robot"; | return "robot"; | ||||
| } | } | ||||
| return "other"; | return "other"; | ||||
| } | } | ||||
| public function version($propertyName, $type = self::VERSION_TYPE_STRING) | public function version($propertyName, $type = self::VERSION_TYPE_STRING) | ||||
| { | { | ||||
| if (empty($propertyName)) { | if (empty($propertyName)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| // set the $type to the default if we don't recognize the type | |||||
| //set the $type to the default if we don't recognize the type | |||||
| if ($type !== self::VERSION_TYPE_STRING && $type !== self::VERSION_TYPE_FLOAT) { | if ($type !== self::VERSION_TYPE_STRING && $type !== self::VERSION_TYPE_FLOAT) { | ||||
| $type = self::VERSION_TYPE_STRING; | $type = self::VERSION_TYPE_STRING; | ||||
| } | } | ||||
| $properties = self::getProperties(); | $properties = self::getProperties(); | ||||
| // Check if the property exists in the properties array. | |||||
| //Check if the property exists in the properties array. | |||||
| if (true === isset($properties[$propertyName])) { | if (true === isset($properties[$propertyName])) { | ||||
| // Prepare the pattern to be matched. | |||||
| // Make sure we always deal with an array (string is converted). | |||||
| //Prepare the pattern to be matched. | |||||
| //Make sure we always deal with an array (string is converted). | |||||
| $properties[$propertyName] = (array) $properties[$propertyName]; | $properties[$propertyName] = (array) $properties[$propertyName]; | ||||
| foreach ($properties[$propertyName] as $propertyMatchString) { | foreach ($properties[$propertyName] as $propertyMatchString) { | ||||
| if (is_array($propertyMatchString)) { | if (is_array($propertyMatchString)) { | ||||
| $propertyMatchString = implode("|", $propertyMatchString); | $propertyMatchString = implode("|", $propertyMatchString); | ||||
| } | } | ||||
| $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); | $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); | ||||
| // Identify and extract the version. | |||||
| //Identify and extract the version. | |||||
| preg_match(sprintf('#%s#is', $propertyPattern), $this->userAgent, $match); | preg_match(sprintf('#%s#is', $propertyPattern), $this->userAgent, $match); | ||||
| if (false === empty($match[1])) { | if (false === empty($match[1])) { | ||||
| $version = ($type === self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1]); | $version = ($type === self::VERSION_TYPE_FLOAT ? $this->prepareVersionNo($match[1]) : $match[1]); | ||||
| return $version; | return $version; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| /** | /** | ||||
| * Merge multiple rules into one array. | * Merge multiple rules into one array. | ||||
| * @param array $all | * @param array $all | ||||
| @@ -380,7 +329,6 @@ class Agent extends Mobile_Detect | |||||
| protected static function mergeRules(...$all) | protected static function mergeRules(...$all) | ||||
| { | { | ||||
| $merged = []; | $merged = []; | ||||
| foreach ($all as $rules) { | foreach ($all as $rules) { | ||||
| foreach ($rules as $key => $value) { | foreach ($rules as $key => $value) { | ||||
| if (empty($merged[$key])) { | if (empty($merged[$key])) { | ||||
| @@ -392,24 +340,19 @@ class Agent extends Mobile_Detect | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return $merged; | return $merged; | ||||
| } | } | ||||
| /** | /** | ||||
| * @inheritdoc | * @inheritdoc | ||||
| */ | */ | ||||
| public function __call($name, $arguments) | public function __call($name, $arguments) | ||||
| { | { | ||||
| // Make sure the name starts with 'is', otherwise | |||||
| //Make sure the name starts with 'is', otherwise | |||||
| if (strpos($name, 'is') !== 0) { | if (strpos($name, 'is') !== 0) { | ||||
| throw new Exception("No such method exists: $name"); | throw new Exception("No such method exists: $name"); | ||||
| } | } | ||||
| $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); | $this->setDetectionType(self::DETECTION_TYPE_EXTENDED); | ||||
| $key = substr($name, 2); | $key = substr($name, 2); | ||||
| return $this->matchUAAgainstKey($key); | return $this->matchUAAgainstKey($key); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -8,11 +8,9 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||||
| * This source file is subject to the MIT license that is bundled | * This source file is subject to the MIT license that is bundled | ||||
| * with this source code in the file LICENSE. | * with this source code in the file LICENSE. | ||||
| */ | */ | ||||
| require_once(DEDEINC."/libraries/fixtures/crawlers.php"); | require_once(DEDEINC."/libraries/fixtures/crawlers.php"); | ||||
| require_once(DEDEINC."/libraries/fixtures/exclusions.php"); | require_once(DEDEINC."/libraries/fixtures/exclusions.php"); | ||||
| require_once(DEDEINC."/libraries/fixtures/headers.php"); | require_once(DEDEINC."/libraries/fixtures/headers.php"); | ||||
| class CrawlerDetect | class CrawlerDetect | ||||
| { | { | ||||
| /** | /** | ||||
| @@ -21,56 +19,48 @@ class CrawlerDetect | |||||
| * @var string|null | * @var string|null | ||||
| */ | */ | ||||
| protected $userAgent; | protected $userAgent; | ||||
| /** | /** | ||||
| * Headers that contain a user agent. | * Headers that contain a user agent. | ||||
| * | * | ||||
| * @var array | * @var array | ||||
| */ | */ | ||||
| protected $httpHeaders = array(); | protected $httpHeaders = array(); | ||||
| /** | /** | ||||
| * Store regex matches. | * Store regex matches. | ||||
| * | * | ||||
| * @var array | * @var array | ||||
| */ | */ | ||||
| protected $matches = array(); | protected $matches = array(); | ||||
| /** | /** | ||||
| * Crawlers object. | * Crawlers object. | ||||
| * | * | ||||
| * @var \Jaybizzle\CrawlerDetect\Fixtures\Crawlers | * @var \Jaybizzle\CrawlerDetect\Fixtures\Crawlers | ||||
| */ | */ | ||||
| protected $crawlers; | protected $crawlers; | ||||
| /** | /** | ||||
| * Exclusions object. | * Exclusions object. | ||||
| * | * | ||||
| * @var \Jaybizzle\CrawlerDetect\Fixtures\Exclusions | * @var \Jaybizzle\CrawlerDetect\Fixtures\Exclusions | ||||
| */ | */ | ||||
| protected $exclusions; | protected $exclusions; | ||||
| /** | /** | ||||
| * Headers object. | * Headers object. | ||||
| * | * | ||||
| * @var \Jaybizzle\CrawlerDetect\Fixtures\Headers | * @var \Jaybizzle\CrawlerDetect\Fixtures\Headers | ||||
| */ | */ | ||||
| protected $uaHttpHeaders; | protected $uaHttpHeaders; | ||||
| /** | /** | ||||
| * The compiled regex string. | * The compiled regex string. | ||||
| * | * | ||||
| * @var string | * @var string | ||||
| */ | */ | ||||
| protected $compiledRegex; | protected $compiledRegex; | ||||
| /** | /** | ||||
| * The compiled exclusions regex string. | * The compiled exclusions regex string. | ||||
| * | * | ||||
| * @var string | * @var string | ||||
| */ | */ | ||||
| protected $compiledExclusions; | protected $compiledExclusions; | ||||
| /** | /** | ||||
| * Class constructor. | * Class constructor. | ||||
| */ | */ | ||||
| @@ -79,14 +69,11 @@ class CrawlerDetect | |||||
| $this->crawlers = new Crawlers(); | $this->crawlers = new Crawlers(); | ||||
| $this->exclusions = new Exclusions(); | $this->exclusions = new Exclusions(); | ||||
| $this->uaHttpHeaders = new Headers(); | $this->uaHttpHeaders = new Headers(); | ||||
| $this->compiledRegex = $this->compileRegex($this->crawlers->getAll()); | $this->compiledRegex = $this->compileRegex($this->crawlers->getAll()); | ||||
| $this->compiledExclusions = $this->compileRegex($this->exclusions->getAll()); | $this->compiledExclusions = $this->compileRegex($this->exclusions->getAll()); | ||||
| $this->setHttpHeaders($headers); | $this->setHttpHeaders($headers); | ||||
| $this->setUserAgent($userAgent); | $this->setUserAgent($userAgent); | ||||
| } | } | ||||
| /** | /** | ||||
| * Compile the regex patterns into one regex string. | * Compile the regex patterns into one regex string. | ||||
| * | * | ||||
| @@ -98,7 +85,6 @@ class CrawlerDetect | |||||
| { | { | ||||
| return '('.implode('|', $patterns).')'; | return '('.implode('|', $patterns).')'; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set HTTP headers. | * Set HTTP headers. | ||||
| * | * | ||||
| @@ -106,23 +92,20 @@ class CrawlerDetect | |||||
| */ | */ | ||||
| public function setHttpHeaders($httpHeaders) | public function setHttpHeaders($httpHeaders) | ||||
| { | { | ||||
| // Use global _SERVER if $httpHeaders aren't defined. | |||||
| //Use global _SERVER if $httpHeaders aren't defined. | |||||
| if (! is_array($httpHeaders) || ! count($httpHeaders)) { | if (! is_array($httpHeaders) || ! count($httpHeaders)) { | ||||
| $httpHeaders = $_SERVER; | $httpHeaders = $_SERVER; | ||||
| } | } | ||||
| // Clear existing headers. | |||||
| //Clear existing headers. | |||||
| $this->httpHeaders = array(); | $this->httpHeaders = array(); | ||||
| // Only save HTTP headers. In PHP land, that means | |||||
| // only _SERVER vars that start with HTTP_. | |||||
| //Only save HTTP headers. In PHP land, that means | |||||
| //only _SERVER vars that start with HTTP_. | |||||
| foreach ($httpHeaders as $key => $value) { | foreach ($httpHeaders as $key => $value) { | ||||
| if (strpos($key, 'HTTP_') === 0) { | if (strpos($key, 'HTTP_') === 0) { | ||||
| $this->httpHeaders[$key] = $value; | $this->httpHeaders[$key] = $value; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Return user agent headers. | * Return user agent headers. | ||||
| * | * | ||||
| @@ -132,7 +115,6 @@ class CrawlerDetect | |||||
| { | { | ||||
| return $this->uaHttpHeaders->getAll(); | return $this->uaHttpHeaders->getAll(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the user agent. | * Set the user agent. | ||||
| * | * | ||||
| @@ -150,7 +132,6 @@ class CrawlerDetect | |||||
| return $this->userAgent = $userAgent; | return $this->userAgent = $userAgent; | ||||
| } | } | ||||
| /** | /** | ||||
| * Check user agent string against the regex. | * Check user agent string against the regex. | ||||
| * | * | ||||
| @@ -172,7 +153,6 @@ class CrawlerDetect | |||||
| return (bool) preg_match("/{$this->compiledRegex}/i", $agent, $this->matches); | return (bool) preg_match("/{$this->compiledRegex}/i", $agent, $this->matches); | ||||
| } | } | ||||
| /** | /** | ||||
| * Return the matches. | * Return the matches. | ||||
| * | * | ||||
| @@ -182,4 +162,4 @@ class CrawlerDetect | |||||
| { | { | ||||
| return isset($this->matches[0]) ? $this->matches[0] : null; | return isset($this->matches[0]) ? $this->matches[0] : null; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -1,8 +1,6 @@ | |||||
| <?php | <?php | ||||
| if (!defined('DEDEINC')) exit('dedebiz'); | if (!defined('DEDEINC')) exit('dedebiz'); | ||||
| require_once(DEDEINC."/libraries/agent.class.php"); | require_once(DEDEINC."/libraries/agent.class.php"); | ||||
| /** | /** | ||||
| * 流量统计 | * 流量统计 | ||||
| * 一个轻量级流量统计功能 | * 一个轻量级流量统计功能 | ||||
| @@ -13,13 +11,11 @@ require_once(DEDEINC."/libraries/agent.class.php"); | |||||
| * @license https://www.dedebiz.com/license | * @license https://www.dedebiz.com/license | ||||
| * @link https://www.dedebiz.com | * @link https://www.dedebiz.com | ||||
| */ | */ | ||||
| class DedeStatistics { | class DedeStatistics { | ||||
| function __construct() | function __construct() | ||||
| { | { | ||||
| } | } | ||||
| // 获取统计JS | |||||
| //获取统计JS | |||||
| function GetStat() | function GetStat() | ||||
| { | { | ||||
| global $envs,$cfg_cookie_encode; | global $envs,$cfg_cookie_encode; | ||||
| @@ -66,7 +62,7 @@ class DedeStatistics { | |||||
| var xhr; | var xhr; | ||||
| if (window.XMLHttpRequest) { | if (window.XMLHttpRequest) { | ||||
| xhr = new XMLHttpRequest(); | xhr = new XMLHttpRequest(); | ||||
| } else if (window.ActiveXObject) { // IE | |||||
| } else if (window.ActiveXObject) { //IE | |||||
| try { | try { | ||||
| xhr = new ActiveXObject('Msxml2.XMLHTTP'); | xhr = new ActiveXObject('Msxml2.XMLHTTP'); | ||||
| } catch (e) { | } catch (e) { | ||||
| @@ -83,14 +79,13 @@ class DedeStatistics { | |||||
| fetch(u); | fetch(u); | ||||
| } | } | ||||
| })(); | })(); | ||||
| EOT; | |||||
| EOT; | |||||
| } | } | ||||
| // 统计 | |||||
| //统计 | |||||
| function Record() | function Record() | ||||
| { | { | ||||
| global $dsql,$cfg_cookie_encode; | global $dsql,$cfg_cookie_encode; | ||||
| // 进行统计 | |||||
| //进行统计 | |||||
| $pm = array('dduuid','ssid','browser','device','device_type','os','t','created_date','created_hour','url_type','typeid','aid','value','sign'); | $pm = array('dduuid','ssid','browser','device','device_type','os','t','created_date','created_hour','url_type','typeid','aid','value','sign'); | ||||
| $pmvalue = array(); | $pmvalue = array(); | ||||
| foreach ($pm as $v) { | foreach ($pm as $v) { | ||||
| @@ -115,8 +110,7 @@ EOT; | |||||
| $insql = "INSERT INTO `#@__statistics_detail`(".implode(",",$kstr).") VALUES (".implode(",",$vstr).")"; | $insql = "INSERT INTO `#@__statistics_detail`(".implode(",",$kstr).") VALUES (".implode(",",$vstr).")"; | ||||
| return $dsql->ExecuteNoneQuery($insql); | return $dsql->ExecuteNoneQuery($insql); | ||||
| } | } | ||||
| // 生成uuid | |||||
| //生成uuid | |||||
| function _uniqidReal($lenght = 13) { | function _uniqidReal($lenght = 13) { | ||||
| if (function_exists("random_bytes")) { | if (function_exists("random_bytes")) { | ||||
| $bytes = random_bytes(ceil($lenght / 2)); | $bytes = random_bytes(ceil($lenght / 2)); | ||||
| @@ -127,7 +121,6 @@ EOT; | |||||
| } | } | ||||
| return substr(bin2hex($bytes), 0, $lenght); | return substr(bin2hex($bytes), 0, $lenght); | ||||
| } | } | ||||
| function GetInfoByDateMulti($ds = array()) | function GetInfoByDateMulti($ds = array()) | ||||
| { | { | ||||
| $results = array(); | $results = array(); | ||||
| @@ -137,8 +130,7 @@ EOT; | |||||
| } | } | ||||
| return $result; | return $result; | ||||
| } | } | ||||
| // 获取某天的统计信息 | |||||
| //获取某天的统计信息 | |||||
| function GetInfoByDate($d=0) | function GetInfoByDate($d=0) | ||||
| { | { | ||||
| global $dsql; | global $dsql; | ||||
| @@ -160,9 +152,8 @@ EOT; | |||||
| $d = $today; | $d = $today; | ||||
| } | } | ||||
| $d = intval($d); | $d = intval($d); | ||||
| // 如果统计数据中存在,则直接查询统计表 | |||||
| //如果统计数据中存在,则直接查询统计表 | |||||
| $info = $dsql->GetOne("SELECT * FROM `#@__statistics` WHERE sdate = $d"); | $info = $dsql->GetOne("SELECT * FROM `#@__statistics` WHERE sdate = $d"); | ||||
| if (is_array($info)) { | if (is_array($info)) { | ||||
| return $info; | return $info; | ||||
| } | } | ||||
| @@ -171,7 +162,7 @@ EOT; | |||||
| $ip = $dsql->GetOne("SELECT COUNT(DISTINCT ip) as total FROM `#@__statistics_detail` WHERE created_date = $d"); | $ip = $dsql->GetOne("SELECT COUNT(DISTINCT ip) as total FROM `#@__statistics_detail` WHERE created_date = $d"); | ||||
| $vv = $dsql->GetOne("SELECT COUNT(DISTINCT ssid) as total FROM `#@__statistics_detail` WHERE created_date = $d"); | $vv = $dsql->GetOne("SELECT COUNT(DISTINCT ssid) as total FROM `#@__statistics_detail` WHERE created_date = $d"); | ||||
| if ($d < intval($today)) { | if ($d < intval($today)) { | ||||
| // 缓存数据 | |||||
| //缓存数据 | |||||
| $insql = "INSERT INTO `#@__statistics`(`sdate`,`pv`,`uv`,`ip`,`vv`) VALUES ('$d', '{$pv['total']}','{$uv['total']}','{$ip['total']}','{$vv['total']}')"; | $insql = "INSERT INTO `#@__statistics`(`sdate`,`pv`,`uv`,`ip`,`vv`) VALUES ('$d', '{$pv['total']}','{$uv['total']}','{$ip['total']}','{$vv['total']}')"; | ||||
| $dsql->ExecuteNoneQuery($insql); | $dsql->ExecuteNoneQuery($insql); | ||||
| } | } | ||||
| @@ -12,9 +12,9 @@ if ($myurl == '') exit(''); | |||||
| else { | else { | ||||
| $uid = $cfg_ml->M_LoginID; | $uid = $cfg_ml->M_LoginID; | ||||
| $face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face']; | $face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face']; | ||||
| echo "用户名:{$cfg_ml->M_UserName} <input name=\"notuser\" type=\"checkbox\" id=\"notuser\" value=\"1\" />匿名评论\r\n"; | |||||
| echo "用户名:{$cfg_ml->M_UserName} <input name='notuser' type='checkbox' id='notuser' value='1' />匿名评论\r\n"; | |||||
| if ($cfg_feedback_ck == 'Y') { | if ($cfg_feedback_ck == 'Y') { | ||||
| echo "验证码:<input name=\"validate\" type=\"text\" id=\"validate\" size=\"10\" style=\"height:18px;width:60px;margin-right:6px;text-transform: uppercase;\" class=\"nb\" />"; | |||||
| echo "<img src='{$cfg_cmsurl}/apps/vdimgck.php' style='cursor:pointer' id='validateimg' onclick=\"this.src=this.src+'?'\" title='验证码' alt='验证码' />\r\n"; | |||||
| echo "验证码:<input name='validate' type='text' id='validate' size='10' style='height:18px;width:60px;margin-right:6px;text-transform: uppercase;' class='nb' />"; | |||||
| echo "<img src='{$cfg_cmsurl}/apps/vdimgck.php' style='cursor:pointer' id='validateimg' onclick='this.src=this.src+'?'' alt='验证码' title='验证码' />\r\n"; | |||||
| } | } | ||||
| } | } | ||||
| @@ -27,7 +27,6 @@ function GetSta($sta) | |||||
| else if ($sta == 1) return '已付款'; | else if ($sta == 1) return '已付款'; | ||||
| else return '已完成'; | else return '已完成'; | ||||
| } | } | ||||
| if ($dopost == '') { | if ($dopost == '') { | ||||
| $sql = "SELECT * FROM `#@__member_operation` WHERE mid='".$cfg_ml->M_ID."' AND product<>'archive' ORDER BY aid DESC"; | $sql = "SELECT * FROM `#@__member_operation` WHERE mid='".$cfg_ml->M_ID."' AND product<>'archive' ORDER BY aid DESC"; | ||||
| $dlist = new DataListCP(); | $dlist = new DataListCP(); | ||||