Exemplo n.º 1
0
 function getdata($style, $parameter)
 {
     global $_G;
     $parameter = $this->cookparameter($parameter);
     $topicids = !empty($parameter['topicids']) ? explode(',', $parameter['topicids']) : array();
     $uids = !empty($parameter['uids']) ? explode(',', $parameter['uids']) : array();
     $startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
     $items = isset($parameter['items']) ? intval($parameter['items']) : 10;
     $titlelength = $parameter['titlelength'] ? intval($parameter['titlelength']) : 40;
     $summarylength = $parameter['summarylength'] ? intval($parameter['summarylength']) : 80;
     $orderby = isset($parameter['orderby']) && in_array($parameter['orderby'], array('dateline', 'viewnum')) ? $parameter['orderby'] : 'dateline';
     $picrequired = !empty($parameter['picrequired']) ? 1 : 0;
     $bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
     $datalist = $list = array();
     $wherearr = array();
     if ($topicids) {
         $wherearr[] = 'topicid IN (' . dimplode($topicids) . ')';
     }
     if ($bannedids) {
         $wherearr[] = 'topicid NOT IN (' . dimplode($bannedids) . ')';
     }
     if ($uids) {
         $wherearr[] = 'uid IN (' . dimplode($uids) . ')';
     }
     if ($picrequired) {
         $wherearr[] = "cover != ''";
     }
     $wherearr[] = "closed = '0'";
     require_once libfile('function/portal');
     foreach (C::t('portal_topic')->fetch_all_by_search_where($wherearr, "ORDER BY {$orderby} DESC", $startrow, $items) as $data) {
         if (empty($data['cover'])) {
             $data['cover'] = STATICURL . 'image/common/nophoto.gif';
             $data['picflag'] = '0';
         }
         $list[] = array('id' => $data['topicid'], 'idtype' => 'topicid', 'title' => cutstr($data['title'], $titlelength, ''), 'url' => !empty($_G['setting']['makehtml']['flag']) && !empty($_G['setting']['makehtml']['topichtmldir']) && !$data['htmlmade'] ? fetch_topic_url($data) : 'portal.php?mod=topic&topic=' . $data['name'], 'pic' => $data['cover'] ? $data['cover'] : '', 'picflag' => $data['picflag'] ? $data['picflag'] : '', 'summary' => $data['summary'] ? cutstr($data['summary'], $summarylength, '') : '', 'fields' => array('fulltitle' => $data['title'], 'uid' => $data['uid'], 'username' => $data['username'], 'dateline' => $data['dateline'], 'viewnum' => $data['viewnum']));
     }
     return array('html' => '', 'data' => $list);
 }
Exemplo n.º 2
0
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;
            }
        }
Exemplo n.º 3
0
 $maketopichtml = !empty($_G['setting']['makehtml']['flag']) && !empty($_G['setting']['makehtml']['topichtmldir']);
 $subtitle = array('', 'topic_title', 'topic_domain', 'topic_name', 'topic_creator', 'topic_dateline');
 if ($maketopichtml) {
     $subtitle[] = 'HTML';
 }
 $subtitle[] = 'operation';
 showformheader('topic');
 showtableheader('topic_list');
 showsubtitle($subtitle);
 $multipage = '';
 $count = C::t('portal_topic')->count_by_search_where($wherearr);
 if ($count) {
     require_once libfile('function/portal');
     $repairs = array();
     foreach (C::t('portal_topic')->fetch_all_by_search_where($wherearr, $ordersql, $start, $perpage) as $topicid => $value) {
         if ($maketopichtml && $value['htmlmade'] && ($htmlname = fetch_topic_url($value)) && !file_exists(DISCUZ_ROOT . './' . $htmlname)) {
             $value['htmlmade'] = 0;
             $repairs[$topicid] = $topicid;
         }
         $tablerow = array("<input type=\"checkbox\" class=\"checkbox\" name=\"ids[]\" value=\"{$topicid}\">", ($value['htmlmade'] ? "[<a href='{$htmlname}' target='_blank'>HTML</a>]" : '') . "<a href=\"portal.php?mod=topic&topicid={$topicid}\" target=\"_blank\">" . $value[title] . "</a>" . ($value['closed'] ? ' [' . cplang('topic_closed_yes') . ']' : ''), $value['domain'] && !empty($_G['setting']['domain']['root']['topic']) ? 'http://' . $value['domain'] . '.' . $_G['setting']['domain']['root']['topic'] : '', $value['name'], "<a href=\"home.php?mod=space&uid={$value['uid']}&do=profile\" target=\"_blank\">{$value['username']}</a>", dgmdate($value[dateline]));
         if ($maketopichtml) {
             $tablerow[] = "<span id='mkhtml_{$value['topicid']}' style='color:" . ($value['htmlmade'] ? "blue;'>" . cplang('setting_functions_makehtml_made') : "red;'>" . cplang('setting_functions_makehtml_dismake')) . "</span>";
         }
         $tablerow[] = ($maketopichtml ? $maketopichtml && !$value['closed'] ? "<a href='javascript:void(0);' onclick=\"make_html('portal.php?mod=topic&topicid={$value['topicid']}', \$('mkhtml_{$value['topicid']}'))\">" . cplang('setting_functions_makehtml_make') . "</a>" : cplang('setting_functions_makehtml_make_has_closed') : '') . " <a href=\"portal.php?mod=portalcp&ac=topic&topicid={$topicid}\" target=\"_blank\">" . cplang('topic_edit') . "</a>&nbsp;" . "<a href=\"portal.php?mod=topic&topicid={$topicid}&diy=yes\" target=\"_blank\">DIY</a>" . '&nbsp;<a href="' . ADMINSCRIPT . '?action=diytemplate&operation=perm&targettplname=portal/portal_topic_content_' . $value['topicid'] . '&tpldirectory=' . getdiydirectory($value['primaltplname']) . '">' . cplang('topic_perm') . '</a>';
         showtablerow('', array('class="td25"', 'class=""', 'class="td28"'), $tablerow);
     }
     $multipage = multi($count, $perpage, $page, $mpurl);
     if ($repairs) {
         C::t('portal_topic')->repair_htmlmade($repairs);
     }
 }
Exemplo n.º 4
0
}
$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']) {