本文整理汇总了PHP中pc_base::load_sys_func方法的典型用法代码示例。如果您正苦于以下问题:PHP pc_base::load_sys_func方法的具体用法?PHP pc_base::load_sys_func怎么用?PHP pc_base::load_sys_func使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pc_base
的用法示例。
在下文中一共展示了pc_base::load_sys_func方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct() {
parent::__construct();
$this->userid = $_SESSION['userid'];
pc_base::load_sys_class('db_factory');
pc_base::load_sys_class('form');
pc_base::load_sys_func('dir');
}
示例2: keyword
function keyword($field, $value)
{
//获取post过来的关键字,关键字用空格或者‘,’分割的
$data = array();
$data = preg_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;
}
示例3: __construct
function __construct($module='', $catid = 0,$siteid = 0,$upload_dir = '') {
$this->catid = intval($catid);
$this->siteid = intval($siteid)== 0 ? 1 : intval($siteid);
$this->module = $module ? $module : 'content';
pc_base::load_sys_func('dir');
pc_base::load_sys_class('image','','0');
$this->upload_root = pc_base::load_config('system','upload_path');
$this->upload_func = 'copy';
$this->upload_dir = $upload_dir;
}
示例4: public_test_mail
public function public_test_mail()
{
pc_base::load_sys_func('mail');
$subject = 'phpcms test mail';
$message = 'this is a test mail from phpcms team';
$mail = array('mailsend' => 2, 'maildelimiter' => 1, 'mailusername' => 1, 'server' => $_POST['mail_server'], 'port' => intval($_POST['mail_port']), 'mail_type' => intval($_POST['mail_type']), 'auth' => intval($_POST['mail_auth']), 'from' => $_POST['mail_from'], 'auth_username' => $_POST['mail_user'], 'auth_password' => $_POST['mail_password']);
if (sendmail($_GET['mail_to'], $subject, $message, $_POST['mail_from'], $mail)) {
echo L('test_email_succ') . $_GET['mail_to'];
} else {
echo L('test_email_faild');
}
}
示例5: getJs
public function getJs()
{
//合并分开的app.js
pc_base::load_sys_func('dir');
$filelist = dir_list(PHPCMS_PATH . 'statics/js/app/build/', 'js');
$models_js = '';
foreach ($filelist as $k => $v) {
$value = file_get_contents($v);
$models_js .= "\r" . $value;
}
$app_path = "http://" . $_SERVER['HTTP_HOST'] . "/";
//dump($filelist);
//echo template('content','js');
include template('content', 'js');
}
示例6: getcitybyapi
/**
* 通过外部接口方式获取详细地址信息
* @return $localinfo province 省份 city城市 sp网络 提供商 pinyin拼音
*/
public function getcitybyapi($ip) {
$api_url = $localinfo = '';
$xml = pc_base::load_sys_class('xml');
pc_base::load_sys_func('iconv');
$api_url = 'http://ipquery.sdo.com/getipinfo.php?ip='.$ip;
$data = $xml->xml_unserialize(@file_get_contents($api_url));
if (CHARSET == 'gbk') {
$data = !empty($data) ? array_iconv($data, 'utf-8', 'gbk') : array();
}
if($data['ip']['result']) {
$localinfo['province'] = $data['ip']['country'];
$localinfo['city'] = $data['ip']['city'];
$localinfo['sp'] = $data['ip']['sp'];
//$name = strtolower(CHARSET) == 'gbk' ? $localinfo['city'] : iconv(CHARSET,'gbk',$localinfo['city']);
$name = str_replace(L('city'),'',$localinfo['city']);
$letters = gbk_to_pinyin($name);
$localinfo['pinyin'] =strtolower(implode('', $letters));
}
return $localinfo;
}
示例7: save_city
/**
* 保存城市
*/
public function save_city()
{
pc_base::load_sys_func('iconv');
$id = intval($_POST['id']);
$city['name'] = iconv('utf-8', CHARSET, addslashes($_POST['name']));
//没有填写拼音默认将城市中文名称转化为拼音
if ($_POST['pinyin'] == '') {
if (strtolower(CHARSET) == 'utf-8') {
$str_py = gbk_to_pinyin(iconv(CHARSET, gbk, $city['name']));
$city['pinyin'] = strtolower(implode('', $str_py));
} else {
$city['pinyin'] = strtolower(implode('', gbk_to_pinyin($city['name'])));
}
} else {
$city['pinyin'] = trim($_POST['pinyin']);
}
$city['linkageid'] = $_POST['linkageid'];
if ($city['name'] == '' || $city['pinyin'] == '') {
exit('post_error');
}
$city = array2string($city);
if ($id == 0) {
$insertid = $this->db->insert(array('key' => 'info_city', 'data' => $city), TRUE);
$this->_cache();
if ($insertid) {
echo $insertid;
exit;
} else {
exit('0');
}
} else {
$this->db->update(array('data' => $city), array('key' => 'info_city', 'id' => $id));
$this->_cache();
exit('1');
}
}
示例8: modify_deposit
/**
* 修改财务
* Enter description here ...
*/
public function modify_deposit()
{
if (isset($_POST['dosubmit'])) {
$username = isset($_POST['username']) && trim($_POST['username']) ? trim($_POST['username']) : showmessage(L('username') . L('error'));
$usernote = isset($_POST['usernote']) && trim($_POST['usernote']) ? addslashes(trim($_POST['usernote'])) : showmessage(L('usernote') . L('error'));
$userinfo = $this->get_useid($username);
if ($userinfo) {
//如果增加金钱或点数,想pay_account 中记录数据
if ($_POST['pay_unit']) {
$value = floatval($_POST['unit']);
$payment = L('admin_recharge');
$receipts = pc_base::load_app_class('receipts');
$func = $_POST['pay_type'] == '1' ? 'amount' : 'point';
$receipts->{$func}($value, $userinfo['userid'], $username, create_sn(), 'offline', $payment, param::get_cookie('admin_username'), $status = 'succ', $usernote);
} else {
$value = floatval($_POST['unit']);
$msg = L('background_operation') . $usernote;
$spend = pc_base::load_app_class('spend');
$func = $_POST['pay_type'] == '1' ? 'amount' : 'point';
$spend->{$func}($value, $msg, $userinfo['userid'], $username, param::get_cookie('userid'), param::get_cookie('admin_username'));
}
if (intval($_POST['sendemail'])) {
pc_base::load_sys_func('mail');
$op = $_POST['pay_unit'] ? $value : '-' . $value;
$op = $_POST['pay_type'] ? $op . L('yuan') : $op . L('point');
$msg = L('account_changes_notice_tips', array('username' => $username, 'time' => date('Y-m-d H:i:s', SYS_TIME), 'op' => $op, 'note' => $usernote, 'amount' => $userinfo['amount'], 'point' => $userinfo['point']));
sendmail($userinfo['email'], L('send_account_changes_notice'), $msg);
}
showmessage(L('public_discount_succ'), HTTP_REFERER);
}
} else {
$show_validator = true;
include $this->admin_tpl('modify_deposit');
}
}
示例9: public_suggest_search
/**
* 提示搜索接口
* TODO 暂时未启用,用的是google的接口
*/
public function public_suggest_search()
{
//关键词转换为拼音
pc_base::load_sys_func('iconv');
$pinyin = gbk_to_pinyin($q);
if (is_array($pinyin)) {
$pinyin = implode('', $pinyin);
}
$this->keyword_db = pc_base::load_model('search_keyword_model');
$suggest = $this->keyword_db->select("pinyin like '{$pinyin}%'", '*', 10, 'searchnums DESC');
foreach ($suggest as $v) {
echo $v['keyword'] . "\n";
}
}
示例10: ignore
/**
* ignore member
*/
function ignore() {
if(isset($_POST['userid'])) {
$uidarr = isset($_POST['userid']) ? $_POST['userid'] : showmessage(L('illegal_parameters'), HTTP_REFERER);
$where = to_sqls($uidarr, '', 'userid');
$res = $this->db->update(array('status'=>2, 'message'=>$_POST['message']), $where);
//发送 email通知
if($res) {
if($_POST['sendemail']) {
$memberinfo = $this->db->select($where);
pc_base::load_sys_func('mail');
foreach ($memberinfo as $v) {
sendmail($v['email'], L('reg_ignore'), $_POST['message']);
}
}
}
showmessage(L('ignore').L('operation_success'), HTTP_REFERER);
} else {
showmessage(L('operation_failure'), HTTP_REFERER);
}
}
示例11: delete_type
/**
* 删除专题分类
* @param intval $typeid 专题附属分类ID
* @param intval $siteid 站点ID
* @param intval $ishtml 专题是否生成静态
*/
private function delete_type($typeid = 0, $siteid = 0, $ishtml = 0)
{
$typeid = intval($typeid);
if (!$typeid) {
return false;
}
pc_base::load_sys_func('dir');
$info = $this->type_db->get_one(array('typeid' => $typeid));
if ($ishtml) {
$siteid = $siteid ? intval($siteid) : get_siteid();
if ($siteid > 1) {
$site = pc_base::load_app_class('sites', 'admin');
$site_info = $site->get_by_id($siteid);
$queue = pc_base::load_model('queue_model');
for ($i = 1; $i > 0; $i++) {
if ($i == 1) {
$file = str_replace($site_info['domain'], pc_base::load_config('system', 'html_root') . '/' . $site_info['dirname'] . '/', $info['url']);
} else {
$file = str_replace(array($site_info['domain'], '.html'), array(pc_base::load_config('system', 'html_root') . '/' . $site_info['dirname'] . '/', '-' . $i . '.html'), $info['url']);
}
if (!file_exists(PHPCMS_PATH . $file)) {
break;
} else {
$queue->add_queue('del', $file, $siteid);
//并加入到消息队列中,便以其他站点删除文件
unlink(PHPCMS_PATH . $file);
//删除生成的静态文件
}
}
} else {
for ($i = 1; $i > 0; $i++) {
if ($i == 1) {
$file = str_replace(APP_PATH, '', $info['url']);
} else {
$file = str_replace(array(APP_PATH, '.html'), array('', '-' . $i . '.html'), $info['url']);
}
if (!file_exists(PHPCMS_PATH . $file)) {
break;
} else {
unlink(PHPCMS_PATH . $file);
//删除生成的静态文件
}
}
}
}
$this->type_db->delete(array('typeid' => $typeid));
//删除数据表记录
return true;
}
示例12: show
/**
* 表单展示
*/
public function show()
{
if (!isset($_GET['formid']) || empty($_GET['formid'])) {
$_GET['action'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
}
$siteid = $_GET['siteid'] ? intval($_GET['siteid']) : 1;
$formid = intval($_GET['formid']);
$r = $this->db->get_one(array('modelid' => $formid, 'siteid' => $siteid, 'disabled' => 0), 'tablename, setting');
if (!$r) {
$_GET['action'] ? exit : showmessage(L('form_no_exist'), HTTP_REFERER);
}
$setting = string2array($r['setting']);
if ($setting['enabletime']) {
if ($setting['starttime'] > SYS_TIME || $setting['endtime'] + 3600 * 24 < SYS_TIME) {
$_GET['action'] ? exit : showmessage(L('form_expired'), APP_PATH . 'index.php?m=formguide&c=index&a=index');
}
}
$userid = param::get_cookie('_userid');
if ($setting['allowunreg'] == 0 && !$userid && $_GET['action'] != 'js') {
showmessage(L('please_login_in'), APP_PATH . 'index.php?m=member&c=index&a=login&forward=' . urlencode(HTTP_REFERER));
}
if (isset($_POST['dosubmit'])) {
$tablename = 'form_' . $r['tablename'];
$this->m_db->change_table($tablename);
$data = array();
require CACHE_MODEL_PATH . 'formguide_input.class.php';
$formguide_input = new formguide_input($formid);
$data = new_addslashes($_POST['info']);
$data = new_html_special_chars($data);
$data = $formguide_input->get($data);
$data['userid'] = $userid;
$data['username'] = param::get_cookie('_username');
$data['datetime'] = SYS_TIME;
$data['ip'] = ip();
$dataid = $this->m_db->insert($data, true);
if ($dataid) {
if ($setting['sendmail']) {
pc_base::load_sys_func('mail');
$mails = explode(',', $setting['mails']);
if (is_array($mails)) {
foreach ($mails as $m) {
sendmail($m, L('tips'), $this->M['mailmessage']);
}
}
}
$this->db->update(array('items' => '+=1'), array('modelid' => $formid, 'siteid' => $this->siteid));
}
showmessage(L('thanks'), APP_PATH);
} else {
if ($setting['allowunreg'] == 0 && !$userid && $_GET['action'] == 'js') {
$no_allowed = 1;
}
pc_base::load_sys_class('form', '', '');
$f_info = $this->db->get_one(array('modelid' => $formid, 'siteid' => $this->siteid));
extract($f_info);
$tablename = 'form_' . $r['tablename'];
$this->m_db->change_table($tablename);
$ip = ip();
$where = array();
if ($userid) {
$where = array('userid' => $userid);
} else {
$where = array('ip' => $ip);
}
$re = $this->m_db->get_one($where, 'datetime');
$setting = string2array($setting);
if ($setting['allowmultisubmit'] == 0 && $re['datetime'] || SYS_TIME - $re['datetime'] < $this->M['interval'] * 60) {
$_GET['action'] ? exit : showmessage(L('had_participate'), APP_PATH . 'index.php?m=formguide&c=index&a=index');
}
require CACHE_MODEL_PATH . 'formguide_form.class.php';
$formguide_form = new formguide_form($formid, $no_allowed);
$forminfos_data = $formguide_form->get();
$SEO = seo($this->siteid, L('formguide'), $name);
if (isset($_GET['action']) && $_GET['action'] == 'js') {
if (!function_exists('ob_gzhandler')) {
ob_clean();
}
ob_start();
}
$template = $_GET['action'] == 'js' ? $js_template : $show_template;
include template('formguide', $template, $default_style);
if (isset($_GET['action']) && $_GET['action'] == 'js') {
$data = ob_get_contents();
ob_clean();
exit(format_js($data));
}
}
}
示例13: dealSchoolArr
protected function dealSchoolArr($school = array())
{
if (empty($school)) {
return array("error" => true);
}
//判断该学校是否已存在
$where['name'] = $school['name'];
$where['xiaozhang'] = $school['xiaozhang'];
$where['type'] = $school['type'];
$M = M('safe_school');
$info = $M->count($where);
if ($info) {
return array("error" => true);
}
//学校已存在,返回
//不存在,添加
$school_id = $M->insert($school, true);
if (!$school_id) {
return array("error" => -1);
}
//创建学校管理员
pc_base::load_sys_func("iconv");
//构造管理员数据
$manager['username'] = gbk_to_pinyin($school['admin']);
$manager['username'] = implode("", $manager['username']);
$pwd = password($school['admin_tel']);
$manager['password'] = $pwd['password'];
$manager['encrypt'] = $pwd['encrypt'];
$manager['roleid'] = 10;
$manager['school_id'] = $school_id;
$manager['realname'] = $school['admin'];
$M_admin = M("admin");
$admin_id = $M_admin->insert($manager);
if (!$admin_id) {
return array("error" => -2);
}
//是否存在中心校
if (!empty($school['lianxiao'])) {
$lianxiao['name'] = $school['lianxiao'];
$M_lianxiao = M("safe_data_lianxiao");
$num = $M_lianxiao->count($lianxiao);
if (!$num) {
$lianxiao_id = $M_lianxiao->insert($lianxiao);
if (!$lianxiao_id) {
return array("error" => -3);
}
//添加中心校管理员
$manager['username'] = gbk_to_pinyin($lianxiao['name']);
$manager['username'] = implode("", $manager['username']);
$pwd = password($manager['username']);
$manager['password'] = $pwd['password'];
$manager['encrypt'] = $pwd['encrypt'];
$manager['roleid'] = 11;
$manager['school_id'] = 0;
$manager['realname'] = '';
$ladmin_id = $M_admin->insert($manager);
if (!$ladmin_id) {
return array("error" => -4);
}
}
}
return array("error" => true, 'school_id' => $school_id);
}
示例14: iconv
function iconv($in_charset, $out_charset, $str)
{
$in_charset = strtoupper($in_charset);
$out_charset = strtoupper($out_charset);
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($str, $out_charset, $in_charset);
} else {
pc_base::load_sys_func('iconv');
$in_charset = strtoupper($in_charset);
$out_charset = strtoupper($out_charset);
if ($in_charset == 'UTF-8' && ($out_charset == 'GBK' || $out_charset == 'GB2312')) {
return utf8_to_gbk($str);
}
if (($in_charset == 'GBK' || $in_charset == 'GB2312') && $out_charset == 'UTF-8') {
return gbk_to_utf8($str);
}
return $str;
}
}
示例15: batch_edit
/**
* 批量修改
*/
public function batch_edit()
{
$categorys = getcache('category_content_' . $this->siteid, 'commons');
if (isset($_POST['dosubmit'])) {
pc_base::load_sys_func('iconv');
$catid = intval($_POST['catid']);
$post_setting = $_POST['setting'];
//栏目生成静态配置
$infos = $info = array();
$infos = $_POST['info'];
if (empty($infos)) {
showmessage(L('operation_success'));
}
$this->attachment_db = pc_base::load_model('attachment_model');
foreach ($infos as $catid => $info) {
$setting = string2array($categorys[$catid]['setting']);
if ($_POST['type'] != 2) {
if ($post_setting[$catid]['ishtml']) {
$setting['category_ruleid'] = $_POST['category_html_ruleid'][$catid];
} else {
$setting['category_ruleid'] = $_POST['category_php_ruleid'][$catid];
$info['url'] = '';
}
}
foreach ($post_setting[$catid] as $_k => $_setting) {
$setting[$_k] = $_setting;
}
//内容生成静态配置
if ($post_setting[$catid]['content_ishtml']) {
$setting['show_ruleid'] = $_POST['show_html_ruleid'][$catid];
} else {
$setting['show_ruleid'] = $_POST['show_php_ruleid'][$catid];
}
if ($setting['repeatchargedays'] < 1) {
$setting['repeatchargedays'] = 1;
}
$info['sethtml'] = $post_setting[$catid]['create_to_html_root'];
$info['setting'] = array2string($setting);
$info['module'] = 'content';
$catname = CHARSET == 'gbk' ? $info['catname'] : iconv('utf-8', 'gbk', $info['catname']);
$letters = gbk_to_pinyin($catname);
$info['letter'] = strtolower(implode('', $letters));
$this->db->update($info, array('catid' => $catid, 'siteid' => $this->siteid));
//更新附件状态
if ($info['image'] && pc_base::load_config('system', 'attachment_stat')) {
$this->attachment_db->api_update($info['image'], 'catid-' . $catid, 1);
}
}
$this->public_cache();
showmessage(L('operation_success'), '?m=admin&c=category&a=init&module=admin&menuid=43');
} else {
if (isset($_POST['catids'])) {
//获取站点模板信息
pc_base::load_app_func('global');
$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_validator = $show_header = '';
$catid = intval($_GET['catid']);
$type = $_POST['type'] ? intval($_POST['type']) : 0;
pc_base::load_sys_class('form', '', 0);
if (empty($_POST['catids'])) {
showmessage(L('illegal_parameters'));
}
$batch_array = $workflows = array();
foreach ($categorys as $catid => $cat) {
if ($cat['type'] == $type && in_array($catid, $_POST['catids'])) {
$batch_array[$catid] = $cat;
}
}
if (empty($batch_array)) {
showmessage(L('please_select_category'));
}
$workflows = getcache('workflow_' . $this->siteid, 'commons');
if ($workflows) {
$workflows_datas = array();
foreach ($workflows as $_k => $_v) {
$workflows_datas[$_v['workflowid']] = $_v['workname'];
}
}
if ($type == 1) {
include $this->admin_tpl('category_batch_edit_page');
} else {
include $this->admin_tpl('category_batch_edit');
}
} else {
$type = isset($_GET['select_type']) ? intval($_GET['select_type']) : 0;
$tree = pc_base::load_sys_class('tree');
$tree->icon = array(' │ ', ' ├─ ', ' └─ ');
$tree->nbsp = ' ';
$category = array();
foreach ($categorys as $catid => $r) {
if ($this->siteid != $r['siteid'] || $r['type'] == 2 && $r['child'] == 0) {
continue;
}
//.........这里部分代码省略.........