/** * 实例化getinfo:由于getinfo类采用了单件模式,所以实例化比较特殊 * * @param bool $reality * @param num $num * @return object */ function singLeton($reality, $num) { require_once R_P . 'lib/getinfo.class.php'; $info =& GetInfo::getInstance($reality); $info->cachenum = $num; return $info; }
/** * 实例化getinfo:由于getinfo类采用了单件模式,所以实例化比较特殊 * * @param bool $reality * @param num $num * @return object */ function singLeton($reality, $num) { L::loadClass('getinfo', '', false); $info =& GetInfo::getInstance($reality); $info->cachenum = $num; return $info; }
} updatecache_c(); adminmsg('operate_success', $basename . '&action=blacklist'); } else { include PrintEot('pwcache'); exit; } } elseif ($action == 'update') { $type = S::getGP('type', 'G'); if (!$type) { include PrintEot('pwcache'); exit; } else { !$db_sortnum && ($db_sortnum = 20); L::loadClass('getinfo', '', false); $getinfo =& GetInfo::getInstance(); if (in_array($type, array('replysort', 'replysortday', 'replysortweek'))) { $step = intval(S::getGP('step')); //* require_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php'); pwCache::getData(D_P . 'data/bbscache/forum_cache.php'); $arr_forumkeys = array_keys($forum); $fourmlimit = array(); for ($j = 0; $j < 5; $j++) { $replysort_judge = ''; //* @include_once pwCache::getPath(S::escapePath(D_P.'data/bbscache/replysort_judge_'.$j.'.php')); pwCache::getData(S::escapePath(D_P . 'data/bbscache/replysort_judge_' . $j . '.php')); $replysort_judge && ($fourmlimit[$j] = $replysort_judge); } if (!$step) { $step = 0; for ($j = 0; $j < 5; $j++) {
function updateFansSort() { global $db; L::loadClass('getinfo', '', false); $getinfo =& GetInfo::getInstance(); $userId = $userIds = array(); $db->update("DELETE FROM pw_elements WHERE type='totalfans' "); $userIds = $getinfo->getTotalFansSort(100); if (!S::isArray($userIds)) { return false; } foreach ($userIds as $key => $value) { $userId[$key]['id'] = $value['uid']; $userId[$key]['value'] = $value['fans']; $userId[$key]['type'] = "totalfans"; $userId[$key]['mark'] = "fans"; } if ($userId) { $sql = "REPLACE INTO pw_elements(id,value,type,mark) VALUES " . S::sqlMulti($userId, true); $db->update($sql); } return true; }
<?php /*this file will be the handler that communicate between ajax and php class */ error_reporting(E_ALL); ini_set("display_errors", "On"); include_once 'info.class.php'; $send_method = $_SERVER['REQUEST_METHOD']; // getting Global post varible if (strtolower($send_method) == 'post') { // checking if method useis post //echo $send_method; $get_info = new GetInfo(); // instanciate class echo $get_info->file_data(); // getting response data }
<?php /*this file will be search handler that communicate between ajax and php class */ error_reporting(E_ALL); ini_set("display_errors", "On"); include_once 'info.class.php'; //include php class $send_method = $_SERVER['REQUEST_METHOD']; // getting Global post varible if (strtolower($send_method) == 'post') { // checking if method useis post //echo $send_method; $search = $_POST['search_item']; // getting search input from ajax //echo $search; $search_info = new GetInfo(); // instanciate class $search_info->searchItem($search); // passing input to php class search function }
require_once '../cache/MemcacheOperate.php'; class GetInfo { public function returnInfo() { $id = $_POST['userid']; $format = is_null($_POST['format']) ? 'json' : $_POST['format']; $db = Db::getInstance(); try { $dbConn = $db->getConnect(); $mem = new MemcacheOperate(); $result = $mem->cacheData('info'); //var_dump($result); if ($result) { return Response::getReturn('200', 'success', $result, $format); } else { $result = $dbConn->query("select * from t_user where id = {$id}"); if ($result) { $result = $result->fetch(PDO::FETCH_ASSOC); $mem->cacheData('info', $result, 200); return Response::getReturn('200', 'success', $result, $format); } return Response::getReturn('400', 'fail', $result, $format); } } catch (Exception $e) { echo $e->getMessage(); } } } $info = new GetInfo(); $info->returnInfo();
public static function info() { GetInfo::comm(); }