예제 #1
0
파일: hott.class.php 프로젝트: v998/dsu
 function viewthread_useraction_output()
 {
     global $_G, $postlist, $tid, $authorid, $hott, $config, $new_window;
     if (!$_G['fid'] || !$_G['tid'] || !$postlist[$_G['forum_firstpid']]['authorid'] || $postlist[$_G['forum_firstpid']]['anonymous']) {
         return;
     }
     loadcache('plugin');
     $config = $_G['cache']['plugin']['dsu_hott'];
     @(include DISCUZ_ROOT . './data/dsu_hott.inc.php');
     $authorid = $postlist[$_G['forum_firstpid']]['authorid'];
     $new_window = $config['new_window'] ? ' target="_blank" ' : '';
     $config['max_text'] = $config['max_text'] > 0 ? $config['max_text'] : 80;
     $tid = $_G['tid'];
     $hott_block1 = $hott_block2 = '';
     if ($hott[1]['script'] && file_exists(DISCUZ_ROOT . './source/plugin/dsu_hott/script/' . $hott[1]['script'])) {
         include DISCUZ_ROOT . './source/plugin/dsu_hott/script/' . $hott[1]['script'];
         $hott_block1 = $hott_script->output(1);
         unset($hott_script);
     }
     if ($hott[2]['script'] && file_exists(DISCUZ_ROOT . './source/plugin/dsu_hott/script/' . $hott[2]['script'])) {
         include DISCUZ_ROOT . './source/plugin/dsu_hott/script/' . $hott[2]['script'];
         $hott_block2 = $hott_script->output(2);
         unset($hott_script);
     }
     if ($hott_block1 || $hott_block2) {
         $hott[0]['style'] = $hott[0]['style'] ? $hott[0]['style'] : 'default';
         @(include template('dsu_hott:' . $hott[0]['style']));
         $return = '</div>' . $return;
         return $return;
     }
 }
예제 #2
0
function setloginstatus($member, $cookietime)
{
    global $_G;
    $_G['uid'] = intval($member['uid']);
    $_G['username'] = $member['username'];
    $_G['adminid'] = $member['adminid'];
    $_G['groupid'] = $member['groupid'];
    $_G['formhash'] = formhash();
    $_G['session']['invisible'] = getuserprofile('invisible');
    $_G['member'] = $member;
    loadcache('usergroup_' . $_G['groupid']);
    C::app()->session->isnew = true;
    C::app()->session->updatesession();
    dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true);
    dsetcookie('loginuser');
    dsetcookie('activationauth');
    dsetcookie('pmnum');
    include_once libfile('function/stat');
    updatestat('login', 1);
    if (defined('IN_MOBILE')) {
        updatestat('mobilelogin', 1);
    }
    if ($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) {
        updatestat('connectlogin', 1);
    }
    $rule = updatecreditbyaction('daylogin', $_G['uid']);
    if (!$rule['updatecredit']) {
        checkusergroup($_G['uid']);
    }
}
예제 #3
0
 function getsetting()
 {
     global $_G;
     $settings = array('fids' => array('title' => 'couplebanner_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'couplebanner_groups', 'type' => 'mselect', 'value' => array()), 'position' => array('title' => 'couplebanner_position', 'type' => 'mradio', 'value' => array(array(1, 'couplebanner_position_left'), array(2, 'couplebanner_position_right')), 'default' => 1), 'coupleadid' => array('title' => 'couplebanner_coupleadid', 'type' => 'select', 'value' => array()));
     loadcache(array('forums', 'grouptype'));
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'couplebanner_index');
     if (empty($_G['cache']['forums'])) {
         $_G['cache']['forums'] = array();
     }
     foreach ($_G['cache']['forums'] as $fid => $forum) {
         $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
     }
     foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
         $settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4) . $group['name']);
         if ($group['secondlist']) {
             foreach ($group['secondlist'] as $sgid) {
                 $settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8) . $_G['cache']['grouptype']['second'][$sgid]['name']);
             }
         }
     }
     $query = DB::query('SELECT * FROM ' . DB::table('common_advertisement') . " WHERE type='couplebanner'");
     while ($couple = DB::fetch($query)) {
         $settings['coupleadid']['value'][] = array($couple['advid'], $couple['title']);
     }
     return $settings;
 }
예제 #4
0
 function discuz_censor()
 {
     global $_G;
     loadcache(array('censor', 'bbcodes_display'));
     $this->censor_words = !empty($_G['cache']['censor']) ? $_G['cache']['censor'] : array();
     $this->bbcodes_display = $_G['cache']['bbcodes_display'][$_G['groupid']];
 }
