本文整理汇总了PHP中writetocache函数的典型用法代码示例。如果您正苦于以下问题:PHP writetocache函数的具体用法?PHP writetocache怎么用?PHP writetocache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writetocache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_cache_plugin
function build_cache_plugin()
{
$data = array();
$query = DB::query("SELECT * FROM " . DB::table('common_plugin') . " WHERE available='1'");
$pluginsetting = array();
while ($plugin = DB::fetch($query)) {
$queryvars = DB::query("SELECT * FROM " . DB::table('common_pluginvar') . " WHERE pluginid='{$plugin['pluginid']}'");
while ($var = DB::fetch($queryvars)) {
$data[$plugin['identifier']][$var['variable']] = $var['value'];
if (in_array(substr($var['type'], 0, 6), array('group_', 'forum_'))) {
$stype = substr($var['type'], 0, 5) . 's';
$type = substr($var['type'], 6);
if ($type == 'select') {
foreach (explode("\n", $var['extra']) as $key => $option) {
$option = trim($option);
if (strpos($option, '=') === FALSE) {
$key = $option;
} else {
$item = explode('=', $option);
$key = trim($item[0]);
$option = trim($item[1]);
}
$var['select'][] = array($key, $option);
}
}
$pluginsetting[$stype][$plugin['identifier']]['name'] = $plugin['name'];
$pluginsetting[$stype][$plugin['identifier']]['setting'][$var['pluginvarid']] = array('title' => $var['title'], 'description' => $var['description'], 'type' => $type, 'select' => $var['select']);
}
}
}
writetocache('pluginsetting', getcachevars(array('pluginsetting' => $pluginsetting)));
save_syscache('plugin', $data);
}
示例2: updatesettings
function updatesettings()
{
global $_DCACHE;
if (isset($_DCACHE['settings']) && is_array($_DCACHE['settings'])) {
writetocache('settings', '', '$_DCACHE[\'settings\'] = ' . arrayeval($_DCACHE['settings']) . ";\n\n");
}
}
示例3: _creatCache
function _creatCache(){
global $db, $tablepre;
include DISCUZ_ROOT.'./include/cache.func.php';
$query = $db->query("SELECT data FROM {$tablepre}caches WHERE cachename='postawards'");
$data = $db->fetch_array($query);
writetocache('postawards_setting', '', $data['data']);
}
示例4: updateLinkCache
function updateLinkCache()
{
global $db;
$query_id = $db->query("SELECT name,site,intro,type,img FROM `links` WHERE invisable = 1") or error('Unable to fetch link cache', __FILE__, __LINE__, $db->error());
while ($v = $db->fetch_array($query_id)) {
$link[] = array('name' => $v['name'], 'site' => $v['site'], 'intro' => $v['intro'], 'type' => $v['type'], 'img' => 'logos/' . $v['img']);
}
writetocache('link.php', ROOT_PATH . 'cache', "define('LINK', true);\n" . '$linkCache = ' . var_export($link, true) . ";\n");
}
示例5: pluginCache
function pluginCache($cacheName,$varName,$data,$isarray){
@require_once libfile('function/cache');
if($isarray){
$cacheArray .= "\$$varName=".arrayeval($data).";\n";
writetocache($cacheName, $cacheArray);
}else{
$cacheArray .= "\$$varName=".$data.";\n";
writetocache($cacheName, $cacheArray);
}
}
示例6: shy9000_famehall_updateCache
function shy9000_famehall_updateCache()
{
$query = DB::query("SELECT g.groupname, g.grouppic, m.uid, m.gid, m.value FROM " . DB::table('mingrentang') . " m, " . DB::table('mingrentanggroup') . " g WHERE m.gid=g.id ORDER BY m.uid");
while ($famehall = DB::fetch($query)) {
$return[$famehall['uid']][] = $famehall['groupname'];
$return2[$famehall['uid']][] = $famehall['gid'];
$return3[$famehall['uid']][] = cutstr($famehall['value'], 40);
$return4[$famehall['uid']][] = $famehall['grouppic'] ? $famehall['grouppic'] : 'def.gif';
}
require_once libfile('function/cache');
writetocache('famehall_cache', getcachevars(array('_FHCACHE' => array('gname' => $return, 'gid' => $return2, 'js' => $return3, 'pic' => $return4))));
return $return;
}
示例7: UpdateAdsCache
function UpdateAdsCache()
{
global $db;
$query_id = $db->query("SELECT * FROM `advertising` ORDER BY id DESC");
while ($result = $db->fetch_array($query_id)) {
$effectivetime = sprintf('%.2f', ($result['exptime'] - (time() - strtotime($result['addtime']))) / 86400);
if ($effectivetime < 0) {
continue;
}
$ads[] = array('' . $result['adlocation'] . '' => array('title' => $result['title'], 'url' => $result['url'], 'img' => $result['img']));
}
writetocache('ads.php', ROOT_PATH . "cache", "define('ADS',true);\n" . '$adsCache = ' . var_export($ads, true) . ";\n");
}
示例8: build_cache_plugin
function build_cache_plugin()
{
global $importtxt;
$data = array();
$query = DB::query("SELECT * FROM " . DB::table('common_plugin') . " WHERE available='1'");
$pluginsetting = array();
while ($plugin = DB::fetch($query)) {
$dir = substr($plugin['directory'], 0, -1);
$plugin['modules'] = unserialize($plugin['modules']);
if ($plugin['modules']['extra']['langexists']) {
require_once libfile('function/plugin');
require_once libfile('function/admincp');
$file = DISCUZ_ROOT . './source/plugin/' . $dir . '/discuz_plugin_' . $dir . ($plugin['modules']['extra']['installtype'] ? '_' . $plugin['modules']['extra']['installtype'] : '') . '.xml';
$importtxt = @implode('', file($file));
$pluginarray = getimportdata('Discuz! Plugin', 1, 1);
if ($pluginarray) {
updatepluginlanguage($pluginarray);
}
}
$queryvars = DB::query("SELECT * FROM " . DB::table('common_pluginvar') . " WHERE pluginid='{$plugin['pluginid']}'");
while ($var = DB::fetch($queryvars)) {
$data[$plugin['identifier']][$var['variable']] = $var['value'];
if (in_array(substr($var['type'], 0, 6), array('group_', 'forum_'))) {
$stype = substr($var['type'], 0, 5) . 's';
$type = substr($var['type'], 6);
if ($type == 'select') {
foreach (explode("\n", $var['extra']) as $key => $option) {
$option = trim($option);
if (strpos($option, '=') === FALSE) {
$key = $option;
} else {
$item = explode('=', $option);
$key = trim($item[0]);
$option = trim($item[1]);
}
$var['select'][] = array($key, $option);
}
}
$pluginsetting[$stype][$plugin['identifier']]['name'] = $plugin['name'];
$pluginsetting[$stype][$plugin['identifier']]['setting'][$var['pluginvarid']] = array('title' => $var['title'], 'description' => $var['description'], 'type' => $type, 'select' => $var['select']);
}
}
}
writetocache('pluginsetting', getcachevars(array('pluginsetting' => $pluginsetting)));
save_syscache('plugin', $data);
}
示例9: build_cache_plugin_mobile
function build_cache_plugin_mobile() {
if(!defined('DISCUZ_VERSION')) {
require './source/discuz_version.php';
}
global $_G;
$setting = array();
$settings = array('closeforumorderby');
foreach($settings as $v) {
$setting[$v] = $_G['setting'][$v];
}
if(in_array('mobile', $_G['setting']['plugins']['available'])) {
$extendsetting = C::t('#mobile#mobile_setting')->fetch_all(array(
'extend_used',
'extend_lastupdate'
));
$array = array(
'discuzversion' => DISCUZ_VERSION,
'charset' => CHARSET,
'version' => MOBILE_PLUGIN_VERSION,
'pluginversion' => $_G['setting']['plugins']['version']['mobile'],
'oemversion' => in_array('mobileoem', $_G['setting']['plugins']['available']) ? $_G['setting']['plugins']['version']['mobileoem'] : '0',
'regname' => $_G['setting']['regname'],
'qqconnect' => in_array('qqconnect', $_G['setting']['plugins']['available']) ? '1' : '0',
'sitename' => $_G['setting']['bbname'],
'mysiteid' => $_G['setting']['my_siteid'],
'ucenterurl' => $_G['setting']['ucenterurl'],
'setting' => $setting,
'extends' => array('used' => $extendsetting['extend_used'], 'lastupdate' => $extendsetting['extend_lastupdate']),
);
} else {
$array = array();
}
require_once './source/plugin/mobile/mobile.class.php';
$data = array('mobilecheck' => mobile_core::json($array));
writetocache('mobile', getcachevars($data));
}
示例10: categories_recache
function categories_recache()
{
global $DMC, $DBPrefix, $settingInfo, $strCategory, $arrSideModule, $strAllCategory, $strPrivateLog;
//get sum category
$sum_sql = "select sum(cateCount) as sum_total from " . $DBPrefix . "categories where parent='0' and isHidden='0'";
$sum_result = $DMC->query($sum_sql);
if ($arr_result = $DMC->fetchArray($sum_result)) {
$sum_total = ($arr_result['sum_total'] == "" or $arr_result['sum_total'] == 0) ? 0 : $arr_result['sum_total'];
} else {
$sum_total = 0;
}
//隐私日志
$arr_private = $DMC->fetchArray($DMC->query("select count(id) as private_count from " . $DBPrefix . "logs where saveType=3"));
$private_count = $arr_private['private_count'];
//get main category
$query_sql = "select id,name,cateTitle,outLinkUrl,cateCount,cateIcons from " . $DBPrefix . "categories where parent='0' and isHidden='0' order by orderNo";
$query_result = $DMC->query($query_sql);
$arr_parent = $DMC->fetchQueryAll($query_result);
for ($i = 0; $i < count($arr_parent); $i++) {
//get sub category
$sub_sql = "select id,name,cateTitle,outLinkUrl,cateCount,cateIcons from " . $DBPrefix . "categories where parent='" . $arr_parent[$i]['id'] . "' and isHidden='0' order by orderNo";
$sub_result = $DMC->query($sub_sql);
$arr_sub[$i] = $DMC->fetchQueryAll($sub_result);
}
ob_start();
if (strpos($settingInfo['categoryImgPath'], "tree") > 0) {
include F2BLOG_ROOT . "./include/treemenu.inc.php";
} else {
include F2BLOG_ROOT . "./include/ulmenu.inc.php";
}
$out_contents = create_sidebar_header("Category", $strCategory, $arrSideModule["category"]["isInstall"]);
$out_contents .= ob_get_contents();
$out_contents .= create_sidebar_footer();
ob_end_clean();
writetocache('category', $out_contents, "html");
}
示例11: update_data
function update_data($echo, $DMC)
{
global $DBPrefix, $update_time, $update_logs;
$delete_setting = true;
//更新附件的文件类别 2009-05-12
$modify_sql[] = "ALTER TABLE `{$DBPrefix}attachments` ADD INDEX `name` (`name`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}guestbook` ADD COLUMN `HTTP_REFERER` text NULL DEFAULT NULL AFTER `parent`";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}links` ADD INDEX `isApp` (`isApp`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD COLUMN `isTopNews` tinyint(1) NOT NULL DEFAULT 0 AFTER `isTop`";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD INDEX `postTime` (`postTime`,`saveType`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD INDEX `isComment` (`isComment`,`isTrackback`,`isTop`,`isTopNews`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}members` ADD INDEX `password` (`password`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}members` ADD INDEX `role` (`role`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}setting` ADD INDEX `settName` (`settName`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}trackbacks` ADD INDEX `isApp` (`isApp`)";
$modify_sql[] = "ALTER TABLE `{$DBPrefix}logs` ADD `autoSplit` int(8) NOT NULL default '0'";
// 強化驗證
$modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '=http')";
$modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '[url=')";
$modify_sql[] = "INSERT INTO `{$DBPrefix}filters` (`category`, `name`) VALUES (1, '[href=')";
//运行SQL语句
foreach ($modify_sql as $key => $value) {
$DMC->query($value, "T");
if ($echo) {
if ($DMC->error()) {
echo $value . " ... <font color=red>" . $DMC->error() . "</font><br />";
} else {
echo $value . " ... <font color=blue>OK</font><br />";
}
}
}
$i = 0;
$contents = "\$update_logs = array(\r\n";
$contents .= "\t'{$i}' => '{$update_time}',\r\n";
for ($i = 0; $i < count($update_logs); $i++) {
$j = $i + 1;
$contents .= "\t'{$j}' => '" . $update_logs[$i] . "',\r\n";
}
$contents .= ");";
writetocache('update_logs', $contents);
//清空缓存
if ($delete_setting == true) {
//0909升级需要重新建立setting文件。
if (!@unlink(F2BLOG_ROOT . "./cache/cache_setting.php")) {
echo "<script language=Javascript> \n";
echo "alert('Please update cache!');\n";
echo "</script>\n";
}
} else {
//更新缓存
settings_recache();
links_recache();
}
return false;
}
示例12: getcachevars
$Id: feed.php 20442 2009-09-28 01:17:13Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
@include_once DISCUZ_ROOT.'./forumdata/cache/cache_manyou.php';
if(!isset($myapps)) {
$query = $db->query("SELECT * FROM {$tablepre}myapp WHERE flag='1' ORDER BY displayorder");
while($application = $db->fetch_array($query)) {
$myapps[$application['appid']] = $application;
}
require_once DISCUZ_ROOT.'./include/cache.func.php';
writetocache('manyou', '', getcachevars(array('myapps' => $myapps)));
}
require_once DISCUZ_ROOT.'./uc_client/client.php';
$invitenum = $db->result_first("SELECT count(*) FROM {$tablepre}myinvite WHERE touid='$discuz_uid'");
$noticenum = $db->result_first("SELECT count(*) FROM {$tablepre}mynotice WHERE uid='$discuz_uid' AND new='1'");
$feeds = array();
$my_feedpp = $my_feedpp > 50 ? $my_feedpp : 50;
$view = !empty($view) && in_array($view, array('me', 'all', 'friend')) ? $view : 'friend';
if(!$discuz_uid) {
$view = 'all';
}
$conf = array(
'type' => 'manyou',
'num' => $my_feedpp,
示例13:
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
if(!$tid){
showmessage("dps_postawards:wrong_request");
}
if(!@include_once DISCUZ_ROOT.'./forumdata/cache/cache_postawards_setting.php'){
require_once DISCUZ_ROOT.'./include/cache.func.php';
$query = $db->query("SELECT data FROM {$tablepre}caches WHERE cachename='postawards'");
$data = $db->fetch_array($query);
writetocache('postawards_setting', '', $data['data']);
}
$allow = $PACACHE['userright'][$groupid];
if(!$allow['postawards'] || !$adminid){
showmessage('group_nopermission', NULL, 'NOPERM');
}
if(!$allow['systemcredit']){
$selfcreditmode = TRUE;
}
if(!$allow['ratemode']){
$ratemode = FALSE;
}
示例14: array
$adminextend = $adminextendnew = array();
if (file_exists($adminextendfile = DISCUZ_ROOT . './data/sysdata/cache_adminextend.php')) {
@(include $adminextendfile);
}
$menudirhandle = dir($menudir);
while ($entry = $menudirhandle->read()) {
if (!in_array($entry, array('.', '..')) && preg_match("/^menu\\_([\\w\\.]+)\$/", $entry, $entryr) && substr($entry, -4) == '.php' && strlen($entry) < 30 && is_file($menudir . '/' . $entry)) {
@(include_once $menudir . '/' . $entry);
$adminextendnew[] = $entryr[1];
}
}
if ($adminextend != $adminextendnew) {
@unlink($adminextendfile);
if ($adminextendnew) {
require_once libfile('function/cache');
writetocache('adminextend', getcachevars(array('adminextend' => $adminextendnew)));
}
unset($_G['lang']['admincp']);
}
}
if ($isfounder) {
$menu['plugin'] = array(array('menu_addons', 'cloudaddons'), array('menu_plugins', 'plugins'));
}
loadcache('adminmenu');
if (is_array($_G['cache']['adminmenu'])) {
foreach ($_G['cache']['adminmenu'] as $row) {
$menu['plugin'][] = array($row['name'], $row['action']);
}
}
if (!$menu['plugin']) {
unset($topmenu['plugin']);
示例15: array
$data = array();
$query = $db->query("SELECT attach.aid, attach.attachment, t.tid, t.fid, t.subject FROM {$tablepre}attachments attach LEFT JOIN {$tablepre}threads t ON t.displayorder>=0 AND t.tid=attach.tid WHERE attach.readperm='0' AND displayorder>='0' AND filetype='image/pjpeg' {$fids} GROUP BY attach.tid ORDER BY {$orderby} DESC LIMIT {$searchnums}");
while ($pic = $db->fetch_array($query)) {
$data['pic'][$pic[aid]]['showpicpics'] = $attachurl . '/' . $pic['attachment'];
$data['pic'][$pic[aid]]['showpiclinks'] = "viewthread.php?tid={$pic['tid']}";
$data['pic'][$pic[aid]]['showpictexts'] = str_replace('\'', ' ', $pic['subject']);
}
$data['expiration'] = $cachelife + time();
$data['cacheshownums'] = $shownums;
$data['cachesearchnums'] = $searchnums;
$data['cachecachelife'] = $cachelife;
$data['cacheorderby'] = $orderby;
$data['cachecachename'] = $cachename;
$data['cachesearchfid'] = $searchfid;
require_once DISCUZ_ROOT . './include/cache.func.php';
writetocache($cachename, '', getcachevars($data));
include DISCUZ_ROOT . './forumdata/cache/cache_' . $cachename . '.php';
//}
shuffle($pic);
$i = 0;
$j = 0;
while ($j < $shownums && isset($pic[$i])) {
if (is_readable($pic[$i]['showpicpics'])) {
$showpicpics .= $comma . $pic[$i]['showpicpics'];
$showpiclinks .= $comma . $pic[$i]['showpiclinks'];
$showpictexts .= $comma . $pic[$i]['showpictexts'];
$comma = '|';
$j++;
}
$i++;
}