| @@ -70,31 +70,31 @@ | |||
| <div class="card-body"> | |||
| <table class="table table-borderless"> | |||
| <tr> | |||
| <td> | |||
| <td width="20%"> | |||
| <div class="web-info"> | |||
| <p>操作系统</p> | |||
| <span><?php echo PHP_OS;?></span> | |||
| </div> | |||
| </td> | |||
| <td> | |||
| <td width="20%"> | |||
| <div class="web-info"> | |||
| <p>WEB服务器</p> | |||
| <span><?php echo $_SERVER['SERVER_SOFTWARE'];?></span> | |||
| </div> | |||
| </td> | |||
| <td> | |||
| <td width="20%"> | |||
| <div class="web-info"> | |||
| <p>IP地址</p> | |||
| <span><?php echo gethostbyname($_SERVER['SERVER_NAME']);?></span> | |||
| </div> | |||
| </td> | |||
| <td> | |||
| <td width="20%"> | |||
| <div class="web-info"> | |||
| <p>PHP版本</p> | |||
| <span><?php echo @phpversion();?></span> | |||
| </div> | |||
| </td> | |||
| <td> | |||
| <td width="20%"> | |||
| <div class="web-info"> | |||
| <p>数据库版本</p> | |||
| <span><?php echo $dsql->GetVersion();?></span> | |||
| @@ -1,17 +0,0 @@ | |||
| <?php | |||
| /** | |||
| * RSS列表页 | |||
| * | |||
| * @version $id:rss.php$ | |||
| * @package DedeBIZ.Site | |||
| * @copyright Copyright (c) 2022 DedeBIZ.COM | |||
| * @license https://www.dedebiz.com/license | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(dirname(__FILE__).'/../system/common.inc.php'); | |||
| require_once(DEDEINC."/archive/rssview.class.php"); | |||
| $tid = isset($tid) && is_numeric($tid) ? $tid : 0; | |||
| if ($tid == 0) die("dedebiz"); | |||
| $rv = new RssView($tid); | |||
| $rv->Display(); | |||
| ?> | |||
| @@ -207,32 +207,7 @@ class PartView | |||
| * @param object $ctag | |||
| * @return array | |||
| */ | |||
| function GetArcList( | |||
| $templets = '', | |||
| $typeid = 0, | |||
| $row = 10, | |||
| $col = 1, | |||
| $titlelen = 30, | |||
| $infolen = 160, | |||
| $imgwidth = 120, | |||
| $imgheight = 90, | |||
| $listtype = "all", | |||
| $orderby = "default", | |||
| $keyword = "", | |||
| $innertext = "", | |||
| $tablewidth = "100", | |||
| $arcid = 0, | |||
| $idlist = "", | |||
| $channelid = 0, | |||
| $limit = "", | |||
| $att = 0, | |||
| $order = 'desc', | |||
| $subday = 0, | |||
| $autopartid = -1, | |||
| $ismember = 0, | |||
| $maintable = '', | |||
| $ctag = '' | |||
| ) { | |||
| function GetArcList($templets='',$typeid = 0,$row = 10,$col = 1,$titlelen = 30,$infolen = 160,$imgwidth = 120,$imgheight = 90,$listtype = "all",$orderby = "default",$keyword = "",$innertext = "",$tablewidth = "100",$arcid = 0,$idlist = "",$channelid = 0,$limit = "",$att = 0,$order = 'desc',$subday = 0,$autopartid = -1,$ismember = 0,$maintable = '',$ctag = '') { | |||
| if (empty($autopartid)) { | |||
| $autopartid = -1; | |||
| } | |||
| @@ -248,32 +223,7 @@ class PartView | |||
| if (!isset($GLOBALS['__SpGetArcList'])) { | |||
| require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php"); | |||
| } | |||
| return SpGetArcList( | |||
| $this->dsql, | |||
| $templets, | |||
| $typeid, | |||
| $row, | |||
| $col, | |||
| $titlelen, | |||
| $infolen, | |||
| $imgwidth, | |||
| $imgheight, | |||
| $listtype, | |||
| $orderby, | |||
| $keyword, | |||
| $innertext, | |||
| $tablewidth, | |||
| $arcid, | |||
| $idlist, | |||
| $channelid, | |||
| $limit, | |||
| $att, | |||
| $order, | |||
| $subday, | |||
| $ismember, | |||
| $maintable, | |||
| $ctag | |||
| ); | |||
| return SpGetArcList($this->dsql,$templets,$typeid,$row,$col,$titlelen,$infolen,$imgwidth,$imgheight,$listtype,$orderby,$keyword,$innertext,$tablewidth,$arcid,$idlist,$channelid,$limit,$att,$order,$subday,$ismember,$maintable,$ctag); | |||
| } | |||
| //关闭所占用的资源 | |||
| function Close() | |||
| @@ -1,210 +0,0 @@ | |||
| <?php | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * RSS视图类 | |||
| * | |||
| * @version $id:rssview.class.php 15:21 2010年7月7日 tianya $ | |||
| * @package DedeBIZ.Libraries | |||
| * @copyright Copyright (c) 2022 DedeBIZ.COM | |||
| * @license https://www.dedebiz.com/license | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(DEDEINC."/dedetag.class.php"); | |||
| require_once(DEDEINC."/typelink/typelink.class.php"); | |||
| require_once(DEDEINC."/channelunit.func.php"); | |||
| @set_time_limit(0); | |||
| /** | |||
| * RSS视图类 | |||
| * | |||
| * @package RssView | |||
| * @subpackage DedeBIZ.Libraries | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| class RssView | |||
| { | |||
| var $dsql; | |||
| var $TypeID; | |||
| var $TypeLink; | |||
| var $TypeFields; | |||
| var $MaxRow; | |||
| var $dtp; | |||
| var $remoteDir; | |||
| /** | |||
| * php5构造函数 | |||
| * | |||
| * @access public | |||
| * @param int $typeid 栏目id | |||
| * @param int $max_row 最大显示行数 | |||
| * @return string | |||
| */ | |||
| function __construct($typeid, $max_row = 50) | |||
| { | |||
| $this->TypeID = $typeid; | |||
| $this->dtp = new DedeTagParse(); | |||
| $this->dtp->refObj = $this; | |||
| $templetfiles = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/plus/rss.htm"; | |||
| $this->dtp->LoadTemplate($templetfiles); | |||
| $this->dsql = $GLOBALS['dsql']; | |||
| $this->TypeLink = new TypeLink($typeid); | |||
| $this->TypeFields = $this->TypeLink->TypeInfos; | |||
| $this->MaxRow = $max_row; | |||
| $this->TypeFields['title'] = $this->TypeLink->GetPositionLink(false); | |||
| $this->TypeFields['title'] = preg_replace("/[<>]/", " / ", $this->TypeFields['title']); | |||
| $this->TypeFields['typelink'] = $GLOBALS['cfg_basehost'].$this->TypeLink->GetOneTypeUrl($this->TypeFields); | |||
| $this->TypeFields['powerby'] = $GLOBALS['cfg_powerby']; | |||
| $this->TypeFields['adminemail'] = $GLOBALS['cfg_adminemail']; | |||
| $this->remoteDir = ''; | |||
| foreach ($this->TypeFields as $k => $v) { | |||
| $this->TypeFields[$k] = dede_htmlspecialchars($v); | |||
| } | |||
| $this->ParseTemplet(); | |||
| } | |||
| //php4构造函数 | |||
| function RssView($typeid, $max_row = 50) | |||
| { | |||
| $this->__construct($typeid, $max_row); | |||
| } | |||
| //关闭相关资源 | |||
| function Close() | |||
| { | |||
| } | |||
| /** | |||
| * 显示列表 | |||
| * | |||
| * @access public | |||
| * @return void | |||
| */ | |||
| function Display() | |||
| { | |||
| $this->dtp->Display(); | |||
| } | |||
| /** | |||
| * 开始创建列表 | |||
| * | |||
| * @access public | |||
| * @param string $isremote 是否远程 | |||
| * @return string | |||
| */ | |||
| function MakeRss($isremote = 0) | |||
| { | |||
| $murl = $GLOBALS['cfg_cmspath']."/static/rss/".$this->TypeID.".xml"; | |||
| $mfile = $GLOBALS['cfg_basedir'].$murl; | |||
| $this->dtp->SaveTo($mfile); | |||
| return $murl; | |||
| } | |||
| /** | |||
| * 解析模板 | |||
| * | |||
| * @access public | |||
| * @return void | |||
| */ | |||
| function ParseTemplet() | |||
| { | |||
| foreach ($this->dtp->CTags as $tid => $ctag) { | |||
| if ($ctag->GetName() == "field") { | |||
| $this->dtp->Assign($tid, $this->TypeFields[$ctag->GetAtt('name')]); | |||
| } else if ($ctag->GetName() == "rssitem") { | |||
| $this->dtp->Assign( | |||
| $tid, | |||
| $this->GetArcList($ctag->GetInnerText()) | |||
| ); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * 获得文档列表 | |||
| * | |||
| * @access public | |||
| * @param string $innertext 底层模板 | |||
| * @return string | |||
| */ | |||
| function GetArcList($innertext = "") | |||
| { | |||
| $typeid = $this->TypeID; | |||
| $innertext = trim($innertext); | |||
| if ($innertext == "") { | |||
| $innertext = GetSysTemplets("rss.htm"); | |||
| } | |||
| $orwhere = " arc.arcrank > -1 "; | |||
| $orwhere .= " AND (arc.typeid in (".GetSonIds($this->TypeID, $this->TypeFields['channeltype']).") ) "; | |||
| $ordersql = " ORDER BY arc.id desc"; | |||
| $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE $orwhere $ordersql LIMIT 0,".$this->MaxRow; | |||
| $this->dsql->SetQuery($query); | |||
| $this->dsql->Execute('al'); | |||
| $artlist = ''; | |||
| $dtp2 = new DedeTagParse(); | |||
| $dtp2->SetNameSpace('field', '[', ']'); | |||
| $dtp2->LoadSource($innertext); | |||
| while ($row = $this->dsql->GetArray('al')) { | |||
| //处理一些特殊字段 | |||
| if ($row['litpic'] == '-' || $row['litpic'] == '') { | |||
| $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/web/img/thumbnail.jpg'; | |||
| } | |||
| if (!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { | |||
| $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; | |||
| } | |||
| $row['picname'] = $row['litpic']; | |||
| $row["arcurl"] = GetFileUrl( | |||
| $row["id"], | |||
| $row["typeid"], | |||
| $row["senddate"], | |||
| $row["title"], | |||
| $row["ismake"], | |||
| $row["arcrank"], | |||
| $row["namerule"], | |||
| $row["typedir"], | |||
| $row["money"], | |||
| $row['filename'], | |||
| $row["moresite"], | |||
| $row["siteurl"], | |||
| $row["sitepath"] | |||
| ); | |||
| $row["typeurl"] = GetTypeUrl( | |||
| $row["typeid"], | |||
| $row["typedir"], | |||
| $row["isdefault"], | |||
| $row["defaultname"], | |||
| $row["ispart"], | |||
| $row["namerule2"], | |||
| $row["moresite"], | |||
| $row["siteurl"], | |||
| $row["sitepath"] | |||
| ); | |||
| $row["info"] = $row["description"]; | |||
| $row["filename"] = $row["arcurl"]; | |||
| $row["stime"] = GetDateMK($row["pubdate"]); | |||
| $row["image"] = "<img src='".$row["picname"]."'>"; | |||
| $row["fullurl"] = $GLOBALS["cfg_basehost"].$row["arcurl"]; | |||
| if ($GLOBALS['cfg_multi_site'] == 'Y') $row["fullurl"] = $row["arcurl"]; | |||
| $row["phpurl"] = $GLOBALS["cfg_plus_dir"]; | |||
| $row["templeturl"] = $GLOBALS["cfg_templets_dir"]; | |||
| if ($row["source"] == '') { | |||
| $row["source"] = $GLOBALS['cfg_webname']; | |||
| } | |||
| if ($row["writer"] == '') { | |||
| $row["writer"] = "张生"; | |||
| } | |||
| foreach ($row as $k => $v) { | |||
| $row[$k] = dede_htmlspecialchars($v); | |||
| } | |||
| if (is_array($dtp2->CTags)) { | |||
| foreach ($dtp2->CTags as $k => $ctag) { | |||
| if ($ctag->GetName() == 'array') { | |||
| //传递整个数组,在runphp模式中有特殊作用 | |||
| $dtp2->Assign($k, $row); | |||
| } else { | |||
| if (isset($row[$ctag->GetName()])) { | |||
| $dtp2->Assign($k, $row[$ctag->GetName()]); | |||
| } else { | |||
| $dtp2->Assign($k, ''); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| $artlist .= $dtp2->GetResult()."\r\n"; | |||
| } | |||
| $this->dsql->FreeResult('al'); | |||
| return $artlist; | |||
| } | |||
| }//End Class | |||
| ?> | |||
| @@ -11,20 +11,17 @@ function __autoload($classname) | |||
| { | |||
| $classname = preg_replace("/[^0-9a-z_]/i", '', $classname); | |||
| $classname = strtolower($classname); | |||
| if ( class_exists ( $classname ) ) | |||
| { | |||
| if (class_exists($classname)) { | |||
| return TRUE; | |||
| } | |||
| if (in_array($classname, array("archives","freelist","listview","partview","rssview","searchview","sglistview","sgpage","specview","taglist"))) { | |||
| $classname = "archive/".$classname; | |||
| } | |||
| $libclassfile = $classname.'.class.php'; | |||
| if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | |||
| { | |||
| if (is_file(DEDEINC.'/'.$libclassfile)) { | |||
| require DEDEINC.'/'.$libclassfile; | |||
| } else { | |||
| if (DEBUG_LEVEL === TRUE) | |||
| { | |||
| if (DEBUG_LEVEL === TRUE) { | |||
| echo '<pre>'; | |||
| echo $classname.'类找不到'; | |||
| echo '</pre>'; | |||
| @@ -11,20 +11,17 @@ function dede_autoloader($classname) | |||
| { | |||
| $classname = preg_replace("/[^0-9a-z_]/i", '', $classname); | |||
| $classname = strtolower($classname); | |||
| if ( class_exists ( $classname ) ) | |||
| { | |||
| if (class_exists($classname)) { | |||
| return TRUE; | |||
| } | |||
| if (in_array($classname, array("archives","freelist","listview","partview","rssview","searchview","sglistview","sgpage","specview","taglist"))) { | |||
| $classname = "archive/".$classname; | |||
| } | |||
| $libclassfile = $classname.'.class.php'; | |||
| if ( is_file ( DEDEINC.'/'.$libclassfile ) ) | |||
| { | |||
| if (is_file(DEDEINC.'/'.$libclassfile )) { | |||
| require DEDEINC.'/'.$libclassfile; | |||
| } else { | |||
| if (DEBUG_LEVEL === TRUE) | |||
| { | |||
| if (DEBUG_LEVEL === TRUE) { | |||
| echo '<pre>'; | |||
| echo $classname.'类找不到'; | |||
| echo '</pre>'; | |||
| @@ -2,6 +2,7 @@ | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * 栏目模型单元类 | |||
| * | |||
| * @version $id:channelunit.class.php 2 17:32 2010年7月6日 tianya $ | |||
| * @package DedeBIZ.Libraries | |||
| * @copyright Copyright (c) 2022 DedeBIZ.COM | |||
| @@ -1,7 +1,7 @@ | |||
| <?php | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * 栏目小助手,本文件仅做一个映射 | |||
| * 栏目小助手 | |||
| * | |||
| * @version $id:channelunit.func.php 2 16:46 2010年7月6日 tianya $ | |||
| * @package DedeBIZ.Helpers | |||
| @@ -1,13 +1,14 @@ | |||
| <?php | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * 字符编码转换 | |||
| * | |||
| * @version $id:charset.func.php 17:44 2020-09-22 tianya $ | |||
| * @package DedeBIZ.Libraries | |||
| * @copyright Copyright (c) 2022 DedeBIZ.COM | |||
| * @license https://www.dedebiz.com/license | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| //字符编码转换的小助手 | |||
| //这里仅做一个映射 | |||
| //仅做一个映射 | |||
| helper("charset"); | |||
| ?> | |||
| @@ -9,7 +9,7 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| /** | |||
| * 获得一个附加表单(发布时用) | |||
| * 获得一个附加表单发布时用 | |||
| * | |||
| * @access public | |||
| * @param object $ctag 标签 | |||
| @@ -1,496 +0,0 @@ | |||
| <?php | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * 采集小助手 | |||
| * | |||
| * @version $id:charset.helper.php 2010-07-05 11:43:09 tianya $ | |||
| * @package DedeBIZ.Helpers | |||
| * @copyright Copyright (c) 2022 DedeBIZ.COM | |||
| * @license https://www.dedebiz.com/license | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| require_once(DEDEINC."/libraries/dedehttpdown.class.php"); | |||
| require_once(DEDEINC."/dedetag.class.php"); | |||
| require_once(DEDEINC."/charset.func.php"); | |||
| /** | |||
| * 下载图片 | |||
| * | |||
| * @access public | |||
| * @param string $gurl 地址 | |||
| * @param string $rfurl 来源地址 | |||
| * @param string $filename 文件名 | |||
| * @param string $gcookie 调整cookie | |||
| * @param string $JumpCount 跳转计数 | |||
| * @param string $maxtime 最大次数 | |||
| * @return string | |||
| */ | |||
| function DownImageKeep($gurl, $rfurl, $filename, $gcookie = "", $JumpCount = 0, $maxtime = 30) | |||
| { | |||
| $urlinfos = GetHostInfo($gurl); | |||
| $ghost = trim($urlinfos['host']); | |||
| if ($ghost == '') { | |||
| return FALSE; | |||
| } | |||
| $gquery = $urlinfos['query']; | |||
| if ($gcookie == "" && !empty($rfurl)) { | |||
| $gcookie = RefurlCookie($rfurl); | |||
| } | |||
| $sessionQuery = "GET $gquery HTTP/1.1\r\n"; | |||
| $sessionQuery .= "Host: $ghost\r\n"; | |||
| $sessionQuery .= "Referer: $rfurl\r\n"; | |||
| $sessionQuery .= "Accept: */*\r\n"; | |||
| $sessionQuery .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)\r\n"; | |||
| if ($gcookie != "" && !preg_match("/[\r\n]/", $gcookie)) { | |||
| $sessionQuery .= $gcookie."\r\n"; | |||
| } | |||
| $sessionQuery .= "Connection: Keep-Alive\r\n\r\n"; | |||
| $errno = ""; | |||
| $errstr = ""; | |||
| $m_fp = fsockopen($ghost, 80, $errno, $errstr, 10); | |||
| fwrite($m_fp, $sessionQuery); | |||
| $lnum = 0; | |||
| //获取详细应答头 | |||
| $m_httphead = array(); | |||
| $httpstas = explode(" ", fgets($m_fp, 256)); | |||
| $m_httphead["http-edition"] = trim($httpstas[0]); | |||
| $m_httphead["http-state"] = trim($httpstas[1]); | |||
| while (!feof($m_fp)) { | |||
| $line = trim(fgets($m_fp, 256)); | |||
| if ($line == "" || $lnum > 100) { | |||
| break; | |||
| } | |||
| $hkey = ""; | |||
| $hvalue = ""; | |||
| $v = 0; | |||
| for ($i = 0; $i < strlen($line); $i++) { | |||
| if ($v == 1) { | |||
| $hvalue .= $line[$i]; | |||
| } | |||
| if ($line[$i] == ":") { | |||
| $v = 1; | |||
| } | |||
| if ($v == 0) { | |||
| $hkey .= $line[$i]; | |||
| } | |||
| } | |||
| $hkey = trim($hkey); | |||
| if ($hkey != "") { | |||
| $m_httphead[strtolower($hkey)] = trim($hvalue); | |||
| } | |||
| } | |||
| //分析返回记录 | |||
| if (preg_match("/^3/", $m_httphead["http-state"])) { | |||
| if (isset($m_httphead["location"]) && $JumpCount < 3) { | |||
| $JumpCount++; | |||
| DownImageKeep($gurl, $rfurl, $filename, $gcookie, $JumpCount); | |||
| } else { | |||
| return FALSE; | |||
| } | |||
| } | |||
| if (!preg_match("/^2/", $m_httphead["http-state"])) { | |||
| return FALSE; | |||
| } | |||
| if (!isset($m_httphead)) { | |||
| return FALSE; | |||
| } | |||
| $contentLength = $m_httphead['content-length']; | |||
| //保存文件 | |||
| $fp = fopen($filename, "w") or die("写入文件:{$filename} 失败"); | |||
| $i = 0; | |||
| $okdata = ""; | |||
| $starttime = time(); | |||
| while (!feof($m_fp)) { | |||
| $okdata .= fgetc($m_fp); | |||
| $i++; | |||
| //超时结束 | |||
| if (time() - $starttime > $maxtime) { | |||
| break; | |||
| } | |||
| //到达指定大小结束 | |||
| if ($i >= $contentLength) { | |||
| break; | |||
| } | |||
| } | |||
| if ($okdata != "") { | |||
| fwrite($fp, $okdata); | |||
| } | |||
| fclose($fp); | |||
| if ($okdata == "") { | |||
| @unlink($filename); | |||
| fclose($m_fp); | |||
| return FALSE; | |||
| } | |||
| fclose($m_fp); | |||
| return TRUE; | |||
| } | |||
| /** | |||
| * 获得某页面返回的Cookie信息 | |||
| * | |||
| * @access public | |||
| * @param string $gurl 调整地址 | |||
| * @return string | |||
| */ | |||
| function RefurlCookie($gurl) | |||
| { | |||
| global $gcookie, $lastRfurl; | |||
| $gurl = trim($gurl); | |||
| if (!empty($gcookie) && $lastRfurl == $gurl) { | |||
| return $gcookie; | |||
| } else { | |||
| $lastRfurl = $gurl; | |||
| } | |||
| if (trim($gurl) == '') { | |||
| return ''; | |||
| } | |||
| $urlinfos = GetHostInfo($gurl); | |||
| $ghost = $urlinfos['host']; | |||
| $gquery = $urlinfos['query']; | |||
| $sessionQuery = "GET $gquery HTTP/1.1\r\n"; | |||
| $sessionQuery .= "Host: $ghost\r\n"; | |||
| $sessionQuery .= "Accept: */*\r\n"; | |||
| $sessionQuery .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)\r\n"; | |||
| $sessionQuery .= "Connection: Close\r\n\r\n"; | |||
| $errno = ""; | |||
| $errstr = ""; | |||
| $m_fp = fsockopen($ghost, 80, $errno, $errstr, 10) or die($ghost.'<br>'); | |||
| fwrite($m_fp, $sessionQuery); | |||
| $lnum = 0; | |||
| //获取详细应答头 | |||
| $gcookie = ""; | |||
| while (!feof($m_fp)) { | |||
| $line = trim(fgets($m_fp, 256)); | |||
| if ($line == "" || $lnum > 100) { | |||
| break; | |||
| } else { | |||
| if (preg_match("/^cookie/i", $line)) { | |||
| $gcookie = $line; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| fclose($m_fp); | |||
| return $gcookie; | |||
| } | |||
| /** | |||
| * 获得网址的host和query部份 | |||
| * | |||
| * @access public | |||
| * @param string $gurl 调整地址 | |||
| * @return string | |||
| */ | |||
| function GetHostInfo($gurl) | |||
| { | |||
| $gurl = preg_replace("/^http:\/\//i", "", trim($gurl)); | |||
| $garr['host'] = preg_replace("/\/(.*)$/i", "", $gurl); | |||
| $garr['query'] = "/".preg_replace("/^([^\/]*)\//i", "", $gurl); | |||
| return $garr; | |||
| } | |||
| /** | |||
| * HTML里的网址格式转换 | |||
| * | |||
| * @access public | |||
| * @param string $body 文档 | |||
| * @return string | |||
| */ | |||
| function TurnLinkTag(&$body) | |||
| { | |||
| $ttx = ''; | |||
| $handid = '服务器'; | |||
| preg_match_all("/<a href=['\"](.+?)['\"]([^>]+?)>(.+?)<\/a>/is", $body, $match); | |||
| if (is_array($match[1]) && count($match[1]) > 0) { | |||
| for ($i = 0; isset($match[1][$i]); $i++) { | |||
| $servername = (isset($match[3][$i]) ? str_replace("'", "`", $match[3][$i]) : $handid.($i + 1)); | |||
| if (preg_match("/[<>]/", $servername) || strlen($servername) > 40) { | |||
| $servername = $handid.($i + 1); | |||
| } | |||
| $ttx .= "{dede:link text='$servername'} {$match[1][$i]} {/dede:link}\r\n"; | |||
| } | |||
| } | |||
| return $ttx; | |||
| } | |||
| /** | |||
| * 替换XML的CDATA | |||
| * | |||
| * @access public | |||
| * @param string $str 字符串 | |||
| * @return string | |||
| */ | |||
| function RpCdata($str) | |||
| { | |||
| $str = str_replace('<![CDATA[', '', $str); | |||
| $str = str_replace(']]>', '', $str); | |||
| return $str; | |||
| } | |||
| /** | |||
| * 分析RSS里的链接 | |||
| * | |||
| * @access public | |||
| * @param string $rssurl rss地址 | |||
| * @return string | |||
| */ | |||
| function GetRssLinks($rssurl) | |||
| { | |||
| global $cfg_soft_lang; | |||
| $dhd = new DedeHttpDown(); | |||
| $dhd->OpenUrl($rssurl); | |||
| $rsshtml = $dhd->GetHtml(); | |||
| //分析编码 | |||
| preg_match("/encoding=[\"']([^\"']*)[\"']/is", $rsshtml, $infos); | |||
| if (isset($infos[1])) { | |||
| $pcode = strtolower(trim($infos[1])); | |||
| } else { | |||
| $pcode = strtolower($cfg_soft_lang); | |||
| } | |||
| if ($cfg_soft_lang == 'gb2312') { | |||
| if ($pcode == 'utf-8') { | |||
| $rsshtml = utf82gb($rsshtml); | |||
| } else if ($pcode == 'big5') { | |||
| $rsshtml = big52gb($rsshtml); | |||
| } | |||
| } else if ($cfg_soft_lang == 'utf-8') { | |||
| if ($pcode == 'gbk' || $pcode == 'gb2312') { | |||
| $rsshtml = gb2utf8($rsshtml); | |||
| } else if ($pcode == 'big5') { | |||
| $rsshtml = gb2utf8(big52gb($rsshtml)); | |||
| } | |||
| } | |||
| $rsarr = array(); | |||
| preg_match_all("/<item(.*)<title>(.*)<\/title>/isU", $rsshtml, $titles); | |||
| preg_match_all("/<item(.*)<link>(.*)<\/link>/isU", $rsshtml, $links); | |||
| preg_match_all("/<item(.*)<description>(.*)<\/description>/isU", $rsshtml, $descriptions); | |||
| if (!isset($links[2])) { | |||
| return ''; | |||
| } | |||
| foreach ($links[2] as $k => $v) { | |||
| $rsarr[$k]['link'] = RpCdata($v); | |||
| if (isset($titles[2][$k])) { | |||
| $rsarr[$k]['title'] = RpCdata($titles[2][$k]); | |||
| } else { | |||
| $rsarr[$k]['title'] = preg_replace("/^(.*)\//i", "", RpCdata($titles[2][$k])); | |||
| } | |||
| if (isset($descriptions[2][$k])) { | |||
| $rsarr[$k]['image'] = GetddImgFromRss($descriptions[2][$k], $rssurl); | |||
| } else { | |||
| $rsarr[$k]['image'] = ''; | |||
| } | |||
| } | |||
| return $rsarr; | |||
| } | |||
| /** | |||
| * 从RSS摘要获取图片信息 | |||
| * | |||
| * @access public | |||
| * @param string $descriptions 描述 | |||
| * @param string $refurl 来源地址 | |||
| * @return string | |||
| */ | |||
| function GetddImgFromRss($descriptions, $refurl) | |||
| { | |||
| if ($descriptions == '') { | |||
| return ''; | |||
| } | |||
| preg_match_all("/<img(.*)src=[\"']{0,1}(.*)[\"']{0,1}[> \r\n\t]{1,}/isU", $descriptions, $imgs); | |||
| if (isset($imgs[2][0])) { | |||
| $imgs[2][0] = preg_replace("/[\"']/", '', $imgs[2][0]); | |||
| $imgs[2][0] = preg_replace("/\/{1,}/", '/', $imgs[2][0]); | |||
| return FillUrl($refurl, $imgs[2][0]); | |||
| } else { | |||
| return ''; | |||
| } | |||
| } | |||
| /** | |||
| * 补全网址 | |||
| * | |||
| * @access public | |||
| * @param string $refurl 来源地址 | |||
| * @param string $surl 站点地址 | |||
| * @return string | |||
| */ | |||
| function FillUrl($refurl, $surl) | |||
| { | |||
| $i = $pathStep = 0; | |||
| $dstr = $pstr = $okurl = ''; | |||
| $refurl = trim($refurl); | |||
| $surl = trim($surl); | |||
| $urls = @parse_url($refurl); | |||
| $basehost = ((!isset($urls['port']) || $urls['port'] == '80') ? $urls['host'] : $urls['host'].':'.$urls['port']); | |||
| //$basepath = $basehost.(!isset($urls['path']) ? '' : '/'.$urls['path']); | |||
| //由于直接获得的path在处理 http://xxxx/nnn/aaa?fdsafd 这种情况时会有错误,因此用其它方式处理 | |||
| $basepath = $basehost; | |||
| $paths = explode('/', preg_replace("/^http:\/\//i", "", $refurl)); | |||
| $n = count($paths); | |||
| for ($i = 1; $i < ($n - 1); $i++) { | |||
| if (!preg_match("/[\?]/", $paths[$i])) $basepath .= '/'.$paths[$i]; | |||
| } | |||
| if (!preg_match("/[\?\.]/", $paths[$n - 1])) { | |||
| $basepath .= '/'.$paths[$n - 1]; | |||
| } | |||
| if ($surl == '') { | |||
| return $basepath; | |||
| } | |||
| $pos = strpos($surl, "#"); | |||
| if ($pos > 0) { | |||
| $surl = substr($surl, 0, $pos); | |||
| } | |||
| //用 '/' 表示网站根的网址 | |||
| if ($surl[0] == '/') { | |||
| $okurl = $basehost.$surl; | |||
| } else if ($surl[0] == '.') { | |||
| if (strlen($surl) <= 2) { | |||
| return ''; | |||
| } else if ($surl[1] == '/') { | |||
| $okurl = $basepath.preg_replace('/^./', '', $surl); | |||
| } else { | |||
| $okurl = $basepath.'/'.$surl; | |||
| } | |||
| } else { | |||
| if (strlen($surl) < 7) { | |||
| $okurl = $basepath.'/'.$surl; | |||
| } else if (preg_match("/^http:\/\//i", $surl)) { | |||
| $okurl = $surl; | |||
| } else { | |||
| $okurl = $basepath.'/'.$surl; | |||
| } | |||
| } | |||
| $okurl = preg_replace("/^http:\/\//i", '', $okurl); | |||
| $okurl = 'http://'.preg_replace("/\/{1,}/", '/', $okurl); | |||
| return $okurl; | |||
| } | |||
| /** | |||
| * 从匹配规则中获取列表网址 | |||
| * | |||
| * @access public | |||
| * @param string $regxurl 正则地址 | |||
| * @param string $handurl 操作地址 | |||
| * @param string $startid 开始id | |||
| * @param string $endid 结束id | |||
| * @param string $addv 增值 | |||
| * @param string $usemore 使用更多 | |||
| * @param string $batchrule 列表规则 | |||
| * @return string | |||
| */ | |||
| function GetUrlFromListRule($regxurl = '', $handurl = '', $startid = 0, $endid = 0, $addv = 1, $usemore = 0, $batchrule = '') | |||
| { | |||
| global $dsql, $islisten; | |||
| $lists = array(); | |||
| $n = 0; | |||
| $islisten = (empty($islisten) ? 0 : $islisten); | |||
| if ($handurl != '') { | |||
| $handurls = explode("\n", $handurl); | |||
| foreach ($handurls as $handurl) { | |||
| $handurl = trim($handurl); | |||
| if (preg_match("/^http:\/\//i", $handurl)) { | |||
| $lists[$n][0] = $handurl; | |||
| $lists[$n][1] = 0; | |||
| $n++; | |||
| if ($islisten == 1) { | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| if ($regxurl != '') { | |||
| //没指定(#)和(*) | |||
| if (!preg_match("/\(\*\)/i", $regxurl) && !preg_match("/\(#\)/", $regxurl)) { | |||
| $lists[$n][0] = $regxurl; | |||
| $lists[$n][1] = 0; | |||
| $n++; | |||
| } else { | |||
| if ($addv <= 0) { | |||
| $addv = 1; | |||
| } | |||
| //没指定多栏目匹配规则 | |||
| if ($usemore == 0) { | |||
| while ($startid <= $endid) { | |||
| $lists[$n][0] = str_replace("(*)", sprintf('%0'.strlen($startid).'d', $startid), $regxurl); | |||
| $lists[$n][1] = 0; | |||
| $startid = sprintf('%0'.strlen($startid).'d', $startid + $addv); | |||
| $n++; | |||
| if ($n > 2000 || $islisten == 1) { | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| //匹配多个栏目 | |||
| //规则表达式 [(#)=>(#)匹配的网址; (*)=>(*)的范围,如:1-20; typeid=>栏目id; addurl=>附加的网址(用|分开多个)] | |||
| else { | |||
| $nrules = explode(']', trim($batchrule)); | |||
| foreach ($nrules as $nrule) { | |||
| $nrule = trim($nrule); | |||
| $nrule = preg_replace("/^\[|\]$/", '', $nrule); | |||
| $nrules = explode(';', $nrule); | |||
| if (count($nrules) < 3) { | |||
| continue; | |||
| } | |||
| $brtag = ''; | |||
| $startid = 0; | |||
| $endid = 0; | |||
| $typeid = 0; | |||
| $addurls = array(); | |||
| foreach ($nrules as $nrule) { | |||
| $nrule = trim($nrule); | |||
| list($k, $v) = explode('=>', $nrule); | |||
| if (trim($k) == '(#)') { | |||
| $brtag = trim($v); | |||
| } else if (trim($k) == 'typeid') { | |||
| $typeid = trim($v); | |||
| } else if (trim($k) == 'addurl') { | |||
| $addurl = trim($v); | |||
| $addurls = explode('|', $addurl); | |||
| } else if (trim($k) == '(*)') { | |||
| $v = preg_replace("/[ \r\n\t]/", '', trim($v)); | |||
| list($startid, $endid) = explode('-', $v); | |||
| } | |||
| } | |||
| //如果栏目用栏目名称 | |||
| if (preg_match('/[^0-9]/', $typeid)) { | |||
| $arr = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE typename LIKE '$typeid' "); | |||
| if (is_array($arr)) { | |||
| $typeid = $arr['id']; | |||
| } else { | |||
| $typeid = 0; | |||
| } | |||
| } | |||
| //附加网址优先 | |||
| $mjj = 0; | |||
| if (isset($addurls[0])) { | |||
| foreach ($addurls as $addurl) { | |||
| $addurl = trim($addurl); | |||
| if ($addurl == '') { | |||
| continue; | |||
| } | |||
| $lists[$n][0] = $addurl; | |||
| $lists[$n][1] = $typeid; | |||
| $n++; | |||
| $mjj++; | |||
| if ($islisten == 1) { | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| //如果为非监听模式或监听模式没手工指定的附加网址 | |||
| if ($islisten != 1 || $mjj == 0) { | |||
| //匹配规则里的网址,注:(#)的网址是是允许使用(*)的 | |||
| while ($startid <= $endid) { | |||
| $lists[$n][0] = str_replace("(#)", $brtag, $regxurl); | |||
| $lists[$n][0] = str_replace("(*)", sprintf('%0'.strlen($startid).'d', $startid), $lists[$n][0]); | |||
| $lists[$n][1] = $typeid; | |||
| $startid = sprintf('%0'.strlen($startid).'d', $startid + $addv); | |||
| $n++; | |||
| if ($islisten == 1) { | |||
| break; | |||
| } | |||
| if ($n > 20000) { | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } //End 匹配多栏目 | |||
| } //End使用规则匹配的情况 | |||
| } | |||
| return $lists; | |||
| }//End | |||
| ?> | |||
| @@ -9,7 +9,6 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| * @license https://www.dedebiz.com/license | |||
| * @link https://www.dedebiz.com | |||
| */ | |||
| //引入小助手 | |||
| //本版本的文件暂时仅作一个映射,今后开发直接采用helper('downmix');进行调用 | |||
| //仅作一个映射,开发直接采用helper('downmix');进行调用 | |||
| helper('downmix'); | |||
| ?> | |||
| @@ -1,7 +1,7 @@ | |||
| <?php | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| /** | |||
| * 缓存小助手,支持文件和dedebiz cache | |||
| * 缓存小助手,支持文件和dedebiz cache | |||
| * | |||
| * @version $id:cache.helper.php 10:46 2011-3-2 tianya $ | |||
| * @package DedeBIZ.Helpers | |||
| @@ -1,13 +1,7 @@ | |||
| <?php | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| //Copyright 2020 The DedeBiz Authors. All rights reserved. | |||
| //license that can be found in the LICENSE file. | |||
| //@copyright Copyright (c) 2022 DedeBIZ.COM | |||
| //@license https://www.dedebiz.com/license | |||
| //@link https://www.dedebiz.com | |||
| //本文件为DedeBIZ商业组件(www.dedebiz.com)PHP SDK,弥补系统性能和安全方面的不足,提供更多功能 | |||
| //用于DedeBIZ商业组件通信 | |||
| define("DEDEBIZ", true); | |||
| //本文件用于和DedeBIZ商业组件进行通信,以获取更多额外的扩展功能 | |||
| class DedeBizClient | |||
| { | |||
| var $socket; | |||
| @@ -143,8 +137,7 @@ class DedeBizClient | |||
| ); | |||
| return $this->request($req); | |||
| } | |||
| //缓存 | |||
| //$key:键 $val:值 $d:缓存时间 | |||
| //缓存:$key键 $val值 $d缓存时间 | |||
| function CacheSet($key, $val, $duration) | |||
| { | |||
| $req = array( | |||
| @@ -157,8 +150,7 @@ class DedeBizClient | |||
| ); | |||
| return $this->request($req); | |||
| } | |||
| //获取缓存文档 | |||
| //$key:键 | |||
| //获取缓存文档:$key键 | |||
| function CacheGet($key) | |||
| { | |||
| $req = array( | |||
| @@ -169,8 +161,7 @@ class DedeBizClient | |||
| ); | |||
| return $this->request($req); | |||
| } | |||
| //删除缓存文档 | |||
| //$key:键 | |||
| //删除缓存文档:$key键 | |||
| function CacheDel($key) | |||
| { | |||
| $req = array( | |||
| @@ -181,8 +172,7 @@ class DedeBizClient | |||
| ); | |||
| return $this->request($req); | |||
| } | |||
| //获取分词结果 | |||
| //$key:键 | |||
| //获取分词结果:$key键 | |||
| function Spliteword($body) | |||
| { | |||
| $req = array( | |||
| @@ -193,8 +183,7 @@ class DedeBizClient | |||
| ); | |||
| return $this->request($req); | |||
| } | |||
| //获取分词结果 | |||
| //$body:文档 $sep:分隔符 | |||
| //获取分词结果:$body文档 $sep分隔符 | |||
| function Pinyin($body, $sep) | |||
| { | |||
| $req = array( | |||
| @@ -238,8 +227,7 @@ class DedeBizClient | |||
| return null; | |||
| } | |||
| } | |||
| //关闭通信接口 | |||
| //一次页面操作后一定记得要关闭连接,否则会占用系统资源 | |||
| //关闭通信接口,一次页面操作后一定记得要关闭连接,否则会占用系统资源 | |||
| function Close() | |||
| { | |||
| //这里避免重复释放 | |||
| @@ -2,8 +2,7 @@ | |||
| if (!defined('DEDEINC')) exit('dedebiz'); | |||
| require_once(DEDEINC."/libraries/agent.class.php"); | |||
| /** | |||
| * 流量统计 | |||
| * 一个轻量级流量统计功能 | |||
| * 轻量级流量统计 | |||
| * | |||
| * @version $id:statistics.class.php 11:42 2022年03月26日 tianya $ | |||
| * @package DedeBIZ.Libraries | |||
| @@ -15,7 +14,7 @@ class DedeStatistics { | |||
| function __construct() | |||
| { | |||
| } | |||
| //获取统计JS | |||
| //获取统计js | |||
| function GetStat() | |||
| { | |||
| global $envs,$cfg_cookie_encode; | |||
| @@ -42,7 +42,7 @@ function CheckUserID($uid, $msgtitle = '用户名', $ckhas = TRUE) | |||
| if (isset($ck_uid[$i + 1]) && ord($ck_uid[$i + 1]) > 0x40) { | |||
| $i++; | |||
| } else { | |||
| return $msgtitle.'可能含有乱码,建议您改用英文字母和数字组合'; | |||
| return $msgtitle.'建议用英文字母和数字组合'; | |||
| } | |||
| } else { | |||
| if (preg_match("/[^0-9a-z@\.-]/i", $ck_uid[$i])) { | |||
| @@ -267,7 +267,7 @@ class MemberLogin | |||
| { | |||
| global $dsql; | |||
| $mid = $this->M_ID; | |||
| $arr = $dsql->GetOne("Select * `#@__member_tj` WHERE mid='$mid' "); | |||
| $arr = $dsql->GetOne("SELECT * `#@__member_tj` WHERE mid='$mid' "); | |||
| if (!is_array($arr)) { | |||
| $arr = array('article' => 0, 'album' => 0, 'archives' => 0, 'homecount' => 0, 'pagecount' => 0, 'feedback' => 0, 'friend' => 0, 'stow' => 0); | |||
| } | |||
| @@ -11,7 +11,7 @@ if (!defined('DEDEINC')) exit('dedebiz'); | |||
| */ | |||
| session_start(); | |||
| /** | |||
| * 检验用户是否有权使用某功能,这个函数是一个回值函数 | |||
| * 检验用户是否有权使用某功能,这个函数是一个回值函数 | |||
| * CheckPurview函数只是对他回值的一个处理过程 | |||
| * | |||
| * @access public | |||