本文整理汇总了PHP中getcache函数的典型用法代码示例。如果您正苦于以下问题:PHP getcache函数的具体用法?PHP getcache怎么用?PHP getcache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getcache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* 附件列表
*/
public function init() {
$where = '';
if($_GET['dosubmit']){
if(is_array($_GET['info'])&&!empty($_GET['info']))extract($_GET['info']);
if($filename) $where = "AND `filename` LIKE '%$filename%' ";
if($start_uploadtime && $end_uploadtime) {
$start = strtotime($start_uploadtime);
$end = strtotime($end_uploadtime);
if($start > $end) showmessage(L('range_not_correct'),HTTP_REFERER);
$where .= "AND `uploadtime` >= '$start' AND `uploadtime` <= '$end' ";
}
if($fileext) $where .= "AND `fileext`='$fileext' ";
$status = trim($_GET['status']);
if($status!='' && ($status==1 ||$status==0)) $where .= "AND `status`='$status' ";
$module = trim($_GET['module']);
if(isset($module) && $module!='') $where .= "AND `module`='$module' ";
}
$where .="AND `siteid`='".$this->siteid."'";
if($where) $where = substr($where, 3);
pc_base::load_sys_class('form');
$category = getcache('category_content_'.$this->siteid,'commons');
$modules = getcache('modules','commons');
$page = $_GET['page'] ? $_GET['page'] : '1';
$infos = $this->db->listinfo($where, 'uploadtime DESC', $page, $pagesize = 20);
$pages = $this->db->pages;
include $this->admin_tpl('attachment_list');
}
示例2: get_info
/**
* 获取评论信息
* @param $module 模型
* @param $contentid 文章ID
* @param $siteid 站点ID
*/
function get_info($module, $contentid, $siteid)
{
$category = getcache('category_content_' . $siteid, 'commons');
list($module, $catid) = explode('_', $module);
$cat = $category[$catid];
if ($cat['type'] == 1) {
//单网页 3.28 增加评论模块对单网页的支持
return array('title' => $cat['catname'], 'url' => $cat['url'], 'allow_comment' => 1);
} else {
//不是单网页
if (empty($contentid) || empty($catid)) {
return false;
}
$this->db->set_catid($catid);
$r = $this->db->get_one(array('catid' => $catid, 'id' => $contentid), '`title`');
//$category = getcache('category_content_'.$siteid, 'commons');
$model = getcache('model', 'commons');
//$cat = $category[$catid];
$data_info = array();
if ($cat['type'] == 0) {
$this->db->table_name = $this->db->db_tablepre . $model[$cat['modelid']]['tablename'] . '_data';
$data_info = $this->db->get_one(array('id' => $contentid));
}
if ($r) {
return array('title' => $r['title'], 'url' => go($catid, $contentid, 1), 'allow_comment' => isset($data_info['allow_comment']) ? $data_info['allow_comment'] : 1);
} else {
return false;
}
}
}
示例3: category_url
/**
* 获取栏目的访问路径
* 在修复栏目路径处重建目录结构用
* @param intval $catid 栏目ID
* @param intval $page 页数
*/
public function category_url($catid, $page = 1)
{
$M = getcache('ask', 'commons');
$M = $M[1];
$category = $this->categorys[$catid];
if ($category['type'] == 2) {
return $category['url'];
}
$page = max(intval($page), 1);
$setting = string2array($category['setting']);
$category_ruleid = $setting['category_ruleid'];
$urlrules = $this->urlrules[$M['category_ruleid']];
$urlrules_arr = explode('|', $urlrules);
if ($page == 1) {
$urlrule = $urlrules_arr[0];
} else {
$urlrule = $urlrules_arr[1];
}
$url = str_replace(array('{$catid}', '{$page}'), array($catid, $page), $urlrule);
if (strpos($url, '\\') !== false) {
$url = APP_PATH . str_replace('\\', '/', $url);
}
if (in_array(basename($url), array('index.html', 'index.htm', 'index.shtml'))) {
$url = dirname($url) . '/';
}
if (strpos($url, '://') === false) {
$url = str_replace('//', '/', $url);
}
if (strpos($url, '/') === 0) {
$url = substr($url, 1);
}
return $url;
}
示例4: vote
function vote($id, $pid)
{
$M = getcache('ask', 'commons');
$M = $M[1];
$_username = param::get_cookie('_username');
$_userid = param::get_cookie('_userid');
$id = intval($id);
$pid = intval($pid);
$userid = intval($_userid);
if (!$id || !$pid || !$userid) {
return false;
}
$r = $this->db->get_one("count(voteid) AS num", $this->db_tablepre . "ask_vote", "askid={$id} AND userid={$userid}");
if ($r['num'] > 0) {
return false;
}
$a = $this->db->get_one('catid', $this->db_tablepre . "ask", "askid={$id} AND siteid=" . $this->siteid);
//检测表
$posts_table_name = $this->posts_table($a['catid']);
$this->table_name = $posts_table_name;
$this->update(array('votecount' => '+=1'), "pid={$pid}");
if ($M['vote_give_credit']) {
$maxnum = floor($M['vote_max_credit'] / $M['vote_give_credit']);
if ($r['num'] <= $maxnum) {
$this->credit->update_credit($_userid, $_username, $M['vote_give_credit'], 1);
pc_base::load_app_class('receipts', 'pay', 0);
receipts::point($M['vote_give_credit'], $_userid, $_username, $flag, 'selfincome', L('votes_the_reward_integral'), $_username);
}
}
$posts['askid'] = $id;
$posts['pid'] = $pid;
$posts['userid'] = $userid;
$posts['addtime'] = SYS_TIME;
return $this->db->insert($posts, $this->db_tablepre . "ask_vote");
}
示例5: oauth
public function oauth() {
pc_base::load_plugin_class('weibooauth','',0);
$setting = getcache('weibo_var','plugins');
if(!isset($_REQUEST['oauth_verifier']) || $_REQUEST['oauth_verifier'] == '') {
if($this->auth_db->get_one(array('source'=>'sina'))) {
$txt = '授权成功,<a href="?m=zl_admin&c=plugin&a=config&pluginid='.$this->pluginid.'&module=removeauth&pc_hash='.$_SESSION['pc_hash'].'">解除绑定</a>';
} else {
$o = new WeiboOAuth( $setting['wb_akey'] , $setting['wb_skey']);
$keys = $o->getRequestToken();
print_r($keys);
$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , get_url());
$_SESSION['keys'] = $keys;
$txt = '<a href="'.$aurl.'">点击进行授权</a>';
}
} else {
$o = new WeiboOAuth( $setting['wb_akey'] , $setting['wb_skey'] , $_SESSION['keys']['oauth_token'] , $_SESSION['keys']['oauth_token_secret'] );
$last_key = $o->getAccessToken( $_REQUEST['oauth_verifier'] ) ;
$c = new WeiboClient( $setting['wb_akey'] , $setting['wb_skey'] , $last_key['oauth_token'] , $last_key['oauth_token_secret'] );
$ms = $c->home_timeline(); // done
$me = $c->verify_credentials();
$this->auth_db->insert(array('uid'=>$me['id'],'token'=>$last_key['oauth_token'],'tsecret'=>$last_key['oauth_token_secret'],'source'=>'sina'));
$txt = '授权成功,'.$me['name'].'<a href="?m=zl_admin&c=plugin&a=config&pluginid='.$this->pluginid.'&module=removeauth&pc_hash='.$_SESSION['pc_hash'].'">解除绑定</a>';
}
include $this->op->plugin_tpl('oauth',PLUGIN_ID);
}
示例6: url
function url($action = 'check') {
$modules = '';
$site = getcache('sitelist','commons');
$sitename = $site['1']['name'];
$siturl = $site['1']['domain'];
foreach ($site as $list) $sitelist .= $list['domain'].',';
$pars = array(
'action'=>$action,
'ZLCMS_username'=>'',
'sitename'=>$sitename,
'siteurl'=>$siturl,
'charset'=>CHARSET,
'version'=>PC_VERSION,
'release'=>PC_RELEASE,
'os'=>PHP_OS,
'php'=>phpversion(),
'mysql'=>mysql_get_server_info(),
'browser'=>urlencode($_SERVER['HTTP_USER_AGENT']),
'username'=>urlencode(param::get_cookie('admin_username')),
'email'=> urlencode(param::get_cookie('admin_email')),
'modules'=>ROUTE_M,
'sitelist'=>urlencode($sitelist),
'uuid'=>urlencode($this->uuid),
);
$data = http_build_query($pars);
$verify = md5($this->uuid);
if($s = $this->module()) {
$p = '&p='.$s;
}
return $this->update_url.'?'.$data.'&verify='.$verify.$p;
}
示例7: init
public function init()
{
if (isset($_POST['dosubmit']) || isset($_GET['dosubmit'])) {
$page = $_GET['page'] ? intval($_GET['page']) : 0;
$modules = array(array('name' => L('module'), 'function' => 'module'), array('name' => L('sites'), 'mod' => 'admin', 'file' => 'sites', 'function' => 'set_cache'), array('name' => L('category'), 'function' => 'category'), array('name' => L('downservers'), 'function' => 'downservers'), array('name' => L('badword_name'), 'function' => 'badword'), array('name' => L('ipbanned'), 'function' => 'ipbanned'), array('name' => L('keylink'), 'function' => 'keylink'), array('name' => L('linkage'), 'function' => 'linkage'), array('name' => L('position'), 'function' => 'position'), array('name' => L('admin_role'), 'function' => 'admin_role'), array('name' => L('urlrule'), 'function' => 'urlrule'), array('name' => L('sitemodel'), 'function' => 'sitemodel'), array('name' => L('type'), 'function' => 'type', 'param' => 'content'), array('name' => L('workflow'), 'function' => 'workflow'), array('name' => L('dbsource'), 'function' => 'dbsource'), array('name' => L('member_setting'), 'function' => 'member_setting'), array('name' => L('member_group'), 'function' => 'member_group'), array('name' => L('membermodel'), 'function' => 'membermodel'), array('name' => L('member_model_field'), 'function' => 'member_model_field'), array('name' => L('search_type'), 'function' => 'type', 'param' => 'search'), array('name' => L('search_setting'), 'function' => 'search_setting'), array('name' => L('update_vote_setting'), 'function' => 'vote_setting'), array('name' => L('update_link_setting'), 'function' => 'link_setting'), array('name' => L('special'), 'function' => 'special'), array('name' => L('setting'), 'function' => 'setting'), array('name' => L('database'), 'function' => 'database'), array('name' => L('update_formguide_model'), 'mod' => 'formguide', 'file' => 'formguide', 'function' => 'public_cache'), array('name' => L('cache_file'), 'function' => 'cache2database'), array('name' => L('cache_copyfrom'), 'function' => 'copyfrom'), array('name' => L('clear_files'), 'function' => 'del_file'), array('name' => L('video_category_tb'), 'function' => 'video_category_tb'));
$this->cache_api = pc_base::load_app_class('cache_api', 'admin');
$m = $modules[$page];
if ($m['mod'] && $m['function']) {
if ($m['file'] == '') {
$m['file'] = $m['function'];
}
$M = getcache('modules', 'commons');
if (in_array($m['mod'], array_keys($M))) {
$cache = pc_base::load_app_class($m['file'], $m['mod']);
$cache->{$m}['function']();
}
} else {
if ($m['target'] == 'iframe') {
echo '<script type="text/javascript">window.parent.frames["hidden"].location="index.php?' . $m['link'] . '";</script>';
} else {
$this->cache_api->cache($m['function'], $m['param']);
}
}
$page++;
if (!empty($modules[$page])) {
echo '<script type="text/javascript">window.parent.addtext("<li>' . L('update') . $m['name'] . L('cache_file_success') . '..........</li>");</script>';
showmessage(L('update') . $m['name'] . L('cache_file_success'), '?m=admin&c=cache_all&page=' . $page . '&dosubmit=1&pc_hash=' . $_SESSION['pc_hash'], 0);
} else {
echo '<script type="text/javascript">window.parent.addtext("<li>' . L('update') . $m['name'] . L('site_cache_success') . '..........</li>")</script>';
showmessage(L('update') . $m['name'] . L('site_cache_success'), 'blank');
}
} else {
include $this->admin_tpl('cache_all');
}
}
示例8: get_category
/**
* 获取站点栏目列表
* @param integer $siteid 站点ID
* @return array() 返回为数组
*/
public static function get_category($siteid) {
$category = getcache('category_content_'.$siteid, 'commons');
foreach ($category as $k=>$v) {
if (!in_array($v['type'], array(0,1))) unset($category[$k]);
}
return $category;
}
示例9: __construct
function __construct($modelid, $catid = 0, $categorys = array())
{
$this->modelid = $modelid;
$this->catid = $catid;
$this->categorys = $categorys;
$this->fields = getcache('model_field_' . $modelid, 'model');
}
示例10: __construct
function __construct() {
$this->db = pc_base::load_model('sitemodel_model');
$this->m_db = pc_base::load_model('sitemodel_field_model');
$this->M = new_html_special_chars(getcache('formguide', 'commons'));
$this->siteid = intval($_GET[siteid]) ? intval($_GET[siteid]) : get_siteid();
$this->M = $this->M[$this->siteid];
}
示例11: __construct
public function __construct()
{
$this->urlrules = getcache('urlrules', 'commons');
self::set_siteid();
$this->categorys = getcache('category_content_' . $this->siteid, 'commons');
$this->html_root = pc_base::load_config('system', 'html_root');
}
示例12: register
/**
* 申请友情链接
*/
public function register() {
$siteid = SITEID;
if(isset($_POST['dosubmit'])){
if($_POST['name']==""){
showmessage(L('sitename_noempty'),"?m=link&c=index&a=register&siteid=$siteid");
}
if($_POST['url']==""){
showmessage(L('siteurl_not_empty'),"?m=link&c=index&a=register&siteid=$siteid");
}
if(!in_array($_POST['linktype'],array('0','1'))){
$_POST['linktype'] = '0';
}
$link_db = pc_base::load_model(link_model);
$_POST['logo'] =new_html_special_chars($_POST['logo']);
if($_POST['linktype']=='0'){
$sql = array('siteid'=>$siteid,'typeid'=>$_POST['typeid'],'linktype'=>$_POST['linktype'],'name'=>$_POST['name'],'url'=>$_POST['url']);
}else{
$sql = array('siteid'=>$siteid,'typeid'=>$_POST['typeid'],'linktype'=>$_POST['linktype'],'name'=>$_POST['name'],'url'=>$_POST['url'],'logo'=>$_POST['logo']);
}
$link_db->insert($sql);
showmessage(L('add_success'), "?m=link&c=index&siteid=$siteid");
} else {
$setting = getcache('link', 'commons');
$setting = $setting[$siteid];
if($setting['is_post']=='0'){
showmessage(L('suspend_application'), HTTP_REFERER);
}
$this->type = pc_base::load_model('type_model');
$types = $this->type->get_types($siteid);//获取站点下所有友情链接分类
pc_base::load_sys_class('form', '', 0);
$SEO = seo(SITEID, '', L('application_links'), '', '');
include template('link', 'register');
}
}
示例13: category
public function category()
{
$id = $_GET['id'];
$categorys = array();
$result = getcache('category_ask_' . $this->siteid, 'commons');
if (!empty($result)) {
foreach ($result as $r) {
$categorys[$r['catid']] = $r;
}
}
if ($id) {
$str = "<span>→</span>";
$LANG_SELECT = L('please_select');
} else {
$str = '';
$LANG_SELECT = L('please_select');
}
if ($id) {
//$str .= '<select onchange="$(\'#catid\').val(this.value);category_load(this.value);" multiple style="height:300px;width:120px;">';
$str .= '<select onchange="$(\'#catid\').val(this.value);category_load(this.value);" multiple style="height:300px;width:120px;">';
} else {
$str .= '<select onchange="category_change_reload(this.options[this.selectedIndex].value)" multiple style="height:300px;width:120px;">';
}
$options = '';
foreach ($categorys as $i => $v) {
if (isset($id) && $v['parentid'] == $id || $v['module'] == 'ask') {
$options .= '<option value="' . $i . '">' . $v['catname'] . '</option>';
}
}
if (empty($options)) {
exit;
}
$str .= $options . '</select>';
echo $str;
}
示例14: addart
function addart($catid, $title, $content)
{
$info = array();
$info['catid'] = 3;
$info['title'] = "api push";
$info['content'] = "absolutelu api push";
$db_config = pc_base::load_config('database');
pc_base::load_sys_class('mysql', '', 0);
pc_base::load_sys_class('param', '', 0);
$db = pc_base::load_model('content_model');
$categorys = getcache('category_content_1', 'commons');
$category = $categorys[3];
//var_dump($categorys);
$modelid = $category['modelid'];
//var_dump($modelid);
//die;
$db->set_model($modelid);
$setting = string2array($category['setting']);
$workflowid = $setting['workflowid'];
$info['status'] = 99;
$info['keywords'] = "";
$info['description'] = str_cut(str_replace(array("\r\n", "\t", '[page]', '[/page]', '“', '”', ' '), '', strip_tags($info['content'])), 200);
$info['username'] = "sumuya";
$info['inputtime'] = '';
echo "1";
if ($db->add_content($info)) {
return true;
}
return false;
}
示例15: createindex
/**
* 创建索引
*/
public function createindex()
{
if (isset($_GET['dosubmit'])) {
//重建索引首先清空表所有数据,然后根据搜索类型接口重新全部重建索引
if (!isset($_GET['have_truncate'])) {
$db_tablepre = $this->db->db_tablepre;
//删除该站点全文索引
$this->db->delete(array('siteid' => $this->siteid));
$types = $this->type_db->select(array('siteid' => $this->siteid, 'module' => 'search'));
setcache('search_types', $types, 'search');
} else {
$types = getcache('search_types', 'search');
}
//$key typeid 的索引
$key = isset($_GET['key']) ? intval($_GET['key']) : 0;
foreach ($types as $_k => $_v) {
if ($key == $_k) {
$typeid = $_v['typeid'];
if ($_v['modelid']) {
if ($_v['typedir'] !== 'yp') {
$search_api = pc_base::load_app_class('search_api', 'content');
} else {
$search_api = pc_base::load_app_class('search_api', $_v['typedir']);
}
if (!isset($_GET['total'])) {
$total = $search_api->total($_v['modelid']);
} else {
$total = intval($_GET['total']);
$search_api->set_model($_v['modelid']);
}
} else {
$module = trim($_v['typedir']);
$search_api = pc_base::load_app_class('search_api', $module);
if (!isset($_GET['total'])) {
$total = $search_api->total();
} else {
$total = intval($_GET['total']);
}
}
$pagesize = $_GET['pagesize'] ? intval($_GET['pagesize']) : 50;
$page = max(intval($_GET['page']), 1);
$pages = ceil($total / $pagesize);
$datas = $search_api->fulltext_api($pagesize, $page);
foreach ($datas as $id => $r) {
$this->db->update_search($typeid, $id, $r['fulltextcontent'], $r['title'], $r['adddate'], 1);
}
$page++;
if ($pages >= $page) {
showmessage("正在更新 <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total} - 当前第 <font color='red'>{$page}</font> 页", "?m=search&c=search_admin&a=createindex&menuid=909&page={$page}&total={$total}&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1");
}
$key++;
showmessage("开始更新: <span style='color:#ff0000;font-size:14px;text-decoration:underline;' >{$_v['name']}</span> - 总数:{$total}条", "?m=search&c=search_admin&a=createindex&menuid=909&page=1&key={$key}&pagesize={$pagesize}&have_truncate=1&dosubmit=1");
}
}
showmessage('全站索引更新完成', 'blank');
} else {
$big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=search&c=search_type&a=add\', title:\'' . L('add_search_type') . '\', width:\'580\', height:\'240\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_search_type'));
include $this->admin_tpl('createindex');
}
}