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);
}
Example #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);
}
Example #3
0
function build_cache_advs()
{
    $advlist = $data = array();
    $data['code'] = $data['parameters'] = $data['evalcode'] = array();
    foreach (C::t('common_advertisement')->fetch_all_old() as $adv) {
        foreach (explode("\t", $adv['targets']) as $target) {
            $data['code'][$target][$adv['type']][$adv['advid']] = $adv['code'];
        }
        $advtype_class = libfile('adv/' . $adv['type'], 'class');
        if (!file_exists($advtype_class)) {
            continue;
        }
        require_once $advtype_class;
        $advclass = 'adv_' . $adv['type'];
        $advclass = new $advclass();
        $adv['parameters'] = unserialize($adv['parameters']);
        unset($adv['parameters']['style'], $adv['parameters']['html'], $adv['parameters']['displayorder']);
        $data['parameters'][$adv['type']][$adv['advid']] = $adv['parameters'];
        if ($adv['parameters']['extra']) {
            $data['parameters'][$adv['type']][$adv['advid']] = array_merge($data['parameters'][$adv['type']][$adv['advid']], $adv['parameters']['extra']);
            unset($data['parameters'][$adv['type']][$adv['advid']]['extra']);
        }
        $advlist[] = $adv;
        $data['evalcode'][$adv['type']] = $advclass->evalcode($adv);
    }
    updateadvtype();
    savecache('advs', $data);
}
Example #4
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);
    }
}
Example #5
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');
}
Example #6
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);
    }
}
Example #7
0
function build_cache_app_setting()
{
    global $_G;
    $data = array();
    $data = C::t('#corpus#corpus_setting')->fetch_all();
    savecache('corpus:setting', $data);
}
Example #8
0
function build_cache_forumlinks()
{
    global $_G;
    $data = array();
    $query = C::t('common_friendlink')->fetch_all_by_displayorder();
    if ($_G['setting']['forumlinkstatus']) {
        $tightlink_content = $tightlink_text = $tightlink_logo = $comma = '';
        foreach ($query as $flink) {
            if ($flink['description']) {
                if ($flink['logo']) {
                    $tightlink_content .= '<li class="lk_logo mbm bbda cl"><img src="' . $flink['logo'] . '" border="0" alt="' . strip_tags($flink['name']) . '" /><div class="lk_content z"><h5><a href="' . $flink['url'] . '" target="_blank">' . $flink['name'] . '</a></h5><p>' . $flink['description'] . '</p></div></li>';
                } else {
                    $tightlink_content .= '<li class="mbm bbda"><div class="lk_content"><h5><a href="' . $flink['url'] . '" target="_blank">' . $flink['name'] . '</a></h5><p>' . $flink['description'] . '</p></div></li>';
                }
            } else {
                if ($flink['logo']) {
                    $tightlink_logo .= '<a href="' . $flink['url'] . '" target="_blank"><img src="' . $flink['logo'] . '" border="0" alt="' . strip_tags($flink['name']) . '" /></a> ';
                } else {
                    $tightlink_text .= '<li><a href="' . $flink['url'] . '" target="_blank" title="' . strip_tags($flink['name']) . '">' . $flink['name'] . '</a></li>';
                }
            }
        }
        $data = array($tightlink_content, $tightlink_logo, $tightlink_text);
    }
    savecache('forumlinks', $data);
}
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);
}
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);
    }
}
 public function check()
 {
     require_once libfile('function/admincp');
     require_once libfile('function/plugin');
     require_once libfile('function/cloudaddons');
     $pluginarray = C::t('common_plugin')->fetch_all_data();
     $addonids = array();
     foreach ($pluginarray as $row) {
         if (ispluginkey($row['identifier'])) {
             $addonids[] = $row['identifier'] . '.plugin';
         }
     }
     $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
     savecache('addoncheck_plugin', $checkresult);
     $newversion = 0;
     foreach ($checkresult as $value) {
         list(, $newver) = explode(':', $value);
         if ($newver) {
             $newversion++;
         }
     }
     if ($newversion) {
         $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_plugin_new_plugin', array('newversion' => $newversion)));
     } else {
         $return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_plugin_no_upgrade'));
     }
     return $return;
 }
