/** * PC标签中调用数据 * @param array $data 配置数据 */ public function pc_tag($data) { $siteid = isset($data['siteid']) && intval($data['siteid']) ? intval($data['siteid']) : get_siteid(); $r = $this->db->select(array('pos' => $data['pos'], 'siteid' => $siteid)); $str = ''; if (!empty($r) && is_array($r)) { foreach ($r as $v) { if (defined('IN_ADMIN') && !defined('HTML')) { $str .= '<div id="block_id_' . $v['id'] . '" class="admin_block" blockid="' . $v['id'] . '">'; } if ($v['type'] == '2') { extract($v, EXTR_OVERWRITE); $data = string2array($data); if (!defined('HTML')) { ob_start(); include $this->template_url($id); $str .= ob_get_contents(); ob_clean(); } else { include $this->template_url($id); } } else { $str .= $v['data']; } if (defined('IN_ADMIN') && !defined('HTML')) { $str .= '</div>'; } } } return $str; }
function keyword ($field, $value) { //获取post过来的关键字,关键字用空格或者‘,’分割的 $data = array(); $data = split('[ ,]', $value); //加载关键字的数据模型 $keyword_db = pc_base::load_model('keyword_model'); $keyword_data_db = pc_base::load_model('keyword_data_model'); pc_base::load_sys_func('iconv'); if (is_array($data) && !empty($data)) { $siteid = get_siteid(); foreach ($data as $v) { $v = defined('IN_ADMIN') ? $v : safe_replace(addslashes($v)); $v = str_replace(array('//','#','.'),' ',$v); if (!$r = $keyword_db->get_one(array('keyword'=>$v, 'siteid'=>$siteid))) { $letters = gbk_to_pinyin($v); $letter = strtolower(implode('', $letters)); $tagid = $keyword_db->insert(array('keyword'=>$v, 'siteid'=>$siteid, 'pinyin'=>$letter, 'videonum'=>1), true); } else { $keyword_db->update(array('videonum'=>'+=1'), array('id'=>$r['id'])); $tagid = $r['id']; } $contentid = $this->id.'-'.$this->modelid; if (!$keyword_data_db->get_one(array('tagid'=>$tagid, 'siteid'=>$siteid, 'contentid'=>$contentid))) { $keyword_data_db->insert(array('tagid'=>$tagid, 'siteid'=>$siteid, 'contentid'=>$contentid)); } unset($contentid, $tagid, $letters); } } return $value; }
function __construct($modelid,$catid = 0,$categorys = array()) { $this->modelid = $modelid; $this->catid = $catid; $this->categorys = $categorys; $this->fields = getcache('model_field_'.$modelid,'model'); $this->siteid = get_siteid(); }
function _initialize() { $this->siteid = get_siteid(); // 用户权限检查 if (C('USER_AUTH_ON') && !in_array(CONTROLLER_NAME, explode(',', C('NOT_AUTH_MODULE')))) { if (!RBAC::AccessDecision()) { //检查认证识别号 if (!$_SESSION[C('USER_AUTH_KEY')]) { //跳转到认证网关 //$this->error('请先登录后台管理','index.php/Admin/Public/login/'); redirect('index.php/Admin/Public/login/'); } // 没有权限 抛出错误 if (C('RBAC_ERROR_PAGE')) { // 定义权限错误页面 $this->assign('jumpUrl', __MODULE__ . C('RBAC_ERROR_PAGE')); $this->error('您没有权限操作该项'); D('Log')->addLog(2); // redirect(C('RBAC_ERROR_PAGE')); } else { if (C('GUEST_AUTH_ON')) { $this->assign('jumpUrl', PHP_FILE . C('USER_AUTH_GATEWAY')); } // 提示错误信息 $this->error(L('_VALID_ACCESS_')); } } } // 记录操作日志 if (!in_array(ACTION_NAME, array('public_session_life'))) { D('Log')->addLog(1); } }
/** * member list */ function manage() { if (isset($_POST['dosubmit'])) { $member_setting = array2string($_POST['info']); $this->db->update(array('module' => 'member', 'setting' => $member_setting), array('module' => 'member')); setcache('member_setting', $_POST['info']); showmessage(L('operation_success'), HTTP_REFERER); } else { $show_scroll = true; $member_setting = $this->db->get_one(array('module' => 'member'), 'setting'); $member_setting = string2array($member_setting['setting']); $email_config = getcache('common', 'commons'); $this->sms_setting_arr = getcache('sms', 'sms'); $siteid = get_siteid(); if (empty($email_config['mail_user']) || empty($email_config['mail_password'])) { $mail_disabled = 1; } if (!empty($this->sms_setting_arr[$siteid])) { $this->sms_setting = $this->sms_setting_arr[$siteid]; if ($this->sms_setting['sms_enable'] == '0') { $sms_disabled = 1; } else { if (empty($this->sms_setting['userid']) || empty($this->sms_setting['productid']) || empty($this->sms_setting['sms_key'])) { $sms_disabled = 1; } } } else { $sms_disabled = 1; } include $this->admin_tpl('member_setting'); } }
function __construct($formid, $no_allowed = 0) { $this->formid = $formid; $this->no_allowed = $no_allowed ? 'disabled=""' : ''; $this->fields = getcache('formguide_field_' . $formid, 'model'); $this->siteid = get_siteid(); }
public function init() { if(isset($_POST['dosubmit'])) { $info['siteurl'] = trim($_POST['info']['siteurl']); $info['sitename'] = trim($_POST['info']['sitename']); $info['siteid'] = intval($_POST['info']['siteid']); if(empty($info['sitename'])) showmessage(L('downserver_not_empty'), HTTP_REFERER); if(empty($info['siteurl']) || !preg_match('/(\w+):\/\/(.+)[^\/]$/i', $info['siteurl'])) showmessage(L('downserver_error'), HTTP_REFERER); $insert_id = $this->db->insert($info,true); if($insert_id){ $this->_set_cache(); showmessage(L('operation_success'), HTTP_REFERER); } } else { $infos = $sitelist = array(); $current_siteid = get_siteid(); $where = "`siteid`='$current_siteid' or `siteid`=''"; $sitelists = $this->sites->get_list(); if($_SESSION['roleid'] == '1') { foreach($sitelists as $key=>$v) $sitelist[$key] = $v['name']; $default = L('all_site'); } else { $sitelist[$current_siteid] = $sitelists[$current_siteid]['name']; $default = ''; } $page = $_GET['page'] ? $_GET['page'] : '1'; $infos = $this->db->listinfo($where, 'listorder DESC,id DESC', $page, $pagesize = 20); $pages = $this->db->pages; include $this->admin_tpl('downservers_list'); } }
function add() { if ($_POST['dosubmit']) { $siteid = intval($_POST['siteid']) ? intval($_POST['siteid']) : showmessage(L('parameter_error'), HTTP_REFERER); if ($this->db->get_one(array('siteid' => $siteid))) { showmessage(L('wap_add_samesite_error'), HTTP_REFERER); } $sitename = trim(new_addslashes($_POST['sitename'])); $logo = trim($_POST['logo']); $domain = trim($_POST['domain']); $setting = array2string($_POST['setting']); $return_id = $this->db->insert(array('siteid' => $siteid, 'sitename' => $sitename, 'logo' => $logo, 'domain' => $domain, 'setting' => $setting), '1'); $this->wap_site_cache(); showmessage(L('operation_success'), '', '', 'add'); } else { $sitelists = array(); $current_siteid = get_siteid(); $sitelists = $this->sites->get_list(); if ($_SESSION['roleid'] == '1') { foreach ($sitelists as $key => $v) { $sitelist[$key] = $v['name']; } } else { $sitelist[$current_siteid] = $sitelists[$current_siteid]['name']; } $show_header = true; include $this->admin_tpl('m_add'); } }
/** * 获取左导航可访问菜单 * @return array */ public function getAccessibleLeftMenu($pid) { $menu_model = model('Menu'); $models = model('model')->where(array('siteid' => get_siteid()))->field('tablename')->select(); $post_type = array(); foreach ($models as $key => $value) { $post_type[] = $value['tablename']; } if (session(C('ADMIN_AUTH_KEY'))) { $menulist = $menu_model->where(array('pid' => $pid, 'status' => 1))->order('sort desc, id asc')->select(); } else { $role_id = session('user_info.role_id'); $menulist = $menu_model->table('__ACCESS__ as access, __NODE__ as node')->where(array('node.pid' => $pid, 'node.id' => array('exp', ' = access.node_id'), 'access.role_id' => $role_id, 'access.siteid' => get_siteid()))->order('node.sort desc, node.id asc')->select(); } // 过滤不属于当前站点的POST TYPE 菜单 foreach ($menulist as $key => $value) { if (empty($value['post_type']) || in_array($value['post_type'], $post_type)) { continue; } unset($menulist[$key]); } foreach ($menulist as $key => $value) { if (session(C('ADMIN_AUTH_KEY'))) { $childs = $menu_model->where(array('pid' => $value['id'], 'status' => 1))->order('sort desc')->select(); } else { $childs = $menu_model->table('__ACCESS__ as access, __NODE__ as node')->where(array('node.pid' => $value['id'], 'node.id' => array('exp', ' = access.node_id'), 'access.role_id' => $role_id, 'access.siteid' => get_siteid()))->order('node.sort desc, node.id asc')->select(); } $menulist[$key]['childs'] = $childs; } return $menulist; }
public function __construct() { $this->db_config = pc_base::load_config('database'); $this->db_setting = 'default'; parent::__construct(); $this->url = pc_base::load_app_class('url', 'content'); $this->siteid = get_siteid(); }
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]; }
/** * 推荐位编辑 */ public function edit() { if(isset($_POST['dosubmit'])) { $_POST['posid'] = intval($_POST['posid']); if(!is_array($_POST['info']) || empty($_POST['info']['name'])){ showmessage(L('operation_failure')); } $_POST['info']['siteid'] = intval($_POST['info']['modelid']) ? get_siteid() : 0; $_POST['info']['listorder'] = intval($_POST['info']['listorder']); $_POST['info']['maxnum'] = intval($_POST['info']['maxnum']); $_POST['info']['thumb'] = $_POST['info']['thumb']; $this->db->update($_POST['info'],array('posid'=>$_POST['posid'])); $this->_set_cache(); showmessage(L('operation_success'), '', '', 'edit'); } else { $info = $this->db->get_one(array('posid'=>intval($_GET['posid']))); extract($info); pc_base::load_sys_class('form'); $this->sitemodel_db = pc_base::load_model('sitemodel_model'); $sitemodel = $sitemodel = array(); $sitemodel = getcache('model','commons'); foreach($sitemodel as $value){ if($value['siteid'] == get_siteid())$modelinfo[$value['modelid']]=$value['name']; } $show_validator = $show_header = $show_scroll = true; include $this->admin_tpl('position_edit'); } }
/** * 查看邮件标签 * @param $data */ public function sg($data) { $ysqgk_id = $data['ysqgkid']; if (empty($ysqgk_id)) { $ysqgk_id = ''; } $bh = $data['bh']; $siteid = $data['siteid']; $pass = $data['pass']; if (empty($siteid)) { $siteid = get_siteid(); } if ($pass) { $pass = md5($pass); } if ($pass != '' and $ysqgk_id != '') { $sql = array('ysqgkid' => $ysqgk_id, 'pass' => $pass, 'siteid' => $siteid); } elseif ($ysqgk_id !== '') { $sql = array('ysqgkid' => $ysqgk_id, 'siteid' => $siteid); } elseif ($bh != '') { $sql = array('bh' => $bh, 'siteid' => $siteid); } $r = $this->ysqgk_db->select($sql, '*', $data['limit'], 'addtime ' . $data['order']); return new_html_special_chars($r); }
function listinfos($where = '', $order = '', $page = 1, $pagesize = 50, $flags = 0) { if (!isset($ACTOR)) { $ACTOR = getcache('actor_' . get_siteid(), 'ask'); } if ($where) { $where = " WHERE {$where}"; } if ($order) { $order = " ORDER BY {$order}"; } $page = max(intval($page), 1); $offset = $pagesize * ($page - 1); $limit = " LIMIT {$offset}, {$pagesize}"; $r = $this->get_one('', ' COUNT(*) AS num'); $number = $r['number']; $this->db->pages; $array = array(); $i = 1; $result = $this->db->query("SELECT * FROM {$this->table_name} {$where} {$order} {$limit}"); $data = $this->fetch_array($result); foreach ($data as $r) { $userids[] = $userid = $r['userid']; $r['orderid'] = $i; $_array[] = $array[$userid] = $r; $i++; } if ($userids != '') { $userids = implodeids($userids); $data = $this->db_m->listinfo("userid IN ({$userids})"); foreach ($data as $r) { $userid = $r['userid']; $credit = $r['point']; $r['lastdate'] = date('Y-m-d H:i', $r['lastdate']); foreach ($ACTOR[$r['actortype']] as $k => $v) { if ($credit >= $v['min'] && $credit <= $v['max']) { $r['grade'] = $v['grade'] . ' ' . $v['actor']; } elseif ($credit > $v['max']) { $r['grade'] = $v['grade'] . ' ' . $v['actor']; } } if ($flags) { $_info[$userid] = $r; } else { $info[] = array_merge($array[$userid], $r); } } if ($flags) { foreach ($_array as $r) { $userid = $r['userid']; $info[] = array_merge($_info[$userid], $r); } } } $info = array_filter($info); $this->number = $this->db_m->page; $this->db->free_result($result); return $info; }
public function attachment_list($where = array(), $order = 'id desc', $limit = 8) { $attachs = $this->where(array_merge(array('siteid' => get_siteid()), $where))->order($order)->page((isset($_GET['p']) ? $_GET['p'] : 0) . ', ' . $limit)->select(); $count = $this->where(array_merge(array('siteid' => get_siteid()), $where))->count(); $Page = new Page($count, $limit); $show = $Page->show(); return array("data" => $attachs, "pages" => $show); }
/** * ÉèÖÃÕ¾µãid */ private function set_siteid() { if (defined('IN_ADMIN')) { $this->siteid = get_siteid(); } else { param::get_cookie('siteid'); $this->siteid = param::get_cookie('siteid'); } }
public function __construct() { $this->db_config = pc_base::load_config('database'); $this->db_setting = 'cmsware'; parent::__construct(); $this->siteid = get_siteid(); $this->db->query("set character_set_client=utf8"); $this->db->query("set character_set_results=utf8"); }
function __construct() { //parent::__construct(); $this->M = new_html_special_chars(getcache('ask', 'commons')); $this->db = pc_base::load_model('ask_model'); $this->db2 = pc_base::load_model('ask_posts_model'); $this->db3 = pc_base::load_model('category_model'); $this->siteid = get_siteid(); }
public function v2_1_alpha() { // 创建分类表 $data = array('name' => '分类', 'typeid' => 2, 'tablename' => 'taxonomy', 'description' => '模型方式创建分类表'); $data['siteid'] = get_siteid(); $model = new \Admin\Model\ModelModel(); if ($modelid = $model->add($data)) { switch ($data['typeid']) { case 0: $model_sql = file_get_contents(MODEL_PATH . 'model.sql'); break; case 1: $model_sql = file_get_contents(MODEL_PATH . 'model_house.sql'); break; case 2: $model_sql = file_get_contents(MODEL_PATH . 'model_common.sql'); break; default: $model_sql = file_get_contents(MODEL_PATH . 'model_common.sql'); break; } $tablepre = C('DB_PREFIX'); $tablename = strtolower($data['tablename']); $model_sql = str_replace('$basic_table', $tablepre . $tablename, $model_sql); $model_sql = str_replace('$table_data', $tablepre . $tablename . '_data', $model_sql); $model_sql = str_replace('$table_model_field', $tablepre . 'model_field', $model_sql); $model_sql = str_replace('$modelid', $modelid, $model_sql); $model_sql = str_replace('$siteid', get_siteid(), $model_sql); if ($model->sql_execute($model_sql) === false) { echo "create table taxonomy fail!\n"; } } else { echo "create table taxonomy fail!\n"; } // 创建目录表 $terms_table_sql = sprintf("CREATE TABLE `%sterms` (\n `id` mediumint(8) unsigned primary key AUTO_INCREMENT,\n `name` varchar(50),\n `description` text,\n `siteid` smallint(5) NOT NULL,\n `updatetime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',\n `inputtime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", C('DB_PREFIX')); if (M()->execute($terms_table_sql) !== false) { echo "create table terms success!\n"; } else { echo "create table terms fail!\n"; } // 创建分类目录关联表 $term_taxonomy_table_sql = sprintf("CREATE TABLE `%sterm_taxonomy` (\n `id` mediumint(8) unsigned primary key AUTO_INCREMENT,\n `term_id` mediumint(8),\n `taxonomy_id` mediumint(8),\n `parent` mediumint(8),\n `siteid` smallint(5) NOT NULL,\n KEY taxonomy_term (taxonomy_id, term_id),\n KEY term (term_id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;", C('DB_PREFIX')); if (M()->execute($term_taxonomy_table_sql) !== false) { echo "create table term_taxonomy success!\n"; } else { echo "create table term_taxonomy fail!\n"; } // 创建目录文章关联表 $term_contents_table_sql = sprintf("CREATE TABLE `%sterm_contents` (\n `term_taxonomy_id` mediumint(8) unsigned,\n `content_id` int(11) unsigned,\n primary key (term_taxonomy_id, content_id)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8;", C('DB_PREFIX')); if (M()->execute($term_contents_table_sql) !== false) { echo "create table term_contents success!\n"; } else { echo "create table term_contents fail!\n"; } }
function __construct() { parent::__construct(); $this->siteid = get_siteid(); $this->filterLogin(); if (isset($this->exceptAuth[CONTROLLER_NAME]) && in_array(ACTION_NAME, $this->exceptAuth[CONTROLLER_NAME])) { return; } $this->filterAuth(); }
/** * js传值,统计展示次数 */ public function show() { $siteid = $_GET['siteid'] ? intval($_GET['siteid']) : get_siteid(); $spaceid = $_GET['spaceid'] ? intval($_GET['spaceid']) : 0; $id = $_GET['id'] ? intval($_GET['id']) : 0; if (!$spaceid || !$id) { exit(0); } else { $this->show_stat($siteid, $spaceid, $id); } }
function get_fields($modelid) { $field_array = array(); $fields = D("ModelField")->where(array('siteid' => get_siteid(), 'modelid' => $modelid, 'disabled' => 0))->order("listorder asc, fieldid asc")->limit(100)->select(); foreach ($fields as $_value) { $setting = string2array($_value['setting']); $_value = array_merge($_value, $setting); $field_array[$_value['field']] = $_value; } return $field_array; }
/** * 生成广告js文件 * @param intval $id 广告版位ID * @return boolen 成功返回true */ public function create_js($id = 0) { $id = intval($id); if (!$id) { $this->msg = L('no_create_js'); return false; } $siteid = get_siteid(); $r = $this->s_db->get_one(array('siteid' => $siteid, 'spaceid' => $id)); $now = SYS_TIME; if ($r['setting']) { $space_setting = string2array($r['setting']); } if ($r['type'] == 'code') { return true; } $poster_template = getcache('poster_template_' . $siteid, 'commons'); if ($poster_template[$r['type']]['option']) { $where = "`spaceid`='" . $id . "' AND `siteid`='" . $siteid . "' AND `disabled`=0 AND `startdate`<='" . $now . "' AND (`enddate`>='" . $now . "' OR `enddate`=0) "; $pinfo = $this->db->select($where, '*', '', '`listorder` ASC, `id` DESC'); if (is_array($pinfo) && !empty($pinfo)) { foreach ($pinfo as $k => $rs) { if ($rs['setting']) { $rs['setting'] = string2array($rs['setting']); $pinfo[$k] = $rs; } else { unset($pinfo[$k]); } } extract($r); } else { return true; } } else { $where = " `spaceid`='" . $id . "' AND `siteid`='" . $siteid . "' AND `disabled`=0 AND `startdate`<='" . $now . "' AND (`enddate`>='" . $now . "' OR `enddate`=0)"; $pinfo = $this->db->get_one($where, '*', '`listorder` ASC, `id` DESC'); if (is_array($pinfo) && $pinfo['setting']) { $pinfo['setting'] = string2array($pinfo['setting']); } extract($r); if (!is_array($pinfo) || empty($pinfo)) { return true; } extract($pinfo, EXTR_PREFIX_SAME, 'p'); } $file = CACHE_PATH . $path; ob_start(); include template('poster', $type); $data = ob_get_contents(); ob_end_clean(); $strlen = pc_base::load_config('system', 'lock_ex') ? file_put_contents($file, $data, LOCK_EX) : file_put_contents($file, $data); @chmod($file, 0777); return true; }
function __construct($formid) { $this->formid = $formid; $this->fields = getcache('formguide_field_'.$formid, 'model'); $this->siteid = get_siteid(); //初始化附件类 pc_base::load_sys_class('attachment','',0); $this->siteid = param::get_cookie('siteid'); $this->attachment = new attachment('formguide','0',$this->siteid); $this->site_config = getcache('sitelist','commons'); $this->site_config = $this->site_config[$this->siteid]; }
function __construct() { $this->db_config = pc_base::load_config('database'); $this->credit = pc_base::load_model('ask_credit_model'); $this->db_setting = 'default'; $this->table_name = 'ask_posts'; $this->table_member = 'member'; $this->siteid = get_siteid(); $this->CATEGORYS = getcache('category_ask_' . $this->siteid, 'commons'); parent::__construct(); }
function __construct() { pc_base::load_app_func('global'); pc_base::load_sys_class('format', '', 0); $this->dianping = pc_base::load_model('dianping_model'); $this->dianping_data = pc_base::load_model('dianping_data_model'); //list($this->modules, $contentid, $this->siteid) = decode_reviewsid($this->reviewsid); $this->username = param::get_cookie('_username'); $this->userid = param::get_cookie('_userid'); $this->siteid = get_siteid(); define('SITEID', $this->siteid); }
function __construct() { pc_base::load_app_func('global'); $this->vote = pc_base::load_model('vote_subject_model');//投票标题 $this->vote_option = pc_base::load_model('vote_option_model');//投票选项 $this->vote_data = pc_base::load_model('vote_data_model'); //投票统计的数据模型 $this->username = param::get_cookie('_username'); $this->userid = param::get_cookie('_userid'); $this->ip = ip(); $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid(); define("SITEID",$siteid); }
/** * 广告模板配置函数 */ function get_types() { $poster_template = getcache('poster_template_' . get_siteid(), 'commons'); $TYPES = array(); if (is_array($poster_template) && !empty($poster_template)) { foreach ($poster_template as $k => $template) { $TYPES[$k] = $template['name']; } } else { $TYPES = array('banner' => L('banner', '', 'poster'), 'fixure' => L('fixure'), 'float' => L('float'), 'couplet' => L('couplet'), 'imagechange' => L('imagechange'), 'imagelist' => L('imagelist'), 'text' => L('text'), 'code' => L('code')); } return $TYPES; }
function __construct() { parent::__construct(); $this->message_db = pc_base::load_model('message_model'); $this->message_group_db = pc_base::load_model('message_group_model'); $this->message_data_db = pc_base::load_model('message_data_model'); $this->_username = param::get_cookie('_username'); $this->_userid = param::get_cookie('_userid'); $this->_groupid = get_memberinfo($this->_userid,'groupid'); pc_base::load_app_func('global'); //定义站点ID常量,选择模版使用 $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid(); define("SITEID",$siteid); }
public function deleteModel($model_data) { $model = model('model'); $model_field = model('ModelField'); $model->startTrans(); if ($model->where(array('siteid' => get_siteid(), 'id' => $model_data['id']))->delete() !== false && $model_field->where(array('modelid' => $model_data['id'], 'siteid' => get_siteid()))->delete() !== false && $this->deleteModelMenu($model_data['tablename']) !== false && $model->drop_table($model_data['tablename']) !== false) { $model->commit(); return true; } else { $model->rollback(); return false; } }