当前位置: 首页>>代码示例>>PHP>>正文


PHP ExecTime函数代码示例

本文整理汇总了PHP中ExecTime函数的典型用法代码示例。如果您正苦于以下问题:PHP ExecTime函数的具体用法?PHP ExecTime怎么用?PHP ExecTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ExecTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetDataList

	function GetDataList()
	{
		$timedd = "未知";
		$starttime = ExecTime(); 
		$DataListValue = "";
		if($this->totalResult==0){
			$query = preg_replace("/^(.*)[\s]from[\s]/is",'Select count(*) as dd From ',$this->sourceSql);
			$rowdm = $this->dsql->GetOne($query);
			$this->totalResult = $rowdm['dd'];
		}
		$this->sourceSql .= " limit ".(($this->nowPage-1)*$this->pageSize).",".$this->pageSize;
		$this->dsql->Query('dm',$this->sourceSql);
		//计算执行时间
		$endtime = ExecTime();
		$timedd=$endtime-$starttime;
		$this->queryTime = $timedd;
		$GLOBALS["limittime"] = $timedd;
		$GLOBALS["totalrecord"] = $this->totalResult;
		return $this->dsql;
	}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:20,代码来源:pub_datalist_dm.php

示例2: GetArcList

	function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
	$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
	{
		global $cfg_list_son;
		$t1 = ExecTime();
		$typeid=$this->TypeID;
		
		if($row=="") $row = 10;
			if($limitstart=="") $limitstart = 0;
			if($titlelen=="") $titlelen = 100;
			if($infolen=="") $infolen = 250;
			if($imgwidth=="") $imgwidth = 120;
			if($imgheight=="") $imgheight = 120;
			if($listtype=="") $listtype = "all";
			if($orderby=="") $orderby="default";
			else $orderby=strtolower($orderby);
			if($orderWay=='') $orderWay = 'desc';
			$tablewidth = str_replace("%","",$tablewidth);
			if($tablewidth=="") $tablewidth=100;
			if($col=="") $col=1;
			$colWidth = ceil(100/$col);
			$tablewidth = $tablewidth."%";
			$colWidth = $colWidth."%";
			$innertext = trim($innertext);
			if($innertext=="") $innertext = GetSysTemplets("list_fulllist.htm");
			//按不同情况设定SQL条件

			$orwhere = $this->addSql;

			//排序方式
			if($orderby=="senddate") $ordersql=" order by arc.senddate $orderWay";
			elseif($orderby=="pubdate") $ordersql=" order by arc.pubdate $orderWay";
			elseif($orderby=="id") $ordersql="  order by arc.ID $orderWay";
			elseif($orderby=="hot"||$orderby=="click") $ordersql = " order by arc.click $orderWay";
			elseif($orderby=="lastpost") $ordersql = "  order by arc.lastpost $orderWay";
			elseif($orderby=="postnum") $ordersql = "  order by arc.postnum $orderWay";
			elseif($orderby=="digg") $ordersql = "  order by arc.digg $orderWay";
		  elseif($orderby=="diggtime") $ordersql = "  order by arc.diggtime $orderWay";
			else $ordersql=" order by arc.sortrank $orderWay";

			//获得附加表的相关信息
			//-----------------------------
			$addtable  = $this->ChannelUnit->ChannelInfos['addtable'];
			$addfields = trim($this->ChannelUnit->ChannelInfos['listadd']);
			if($addtable!="" && $addfields!="")
			{
				$addJoin = " left join `$addtable` addt on addt.aid = arc.ID ";
				$addField = "";
				$fields = explode(",",$addfields);
				foreach($fields as $k=>$v){
					$addField .= ",addt.{$v}";
				}
			}else
			{
				$addField = "";
				$addJoin = "";
			}

			$query = "Select arc.*,
			tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
			$addField
			from `{$this->maintable}` arc
			left join #@__arctype tp on arc.typeid=tp.ID
			$addJoin
			where $orwhere $ordersql limit $limitstart,$row";

			$this->dtp2->LoadSource($innertext);
			if(!is_array($this->dtp2->CTags)) return '';
			
			$this->dsql->Execute("al",$query);
			
			$t2 = ExecTime();
			
			$artlist = "";
			if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n";
			
			$GLOBALS['autoindex'] = 0;
			for($i=0;$i<$row;$i++)
			{
				if($col>1) $artlist .= "<tr>\r\n";
				for($j=0;$j<$col;$j++)
				{
					if($col>1) $artlist .= "<td width='$colWidth'>\r\n";
					if($row = $this->dsql->GetArray("al",MYSQL_ASSOC))
					{
						$GLOBALS['autoindex']++;
						//处理一些特殊字段
						//if()
						$row['id'] =  $row['ID'];
						$row['arcurl'] = $this->GetArcUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money']);
						$row['typeurl'] = $this->GetListUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],"abc");

						if($ismake==0 && $GLOBALS['cfg_multi_site']=='Y')
						{
							if($row["siteurl"]=="") $row["siteurl"] = $GLOBALS['cfg_mainsite'];
							if(!eregi("^http://",$row['picname'])){
								$row['litpic'] = $row['siteurl'].$row['litpic'];
								$row['picname'] = $row['litpic'];
							}
						}
//.........这里部分代码省略.........
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:101,代码来源:inc_arclist_view.php

示例3: MakeOneTag

/**
 *  给块标记赋值
 *
 * @param     object  $dtp  模板解析引擎
 * @param     object  $refObj  实例化对象
 * @param     object  $parfield
 * @return    string
 */
function MakeOneTag(&$dtp, &$refObj, $parfield = 'Y')
{
    global $cfg_disable_tags;
    $cfg_disable_tags = isset($cfg_disable_tags) ? $cfg_disable_tags : 'php';
    $disable_tags = explode(',', $cfg_disable_tags);
    $alltags = array();
    $dtp->setRefObj($refObj);
    //读取自由调用tag列表
    $dh = dir(DEDEINC . '/taglib');
    while ($filename = $dh->read()) {
        if (preg_match("/\\.lib\\./", $filename)) {
            $alltags[] = str_replace('.lib.php', '', $filename);
        }
    }
    $dh->Close();
    //遍历tag元素
    if (!is_array($dtp->CTags)) {
        return '';
    }
    foreach ($dtp->CTags as $tagid => $ctag) {
        $tagname = $ctag->GetName();
        if ($tagname == 'field' && $parfield == 'Y') {
            $vname = $ctag->GetAtt('name');
            if ($vname == 'array' && isset($refObj->Fields)) {
                $dtp->Assign($tagid, $refObj->Fields);
            } else {
                if (isset($refObj->Fields[$vname])) {
                    $dtp->Assign($tagid, $refObj->Fields[$vname]);
                } else {
                    if ($ctag->GetAtt('noteid') != '') {
                        if (isset($refObj->Fields[$vname . '_' . $ctag->GetAtt('noteid')])) {
                            $dtp->Assign($tagid, $refObj->Fields[$vname . '_' . $ctag->GetAtt('noteid')]);
                        }
                    }
                }
            }
            continue;
        }
        //由于考虑兼容性,原来文章调用使用的标记别名统一保留,这些标记实际调用的解析文件为inc_arclist.php
        if (preg_match("/^(artlist|likeart|hotart|imglist|imginfolist|coolart|specart|autolist)\$/", $tagname)) {
            $tagname = 'arclist';
        }
        if ($tagname == 'friendlink') {
            $tagname = 'flink';
        }
        if (in_array($tagname, $alltags)) {
            if (in_array($tagname, $disable_tags)) {
                if (DEBUG_LEVEL) {
                    echo 'DedeCMS Error:Tag disabled:"' . $tagname . '" <a href="http://help.dedecms.com/install-use/apply/2013/0711/2324.html" target="_blank">more...</a>!';
                }
                continue;
            }
            if (DEBUG_LEVEL == TRUE) {
                $ttt1 = ExecTime();
            }
            $filename = DEDEINC . '/taglib/' . $tagname . '.lib.php';
            include_once $filename;
            $funcname = 'lib_' . $tagname;
            $dtp->Assign($tagid, $funcname($ctag, $refObj));
            if (DEBUG_LEVEL == TRUE) {
                $queryTime = ExecTime() - $ttt1;
                echo '标签:' . $tagname . '载入花费时间:' . $queryTime . "<br />\r\n";
            }
        }
    }
}
开发者ID:hensonvip,项目名称:ymroad,代码行数:74,代码来源:channelunit.helper.php

示例4: __construct

	function __construct($aid)
 	{
 		global $PubFields;
 		$t1 = ExecTime();
 		$this->IsError = false;
 		$this->dsql = new DedeSql(false);
 		$this->ArcID = $aid;
 		$this->MemberInfos = array();
 		$this->PreNext = array();
 		$this->TempletsFile = '';
 		$this->MainTable = '';
 		$this->fullurl = '';
 		
    //获取文档表信息
    $fullsearchs = $this->dsql->GetOne("select c.ID as channelid,c.maintable,c.addtable,a.keywords,a.url from `#@__full_search` a left join  #@__channeltype c on  c.ID = a.channelid where a.aid='$aid'",MYSQL_ASSOC);
    if($fullsearchs['channelid']==-1)
    {
       $this->MainTable = '#@__archivesspec';
 		   $this->AddTable = '#@__addonspec';
 		}else
 		{
 		   if($fullsearchs['maintable']=='') $fullsearchs['maintable']='#@__archives';
 		   $this->MainTable = $fullsearchs['maintable'];
 		   $this->AddTable = $fullsearchs['addtable'];
 		}

 		$query = "Select arc.*,sm.name as smalltypename,tp.reID,tp.typedir,tp.typename,am.uname from `{$this->MainTable}` arc
 		          left join #@__arctype tp on tp.ID=arc.typeid
 		          left join #@__smalltypes sm on sm.id=arc.smalltypeid
 		          left join #@__admin am on arc.adminID = am.ID 
 		          where arc.ID='$aid'";
 		$row = $this->dsql->GetOne($query,MYSQL_ASSOC);

 		//无法获取记录
 		if(!is_array($row)){
 			$this->IsError = true;
 			return;
 	  }
 		//把主表记录转换为Field
 		foreach($row as $k=>$v) $this->Fields[$k] = $v;
 		$this->Fields['keywords'] = $fullsearchs['keywords'];
 		$this->fullurl = $fullsearchs['url'];
 		unset($row);
 		unset($fullsearchs);
 		if($this->Fields['redirecturl']!="") return;

 		//模板引擎与页面环境初始化
 		$this->ChannelUnit = new ChannelUnit($this->Fields['channel'],$aid);
 		$this->TypeLink = new TypeLink($this->Fields['typeid']);
 		$this->dtp = new DedeTagParse();
 		$this->SplitPageField = $this->ChannelUnit->SplitPageField;
 		$this->SplitFields = "";
 		$this->TotalPage = 1;
 		$this->NameFirst = "";
 		$this->ShortName = "html";
 		$this->FixedValues = "";
 		$this->TempSource = "";
 		$this->PartView = new PartView($this->Fields['typeid']);

 		if(empty($GLOBALS["pageno"])) $this->NowPage = 1;
 		else $this->NowPage = intval($GLOBALS["pageno"]);

 		//特殊的字段Field数据处理
 		$this->Fields['aid'] = $aid;
 		$this->Fields['id'] = $aid;
 		$this->Fields['position'] = $this->TypeLink->GetPositionLink(true);
 		//设置一些全局参数的值
 		foreach($PubFields as $k=>$v) $this->Fields[$k] = $v;
 		if($this->Fields['litpic']=="") $this->Fields['litpic'] = $this->Fields["phpurl"]."/img/dfpic.gif";

 		//读取附加表信息,并把附加表的资料经过编译处理后导入到$this->Fields中,以方便在
 		//模板中用 {dede:field name='fieldname' /} 标记统一调用
 		if($this->AddTable!="")
 		{
 		  $row = $this->dsql->GetOne("select * from ".trim($this->ChannelUnit->ChannelInfos["addtable"])." where aid=$aid ");
 		  if(is_array($row)) foreach($row as $k=>$v){ if(ereg("[A-Z]",$k)) $row[strtolower($k)] = $v; }
 		  foreach($this->ChannelUnit->ChannelFields as $k=>$arr)
 		  {
 		  	if(isset($row[$k]))
 		  	{
 		  		 if($arr["rename"]!="") $nk = $arr["rename"];
 		  		 else $nk = $k;
 		  		 $this->Fields[$nk] = $this->ChannelUnit->MakeField($k,$row[$k]);
 		  		 if($arr['type']=='htmltext' && $GLOBALS['cfg_keyword_replace']=='Y'){
 		  			 $this->Fields[$nk] = $this->ReplaceKeyword($this->Fields['keywords'],$this->Fields[$nk]);
 		  		 }
 		  	}
 		  }//End foreach
 		}
 		unset($row);

 		//处理要分页显示的字段
 		//---------------------------
 		$this->SplitTitles = Array();
 		if($this->SplitPageField!="" && $GLOBALS['cfg_arcsptitle']='Y' &&
 		 isset($this->Fields[$this->SplitPageField]))
 	  {
 			$this->SplitFields = explode("#p#",$this->Fields[$this->SplitPageField]);
 			$i = 1;
 			foreach($this->SplitFields as $k=>$v)
//.........这里部分代码省略.........
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:101,代码来源:inc_archives_view.php

示例5: preg_replace

	//后两个变量为系统继承变量,不可指定
	if($step != 'me'){
		return preg_replace('/(^|>)([^<]+)(?=<|$)/sUe', "highlight('\\2',\$words, \$hrefs, '\\1', 'me')", $string);
	}
	
	if(is_array($words)){
			$string = str_replace('\"', '"', $string);
			foreach($words as $k => $word){
				if(empty($hrefs[$k])){
					$string = preg_replace('/(^|>)([^<]+)(?=<|$)/sUe', "highlight('\\2',\$word, '', '\\1', 'me')", $string);
				}else{
					$string = preg_replace('/(^|>)([^<]+)(?=<|$)/sUe', "highlight('\\2',\$word, \$hrefs[\$k], '\\1', 'me')", $string);
				}
			}
		return $pretext.$string;
	}else{
		if($hrefs == ''){
			$string = str_replace($words,'<strong><font color="#ff0000">'.$words.'</font></strong>',$string);
		}else{
			if(strpos($string, $words) !== false){
				$string = str_replace($words, '<a href="'.$hrefs.'" style="color:#ff0000;font-weight:bold;">'.$words.'</a>', $string);
			}
		}
		return $pretext.$string;
	}
	
}

$startRunMe = ExecTime();
?>
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:30,代码来源:inc_functions.php

示例6: ExecTime

						$mkimg->Cut($cfg_basedir.$litpic,$imgwidth,$imgheight);
						break;
					case 4:
						$mkimg->BackFill($cfg_basedir.$litpic,$imgwidth,$imgheight,$backcolor1,$backcolor2,$backcolor3);
						break;
				}
				$dsql->ExecuteNoneQuery("update #@__archives set litpic='$litpic' where ID='$ID'");
				$dsql->ExecuteNoneQuery("update #@__full_search set litpic='$litpic' where aid='$ID'");
			}
		}
				//echo "update #@__archives set litpic=$litpic where ID=$ID";
		echo $litpic."---ID:".$ID."<BR>";
	}
}

