Example #1
0
function get_keywords($data, $number = 3)
{
    $data = trim(strip_tags($data));
    if (empty($data)) {
        return '';
    }
    /*if(CHARSET != 'utf-8') {
    		$data = iconv('utf-8', CHARSET, $data);
    	} else {
    		$data = iconv('utf-8', 'gbk', $data);
    	}*/
    $segment = pc_base::load_sys_class('segment');
    return $segment->get_keyword($data);
    /*
    $http = pc_base::load_sys_class('http');
    $http->post(API_URL_GET_KEYWORDS, array('siteurl'=>SITE_URL, 'charset'=>CHARSET, 'data'=>$data, 'number'=>$number));
    	if($http->is_ok()) {
    		if(CHARSET != 'utf-8') {
    			return $http->get_data();
    		} else {
    			return iconv('gbk', 'utf-8', $http->get_data());
    		}
    	}
    	return '';
    */
}
Example #2
0
function system_information($data)
{
    $update = pc_base::load_sys_class('update');
    $notice_url = $update->notice();
    $string = base64_decode('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPiQoIiNtYWluX2ZyYW1laWQiKS5yZW1vdmVDbGFzcygiZGlzcGxheSIpOzwvc2NyaXB0PjxkaXYgaWQ9InBocGNtc19ub3RpY2UiPjwvZGl2PjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0IiBzcmM9Ik5PVElDRV9VUkwiPjwvc2NyaXB0Pg==');
    echo $data . str_replace('NOTICE_URL', $notice_url, $string);
}
Example #3
0
 /**
  * 获取api操作实例
  * @param string $classname 接口调用的类文件名
  * @param sting  $module	 模块名
  * @return object	 
  */
 public function get_api($module = 'admin')
 {
     if (!isset($this->api_list[$module]) || !is_object($this->api_list[$module])) {
         $this->api_list[$module] = pc_base::load_app_class('push_api', $module);
     }
     return $this->api_list[$module];
 }
Example #4
0
 public function right()
 {
     $this->member_db = pc_base::load_model('member_model');
     $this->messagequeue_db = pc_base::load_model('messagequeue_model');
     $total_member = $this->member_db->count();
     //会员总数
     $todaytime = strtotime(date('Y-m-d', SYS_TIME));
     //今日会员数
     $today_member = $this->member_db->count("`regdate` > '{$todaytime}'");
     $total_messagequeue = $this->messagequeue_db->count();
     //消息总数
     $mysql_version = $this->member_db->get_version();
     //mysql版本
     $mysql_table_status = $this->member_db->get_table_status();
     $mysql_table_size = $mysql_table_index_size = '';
     foreach ($mysql_table_status as $table) {
         $mysql_table_size += $table['Data_length'];
         $mysql_table_index_size += $table['Index_length'];
     }
     $mysql_table_size = sizecount($mysql_table_size);
     $mysql_table_index_size = sizecount($mysql_table_index_size);
     //应用个数
     $applist = getcache('applist');
     $appnum = empty($applist) ? 0 : count($applist);
     include $this->admin_tpl('right');
 }
Example #5
0
 /**
  * 修改公告
  */
 public function edit()
 {
     $_GET['aid'] = intval($_GET['aid']);
     if (!$_GET['aid']) {
         showmessage(L('illegal_operation'));
     }
     if (isset($_POST['dosubmit'])) {
         $_POST['announce'] = $this->check($_POST['announce'], 'edit');
         if ($this->db->update($_POST['announce'], array('aid' => $_GET['aid']))) {
             showmessage(L('announced_a'), HTTP_REFERER, '', 'edit');
         }
     } else {
         $where = array('aid' => $_GET['aid']);
         $an_info = $this->db->get_one($where);
         pc_base::load_sys_class('form', '', 0);
         //获取站点模板信息
         pc_base::load_app_func('global', 'admin');
         $template_list = template_list($this->siteid, 0);
         foreach ($template_list as $k => $v) {
             $template_list[$v['dirname']] = $v['name'] ? $v['name'] : $v['dirname'];
             unset($template_list[$k]);
         }
         $show_header = $show_validator = $show_scroll = 1;
         include $this->admin_tpl('announce_edit');
     }
 }
 function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'default';
     $this->table_name = 'dianping_type';
     parent::__construct();
 }
