【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:all.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php
require_once('global.php');
require_once('include/visits.php');
$timeformat = isset($base['normaltime']) ? $base['normaltime'] : 'Y-m-d';
$expiration = 0;
if (!$action) $action = 'index';
if (in_array($action, array('index', 'tags'))) {
$pagenum = intval($base['normal_shownum']);
$query_sql = "SELECT a.articleid,a.cid,a.uid,a.stick,a.dateline,a.title,a.content,a.keywords,a.views,a.comments,a.attachments,c.name as cname
FROM {$db_prefix}articles a
LEFT JOIN {$db_prefix}categories c ON c.cid=a.cid
WHERE a.visible='1'";
$page = intval($_GET['page']);
if($page) {
$start_limit = ($page - 1) * $pagenum;
} else {
$start_limit = 0;
$page = 1;
}
if ($action == 'tags') {
$itemid = intval($_GET['id']);
if ($itemid) {
$l="SELECT usenum,aids FROM {$db_prefix}tags WHERE tagid='$itemid'";
$tag = $DB->fetch_one_array($l);
if (!$tag) {
die('璁板綍涓嶅瓨鍦?');
}
$tatol= $tag[usenum];
$query_sql .= " AND a.articleid IN (".$tag['aids'].") ORDER BY a.$article_order DESC LIMIT $start_limit, ".$pagenum;
}
} else {
$tatol = $DB->num_rows($DB->query("SELECT articleid FROM {$db_prefix}articles WHERE visible='1'"));
// 妫鏌ユ槸鍚﹁缃?cid鍙傛暟
$cateadd = '';
$cid = intval($_GET['id']);
if ($cid) {
$cateadd = " AND a.cid='$cid' ";
$query_
sql .= " AND a.cid='$cid' ";
$r = $DB->fetch_one_array("SELECT name,articles FROM {$db_prefix}categories WHERE cid='$cid'");
$tatol = $r['articles'];
}
// 妫鏌ユ槸鍚﹁缃?setdate鍙傛暟
if ($sety && $setm&& $setd) {
$start = strtotime($sety.'-'.$setm.'-'.$setd);
$end = $start + 86400;
$startadd = $start ? " AND a.dateline >= '".correcttime($start)."' " : '';
$endadd = $end ? " AND a.dateline < '".correcttime($end)."' " : '';
$query = $DB->query("SELECT COUNT(*) FROM {$db_prefix}articles a WHERE a.visible='1' ".$cateadd.$startadd.$endadd);
$tatol = $DB->result($query, 0);
}
$query_sql .= $startadd.$endadd." ORDER BY a.stick DESC, a.$article_order DESC LIMIT $start_limit, ".$pagenum;
}
if ($tatol) {
require_once(ROOT.'include/func_attachment.php');
$query = $DB->query($query_sql);
$Paginationpage = Pagination($tatol, $pagenum, $page, $pageurl);
$articledb=array();
while ($article = $DB->fetch_array($query)) {
$article['dateline'] = formatdate($timeformat, $article['dateline']);
//$article['title'] = trimmed_title($article['title']);
//闄勪欢
if ($article['attachments']) {
$attachs= unserialize(stripslashes_array($article['attachments']));
if (is_array($attachs)) {
foreach ($attachs AS $attach) {
$a_path = $base['attachments_dir'].'/'.$attach['filepath'];
if (file_exists($a_path)) {
$a_ext = strtolower(getextension($attach['filename']));
if ($a_ext == 'gif' || $a_ext == 'jpg' || $a_ext == 'jpeg' || $a_ext == 'png') {
$imagesize = @getimagesize($a_path);
//print_r($imagesize);
$a_size = sizecount($attach['filesize']);
$a_thumb_path = $base['attachments_dir'].$attach['thumb_filepath'];
if ($attach['thumb_filepath'] && $base['attachments_thumbs'] && file_exists($a_thumb_path)) {
$article['image'][$attach['attachmentid']]=array($attach['attachmentid'],$a_thumb_path,$a_size,$attach['thumb_width'],$attach['thumb_height'],$attach['downloads'],1);
} else {
// 濡傛灉缂╃暐鍥句笉瀛樺湪
$size = explode('x', strtolower($base['attachments_thumbs_size']));
$im = scale_image( array(
"max_width" => $size[0],
"max_height" => $size[1],
"cur_width" => $imagesize[0],
"cur_height" => $imagesize[1]
)); $article['image'][$attach['attachmentid']]=array($attach['attachmentid'],$a_path,$a_size,$im['img_width'],$im['img_height'],$attach['downloads'],0);
}
} else {
// 濡傛灉闈炲浘鐗囨枃浠?
$a_size = sizecount($attach['filesize']); $article['file'][$attach['attachmentid']]=array($attach['attachmentid'],$attach['filename'],$a_size,$attach['downloads']);
}
}
}
$article['content'] = preg_replace("/\[attach=(\d+)\]/ie", "upfile('\\1')", $article['content']);
foreach($attachmentids as $key => $value){
if($article['image'][$value]){
unset($article['image'][$value]);
}
if($article['file'][$value]){
unset($article['file'][$value]);
}
}
$attachmentids=array();