$t2 = ExecTime();
$t2 = ($t2 - $t1);

//返回提示信息
if($totalnum>0) $tjlen = ceil( ($tjnum/$totalnum) * 100 );
else $tjlen=100;
$dvlen = $tjlen * 2;
$tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:$dvlen;height:15;background-color:#829D83'></div></div>";
$tjsta .= "<br/>本次用时:".number_format($t2,2)." 到达位置:".($startdd+$pagesize)."<br/>完成创建文件总数的:$tjlen %,继续执行任务...";

if($tjnum < $totalnum)
{
	$nurl  = "makeminiature_action.php?endid=$endid&startid=$startid&typeid=$typeid";
	$nurl .= "&totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize";
	$nurl .= "&seltime=$seltime&stime=".urlencode($stime)."&etime=".urlencode($etime);
	$nurl .="&isall=$isall&maketype=$maketype&imgwidth=$imgwidth&imgheight=$imgheight&backcolor1=$backcolor1&backcolor2=$backcolor2&backcolor3=$backcolor3";
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:makeminiature_action.php

示例7: LoadTemplate

 /**
  *  设定模板文件
  *
  * @access    public
  * @param     string  $tmpfile  模板文件
  * @return    void
  */
 function LoadTemplate($tmpfile)
 {
     if (!file_exists($tmpfile)) {
         echo " Template Not Found! ";
         exit;
     }
     $tmpfile = preg_replace("/[\\/]{1,}/", "/", $tmpfile);
     $tmpfiles = explode('/', $tmpfile);
     $tmpfileOnlyName = preg_replace("/(.*)\\//", "", $tmpfile);
     $this->templateFile = $tmpfile;
     $this->refDir = '';
     for ($i = 0; $i < count($tmpfiles) - 1; $i++) {
         $this->refDir .= $tmpfiles[$i] . '/';
     }
     if (!is_dir($this->cacheDir)) {
         $this->cacheDir = $this->refDir;
     }
     if ($this->cacheDir != '') {
         $this->cacheDir = $this->cacheDir . '/';
     }
     if (isset($GLOBALS['_DEBUG_CACHE'])) {
         $this->cacheDir = $this->refDir;
     }
     $this->cacheFile = $this->cacheDir . preg_replace("/\\.(wml|html|htm|php)\$/", "_" . $this->GetEncodeStr($tmpfile) . '.inc', $tmpfileOnlyName);
     $this->configFile = $this->cacheDir . preg_replace("/\\.(wml|html|htm|php)\$/", "_" . $this->GetEncodeStr($tmpfile) . '_config.inc', $tmpfileOnlyName);
     //不开启缓存、当缓存文件不存在、及模板为更新的文件的时候才载入模板并进行解析
     if ($this->isCache == FALSE || !file_exists($this->cacheFile) || filemtime($this->templateFile) > filemtime($this->cacheFile)) {
         $t1 = ExecTime();
         //debug
         $fp = fopen($this->templateFile, 'r');
         $this->sourceString = fread($fp, filesize($this->templateFile));
         fclose($fp);
         $this->ParseTemplate();
         //模板解析时间
         //echo ExecTime() - $t1;
     } else {
         //如果存在config文件,则载入此文件,该文件用于保存 $this->tpCfgs的内容,以供扩展用途
         //模板中用{tag:config name='' value=''/}来设定该值
         if (file_exists($this->configFile)) {
             include $this->configFile;
         }
     }
 }
开发者ID:lz1988,项目名称:stourwebcms,代码行数:50,代码来源:sttemplate.class.php

示例8: GetDataList

	function GetDataList($innertext)
	{
		$timedd = "未知";
		$starttime = ExecTime(); 
		$DataListValue = "";
		if($this->totalResult==0){
			$query = preg_replace("/^(.*)[\s]from[\s]/is",'Select count(*) as dd From ',$this->sourceSql);
			$rowdm = $this->dsql->GetOne($query);
			$this->totalResult = $rowdm['dd'];
		}
		$this->sourceSql .= " limit ".(($this->nowPage-1)*$this->pageSize).",".$this->pageSize;
		$this->dsql->Query('dms',$this->sourceSql);
		//计算执行时间
		$endtime = $this->ExecTime();
		if($starttime!=""&&$endtime!=""){
			$timedd=$endtime-$starttime;
			if($timedd<0) $timedd=$timedd*(-1.0);
			$timedd=substr($timedd,0,5);
		}
		$this->queryTime = $timedd;
		$GLOBALS["limittime"] = $timedd;
		$GLOBALS["totalrecord"] = $this->totalResult;
		////////////////////////////////////////
		$dtp2 = new DedeTagParse();
		$dtp2->TagStartWord="[";
		$dtp2->TagEndWord="]";
		$dtp2->NameSpace="field";
		$dtp2->CharToLow=FALSE;
		$dtp2->LoadSource($innertext);
		$fnum = 0;
		while($GLOBALS["row"] = $this->dsql->GetArray('dms'))
		{
			$fnum++;
			for($i=0;$i<=$dtp2->Count;$i++)
			{
				if(isset($GLOBALS["row"][$dtp2->CTags[$i]->TagName]))
					$dtp2->Assign($i,$GLOBALS["row"][$dtp2->CTags[$i]->TagName]);
				else
					$dtp2->Assign($i,"");
			}
			$DataListValue .= $dtp2->GetResult();
		}
		$GLOBALS["row"] = "";
		return $DataListValue;
	}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:45,代码来源:pub_datalist.php

示例9: GetRndName

	function GetRndName($url,$v)
	{
		global $threadnum;
		$this->MediaCount++;
		$mnum = $this->MediaCount;
		$timedir = strftime("%y%m%d",time());
		//存放路径
		$fullurl = preg_replace("/\/{1,}/","/",$this->Item["imgurl"]."/");
		if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$GLOBALS['cfg_dir_purview']);
		$fullurl = $fullurl.$timedir."/";
		if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$GLOBALS['cfg_dir_purview']);
		//文件名称
		$timename = str_replace(".","",ExecTime());
		$nthreadnum =(!empty($threadnum) ? $threadnum : 0);
		$filename = $timename.$nthreadnum.$mnum.mt_rand(1000,9999);
		//把适合的数字转为字母
		$filename = dd2char($filename);
		//分配扩展名
		$urls = explode(".",$url);
		if($v=="img"){
			$shortname = ".jpg";
			if(eregi("\.gif\?(.*)$",$url) || eregi("\.gif$",$url)) $shortname = ".gif";
			else if(eregi("\.png\?(.*)$",$url) || eregi("\.png$",$url)) $shortname = ".png";
		}
		else if($v=="embed") $shortname = ".swf";
		else $shortname = "";
		//-----------------------------------------
		$fullname = $fullurl.$filename.$shortname;
		return preg_replace("/\/{1,}/","/",$fullname);
	}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:30,代码来源:pub_collection.php

