function build_cache_fields_connect_register()
{
    global $_G;
    $data = array();
    $fields = array();
    if ($_G['setting']['connect']['register_gender']) {
        $fields[] = 'gender';
    }
    if ($_G['setting']['connect']['register_birthday']) {
        $fields[] = 'birthyear';
        $fields[] = 'birthmonth';
        $fields[] = 'birthday';
    }
    if ($fields) {
        foreach (C::t('common_member_profile_setting')->fetch_all($fields) as $field) {
            $choices = array();
            if ($field['selective']) {
                foreach (explode("\n", $field['choices']) as $item) {
                    list($index, $choice) = explode('=', $item);
                    $choices[trim($index)] = trim($choice);
                }
                $field['choices'] = $choices;
            } else {
                unset($field['choices']);
            }
            $field['showinregister'] = 1;
            $field['available'] = 1;
            $data['field_' . $field['fieldid']] = $field;
        }
    }
    savecache('fields_connect_register', $data);
}
예제 #2
0
function build_cache_stamps()
{
    $data = array();
    $fillarray = range(0, 99);
    $count = 0;
    $repeats = $stampicon = array();
    foreach (C::t('common_smiley')->fetch_all_by_type(array('stamp', 'stamplist')) as $stamp) {
        if (isset($fillarray[$stamp['displayorder']])) {
            unset($fillarray[$stamp['displayorder']]);
        } else {
            $repeats[] = $stamp['id'];
        }
        $count++;
    }
    foreach ($repeats as $id) {
        reset($fillarray);
        $displayorder = current($fillarray);
        unset($fillarray[$displayorder]);
        C::t('common_smiley')->update($id, array('displayorder' => $displayorder));
    }
    foreach (C::t('common_smiley')->fetch_all_by_type('stamplist') as $stamp) {
        if ($stamp['typeid'] < 1) {
            continue;
        }
        $row = C::t('common_smiley')->fetch_by_id_type($stamp['typeid'], 'stamp');
        $stampicon[$row['displayorder']] = $stamp['displayorder'];
    }
    foreach (C::t('common_smiley')->fetch_all_by_type(array('stamp', 'stamplist')) as $stamp) {
        $icon = $stamp['type'] == 'stamp' ? isset($stampicon[$stamp['displayorder']]) ? $stampicon[$stamp['displayorder']] : 0 : ($stamp['type'] == 'stamplist' && !in_array($stamp['displayorder'], $stampicon) ? 1 : 0);
        $data[$stamp['displayorder']] = array('url' => $stamp['url'], 'text' => $stamp['code'], 'type' => $stamp['type'], 'icon' => $icon);
    }
    savecache('stamps', $data);
}
예제 #3
0
 public function fetch_by_picid($picid, $havecount = false)
 {
     //返回一条数据同时加载附件表数据
     global $_G;
     $picid = intval($picid);
     $image = $attachment = array();
     $image = self::fetch($picid);
     if ($image['aid']) {
         $attachment = C::t('attachment')->fetch($image['aid']);
     }
     $data = array_merge($attachment, $image);
     $data['title'] = $data['filename'];
     //$data['url']=getAttachUrl($data,true);
     //if($data['thumb']) $data['icon']=getimgthumbname($_G['setting']['attachurl'].$data['attachment']);
     //else $data['icon']=$data['url'];
     /*if($data['thumb']>1){
     			$data['url']=getimgthumbname($data['url'].'.1440x900');
     		}*/
     $data['ext'] = $data['filetype'];
     $data['size'] = $data['filesize'];
     if ($havecount) {
         $count = C::t('count')->fetch_by_type($picid, 'image');
         $data['viewnum'] = intval($count['viewnum']);
         $data['replynum'] = intval($count['replynum']);
         $data['downnum'] = intval($count['downnum']);
         $data['star'] = intval($count['star']);
         $data['starnum'] = intval($count['starnum']);
     }
     return $data;
 }
예제 #4
0
 function csc($task = array())
 {
     global $_G;
     $taskvars = array('num' => 0);
     $num = 0;
     foreach (C::t('common_taskvar')->fetch_all_by_taskid($task['taskid']) as $taskvar) {
         if ($taskvar['value']) {
             $taskvars[$taskvar['variable']] = $taskvar['value'];
         }
     }
     $taskvars['time'] = floatval($taskvars['time']);
     if ($taskvars['act'] == 'favorite') {
         $favorite = C::t('forum_spacecache')->fetch($_G['uid'], 'favorite' . $task['taskid']);
         $favorite = $favorite['value'];
         $num = C::t('home_favorite')->count_by_uid_idtype($_G['uid'], 'tid') - $favorite;
     } elseif ($taskvars['act'] == 'magic') {
         $maxtime = $taskvars['time'] ? $task['applytime'] + 3600 * $taskvars['time'] : 0;
         $num = C::t('common_magiclog')->count_by_action_uid_dateline(2, $_G['uid'], $task['applytime'], $maxtime);
     } elseif ($taskvars['act'] == 'userapp') {
         $userapp = C::t('forum_spacecache')->fetch($_G['uid'], 'userapp' . $task['taskid']);
         $userapp = $userapp['value'];
         $num = C::t('home_userapp')->count_by_uid($_G['uid']) - $userapp;
     }
     if ($num && $num >= $taskvars['num']) {
         if ($taskvars['act'] == 'favorite' || $taskvars['act'] == 'userapp') {
             C::t('forum_spacecache')->delete($_G['uid'], $taskvars['act'] . $task['taskid']);
         }
         return TRUE;
     } elseif ($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) {
         return FALSE;
     } else {
         return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0);
     }
 }