Example #7
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     $this->db = pc_base::load_model('member_model');
     pc_base::load_app_func('global');
     /*获取系统配置*/
     $this->settings = getcache('settings', 'admin');
     $this->applist = getcache('applist', 'admin');
     if (isset($_GET) && is_array($_GET) && count($_GET) > 0) {
         foreach ($_GET as $k => $v) {
             if (!in_array($k, array('m', 'c', 'a'))) {
                 $_POST[$k] = $v;
             }
         }
     }
     if (isset($_POST['appid'])) {
         $this->appid = intval($_POST['appid']);
     } else {
         exit('0');
     }
     if (isset($_POST['data'])) {
         parse_str(sys_auth($_POST['data'], 'DECODE', $this->applist[$this->appid]['authkey']), $this->data);
         if (!is_array($this->data)) {
             exit('0');
         }
     } else {
         exit('0');
     }
     if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         $this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];
         if ($this->applist[$this->appid]['authkey'] != $this->data['ps_auth_key']) {
             exit('0');
         }
     }
 }
		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);
		}
 public function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'comment';
     $this->table_name = 'comment_setting';
     parent::__construct();
 }
	public function __construct() {
		$this->db_config = pc_base::load_config('database');
		$this->db_setting = 'default';
		$this->table_name = 'model';
		parent::__construct();
		$this->charset = $this->db_config[$this->db_setting]['charset'];
	}
 public function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'reviews';
     $this->table_name = $this->old_table_name = 'reviews_check';
     parent::__construct();
 }
Example #12
0
 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');
     }
 }
function sys_auth($string, $operation = 'ENCODE', $key = '', $expiry = 0)
{
    $key_length = 4;
    $key = md5($key != '' ? $key : pc_base::load_config('system', 'auth_key'));
    $fixedkey = md5($key);
    $egiskeys = md5(substr($fixedkey, 16, 16));
    $runtokey = $key_length ? $operation == 'ENCODE' ? substr(md5(microtime(true)), -$key_length) : substr($string, 0, $key_length) : '';
    $keys = md5(substr($runtokey, 0, 16) . substr($fixedkey, 0, 16) . substr($runtokey, 16) . substr($fixedkey, 16));
    $string = $operation == 'ENCODE' ? sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $egiskeys), 0, 16) . $string : base64_decode(substr($string, $key_length));
    $i = 0;
    $result = '';
    $string_length = strlen($string);
    for ($i = 0; $i < $string_length; $i++) {
        $result .= chr(ord($string[$i]) ^ ord($keys[$i % 32]));
    }
    if ($operation == 'ENCODE') {
        return $runtokey . str_replace('=', '', base64_encode($result));
    } else {
        if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $egiskeys), 0, 16)) {
            return substr($result, 26);
        } else {
            return '';
        }
    }
}
 /**
  * 按月份创建表
  */
 private function create_table()
 {
     $data_info = pc_base::load_config('database', $this->db_setting);
     $charset = $data_info['charset'];
     $sql = "CREATE TABLE IF NOT EXISTS `" . $this->table_name . "` (\r\n  \t\t`id` int(10) unsigned NOT NULL auto_increment,\r\n  \t\t`pid` smallint(5) unsigned NOT NULL default '0',\r\n  \t\t`siteid` smallint(5) unsigned NOT NULL default '0',\r\n  \t\t`spaceid` smallint(5) unsigned NOT NULL default '0',\r\n  \t\t`username` char(20) NOT NULL,\r\n  \t\t`area` char(40) NOT NULL,\r\n  \t\t`ip` char(15) NOT NULL,\r\n  \t\t`referer` char(120) NOT NULL,\r\n  \t\t`clicktime` int(10) unsigned NOT NULL default '0',\r\n  \t\t`type` tinyint(1) unsigned NOT NULL default '1',\r\n  \t\tPRIMARY KEY  (`id`),\r\n  \t\tKEY `pid` (`pid`,`type`,`ip`)\r\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=" . $charset . " ;";
     $this->db->query($sql);
 }
Example #15
0
 function __construct()
 {
     parent::__construct();
     $this->db = pc_base::load_model('workflow_model');
     $this->admin_db = pc_base::load_model('admin_model');
     $this->siteid = $this->get_siteid();
 }
Example #16
0
 function __construct()
 {
     $this->db = pc_base::load_model('content_model');
     $this->_userid = param::get_cookie('_userid');
     $this->_username = param::get_cookie('_username');
     $this->_groupid = param::get_cookie('_groupid');
 }
Example #17
0
 private function _format($id, $data, $type)
 {
     switch ($type) {
         case '1':
             //json
             if (CHARSET == 'gbk') {
                 $data = array_iconv($data, 'gbk', 'utf-8');
             }
             return json_encode($data);
             break;
         case '2':
             //xml
             $xml = pc_base::load_sys_class('xml');
             return $xml->xml_serialize($data);
             break;
         case '3':
             //js
             pc_base::load_app_func('global');
             ob_start();
             include template_url($id);
             $html = ob_get_contents();
             ob_clean();
             return format_js($html);
             break;
     }
 }
