Ejemplo n.º 1
0
function threadsort_checkoption($sortid = 0, $unchangeable = 1)
{
    global $_G;
    $_G['forum_selectsortid'] = $sortid ? intval($sortid) : '';
    loadcache(array('threadsort_option_' . $sortid));
    sortthreadsortselectoption($sortid);
    $_G['forum_optionlist'] = $_G['cache']['threadsort_option_' . $sortid];
    $_G['forum_checkoption'] = array();
    if (is_array($_G['forum_optionlist'])) {
        foreach ($_G['forum_optionlist'] as $optionid => $option) {
            $_G['forum_checkoption'][$option['identifier']]['optionid'] = $optionid;
            $_G['forum_checkoption'][$option['identifier']]['title'] = $option['title'];
            $_G['forum_checkoption'][$option['identifier']]['type'] = $option['type'];
            $_G['forum_checkoption'][$option['identifier']]['required'] = $option['required'] ? 1 : 0;
            $_G['forum_checkoption'][$option['identifier']]['unchangeable'] = $_G['gp_action'] == 'edit' && $unchangeable && $option['unchangeable'] ? 1 : 0;
            $_G['forum_checkoption'][$option['identifier']]['maxnum'] = $option['maxnum'] ? intval($option['maxnum']) : '';
            $_G['forum_checkoption'][$option['identifier']]['minnum'] = $option['minnum'] ? intval($option['minnum']) : '';
            $_G['forum_checkoption'][$option['identifier']]['maxlength'] = $option['maxlength'] ? intval($option['maxlength']) : '';
        }
    }
}
Ejemplo n.º 2
0
if ($_G['setting']['allowmoderatingthread'] && $_G['uid']) {
    $threadmodcount = DB::result_first("SELECT COUNT(*) FROM " . DB::table($threadtable) . " WHERE fid='{$_G['fid']}' AND displayorder='-2' AND authorid='{$_G['uid']}'");
}
if ($_G['forum']['modworks'] || $_G['forum']['modnewposts']) {
    $_G['forum']['modnewposts'] && ($_G['forum']['modworks'] = 1);
    $modusernum = $_G['group']['allowmoduser'] ? DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'") : 0;
}
$optionadd = $filterurladd = $searchsorton = '';
$quicksearchlist = array();
if (!empty($_G['forum']['threadsorts']['types'])) {
    require_once libfile('function/threadsort');
    $showpic = intval($_G['gp_showpic']);
    $templatearray = $sortoptionarray = array();
    foreach ($_G['forum']['threadsorts']['types'] as $stid => $sortname) {
        loadcache(array('threadsort_option_' . $stid, 'threadsort_template_' . $stid));
        sortthreadsortselectoption($stid);
        $templatearray[$stid] = $_G['cache']['threadsort_template_' . $stid]['subject'];
        $sortoptionarray[$stid] = $_G['cache']['threadsort_option_' . $stid];
    }
    if (!empty($_G['forum']['threadsorts']['defaultshow']) && empty($_G['gp_sortid']) && empty($_G['gp_sortall'])) {
        $_G['gp_sortid'] = $_G['forum']['threadsorts']['defaultshow'];
        $_G['gp_filter'] = 'sortid';
        $_SERVER['QUERY_STRING'] = $_SERVER['QUERY_STRING'] ? $_SERVER['QUERY_STRING'] . '&sortid=' . $_G['gp_sortid'] : 'sortid=' . $_G['gp_sortid'];
        $filterurladd = '&filter=sort';
    }
    $_G['gp_sortid'] = $_G['gp_sortid'] ? $_G['gp_sortid'] : $_G['gp_searchsortid'];
    if (isset($_G['gp_sortid']) && $_G['forum']['threadsorts']['types'][$_G['gp_sortid']]) {
        $searchsortoption = $sortoptionarray[$_G['gp_sortid']];
        $quicksearchlist = quicksearch($searchsortoption);
        $_G['forum_optionlist'] = $_G['cache']['threadsort_option_' . $_G['gp_sortid']];
        $forum_optionlist = getsortedoptionlist();
Ejemplo n.º 3
0
 if (empty($_G['gp_searchoption']) && !$_G['gp_sortid']) {
     cpmsg('threadtype_content_no_choice', 'action=threadtypes&operation=content', 'error');
 }
 $mpurl = ADMINSCRIPT . '?action=threadtypes&operation=content&sortid=' . $_G['gp_sortid'] . '&searchsortsubmit=true';
 if (!is_array($_G['gp_searchoption'])) {
     $mpurl .= '&searchoption=' . $_G['gp_searchoption'];
     $_G['gp_searchoption'] = unserialize(base64_decode($_G['gp_searchoption']));
 } else {
     $mpurl .= '&searchoption=' . base64_encode(serialize($_G['gp_searchoption']));
 }
 shownav('forum', 'threadtype_infotypes');
 showsubmenu('threadtype_infotypes', array(array('threadtype_infotypes_type', 'threadtypes', 0), array('threadtype_infotypes_content', 'threadtypes&operation=content', 1), array(array('menu' => $curclassname ? $curclassname : 'threadtype_infotypes_option', 'submenu' => $classoptionmenu))));
 loadcache('forums');
 loadcache(array('threadsort_option_' . $_G['gp_sortid']));
 require_once libfile('function/threadsort');
 sortthreadsortselectoption($_G['gp_sortid']);
 $sortoptionarray = $_G['cache']['threadsort_option_' . $_G['gp_sortid']];
 $selectsql = '';
 if ($_G['gp_searchoption']) {
     foreach ($_G['gp_searchoption'] as $optionid => $option) {
         $fieldname = $sortoptionarray[$optionid]['identifier'] ? $sortoptionarray[$optionid]['identifier'] : 1;
         if ($option['value']) {
             if (in_array($option['type'], array('number', 'radio'))) {
                 $option['value'] = intval($option['value']);
                 $exp = '=';
                 if ($option['condition']) {
                     $exp = $option['condition'] == 1 ? '>' : '<';
                 }
                 $sql = "{$fieldname}{$exp}'{$option['value']}'";
             } elseif ($option['type'] == 'select') {
                 $subvalues = $currentchoices = array();
Ejemplo n.º 4
0
 function getdata($style, $parameter)
 {
     global $_G;
     $parameter = $this->cookparameter($parameter);
     loadcache('forums');
     $tids = !empty($parameter['tids']) ? explode(',', $parameter['tids']) : array();
     $fids = isset($parameter['fids']) && !in_array(0, (array) $parameter['fids']) ? $parameter['fids'] : array_keys($_G['cache']['forums']);
     $startrow = !empty($parameter['startrow']) ? intval($parameter['startrow']) : 0;
     $items = !empty($parameter['showitems']) ? intval($parameter['showitems']) : 10;
     $digest = isset($parameter['digest']) ? $parameter['digest'] : 0;
     $stick = isset($parameter['stick']) ? $parameter['stick'] : 0;
     $orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('lastpost', 'dateline', 'replies', 'views', 'heats', 'recommends')) ? $parameter['orderby'] : 'lastpost' : 'lastpost';
     $lastpost = isset($parameter['lastpost']) ? intval($parameter['lastpost']) : 0;
     $recommend = !empty($parameter['recommend']) ? 1 : 0;
     $sortid = isset($parameter['sortids']) ? intval($parameter['sortids']) : '';
     if ($fids) {
         $thefids = array();
         foreach ($fids as $fid) {
             if ($_G['cache']['forums'][$fid]['type'] == 'group') {
                 $thefids[] = $fid;
             }
         }
         if ($thefids) {
             foreach ($_G['cache']['forums'] as $value) {
                 if ($value['fup'] && in_array($value['fup'], $thefids)) {
                     $fids[] = intval($value['fid']);
                 }
             }
         }
         $fids = array_unique($fids);
     }
     $datalist = $list = array();
     $threadtypeids = array();
     $sql = ($tids ? ' AND t.tid IN (' . dimplode($tids) . ')' : '') . ($sortid ? ' AND t.sortid=' . $sortid : '') . ($fids ? ' AND t.fid IN (' . dimplode($fids) . ')' : '') . ($digest ? ' AND t.digest IN (' . dimplode($digest) . ')' : '') . ($stick ? ' AND t.displayorder IN (' . dimplode($stick) . ')' : '') . " AND t.closed='0' AND t.isgroup='0'";
     if ($lastpost) {
         $historytime = TIMESTAMP - $lastpost;
         $sql .= " AND t.dateline>='{$historytime}'";
     }
     if ($orderby == 'heats') {
         $_G['setting']['indexhot']['days'] = !empty($_G['setting']['indexhot']['days']) ? intval($_G['setting']['indexhot']['days']) : 8;
         $heatdateline = TIMESTAMP - 86400 * $_G['setting']['indexhot']['days'];
         $sql .= " AND t.dateline>'{$heatdateline}' AND t.heats>'0'";
     }
     $sqlfrom = "FROM `" . DB::table('forum_thread') . "` t";
     $joinmethod = empty($tids) ? 'INNER' : 'LEFT';
     if ($recommend) {
         $sqlfrom .= " {$joinmethod} JOIN `" . DB::table('forum_forumrecommend') . "` fc ON fc.tid=t.tid";
     }
     require_once libfile('function/threadsort');
     $templatearray = $sortoptionarray = array();
     loadcache(array('threadsort_option_' . $sortid, 'threadsort_template_' . $sortid));
     sortthreadsortselectoption($sortid);
     $templatearray[$sortid] = $_G['cache']['threadsort_template_' . $sortid]['block'];
     $sortoptionarray[$sortid] = $_G['cache']['threadsort_option_' . $sortid];
     $isthreadtype = strpos($templatearray[$sortid], '{typename}') !== false || strpos($templatearray[$sortid], '{typename_url}') !== false ? true : false;
     $threadtypes = array();
     if ($isthreadtype && $fids) {
         foreach (C::t('forum_forumfield')->fetch_all($fids) as $fid => $forum) {
             $threadtypes[$fid] = dunserialize($forum['threadtypes']);
         }
     }
     $html = '';
     $threadlist = $verify = $verifyuids = array();
     $query = DB::query("SELECT t.*\r\n\t\t\t{$sqlfrom} WHERE 1 {$sql}\r\n\t\t\tAND t.readperm='0'\r\n\t\t\tAND t.displayorder>='0'\r\n\t\t\tORDER BY t.{$orderby} DESC\r\n\t\t\tLIMIT {$startrow},{$items};");
     while ($thread = DB::fetch($query)) {
         if (isset($_G['setting']['verify']['enabled']) && $_G['setting']['verify']['enabled']) {
             $verifyuids[$thread['authorid']] = $thread['authorid'];
         }
         if ($thread['highlight']) {
             $color = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282');
             $string = sprintf('%02d', $thread['highlight']);
             $stylestr = sprintf('%03b', $string[0]);
             $thread['highlight'] = ' style="';
             $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
             $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
             $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
             $thread['highlight'] .= $string[1] ? 'color: ' . $color[$string[1]] : '';
             $thread['highlight'] .= '"';
         } else {
             $thread['highlight'] = '';
         }
         $thread['lastposterenc'] = rawurlencode($thread['lastposter']);
         $fid = $thread['fid'];
         if ($thread['typeid'] && $isthreadtype && $threadtypes[$fid] && !empty($threadtypes[$fid]['prefix']) && isset($threadtypes[$fid]['types'][$thread['typeid']])) {
             if ($threadtypes[$fid]['prefix'] == 1) {
                 $thread['typehtml'] = '<em>[<a href="forum.php?mod=forumdisplay&fid=' . $fid . '&amp;filter=typeid&amp;typeid=' . $thread['typeid'] . '">' . $threadtypes[$fid]['types'][$thread['typeid']] . '</a>]</em>';
             } elseif ($threadtypes[$fid]['icons'][$thread['typeid']] && $threadtypes[$fid]['prefix'] == 2) {
                 $thread['typehtml'] = '<em><a title="' . $threadtypes[$fid]['types'][$thread['typeid']] . '" href="forum.php?mod=forumdisplay&fid=' . $fid . '&amp;filter=typeid&amp;typeid=' . $thread['typeid'] . '">' . '<img style="vertical-align: middle;padding-right:4px;" src="' . $threadtypes[$fid]['icons'][$thread['typeid']] . '" alt="' . $threadtypes[$fid]['types'][$thread['typeid']] . '" /></a></em>';
             }
             $thread['typename'] = $threadtypes[$fid]['types'][$thread['typeid']];
         } else {
             $thread['typename'] = $thread['typehtml'] = '';
         }
         $thread['dateline'] = dgmdate($thread['dateline'], 'u', '9999', getglobal('setting/dateformat'));
         $thread['lastpost'] = dgmdate($thread['lastpost'], 'u');
         $threadlist[$thread['tid']] = $thread;
     }
     if (!empty($threadlist)) {
         if ($verifyuids) {
             foreach (C::t('common_member_verify')->fetch_all($verifyuids) as $value) {
                 foreach ($_G['setting']['verify'] as $vid => $vsetting) {
                     if ($vsetting['available'] && $vsetting['showicon'] && $value['verify' . $vid] == 1) {
                         $srcurl = '';
                         if (!empty($vsetting['icon'])) {
                             $srcurl = $vsetting['icon'];
                         }
                         $verify[$value['uid']] .= "<a href=\"home.php?mod=spacecp&ac=profile&op=verify&vid={$vid}\" target=\"_blank\">" . (!empty($srcurl) ? '<img src="' . $srcurl . '" class="vm" alt="' . $vsetting['title'] . '" title="' . $vsetting['title'] . '" />' : $vsetting['title']) . '</a>';
                     }
                 }
             }
         }
         $html = implode('', showsortmodetemplate($sortid, $fids, $sortoptionarray, $templatearray, $threadlist, array_keys($threadlist), $verify));
     }
     return array('html' => $html, 'data' => null);
 }
Ejemplo n.º 5
0
 if (empty($_GET['searchoption']) && !$_GET['sortid']) {
     cpmsg('threadtype_content_no_choice', 'action=threadtypes&operation=content', 'error');
 }
 $mpurl = ADMINSCRIPT . '?action=threadtypes&operation=content&sortid=' . $_GET['sortid'] . '&searchsortsubmit=true';
 if (!is_array($_GET['searchoption'])) {
     $mpurl .= '&searchoption=' . $_GET['searchoption'];
     $_GET['searchoption'] = dunserialize(base64_decode($_GET['searchoption']));
 } else {
     $mpurl .= '&searchoption=' . base64_encode(serialize($_GET['searchoption']));
 }
 shownav('forum', 'threadtype_infotypes');
 showsubmenu('threadtype_infotypes', array(array('threadtype_infotypes_type', 'threadtypes', 0), array('threadtype_infotypes_content', 'threadtypes&operation=content', 1), array(array('menu' => $curclassname ? $curclassname : 'threadtype_infotypes_option', 'submenu' => $classoptionmenu))));
 loadcache('forums');
 loadcache(array('threadsort_option_' . $_GET['sortid']));
 require_once libfile('function/threadsort');
 sortthreadsortselectoption($_GET['sortid']);
 $sortoptionarray = $_G['cache']['threadsort_option_' . $_GET['sortid']];
 $selectsql = '';
 if ($_GET['searchoption']) {
     foreach ($_GET['searchoption'] as $optionid => $option) {
         $fieldname = $sortoptionarray[$optionid]['identifier'] ? $sortoptionarray[$optionid]['identifier'] : 1;
         if ($option['value']) {
             if (in_array($option['type'], array('number', 'radio'))) {
                 $option['value'] = intval($option['value']);
                 $exp = '=';
                 if ($option['condition']) {
                     $exp = $option['condition'] == 1 ? '>' : '<';
                 }
                 $sql = "{$fieldname}{$exp}'{$option['value']}'";
             } elseif ($option['type'] == 'select') {
                 $subvalues = $currentchoices = array();