예제 #5
0
function build_cache_usergroups_single()
{
    $pluginvalue = pluginsettingvalue('groups');
    $allowthreadplugin = C::t('common_setting')->fetch('allowthreadplugin', true);
    $data_uf = C::t('common_usergroup_field')->range();
    $data_ag = C::t('common_admingroup')->range();
    foreach (C::t('common_usergroup')->range() as $gid => $data) {
        $data = array_merge($data, (array) $data_uf[$gid], (array) $data_ag[$gid]);
        $ratearray = array();
        if ($data['raterange']) {
            foreach (explode("\n", $data['raterange']) as $rating) {
                $rating = explode("\t", $rating);
                $ratearray[$rating[0]] = array('isself' => $rating[1], 'min' => $rating[2], 'max' => $rating[3], 'mrpd' => $rating[4]);
            }
        }
        $data['raterange'] = $ratearray;
        $data['grouptitle'] = $data['color'] ? '<font color="' . $data['color'] . '">' . $data['grouptitle'] . '</font>' : $data['grouptitle'];
        $data['grouptype'] = $data['type'];
        $data['grouppublic'] = $data['system'] != 'private';
        $data['groupcreditshigher'] = $data['creditshigher'];
        $data['groupcreditslower'] = $data['creditslower'];
        $data['maxspacesize'] = intval($data['maxspacesize']) * 1024 * 1024;
        $data['allowthreadplugin'] = !empty($allowthreadplugin[$data['groupid']]) ? $allowthreadplugin[$data['groupid']] : array();
        $data['plugin'] = $pluginvalue[$data['groupid']];
        unset($data['type'], $data['system'], $data['creditshigher'], $data['creditslower'], $data['groupavatar'], $data['admingid']);
        savecache('usergroup_' . $data['groupid'], $data);
    }
}
예제 #6
0
 public function check()
 {
     $forumlist = C::t('forum_forum')->fetch_all_by_recyclebin();
     if (empty($forumlist)) {
         $return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_recyclebin_no_need'));
     } else {
         $forumdesc = '';
         $adminfile = defined(ADMINSCRIPT) ? ADMINSCRIPT : 'admin.php';
         $k = 1;
         foreach ($forumlist as $forum) {
             $forumdesc .= '<p class="recyclebinforumlist" ' . ($k > 2 ? 'style="display:none;"' : '') . '><a href="' . $adminfile . '"?action=forums&operation=edit&fid=' . $forum['fid'] . ' target="_blank">' . $forum['name'] . '</a></p>';
             if ($k == 3) {
                 $forumdesc .= '<p id="recyclebinmore"><a href="javascript:;" onclick="showlistmore(\\\'recyclebinmore\\\',\\\'recyclebinforumlist\\\');">' . lang('admincp', 'more') . '</a></p>';
             }
             $k++;
         }
         $extraurl = '';
         if (count($forumlist) == 1) {
             $extraurl = '&optimizefid=' . $forum['fid'];
             $forumdesc = '';
         }
         $return = array('status' => 1, 'type' => 'view', 'lang' => lang('optimizer', 'optimizer_recyclebin_need', array('forumdesc' => $forumdesc)), 'extraurl' => $extraurl);
     }
     return $return;
 }
 public function fetch_all($uids, $force_from_db = false, $fetch_archive = 1)
 {
     $data = array();
     if (!empty($uids)) {
         if ($force_from_db || ($data = $this->fetch_cache($uids)) === false || count($uids) != count($data)) {
             if (is_array($data) && !empty($data)) {
                 $uids = array_diff($uids, array_keys($data));
             }
             if ($data === false) {
                 $data = array();
             }
             if (!empty($uids)) {
                 $query = DB::query('SELECT ' . implode(',', $this->_fields) . ' FROM ' . DB::table($this->_table) . ' WHERE ' . DB::field($this->_pk, $uids));
                 while ($value = DB::fetch($query)) {
                     $data[$value[$this->_pk]] = $value;
                     $this->store_cache($value[$this->_pk], $value);
                 }
             }
         }
         if (isset($this->membersplit) && $fetch_archive && count($data) != count($uids)) {
             $data = $data + C::t($this->_table . '_archive')->fetch_all(array_diff($uids, array_keys($data)), null, 0);
         }
     }
     return $data;
 }