function build_cache_forumrecommend()
{
    $data = array();
    $fids = C::t('forum_forum')->fetch_all_fids();
    foreach ($fids as $row) {
        require_once libfile('function/group');
        $recommendlist = C::t('forum_forum')->fetch_all_recommend_by_fid($row['fid']);
        foreach ($recommendlist as $info) {
            $group = array('fid' => $info['fid'], 'name' => $info['name'], 'threads' => $info['threads'], 'lastpost' => $info['lastpost'], 'icon' => $info['icon'], 'membernum' => $info['membernum'], 'description' => $info['description']);
            $group['icon'] = get_groupimg($group['icon'], 'icon');
            $lastpost = array(0, 0, '', '');
            $group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost'];
            $group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost'];
            list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost'];
            if ($lastpost['tid']) {
                $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s');
                if ($lastpost['author']) {
                    $lastpost['encode_author'] = rawurlencode($lastpost['author']);
                }
                $group['lastpost'] = $lastpost;
            } else {
                $group['lastpost'] = '';
            }
            $data[$row['fid']][] = $group;
        }
    }
    savecache('forumrecommend', $data);
}
Example #13
0
	function checkCloud() {
		global $_G;

		loadcache('mobileoem_data');
		if(!$_G['cache']['mobileoem_data'] || (TIMESTAMP - $_G['cache']['mobileoem_data']['timestamp']) > 86400) {
			try {
				$cloud = Cloud::loadClass('Service_Client_OEM');
				$clouddata = $cloud->checkApp();
			} catch (Exception $e) {
				$clouddata = array('errCode' => 1);
			}
			if(!$clouddata['errCode']) {
				if(!$clouddata['isDone']) {
					$_G['cache']['mobileoem_data'] = array();
				} else {
					$_G['cache']['mobileoem_data'] = $clouddata;
				}
			}
			$_G['cache']['mobileoem_data']['timestamp'] = TIMESTAMP;
			savecache('mobileoem_data', $_G['cache']['mobileoem_data']);
		}

		$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
		if(strpos($useragent, 'iphone') !== false || strpos($useragent, 'ios') !== false) {
			$this->platform = '&platform=ios';
		} elseif(strpos($useragent, 'android') !== false) {
			$this->platform = '&platform=android';
		} elseif(strpos($useragent, 'windows phone') !== false) {
			$this->platform = '&platform=windowsphone';
		} else {
			$this->platform = '';
		}
	}
function build_cache_postimg()
{
    $imgextarray = array('jpg', 'gif', 'png');
    $imgdir = array('hrline', 'postbg');
    $postimgjs = 'var postimg_type = new Array();';
    foreach ($imgdir as $perdir) {
        $count = 0;
        $pdir = DISCUZ_ROOT . './static/image/' . $perdir;
        $postimgdir = dir($pdir);
        $postimgjs .= 'postimg_type["' . $perdir . '"]=[';
        while ($entry = $postimgdir->read()) {
            if (in_array(strtolower(fileext($entry)), $imgextarray) && preg_match("/^[\\w\\-\\.\\[\\]\\(\\)\\<\\> &]+\$/", substr($entry, 0, strrpos($entry, '.'))) && strlen($entry) < 30 && is_file($pdir . '/' . $entry)) {
                $postimg[$perdir][] = array('url' => $entry);
                $postimgjs .= ($count ? ',' : '') . '"' . $entry . '"';
                $count++;
            }
        }
        $postimgjs .= '];';
        $postimgdir->close();
    }
    savecache('postimg', $postimg);
    $cachedir = 'saekv://data/cache/';
    if (@($fp = fopen($cachedir . 'common_postimg.js', 'w'))) {
        fwrite($fp, $postimgjs);
        fclose($fp);
    } else {
        exit('Can not write to cache files, please check directory ./data/ and ./data/cache/ .');
    }
}
Example #15
0
/**
 * 基本缓存设置
 * @author HumingXu E-mail:huming17@126.com
 */