예제 #5
0
 function viewthread_sidebottom_output()
 {
     global $_G, $postlist;
     if (IS_ROBOT) {
         return array();
     }
     if (!$_G['forum_firstpid']) {
         return array();
     }
     loadcache('myapp');
     $thisApp = '';
     $poster = reset($postlist);
     $userapp = C::t('home_userapp_plying')->fetch($poster['authorid']);
     if (!empty($userapp['appid'])) {
         $applist = explode(',', $userapp['appid']);
         $i = 0;
         foreach ($applist as $appid) {
             if (!empty($_G['cache']['myapp'][$appid])) {
                 if ($i < $this->num) {
                     $thisApp .= '<a href="userapp.php?mod=app&id=' . $appid . '&fromtid=' . $_G['tid'] . '"' . (isset($_G['cache']['myapp'][$appid]) ? ' title="' . $_G['cache']['myapp'][$appid]['appname'] . '"' : '') . ' target="_blank">' . '<img class="authicn vm" src="http://appicon.manyou.com/logos/' . $appid . '" style="width:40px;height:40px;margin-left:0px;"/></a>';
                     $i++;
                 } else {
                     break;
                 }
             }
         }
     }
     $thisApp = $thisApp ? '<p>' . $this->title . '</p><p class="avt" style="margin-left:10px;">' . $thisApp . '</p>' : '';
     return array($thisApp);
 }
예제 #6
0
function getCloudRelateThreads($api = 'tao', $keyword, $page, $tpp = 20, $excludeForumIds = '', $cache = false)
{
    global $_G;
    $threadlist = array();
    $searchHelper = Cloud::loadClass('Service_SearchHelper');
    if ($api != 'tao') {
        $cloudData = $searchHelper->getRelatedThreads($excludeForumIds);
    } else {
        $cloudData = $searchHelper->getRelatedThreadsTao($keyword, $page, $tpp, $disAd, $of, $ot, $cache, $excludeForumIds);
    }
    if ($cloudData['result']['data']) {
        foreach ($cloudData['result']['ad']['content'] as $sAdv) {
            $threadlist[] = array('icon' => (string) $cloudData['result']['ad']['icon']) + $sAdv;
        }
        foreach ($cloudData['result']['data'] as $sPost) {
            $threadlist[] = $sPost;
        }
    } else {
        return null;
    }
    loadcache('forums');
    foreach ($threadlist as $curtid => &$curvalue) {
        $curvalue['pForumName'] = $_G['cache']['forums'][$curvalue['pForumId']]['name'];
        $curvalue['istoday'] = strtotime($curvalue['pPosted']) > $todaytime ? 1 : 0;
        $curvalue['dateline'] = $curvalue['pPosted'];
    }
    return array($threadlist, $cloudData);
}
예제 #7
0
 function getsetting()
 {
     global $_G;
     $settings = array('fids' => array('title' => 'couplebanner_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'couplebanner_groups', 'type' => 'mselect', 'value' => array()), 'category' => array('title' => 'couplebanner_category', 'type' => 'mselect', 'value' => array()), 'position' => array('title' => 'couplebanner_position', 'type' => 'mradio', 'value' => array(array(1, 'couplebanner_position_left'), array(2, 'couplebanner_position_right')), 'default' => 1), 'coupleadid' => array('title' => 'couplebanner_coupleadid', 'type' => 'select', 'value' => array()), 'disableclose' => array('title' => 'couplebanner_disableclose', 'type' => 'mradio', 'value' => array(array(0, 'couplebanner_show'), array(1, 'couplebanner_hidden')), 'default' => 0));
     loadcache(array('forums', 'grouptype'));
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'couplebanner_index');
     if (empty($_G['cache']['forums'])) {
         $_G['cache']['forums'] = array();
     }
     foreach ($_G['cache']['forums'] as $fid => $forum) {
         $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
     }
     foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
         $settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4) . $group['name']);
         if ($group['secondlist']) {
             foreach ($group['secondlist'] as $sgid) {
                 $settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8) . $_G['cache']['grouptype']['second'][$sgid]['name']);
             }
         }
     }
     foreach (C::t('common_advertisement')->fetch_all_by_type('couplebanner') as $couple) {
         $settings['coupleadid']['value'][] = array($couple['advid'], $couple['title']);
     }
     loadcache('portalcategory');
     $this->categoryvalue[] = array(-1, 'couplebanner_index');
     $this->getcategory(0);
     $settings['category']['value'] = $this->categoryvalue;
     return $settings;
 }
예제 #8
0
 function checkfield()
 {
     global $_G;
     $fields = array('realname', 'gender', 'birthyear', 'birthmonth', 'birthday', 'bloodtype', 'affectivestatus', 'birthprovince', 'birthcity', 'resideprovince', 'residecity');
     loadcache('profilesetting');
     $fieldsnew = array();
     foreach ($fields as $v) {
         if (isset($_G['cache']['profilesetting'][$v])) {
             $fieldsnew[$v] = $_G['cache']['profilesetting'][$v]['title'];
         }
     }
     if ($fieldsnew) {
         space_merge($_G['member'], 'profile');
         $none = array();
         foreach ($_G['member'] as $k => $v) {
             if (in_array($k, $fields, true) && !trim($v)) {
                 $none[] = $fieldsnew[$k];
             }
         }
         $all = count($fields);
         $csc = intval(($all - count($none)) / $all * 100);
         return array($none, $csc);
     } else {
         return true;
     }
 }