예제 #8
0
function build_cache_diytemplatename()
{
    $data = array();
    $apps = array('portal', 'forum', 'group', 'home');
    $nullname = lang('portalcp', 'diytemplate_name_null');
    $scriptarr = $lostname = array();
    foreach (C::t('common_diy_data')->range() as $datarow) {
        $datarow['name'] = $datarow['name'] ? $datarow['name'] : lang('portalcp', $datarow['targettplname'], '', '');
        if (empty($datarow['name'])) {
            $lostname[$datarow['targettplname']] = $datarow['targettplname'];
            $datarow['name'] = $nullname;
        }
        $data[$datarow['targettplname']] = dhtmlspecialchars($datarow['name']);
        $curscript = substr($datarow['targettplname'], 0, strpos($datarow['targettplname'], '/'));
        if (in_array($curscript, $apps)) {
            $scriptarr[$curscript][$datarow['targettplname']] = true;
        }
    }
    if ($lostname) {
        require_once libfile('function/portalcp');
        foreach (getdiytplnames($lostname) as $pre => $datas) {
            foreach ($datas as $id => $name) {
                $data[$pre . $id] = $name;
            }
        }
    }
    savecache('diytemplatename', $data);
    foreach ($scriptarr as $curscript => $value) {
        savecache('diytemplatename' . $curscript, $value);
    }
}
예제 #9
0
 private function getGlobalPostString($action)
 {
     global $_G;
     $setting = $_G['setting'];
     $mySiteId = empty($_G['setting']['my_siteid']) ? '' : $_G['setting']['my_siteid'];
     $siteName = $_G['setting']['bbname'];
     $siteUrl = $_G['siteurl'];
     $ucUrl = rtrim($_G['setting']['ucenterurl'], '/') . '/';
     $siteCharset = $_G['charset'];
     $siteTimeZone = $_G['setting']['timeoffset'];
     $mySiteKey = empty($_G['setting']['my_sitekey']) ? '' : $_G['setting']['my_sitekey'];
     $siteKey = C::t('common_setting')->fetch('siteuniqueid');
     $siteLanguage = $_G['config']['output']['language'];
     $siteVersion = $_G['setting']['version'];
     $utilService = Cloud::loadClass('Service_Util');
     $myVersion = $utilService->getApiVersion();
     $productType = 'DISCUZX';
     $siteRealNameEnable = '';
     $siteRealAvatarEnable = '';
     $siteEnableApp = intval($setting['my_app_status']);
     $key = $mySiteId . $siteName . $siteUrl . $ucUrl . $siteCharset . $siteTimeZone . $siteRealNameEnable . $mySiteKey . $siteKey;
     $key = md5($key);
     $siteTimeZone = urlencode($siteTimeZone);
     $siteName = urlencode($siteName);
     $register = false;
     return sprintf('action=%s&productType=%s&key=%s&mySiteId=%d&siteName=%s&siteUrl=%s&ucUrl=%s&siteCharset=%s&siteTimeZone=%s&siteEnableRealName=%s&siteEnableRealAvatar=%s&siteKey=%s&siteLanguage=%s&siteVersion=%s&myVersion=%s&siteEnableApp=%s&from=cloud', $action, $productType, $key, $mySiteId, $siteName, $siteUrl, $ucUrl, $siteCharset, $siteTimeZone, $siteRealNameEnable, $siteRealAvatarEnable, $siteKey, $siteLanguage, $siteVersion, $myVersion, $siteEnableApp);
 }
 private function _updatePass($res, $oldpassword, $newpassword)
 {
     global $_G;
     $oldpassword = $oldpassword ? urldecode($oldpassword) : '';
     $newpassword = $newpassword ? urldecode($newpassword) : '';
     if (!empty($newpassword) && $newpassword != addslashes($newpassword)) {
         // 抱歉,密码空或包含非法字符:新密码
         return $this->makeErrorInfo($res, lang('message', 'profile_passwd_illegal'));
     }
     loaducenter();
     $ucresult = uc_user_edit(addslashes($_G['username']), $oldpassword, $newpassword);
     if ($ucresult == -1) {
         // 原密码不正确,您不能修改密码或 Email 或安全提问
         return $this->makeErrorInfo($res, lang('message', 'profile_passwd_wrong'));
     }
     $setarr['password'] = md5(random(10));
     C::t('common_member')->update($_G['uid'], $setarr);
     $secretStr = AppbymeUserAccess::getSecretStr($_G['uid'], $newpassword);
     $newAccessSecret = $secretStr['accessSecret'];
     $data = array('user_access_secret' => $newAccessSecret);
     $result = AppbymeUserAccess::updateUserAccess($data, $_G['uid']);
     // if (!$result) {
     //     return $this->makeErrorInfo($res, 'user_info_edit_error');
     // }
     $res['token'] = $secretStr['accessToken'];
     $res['secret'] = $newAccessSecret;
     return $res;
 }