示例10: GetArcList

	function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250,
	$imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc')
	{
		global $cfg_list_son;
		$t1 = ExecTime();
		$typeid=$this->TypeID;
		if($row=="") $row = 10;
		if($limitstart=="") $limitstart = 0;
		if($titlelen=="") $titlelen = 100;
		if($infolen=="") $infolen = 250;
		if($imgwidth=="") $imgwidth = 120;
		if($imgheight=="") $imgheight = 120;
		if($listtype=="") $listtype = "all";
		if($orderby=="") $orderby="default";
		else $orderby=strtolower($orderby);
		if($orderWay=='') $orderWay = 'desc';
		$tablewidth = str_replace("%","",$tablewidth);
		if($tablewidth=="") $tablewidth=100;
		if($col=="") $col=1;
		$colWidth = ceil(100/$col);
		$tablewidth = $tablewidth."%";
		$colWidth = $colWidth."%";
		$innertext = trim($innertext);
		if($innertext=="") $innertext = GetSysTemplets("list_digglist.htm");
		//按不同情况设定SQL条件
		$orwhere = " arc.arcrank > -1 ";
    
		//排序方式
		$ordersql = "";
		if($orderby=="digg") $ordersql=" order by arc.digg $orderWay";
		else $ordersql=" order by arc.diggtime $orderWay";

    $this->dtp2->LoadSource($innertext);
		if(!is_array($this->dtp2->CTags)) return '';

		$query = "Select arc.*,
			tp.typedir,tp.typename,tp.isdefault,tp.defaultname,
			tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
			from `#@__full_search` arc
			left join #@__arctype tp on arc.typeid=tp.ID
			where $orwhere $ordersql limit $limitstart,$row
		";
		$this->dsql->SetQuery($query);
		$this->dsql->Execute("alf");
		//$t2 = ExecTime();
		//echo $query."|";
		//echo ($t2-$t1)."<br>";
		$artlist = "";
		$GLOBALS['autoindex'] = 0;
		while($row = $this->dsql->GetArray("alf"))
    {
       //处理一些特殊字段
       $row['description'] = cn_substr($row['addinfos'],$infolen);
       $row['id'] =  $row['aid'];
       $row['filename'] = $row['arcurl'] = $row['url'];
       $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
       if($row['litpic']=="") $row['litpic'] = $GLOBALS['PubFields']['templeturl']."/img/default.gif";
       $row['picname'] = $row['litpic'];
       if($GLOBALS['cfg_multi_site']=='Y')
       {
           if($row['siteurl']=="") $row['siteurl'] = $GLOBALS['cfg_mainsite'];
           if(!eregi("^http://",$row['picname'])){
           	 	$row['litpic'] = $row['siteurl'].$row['litpic'];
           	 	$row['picname'] = $row['litpic'];
           }
       }
       $row['stime'] = GetDateMK($row['uptime']);
       $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
       $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."' />";
       $row['imglink'] = "<a href='".$row['arcurl']."'>".$row['image']."</a>";
       $row['fulltitle'] = $row['title'];
       $row['title'] = cn_substr($row['title'],$titlelen);
       $row['textlink'] = "<a href='".$row['arcurl']."'>".$row['title']."</a>";
       foreach($this->dtp2->CTags as $k=>$ctag)
       {
       		if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]);
       		else $this->dtp2->Assign($k,'');
       }
       $GLOBALS['autoindex']++;
       $artlist .= $this->dtp2->GetResult();
     }//Loop Line
		 $this->dsql->FreeResult("alf");
		//$t3 = ExecTime();
		//echo ($t3-$t2)."<br>";
		return $artlist;
	}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:86,代码来源:inc_digglist_view.php