예제 #9
0
		function global_header() 
		{
			global $_G;
			if(!$_G[uid])
			{
				loadcache('plugin'); 
				$config =  $_G['cache']['plugin']['ct_login_yinxiangpai'];
				$login_url = $config['login_url'] ? unserialize($config['login_url']) : '';
				$isopen = $config['isopen'] ? $config['isopen'] : 0 ;
				
				if(empty($login_url))showmessage(lang('plugin/ct_login_yinxiangpai','login_url'));
				
				$login_arr = explode('[ct]', str_replace(array("\n", "\t"), array('', ''), $config['m_url']));
				//$m_url = array_diff($login_arr,array(''));
				if($login_arr){
					foreach($login_arr as $k=>$v){
						if(empty($v))continue;
						$m_url[$k]=strtolower(trim($v));
					}
				}
		
				$http = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://';
				$get_url = $http.strtolower($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
			
				$current_page = CURSCRIPT . '_' . CURMODULE;
				if((in_array($current_page,$login_url) || in_array( $get_url,$m_url) )&& !$_G[uid] && $isopen )
				{
					$target_url = $_G['siteurl'].'plugin.php?id=ct_login_yinxiangpai:index';
					header('Location: '.$target_url);		
				}
			}
		}
예제 #10
0
 function checkfield()
 {
     global $_G;
     $fields = lang('task/profile', 'profile_fields');
     loadcache('profilesetting');
     $fieldsql = array();
     foreach ($fields as $k => $v) {
         $nk = explode('.', $k);
         if (isset($_G['cache']['profilesetting'][$nk[1]])) {
             $fieldsnew[$nk[1]] = $v;
             $fieldsql[] = $k;
         }
     }
     if ($fieldsql) {
         $result = DB::fetch_first("SELECT " . implode(',', $fieldsql) . " FROM " . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_profile') . " mp ON m.uid=mp.uid WHERE m.uid='{$_G['uid']}'");
         $none = array();
         foreach ($result as $k => $v) {
             if (!trim($v)) {
                 $none[] = $fieldsnew[$k];
             }
         }
         $csc = intval((count($fields) - count($none)) / count($fields) * 100);
         return array($none, $csc);
     } else {
         return true;
     }
 }
예제 #11
0
function getPortalConfigure($setting = null)
{
    $config[] = array('title' => Utils::converGbkString('首页'), 'module' => Utils::converGbkString('门户首页'), 'enable' => '1', 'sort' => 1, 'id' => '0', 'type' => '4');
    global $_G;
    loadcache('portalcategory');
    $portalcategory = $_G['cache']['portalcategory'];
    if (false && !empty($portalcategory)) {
        foreach ($portalcategory as $cat) {
            if ($cat['closed'] != 1) {
                if (isset($setting['portal']) && !empty($setting['portal'])) {
                    foreach ($setting['portal'] as $category) {
                        if ($category['id'] == $cat['catid'] && $category['enable'] == 1) {
                            $config[] = array('title' => Utils::converGbkString($category['title']), 'module' => $cat['catname'], 'enable' => '1', 'sort' => $category['sort'], 'id' => $cat['catid'], 'type' => '4');
                        }
                    }
                }
            }
        }
        $newArr = array();
        for ($j = 0; $j < count($config); $j++) {
            $newArr[] = $config[$j]['sort'];
        }
        array_multisort($newArr, $config);
    }
    return $config;
}
예제 #12
0
 public static function parse_related_link($content, $extent)
 {
     global $_G;
     loadcache('relatedlink');
     $allextent = array('article' => 0, 'forum' => 1, 'group' => 2, 'blog' => 3);
     if ($_G['cache']['relatedlink'] && isset($allextent[$extent])) {
         $searcharray = $replacearray = array();
         foreach ($_G['cache']['relatedlink'] as $link) {
             $link['extent'] = sprintf('%04b', $link['extent']);
             if ($link['extent'][$allextent[$extent]] && $link['name'] && $link['url']) {
                 $searcharray[$link[name]] = '/(' . preg_quote($link['name']) . ')/i';
                 $replacearray[$link[name]] = "<a href=\"{$link['url']}\" target=\"_blank\" class=\"relatedlink\">{$link['name']}</a>";
             }
         }
         if ($searcharray && $replacearray) {
             $_G['trunsform_tmp'] = array();
             $content = preg_replace_callback("/(<script\\s+.*?>.*?<\\/script>)|(<a\\s+.*?>.*?<\\/a>)|(<img\\s+.*?[\\/]?>)|(\\[attach\\](\\d+)\\[\\/attach\\])/is", function ($matches) {
                 return helper_seo::base64_transform('encode', '<relatedlink>', $matches[1] . $matches[2] . $matches[3] . $matches[4], '</relatedlink>');
             }, $content);
             $content = preg_replace($searcharray, $replacearray, $content, 1);
             $content = preg_replace_callback("/<relatedlink>(.*?)<\\/relatedlink>/is", function ($matches) {
                 return helper_seo::base64_transform('decode', '', $matches[1], '');
             }, $content);
         }
     }
     return $content;
 }
function make_secqaa($idhash)
{
    global $_G;
    loadcache('secqaa');
    $secqaakey = max(1, random(1, 1));
    if ($_G['cache']['secqaa'][$secqaakey]['type']) {
        $etype = explode(':', $_G['cache']['secqaa'][$secqaakey]['question']);
        if (count($etype) > 1 && preg_match('/^[\\w\\_]+$/', $etype[0]) && preg_match('/^[\\w\\_]+$/', $etype[1])) {
            $qaafile = DISCUZ_ROOT . './source/plugin/' . $etype[0] . '/secqaa/secqaa_' . $etype[1] . '.php';
            $class = $etype[1];
        } else {
            $qaafile = libfile('secqaa/' . $_G['cache']['secqaa'][$secqaakey]['question'], 'class');
            $class = $_G['cache']['secqaa'][$secqaakey]['question'];
        }
        if (file_exists($qaafile)) {
            @(include_once $qaafile);
            $class = 'secqaa_' . $class;
            if (class_exists($class)) {
                $qaa = new $class();
                if (method_exists($qaa, 'make')) {
                    $_G['cache']['secqaa'][$secqaakey]['answer'] = md5($qaa->make($_G['cache']['secqaa'][$secqaakey]['question']));
                }
            }
        }
    }
    dsetcookie('secqaa' . $idhash, authcode($_G['cache']['secqaa'][$secqaakey]['answer'] . "\t" . (TIMESTAMP - 180) . "\t" . $idhash . "\t" . FORMHASH, 'ENCODE', $_G['config']['security']['authkey']), 0, 1, true);
    return $_G['cache']['secqaa'][$secqaakey]['question'];
}
예제 #14
0
function deletepost($condition, $unbuffered = true, $deleteattach = true)
{
    global $_G;
    loadcache('posttableids');
    $num = 0;
    if (!empty($_G['cache']['posttableids'])) {
        $posttableids = $_G['cache']['posttableids'];
    } else {
        $posttableids = array('0');
    }
    foreach ($posttableids as $id) {
        if ($id == 0) {
            DB::delete('forum_post', $condition, 0, $unbuffered);
        } else {
            DB::delete("forum_post_{$id}", $condition, 0, $unbuffered);
        }
        $num += DB::affected_rows();
    }
    if ($deleteattach) {
        $query = DB::query("SELECT attachment, thumb, remote, aid FROM " . DB::table('forum_attachment') . " WHERE {$condition}");
        while ($attach = DB::fetch($query)) {
            dunlink($attach);
        }
        DB::delete('forum_attachment', $condition, 0, $unbuffered);
        DB::delete('forum_attachmentfield', $condition, 0, $unbuffered);
    }
    return $num;
}
예제 #15
0
 public function onMobileModule()
 {
     global $_G;
     if (!$_G['setting']['plugins']['available']) {
         return '';
     }
     require_once libfile('function/admincp');
     loadcache('pluginlanguage_script', 1);
     $return = array();
     foreach ($_G['setting']['plugins']['available'] as $pluginid) {
         $row = array();
         $modulefile = DISCUZ_ROOT . './source/plugin/' . $pluginid . '/discuz_mobile_' . $pluginid . '.xml';
         if (file_exists($modulefile)) {
             $_GET['importtxt'] = @implode('', file($modulefile));
             $pluginarray = getimportdata('Discuz! Mobile', 0, 1);
             if ($pluginarray) {
                 foreach ($pluginarray as $name => $value) {
                     $row[] = array('name' => isset($_G['cache']['pluginlanguage_script'][$pluginid][$name]) ? $_G['cache']['pluginlanguage_script'][$pluginid][$name] : $name, 'logo' => $value['logo'], 'url' => preg_match('/^http:\\/\\//', $value['url']) ? $value['url'] : $_G['siteurl'] . $value['url']);
                 }
             }
         }
         $return[$pluginid] = $row;
     }
     return $return;
 }
예제 #16
0
 private function reloadId()
 {
     global $_G;
     loadcache('setting', 1);
     $this->_sId = !empty($_G['setting']['my_siteid']) ? $_G['setting']['my_siteid'] : '';
     $this->_sKey = !empty($_G['setting']['my_sitekey']) ? $_G['setting']['my_sitekey'] : '';
 }
예제 #17
0
 function view($task, $taskvars)
 {
     global $_G;
     $return = $value = '';
     if (!empty($taskvars['complete']['forumid'])) {
         $value = intval($taskvars['complete']['forumid']['value']);
         loadcache('forums');
         $value = '<a href="forum.php?mod=forumdisplay&fid=' . $value . '">' . $_G['cache']['forums'][$value]['name'] . '</a>';
     } elseif (!empty($taskvars['complete']['threadid'])) {
         $value = intval($taskvars['complete']['threadid']['value']);
         $subject = DB::result_first("SELECT subject FROM " . DB::table('forum_thread') . " WHERE tid='{$value}'");
         $value = '<a href="forum.php?mod=viewthread&tid=' . $value . '">' . ($subject ? $subject : 'TID ' . $value) . '</a>';
     } elseif (!empty($taskvars['complete']['author'])) {
         $value = addslashes($taskvars['complete']['author']['value']);
         $authorid = DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='******'");
         $value = '<a href="home.php?mod=space&uid=' . $authorid . '">' . $value . '</a>';
     }
     if ($taskvars['complete']['act']['value'] == 'newreply') {
         if ($taskvars['complete']['threadid']) {
             $return .= lang('task/post', 'task_complete_act_newreply_thread', array('value' => $value, 'num' => $taskvars['complete']['num']['value']));
         } else {
             $return .= lang('task/post', 'task_complete_act_newreply_author', array('value' => $value, 'num' => $taskvars['complete']['num']['value']));
         }
     } else {
         if ($taskvars['complete']['forumid']) {
             $return .= lang('task/post', 'task_complete_forumid', array('value' => $value));
         }
         if ($taskvars['complete']['act']['value'] == 'newthread') {
             $return .= lang('task/post', 'task_complete_act_newthread', array('num' => $taskvars['complete']['num']['value']));
         } else {
             $return .= lang('task/post', 'task_complete_act_newpost', array('num' => $taskvars['complete']['num']['value']));
         }
     }
     return $return;
 }
예제 #18
0
function search_get_usergroups($groupIds)
{
    global $_G;
    require_once DISCUZ_ROOT . './api/manyou/Manyou.php';
    $missGroupIds = array();
    $res = array();
    foreach ($groupIds as $groupId) {
        $kname = 'search_group_hash_' . $groupId;
        loadcache($kname);
        if (TIMESTAMP - $_G['cache'][$kname]['ts'] > 21600) {
            $missGroupIds[] = $groupId;
        } else {
            $res[$groupId]['sign'] = $_G['cache'][$kname]['sign'];
        }
    }
    if ($missGroupIds) {
        $userGroups = SearchHelper::getUserGroupPermissions($missGroupIds);
        foreach ($userGroups as $groupId => $userGroup) {
            $kname = $kname = 'search_group_hash_' . $groupId;
            $data = array('ts' => TIMESTAMP, 'sign' => $userGroup['sign']);
            save_syscache($kname, $data);
            $res[$groupId]['sign'] = $userGroup['sign'];
        }
    }
    return $res;
}
예제 #19
0
 function getsetting()
 {
     global $_G;
     $settings = array('fids' => array('title' => 'interthread_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'interthread_groups', 'type' => 'mselect', 'value' => array()), 'pnumber' => array('title' => 'interthread_pnumber', 'type' => 'mselect', 'value' => array(), 'default' => array(0)));
     loadcache(array('forums', 'grouptype'));
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
     if (empty($_G['cache']['forums'])) {
         $_G['cache']['forums'] = array();
     }
     foreach ($_G['cache']['forums'] as $fid => $forum) {
         $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
     }
     foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
         $settings['groups']['value'][] = array($gid, $group['name']);
         if ($group['secondlist']) {
             foreach ($group['secondlist'] as $sgid) {
                 $settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8) . $_G['cache']['grouptype']['second'][$sgid]['name']);
             }
         }
     }
     for ($i = 1; $i <= $_G['ppp']; $i++) {
         $settings['pnumber']['value'][$i] = array($i, '> #' . $i);
     }
     return $settings;
 }
 private function _getImageInfoCount()
 {
     loadcache('plugin', true);
     $fids = ForumUtils::getForumPhotoGalleryShowFids();
     $count = DzPictureSet::getImageListCount($fids);
     return $count;
 }
예제 #21
0
 function getsetting()
 {
     global $_G;
     $settings = $this->setting;
     if ($settings['catid']) {
         $settings['catid']['value'][] = array(0, lang('portalcp', 'block_all_category'));
         loadcache('albumcategory');
         foreach ($_G['cache']['albumcategory'] as $value) {
             if ($value['level'] == 0) {
                 $settings['catid']['value'][] = array($value['catid'], $value['catname']);
                 if ($value['children']) {
                     foreach ($value['children'] as $catid2) {
                         $value2 = $_G['cache']['albumcategory'][$catid2];
                         $settings['catid']['value'][] = array($value2['catid'], '-- ' . $value2['catname']);
                         if ($value2['children']) {
                             foreach ($value2['children'] as $catid3) {
                                 $value3 = $_G['cache']['albumcategory'][$catid3];
                                 $settings['catid']['value'][] = array($value3['catid'], '---- ' . $value3['catname']);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $settings;
 }
예제 #22
0
 function getsetting()
 {
     global $_G;
     $settings = array('fids' => array('title' => 'footerbanner_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'footerbanner_groups', 'type' => 'mselect', 'value' => array()), 'category' => array('title' => 'footerbanner_category', 'type' => 'mselect', 'value' => array()), 'position' => array('title' => 'footerbanner_position', 'type' => 'mradio', 'value' => array(array(1, 'footerbanner_position_up'), array(2, 'footerbanner_position_middle'), array(3, 'footerbanner_position_down')), 'default' => 1));
     loadcache(array('forums', 'grouptype'));
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'footerbanner_index');
     $settings['fids']['value'][] = array(-2, 'Archiver');
     if (empty($_G['cache']['forums'])) {
         $_G['cache']['forums'] = array();
     }
     foreach ($_G['cache']['forums'] as $fid => $forum) {
         $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
     }
     foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
         $settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4) . $group['name']);
         if ($group['secondlist']) {
             foreach ($group['secondlist'] as $sgid) {
                 $settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8) . $_G['cache']['grouptype']['second'][$sgid]['name']);
             }
         }
     }
     loadcache('portalcategory');
     $this->categoryvalue[] = array(-1, 'footerbanner_index');
     $this->getcategory(0);
     $settings['category']['value'] = $this->categoryvalue;
     return $settings;
 }
 function getdata($style, $parameter)
 {
     global $_G;
     $parameter = $this->cookparameter($parameter);
     loadcache('portalcategory');
     $thecatid = !empty($parameter['thecatid']) ? explode(',', $parameter['thecatid']) : array();
     if (!empty($parameter['catid'])) {
         $catid = $parameter['catid'];
     } else {
         $catid = array_keys($_G['cache']['portalcategory']);
         $catid[] = '0';
     }
     $orderby = $parameter['orderby'] == 'articles' ? ' ORDER BY articles DESC' : ' ORDER BY displayorder';
     $wheres = array();
     if ($thecatid) {
         $wheres[] = "catid IN (" . dimplode($thecatid) . ")";
     }
     if ($catid) {
         $wheres[] = "upid IN (" . dimplode($catid) . ")";
     }
     $wheresql = $wheres ? implode(' AND ', $wheres) : '1';
     $list = array();
     $query = DB::query('SELECT * FROM ' . DB::table('portal_category') . " WHERE {$wheresql} {$orderby}");
     while ($data = DB::fetch($query)) {
         $list[] = array('id' => $data['catid'], 'idtype' => 'catid', 'title' => htmlspecialchars($data['catname']), 'url' => $_G['cache']['portalcategory'][$data['catid']]['caturl'], 'pic' => '', 'picflag' => '0', 'summary' => '', 'fields' => array('dateline' => $data['dateline'], 'articles' => $data['articles']));
     }
     return array('html' => '', 'data' => $list);
 }
예제 #24
0
 function common()
 {
     global $_G;
     $this->page = intval($_GET['page']) ? intval($_GET['page']) : 1;
     loadcache('forum_guide');
     $dateline = 0;
     $maxnum = 50000;
     if ($_G['setting']['guide']['newdt']) {
         $dateline = time() - intval($_G['setting']['guide']['newdt']);
     }
     $maxtid = C::t('forum_thread')->fetch_max_tid();
     $limittid = max(0, $maxtid - $maxnum);
     $tids = array_slice($_G['cache']['forum_guide']['new']['data'], ($this->page - 1) * $this->perpage, $this->perpage);
     $query = C::t('forum_thread')->fetch_all_for_guide('new', $limittid, $tids, $_G['setting']['heatthread']['guidelimit'], $dateline);
     $threadlist = array();
     rsort($query);
     foreach ($query as $thread) {
         $this->field('author', '0', $thread['author']);
         $this->field('dateline', '0', $thread['dateline']);
         $this->field('replies', '1', $thread['replies']);
         $this->field('views', '2', $thread['views']);
         $this->id = $thread['tid'];
         $this->title = $thread['subject'];
         $this->image = '';
         $this->icon = '1';
         $this->poptype = '0';
         $this->popvalue = '';
         $this->clicktype = 'tid';
         $this->clickvalue = $thread['tid'];
         $this->insertrow();
     }
 }
예제 #25
0
파일: adv_text.php 프로젝트: softhui/discuz
 function getsetting()
 {
     global $_G;
     $settings = array('fids' => array('title' => 'text_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'text_groups', 'type' => 'mselect', 'value' => array()), 'category' => array('title' => 'text_category', 'type' => 'mselect', 'value' => array()));
     loadcache(array('forums', 'grouptype'));
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'text_index');
     if (empty($_G['cache']['forums'])) {
         $_G['cache']['forums'] = array();
     }
     foreach ($_G['cache']['forums'] as $fid => $forum) {
         $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
     }
     foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
         $settings['groups']['value'][] = array($gid, $group['name']);
         if ($group['secondlist']) {
             foreach ($group['secondlist'] as $sgid) {
                 $settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 4) . $_G['cache']['grouptype']['second'][$sgid]['name']);
             }
         }
     }
     loadcache('portalcategory');
     $this->getcategory(0);
     $settings['category']['value'] = $this->categoryvalue;
     return $settings;
 }
예제 #26
0
 function getdata($style, $parameter)
 {
     global $_G;
     $parameter = $this->cookparameter($parameter);
     $fups = isset($parameter['fups']) && !in_array(0, (array) $parameter['fups']) ? $parameter['fups'] : '';
     $orderby = isset($parameter['orderby']) ? in_array($parameter['orderby'], array('displayorder', 'threads', 'posts', 'todayposts')) ? $parameter['orderby'] : 'displayorder' : 'displayorder';
     $titlelength = isset($parameter['titlelength']) ? intval($parameter['titlelength']) : 40;
     $summarylength = isset($parameter['summarylength']) ? intval($parameter['summarylength']) : 80;
     $startrow = isset($parameter['startrow']) ? intval($parameter['startrow']) : 0;
     $items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
     $bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
     $sqlban = !empty($bannedids) ? ' AND f.fid NOT IN (' . dimplode($bannedids) . ')' : '';
     if (empty($fups)) {
         loadcache('forums');
         if (empty($_G['cache']['forums'])) {
             $fups = array('0');
         } else {
             $fups = array_keys($_G['cache']['forums']);
         }
     }
     $ffadd1 = ", ff.icon, ff.description";
     $ffadd2 = "LEFT JOIN `" . DB::table('forum_forumfield') . "` ff ON f.`fid`=ff.`fid`";
     $query = DB::query("SELECT f.* {$ffadd1}\r\n\t\t\tFROM `" . DB::table('forum_forum') . "` f {$ffadd2}\r\n\t\t\tWHERE\r\n\t\t\t" . ($fups ? "f.`fup` IN (" . dimplode($fups) . ") " : "1 ") . "\r\n\t\t\tAND f.`status`='1' AND f.`type`!='group'\r\n\t\t\t{$sqlban}\r\n\t\t\tORDER BY " . ($orderby == 'displayorder' ? "f.fup, f.`displayorder` ASC " : "f.`{$orderby}` DESC") . " LIMIT {$startrow}, {$items}");
     $datalist = $list = array();
     $attachurl = preg_match('/^(http|ftp|ftps|https):\\/\\//', $_G['setting']['attachurl']) ? $_G['setting']['attachurl'] : $_G['siteurl'] . $_G['setting']['attachurl'];
     while ($data = DB::fetch($query)) {
         if (!empty($data['icon'])) {
             $data['icon'] = preg_match('/^(http|ftp|ftps|https):\\/\\//', $data['icon']) ? $data['icon'] : $attachurl . 'common/' . $data['icon'];
         } else {
             $data['icon'] = 'static/image/common/forum_new.gif';
         }
         $list[] = array('id' => $data['fid'], 'idtype' => 'fid', 'title' => cutstr($data['name'], $titlelength, ''), 'url' => 'forum.php?mod=forumdisplay&fid=' . $data['fid'], 'pic' => '', 'summary' => cutstr($data['description'], $summarylength, ''), 'fields' => array('fulltitle' => $data['name'], 'icon' => $data['icon'], 'threads' => intval($data['threads']), 'posts' => intval($data['posts']), 'todayposts' => intval($data['todayposts'])));
     }
     return array('html' => '', 'data' => $list);
 }
예제 #27
0
function updategroupcreditlog($fid, $uid)
{
    global $_G;
    if (empty($fid) || empty($uid)) {
        return false;
    }
    $today = date('Ymd', TIMESTAMP);
    $updategroupcredit = getcookie('groupcredit_' . $fid);
    if ($updategroupcredit < $today) {
        $status = DB::result_first("SELECT logdate FROM " . DB::table('forum_groupcreditslog') . " WHERE fid='{$fid}' AND uid='{$uid}' AND logdate='{$today}'");
        if (empty($status)) {
            DB::query("UPDATE " . DB::table('forum_forum') . " SET commoncredits=commoncredits+1 WHERE fid='{$fid}'");
            DB::query("REPLACE INTO " . DB::table('forum_groupcreditslog') . " (fid, uid, logdate) VALUES ('{$fid}', '{$uid}', '{$today}')");
            if (empty($_G['forum']) || empty($_G['forum']['level'])) {
                $forum = DB::fetch_first("SELECT name, level, commoncredits FROM " . DB::table('forum_forum') . " WHERE fid='{$fid}'");
            } else {
                $_G['forum']['commoncredits']++;
                $forum =& $_G['forum'];
            }
            if (empty($_G['grouplevels'])) {
                loadcache('grouplevels');
            }
            $grouplevel = $_G['grouplevels'][$forum['level']];
            if ($grouplevel['type'] == 'default' && !($forum['commoncredits'] >= $grouplevel['creditshigher'] && $forum['commoncredits'] < $grouplevel['creditslower'])) {
                $levelid = DB::result_first("SELECT levelid FROM " . DB::table('forum_grouplevel') . " WHERE type='default' AND creditshigher<='{$forum['commoncredits']}' AND creditslower>'{$forum['commoncredits']}' LIMIT 1");
                if (!empty($levelid)) {
                    DB::query("UPDATE " . DB::table('forum_forum') . " SET level='{$levelid}' WHERE fid='{$fid}'");
                    $groupfounderuid = DB::result_first("SELECT founderuid FROM " . DB::table('forum_forumfield') . " WHERE fid='{$fid}' LIMIT 1");
                    notification_add($groupfounderuid, 'system', 'grouplevel_update', array('groupname' => '<a href="forum.php?mod=group&fid=' . $fid . '">' . $forum['name'] . '</a>', 'newlevel' => $_G['grouplevels'][$levelid]['leveltitle']));
                }
            }
        }
        dsetcookie('groupcredit_' . $fid, $today, 86400);
    }
}
예제 #28
0
 function usesubmit()
 {
     global $_G;
     $list = $uids = array();
     $num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
     $limit = $num + 20;
     loadcache('magics');
     $mid = !empty($_G['magics']['gift']) ? intval($_G['magics']['gift']['magicid']) : 0;
     if ($mid) {
         $query = DB::query('SELECT * FROM ' . DB::table('common_magiclog') . " WHERE magicid = '{$mid}' AND action='2' AND uid != '{$_G['uid']}' ORDER BY dateline DESC LIMIT 0,{$limit}");
         while ($value = DB::fetch($query)) {
             $uids[] = intval($value['uid']);
         }
     }
     if ($uids) {
         $counter = 0;
         $query = DB::query('SELECT m.username, mfh.uid, mfh.magicgift FROM ' . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_field_home') . " mfh USING(uid) WHERE m.uid IN (" . dimplode($uids) . ")");
         while ($value = DB::fetch($query)) {
             $info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array();
             if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) {
                 $value['avatar'] = addcslashes(avatar($value['uid'], 'small'), "'");
                 $list[$value['uid']] = $value;
                 $counter++;
                 if ($counter >= $num) {
                     break;
                 }
             }
         }
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
     $op = 'show';
     include template('home/magic_detector');
 }
예제 #29
0
 function getsetting()
 {
     global $_G;
     $settings = array('fids' => array('title' => 'cornerbanner_fids', 'type' => 'mselect', 'value' => array()), 'groups' => array('title' => 'cornerbanner_groups', 'type' => 'mselect', 'value' => array()), 'category' => array('title' => 'cornerbanner_category', 'type' => 'mselect', 'value' => array()), 'disableclose' => array('title' => 'cornerbanner_disableclose', 'type' => 'mradio', 'value' => array(array(0, 'cornerbanner_show'), array(1, 'cornerbanner_hidden')), 'default' => 0), 'animator' => array('title' => 'cornerbanner_animator', 'type' => 'radio', 'default' => 0));
     loadcache(array('forums', 'grouptype'));
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(0, '&nbsp;');
     $settings['fids']['value'][] = $settings['groups']['value'][] = array(-1, 'cornerbanner_index');
     if (empty($_G['cache']['forums'])) {
         $_G['cache']['forums'] = array();
     }
     foreach ($_G['cache']['forums'] as $fid => $forum) {
         $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')) . $forum['name']);
     }
     foreach ($_G['cache']['grouptype']['first'] as $gid => $group) {
         $settings['groups']['value'][] = array($gid, str_repeat('&nbsp;', 4) . $group['name']);
         if ($group['secondlist']) {
             foreach ($group['secondlist'] as $sgid) {
                 $settings['groups']['value'][] = array($sgid, str_repeat('&nbsp;', 8) . $_G['cache']['grouptype']['second'][$sgid]['name']);
             }
         }
     }
     loadcache('portalcategory');
     $this->categoryvalue[] = array(-1, 'cornerbanner_index');
     $this->getcategory(0);
     $settings['category']['value'] = $this->categoryvalue;
     return $settings;
 }
function get_forums()
{
    global $wf_forum_limit, $wf_forum_display_limit_on, $_G;
    loadcache('forums');
    $forumarray = array();
    foreach ($_G['cache']['forums'] as $forum) {
        if ($forum['type'] == 'group') {
            $forumarray[$forum['fid']] = $forum;
        } else {
            if (isset($forumarray[$forum['fup']]) && in_array($forum['fid'], $wf_forum_limit)) {
                foreach ($_G['cache']['forums'] as $subforum) {
                    if ($subforum['type'] == 'sub' && $subforum['fup'] == $forum['fid']) {
                        $forum['sub'][$subforum['fid']] = $subforum['fid'];
                    }
                }
                $forumarray[$forum['fup']]['sub'][$forum['fid']] = $forum;
            }
        }
    }
    foreach ($forumarray as $key => $group) {
        if (empty($group['sub'])) {
            unset($forumarray[$key]);
        }
    }
    return $forumarray;
}