예제 #11
0
 function output()
 {
     global $_G;
     //如果拉取过,就在db里面标明
     if (isset($_REQUEST['pull']) && isset($_REQUEST['pull']) == '1') {
         $setting = array('bigapp_similes_zip' => '1');
         C::t('common_setting')->update_batch($setting);
         $variable['pull'] = '1';
     } else {
         if (!isset($_REQUEST['type']) || isset($_REQUEST['type']) && $_REQUEST['type'] == '0') {
             //$type_cnt = 0;
             foreach (C::t('forum_imagetype')->fetch_all_by_type('smiley') as $type) {
                 $available = $type['available'];
                 if ($available == '0') {
                     continue;
                 }
                 $id = $type['typeid'];
                 $tmp = array();
                 $tmp['name'] = $type['name'];
                 $tmp['directory'] = $type['directory'];
                 $smiley_cnt = 0;
                 foreach (C::t('common_smiley')->fetch_all_by_typeid_type($id, 'smiley') as $smiley) {
                     $tmp['smiley'][$smiley_cnt]['code'] = $smiley['code'];
                     $tmp['smiley'][$smiley_cnt]['url'] = $smiley['url'];
                     $tmp['smiley'][$smiley_cnt]['id'] = $smiley['id'];
                     $smiley_cnt++;
                 }
                 $variable['smilies'][] = $tmp;
             }
         }
     }
     bigapp_core::result(bigapp_core::variable($variable));
 }
예제 #12
0
 public function onNotificationsGet($uId)
 {
     $notify = $result = array();
     $result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
     $i = 0;
     foreach (C::t('home_notification')->fetch_all_by_uid($uId, 1) as $value) {
         $i++;
         if (!$result['notification']['mostRecent']) {
             $result['notification']['mostRecent'] = $value['dateline'];
         }
     }
     $result['notification']['unread'] = $i;
     loaducenter();
     $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
     if ($pmarr['count']) {
         $result['message']['unread'] = $pmarr['count'];
         $result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
     }
     $fIds = array();
     foreach (C::t('home_friend_request')->fetch_all_by_uid($uId) as $value) {
         if (!$result['friendRequest']['mostRecent']) {
             $result['friendRequest']['mostRecent'] = $value['dateline'];
         }
         $fIds[] = $value['uid'];
     }
     $result['friendRequest']['uIds'] = $fIds;
     return $result;
 }
예제 #13
0
 function plugin_myrepeats()
 {
     global $_G;
     if (!$_G['uid']) {
         return;
     }
     /* 读取可以使用马甲的用户组 usergroups 变量值。需要注意参数的读取方式,详情见插件手册-参数读取		。 */
     $myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['use		rgroups']);
     if (in_array('', $myrepeatsusergroups)) {
         $myrepeatsusergroups = array();
     }
     $userlist = array();
     /* 对当前登录用户进行马甲验证, 即当前用户组不再权限许可范围内, 但其他帐号所在用户组有权限, 则当		前用户也有使用权限。*/
     if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
         if (!isset($_G['cookie']['myrepeat_rr'])) {
             /* 这里需要注意一下你所建的数据表对象的构建, 即 source/plugin/myrepeats/t				able/下的 table_新建表名.php */
             $users = count(C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']));
             dsetcookie('myrepeat_rr', 'R' . $users, 86400);
         } else {
             $users = substr($_G['cookie']['myrepeat_rr'], 1);
         }
         if (!$users) {
             return '';
         }
     }
     /* 前台显示代码 */
     $this->value['global_usernav_extra1'] = '<script>' . 'function showmyrepeats() {if(!$(\'myrepeats_menu\')) {' . 'menu=document.createElement(\'div\');menu.id=\'myrepeats_menu\';menu.style			.display=\'none\';menu.className=\'p_pop\';' . '$(\'append_parent\').appendChild(menu);' . 'ajaxget(\'plugin.php?id=myrepeats:switch&list=yes\',\'myrepeats_menu\',\'a			jaxwaitid\');}' . 'showMenu({\'ctrlid\':\'myrepeats\',\'duration\':2});}' . '</script>' . '<span class="pipe">|</span><a id="myrepeats" href="home.php?mod=spacecp&ac=plugin&		id=myrepeats:memcp" class="showmenu cur1" onmouseover="delayShow(this, showmyrepeat		s)">' . lang('plugin/myrepeats', 'switch') . '</a>' . "\n";
 }
예제 #14
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();
     }
 }
예제 #15
0
 public static function output()
 {
     global $_G;
     if (!empty($_G['uid'])) {
         if (self::$tmpavatarbig && self::$tmpavatarmiddle && self::$tmpavatarsmall) {
             $avatar1 = self::byte2hex(file_get_contents(self::$tmpavatarbig));
             $avatar2 = self::byte2hex(file_get_contents(self::$tmpavatarmiddle));
             $avatar3 = self::byte2hex(file_get_contents(self::$tmpavatarsmall));
             $extra = '&avatar1=' . $avatar1 . '&avatar2=' . $avatar2 . '&avatar3=' . $avatar3;
             $result = self::uc_api_post_ex('user', 'rectavatar', array('uid' => $_G['uid']), $extra);
             @unlink(self::$tmpavatar);
             @unlink(self::$tmpavatarbig);
             @unlink(self::$tmpavatarmiddle);
             @unlink(self::$tmpavatarsmall);
             if ($result == '<?xml version="1.0" ?><root><face success="1"/></root>') {
                 $variable = array('uploadavatar' => 'api_uploadavatar_success');
                 $tableext = '';
                 $member = C::t('common_member')->fetch($_G['uid'], false, 1);
                 if (!$member) {
                     self::error('api_uploadavatar_user_not_exists');
                 }
                 $tableext = isset($member['_inarchive']) ? '_archive' : '';
                 C::t('common_member' . $tableext)->update($_G['uid'], array('avatarstatus' => '1'));
                 bigapp_core::result(bigapp_core::variable($variable));
             } else {
                 self::error('api_uploadavatar_uc_error');
             }
         }
     } else {
         self::error('api_uploadavatar_unavailable_user');
     }
 }