示例11: SpGetFullList


//.........这里部分代码省略.........
    
	 //文档排序的方式
		$ordersql = "";
    if($orderby=='rand') $ordersql = "  order by rand()";
    else if($orderby=='click'||$orderby=='hot') $ordersql = "  order by arcf.click desc";
    else if($orderby=='digg') $ordersql = "  order by arcf.digg desc";
    else if($orderby=='diggtime') $ordersql = "  order by arcf.diggtime desc";
		else $ordersql=" order by arcf.aid desc";

    //返回结果条数
	  if(!empty($limit)) $limitsql = " limit $limitv ";
	  else $limitsql = " limit 0,$line ";

	  //载入底层模板
	  $dtp2 = new DedeTagParse();
    $dtp2->SetNameSpace("field","[","]");
    $dtp2->LoadString($innertext);
    if(!is_array($dtp2->CTags)) return '';

		//执行SQL查询
		$query = "Select arcf.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
		from `#@__full_search` arcf left join `#@__arctype` tp on arcf.typeid=tp.ID
		where $orwhere $ordersql $limitsql ";
		
		$md5hash = md5($query);
		$artlist = '';
		$ids = '';
		$needup = false;
		if($idlist=='' && $cfg_al_cachetime>0)
		{
		  	$ids = SpGetArclistDateCacheF($dsql,$md5hash);
		  	if($ids=='-1') $needup = true;
		  	else if($ids!='')
		  	{
		         $query = "Select arcf.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl
		                 from `#@__full_search` arcf left join `#@__arctype` tp on arcf.typeid=tp.ID
		                 where arcf.aid in($ids) $ordersql $limitsql ";
		  	}else 
		  	{
		  		return '';
		  	}
		}
		$nids = array();
		$t1 = ExecTime();
		$dsql->SetQuery($query);
		$dsql->Execute("alf");
    
    $GLOBALS['autoindex'] = 0;
    while($row = $dsql->GetArray("alf"))
    {
       //处理一些特殊字段
       $row['description'] = cn_substr($row['addinfos'],$infolen);
       $nids[] = $row['id'] =  $row['aid'];
       if(!isset($row['picname'])) $row['picname'] = '';
       
       if($row['url']=='') $row['url'] = $GLOBALS['cfg_phpurl'].'/view.php?aid='.$row['aid'];
       
       $row['filename'] = $row['arcurl'] = $row['url'];
       $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
       if($row['litpic']=="") $row['litpic'] = $GLOBALS['PubFields']['templeturl']."/img/default.gif";
       $row['picname'] = $row['litpic'];
       if($GLOBALS['cfg_multi_site']=='Y')
       {
           if($row['siteurl']=="") $row['siteurl'] = $GLOBALS['cfg_mainsite'];
           if(!eregi("^http://",$row['picname'])){
           	 	$row['litpic'] = $row['siteurl'].$row['litpic'];
           	 	$row['picname'] = $row['litpic'];
           }
       }
       $row['stime'] = GetDateMK($row['uptime']);
       $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>";
       $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."' />";
       $row['imglink'] = "<a href='".$row['arcurl']."'>".$row['image']."</a>";
       $row['fulltitle'] = $row['title'];
       $row['title'] = cn_substr($row['title'],$titlelen);
       $row['textlink'] = "<a href='".$row['arcurl']."'>".$row['title']."</a>";
       foreach($dtp2->CTags as $k=>$ctag)
       {
       		if(isset($row[$ctag->GetName()])){
       			$dtp2->Assign($k,$row[$ctag->GetName()]);
       		}
       		else $dtp2->Assign($k,'');
       }
       $GLOBALS['autoindex']++;
       $artlist .= $dtp2->GetResult();
     }//Loop Line
     $dsql->FreeResult("alf");
     
     if($needup)
     {
     	  $ids = join(',',$nids);
     	  $inquery = "INSERT INTO `#@__arccache_full`(`md5hash`,`uptime`,`cachedata`) VALUES ('".$md5hash."', '".time()."', '$ids'); ";
	      $dsql->ExecuteNoneQuery("Delete From `#@__arccache_full` where md5hash='".$md5hash."' or uptime < $mintime ");
	      $dsql->ExecuteNoneQuery($inquery);
     }
     
     $t2 = ExecTime();
     //echo "<hr>".($t2-$t1)." $query<hr>";
     return $artlist;
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:101,代码来源:inc_fun_SpFullList.php

