First commit
This commit is contained in:
0
source/module/portal/index.htm
Normal file
0
source/module/portal/index.htm
Normal file
130
source/module/portal/portal_attachment.php
Normal file
130
source/module/portal/portal_attachment.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_attachment.php 25246 2011-11-02 03:34:53Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$operation = $_GET['op'] ? $_GET['op'] : '';
|
||||
|
||||
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
|
||||
$aid = empty($_GET['aid']) ? '' : intval($_GET['aid']);
|
||||
$attach = C::t('portal_attachment')->fetch($id);
|
||||
if(empty($attach)) {
|
||||
showmessage('portal_attachment_noexist');
|
||||
}
|
||||
|
||||
if($operation == 'delete') {
|
||||
if(!$_G['group']['allowmanagearticle'] && ($_G['uid'] != $attach['uid'] || $aid != $attach['aid'])) {
|
||||
showmessage('portal_attachment_nopermission_delete');
|
||||
}
|
||||
if(!isset($_GET['formhash']) || formhash() != $_GET['formhash']) {
|
||||
showmessage('portal_attachment_nopermission_delete');
|
||||
}
|
||||
if($aid) {
|
||||
C::t('portal_article_title')->update($aid, array('pic' => ''));
|
||||
}
|
||||
C::t('portal_attachment')->delete($id);
|
||||
pic_delete($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
|
||||
showmessage('portal_image_noexist');
|
||||
|
||||
} elseif($operation == 'getattach') {
|
||||
|
||||
require_once libfile('function/attachment');
|
||||
if($attach['isimage']) {
|
||||
require_once libfile('function/home');
|
||||
$smallimg = pic_get($attach['attachment'], 'portal', $attach['thumb'], $attach['remote']);
|
||||
$bigimg = pic_get($attach['attachment'], 'portal', 0, $attach['remote']);
|
||||
$coverstr = addslashes(serialize(array('pic'=>'portal/'.$attach['attachment'], 'thumb'=>$attach['thumb'], 'remote'=>$attach['remote'])));
|
||||
}
|
||||
$attach['filetype'] = attachtype($attach['filetype']."\t".$attach['filetype']);
|
||||
$attach['filesize'] = sizecount($attach['filesize']);
|
||||
include template('portal/portal_attachment');
|
||||
|
||||
exit;
|
||||
|
||||
} else {
|
||||
$filename = $_G['setting']['attachdir'].'/portal/'.$attach['attachment'];
|
||||
if(!$attach['remote'] && !is_readable($filename)) {
|
||||
showmessage('attachment_nonexistence');
|
||||
}
|
||||
|
||||
$readmod = 2;//read local file's function: 1=fread 2=readfile 3=fpassthru 4=fpassthru+multiple
|
||||
$range = 0;
|
||||
if($readmod == 4 && !empty($_SERVER['HTTP_RANGE'])) {
|
||||
list($range) = explode('-',(str_replace('bytes=', '', $_SERVER['HTTP_RANGE'])));
|
||||
}
|
||||
|
||||
if($attach['remote'] && !$_G['setting']['ftp']['hideurl'] && $attach['isimage']) {
|
||||
dheader('location:'.$_G['setting']['ftp']['attachurl'].'portal/'.$attach['attachment']);
|
||||
}
|
||||
|
||||
$filesize = $attach['filesize'];
|
||||
$filenameencode = strtolower(CHARSET) == 'utf-8' ? rawurlencode($attach['filename']) : rawurlencode(diconv($attach['filename'], CHARSET, 'UTF-8'));
|
||||
|
||||
$rfc6266blacklist = strexists($_SERVER['HTTP_USER_AGENT'], 'UCBrowser') || strexists($_SERVER['HTTP_USER_AGENT'], 'Quark') || strexists($_SERVER['HTTP_USER_AGENT'], 'SogouM') || strexists($_SERVER['HTTP_USER_AGENT'], 'baidu');
|
||||
|
||||
dheader('Date: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
|
||||
dheader('Last-Modified: '.gmdate('D, d M Y H:i:s', $attach['dateline']).' GMT');
|
||||
dheader('Content-Encoding: none');
|
||||
dheader('Content-Disposition: attachment; filename="'.$filenameencode.'"'.(($attach['filename'] == $filenameencode || $rfc6266blacklist) ? '' : '; filename*=utf-8\'\''.$filenameencode));
|
||||
dheader('Content-Type: '.$attach['filetype']);
|
||||
dheader('Content-Length: '.$filesize);
|
||||
|
||||
if($readmod == 4) {
|
||||
dheader('Accept-Ranges: bytes');
|
||||
if(!empty($_SERVER['HTTP_RANGE'])) {
|
||||
$rangesize = ($filesize - $range) > 0 ? ($filesize - $range) : 0;
|
||||
dheader('Content-Length: '.$rangesize);
|
||||
dheader('HTTP/1.1 206 Partial Content');
|
||||
dheader('Content-Range: bytes='.$range.'-'.($filesize-1).'/'.($filesize));
|
||||
}
|
||||
}
|
||||
|
||||
$attach['remote'] ? getremotefile($attach['attachment']) : getlocalfile($filename, $readmod, $range);
|
||||
}
|
||||
function getremotefile($file) {
|
||||
global $_G;
|
||||
@set_time_limit(0);
|
||||
if(!@readfile($_G['setting']['ftp']['attachurl'].'portal/'.$file)) {
|
||||
|
||||
$ftp = new discuz_ftp();
|
||||
if(!($_G['setting']['ftp']['connid'] = $ftp->connect())) {
|
||||
return FALSE;
|
||||
}
|
||||
$tmpfile = @tempnam($_G['setting']['attachdir'], '');
|
||||
if($ftp->ftp_get($_G['setting']['ftp']['connid'], $tmpfile, $file, FTP_BINARY)) {
|
||||
@readfile($tmpfile);
|
||||
@unlink($tmpfile);
|
||||
} else {
|
||||
@unlink($tmpfile);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function getlocalfile($filename, $readmod = 2, $range = 0) {
|
||||
if($readmod == 1 || $readmod == 3 || $readmod == 4) {
|
||||
if($fp = @fopen($filename, 'rb')) {
|
||||
@fseek($fp, $range);
|
||||
if(function_exists('fpassthru') && ($readmod == 3 || $readmod == 4)) {
|
||||
@fpassthru($fp);
|
||||
} else if(filesize($filename)) {
|
||||
echo fread($fp, filesize($filename));
|
||||
}
|
||||
}
|
||||
@fclose($fp);
|
||||
} else {
|
||||
@readfile($filename);
|
||||
}
|
||||
@flush();
|
||||
@ob_flush();
|
||||
}
|
||||
|
||||
?>
|
44
source/module/portal/portal_block.php
Normal file
44
source/module/portal/portal_block.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_block.php 24984 2011-10-20 07:59:00Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$bid = max(0,intval($_GET['bid']));
|
||||
if(empty($bid)) {
|
||||
showmessage('block_choose_bid', dreferer());
|
||||
}
|
||||
block_get($bid);
|
||||
if(!isset($_G['block'][$bid])) {
|
||||
showmessage('block_noexist', dreferer());
|
||||
}
|
||||
$block = &$_G['block'][$bid];
|
||||
$blockmoreurl = $block['param']['moreurl'] = isset($block['param']['moreurl']) ? $block['param']['moreurl'] :
|
||||
array('perpage' => 20, 'seotitle' => $block['name'], 'keywords' => '', 'description' => '');
|
||||
$blocktype = $block['blockclass'];
|
||||
if(!in_array($blocktype, array('forum_thread', 'portal_article', 'group_thread'), true)) {
|
||||
showmessage('block_nomore', dreferer());
|
||||
}
|
||||
|
||||
$perpage = max(1, intval($blockmoreurl['perpage']));
|
||||
$curpage = max(1, intval($_GET['page']));
|
||||
$start = ($curpage-1) * $perpage;
|
||||
$count = C::t('common_block_item_data')->count_by_bid($bid);
|
||||
$list = $count ? C::t('common_block_item_data')->fetch_all_by_bid($bid, 1, $start, $perpage) : array();
|
||||
$multipage = $count ? multi($count, $perpage, $curpage, 'portal.php?mod=block&bid='.$bid) : '';
|
||||
|
||||
$navtitle = $blockmoreurl['seotitle'];
|
||||
$metakeywords = $blockmoreurl['seokeywords'];
|
||||
$metadescription = $blockmoreurl['seodescription'];
|
||||
|
||||
$file = 'portal/block_more_'.$blocktype;
|
||||
include template('diy:'.$file);
|
||||
|
||||
?>
|
60
source/module/portal/portal_comment.php
Normal file
60
source/module/portal/portal_comment.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_comment.php 33660 2013-07-29 07:51:05Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
|
||||
$idtype = in_array($_GET['idtype'], array('aid', 'topicid')) ? $_GET['idtype'] : 'aid';
|
||||
$url = '';
|
||||
if(empty($id)) {
|
||||
showmessage('comment_no_'.$idtype.'_id');
|
||||
}
|
||||
if($idtype == 'aid') {
|
||||
$csubject = C::t('portal_article_title')->fetch($id);
|
||||
if($csubject) {
|
||||
$csubject = array_merge($csubject, C::t('portal_article_count')->fetch($id));
|
||||
}
|
||||
$url = fetch_article_url($csubject);
|
||||
} elseif($idtype == 'topicid') {
|
||||
$csubject = C::t('portal_topic')->fetch($id);
|
||||
$url = fetch_topic_url($csubject);
|
||||
}
|
||||
if(empty($csubject)) {
|
||||
showmessage('comment_'.$idtype.'_no_exist');
|
||||
} elseif(empty($csubject['allowcomment'])) {
|
||||
showmessage($idtype.'_comment_is_forbidden');
|
||||
}
|
||||
|
||||
$perpage = 25;
|
||||
$page = intval($_GET['page']);
|
||||
if($page<1) $page = 1;
|
||||
$start = ($page-1)*$perpage;
|
||||
|
||||
$commentlist = array();
|
||||
$multi = '';
|
||||
|
||||
if($csubject['commentnum']) {
|
||||
$pricount = 0;
|
||||
$query = C::t('portal_comment')->fetch_all_by_id_idtype($id, $idtype, 'dateline', 'DESC', $start, $perpage);
|
||||
foreach($query as $value) {
|
||||
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
|
||||
$commentlist[] = $value;
|
||||
} else {
|
||||
$pricount ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$multi = multi($csubject['commentnum'], $perpage, $page, "portal.php?mod=comment&id=$id&idtype=$idtype");
|
||||
list($seccodecheck, $secqaacheck) = seccheck('publish');
|
||||
include_once template("diy:portal/comment");
|
||||
|
||||
?>
|
33
source/module/portal/portal_index.php
Normal file
33
source/module/portal/portal_index.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_index.php 31313 2012-08-10 03:51:03Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
list($navtitle, $metadescription, $metakeywords) = get_seosetting('portal');
|
||||
if(!$navtitle) {
|
||||
$navtitle = $_G['setting']['navs'][1]['navname'];
|
||||
$nobbname = false;
|
||||
} else {
|
||||
$nobbname = true;
|
||||
}
|
||||
if(!$metakeywords) {
|
||||
$metakeywords = $_G['setting']['navs'][1]['navname'];
|
||||
}
|
||||
if(!$metadescription) {
|
||||
$metadescription = $_G['setting']['navs'][1]['navname'];
|
||||
}
|
||||
|
||||
if(isset($_G['makehtml'])){
|
||||
helper_makehtml::portal_index();
|
||||
}
|
||||
|
||||
include_once template('diy:portal/index');
|
||||
?>
|
205
source/module/portal/portal_list.php
Normal file
205
source/module/portal/portal_list.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_list.php 33245 2013-05-09 02:02:59Z laoguozhang $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$_G['catid'] = $catid = max(0,intval($_GET['catid']));
|
||||
if(empty($catid)) {
|
||||
showmessage('list_choose_category', dreferer());
|
||||
}
|
||||
$portalcategory = &$_G['cache']['portalcategory'];
|
||||
$cat = $portalcategory[$catid];
|
||||
|
||||
if(empty($cat)) {
|
||||
showmessage('list_category_noexist', dreferer());
|
||||
}
|
||||
require_once libfile('function/portalcp');
|
||||
$categoryperm = getallowcategory($_G['uid']);
|
||||
if($cat['closed'] && !$_G['group']['allowdiy'] && !$categoryperm[$catid]['allowmanage']) {
|
||||
showmessage('list_category_is_closed', dreferer());
|
||||
}
|
||||
|
||||
if(!isset($_G['makehtml'])) {
|
||||
if(!empty($cat['url'])) dheader('location:'.$cat['url']);
|
||||
if(defined('SUB_DIR') && $_G['siteurl']. substr(SUB_DIR, 1) != $cat['caturl'] || !defined('SUB_DIR') && $_G['siteurl'] != substr($cat['caturl'], 0, strrpos($cat['caturl'], '/')+1)) {
|
||||
dheader('location:'.$cat['caturl'], true, '301');
|
||||
}
|
||||
}
|
||||
|
||||
$cat = category_remake($catid);
|
||||
$navid = 'mn_P'.$cat['topid'];
|
||||
foreach ($_G['setting']['navs'] as $navsvalue) {
|
||||
if($navsvalue['navid'] == $navid && $navsvalue['available'] && $navsvalue['level'] == 0) {
|
||||
$_G['mnid'] = $navid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$page = max(1, intval($_GET['page']));
|
||||
foreach($cat['ups'] as $val) {
|
||||
$cats[] = $val['catname'];
|
||||
}
|
||||
|
||||
$bodycss = array($cat['topid'] => 'pg_list_'.$cat['topid']);
|
||||
if($cat['upid']) {
|
||||
$bodycss[$cat['upid']] = 'pg_list_'.$cat['upid'];
|
||||
}
|
||||
$bodycss[$cat['catid']] = 'pg_list_'.$cat['catid'];
|
||||
$cat['bodycss'] = implode(' ', $bodycss);
|
||||
|
||||
$catseoset = array(
|
||||
'seotitle' => $cat['seotitle'],
|
||||
'seokeywords' => $cat['keyword'],
|
||||
'seodescription' => $cat['description']
|
||||
);
|
||||
$seodata = array('firstcat' => $cats[0], 'secondcat' => $cats[1], 'curcat' => $cat['catname'], 'page' => intval($_GET['page']));
|
||||
list($navtitle, $metadescription, $metakeywords) = get_seosetting('articlelist', $seodata, $catseoset);
|
||||
if(!$navtitle) {
|
||||
$navtitle = helper_seo::get_title_page($cat['catname'], $_G['page']);
|
||||
$nobbname = false;
|
||||
} else {
|
||||
$nobbname = true;
|
||||
}
|
||||
if(!$metakeywords) {
|
||||
$metakeywords = $cat['catname'];
|
||||
}
|
||||
if(!$metadescription) {
|
||||
$metadescription = $cat['catname'];
|
||||
}
|
||||
|
||||
if(isset($_G['makehtml'])){
|
||||
helper_makehtml::portal_list($cat);
|
||||
}
|
||||
|
||||
$file = 'portal/list:'.$catid;
|
||||
$tpldirectory = '';
|
||||
$primaltplname = $cat['primaltplname'];
|
||||
if(strpos($primaltplname, ':') !== false) {
|
||||
list($tpldirectory, $primaltplname) = explode(':', $primaltplname);
|
||||
}
|
||||
include template('diy:'.$file, NULL, $tpldirectory, NULL, $primaltplname);
|
||||
|
||||
|
||||
function category_get_wheresql($cat) {
|
||||
$wheresql = '';
|
||||
if(is_array($cat)) {
|
||||
$catid = $cat['catid'];
|
||||
if(!empty($cat['subs'])) {
|
||||
include_once libfile('function/portalcp');
|
||||
$subcatids = category_get_childids('portal', $catid);
|
||||
$subcatids[] = $catid;
|
||||
|
||||
$wheresql = "at.catid IN (".dimplode($subcatids).")";
|
||||
} else {
|
||||
$wheresql = "at.catid='$catid'";
|
||||
}
|
||||
}
|
||||
$wheresql .= " AND at.status='0'";
|
||||
return $wheresql;
|
||||
}
|
||||
|
||||
function category_get_list($cat, $wheresql, $page = 1, $perpage = 0) {
|
||||
global $_G;
|
||||
$cat['perpage'] = empty($cat['perpage']) ? 15 : $cat['perpage'];
|
||||
$cat['maxpages'] = empty($cat['maxpages']) ? 1000 : $cat['maxpages'];
|
||||
$perpage = intval($perpage);
|
||||
$page = intval($page);
|
||||
$perpage = empty($perpage) ? $cat['perpage'] : $perpage;
|
||||
$page = empty($page) ? 1 : min($page, $cat['maxpages']);
|
||||
$start = ($page-1)*$perpage;
|
||||
if($start<0) $start = 0;
|
||||
$list = array();
|
||||
$pricount = 0;
|
||||
$multi = '';
|
||||
$count = C::t('portal_article_title')->fetch_all_by_sql($wheresql, '', 0, 0, 1, 'at');
|
||||
if($count) {
|
||||
$query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, 'ORDER BY at.dateline DESC', $start, $perpage, 0, 'at');
|
||||
foreach($query as $value) {
|
||||
$value['catname'] = $value['catid'] == $cat['catid'] ? $cat['catname'] : $_G['cache']['portalcategory'][$value['catid']]['catname'];
|
||||
$value['onerror'] = '';
|
||||
if($value['pic']) {
|
||||
$value['pic'] = pic_get($value['pic'], '', $value['thumb'], $value['remote'], 1, 1);
|
||||
}
|
||||
$value['dateline'] = dgmdate($value['dateline']);
|
||||
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
|
||||
$list[] = $value;
|
||||
} else {
|
||||
$pricount++;
|
||||
}
|
||||
}
|
||||
if(strpos($cat['caturl'], 'portal.php') === false) {
|
||||
$cat['caturl'] .= 'index.php';
|
||||
}
|
||||
$multi = multi($count, $perpage, $page, $cat['caturl'], $cat['maxpages']);
|
||||
}
|
||||
return $return = array('list'=>$list,'count'=>$count,'multi'=>$multi,'pricount'=>$pricount);
|
||||
}
|
||||
|
||||
function category_get_list_more($cat, $wheresql, $hassub = true,$hasnew = true,$hashot = true) {
|
||||
global $_G;
|
||||
$data = array();
|
||||
$catid = $cat['catid'];
|
||||
|
||||
$cachearr = array();
|
||||
if($hashot) $cachearr[] = 'portalhotarticle';
|
||||
if($hasnew) $cachearr[] = 'portalnewarticle';
|
||||
|
||||
if($hassub) {
|
||||
foreach($cat['children'] as $childid) {
|
||||
$cachearr[] = 'subcate'.$childid;
|
||||
}
|
||||
}
|
||||
|
||||
$allowmemory = memory('check');
|
||||
foreach ($cachearr as $key) {
|
||||
$cachekey = $key.$catid;
|
||||
$data[$key] = $allowmemory ? memory('get', $cachekey) : false;
|
||||
if($data[$key] === false) {
|
||||
$list = array();
|
||||
$sql = '';
|
||||
if($key == 'portalhotarticle') {
|
||||
$dateline = TIMESTAMP - 3600 * 24 * 90;
|
||||
$query = C::t('portal_article_count')->fetch_all_hotarticle($wheresql, $dateline);
|
||||
} elseif($key == 'portalnewarticle') {
|
||||
$query = C::t('portal_article_title')->fetch_all_by_sql($wheresql, 'ORDER BY at.dateline DESC', 0, 10, 0, 'at');
|
||||
} elseif(substr($key, 0, 7) == 'subcate') {
|
||||
$cacheid = intval(str_replace('subcate', '', $key));
|
||||
if(!empty($_G['cache']['portalcategory'][$cacheid])) {
|
||||
$where = '';
|
||||
if(!empty($_G['cache']['portalcategory'][$cacheid]['children']) && dimplode($_G['cache']['portalcategory'][$cacheid]['children'])) {
|
||||
$_G['cache']['portalcategory'][$cacheid]['children'][] = $cacheid;
|
||||
$where = 'at.catid IN ('.dimplode($_G['cache']['portalcategory'][$cacheid]['children']).')';
|
||||
} else {
|
||||
$where = 'at.catid='.$cacheid;
|
||||
}
|
||||
$where .= " AND at.status='0'";
|
||||
$query = C::t('portal_article_title')->fetch_all_by_sql($where, 'ORDER BY at.dateline DESC', 0, 10, 0, 'at');
|
||||
}
|
||||
}
|
||||
|
||||
if($query) {
|
||||
|
||||
foreach($query as $value) {
|
||||
$value['catname'] = $value['catid'] == $cat['catid'] ? $cat['catname'] : $_G['cache']['portalcategory'][$value['catid']]['catname'];
|
||||
if($value['pic']) $value['pic'] = pic_get($value['pic'], '', $value['thumb'], $value['remote'], 1, 1);
|
||||
$value['timestamp'] = $value['dateline'];
|
||||
$value['dateline'] = dgmdate($value['dateline']);
|
||||
$list[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$data[$key] = $list;
|
||||
if($allowmemory) {
|
||||
memory('set', $cachekey, $list, empty($list) ? 60 : 600);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
50
source/module/portal/portal_portalcp.php
Normal file
50
source/module/portal/portal_portalcp.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_portalcp.php 28492 2012-03-01 10:05:07Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$ac = in_array(getgpc('ac'), array('comment', 'article', 'related', 'block', 'portalblock', 'blockdata', 'topic', 'diy', 'upload', 'category', 'plugin', 'logout')) ? $_GET['ac'] : 'index';
|
||||
|
||||
if (!$_G['setting']['portalstatus'] && !in_array($ac, array('index', 'block', 'portalblock', 'blockdata', 'diy', 'logout'))) {
|
||||
showmessage('portal_status_off');
|
||||
}
|
||||
|
||||
$_G['disabledwidthauto'] = 0;
|
||||
|
||||
$admincp2 = getstatus($_G['member']['allowadmincp'], 2);
|
||||
$admincp3 = getstatus($_G['member']['allowadmincp'], 3);
|
||||
$admincp4 = getstatus($_G['member']['allowadmincp'], 4);
|
||||
$admincp5 = getstatus($_G['member']['allowadmincp'], 5);
|
||||
$admincp6 = getstatus($_G['member']['allowadmincp'], 6);
|
||||
|
||||
if (!$_G['inajax'] && in_array($ac, array('index', 'portalblock', 'blockdata', 'category', 'plugin')) && ($_G['group']['allowdiy'] || $_G['group']['allowmanagearticle'] || $admincp2 || $admincp3 || $admincp4 || $admincp6)) {
|
||||
$modsession = new discuz_panel(PORTALCP_PANEL);
|
||||
if(getgpc('login_panel') && getgpc('cppwd') && submitcheck('submit')) {
|
||||
$modsession->dologin($_G['uid'], getgpc('cppwd'), true);
|
||||
}
|
||||
|
||||
if(!$modsession->islogin) {
|
||||
include template('portal/portalcp_login');
|
||||
dexit();
|
||||
}
|
||||
}
|
||||
|
||||
if($ac == 'logout') {
|
||||
$modsession = new discuz_panel(PORTALCP_PANEL);
|
||||
$modsession->dologout();
|
||||
showmessage('modcp_logout_succeed', 'index.php');
|
||||
}
|
||||
|
||||
$navtitle = lang('core', 'title_'.$ac.'_management').' - '.lang('core', 'title_portal_management');
|
||||
|
||||
require_once libfile('function/portalcp');
|
||||
require_once libfile('portalcp/'.$ac, 'include');
|
||||
?>
|
143
source/module/portal/portal_rss.php
Normal file
143
source/module/portal/portal_rss.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_rss.php 24992 2011-10-20 09:41:00Z liulanbo $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(!$_G['setting']['rssstatus']) {
|
||||
exit('RSS Disabled');
|
||||
}
|
||||
|
||||
$ttl = $_G['setting']['rssttl'] ? $_G['setting']['rssttl']: 30;
|
||||
$num = 20;
|
||||
|
||||
$_G['groupid'] = 7;
|
||||
$_G['uid'] = 0;
|
||||
$_G['username'] = $_G['member']['password'] = '';
|
||||
|
||||
$rsscatid = empty($_GET['catid']) ? 0 : intval($_GET['catid']);
|
||||
$catname = '';
|
||||
|
||||
if(empty($rsscatid)) {
|
||||
foreach($_G['cache']['portalcategory'] as $catid => $category) {
|
||||
$catarray[] = $catid;
|
||||
}
|
||||
} else {
|
||||
|
||||
if(isset($_G['cache']['portalcategory'][$rsscatid])) {
|
||||
$catarray = array($rsscatid);
|
||||
$catname = dhtmlspecialchars($_G['cache']['portalcategory'][$rsscatid]['catname']);
|
||||
} else {
|
||||
exit('Specified article not found');
|
||||
}
|
||||
}
|
||||
|
||||
$rewriteflag = 0;
|
||||
$havedomain = implode('', $_G['setting']['domain']['app']);
|
||||
if(is_array($_G['setting']['rewritestatus']) && in_array('portal_article', $_G['setting']['rewritestatus'])) {
|
||||
$rewriteflag = 1;
|
||||
}
|
||||
|
||||
$charset = $_G['config']['output']['charset'];
|
||||
dheader("Content-type: application/xml");
|
||||
echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n".
|
||||
"<rss version=\"2.0\">\n".
|
||||
" <channel>\n".
|
||||
(count($catarray) > 1 ?
|
||||
" <title>{$_G['setting']['bbname']}</title>\n".
|
||||
" <link>{$_G['siteurl']}forum.php</link>\n".
|
||||
" <description>Latest $num articles of all categories</description>\n"
|
||||
:
|
||||
" <title>{$_G['setting']['bbname']} - $catname</title>\n".
|
||||
" <link>{$_G['siteurl']}portal.php?mod=list&catid=$rsscatid</link>\n".
|
||||
" <description>Latest $num articles of $catname</description>\n"
|
||||
).
|
||||
" <copyright>Copyright(C) {$_G['setting']['bbname']}</copyright>\n".
|
||||
" <generator>Discuz! Board by Comsenz Inc.</generator>\n".
|
||||
" <lastBuildDate>".gmdate('r', TIMESTAMP)."</lastBuildDate>\n".
|
||||
" <ttl>$ttl</ttl>\n".
|
||||
" <image>\n".
|
||||
" <url>{$_G['siteurl']}static/image/common/logo_88_31.gif</url>\n".
|
||||
" <title>{$_G['setting']['bbname']}</title>\n".
|
||||
" <link>{$_G['siteurl']}</link>\n".
|
||||
" </image>\n";
|
||||
|
||||
if($catarray) {
|
||||
$alldata = C::t('portal_rsscache')->fetch_all_by_catid($catarray, $num);
|
||||
if($alldata) {
|
||||
foreach($alldata as $article) {
|
||||
if(TIMESTAMP - $article['lastupdate'] > $ttl * 60) {
|
||||
updatersscache($num);
|
||||
break;
|
||||
} else {
|
||||
list($article['description'], $attachremote, $attachfile, $attachsize) = explode("\t", $article['description']);
|
||||
if($attachfile) {
|
||||
if($attachremote) {
|
||||
$filename = $_G['setting']['ftp']['attachurl'].'portal/'.$attachfile;
|
||||
} else {
|
||||
$filename = $_G['siteurl'].$_G['setting']['attachurl'].'portal/'.$attachfile;
|
||||
}
|
||||
}
|
||||
echo " <item>\n".
|
||||
" <title>".$article['subject']."</title>\n".
|
||||
" <link>{$_G['siteurl']}".($rewriteflag ? rewriteoutput('portal_article', 1, '', $article['aid']) : "portal.php?mod=view&aid={$article['aid']}")."</link>\n".
|
||||
" <description><![CDATA[".dhtmlspecialchars($article['description'])."]]></description>\n".
|
||||
" <category>".dhtmlspecialchars($article['catname'])."</category>\n".
|
||||
" <author>".dhtmlspecialchars($article['author'])."</author>\n".
|
||||
($attachfile ? '<enclosure url="'.$filename.'" length="'.$attachsize.'" type="image/jpeg" />'."\n" : '').
|
||||
" <pubDate>".gmdate('r', $article['dateline'])."</pubDate>\n".
|
||||
" </item>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
updatersscache($num);
|
||||
}
|
||||
}
|
||||
|
||||
echo " </channel>\n".
|
||||
"</rss>";
|
||||
|
||||
|
||||
function updatersscache($num) {
|
||||
global $_G;
|
||||
$processname = 'portal_rss_cache';
|
||||
if(discuz_process::islocked($processname, 600)) {
|
||||
return false;
|
||||
}
|
||||
C::t('portal_rsscache')->truncate();
|
||||
require_once libfile('function/post');
|
||||
foreach($_G['cache']['portalcategory'] as $catid => $catarray) {
|
||||
$query = C::t('portal_article_title')->fetch_all_for_cat($catid, 0, 1, 0, $num);
|
||||
$catarray['catname'] = addslashes($catarray['catname']);
|
||||
foreach($query as $article) {
|
||||
$article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous');
|
||||
$article['title'] = addslashes($article['title']);
|
||||
$articleattach = C::t('portal_attachment')->fetch_by_aid_image($article['aid']);
|
||||
$attachdata = '';
|
||||
if(!empty($articleattach)) {
|
||||
$attachdata = "\t".$articleattach['remote']."\t".$articleattach['attachment']."\t".$articleattach['filesize'];
|
||||
}
|
||||
$article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)).$attachdata);
|
||||
C::t('portal_rsscache')->insert(array(
|
||||
'lastupdate'=>$_G['timestamp'],
|
||||
'catid'=>$catid,
|
||||
'aid'=>$article['aid'],
|
||||
'dateline'=>$article['dateline'],
|
||||
'catname'=>$catarray['catname'],
|
||||
'author'=>$article['author'],
|
||||
'subject'=>$article['title'],
|
||||
'description'=>$article['description']
|
||||
));
|
||||
}
|
||||
}
|
||||
discuz_process::unlock($processname);
|
||||
return true;
|
||||
}
|
||||
?>
|
85
source/module/portal/portal_topic.php
Normal file
85
source/module/portal/portal_topic.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_topic.php 33660 2013-07-29 07:51:05Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if($_GET['diy']=='yes' && !$_G['group']['allowaddtopic'] && !$_G['group']['allowmanagetopic']) {
|
||||
$_GET['diy'] = '';
|
||||
showmessage('topic_edit_nopermission');
|
||||
}
|
||||
|
||||
$topicid = $_GET['topicid'] ? intval($_GET['topicid']) : 0;
|
||||
|
||||
if($topicid) {
|
||||
$topic = C::t('portal_topic')->fetch($topicid);
|
||||
} elseif($_GET['topic']) {
|
||||
$topic = C::t('portal_topic')->fetch_by_name($_GET['topic']);
|
||||
}
|
||||
|
||||
if(empty($topic)) {
|
||||
showmessage('topic_not_exist');
|
||||
}
|
||||
|
||||
if($topic['closed'] && !$_G['group']['allowmanagetopic'] && !($topic['uid'] == $_G['uid'] && $_G['group']['allowaddtopic'])) {
|
||||
showmessage('topic_is_closed');
|
||||
}
|
||||
|
||||
if($_GET['diy'] == 'yes' && $topic['uid'] != $_G['uid'] && !$_G['group']['allowmanagetopic']) {
|
||||
$_GET['diy'] = '';
|
||||
showmessage('topic_edit_nopermission');
|
||||
}
|
||||
|
||||
if(!empty($_G['setting']['makehtml']['flag']) && $topic['htmlmade'] && !isset($_G['makehtml']) && empty($_GET['diy'])) {
|
||||
dheader('location:'.fetch_topic_url($topic));
|
||||
}
|
||||
|
||||
$topicid = intval($topic['topicid']);
|
||||
|
||||
C::t('portal_topic')->increase($topicid, array('viewnum' => 1));
|
||||
|
||||
$navtitle = $topic['title'];
|
||||
$metadescription = empty($topic['summary']) ? $topic['title'] : $topic['summary'];
|
||||
$metakeywords = empty($topic['keyword']) ? $topic['title'] : $topic['keyword'];
|
||||
|
||||
$attachtags = $aimgs = array();
|
||||
|
||||
list($seccodecheck, $secqaacheck) = seccheck('publish');
|
||||
|
||||
if(isset($_G['makehtml'])) {
|
||||
helper_makehtml::portal_topic($topic);
|
||||
}
|
||||
|
||||
$file = 'portal/portal_topic_content:'.$topicid;
|
||||
$tpldirectory = '';
|
||||
$primaltplname = $topic['primaltplname'];
|
||||
if(strpos($primaltplname, ':') !== false) {
|
||||
list($tpldirectory, $primaltplname) = explode(':', $primaltplname);
|
||||
}
|
||||
$topicurl = fetch_topic_url($topic);
|
||||
include template('diy:'.$file, NULL, $tpldirectory, NULL, $primaltplname);
|
||||
|
||||
function portaltopicgetcomment($topcid, $limit = 20, $start = 0) {
|
||||
global $_G;
|
||||
$topcid = intval($topcid);
|
||||
$limit = intval($limit);
|
||||
$start = intval($start);
|
||||
$data = array();
|
||||
if($topcid) {
|
||||
$query = C::t('portal_comment')->fetch_all_by_id_idtype($topcid, 'topicid', 'dateline', 'DESC', $start, $limit);
|
||||
foreach($query as $value) {
|
||||
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
|
||||
$data[$value['cid']] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
?>
|
345
source/module/portal/portal_view.php
Normal file
345
source/module/portal/portal_view.php
Normal file
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: portal_view.php 33660 2013-07-29 07:51:05Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$aid = empty($_GET['aid'])?0:intval($_GET['aid']);
|
||||
if(empty($aid)) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
showmessage('view_no_article_id');
|
||||
}
|
||||
$article = C::t('portal_article_title')->fetch($aid);
|
||||
require_once libfile('function/portalcp');
|
||||
$categoryperm = getallowcategory($_G['uid']);
|
||||
|
||||
if(empty($article) || ($article['status'] > 0 && $article['uid'] != $_G['uid'] && !$_G['group']['allowmanagearticle'] && empty($categoryperm[$article['catid']]['allowmanage']) && $_G['adminid'] != 1 && $_GET['modarticlekey'] != modauthkey($article['aid']))) {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
showmessage('view_article_no_exist');
|
||||
}
|
||||
|
||||
if(!empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['article']) && empty($_G['cache']['portalcategory'][$article['catid']]['noantitheft'])) {
|
||||
helper_antitheft::check($aid, 'aid');
|
||||
}
|
||||
|
||||
if(!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade'] && !isset($_G['makehtml']) && empty($_GET['diy']) && empty($article['url'])) {
|
||||
dheader('location:'. fetch_article_url($article));
|
||||
}
|
||||
$article_count = C::t('portal_article_count')->fetch($aid);
|
||||
if($article_count) $article = array_merge($article_count, $article);
|
||||
|
||||
if($article_count) {
|
||||
C::t('portal_article_count')->increase($aid, array('viewnum'=>1));
|
||||
unset($article_count);
|
||||
} else {
|
||||
C::t('portal_article_count')->insert(array(
|
||||
'aid'=>$aid,
|
||||
'catid'=>$article['catid'],
|
||||
'viewnum'=>1));
|
||||
}
|
||||
|
||||
if($article['url']) {
|
||||
if(!isset($_G['makehtml'])) {
|
||||
dheader("location:{$article['url']}");
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$cat = category_remake($article['catid']);
|
||||
|
||||
$article['pic'] = pic_get($article['pic'], '', $article['thumb'], $article['remote'], 1, 1);
|
||||
|
||||
$page = intval($_GET['page']);
|
||||
if($page<1) $page = 1;
|
||||
|
||||
$content = $contents = array();
|
||||
$multi = '';
|
||||
|
||||
$content = C::t('portal_article_content')->fetch_by_aid_page($aid, $page);
|
||||
|
||||
if($article['contents'] && $article['showinnernav']) {
|
||||
foreach(C::t('portal_article_content')->fetch_all_by_aid($aid) as $value) {
|
||||
$contents[] = $value;
|
||||
}
|
||||
if(empty($contents)) {
|
||||
C::t('portal_article_content')->update($aid, array('showinnernav' => '0'));
|
||||
}
|
||||
}
|
||||
|
||||
require_once libfile('function/blog');
|
||||
$content['content'] = blog_bbcode($content['content']);
|
||||
|
||||
if(!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade']) {
|
||||
$_caturl = $_G['cache']['portalcategory'][$cat['topid']]['domain'] ? $_G['cache']['portalcategory'][$cat['topid']]['caturl'] : '';
|
||||
$viewurl = $_caturl.$article['htmldir'].$article['htmlname'].'{page}.'.$_G['setting']['makehtml']['extendname'];
|
||||
unset($_caturl);
|
||||
} else {
|
||||
$viewurl = "portal.php?mod=view&aid=$aid";
|
||||
}
|
||||
|
||||
$multi = multi($article['contents'], 1, $page, $viewurl);
|
||||
$org = array();
|
||||
if($article['idtype'] == 'tid' || $content['idtype']=='pid') {
|
||||
$thread = $firstpost = array();
|
||||
require_once libfile('function/discuzcode');
|
||||
require_once libfile('function/forum');
|
||||
$thread = get_thread_by_tid($article['id']);
|
||||
if(!empty($thread)) {
|
||||
if($content['idtype']=='pid') {
|
||||
$firstpost = C::t('forum_post')->fetch_post($thread['posttableid'], $content['id']);
|
||||
} else {
|
||||
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($article['id']);
|
||||
}
|
||||
if($firstpost && $firstpost['tid'] == $article['id']) {
|
||||
$firstpost['uid'] = $firstpost['authorid'];
|
||||
$firstpost['username'] = $firstpost['author'];
|
||||
}
|
||||
}
|
||||
if(!empty($firstpost) && !empty($thread) && $thread['displayorder'] != -1) {
|
||||
$_G['tid'] = $article['id'];
|
||||
$aids = array();
|
||||
$firstpost['message'] = $content['content'];
|
||||
if($thread['attachment']) {
|
||||
$_G['group']['allowgetimage'] = 1;
|
||||
if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $firstpost['message'], $matchaids)) {
|
||||
$aids = $matchaids[1];
|
||||
}
|
||||
}
|
||||
|
||||
if($aids) {
|
||||
parseforumattach($firstpost, $aids);
|
||||
}
|
||||
$content['content'] = $firstpost['message'];
|
||||
$content['pid'] = $firstpost['pid'];
|
||||
|
||||
$org = $firstpost;
|
||||
$org_url = "forum.php?mod=viewthread&tid={$article['id']}";
|
||||
} else {
|
||||
C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => ''));
|
||||
C::t('portal_article_content')->update_by_aid($aid, array('id' => 0, 'idtype' => ''));
|
||||
}
|
||||
} elseif($article['idtype']=='blogid') {
|
||||
$org = C::t('home_blog')->fetch($article['id']);
|
||||
if(empty($org)) {
|
||||
C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => ''));
|
||||
dheader('location: '. fetch_article_url($article));
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$article['related'] = array();
|
||||
if(($relateds = C::t('portal_article_related')->fetch_all_by_aid($aid))) {
|
||||
foreach(C::t('portal_article_title')->fetch_all(array_keys($relateds)) as $raid => $value) {
|
||||
$value['uri'] = fetch_article_url($value);
|
||||
$article['related'][$raid] = $value;
|
||||
}
|
||||
}
|
||||
$article['allowcomment'] = !empty($cat['allowcomment']) && !empty($article['allowcomment']) ? 1 : 0;
|
||||
$_G['catid'] = $_GET['catid'] = $article['catid'];
|
||||
$common_url = '';
|
||||
$commentlist = array();
|
||||
if($article['allowcomment']) {
|
||||
|
||||
if($org && empty($article['owncomment'])) {
|
||||
|
||||
if($article['idtype'] == 'blogid') {
|
||||
|
||||
$common_url = "home.php?mod=space&uid={$org['uid']}&do=blog&id={$article['id']}";
|
||||
$form_url = "home.php?mod=spacecp&ac=comment";
|
||||
|
||||
$article['commentnum'] = C::t('home_comment')->count_by_id_idtype($article['id'], 'blogid');
|
||||
if($article['commentnum']) {
|
||||
$query = C::t('home_comment')->fetch_all_by_id_idtype($article['id'], 'blogid', 0, 20, '', 'DESC');
|
||||
foreach($query as $value) {
|
||||
if($value['status'] == 0 || $_G['adminid'] == 1 || $value['uid'] == $_G['uid']) {
|
||||
$commentlist[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} elseif($article['idtype'] == 'tid') {
|
||||
|
||||
$common_url = "forum.php?mod=viewthread&tid={$article['id']}";
|
||||
$form_url = "forum.php?mod=post&action=reply&tid={$article['id']}&replysubmit=yes&infloat=yes&handlekey=fastpost";
|
||||
|
||||
require_once libfile('function/discuzcode');
|
||||
$posttable = empty($thread['posttable']) ? getposttablebytid($article['id']) : $thread['posttable'];
|
||||
$_G['tid'] = $article['id'];
|
||||
$article['commentnum'] = getcount($posttable, array('tid'=>$article['id'], 'first'=>'0'));
|
||||
|
||||
if($article['allowcomment'] && $article['commentnum']) {
|
||||
$attachpids = $attachtags = array();
|
||||
$_G['group']['allowgetattach'] = $_G['group']['allowgetimage'] = 1;
|
||||
foreach(C::t('forum_post')->fetch_all_by_tid('tid:'.$article['id'], $article['id'], true, 'ASC', 0, 20, null, 0) as $value) {
|
||||
$value['uid'] = $value['authorid'];
|
||||
$value['username'] = $value['author'];
|
||||
if($value['status'] != 1 && !$value['first']) {
|
||||
$value['message'] = discuzcode($value['message'], $value['smileyoff'], $value['bbcodeoff'], $value['htmlon']);
|
||||
$value['cid'] = $value['pid'];
|
||||
$commentlist[$value['pid']] = $value;
|
||||
if($value['attachment']) {
|
||||
$attachpids[] = $value['pid'];
|
||||
if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $value['message'], $matchaids)) {
|
||||
$attachtags[$value['pid']] = $matchaids[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($attachpids) {
|
||||
require_once libfile('function/attachment');
|
||||
parseattach($attachpids, $attachtags, $commentlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$common_url = "portal.php?mod=comment&id=$aid&idtype=aid";
|
||||
$form_url = "portal.php?mod=portalcp&ac=comment";
|
||||
|
||||
$query = C::t('portal_comment')->fetch_all_by_id_idtype($aid, 'aid', 'dateline', 'DESC', 0, 20);
|
||||
$pricount = 0;
|
||||
foreach($query as $value) {
|
||||
if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
|
||||
$value['allowop'] = 1;
|
||||
$commentlist[] = $value;
|
||||
} else {
|
||||
$pricount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$hash = md5($article['uid']."\t".$article['dateline']);
|
||||
$id = $article['aid'];
|
||||
$idtype = 'aid';
|
||||
|
||||
loadcache('click');
|
||||
$clicks = empty($_G['cache']['click']['aid'])?array():$_G['cache']['click']['aid'];
|
||||
$maxclicknum = 0;
|
||||
foreach ($clicks as $key => $value) {
|
||||
$value['clicknum'] = $article["click{$key}"];
|
||||
$value['classid'] = mt_rand(1, 4);
|
||||
if($value['clicknum'] > $maxclicknum) $maxclicknum = $value['clicknum'];
|
||||
$clicks[$key] = $value;
|
||||
}
|
||||
|
||||
$clickuserlist = array();
|
||||
foreach(C::t('home_clickuser')->fetch_all_by_id_idtype($id, $idtype, 0, 24) as $value) {
|
||||
$value['clickname'] = $clicks[$value['clickid']]['name'];
|
||||
$clickuserlist[] = $value;
|
||||
}
|
||||
|
||||
$article['timestamp'] = $article['dateline'];
|
||||
$article['dateline'] = dgmdate($article['dateline']);
|
||||
|
||||
foreach($cat['ups'] as $val) {
|
||||
$cats[] = $val['catname'];
|
||||
}
|
||||
$seodata = array('firstcat' => $cats[0], 'secondcat' => $cats[1], 'curcat' => $cat['catname'], 'subject' => $article['title'], 'user' => $article['username'], 'summary' => $article['summary'], 'page' => intval($_GET['page']));
|
||||
list($navtitle, $metadescription, $metakeywords) = get_seosetting('article', $seodata);
|
||||
if(empty($navtitle)) {
|
||||
$navtitle = helper_seo::get_title_page($article['title'], $_G['page']).' - '.$cat['catname'];
|
||||
$nobbname = false;
|
||||
} else {
|
||||
$nobbname = true;
|
||||
}
|
||||
if(empty($metakeywords)) {
|
||||
$metakeywords = $article['title'];
|
||||
}
|
||||
if(empty($metadescription)) {
|
||||
$metadescription = $article['summary'] ? $article['summary'] : $article['title'];
|
||||
}
|
||||
|
||||
list($seccodecheck, $secqaacheck) = seccheck('publish');
|
||||
|
||||
$catid = $article['catid'];
|
||||
if(!$_G['setting']['relatedlinkstatus']) {
|
||||
$_G['relatedlinks'] = get_related_link('article');
|
||||
} else {
|
||||
$content['content'] = parse_related_link($content['content'], 'article');
|
||||
}
|
||||
if(isset($_G['makehtml'])) {
|
||||
helper_makehtml::portal_article($cat, $article, $page);
|
||||
}
|
||||
portal_get_per_next_article($article);
|
||||
$tpldirectory = '';
|
||||
$articleprimaltplname = $cat['articleprimaltplname'];
|
||||
if(strpos($articleprimaltplname, ':') !== false) {
|
||||
list($tpldirectory, $articleprimaltplname) = explode(':', $articleprimaltplname);
|
||||
}
|
||||
include_once template("diy:portal/view:{$catid}", NULL, $tpldirectory, NULL, $articleprimaltplname);
|
||||
|
||||
function parseforumattach(&$post, $aids) {
|
||||
global $_G;
|
||||
if(($aids = array_unique($aids))) {
|
||||
require_once libfile('function/attachment');
|
||||
$finds = $replaces = array();
|
||||
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$post['tid'], 'aid', $aids) as $attach) {
|
||||
|
||||
$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
|
||||
$attach['dateline'] = dgmdate($attach['dateline'], 'u');
|
||||
$extension = strtolower(fileext($attach['filename']));
|
||||
$attach['ext'] = $extension;
|
||||
$attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : '';
|
||||
$attach['attachicon'] = attachtype($extension."\t".$attach['filetype']);
|
||||
$attach['attachsize'] = sizecount($attach['filesize']);
|
||||
|
||||
$attach['refcheck'] = (!$attach['remote'] && $_G['setting']['attachrefcheck']) || ($attach['remote'] && ($_G['setting']['ftp']['hideurl'] || ($attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp')));
|
||||
$aidencode = packaids($attach);
|
||||
$widthcode = attachwidth($attach['width']);
|
||||
$is_archive = $_G['forum_thread']['is_archived'] ? "&fid=".$_G['fid']."&archiveid=".$_G['forum_thread']['archiveid'] : '';
|
||||
if($attach['isimage']) {
|
||||
$attachthumb = getimgthumbname($attach['attachment']);
|
||||
if($_G['setting']['thumbstatus'] && $attach['thumb']) {
|
||||
$replaces[$attach['aid']] = "<a href=\"javascript:;\"><img id=\"_aimg_{$attach['aid']}\" aid=\"{$attach['aid']}\" onclick=\"zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G['forum']['showexif']}')\"
|
||||
zoomfile=\"".($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes" : $attach['url'].$attach['attachment'])."\"
|
||||
src=\"".($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid=$aidencode" : $attach['url'].$attachthumb)."\" alt=\"{$attach['imgalt']}\" title=\"{$attach['imgalt']}\" w=\"{$attach['width']}\" /></a>";
|
||||
} else {
|
||||
$replaces[$attach['aid']] = "<img id=\"_aimg_{$attach['aid']}\" aid=\"{$attach['aid']}\"
|
||||
zoomfile=\"".($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes" : $attach['url'].$attach['attachment'])."\"
|
||||
src=\"".($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes " : $attach['url'].$attach['attachment'])."\" $widthcode alt=\"{$attach['imgalt']}\" title=\"{$attach['imgalt']}\" w=\"{$attach['width']}\" />";
|
||||
}
|
||||
} else {
|
||||
$replaces[$attach['aid']] = "{$attach['attachicon']}<a href=\"forum.php?mod=attachment{$is_archive}&aid=$aidencode\" onmouseover=\"showMenu({'ctrlid':this.id,'pos':'12'})\" id=\"aid{$attach['aid']}\" target=\"_blank\">{$attach['filename']}</a>";
|
||||
}
|
||||
$finds[$attach['aid']] = '[attach]'.$attach['aid'].'[/attach]';
|
||||
}
|
||||
if($finds && $replaces) {
|
||||
$post['message'] = str_ireplace($finds, $replaces, $post['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function portal_get_per_next_article(&$article) {
|
||||
$data = array();
|
||||
$aids = array();
|
||||
if($article['preaid']) {
|
||||
$aids[$article['preaid']] = $article['preaid'];
|
||||
}
|
||||
if($article['nextaid']) {
|
||||
$aids[$article['nextaid']] = $article['nextaid'];
|
||||
}
|
||||
if($aids) {
|
||||
$data = C::t('portal_article_title')->fetch_all($aids);
|
||||
foreach ($data as $aid => &$value) {
|
||||
$value['url'] = fetch_article_url($value);
|
||||
}
|
||||
}
|
||||
if($data[$article['preaid']]) {
|
||||
$article['prearticle'] = $data[$article['preaid']];
|
||||
}
|
||||
if($data[$article['nextaid']]) {
|
||||
$article['nextarticle'] = $data[$article['nextaid']];
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user