예제 #16
0
 function usesubmit()
 {
     global $_G;
     $info = array('credits' => intval($_POST['credits']), 'percredit' => intval($_POST['percredit']), 'credittype' => $_GET['credittype'], 'left' => intval($_POST['credits']), 'magicid' => intval($this->magic['magicid']), 'receiver' => array());
     if ($info['credits'] < 1) {
         showmessage(lang('magic/gift', 'gift_bad_credits_input'));
     }
     if ($info['percredit'] < 1 || $info['percredit'] > $info['credits']) {
         showmessage(lang('magic/gift', 'gift_bad_percredit_input'));
     }
     $member = array();
     if (preg_match('/^extcredits[1-8]$/', $info['credittype'])) {
         $member = C::t('common_member_count')->fetch($_G['uid']);
         if ($member[$info['credittype']] < $info['credits']) {
             showmessage(lang('magic/gift', 'gift_credits_out_of_own'));
         }
         $extcredits = str_replace('extcredits', '', $info['credittype']);
         updatemembercount($_G['uid'], array($extcredits => -$info['credits']), 1, 'BGC', $this->magic['magicid']);
     } else {
         showmessage(lang('magic/gift', 'gift_bad_credittype_input'));
     }
     C::t('common_member_field_home')->update($_G['uid'], array('magicgift' => serialize($info)));
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
     showmessage(lang('magic/gift', 'gift_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
 }
예제 #17
0
 public function addtags($tags, $appid)
 {
     if (!$tags) {
         C::t('app_relative')->delete_by_appid($appid);
         return;
     }
     if (!is_array($tags)) {
         if (strpos($tags, "','") !== false) {
             $tagnames = explode("','", trim($tags, "'"));
         } elseif (strpos($tags, ',') !== false) {
             $tagnames = explode(',', trim($tags));
         } else {
             $tagnames = array(trim($tags, "'"));
         }
     } else {
         $tagnames = $tags;
     }
     $tagarr = DB::fetch_all('SELECT tagid,tagname FROM ' . DB::table($this->_table) . "  WHERE  tagname IN( " . dimplode($tagnames) . ")");
     $have_tagnames = array();
     $have_tagids = array();
     foreach ($tagarr as $tagid => $value) {
         $have_tagnames[] = $value['tagname'];
         $have_tagids[] = $value['tagid'];
     }
     //已经存在的增加hot +1;
     DB::query("UPDATE " . DB::table($this->_table) . " SET hot=hot+1 WHERE tagid IN(%n)", array($have_tagids));
     $insert_names = array_diff($tagnames, $have_tagnames);
     foreach ($insert_names as $name) {
         $have_tagids[] = self::insert(array('tagname' => $name, 'dateline' => TIMESTAMP, 'hot' => 1), 1);
     }
     //插入关系表
     C::t('app_relative')->update_by_appid($appid, $have_tagids);
 }
예제 #18
0
 function getdata($style, $parameter)
 {
     $advid = 0;
     if (!empty($parameter['title'])) {
         $adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['title']);
         if (empty($adv)) {
             $advid = C::t('common_advertisement_custom')->insert(array('name' => $parameter['title']), true);
         } else {
             $advid = $adv['id'];
         }
     } elseif (!empty($parameter['adv'])) {
         $adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['adv']);
         $advid = intval($adv['id']);
     } else {
         $return = 'Empty Ads';
     }
     if ($advid) {
         $flag = false;
         if (getglobal('inajax')) {
             $flag = true;
             setglobal('inajax', 0);
         }
         $return = adshow('custom_' . $advid);
         if ($flag) {
             setglobal('inajax', 1);
         }
     }
     return array('html' => $return, 'data' => null);
 }
예제 #19
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;
 }
