⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inc_arcpart_view.php

📁 强大的PHP内容管理系统尽量不要让站长把时间都花费在为您修正说明上。压缩包解压
💻 PHP
📖 第 1 页 / 共 3 页
字号:
		return $revalue;
	}
	//----------------------------------------
	//通过任意SQL查询获得内容
	//----------------------------------------
	function GetSql($sql="",$InnerText=""){
		$InnerText = trim($InnerText);
		if($sql==""||$InnerText=="") return "";
		$revalue = "";
		$this->dsql->SetQuery($sql);
		$this->dsql->Execute();
		$ctp = new DedeTagParse();
		$ctp->SetNameSpace("field","[","]");
		$ctp->LoadSource($InnerText);
		while($row = $this->dsql->GetArray())
    {
		  foreach($ctp->CTags as $tagid=>$ctag){
		    if(isset($row[$ctag->GetName()]))
		    { $ctp->Assign($tagid,$row[$ctag->GetName()]); }
		  }
		  $revalue .= $ctp->GetResult();
		}
		return $revalue;
	}
	//----------------------------------------
	//获得标签
	//----------------------------------------
	function GetTags($num,$ltype='new',$InnerText=""){
		global $cfg_cmspath;
		$InnerText = trim($InnerText);
		if($InnerText=="") $InnerText = GetSysTemplets("tag_one.htm");
		$revalue = "";
		if($ltype=='rand') $orderby = ' rand() ';
		else if($ltype=='week') $orderby=' weekcc desc ';
		else if($ltype=='month') $orderby=' monthcc desc ';
		else if($ltype=='hot') $orderby=' count desc ';
		else $orderby = '  id desc  ';
		if(empty($num)) $num = 10;
		$this->dsql->SetQuery("Select tagname,count,monthcc,result From #@__tag_index order by $orderby limit 0,$num");
    $this->dsql->Execute();
		$ctp = new DedeTagParse();
		$ctp->SetNameSpace("field","[","]");
		$ctp->LoadSource($InnerText);
		while($row = $this->dsql->GetArray())
    {
		  $row['keyword'] = $row['tagname'];
		  $row['link'] = $cfg_cmspath."/tag.php?/".urlencode($row['keyword'])."/";
		  $row['highlight'] = $row['keyword'];
		  $row['result'] = trim($row['result']);
		  if(empty($row['result'])) $row['result'] = 0;

		  if($ltype=='view'||$ltype=='rand'||$ltype=='new'){
		  	 if($row['monthcc']>1000 || $row['weekcc']>300 ){
		  	 	  $row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:red'><b>{$row['highlight']}</b></span>";
		  	 }
		  	 else if($row['result']>150){
		  	 	  $row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:blue'>{$row['highlight']}</span>";
		  	 }
		  	 else if($row['count']>1000){
		  	 	  $row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;color:red'>{$row['highlight']}</span>";
		  	 }
		  }else{
		  	$row['highlight'] = "<span style='font-size:".mt_rand(12,16)."px;'>{$row['highlight']}</span>";
		  }

		  foreach($ctp->CTags as $tagid=>$ctag){
		    if(isset($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]);
		  }
		  $revalue .= $ctp->GetResult();
		}

		return $revalue;
	}

	/*调用圈子模块相关方法*/
  //最新主题调用 $num:贴子数,$gid:圈子ID,$dsql数据连接,$h:依照什么排序,$orders:排序方法
  function GetThreads($gid=0,$num=0,$orderby="dateline",$orderway="DESC",$innertext='')
  {
	  global $cfg_group_url,$cfg_dbprefix;
    if( !$this->dsql->IsTable("{$cfg_dbprefix}group_threads") ) return '没安装问答模块';
	  $num = AttDef($num,12);
	  $gid = AttDef($gid,0);
	  $orderway = AttDef($orderway,'desc');
	  $orderby = AttDef($orderby,'dateline');
	  if(trim($innertext)=="") $innertext = GetSysTemplets("groupthreads.htm");
	  $WhereSql = " WHERE t.closed=0 ";
	  $orderby = 't.'.$orderby;
	  if($gid > 0) $WhereSql .= " AND t.gid='$gid' ";
	  $this->dsql->SetQuery("SELECT t.subject,t.gid,t.tid,t.lastpost,g.groupname FROM #@__group_threads t left join #@__groups g on g.groupid=t.gid  $WhereSql ORDER BY $orderby $orderway LIMIT 0,{$num}");
    $this->dsql->Execute();
    $ctp = new DedeTagParse();
		$ctp->SetNameSpace("field","[","]");
		if(!isset($list)) $list = '';
    while($rs = $this->dsql->GetArray())
    {
  	  $ctp->LoadSource($innertext);
  	  $rs['url'] = $cfg_group_url."/viewthread.php?id={$rs['gid']}&tid={$rs['tid']}";
  	  $rs['groupurl'] = $cfg_group_url."/group.php?id={$rs['gid']}";
  	  foreach($ctp->CTags as $tagid=>$ctag){
		    if(!empty($rs[strtolower($ctag->GetName())])){ $ctp->Assign($tagid,$rs[$ctag->GetName()]); }
		  }
		  $list .= $ctp->GetResult();
    }
    return $list;
  }

  function GetGroups($nums=0,$orderby='threads',$innertext='')
  {
	  global $cfg_group_url,$cfg_dbprefix;
    if( !$this->dsql->IsTable("{$cfg_dbprefix}groups") ) return '没安装圈子模块';
	  $list = '';
	  $nums = AttDef($nums,6);
	  $orderby = AttDef($orderby,'threads');
	  if(trim($innertext)=='') $innertext = GetSysTemplets("groups.htm");
	  $this->dsql->SetQuery("SELECT groupimg,groupid,groupname FROM #@__groups WHERE ishidden=0 ORDER BY $orderby DESC LIMIT 0,{$nums}");
    $this->dsql->Execute();
    $ctp = new DedeTagParse();
		$ctp->SetNameSpace("field","[","]");
    while($rs = $this->dsql->GetArray())
    {
  	  $ctp->LoadSource($innertext);
  	  $rs['url'] = $cfg_group_url."/group.php?id={$rs['groupid']}";
  	  $rs['icon']  = $rs['groupimg'];
  	  foreach($ctp->CTags as $tagid=>$ctag){
		    if(!empty($rs[strtolower($ctag->GetName())])){ $ctp->Assign($tagid,$rs[$ctag->GetName()]); }
		  }
		  $list .= $ctp->GetResult();
    }
	  return $list;
 }

 //调用问答最新主题
 //--------------------------------
 function GetAsk($nums=8,$qtype='new',$innertext='',$tid=0)
 {
    global $cfg_ask_url,$cfg_dbprefix;

    if( !$this->dsql->IsTable("{$cfg_dbprefix}ask") ) return '没安装问答模块';

    $nums = AttDef($nums,6);
    $qtype = AttDef($qtype,'new');
    $tid = AttDef($tid,0);
    if(trim($innertext)=='') $innertext = GetSysTemplets("asks.htm");
		$qtypeQuery = '';

		if($tid>0) $tid = " (tid=$tid Or $tid2='$tid') And ";
		else $tid = '';
		//推荐问题
		if($qtype=='commend') $qtypeQuery = " $tid digest=1 order by dateline desc ";
		//新解决问题
		else if($qtype=='ok') $qtypeQuery = " $tid status=1 order by solvetime desc ";
		//高分问题
		else if($qtype=='high') $qtypeQuery = " $tid status=0 order by reward desc ";
		//新问题
		else $qtypeQuery = " $tid status=0 order by disorder desc, dateline desc ";

		$ctp = new DedeTagParse();
		$ctp->SetNameSpace("field","[","]");

    $query = "select id, tid, tidname, tid2, tid2name, title from #@__ask where $qtypeQuery  limit $nums";
    $this->dsql->Execute('me',$query);
    $solvingask = '';
    while($rs = $this->dsql->GetArray('me'))
    {
	    $ctp->LoadSource($innertext);
	    if($rs['tid2name']!='')
	    {
	    	$rs['tid'] = $rs['tid2'];
	    	$rs['tidname'] = $rs['tid2name'];
	    }
  	  $rs['url'] = $cfg_ask_url."/question.php?id={$rs['id']}";
      $rs['typeurl'] = $cfg_ask_url."/browser.php?tid={$rs['tid']}";
  	  foreach($ctp->CTags as $tagid=>$ctag){
		    if(!empty($rs[strtolower($ctag->GetName())])){ $ctp->Assign($tagid,$rs[$ctag->GetName()]); }
		  }
		  $solvingask .= $ctp->GetResult();
    }
    return $solvingask;
 }

	//获得一组投票
	//-------------------------
	function GetVote($id=0,$lineheight=24,$tablewidth="100%",$titlebgcolor="#EDEDE2",$titlebackgroup="",$tablebg="#FFFFFF"){
		if($id=="") $id=0;
		if($id==0){
			$row = $this->dsql->GetOne("select aid From #@__vote order by aid desc limit 0,1");
			if(!isset($row['aid'])) return "";
			else $id=$row['aid'];
		}
		require_once(dirname(__FILE__)."/inc_vote.php");
		$vt = new DedeVote($id);
		//$vt->Close();
		return $vt->GetVoteForm($lineheight,$tablewidth,$titlebgcolor,$titlebackgroup,$tablebg);
	}
	//获取友情链接列表
	//------------------------
	function GetFriendLink($type="",$row="",$col="",$titlelen="",$tablestyle="",$linktype=1,$innertext=''){
		$type = AttDef($type,"textall");
		$row = AttDef($row,4);
		$col = AttDef($col,6);
		if($linktype=="") $linktype = 1;
		$titlelen = AttDef($titlelen,24);
		$tablestyle = AttDef($tablestyle," width='100%' border='0' cellspacing='1' cellpadding='1' ");
		$tdwidth = round(100/$col)."%";
		$totalrow = $row*$col;

		if($innertext=='') $innertext = " [field:link/] ";

		$wsql = " where ischeck >= '$linktype' ";
		if($type=="image") $wsql .= " And logo<>'' ";
		else if($type=="text") $wsql .= " And logo='' ";
		else $wsql .= "";

		$equery = "Select * from #@__flink $wsql order by sortrank asc limit 0,$totalrow";

		$this->dsql->SetQuery($equery);
		$this->dsql->Execute();

		$revalue = "";
		while($row = $this->dsql->GetArray())
		{
			if($type=="text"||$type=="textall")
					$row['link'] = "<a href='".$row['url']."' target='_blank'>".cn_substr($row['webname'],$titlelen)."</a>";
			else if($type=="image")
					$row['link'] = "<a href='".$row['url']."' target='_blank'><img alt='".str_replace("'","`",$row['webname'])."' src='".$row['logo']."' border='0'></a>";
			else{
				if($row['logo']=="")
					$row['link'] = "&nbsp;<a href='".$row['url']."' target='_blank'>".cn_substr($row['webname'],$titlelen)."</a>";
				else
					$row['link'] = "&nbsp;<a href='".$row['url']."' target='_blank'><img alt='".str_replace("'","`",$row['webname'])."' src='".$row['logo']."' border='0'></a>";
			}
			$rbtext = preg_replace("/\[field:url([\s]{0,})\/\]/isU",$row['url'],$innertext);
 			$rbtext = preg_replace("/\[field:webname([\s]{0,})\/\]/isU",$row['ID'],$rbtext);
 			$rbtext = preg_replace("/\[field:logo([\s]{0,})\/\]/isU",$row['logo'],$rbtext);
 			$rbtext = preg_replace("/\[field:link([\s]{0,})\/\]/isU",$row['link'],$rbtext);
 			$revalue .= $rbtext;
		}
		return $revalue;
	}
	//按排列顺序获得一个下级分类信息
	function GetAutoChannel($sortid,$innertext,$topid="-1"){
		if($topid=="-1" || $topid=="") $topid = $this->TypeID;
		$typeid = $this->GetAutoChannelID($sortid,$topid);
		if($typeid==0) return "";
		if(trim($innertext)=="") $innertext = GetSysTemplets("part_autochannel.htm");
		return $this->GetOneType($typeid,$innertext);
  }
  function GetAutoChannelID($sortid,$topid){
		if(empty($sortid)) $sortid = 1;
		$getstart = $sortid - 1;
		$row = $this->dsql->GetOne("Select ID,typename From #@__arctype where reid='{$topid}' And ispart<2 And ishidden<>'1' order by sortrank asc limit $getstart,1");
		if(!is_array($row)) return 0;
		else return $row['ID'];
  }
 	//---------------------------
 	//关闭所占用的资源
 	//---------------------------
 	function Close(){
 		$this->dsql->Close();
 		if(is_object($this->TypeLink)) $this->TypeLink->Close();
 	}
}//End Class

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -