url.inc.php

来自「Phpcms2008 是一款基于 PHP+Mysql 架构的网站内容管理系统」· PHP 代码 · 共 87 行

PHP
87
字号
<?php 
defined('IN_PHPCMS') or exit('Access Denied');

$html = load('url.class.php');
if($dosubmit)
{
	if($type == 'lastinput')
	{
		$offset = 0;
	}
	else
	{
		$page = max(intval($page), 1);
		$offset = $pagesize*($page-1);
	}
	$where = ' WHERE status=99 ';
	$order = 'ASC';
	
	if(!isset($firest) && is_array($catids) && $catids[0] > 0) 
	{
		cache_write('url_show_'.$_userid.'.php', $catids);
		$catids = implodeids($catids);
		$where .= " AND catid IN($catids) ";
		$firest = 1;
	}
	elseif($firest)
	{
		$catids = cache_read('url_show_'.$_userid.'.php');
		$catids = implodeids($catids);
		$where .= " AND catid IN($catids) ";
	}
	else
	{
		$firest = 0;
	}

	if($type == 'lastinput' && $number)
	{
		$offset = 0;
		$pagesize = $number;
		$order = 'DESC';
	}
	elseif($type == 'date')
	{
		if($fromdate)
		{
			$fromtime = strtotime($fromdate.' 00:00:00');
			$where .= " AND `inputtime`>=$fromtime ";
		}
		if($todate)
		{
			$totime = strtotime($todate.' 23:59:59');
			$where .= " AND `inputtime`<=$totime ";
		}
	}
	elseif($type == 'id')
	{
		$fromid = intval($fromid);
		$toid = intval($toid);
		if($fromid) $where .= " AND `contentid`>=$fromid ";
		if($toid) $where .= " AND `contentid`<=$toid ";
	}
	if(!isset($total) && $type != 'lastinput')
	{
		$total = cache_count("SELECT COUNT(*) AS `count` FROM `".DB_PRE."content` $where");
		$pages = ceil($total/$pagesize);
		$start = 1;
	}
	$data = $db->select("SELECT `contentid`, `islink`, `url` FROM `".DB_PRE."content` $where ORDER BY `contentid` $order LIMIT $offset,$pagesize");
	foreach($data as $r)
	{
		if($r['islink']) continue;
		$url = $html->show($r['contentid']);
		$html->update($r['contentid'],$url);
		if(!is_a($c, 'content'))
		{
			require 'admin/content.class.php';
			$c = new content();	
		}
		$c->search_api($r['contentid']);
	}
	if($pages > $page)
	{
		$page++;
		$creatednum = $offset + count($data);
		$percent = round($creatednum/$total, 2)*100;
		$message = "鍏遍渶鏇存柊 <font color='red'>$total</font> 鏉′俊鎭

⌨️ 快捷键说明

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