예제 #20
0
 function usesubmit()
 {
     global $_G;
     $list = $uids = array();
     $num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
     $limit = $num + 20;
     $giftMagicID = C::t('common_magic')->fetch_by_identifier('gift');
     $mid = $giftMagicID['available'] ? intval($giftMagicID['magicid']) : 0;
     if ($mid) {
         foreach (C::t('common_magiclog')->fetch_all_by_magicid_action_uid($mid, 2, $_G['uid'], 0, $limit) as $value) {
             $uids[] = intval($value['uid']);
         }
     }
     if ($uids) {
         $counter = 0;
         $members = C::t('common_member')->fetch_all($uids);
         foreach (C::t('common_member_field_home')->fetch_all($uids) as $uid => $value) {
             $value = array_merge($members[$uid], $value);
             $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($uid, 'small'), "'");
                 $list[$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');
 }
예제 #21
0
 function usesubmit()
 {
     global $_G;
     $idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : '';
     if (!in_array($idtype, $this->idtypearray)) {
         showmessage(lang('magic/highlight', 'highlight_info_notype'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
     }
     if (empty($_GET['id'])) {
         showmessage(lang('magic/highlight', 'highlight_info_nonexistence_' . $idtype));
     }
     if ($idtype == 'tid') {
         $info = getpostinfo($_GET['id'], $idtype, array('fid', 'authorid', 'subject'));
         $this->_check($info['fid']);
         magicthreadmod($_GET['id']);
         C::t('forum_thread')->update($_GET['id'], array('highlight' => $_GET['highlight_color'], 'moderated' => 1));
         $this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
         $expiration = TIMESTAMP + $this->parameters['expiration'] * 3600;
         updatemagicthreadlog($_GET['id'], $this->magic['magicid'], $expiration > 0 ? 'EHL' : 'HLT', $expiration);
         if ($info['authorid'] != $_G['uid']) {
             notification_add($info['authorid'], 'magic', lang('magic/highlight', 'highlight_notification'), array('tid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name']));
         }
     } elseif ($idtype == 'blogid') {
         $info = getpostinfo($_GET['id'], $idtype, array('uid', 'subject'));
         C::t('home_blogfield')->update($_GET['id'], array('magiccolor' => $_GET['highlight_color']));
         if ($info['uid'] != $_G['uid']) {
             notification_add($info['uid'], 'magic', lang('magic/highlight', 'highlight_notification_blogid'), array('blogid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name']));
         }
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $_GET['id']);
     showmessage(lang('magic/highlight', 'highlight_succeed_' . $idtype), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
 }
예제 #22
0
 function common()
 {
     global $_G;
     if ($_GET['do'] == 'recommend') {
         if (!$_GET['hash'] || FORMHASH != $_GET['hash'] || !$_GET['pid'] || !$_GET['tid'] || !$_G['uid']) {
             mobile_core::result(mobile_core::variable(array('result' => -1)));
         }
         $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
         if (!$_G['wechat']['setting']['wsq_allow'] || !in_array($_GET['tid'], (array) $_G['wechat']['setting']['showactivity']['tids'])) {
             mobile_core::result(mobile_core::variable(array('result' => -2)));
         }
         $postinfo = C::t('forum_post')->fetch('tid:' . $_GET['tid'], $_GET['pid']);
         if (!$postinfo) {
             mobile_core::result(mobile_core::variable(array('result' => -3)));
         }
         $post = C::t('forum_debatepost')->fetch($_GET['pid']);
         if (!$post) {
             C::t('forum_debatepost')->insert(array('pid' => $_GET['pid'], 'tid' => $_GET['tid'], 'dateline' => TIMESTAMP, 'stand' => 0, 'voters' => 1, 'voterids' => "{$_G['uid']}\t"));
             mobile_core::result(mobile_core::variable(array('result' => 1)));
         } elseif (strpos("\t" . $post['voterids'], "\t{$_G['uid']}\t") === FALSE) {
             C::t('forum_debatepost')->update_voters($_GET['pid'], $_G['uid']);
             mobile_core::result(mobile_core::variable(array('result' => 1)));
         } else {
             mobile_core::result(mobile_core::variable(array('result' => 0)));
         }
     }
 }
예제 #23
0
 public function onConnectSetConfig($data)
 {
     global $_G;
     $settingFields = array('connectappid', 'connectappkey');
     if (!$data) {
         return false;
     }
     $setting = C::t('common_setting')->fetch_all(array('connect'));
     $connectData = (array) dunserialize($setting['connect']);
     if (!is_array($connectData)) {
         $connectData = array();
     }
     $settings = array();
     foreach ($data as $k => $v) {
         if (in_array($k, $settingFields)) {
             $settings[$k] = $v;
         } else {
             $connectData[$k] = $v;
         }
     }
     if ($connectData) {
         $settings['connect'] = $connectData;
     }
     if ($settings) {
         C::t('common_setting')->update_batch($settings);
         return true;
     }
     return false;
 }
예제 #24
0
 function usesubmit()
 {
     global $_G;
     $id = intval($_GET['id']);
     $idtype = $_GET['idtype'];
     $blog = magic_check_idtype($id, $idtype);
     $num = 10;
     $list = $ids = $note_inserts = array();
     $fusername = dimplode($_POST['fusername']);
     if ($fusername) {
         $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num);
         $note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}"));
         foreach ($query as $value) {
             $ids[] = $value['fuid'];
             $value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small'));
             $list[] = $value;
             $note_inserts[] = array('uid' => $value['fuid'], 'type' => $name, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $note, 'dateline' => $_G['timestamp']);
         }
     }
     if (empty($ids)) {
         showmessage('magicuse_has_no_valid_friend');
     }
     foreach ($note_inserts as $note_insert) {
         C::t('home_notification')->insert($note_insert);
     }
     C::t('common_member')->increase($ids, array('newprompt' => 1));
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id);
     $op = 'show';
     include template('home/magic_call');
 }