function build_cache_setting()
{
    global $_G;
    $skipkeys = array('backupdir', 'custombackup');
    $serialized = array('seccodedata', 'secqaa', 'server_mail', 'server_upload');
    $data = array();
    foreach (C::t('common_setting')->fetch_all_not_key($skipkeys) as $setting) {
        if (in_array($setting['skey'], $serialized)) {
            $_G['setting'][$setting['skey']] = $data[$setting['skey']] = json_decode($setting['svalue'], 1);
        } else {
            $_G['setting'][$setting['skey']] = $data[$setting['skey']] = $setting['svalue'];
        }
    }
    list($data['user_role_menu']) = get_cachedata_user_role_menu();
    //TODO 数据文件缓存
    //$data['footernavs'] = get_cachedata_footernav();
    //$data['spacenavs'] = get_cachedata_spacenavs();
    //$data['mynavs'] = get_cachedata_mynavs();
    //$data['topnavs'] = get_cachedata_topnav();
    //	unset($data['allowthreadplugin']);
    //	if($data['jspath'] == 'data/cache/') {
    //		writetojscache();
    //	} elseif(!$data['jspath']) {
    //		$data['jspath'] = 'static/js/';
    //	}
    //
    //	if($data['cacheindexlife']) {
    //		$cachedir = SITE_ROOT.'./cache/';
    //		$tidmd5 = substr(md5(0), 3);
    //		@unlink($cachedir.'/'.$tidmd5[0].'/'.$tidmd5[1].'/'.$tidmd5[2].'/0.htm');
    //	}
    savecache('setting', $data);
    $_G['setting'] = $data;
}
Example #16
0
function build_cache_yuexiamen()
{
    $data = array();
    foreach (C::t('yuexiamen_poi')->fetch_all() as $yuexiamen) {
        $data['yuexiamen_poi'] = array('area' => $yuexiamen['area'], 'areaid' => $yuexiamen['areaid'], 'name' => $yuexiamen['name'], 'introduction' => $yuexiamen['introductiong'], 'dateline' => $yuexiamen['dateline']);
    }
    savecache('yuexiamen', $data);
}
Example #17
0
 public static function setDzPluginCache($key, $data, $force = true)
 {
     $key = 'dzsyscache_' . $key;
     $cache = self::getDzPluginCache('', $force);
     empty($cache) && ($cache = array());
     is_array($cache) && ($cache = array_merge($cache, array($key => $data)));
     savecache(MOBCENT_DZ_PLUGIN_ID, $cache);
 }
Example #18
0
function build_cache_magics()
{
    $data = array();
    foreach (C::t('common_magic')->fetch_all_data(1) as $magic) {
        $data[$magic['magicid']] = $magic;
    }
    savecache('magics', $data);
}
Example #19
0
function build_cache_medals()
{
    $data = array();
    foreach (C::t('forum_medal')->fetch_all_data(1) as $medal) {
        $data[$medal['medalid']] = array('name' => $medal['name'], 'image' => $medal['image'], 'description' => dhtmlspecialchars($medal['description']));
    }
    savecache('medals', $data);
}
function build_cache_connect_blacklist()
{
    global $_G;
    $data = array();
    foreach (C::t('common_uin_black')->fetch_all_by_uin() as $blacklist) {
        $data[] = $blacklist['uin'];
    }
    savecache('connect_blacklist', $data);
}
Example #21
0
 public function index()
 {
     import("@.ORG.Weixin");
     $config = $this->Config;
     $wxconfig = F("wxconfig");
     $user = M("user");
     $data = array();
     $wechatObj = new Wechat();
     if ($wxconfig["wstatu"] != "") {
         $data = $wechatObj->responseMsg($idx);
         //接收到的
         $me = $data['me'];
         $guest = $data['user'];
         //////////////////////*用户打入库-开始*///////////////
         $this->adduser($guest);
         if ($data['key'] == "ewm") {
             $ewm = $wechatObj->ewm(2, 1);
             $wechatObj->sendtext($guest, $me, $ewm);
         }
         $wechatObj->sendtext($guest, $me, $guest);
         exit;
         ///////////////////////////////事件开始/////////////////////////
         if ($data['type'] == "event") {
             //关注
             if ($data['event'] == "subscribe" || $data['event'] == "SCAN") {
                 if ($data['key'] == 1) {
                     $user = M("user")->where("wxid='" . sysmd5($guest) . "'")->setfield('vip', 1);
                     $map1['url'] = "http://mall.bydauto.com.cn/echo/index/store";
                     $map1['title'] = "vip会议标题['待定..']";
                     $map1['description'] = "描述的文字['待定..'],点击进去的链接待定,下面的图片大小700x400";
                     $map1['thumb'] = "http://byd.gzqizhen.com/Public/byd/byd.jpg";
                     $wechatObj->sendimg($guest, $me, $map1);
                     exit;
                 }
                 if ($data['key'] == 2) {
                     $vip = M("user")->where("wxid='" . sysmd5($guest) . "'")->getfield('vip');
                     if (!$vip) {
                         $user = M("user")->where("wxid='" . sysmd5($guest) . "'")->setfield('vip', 2);
                     }
                     $map2['url'] = "http://mall.bydauto.com.cn/echo/index/store";
                     $map2['title'] = "新能源['待定..']";
                     $map2['description'] = "描述的文字['待定..']下面的图片大小700x400";
                     $map2['thumb'] = "http://byd.gzqizhen.com/Public/byd/byd.jpg";
                     $wechatObj->sendimg($guest, $me, $map2);
                     // $wechatObj->sendtext($guest,$me,"新能源");
                     exit;
                 }
             }
         }
         ///////////////////////////////事件结束/////////////////////////
         $wechatObj->sendimg($guest, $me, $wxconfig);
     } else {
         M("config")->where("varname='wstatu'")->setField('value', "清理此位置可以重新设置微信接入!");
         $wechatObj->valid($wxconfig["token"]);
         savecache("Config");
     }
 }
