function cron_run($force = 0) { global $conf, $time, $forumlist, $runtime; $cron_1_last_date = runtime_get('cron_1_last_date'); $cron_2_last_date = runtime_get('cron_2_last_date'); $t = $time - $cron_1_last_date; if ($t > 300 || $force) { $lock = cache_get('cron_lock_1'); if ($lock === NULL) { cache_set('cron_lock_1', 1, 10); // 设置 10 秒超时 // 清理在线 online_gc(); runtime_set('cron_1_last_date', $time); cache_delete('cron_lock_1'); } } $t = $time - $cron_2_last_date; if ($t > 86400 || $force) { $lock = cache_get('cron_lock_2'); // 高并发下, mysql 机制实现的锁锁不住,但是没关系 if ($lock === NULL) { cache_set('cron_lock_2', 1, 10); // 设置 10 秒超时 // 每日统计清 0 runtime_set('todayposts', 0); runtime_set('todaythreads', 0); runtime_set('todayusers', 0); foreach ($forumlist as $fid => $forum) { forum__update($fid, array('todayposts' => 0, 'todaythreads' => 0)); } forum_list_cache_delete(); // 清理最新发帖,只保留 100 条。 thread_new_gc(); thread_lastpid_gc(); // 清理在线 online_gc(); // 清理临时附件 attach_gc(); // 清空每日 IP 限制 ipaccess_truncate(); // 清理游客喜欢限制 guest_agree_truncate(); list($y, $n, $d) = explode(' ', date('Y n j', $time)); // 0 点 $today = mktime(0, 0, 0, $n, $d, $y); // -8 hours runtime_set('cron_2_last_date', $today, TRUE); // 加到1天后 // 每日生成最新的 sitemap thread_new_sitemap(); // 往前推8个小时,尽量保证在前一天 table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } }
function thread_top_cache_delete() { global $conf; static $deleted = FALSE; if ($deleted) { return; } cache_delete('thread_top_list'); $deleted = TRUE; }
function user_delete($uid) { global $conf; // 清理用户资源 $threadlist = mythread_find_by_uid($uid, 1, 1000); foreach ($threadlist as $thread) { thread_delete($thread['tid']); } $r = user__delete($uid); $conf['cache']['type'] != 'mysql' and cache_delete("user-{$uid}"); // 全站统计 runtime_set('users-', 1); return $r; }
function delete_admin($username) { $r = $this->get_one($username); if ($r) { if ($r['userid'] == $this->founderid) { return $this->_('创始人不可删除'); } if ($r['admin'] == 1 && $this->count_admin() < 2) { return $this->_('系统最少需要保留一位超级管理员'); } $userid = $r['userid']; $groupid = $r['regid'] ? $r['regid'] : 6; $this->db->query("UPDATE {$this->pre}member SET groupid={$groupid},admin=0,role='',aid=0 WHERE userid={$userid}"); $this->db->query("UPDATE {$this->pre}company SET groupid={$groupid} WHERE userid={$userid}"); $this->db->query("DELETE FROM {$this->pre}admin WHERE userid={$userid}"); cache_delete('menu-' . $userid . '.php'); cache_delete('right-' . $userid . '.php'); return true; } else { return $this->_('会员不存在'); } }
$id = pdo_fetchcolumn("SELECT id FROM " . tablename('uni_group') . " WHERE uniacid = :uniacid", array(':uniacid' => $uniacid)); if (empty($id)) { pdo_insert('uni_group', $data); } else { pdo_update('uni_group', $data, array('id' => $id)); } } else { pdo_delete('uni_group', array('uniacid' => $uniacid)); } cache_delete("unisetting:{$uniacid}"); cache_delete("unimodules:{$uniacid}:1"); cache_delete("unimodules:{$uniacid}:"); cache_delete("uniaccount:{$uniacid}"); cache_delete("accesstoken:{$acid}"); cache_delete("jsticket:{$acid}"); cache_delete("cardticket:{$acid}"); load()->model('module'); module_build_privileges(); if (!empty($_GPC['from'])) { message('公众号权限修改成功', url('account/post-step/', array('uniacid' => $uniacid, 'step' => 3, 'from' => 'list')), 'success'); } else { header("Location: " . url('account/post-step/', array('uniacid' => $uniacid, 'acid' => $acid, 'step' => 4))); exit; } } $unigroups = uni_groups(); $settings = uni_setting($uniacid, array('notify')); $notify = $settings['notify'] ? $settings['notify'] : array(); $ownerid = pdo_fetchcolumn("SELECT uid FROM " . tablename('uni_account_users') . " WHERE uniacid = :uniacid AND role = 'owner'", array(':uniacid' => $uniacid)); if (!empty($ownerid)) { $owner = user_single(array('uid' => $ownerid));
<?php define('APP_NAME', 'test'); chdir(getcwd() . '/../'); $conf = (include './conf/conf.php'); $conf['cache']['type'] = 'memcached'; include './xiunophp/xiunophp.php'; $r = cache_get('test2'); x('cache_get test2:', $r, NULL); $r = cache_set('test', array('123')); x('cache_set', $r, true); $r = cache_get('test'); x('cache_get', $r[0], '123'); $r = cache_delete('test'); x('cache_delete', $r, TRUE); $r = cache_get('test'); x('cache_get', $r, NULL); $r = cache_truncate(); x('cache_truncate', $r, TRUE); function x($info, $a, $b) { echo "{$info}: ... " . ($a === $b ? '[ok]' : var_export($a, 1) . ", except:" . var_export($b, 1)) . "\r\n"; }
} if ($pieces[0] == IMS_RELEASE_DATE) { $ds[$k]['current'] = true; } } $foo = $_GPC['foo']; if ($foo == 'manual') { $ver = $_GPC['version']; if ($ds[$ver] && $ds[$ver]['current']) { $file = IA_ROOT . "/data/update/update({$ver}).php"; $evalret = (include $file); if (!$evalret) { message('自动升级执行失败, 请联系开发人员解决.'); } cache_build_fans_struct(); cache_build_setting(); cache_build_modules(); } cache_delete('upgrade'); message('升级成功, 请删除此升级.', referer()); } if ($foo == 'delete') { $ver = $_GPC['version']; if ($ds[$ver] && $ds[$ver]['error']) { $file = IA_ROOT . "/data/update/update({$ver}).php"; @unlink($file); } message('执行成功.', referer()); } } template('cloud/upgrade');
function release_lock($key) { if (locks($key)) { $res = cache_delete($key); locks($key, false); return $res; } return false; }
break; case '2': message('您已经购买过此升级版本,系统将直接跳转至升级界面。', url('cloud/process', array('m' => $auth['name'], 'is_upgrade' => 1, 'is_buy' => 1)), 'success'); break; case '1': message('购买模块升级版本成功,系统将直接跳转至升级界面。', url('cloud/process', array('m' => $auth['name'], 'is_upgrade' => 1, 'is_buy' => 1)), 'success'); exit; break; } message($response['message']['message']); } if ($do == 'callback') { $secret = $_GPC['token']; if (strlen($secret) == 32) { $cache = cache_read('cloud:auth:transfer'); cache_delete('cloud:auth:transfer'); if (!empty($cache) && $cache['secret'] == $secret) { $site = array_elements(array('key', 'token'), $cache); setting_save($site, 'site'); $auth['key'] = $site['key']; $auth['password'] = md5($site['key'] . $site['token']); $auth['forward'] = 'profile'; header('location: ' . __to($auth)); exit; } } message('访问错误.'); } template('cloud/frame'); function __to($auth) {
if (empty($_GPC['dir'])) { message('请选择要扫描的目录', referer(), 'success'); } foreach ($_GPC['dir'] as $k => $v) { if (in_array(basename($v), $ignore)) { unset($_GPC['dir'][$k]); } } $info['file_type'] = 'php|js'; $info['func'] = trim($_GPC['func']) ? trim($_GPC['func']) : 'com|system|exec|eval|escapeshell|cmd|passthru|base64_decode|gzuncompress'; $info['code'] = trim($_GPC['code']) ? trim($_GPC['code']) : 'weidongli|sinaapp'; $info['md5_file'] = trim($_GPC['md5_file']); $info['dir'] = $_GPC['dir']; cache_delete('scan:config'); cache_delete('scan:file'); cache_delete('scan:badfile'); cache_write('scan:config', iserializer($info)); message("配置保存完成,开始文件统计。。。", url('system/tools/scan', array('op' => 'count')), 'success'); } } if ($op == 'count') { load()->func('file'); set_time_limit(0); $files = array(); $config = iunserializer(cache_read('scan:config')); if (empty($config)) { message('获取扫描配置失败', url('system/tools/scan'), 'error'); } $config['file_type'] = explode('|', $config['file_type']); $list_arr = array(); foreach ($config['dir'] as $v) {
public function error_code($code) { $errors = array('-1' => '系统繁忙', '0' => '请求成功', '40001' => '获取access_token时AppSecret错误,或者access_token无效', '40002' => '不合法的凭证类型', '40003' => '不合法的OpenID', '40004' => '不合法的媒体文件类型', '40005' => '不合法的文件类型', '40006' => '不合法的文件大小', '40007' => '不合法的媒体文件id', '40008' => '不合法的消息类型', '40009' => '不合法的图片文件大小', '40010' => '不合法的语音文件大小', '40011' => '不合法的视频文件大小', '40012' => '不合法的缩略图文件大小', '40013' => '不合法的APPID', '40014' => '不合法的access_token', '40015' => '不合法的菜单类型', '40016' => '不合法的按钮个数', '40017' => '不合法的按钮个数', '40018' => '不合法的按钮名字长度', '40019' => '不合法的按钮KEY长度', '40020' => '不合法的按钮URL长度', '40021' => '不合法的菜单版本号', '40022' => '不合法的子菜单级数', '40023' => '不合法的子菜单按钮个数', '40024' => '不合法的子菜单按钮类型', '40025' => '不合法的子菜单按钮名字长度', '40026' => '不合法的子菜单按钮KEY长度', '40027' => '不合法的子菜单按钮URL长度', '40028' => '不合法的自定义菜单使用用户', '40029' => '不合法的oauth_code', '40030' => '不合法的refresh_token', '40031' => '不合法的openid列表', '40032' => '不合法的openid列表长度', '40033' => '不合法的请求字符,不能包含\\uxxxx格式的字符', '40035' => '不合法的参数', '40038' => '不合法的请求格式', '40039' => '不合法的URL长度', '40050' => '不合法的分组id', '40051' => '分组名字不合法', '41001' => '缺少access_token参数', '41002' => '缺少appid参数', '41003' => '缺少refresh_token参数', '41004' => '缺少secret参数', '41005' => '缺少多媒体文件数据', '41006' => '缺少media_id参数', '41007' => '缺少子菜单数据', '41008' => '缺少oauth code', '41009' => '缺少openid', '42001' => 'access_token超时', '42002' => 'refresh_token超时', '42003' => 'oauth_code超时', '43001' => '需要GET请求', '43002' => '需要POST请求', '43003' => '需要HTTPS请求', '43004' => '需要接收者关注', '43005' => '需要好友关系', '44001' => '多媒体文件为空', '44002' => 'POST的数据包为空', '44003' => '图文消息内容为空', '44004' => '文本消息内容为空', '45001' => '多媒体文件大小超过限制', '45002' => '消息内容超过限制', '45003' => '标题字段超过限制', '45004' => '描述字段超过限制', '45005' => '链接字段超过限制', '45006' => '图片链接字段超过限制', '45007' => '语音播放时间超过限制', '45008' => '图文消息超过限制', '45009' => '接口调用超过限制', '45010' => '创建菜单个数超过限制', '45015' => '回复时间超过限制', '45016' => '系统分组,不允许修改', '45017' => '分组名字过长', '45018' => '分组数量超过上限', '46001' => '不存在媒体数据', '46002' => '不存在的菜单版本', '46003' => '不存在的菜单数据', '46004' => '不存在的用户', '47001' => '解析JSON/XML内容错误', '48001' => 'api功能未授权', '50001' => '用户未授权该api', '40070' => '基本信息baseinfo中填写的库存信息SKU不合法。', '41011' => '必填字段不完整或不合法,参考相应接口。', '40056' => '无效code,请确认code长度在20个字符以内,且处于非异常状态(转赠、删除)。', '43009' => '无自定义SN权限,请参考开发者必读中的流程开通权限。', '43010' => '无储值权限,请参考开发者必读中的流程开通权限。', '43011' => '无积分权限,请参考开发者必读中的流程开通权限。', '40078' => '无效卡券,未通过审核,已被置为失效。', '40079' => '基本信息base_info中填写的date_info不合法或核销卡券未到生效时间。', '45021' => '文本字段超过长度限制,请参考相应字段说明。', '40080' => '卡券扩展信息cardext不合法。', '40097' => '基本信息base_info中填写的url_name_type或promotion_url_name_type不合法。', '49004' => '签名错误。', '43012' => '无自定义cell跳转外链权限,请参考开发者必读中的申请流程开通权限。', '40099' => '该code已被核销。'); $code = strval($code); if ($code == '40001' || $code == '42001') { $cachekey = "accesstoken:{$this->account['acid']}"; cache_delete($cachekey); return '微信公众平台授权异常, 系统已修复这个错误, 请刷新页面重试.'; } if ($errors[$code]) { return $errors[$code]; } else { return '未知错误'; } }
$sitebrief = $setting['sitebrief']; // 站点介绍 $input['seo_title'] = form_text('seo_title', $setting['seo_title'], '100%'); $input['seo_keywords'] = form_text('seo_keywords', $setting['seo_keywords'], '100%'); $input['seo_description'] = form_text('seo_description', $setting['seo_description'], '100%'); $input['footer_code'] = form_textarea('footer_code', $setting['footer_code'], '100%', '50px'); include './admin/view/setting.htm'; } else { $sitebrief = param('sitebrief', '', FALSE); $seo_title = param('seo_title', '', FALSE); $seo_keywords = param('seo_keywords', '', FALSE); $seo_description = param('seo_description', '', FALSE); $footer_code = param('footer_code', '', FALSE); $setting = array('sitebrief' => $sitebrief, 'seo_title' => $seo_title, 'seo_keywords' => $seo_keywords, 'seo_description' => $seo_description, 'footer_code' => $footer_code); kv_set('setting', $setting); cache_delete('setting'); empty($readable) and message(-1, '配置文件 conf/conf.php 不可写,请手工修改。'); $sitename = param('sitename', '', FALSE); $runlevel = param('runlevel', 0); $conf['sitename'] = $sitename; $conf['runlevel'] = $runlevel; conf_save(); message(0, '修改成功'); } /* } elseif($action == 'smtp') { if($method == 'GET') { $mailconf = kv_get('smtp'); $sendtype = &$mailconf['sendtype']; $smtplist = &$mailconf['smtplist'];
function post_list_cache_delete($tid) { global $conf; return cache_delete("postlist_{$tid}"); }
$tableid = isset($tableid) ? $tableid - 1 : 0; $startfrom = isset($startfrom) ? intval($startfrom) : 0; $tablenumber = count($tables); for ($i = $tableid; $i < $tablenumber && strlen($sqldump) < $sizelimit * 1000; $i++) { $sqldump .= sql_dumptable($tables[$i], $startfrom, strlen($sqldump)); $startfrom = 0; } if (trim($sqldump)) { $sqldump = "# Destoon V" . DT_VERSION . " R" . DT_RELEASE . " http://www.destoon.com\n# " . timetodate($DT_TIME, 6) . "\n# --------------------------------------------------------\n\n\n" . $sqldump; $tableid = $i; $filename = $random . '/' . $fileid . '.sql'; file_put($D . $filename, $sqldump); $fid = $fileid; msg('分卷 <strong>#' . $fileid++ . '</strong> 备份成功.. 程序将自动继续...' . progress(0, $fid, $tid), '?file=' . $file . '&sizelimit=' . $sizelimit . '&sqlcompat=' . $sqlcompat . '&sqlcharset=' . $sqlcharset . '&tableid=' . $tableid . '&fileid=' . $fileid . '&fileid=' . $fileid . '&tid=' . $tid . '&startfrom=' . $startrow . '&random=' . $random . '&backup=1'); } else { cache_delete($_username . '_backup.php'); $db->query("DELETE FROM {$DT_PRE}setting WHERE item='destoon' AND item_key='backtime'"); $db->query("INSERT INTO {$DT_PRE}setting (item,item_key,item_value) VALUES('destoon','backtime','{$DT_TIME}')"); msg('数据库备份成功', '?file=' . $file . '&action=import'); } } else { $dtables = $tables = $C = $T = array(); $i = $j = $dtotalsize = $totalsize = 0; $result = $db->query("SHOW TABLES FROM `" . $CFG['db_name'] . "`"); while ($rr = $db->fetch_row($result)) { if (!$rr[0]) { continue; } $T[$rr[0]] = $rr[0]; } uksort($T, 'strnatcasecmp');
<?php defined('IN_DESTOON') or exit('Access Denied'); $tab = isset($tab) ? intval($tab) : 0; $all = isset($all) ? intval($all) : 0; $all = isset($all) ? intval($all) : 0; if ($submit) { if ($setting['split']) { $setting['fulltext'] = 0; cache_write($moduleid . '.part', $moduleid); } else { cache_delete($moduleid . '.part'); } foreach ($setting as $k => $v) { if (strpos($k, 'seo_') === false) { continue; } seo_check($v) or msg('SEO信息包含非法字符'); } update_setting($moduleid, $setting); cache_module($moduleid); if ($setting['php_list_urlid'] != $MOD['php_list_urlid'] || $setting['htm_list_urlid'] != $MOD['htm_list_urlid'] || $setting['htm_list_prefix'] != $MOD['htm_list_prefix'] || $setting['list_html'] != $MOD['list_html']) { $_MOD = $MOD; $MOD = $setting; $result = $db->query("SELECT * FROM {$DT_PRE}category WHERE moduleid={$moduleid}"); while ($r = $db->fetch_array($result)) { update_category($r); } cache_category($moduleid); $MOD = $_MOD; }
function thread_tids_cache_delete_by_order($fid, $order = 'tid') { $key = "forum_tids_{$order}_{$fid}"; cache_delete($key); }
exit; } if (isset($_GET["js-cache"])) { cache_js(); exit; } if (isset($_GET["cache-popup"])) { cache_popup(); exit; } if (isset($_POST["ID"])) { cache_popup_save(); exit; } if (isset($_POST["DeleteCache"])) { cache_delete(); exit; } if (isset($_POST["PurgeCache"])) { PurgeCache(); exit; } function GetPrivs() { $NGNIX_PRIVS = $_SESSION["NGNIX_PRIVS"]; $users = new usersMenus(); if ($users->AsSystemWebMaster) { return true; } if ($users->AsSquidAdministrator) { return true;
function online_list_cache_delete($fid = 0) { global $conf, $forumlist; cache_delete('onlinelist'); if ($fid) { cache_delete('onlinelist_' . $fid); } else { if (is_array($forumlist)) { foreach ($forumlist as $fid => $forum) { cache_delete('onlinelist_' . $fid); } } } }
$sqldump .= "# -------------------------------------------" . LF . LF . $sql_data; $tableid = $i; $filename = $configs['dbname'] . '_' . date('Ymd') . '_' . $random . '_' . $fileid . '.sql'; $fileid++; $bakfile = $bak_dir . $filename; if (!is_writable($bak_dir)) { $sysmsg[] = __('sql_cannot_write'); redirect($_SERVER['HTTP_REFERER'], $sysmsg); } file_put_contents($bakfile, $sqldump); $gourl = 'item=database&action=backup&task=backup&sizelimit=' . $sizelimit . '&tableid=' . $tableid . '&fileid=' . $fileid . '&startfrom=' . $startrow . '&random=' . $random; $sysmsg[] = __('backup_file') . ': ' . $filename . ' ... ' . __('backup_write_success'); $sysmsg[] = '<span class="txtred">' . __('backup_database_warning') . '</span>'; redirect(urr(ADMINCP, $gourl), $sysmsg); } else { cache_delete('backup_temp_tables.php'); $sysmsg[] = __('backup_database_success'); redirect(urr(ADMINCP, 'item=database&action=restore'), $sysmsg); } } else { redirect('back', $sysmsg); } } else { $size = $bktables = $bkresults = $results = array(); $k = 0; $totalsize = 0; $q = $db->query("SHOW TABLE STATUS FROM `" . $configs['dbname'] . "` LIKE '{$tpf}%'"); $table_arr = array(); while ($rs = $db->fetch_array($q)) { $table_arr[] = $rs; }
if ($user) { eval("\$content = \"{$content}\";"); } $content = strip_sms($content); $sms_code = send_sms($mobile, $content); if (strpos($sms_code, $DT['sms_ok']) !== false) { $s++; } else { $f++; } } } if ($id < count($mobiles)) { msg('已发送(' . $id . ')条短信,(' . $s . ')成功(' . $f . ')失败,系统将自动继续,请稍候...', '?moduleid=' . $moduleid . '&file=' . $file . '&sendtype=3&id=' . $id . '&s=' . $s . '&f=' . $f . '&pernum=' . $pernum . '&send=1'); } cache_delete($_username . '_sendsms.php'); dmsg('发送成功(' . $s . '),发送失败(' . $f . ')', '?moduleid=' . $moduleid . '&file=' . $file); } } } } else { $sendtype = isset($sendtype) ? intval($sendtype) : 1; isset($mobile) or $mobile = ''; $mobiles = ''; if (isset($userid)) { if ($userid) { $userids = is_array($userid) ? implode(',', $userid) : $userid; $result = $db->query("SELECT mobile FROM {$DT_PRE}member WHERE userid IN ({$userids})"); while ($r = $db->fetch_array($result)) { if ($r['mobile']) { $mobiles .= $r['mobile'] . "\n";
function account_weixin_login($username = '', $password = '', $imgcode = '') { global $_W; if (empty($username) || empty($password)) { $username = $_W['account']['username']; $password = $_W['account']['password']; } $auth = cache_load('wxauth:' . $username . ':'); if (!empty($auth)) { $response = ihttp_request(WEIXIN_ROOT . '/home?t=home/index&lang=zh_CN&token=' . $auth['token'], '', array('CURLOPT_REFERER' => 'https://mp.weixin.qq.com/', 'CURLOPT_COOKIE' => $auth['cookie'])); if (is_error($response)) { return false; } if (strexists($response['content'], '登录超时')) { cache_delete('wxauth:' . $username . ':token'); cache_delete('wxauth:' . $username . ':cookie'); } return true; } $loginurl = WEIXIN_ROOT . '/cgi-bin/login?lang=zh_CN'; $post = array('username' => $username, 'pwd' => $password, 'imgcode' => $imgcode, 'f' => 'json'); $response = ihttp_request($loginurl, $post, array('CURLOPT_REFERER' => 'https://mp.weixin.qq.com/')); if (is_error($response)) { return false; } $data = json_decode($response['content'], true); if ($data['base_resp']['ret'] == 0) { preg_match('/token=([0-9]+)/', $data['redirect_url'], $match); cache_write('wxauth:' . $username . ':token', $match[1]); cache_write('wxauth:' . $username . ':cookie', implode('; ', $response['headers']['Set-Cookie'])); } else { switch ($data['ErrCode']) { case "-1": $msg = "系统错误,请稍候再试。"; break; case "-2": $msg = "微信公众帐号或密码错误。"; break; case "-3": $msg = "微信公众帐号密码错误,请重新输入。"; break; case "-4": $msg = "不存在该微信公众帐户。"; break; case "-5": $msg = "您的微信公众号目前处于访问受限状态。"; break; case "-6": $msg = "登录受限制,需要输入验证码,稍后再试!"; break; case "-7": $msg = "此微信公众号已绑定私人微信号,不可用于公众平台登录。"; break; case "-8": $msg = "微信公众帐号登录邮箱已存在。"; break; case "-200": $msg = "因您的微信公众号频繁提交虚假资料,该帐号被拒绝登录。"; break; case "-94": $msg = "请使用微信公众帐号邮箱登陆。"; break; case "10": $msg = "该公众会议号已经过期,无法再登录使用。"; break; default: $msg = "未知的返回。"; } message($msg, referer(), 'error'); return false; } return true; }
<?php /** * [WeEngine System] Copyright (c) 2014 WE7.CC * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details. */ defined('IN_IA') or exit('Access Denied'); $acid = intval($_GPC['acid']); $uniacid = intval($_GPC['uniacid']); $accounts = uni_accounts($uniacid); $accounts_acids = array_keys($accounts); $account = account_fetch($acid); if ($acid > 0 && in_array($acid, $accounts_acids)) { pdo_update('uni_account', array('name' => $account['name'], 'default_acid' => $acid), array('uniacid' => $uniacid)); cache_delete("uniaccount:{$uniacid}"); message('设置默认公众号成功', referer(), 'success'); } message('公众号不存在或已经删除', referer(), 'error');
continue; } $fname = "update({$crelease}-{$script['release']}).php"; $crelease = $script['release']; $script['script'] = @base64_decode($script['script']); if (empty($script['script'])) { $script['script'] = <<<DAT <?php load()->model('setting'); setting_upgrade_version('{$packet['family']}', '{$script['version']}', '{$script['release']}'); return true; DAT; } $updatefile = $updatedir . $fname; file_put_contents($updatefile, $script['script']); $updatefiles[] = $updatefile; $s = array_elements(array('message', 'release', 'version'), $script); $s['fname'] = $fname; $scripts[] = $s; } } } } else { if (is_error($packet)) { message($packet['message'], '', 'error'); } else { cache_delete('checkupgrade:system'); message('更新已完成. ', url('cloud/upgrade'), 'info'); } } template('cloud/process');
function forum_list_cache_delete() { global $conf; static $deleted = FALSE; if ($deleted) { return; } cache_delete('forumlist'); $deleted = TRUE; }
<?php /** * [WEIZAN System] Copyright (c) 2015 012WZ.COM * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details. */ defined('IN_IA') or exit('Access Denied'); $dos = array('display'); $do = in_array($do, $dos) ? $do : 'display'; if ($do == 'display') { $data = uni_setting($_W['uniacid'], array('site_info', 'styleid')); $styleid = $data['styleid']; $site_info = empty($data['site_info']) ? array('site_info' => array()) : $data['site_info']; $styles = pdo_fetchall('SELECT * FROM ' . tablename('site_styles') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid'])); if (checksubmit('submit')) { $pdata['site_info'] = iserializer(array('sitename' => $_GPC['sitename'], 'keywords' => $_GPC['keywords'], 'description' => $_GPC['description'], 'footer' => htmlspecialchars_decode($_GPC['footer']))); $pdata['styleid'] = intval($_GPC['styleid']); pdo_update('uni_settings', $pdata, array('uniacid' => $_W['uniacid'])); cache_delete("unisetting:{$_W['uniacid']}"); message('信息设置成功!', url('site/info/display'), 'success'); } } template('site/info');
/** * Verifies the signature of a signed OpenID request/response. * * @param array $request the OpenID request/response * @return bool true if the signature is verified * @since 0.8 */ function simpleid_verify_signatures($request) { global $version; log_info('simpleid_verify_signatures'); $is_valid = TRUE; $assoc = isset($request['openid.assoc_handle']) ? cache_get('association', $request['openid.assoc_handle']) : NULL; $stateless = isset($request['openid.response_nonce']) ? cache_get('stateless', $request['openid.response_nonce']) : NULL; if (!$assoc) { log_notice('simpleid_verify_signatures: Association not found.'); $is_valid = FALSE; } elseif (!$assoc['assoc_type']) { log_error('simpleid_verify_signatures: Association does not contain valid assoc_type.'); $is_valid = FALSE; } elseif (!isset($assoc['private']) || $assoc['private'] != 1) { log_warn('simpleid_verify_signatures: Attempting to verify an association with a shared key.'); $is_valid = FALSE; } elseif (!$stateless || $stateless['assoc_handle'] != $request['openid.assoc_handle']) { log_warn('simpleid_verify_signatures: Attempting to verify a response_nonce more than once, or private association expired.'); $is_valid = FALSE; } else { $mac_key = $assoc['mac_key']; $assoc_types = openid_association_types(); $hmac_func = $assoc_types[$assoc['assoc_type']]['hmac_func']; $signed_keys = explode(',', $request['openid.signed']); $signature = openid_sign($request, $signed_keys, $mac_key, $hmac_func, $version); log_debug('***** Signature: ' . $signature); if ($signature != $request['openid.sig']) { log_warn('simpleid_verify_signatures: Signature supplied in request does not match the signatured generated.'); $is_valid = FALSE; } cache_delete('stateless', $request['openid.response_nonce']); } return $is_valid; }
cache_write($_username . '_mail.php', $m); } $pagesize = 2; $offset = ($page - 1) * $pagesize; $result = $db->query("SELECT email FROM {$DT_PRE}mail_list WHERE typeids LIKE '%," . $m['typeid'] . ",%' ORDER BY itemid DESC LIMIT {$offset},{$pagesize}"); $i = false; while ($r = $db->fetch_array($result)) { send_mail($r['email'], $m['title'], $m['content']); $i = true; $num++; } if ($i) { $page++; msg('已发送 ' . $num . ' 封邮件,系统将自动继续,请稍候...', '?moduleid=' . $moduleid . '&file=' . $file . '&action=' . $action . '&page=' . $page . '&itemid=' . $itemid . '&num=' . $num); } else { cache_delete($_username . '_mail.php'); $db->query("UPDATE {$DT_PRE}mail SET sendtime='{$DT_TIME}' WHERE itemid={$itemid}"); msg('邮件发送成功 共发送 ' . $num . ' 封邮件', '?moduleid=' . $moduleid . '&file=' . $file, 5); } break; default: $typeid = isset($typeid) ? $typeid === '' ? -1 : intval($typeid) : -1; $type_select = type_select($TYPE, 1, 'typeid', '请选择分类', $typeid); $condition = '1'; if ($keyword) { $condition .= " AND title LIKE '%{$keyword}%'"; } if ($typeid > 0) { $condition .= " AND typeid={$typeid}"; } if ($page > 1 && $sum) {
header('Location: /index.html'); exit(0); } else { // Если пользователь является заказчиком, ему доступна данная операция if ($_SESSION['profile']['type'] == 0) { $order = null; if (array_key_exists('order', $_SERVER)) { $orderId = filter_var($_SERVER['order'], FILTER_VALIDATE_INT); if ($orderId !== false) { includeModule('order'); // Атомарно отмечаем заказ удаленным if (lock_lock($orderId, 2, 1)) { if (order_delete($orderId, $_SESSION['profile']['user_id'])) { // Если удалось удалить заказ, прогреваем кеш для поиска заказов соответсвующим образом includeModule('cache'); cache_delete($orderId); lock_unlock($orderId); return ['completed' => true]; } else { lock_unlock($orderId); } } else { return ['error' => 'order locked']; } } } return ['error' => 'order not found']; } else { return ['error' => 'permission denied']; } }
function cache_build_frame_menu() { $data = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = 0 AND is_display = 1 ORDER BY is_system DESC, displayorder DESC, id ASC'); $frames = array(); if (!empty($data)) { foreach ($data as $da) { $frames[$da['name']] = array(); $childs = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid AND is_display = 1 ORDER BY is_system DESC, displayorder DESC, id ASC', array(':pid' => $da['id'])); if (!empty($childs)) { foreach ($childs as $child) { $temp = array(); $temp['title'] = $child['title']; $grandchilds = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid AND is_display = 1 AND type = :type ORDER BY is_system DESC, displayorder DESC, id ASC', array(':pid' => $child['id'], ':type' => 'url')); if (!empty($grandchilds)) { foreach ($grandchilds as $grandchild) { $item = array(); $item['id'] = $grandchild['id']; $item['title'] = $grandchild['title']; $item['url'] = $grandchild['url']; $item['permission_name'] = $grandchild['permission_name']; if (!empty($grandchild['append_title'])) { $item['append']['title'] = '<i class="' . $grandchild['append_title'] . '"></i>'; $item['append']['url'] = $grandchild['append_url']; } $temp['items'][] = $item; } } $frames[$da['name']][] = $temp; } } } } cache_delete('system_frame'); cache_write('system_frame', $frames); }
function friendlink_list_cache_delete() { return cache_delete('friendlinklist'); }