示例12: SpGetArcList

function SpGetArcList(&$dsql,$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,$limitv="",$att="",$order="desc",
  $subday=0,$ismember=0,$maintable='#@__archives',$ctag='',$isUpCache=true)
  {
		global $PubFields,$cfg_keyword_like,$cfg_arc_all,$cfg_needsontype,$cfg_maxsearch,$cfg_al_cachetime;

		$row = AttDef($row,10);
		$titlelen = AttDef($titlelen,30);
		$infolen = AttDef($infolen,160);
		$imgwidth = AttDef($imgwidth,120);
		$imgheight = AttDef($imgheight,120);
		$listtype = AttDef($listtype,"all");
    $arcid = AttDef($arcid,0);
    //$att = AttDef($att,0);
    $channelid = AttDef($channelid,0);
    $ismember = AttDef($ismember,0);
    $orderby = AttDef($orderby,"default");
    $orderWay = AttDef($order,"desc");
    $maintable = AttDef($maintable,"#@__archives");
    $subday = AttDef($subday,0);
    $line = $row;
		$orderby=strtolower($orderby);
		$tablewidth = str_replace("%","",$tablewidth);
		if($tablewidth=="") $tablewidth=100;
		if($col=="") $col = 1;
		$colWidth = ceil(100/$col);
		$tablewidth = $tablewidth."%";
		$colWidth = $colWidth."%";
		$keyword = trim($keyword);
		$innertext = trim($innertext);
		if($innertext=="") $innertext = GetSysTemplets("part_arclist.htm");
		if(!empty($idlist) && ereg("[^0-9,]",$idlist)) $idlist = '';
		
		$mintime = time() - ($cfg_al_cachetime * 3600);

		$orwhere = '';

  //对于文章列表等地方的调用,限定为最新文档
  $idlist = ereg_replace("[^,0-9]","",$idlist);
	if($idlist!='') $orwhere .= " arc.ID in ($idlist) And ";
    

  $t1 = ExecTime();
	
	//按不同情况设定SQL条件 排序方式
	$orwhere .= " arc.arcrank > -1 ";

  $addField = "";
  $addJoin = "";
  $channelinfos = '';

  //获取主表
  if(eregi('spec',$listtype)) $channelid = -1;
  if(!empty($typeid)) $reids = explode(',',$typeid);
  if(!empty($channelid))
  {
  	$channelinfos = $dsql->GetOne("Select ID,maintable,addtable,listadd From `#@__channeltype` where ID='$channelid' ");
  	$maintable = $channelinfos['maintable'];
  }else if(!empty($typeid))
  {
		$channelinfos = $dsql->GetOne("select c.ID,c.maintable,c.addtable,c.listadd from `#@__arctype` a left join #@__channeltype c on c.ID=a.channeltype where a.ID='".$reids[0]."' ");
		if(is_array($channelinfos)) {			
			$maintable = $channelinfos['maintable'];
			$channelid = $channelinfos['ID'];
		}
  }

  if(trim($maintable)=='') $maintable = "#@__archives";

   //时间限制(用于调用最近热门文章、热门评论之类)
		if($subday>0){
			 $limitvday = time() - ($subday * 24 * 3600);
			 $orwhere .= " And arc.senddate > $limitvday ";
		}
		//文档的自定义属性
		if($att!="") $orwhere .= " And arc.arcatt='$att' ";
		//文档的频道模型
		if(!empty($channelid) && !eregi("spec",$listtype)) $orwhere .= " And arc.channel = '$channelid' ";
		//echo $orwhere.$channelid ;
		//是否为推荐文档
		if(eregi("commend",$listtype)) $orwhere .= " And arc.iscommend > 10  ";
		//是否为带缩略图图片文档
		if(eregi("image",$listtype)) $orwhere .= " And arc.litpic <> ''  ";
		//是否为专题文档
		if(eregi("spec",$listtype) || $channelid==-1) $orwhere .= " And arc.channel = -1  ";
    //是否指定相近ID
		if($arcid!=0) $orwhere .= " And arc.ID<>'$arcid' ";

		//是否为会员文档
		if($ismember==1) $orwhere .= " And arc.memberid>0  ";

		if($cfg_keyword_like=='N'){ $keyword=""; }

	//类别ID的条件,如果用 "," 分开,可以指定特定类目
	//------------------------------
	if(!empty($typeid))
	{
		  $ridnum = count($reids);
		  if($ridnum>1)
//.........这里部分代码省略.........
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:101,代码来源:inc_fun_SpGetArcList.php

示例13: Testlists

 function Testlists(&$dourl)
 {
     $links = array();
     //从RSS中获取网址
     if ($this->lists['sourcetype'] == 'rss') {
         $dourl = $this->lists['rssurl'];
         $links = GetRssLinks($dourl);
         return $links;
     }
     //正常情况
     if (isset($this->lists['url'][0][0])) {
         $dourl = $this->lists['url'][0][0];
     } else {
         $dourl = '';
         $this->errString = "配置中指定列表的网址错误!\r\n";
         return $links;
     }
     $dhtml = new DedeHtml2();
     $html = $this->DownOnePage($dourl);
     if ($html == '') {
         $this->errString = "读取网址: {$dourl} 时失败!\r\n";
         return $links;
     }
     if (trim($this->lists['areastart']) != '' && trim($this->lists['areaend']) != '') {
         $areabody = $this->lists['areastart'] . '[var:区域]' . $this->lists['areaend'];
         $html = $this->GetHtmlArea('[var:区域]', $areabody, $html);
     }
     $t1 = ExecTime();
     $dhtml->SetSource($html, $dourl, 'link');
     foreach ($dhtml->Links as $s) {
         if ($this->lists['nothas'] != '') {
             if (eregi($this->lists['nothas'], $s['link'])) {
                 continue;
             }
         }
         if ($this->lists['musthas'] != '') {
             if (!eregi($this->lists['musthas'], $s['link'])) {
                 continue;
             }
         }
         $links[] = $s;
     }
     return $links;
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:44,代码来源:dedecollection.class.php

示例14: stripslashes

     $imagebody = stripslashes($imagebody);
     $imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname);
     if ($ddisfirst == 1 && $litpic == '' && !empty($litpicname)) {
         $litpic = $litpicname;
         $hasone = TRUE;
     }
 }
 /*---------------------
   function _getformzip()
   处理从ZIP中解压的图片
   ---------------------*/
 if ($formzip == 1) {
     include_once DEDEINC . "/zip.class.php";
     include_once DEDEADMIN . "/file_class.php";
     $zipfile = $cfg_basedir . str_replace($cfg_mainsite, '', $zipfile);
     $tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16);
     $ntime = time();
     if (file_exists($zipfile)) {
         @mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
         @chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
         $z = new zip();
         $z->ExtractAll($zipfile, $tmpzipdir);
         $fm = new FileManagement();
         $imgs = array();
         $fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
         $i = 0;
         foreach ($imgs as $imgold) {
             $i++;
             $savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime);
             CreateDir($savepath);
             $iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999));