Example #18
0
 /**
  * 创建索引
  */
 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');
     }
 }
Example #19
0
 /**
  * 按照模型搜索
  */
 public function lists()
 {
     $tag = safe_replace(addslashes($_GET['tag']));
     $keyword_data_db = pc_base::load_model('keyword_data_model');
     //获取标签id
     $r = $this->keyword_db->get_one(array('keyword' => $tag, 'siteid' => $this->siteid), 'id');
     if (!$r['id']) {
         showmessage('不存在此关键字!');
     }
     $tagid = intval($r['id']);
     $page = max($_GET['page'], 1);
     $pagesize = 20;
     $where = '`tagid`=\'' . $tagid . '\' AND `siteid`=' . $this->siteid;
     $infos = $keyword_data_db->listinfo($where, '`id` DESC', $page, $pagesize);
     $pages = $keyword_data_db->pages;
     $total = $keyword_data_db->number;
     if (is_array($infos)) {
         $datas = array();
         foreach ($infos as $info) {
             list($contentid, $modelid) = explode('-', $info['contentid']);
             $this->db->set_model($modelid);
             $res = $this->db->get_one(array('id' => $contentid), 'title, description, url, inputtime, style');
             $res['title'] = str_replace($tag, '<font color="#f00">' . $tag . '</font>', $res['title']);
             $res['description'] = str_replace($tag, '<font color="#f00">' . $tag . '</font>', $res['description']);
             $datas[] = $res;
         }
     }
     $SEO = seo($siteid, '', $tag);
     include template('content', 'tag_list');
 }
Example #20
0
 public function __construct($appid, $appkey, $callback)
 {
     $this->appid = $appid;
     $this->appkey = $appkey;
     $this->callback = $callback;
     pc_base::load_app_func('utils');
 }
Example #21
0
 public function update()
 {
     set_time_limit(120);
     $old_attachment_path = isset($_POST['old_attachment_path']) && trim($_POST['old_attachment_path']) ? trim($_POST['old_attachment_path']) : showmessage(L('old_attachment_address_empty'));
     $new_attachment_path = isset($_POST['new_attachment_path']) && trim($_POST['new_attachment_path']) ? trim($_POST['new_attachment_path']) : showmessage(L('new_attachment_address_empty'));
     //获取数据表列表
     $db = pc_base::load_model('site_model');
     $r = $db->query("show tables");
     $r = $db->fetch_array($db_list);
     foreach ($r as $k => $v) {
         $v = array_pop($v);
         if (strpos($v, $db->db_tablepre) === false) {
             continue;
         }
         $table_name = str_replace($db->db_tablepre, '', $v);
         //获取每个表的数据表结构
         if (!($modle_table_db = pc_base::load_model($table_name . '_model'))) {
             $modle_table_db = $db;
         }
         $s = $modle_table_db->get_fields($table_name);
         if ($s) {
             $sql = '';
             foreach ($s as $key => $val) {
                 //对数据表进行过滤,只有CHAR、TEXT或mediumtext类型的字段才可以保存下附件的地址。
                 if (preg_match('/(char|text|mediumtext)+/i', $val)) {
                     $sql .= !empty($sql) ? ", `{$key}`=replace(`{$key}`, '{$old_attachment_path}', '{$new_attachment_path}')" : "`{$key}`=replace(`{$key}`, '{$old_attachment_path}', '{$new_attachment_path}')";
                 }
             }
             if (!empty($sql)) {
                 $modle_table_db->query("UPDATE " . $db->db_tablepre . $table_name . " SET {$sql}");
             }
         }
     }
     showmessage(L('operation_success'));
 }
 function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'default';
     $this->table_name = 'category_priv';
     parent::__construct();
 }