function build_cache_creditrule()
{
    $data = array();
    foreach (C::t('common_credit_rule')->fetch_all_rule() as $rule) {
        $rule['rulenameuni'] = urlencode(diconv($rule['rulename'], CHARSET, 'UTF-8', true));
        $data[$rule['action']] = $rule;
    }
    savecache('creditrule', $data);
}
Example #23
0
function build_cache_myapp()
{
    $data = array();
    foreach (C::t('common_myapp')->fetch_all_by_flag(-1, '!=') as $myapp) {
        $myapp['icon'] = getmyappiconpath($myapp['appid'], $myapp['iconstatus']);
        $data[$myapp['appid']] = $myapp;
    }
    savecache('myapp', $data);
}
function build_cache_attachtype()
{
    $attachtypes = C::t('forum_attachtype')->fetch_all_data();
    $data = array();
    foreach ($attachtypes as $row) {
        $data[$row['fid']][strtolower($row['extension'])] = $row['maxsize'];
    }
    savecache('attachtype', $data);
}
function build_cache_modreasons()
{
    $settings = C::t('common_setting')->fetch_all(array('modreasons', 'userreasons'));
    foreach ($settings as $key => $data) {
        $data = str_replace(array("\r\n", "\r"), array("\n", "\n"), $data);
        $data = explode("\n", trim($data));
        savecache($key, $data);
    }
}
Example #26
0
function build_cache_userstats()
{
    global $_G;
    $totalmembers = C::t('user')->count();
    $member = C::t('user')->range(0, 1, 'DESC');
    $member = current($member);
    $newsetuser = $member['username'];
    $data = array('totalmembers' => $totalmembers, 'newsetuser' => $newsetuser);
    savecache('userstats', $data);
}
Example #27
0
function build_cache_groupicon()
{
    $data = array();
    foreach (C::t('forum_onlinelist')->fetch_all_order_by_displayorder() as $list) {
        if ($list['url']) {
            $data[$list['groupid']] = STATICURL . 'image/common/' . $list['url'];
        }
    }
    savecache('groupicon', $data);
}
Example #28
0
 private static function nextcron()
 {
     $cron = C::t('common_cron')->fetch_nextcron();
     if ($cron && isset($cron['nextrun'])) {
         savecache('cronnextrun', $cron['nextrun']);
     } else {
         savecache('cronnextrun', TIMESTAMP + 86400 * 365);
     }
     return true;
 }
Example #29
0
function build_cache_smilies()
{
    $data = array();
    $data = array('searcharray' => array(), 'replacearray' => array(), 'typearray' => array());
    foreach (C::t('smiley')->fetch_all_cache() as $smiley) {
        $data['searcharray'][$smiley['id']] = '/' . preg_quote(dhtmlspecialchars($smiley['code']), '/') . '/';
        $data['replacearray'][$smiley['id']] = $smiley['url'];
        $data['typearray'][$smiley['id']] = $smiley['typeid'];
    }
    savecache('smilies', $data);
}
Example #30
0
function build_cache_stamptypeid()
{
    $data = array();
    foreach (C::t('common_smiley')->fetch_all_by_type('stamp') as $stamp) {
        if ($stamp['typeid'] < 0) {
            continue;
        }
        $data[$stamp['typeid']] = $stamp['displayorder'];
    }
    savecache('stamptypeid', $data);
}