예제 #25
0
 function usesubmit()
 {
     global $_G;
     $id = intval($_GET['id']);
     if (empty($id)) {
         showmessage(lang('magic/namepost', 'namepost_info_nonexistence'));
     }
     $idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
     if (!in_array($idtype, array('pid', 'cid'))) {
         showmessage(lang('magic/namepost', 'namepost_use_error'));
     }
     if ($idtype == 'pid') {
         $_G['tid'] = intval($_GET['ptid']);
         $post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous'));
         $this->_check($post);
         $authorid = $post['authorid'];
         $author = $post['anonymous'] ? '' : 1;
     } elseif ($idtype == 'cid') {
         $comment = C::t('home_comment')->fetch($id);
         $authorid = $comment['authorid'];
         $author = $comment['author'];
     }
     if ($author) {
         showmessage('magicuse_bad_object');
     }
     $member = getuserbyuid($authorid);
     if (!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) {
         showmessage(lang('magic/namepost', 'namepost_info_user_noperm'));
     }
     $author = daddslashes($member['username']);
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id);
     showmessage(lang('magic/namepost', 'magic_namepost_succeed'), 'javascript:;', array('uid' => $authorid, 'username' => $author, 'avatar' => 1), array('alert' => 'right'));
 }
예제 #26
0
function build_cache_heats()
{
    global $_G;
    $addsql = '';
    $data = array();
    if (discuz_process::islocked('update_heats_list')) {
        return false;
    }
    if ($_G['setting']['indexhot']['status']) {
        require_once libfile('function/post');
        $_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200));
        $messageitems = 2;
        $limit = $_G['setting']['indexhot']['limit'];
        foreach (C::t('forum_thread')->fetch_all_heats() as $heat) {
            $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($heat['tid']);
            $heat = array_merge($heat, (array) $post);
            if ($limit == 0) {
                break;
            }
            if ($messageitems > 0) {
                $heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : '';
                $data['message'][$heat['tid']] = $heat;
            } else {
                unset($heat['message']);
                $data['subject'][$heat['tid']] = $heat;
            }
            $messageitems--;
            $limit--;
        }
        $data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration'];
    }
    savecache('heats', $data);
    discuz_process::unlock('update_heats_list');
}
예제 #27
0
 function output()
 {
     global $_G;
     $forums = $GLOBALS['forums'] ? $GLOBALS['forums'] : C::t('forum_forum')->fetch_all_by_status(1);
     foreach ($forums as $forum) {
         if ($forum['fup'] && $GLOBALS['forumlist'][$forum['fup']]) {
             $GLOBALS['forumlist'][$forum['fup']]['sublist'][] = mobile_core::getvalues($forum, array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description'));
         }
         if ($GLOBALS['forumlist'][$forum['fid']]['icon']) {
             $icon = preg_match('/src="(.+?)"/', $GLOBALS['forumlist'][$forum['fid']]['icon'], $r) ? $r[1] : '';
             if (!preg_match('/^http:\\//', $icon)) {
                 $icon = $_G['siteurl'] . $icon;
             }
             $GLOBALS['forumlist'][$forum['fid']]['icon'] = $icon;
         }
         //TODO:现在是用发帖总量来展示"今日发布量",数据量大了改回来
         if ($GLOBALS['forumlist'][$forum['fid']]['posts']) {
             $GLOBALS['forumlist'][$forum['fid']]['posts'] = "今日 " . $GLOBALS['forumlist'][$forum['fid']]['posts'];
         }
     }
     if ($_GET['checknotice']) {
         $variable = array();
     } else {
         $variable = array('member_email' => $_G['member']['email'], 'member_credits' => $_G['member']['credits'], 'setting_bbclosed' => $_G['setting']['bbclosed'], 'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle', '/^allow.+?$/')), 'catlist' => array_values(mobile_core::getvalues($GLOBALS['catlist'], array('/^\\d+$/'), array('fid', 'name', 'forums'))), 'forumlist' => array_values(mobile_core::getvalues($GLOBALS['forumlist'], array('/^\\d+$/'), array('fid', 'name', 'threads', 'posts', 'redirect', 'todayposts', 'description', 'sublist', 'icon'))));
     }
     mobile_core::result(mobile_core::variable($variable));
 }