Example #23
0
 /**
  * 更新模型缓存
  */
 public static function update_cache_model()
 {
     $sitemodel_db = pc_base::load_model('sitemodel_model');
     $data = $sitemodel_db->select(array('type' => 2), "*", 1000, 'sort', '', 'modelid');
     setcache('member_model', $data, 'commons');
     if (!defined('MODEL_PATH')) {
         //模型原型存储路径
         define('MODEL_PATH', PC_PATH . 'modules' . DIRECTORY_SEPARATOR . 'member' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR);
     }
     if (!defined('CACHE_MODEL_PATH')) {
         //模型缓存路径
         define('CACHE_MODEL_PATH', PHPCMS_PATH . 'caches' . DIRECTORY_SEPARATOR . 'caches_model' . DIRECTORY_SEPARATOR . 'caches_data' . DIRECTORY_SEPARATOR);
     }
     require MODEL_PATH . 'fields.inc.php';
     //更新内容模型类:表单生成、入库、更新、输出
     $classtypes = array('form', 'input', 'update', 'output');
     foreach ($classtypes as $classtype) {
         $cache_data = file_get_contents(MODEL_PATH . 'member_' . $classtype . '.class.php');
         $cache_data = str_replace('}?>', '', $cache_data);
         foreach ($fields as $field => $fieldvalue) {
             if (file_exists(MODEL_PATH . $field . DIRECTORY_SEPARATOR . $classtype . '.inc.php')) {
                 $cache_data .= file_get_contents(MODEL_PATH . $field . DIRECTORY_SEPARATOR . $classtype . '.inc.php');
             }
         }
         $cache_data .= "\r\n } \r\n?>";
         file_put_contents(CACHE_MODEL_PATH . 'member_' . $classtype . '.class.php', $cache_data);
         chmod(CACHE_MODEL_PATH . 'member_' . $classtype . '.class.php', 0777);
     }
     return true;
 }
Example #24
0
 /**
  *  加载缓存驱动
  * @param $cache_name 	缓存配置名称
  * @return object
  */
 public function load($cache_name)
 {
     $object = null;
     if (isset($this->cache_config[$cache_name]['type'])) {
         switch ($this->cache_config[$cache_name]['type']) {
             case 'file':
                 $object = pc_base::load_sys_class('cache_file');
                 break;
             case 'memcache':
                 define('MEMCACHE_HOST', $this->cache_config[$cache_name]['hostname']);
                 define('MEMCACHE_PORT', $this->cache_config[$cache_name]['port']);
                 define('MEMCACHE_TIMEOUT', $this->cache_config[$cache_name]['timeout']);
                 define('MEMCACHE_DEBUG', $this->cache_config[$cache_name]['debug']);
                 $object = pc_base::load_sys_class('cache_memcache');
                 break;
             case 'apc':
                 $object = pc_base::load_sys_class('cache_apc');
                 break;
             default:
                 $object = pc_base::load_sys_class('cache_file');
         }
     } else {
         $object = pc_base::load_sys_class('cache_file');
     }
     return $object;
 }
Example #25
0
 /**
  * 构造函数
  * 
  */
 public function __construct()
 {
     $this->db = pc_base::load_model('session_model');
     $this->lifetime = pc_base::load_config('system', 'session_ttl');
     session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
     session_start();
 }
Example #26
0
	function __construct() {
		$this->db = pc_base::load_model('content_model');
		pc_base::load_app_class('rssbuilder','','','0');
		$this->siteid = $_GET['siteid'] ? intval($_GET['siteid']) : '1';
		$this->rssid = intval($_GET['rssid']);
		define('SITEID', $this->siteid);
	}
Example #27
0
 function __construct($modelid)
 {
     $this->db = pc_base::load_model('sitemodel_field_model');
     $this->db_pre = $this->db->db_tablepre;
     $this->modelid = $modelid;
     $this->fields = getcache('model_field_' . $modelid, 'model');
 }
Example #28
0
 /**
  * 推送选择界面
  */
 public function init()
 {
     if ($_POST['dosubmit']) {
         $c = pc_base::load_model('content_model');
         $c->set_model($_POST['modelid']);
         $info = array();
         $ids = explode('|', $_POST['id']);
         if (is_array($ids)) {
             foreach ($ids as $id) {
                 $info[$id] = $c->get_content($_POST['catid'], $id);
             }
         }
         $_GET['add_action'] = $_GET['add_action'] ? $_GET['add_action'] : $_GET['action'];
         $this->push->{$_GET}['add_action']($info, $_POST);
         showmessage(L('success'), '', '', 'push');
     } else {
         pc_base::load_app_func('global', 'template');
         if (method_exists($this->push, $_GET['action'])) {
             $html = $this->push->{$_GET['action']}(array('modelid' => $_GET['modelid'], 'catid' => $_GET['catid']));
             $tpl = isset($_GET['tpl']) ? 'push_to_category' : 'push_list';
             include $this->admin_tpl($tpl);
         } else {
             showmessage('CLASS METHOD NO EXISTS!', 'blank');
         }
     }
 }
Example #29
0
 public function __construct()
 {
     $this->db_config = pc_base::load_config('database');
     $this->db_setting = 'default';
     $this->table_name = 'search';
     parent::__construct();
 }
Example #30
0
 function __construct()
 {
     $this->db = pc_base::load_model('copyfrom_model');
     pc_base::load_sys_class('form', '', 0);
     parent::__construct();
     $this->siteid = $this->get_siteid();
 }