function space_open($uid, $username, $gid = 0, $email = '') { global $_SGLOBAL, $_SCONFIG; if (empty($uid) || empty($username)) { return array(); } //验证空间是否被管理员删除 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spacelog') . " WHERE uid='{$uid}' AND flag='-1'"); if ($value = $_SGLOBAL['db']->fetch_array($query)) { showmessage('the_space_has_been_closed'); } $space = array('uid' => $uid, 'username' => $username, 'dateline' => $_SGLOBAL['timestamp'], 'groupid' => $gid); inserttable('space', $space, 0, true); inserttable('spacefield', array('uid' => $uid, 'email' => $email), 0, true); //发送PM if ($_SGLOBAL['supe_uid'] && $_SGLOBAL['supe_uid'] != $uid) { include_once S_ROOT . './uc_client/client.php'; uc_pm_send($_SGLOBAL['supe_uid'], $uid, cplang('space_open_subject'), cplang('space_open_message', array(getsiteurl())), 1, 0, 0); } //产生feed include_once S_ROOT . './source/function_cp.php'; $_uid = $_SGLOBAL['supe_uid']; $_username = $_SGLOBAL['supe_username']; $_SGLOBAL['supe_uid'] = $uid; $_SGLOBAL['supe_username'] = addslashes($username); feed_add('profile', cplang('feed_space_open')); $_SGLOBAL['supe_uid'] = $_uid; $_SGLOBAL['supe_username'] = $_username; return $space; }
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')); }
/** * * IP禁止判断接口,供外部调用 ... */ public function check_ip() { $ip_array = array(); //当前IP $ip = ip(); //加载IP禁止缓存 $ipbanned_cache = getcache('ipbanned', 'commons'); if (!empty($ipbanned_cache)) { foreach ($ipbanned_cache as $data) { $ip_array[$data['ip']] = $data['ip']; //是否是IP段 if (strpos($data['ip'], '*')) { $ip_min = $this->convert_ip("min", $data['ip']); $ip_max = $this->convert_ip("max", $data['ip']); $result = $this->ipforbidden($ip, $ip_min, $ip_max); if ($result == 0 && $data['expires'] > SYS_TIME) { //被封 showmessage('你在IP禁止段内,所以禁止你访问'); } } else { //不是IP段,用绝对匹配 if ($ip == $data['ip'] && $data['expires'] > SYS_TIME) { showmessage('IP地址绝对匹配,禁止你访问'); } } } } }
/** * 推送选择界面 */ 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'); } } }
public function init() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $userid = param::get_cookie('_userid'); $sql = " `userid` = '{$userid}'"; if (isset($_GET['dosubmit'])) { $type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : ''; $endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : ''; $starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : ''; if (!empty($starttime) && empty($endtime)) { $endtime = SYS_TIME; } if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) { showmessage(L('wrong_time_over_time_to_time_less_than')); } if (!empty($starttime)) { $sql .= $sql ? " AND `creat_at` BETWEEN '{$starttime}' AND '{$endtime}' " : " `creat_at` BETWEEN '{$starttime}' AND '{$endtime}' "; } if (!empty($type)) { $sql .= $sql ? " AND `type` = '{$type}' " : " `type` = '{$type}'"; } } $list = $this->spend_db->listinfo($sql, '`id` desc', $page); $pages = $this->spend_db->pages; include template('pay', 'spend_list'); }
function checkcloudstatus($showMessage = true) { global $_G; $res = false; $cloudStatus = $_G['setting']['cloud_status']; $site_id = $_G['setting']['my_siteid']; $site_key = $_G['setting']['my_sitekey']; if ($site_id && $site_key) { switch ($cloudStatus) { case 1: $res = 'cloud'; break; case 2: $res = 'unconfirmed'; break; default: $res = 'upgrade'; } } elseif (!$cloudStatus && !$site_id && !$site_key) { $res = 'register'; } elseif ($showMessage) { if (defined('IN_ADMINCP')) { cpmsg_error('cloud_status_error'); } else { showmessage('cloud_status_error'); } } return $res; }
function usesubmit() { global $_G; $info = array('credits' => intval($_POST['credits']), 'percredit' => intval($_POST['percredit']), 'credittype' => $_G['gp_credittype'], 'left' => intval($_POST['credits']), 'magicid' => intval($this->magic['magicid']), 'receiver' => array()); if ($info['credits'] < 1) { showmessage(lang('magic/gift', 'gift_bad_credits_input')); } if ($info['percredit'] < 1 || $info['percredit'] > $info['credits']) { showmessage(lang('magic/gift', 'gift_bad_percredit_input')); } $member = array(); if (preg_match('/^extcredits[1-8]$/', $info['credittype'])) { $member = DB::fetch_first('SELECT * FROM ' . DB::table('common_member_count') . " WHERE uid = '{$_G['uid']}'"); if ($member[$info['credittype']] < $info['credits']) { showmessage(lang('magic/gift', 'gift_credits_out_of_own')); } $extcredits = str_replace('extcredits', '', $info['credittype']); updatemembercount($_G['uid'], array($extcredits => -$info['credits']), 1, 'BGC', $this->magic['magicid']); } else { showmessage(lang('magic/gift', 'gift_bad_credittype_input')); } DB::update('common_member_field_home', array('magicgift' => addslashes(serialize($info))), array('uid' => $_G['uid'])); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); showmessage(lang('magic/gift', 'gift_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
/** * 申请友情链接 */ public function register() { if (isset($_POST['dosubmit'])) { if ($_POST['name'] == "") { showmessage(L('sitename_noempty'), U('link/index/register')); } if ($_POST['url'] == "") { showmessage(L('siteurl_not_empty'), U('link/index/register')); } if (!in_array($_POST['linktype'], array('0', '1'))) { $_POST['linktype'] = '0'; } $link_db = Loader::model('link_model'); $_POST['logo'] = String::htmlspecialchars($_POST['logo']); if ($_POST['linktype'] == '0') { $sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url']); } else { $sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url'], 'logo' => $_POST['logo']); } $link_db->insert($sql); showmessage(L('add_success'), U('link/index')); } else { $setting = S('common/link'); if (isset($setting['is_post']) && $setting['is_post'] == '0') { showmessage(L('suspend_application'), HTTP_REFERER); } $this->type = Loader::model('type_model'); $types = $this->type->get_types(); // 获取站点下所有友情链接分类 $SEO = seo('', L('application_links'), '', ''); include template('link', 'register'); } }
function edit() { if(isset($_POST['dosubmit'])) { $urlruleid = intval($_POST['urlruleid']); $_POST['info']['urlrule'] = rtrim(trim($_POST['info']['urlrule']),'.php'); $_POST['info']['urlrule'] = $this->url_replace($_POST['info']['urlrule']); if($this->url_ifok($_POST['info']['urlrule'])==false){ showmessage('url规则里含有非法php字符'); } $this->db->update($_POST['info'],array('urlruleid'=>$urlruleid)); $this->public_cache_urlrule(); showmessage(L('update_success'),'','','edit'); } else { $show_validator = $show_header = ''; $urlruleid = $_GET['urlruleid']; $r = $this->db->get_one(array('urlruleid'=>$urlruleid)); extract($r); $modules_arr = $this->module_db->select('','module,name'); $modules = array(); foreach ($modules_arr as $r) { $modules[$r['module']] = $r['name']; } include $this->admin_tpl('urlrule_edit'); } }
function global_header() { global $_G; if(!$_G[uid]) { loadcache('plugin'); $config = $_G['cache']['plugin']['ct_login_yinxiangpai']; $login_url = $config['login_url'] ? unserialize($config['login_url']) : ''; $isopen = $config['isopen'] ? $config['isopen'] : 0 ; if(empty($login_url))showmessage(lang('plugin/ct_login_yinxiangpai','login_url')); $login_arr = explode('[ct]', str_replace(array("\n", "\t"), array('', ''), $config['m_url'])); //$m_url = array_diff($login_arr,array('')); if($login_arr){ foreach($login_arr as $k=>$v){ if(empty($v))continue; $m_url[$k]=strtolower(trim($v)); } } $http = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://'; $get_url = $http.strtolower($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); $current_page = CURSCRIPT . '_' . CURMODULE; if((in_array($current_page,$login_url) || in_array( $get_url,$m_url) )&& !$_G[uid] && $isopen ) { $target_url = $_G['siteurl'].'plugin.php?id=ct_login_yinxiangpai:index'; header('Location: '.$target_url); } } }
/** * 申请友情链接 */ 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'); } }
function readRemoteAkSk() { global $_G; $siteUrl = null; $adminEmail = ''; $bbsName = ''; if (isset($_G['siteurl'])) { $siteUrl = $_G['siteurl'] . 'api/mobile/iyz_index.php'; $siteUrl = str_replace('api/mobile/api/mobile/', 'api/mobile/', $siteUrl); } if (isset($_G['setting']['adminemail'])) { $adminEmail = $_G['setting']['adminemail']; } if (isset($_G['setting']['bbname'])) { $bbsName = $_G['setting']['bbname']; } if (empty($siteUrl)) { showmessage(lang('plugin/bigapp', 'no_site_url'), '', array(), array('alert' => 'error')); } $obj = new BkSvr(1, 2, 30); //fake ak/sk $aksk = $obj->getInfo(BigAppConf::$ucRegUrl, array('method' => 'regist', 'site_url' => $siteUrl, 'bbs_name' => $bbsName, 'admin_email' => $adminEmail)); if (isset($aksk['app_key']) && isset($aksk['app_secret'])) { $ak = $aksk['app_key']; $sk = $aksk['app_secret']; } if (empty($ak) || empty($sk)) { showmessage(lang('plugin/bigapp', 'get_ak_sk_fail')); } return array($ak, $sk); }
function __construct() { parent::__construct(); //检查 session 是否已经登录 $users = session('admin_info'); if ($users) { if (md5($users['admin_id'] . C('secret_key')) != $users['secret_key']) { session_destroy(); redirect(U('Public/login')); exit; } $this->admin_id = $users['admin_id']; $this->admin_name = $users['admin_name']; } else { redirect(U('Public/login')); exit; } $this->assign('loginUser', $users); /***----------权限控制-----------***/ $AuthLogic = new \Admin\Logic\AuthLogic($this->admin_id); if (true === $AuthLogic->check_auth()) { } else { if (IS_AJAX) { $this->error('没有操作权限'); exit; } else { showmessage('没有该页面权限'); exit; } } }
/** * return_url get形式响应 */ public function respond_get() { if (isset($_GET['code'])) { $payment = $this->get_by_code($_GET['code']); if (!$payment) { showmessage(L('payment_failed')); } $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); Loader::lib('pay:pay_factory', false); $payment_handler = new pay_factory($pay_name, $cfg); $return_data = $payment_handler->receive(); if ($return_data) { if ($return_data['order_status'] == 0) { $this->update_member_amount_by_sn($return_data['order_id']); } $this->update_recode_status_by_sn($return_data['order_id'], $return_data['order_status']); showmessage(L('pay_success'), SITE_URL . 'index.php?app=pay&controller=deposit'); } else { showmessage(L('pay_failed'), SITE_URL . 'index.php?app=pay&controller=deposit'); } } else { showmessage(L('pay_success')); } }
function _list() { global $_G; $id = intval($_GET['id']); $and = ''; $url = URL . "m=article&a=list"; if ($id > 0) { foreach ($_G[setting][article_tag] as $k => $v) { if ($k == $id) { $tag = $v; } } if (!$tag) { showmessage('未找到分类'); return false; } $and .= " AND tag = " . $id; $url .= "&id=" . $id; } $rs = D(array('and' => $and . ' AND `hide` = 0 ', 'table' => 'article', 'order' => '`sort` DESC,`id` DESC'), array('size' => 10, 'url' => $url)); foreach ($rs[goods] as $k => $v) { $rs[goods][$k][message] = trim_html($v[message], 1); } $this->add(array('tag' => $tag)); $this->add($rs); seo('文章列表' . ' - ' . $_G['setting'][title]); $this->show(); }
public function init() { $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $userid = cookie('_userid'); $where = array('userid' => $userid); if (isset($_GET['dosubmit'])) { $type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : ''; $endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : ''; $starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : ''; if (!empty($starttime) && empty($endtime)) { $endtime = TIME; } if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) { showmessage(L('wrong_time_over_time_to_time_less_than')); } if (!empty($starttime)) { $where['creat_at'] = array('between', $starttime . ',' . $endtime); } if (!empty($type)) { $where['type'] = $type; } } $list = $this->spend_db->where($where)->order('id desc')->listinfo($page); $pages = $this->spend_db->pages; include template('pay', 'spend_list'); }
public static function mobileoutput() { global $_G; if (!defined('TPL_DEFAULT')) { $content = ob_get_contents(); ob_end_clean(); $content = preg_replace("/href=\"(\\w+\\.php)(.*?)\"/e", "mobilereplace('\\1', '\\2')", $content); ob_start(); $content = '<?xml version="1.0" encoding="utf-8"?>' . $content; if ('utf-8' != CHARSET) { @header('Content-Type: text/html; charset=utf-8'); $content = diconv($content, CHARSET, 'utf-8'); } echo $content; exit; } elseif (defined('TPL_DEFAULT') && !$_G['cookie']['dismobilemessage'] && $_G['mobile']) { ob_end_clean(); ob_start(); $_G['forcemobilemessage'] = true; $query_sting_tmp = str_replace(array('&mobile=yes', 'mobile=yes'), array(''), $_SERVER['QUERY_STRING']); $_G['setting']['mobile']['pageurl'] = $_G['siteurl'] . substr($_G['PHP_SELF'], 1) . ($query_sting_tmp ? '?' . $query_sting_tmp . '&mobile=no' : '?mobile=no'); unset($query_sting_tmp); dsetcookie('dismobilemessage', '1', 3600); showmessage('not_in_mobile'); exit; } }
function _checklowerlimit($action, $uid = 0, $coef = 1, $fid = 0, $returnonly = 0) { global $_G; include_once libfile('class/credit'); $credit =& credit::instance(); $limit = $credit->lowerlimit($action, $uid, $coef, $fid); if ($returnonly) { return $limit; } if ($limit !== true) { $GLOBALS['id'] = $limit; $lowerlimit = is_array($action) && $action['extcredits' . $limit] ? abs($action['extcredits' . $limit]) + $_G['setting']['creditspolicy']['lowerlimit'][$limit] : $_G['setting']['creditspolicy']['lowerlimit'][$limit]; $rulecredit = array(); if (!is_array($action)) { $rule = $credit->getrule($action, $fid); foreach ($_G['setting']['extcredits'] as $extcreditid => $extcredit) { if ($rule['extcredits' . $extcreditid]) { $rulecredit[] = $extcredit['title'] . ($rule['extcredits' . $extcreditid] > 0 ? '+' . $rule['extcredits' . $extcreditid] : $rule['extcredits' . $extcreditid]); } } } else { $rule = array(); } $values = array('title' => $_G['setting']['extcredits'][$limit]['title'], 'lowerlimit' => $lowerlimit, 'unit' => $_G['setting']['extcredits'][$limit]['unit'], 'ruletext' => $rule['rulename'], 'rulecredit' => implode(', ', $rulecredit)); if (!is_array($action)) { if (!$fid) { showmessage('credits_policy_lowerlimit', '', $values); } else { showmessage('credits_policy_lowerlimit_fid', '', $values); } } else { showmessage('credits_policy_lowerlimit_norule', '', $values); } } }
/** * 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 usesubmit() { global $_G; $id = intval($_G['gp_id']); $idtype = $_G['gp_idtype']; $blog = magic_check_idtype($id, $idtype); $num = 10; $list = $ids = $note_inserts = array(); $fusername = dimplode($_POST['fusername']); if ($fusername) { $query = DB::query('SELECT * FROM ' . DB::table('home_friend') . " WHERE uid='{$_G['uid']}' AND fusername IN (" . $fusername . ") LIMIT {$num}"); $note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}")); while ($value = DB::fetch($query)) { $ids[] = $value['fuid']; $value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small')); $list[] = $value; $note_inserts[] = "('{$value['fuid']}', '{$name}', '1', '{$_G['uid']}', '{$_G['username']}', '{$note}', '{$_G['timestamp']}')"; } } if (empty($ids)) { showmessage('magicuse_has_no_valid_friend'); } DB::query('INSERT INTO ' . DB::table('home_notification') . '(uid, type, new, authorid, author, note, dateline) VALUES ' . implode(',', $note_inserts)); DB::query('UPDATE ' . DB::table('common_member') . ' SET newprompt = newprompt + 1 WHERE uid IN (' . dimplode($ids) . ')'); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); $op = 'show'; include template('home/magic_call'); }
/** * 保存配置信息 */ public function save() { $setting = array(); $setting['admin_email'] = is_email($_POST['setting']['admin_email']) ? trim($_POST['setting']['admin_email']) : showmessage(L('email_illegal'), HTTP_REFERER); $setting['maxloginfailedtimes'] = intval($_POST['setting']['maxloginfailedtimes']); $setting['minrefreshtime'] = intval($_POST['setting']['minrefreshtime']); $setting['mail_type'] = intval($_POST['setting']['mail_type']); $setting['mail_server'] = trim($_POST['setting']['mail_server']); $setting['mail_port'] = intval($_POST['setting']['mail_port']); $setting['category_ajax'] = intval(abs($_POST['setting']['category_ajax'])); $setting['mail_user'] = trim($_POST['setting']['mail_user']); $setting['mail_auth'] = intval($_POST['setting']['mail_auth']); $setting['mail_from'] = trim($_POST['setting']['mail_from']); $setting['mail_password'] = trim($_POST['setting']['mail_password']); $setting['errorlog_size'] = trim($_POST['setting']['errorlog_size']); $setting = array2string($setting); $this->db->update(array('setting' => $setting), array('module' => 'admin')); //存入admin模块setting字段 //如果开始盛大通行证接入,判断服务器是否支持curl $snda_error = ''; if ($_POST['setconfig']['snda_akey'] || $_POST['setconfig']['snda_skey']) { if (function_exists('curl_init') == FALSE) { $snda_error = L('snda_need_curl_init'); $_POST['setconfig']['snda_enable'] = 0; } } set_config($_POST['setconfig']); //保存进config文件 $this->setcache(); showmessage(L('setting_succ') . $snda_error, HTTP_REFERER); }
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'); } }
/** * 添加规则 */ public function add() { if (isset($_POST['dosubmit'])) { $ruledata['fromid'] = isset($_POST['fromid']) ? intval($_POST['fromid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $ruledata['toid'] = isset($_POST['toid']) ? intval($_POST['toid']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $ruledata['fromrate'] = isset($_POST['fromrate']) ? intval($_POST['fromrate']) : showmessage(L('illegal_parameters'), HTTP_REFERER); $ruledata['torate'] = isset($_POST['torate']) ? intval($_POST['torate']) : showmessage(L('illegal_parameters'), HTTP_REFERER); if(empty($_POST['from']) || empty($_POST['to'])) { showmessage(L('illegal_parameters'), HTTP_REFERER); } $fromarr = explode('_', $_POST['from']); $toarr = explode('_', $_POST['to']); $ruledata['from'] = isset($fromarr[0]) ? $fromarr[0] : ''; $ruledata['fromname'] = isset($fromarr[1]) ? $fromarr[1] : ''; $ruledata['fromunit'] = isset($fromarr[2]) ? $fromarr[2] : ''; $ruledata['to'] = isset($toarr[0]) ? $toarr[0] : ''; $ruledata['toname'] = isset($toarr[1]) ? $toarr[1] : ''; $ruledata['tounit'] = isset($toarr[2]) ? $toarr[2] : ''; $creditlistarr = $this->db->get_one(array('name'=>'creditrate')); $creditlist = string2array($creditlistarr['data']); $creditlist[] = $ruledata; $noticedata['creditlist'] = $creditlist; //加入消息队列 messagequeue::add('credit_update', $noticedata); setcache('creditlist', $creditlist); $this->db->insert(array('name'=>'creditrate', 'data'=>array2string($creditlist)), 1, 1); showmessage(L('operation_success'), HTTP_REFERER); } $applist = getcache('applist'); include $this->admin_tpl('credit_add'); }
/** * 编译模板 * * @param $module 模块名称 * @param $template 模板文件名 * @param $istag 是否为标签模板 * @return unknown */ public function template_compile($module, $template, $style = 'default') { if (strpos($module, '/') === false) { $tplfile = $_tpl = PC_PATH . 'templates' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html'; } elseif (strpos($module, 'yp/') !== false) { $module = str_replace('/', DIRECTORY_SEPARATOR, $module); $tplfile = $_tpl = PC_PATH . 'templates' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html'; } else { $plugin = str_replace('plugin/', '', $module); $module = str_replace('/', DIRECTORY_SEPARATOR, $module); $tplfile = $_tpl = PC_PATH . 'plugin' . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $template . '.html'; } if ($style != 'default' && !file_exists($tplfile)) { $style = 'default'; $tplfile = PC_PATH . 'templates' . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . '.html'; } if (!file_exists($tplfile)) { showmessage("templates" . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . $template . ".html is not exists!"); } $content = @file_get_contents($tplfile); $filepath = CACHE_PATH . 'caches_template' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR; if (!is_dir($filepath)) { mkdir($filepath, 0777, true); } $compiledtplfile = $filepath . $template . '.php'; $content = $this->template_parse($content); $strlen = file_put_contents($compiledtplfile, $content); chmod($compiledtplfile, 0777); return $strlen; }
/** * 按照模型搜索 */ 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'); }
public function removeauth() { if($this->auth_db->delete(array('source'=>'sina'))) { showmessage('ok'); } else { showmessage('fail'); } }
/** * return_url get形式响应 */ public function respond_get() { if ($_GET['code']) { $payment = $this->get_by_code($_GET['code']); if (!$payment) { showmessage(L('payment_failed')); } $cfg = unserialize_config($payment['config']); $pay_name = ucwords($payment['pay_code']); pc_base::load_app_class('pay_factory', '', 0); $payment_handler = new pay_factory($pay_name, $cfg); $return_data = $payment_handler->receive(); if ($return_data) { if ($return_data['order_status'] == 0) { $this->update_member_amount_by_sn($return_data['order_id']); } $this->update_recode_status_by_sn($return_data['order_id'], $return_data['order_status']); showmessage(L('pay_success'), APP_PATH . 'index.php?m=pay&c=deposit'); } else { showmessage(L('pay_failed'), APP_PATH . 'index.php?m=pay&c=deposit'); } } else { showmessage(L('pay_success')); } }
function usesubmit() { global $_G; $id = intval($_GET['id']); $idtype = $_GET['idtype']; $blog = magic_check_idtype($id, $idtype); $num = 10; $list = $ids = $note_inserts = array(); $fusername = dimplode($_POST['fusername']); if ($fusername) { $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num); $note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}")); foreach ($query as $value) { $ids[] = $value['fuid']; $value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small')); $list[] = $value; $note_inserts[] = array('uid' => $value['fuid'], 'type' => $name, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $note, 'dateline' => $_G['timestamp']); } } if (empty($ids)) { showmessage('magicuse_has_no_valid_friend'); } foreach ($note_inserts as $note_insert) { C::t('home_notification')->insert($note_insert); } C::t('common_member')->increase($ids, array('newprompt' => 1)); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); $op = 'show'; include template('home/magic_call'); }
function register_header() { global $_G; $inputemail = 'gp_' . $this->regemail['email']; $_G['gp_email'] = $_G[$inputemail]; if ($_POST) { $_G['gp_activationauth'] = strip_tags(str_replace(" ", "+", $_G['gp_activationauth'])); $activationinfo = authcode($_G['gp_activationauth'], $operation = 'DECODE'); $activationinfoname = preg_replace("/\\s.+/i", "", $activationinfo); if ($activationinfoname) { loaducenter(); if ($data = uc_get_user($activationinfoname)) { list($uid, $username, $email) = $data; } $_G['gp_email'] = getEmail(strip_tags($email)); } else { $_G['gp_email'] = getEmail(strip_tags($_G['gp_email'])); } $_G['gp_rid'] = strip_tags($_G['gp_rid']); if (!$_G['gp_rid']) { showmessage('dsu_amufzc:1', ''); } if (!$_G['gp_email']) { showmessage('dsu_amufzc:5', ''); } $amutb = DB::table("plugin_dsuamfzc"); $query = DB::fetch_first("SELECT * FROM {$amutb} WHERE rid = '" . $_G['gp_rid'] . "'"); if (!$query || $query['yes'] == '1') { showmessage('dsu_amufzc:2', ''); } if ($_G['gp_email'] != $query['email']) { showmessage('dsu_amufzc:11', ''); } } }
/** * 模块卸载 */ public function uninstall() { if(!isset($_GET['module']) || empty($_GET['module'])) showmessage(L('illegal_parameters')); $module_api = pc_base::load_app_class('module_api'); if(!$module_api->uninstall($_GET['module'])) showmessage($module_api->error_msg, 'blank'); else showmessage(L('uninstall_success'), '?m=zl_admin&c=module&a=cache&pc_hash='.$_SESSION['pc_hash']); }