예제 #28
0
function build_cache_styles()
{
    global $_G;
    $stylevars = $styledata = array();
    $defaultstyleid = $_G['setting']['styleid'];
    foreach (C::t('common_stylevar')->range() as $var) {
        $stylevars[$var['styleid']][$var['variable']] = $var['substitute'];
    }
    foreach (C::t('common_style')->fetch_all_data(true) as $data) {
        $data['tpldir'] = $data['directory'];
        $data = array_merge($data, (array) $stylevars[$data['styleid']]);
        $datanew = array();
        $data['imgdir'] = $data['imgdir'] ? $data['imgdir'] : STATICURL . 'image/common';
        $data['styleimgdir'] = $data['styleimgdir'] ? $data['styleimgdir'] : $data['imgdir'];
        foreach ($data as $k => $v) {
            if (substr($k, -7, 7) == 'bgcolor') {
                $newkey = substr($k, 0, -7) . 'bgcode';
                $datanew[$newkey] = setcssbackground($data, $k);
            }
        }
        $data = array_merge($data, $datanew);
        if (strstr($data['boardimg'], ',')) {
            $flash = explode(",", $data['boardimg']);
            $flash[0] = trim($flash[0]);
            $flash[0] = preg_match('/^http:\\/\\//i', $flash[0]) ? $flash[0] : $data['styleimgdir'] . '/' . $flash[0];
            $data['boardlogo'] = "<embed src=\"" . $flash[0] . "\" width=\"" . trim($flash[1]) . "\" height=\"" . trim($flash[2]) . "\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"></embed>";
        } else {
            $data['boardimg'] = preg_match('/^http:\\/\\//i', $data['boardimg']) ? $data['boardimg'] : $data['styleimgdir'] . '/' . $data['boardimg'];
            $data['boardlogo'] = "<img src=\"{$data['boardimg']}\" alt=\"" . $_G['setting']['bbname'] . "\" border=\"0\" />";
        }
        $data['bold'] = $data['nobold'] ? 'normal' : 'bold';
        $contentwidthint = intval($data['contentwidth']);
        $contentwidthint = $contentwidthint ? $contentwidthint : 600;
        if ($data['extstyle']) {
            list($data['extstyle'], $data['defaultextstyle']) = explode('|', $data['extstyle']);
            $extstyle = explode("\t", $data['extstyle']);
            $data['extstyle'] = array();
            foreach ($extstyle as $dir) {
                if (file_exists($extstylefile = DISCUZ_ROOT . $data['tpldir'] . '/style/' . $dir . '/style.css')) {
                    if ($data['defaultextstyle'] == $dir) {
                        $data['defaultextstyle'] = $data['tpldir'] . '/style/' . $dir;
                    }
                    $content = file_get_contents($extstylefile);
                    if (preg_match('/\\[name\\](.+?)\\[\\/name\\]/i', $content, $r1) && preg_match('/\\[iconbgcolor](.+?)\\[\\/iconbgcolor]/i', $content, $r2)) {
                        $data['extstyle'][] = array($data['tpldir'] . '/style/' . $dir, $r1[1], $r2[1]);
                    }
                }
            }
        }
        $data['verhash'] = random(3);
        $styledata[] = $data;
    }
    foreach ($styledata as $data) {
        savecache('style_' . $data['styleid'], $data);
        if ($defaultstyleid == $data['styleid']) {
            savecache('style_default', $data);
        }
        writetocsscache($data);
    }
}
예제 #29
0
 public function viewthread_modoption()
 {
     global $_G;
     if (!$_G['adminid']) {
         return false;
     }
     $usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']);
     if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) {
         if (self::$util->isfounder($_G['member']) == false) {
             return false;
         }
     }
     $tid = $_G['tid'];
     $title = urlencode(trim($_G['forum_thread']['subject']));
     $post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1);
     include_once libfile('function/discuzcode');
     $content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message']));
     $content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content);
     $content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content);
     $content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content);
     $content = strip_tags(discuzcode($content, 0, 0, 0));
     $content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content);
     $content = str_replace('&nbsp;', ' ', $content);
     $content = urlencode(cutstr($content, 50, ''));
     include template('qqgroup:push');
     return trim($return);
 }
예제 #30
0
function build_cache_globalstick()
{
    $data = array();
    $query = C::t('forum_forum')->fetch_all_valid_forum();
    $fuparray = $threadarray = array();
    foreach ($query as $forum) {
        switch ($forum['type']) {
            case 'forum':
                $fuparray[$forum['fid']] = $forum['fup'];
                break;
            case 'sub':
                $fuparray[$forum['fid']] = $fuparray[$forum['fup']];
                break;
        }
    }
    foreach (C::t('forum_thread')->fetch_all_by_displayorder(array(2, 3)) as $thread) {
        switch ($thread['displayorder']) {
            case 2:
                $threadarray[$fuparray[$thread['fid']]][] = $thread['tid'];
                break;
            case 3:
                $threadarray['global'][] = $thread['tid'];
                break;
        }
    }
    foreach (array_unique($fuparray) as $gid) {
        if (!empty($threadarray[$gid])) {
            $data['categories'][$gid] = array('tids' => dimplode($threadarray[$gid]), 'count' => intval(@count($threadarray[$gid])));
        }
    }
    $data['global'] = array('tids' => empty($threadarray['global']) ? '' : dimplode($threadarray['global']), 'count' => intval(@count($threadarray['global'])));
    savecache('globalstick', $data);
}