开发者ID:nanhuacrab,项目名称:www,代码行数:31,代码来源:album_add.php

示例15: GetArcList

 /**
  *  获得一个单列的文档列表
  *
  * @access    public
  * @param     int  $limitstart  限制开始  
  * @param     int  $row  行数 
  * @param     int  $col  列数
  * @param     int  $titlelen  标题长度
  * @param     int  $infolen  描述长度
  * @param     int  $imgwidth  图片宽度
  * @param     int  $imgheight  图片高度
  * @param     string  $listtype  列表类型
  * @param     string  $orderby  排列顺序
  * @param     string  $innertext  底层模板
  * @param     string  $tablewidth  表格宽度
  * @param     string  $ismake  是否编译
  * @param     string  $orderWay  排序方式
  * @return    string
  */
 function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $listtype = "all", $orderby = "default", $innertext = "", $tablewidth = "100", $ismake = 1, $orderWay = 'desc')
 {
     global $cfg_list_son;
     $typeid = $this->TypeID;
     if ($row == '') {
         $row = 10;
     }
     if ($limitstart == '') {
         $limitstart = 0;
     }
     if ($titlelen == '') {
         $titlelen = 100;
     }
     if ($listtype == '') {
         $listtype = "all";
     }
     if ($orderby == '') {
         $orderby = 'id';
     } else {
         $orderby = strtolower($orderby);
     }
     if ($orderWay == '') {
         $orderWay = 'desc';
     }
     $tablewidth = str_replace("%", "", $tablewidth);
     if ($tablewidth == '') {
         $tablewidth = 100;
     }
     if ($col == '') {
         $col = 1;
     }
     $colWidth = ceil(100 / $col);
     $tablewidth = $tablewidth . "%";
     $colWidth = $colWidth . "%";
     $innertext = trim($innertext);
     if ($innertext == '') {
         $innertext = GetSysTemplets('list_sglist.htm');
     }
     //排序方式
     $ordersql = '';
     if ($orderby == 'senddate' || $orderby == 'id') {
         $ordersql = " ORDER BY arc.aid {$orderWay}";
     } else {
         if ($orderby == 'hot' || $orderby == 'click') {
             $ordersql = " ORDER BY arc.click {$orderWay}";
         } else {
             $ordersql = " ORDER BY arc.aid {$orderWay}";
         }
     }
     $addField = 'arc.' . join(',arc.', $this->ListFields);
     //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢)
     if (preg_match('/hot|click/', $orderby) || $this->sAddTable) {
         $query = "SELECT tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,\n            tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,arc.aid,arc.aid AS id,arc.typeid,\n            {$addField}\n            FROM `{$this->AddTable}` arc\n            LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n            WHERE {$this->addSql} {$ordersql} LIMIT {$limitstart},{$row}";
     } else {
         $t1 = ExecTime();
         $ids = array();
         $nordersql = str_replace('.aid', '.id', $ordersql);
         $query = "SELECT id From `#@__arctiny` arc WHERE {$this->addSql} {$nordersql} LIMIT {$limitstart},{$row} ";
         $this->dsql->SetQuery($query);
         $this->dsql->Execute();
         while ($arr = $this->dsql->GetArray()) {
             $ids[] = $arr['id'];
         }
         $idstr = join(',', $ids);
         if ($idstr == '') {
             return '';
         } else {
             $query = "SELECT tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,\n                tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,arc.aid,arc.aid AS id,arc.typeid,\n                       {$addField}\n                       FROM `{$this->AddTable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id\n                       WHERE arc.aid IN({$idstr}) AND arc.arcrank >-1 {$ordersql} ";
         }
         $t2 = ExecTime();
         //echo $t2-$t1;
     }
     $this->dsql->SetQuery($query);
     $this->dsql->Execute('al');
     $t2 = ExecTime();
     //echo $t2-$t1;
     $artlist = '';
     $this->dtp2->LoadSource($innertext);
     $GLOBALS['autoindex'] = 0;
     for ($i = 0; $i < $row; $i++) {
         if ($col > 1) {
//.........这里部分代码省略.........
开发者ID:cwcw,项目名称:cms,代码行数:101,代码来源:arc.sglistview.class.php


注:本文中的ExecTime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。