本文整理汇总了PHP中_cfg函数的典型用法代码示例。如果您正苦于以下问题:PHP _cfg函数的具体用法?PHP _cfg怎么用?PHP _cfg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_cfg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_validate
/**
* Form token validation
* @param array $validations The array of validation rules
* @return void
*/
function form_validate($validations = null)
{
if (!isset($_POST['lc_formToken_' . _cfg('formTokenName')])) {
Validation::addError('', _t('Invalid form token.'));
return false;
}
$token = _decrypt(session_get(_cfg('formTokenName')));
$postedToken = _decrypt(_post($_POST['lc_formToken_' . _cfg('formTokenName')]));
$result = false;
# check token first
if ($token == $postedToken) {
# check referer if it is requesting in the same site
if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] && _cfg('siteDomain')) {
$siteDomain = _cfg('siteDomain');
$siteDomain = preg_replace('/^www\\./', '', $siteDomain);
$parsedURL = parse_url($_SERVER['HTTP_REFERER']);
$parsedURL['host'] = preg_replace('/^www\\./', '', $parsedURL['host']);
if (strcasecmp($siteDomain, $parsedURL['host']) == 0) {
$result = true;
}
}
}
if ($result == false) {
Validation::addError('', _t('Error occured during form submission. Please refresh the page to try again.'));
return false;
}
if ($validations && Validation::check($validations) === false) {
return false;
}
return true;
}
示例2: glist
public function glist()
{
$webname = $this->_cfg['web_name'];
$title = "商品列表_" . _cfg("web_name");
$key = "所有商品";
include templates("mobile/index", "glist");
}
示例3: tag
public function tag()
{
$search = $this->segment_array();
array_shift($search);
array_shift($search);
array_shift($search);
$search = implode('/', $search);
if (!$search) {
_message("输入搜索关键字");
}
$search = urldecode($search);
$search = safe_replace($search);
if (!_is_utf8($search)) {
$search = iconv("GBK", "UTF-8", $search);
}
$mysql_model = System::load_sys_class('model');
$search = str_ireplace("union", '', $search);
$search = str_ireplace("select", '', $search);
$search = str_ireplace("delete", '', $search);
$search = str_ireplace("update", '', $search);
$search = str_ireplace("/**/", '', $search);
$title = $search . ' - ' . _cfg('web_name');
$shoplist = $mysql_model->GetList("select title,thumb,id,sid,zongrenshu,canyurenshu,shenyurenshu,money from `@#_shoplist` WHERE shenyurenshu !=0 and `title` LIKE '%" . $search . "%' order by shenyurenshu desc");
$list = count($shoplist);
include templates("search", "search");
}
示例4: postCreate
public function postCreate()
{
$model = $this->model;
$post = new $model();
$rules = array();
/**
* Retrieve inputs and rules
*/
foreach (_cfg('fields') as $key => $field) {
$name = isset($field['name']) ? $field['name'] : $key;
$post->{$name} = Input::get($name, '');
$rules[$name] = isset($field['rules']) ? $field['rules'] : array();
}
/**
* Prepare redirect url
*/
$url = Admin::url(Admin::data('section') . '/' . Admin::data('action') . (Admin::data('id') ? '/' . Admin::data('id') : ''));
/**
* Validate
*/
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
pr($validator->messages());
return Redirect::to($url)->withInput(Input::except('_token'))->withErrors($validator);
}
/**
* Save new data
*/
if ($post->save()) {
return Redirect::to($url . '?success=1');
}
return Redirect::to($url)->withInput(Input::except('_token'));
}
示例5: defaultImageFilterSet
/**
* Set default image filter set and merge with user's options
* @return object File
*/
private function defaultImageFilterSet()
{
$this->imageFilterSet = array('maxDimension' => '800x600', 'resizeMode' => FILE_RESIZE_BOTH, 'jpgQuality' => 75);
$this->imageFilterSet = array_merge($this->imageFilterSet, _cfg('imageFilterSet'));
$this->setImageResizeMode($this->imageFilterSet['resizeMode']);
return $this;
}
示例6: security_prerequisite
/**
* @internal
* Check the default security secret to be changed
*/
function security_prerequisite()
{
$defaultSecret = md5('lucidframe');
$secret = trim(_cfg('securitySecret'));
if (function_exists('mcrypt_encrypt') && (empty($secret) || strcmp($secret, $defaultSecret) === 0)) {
$msg = 'To change your own security secret, ';
$msg .= 'open your terminal or command line, <code class="inline">cd</code> to your project directory, ';
$msg .= 'then run <code class="inline">php lucidframe secret:generate</span>';
_cfg('sitewideWarnings', function_exists('_t') ? _t($msg) : $msg);
}
}
示例7: testForFunctionUnderscoreCfg
/**
* Test cases for _cfg()
*/
public function testForFunctionUnderscoreCfg()
{
// 1.
_cfg('sitewideWarnings', _t('Change your own security salt hash in the file "/inc/.secret".'));
$this->assertEqual(_cfg('sitewideWarnings'), 'Change your own security salt hash in the file "/inc/.secret".');
// 2.
_cfg('minifyHTML', false);
$this->assertFalse(_cfg('minifyHTML'));
// 3.
_cfg('translationEnabled', false);
$this->assertFalse(_cfg('translationEnabled'));
}
示例8: __construct
function __construct($alias = null)
{
if ($alias == null) {
if ($db = _cfg('db') != null) {
$alias = $db[$db['default']];
} else {
trigger_error('Banco de dados não configurado');
}
}
//carregando o driver
$driver = $db[$alias];
$this->driver = new $driver($db[$alias]);
}
示例9: auth_prerequisite
/**
* Check and get the authentication configuration settings
*/
function auth_prerequisite()
{
global $lc_siteErrors;
db_prerequisite();
$auth = _cfg('auth');
if (isset($auth['table']) && $auth['table'] && isset($auth['fields']['id']) && $auth['fields']['id'] && isset($auth['fields']['role']) && $auth['fields']['role']) {
return $auth;
} else {
$error = new stdClass();
$error->message = 'Required to configure <code class="inline">$lc_auth</code> in "/inc/config.php" or "/inc/site.config.php".';
$error->message = array(function_exists('_t') ? _t($error->message) : $error->message);
$error->type = 'sitewide-message error';
include _i('inc/tpl/site.error.php');
exit;
}
}
示例10: show
public function show()
{
$articleid = safe_replace($this->segment(4));
$article = $this->db->GetOne("SELECT * FROM `@#_article` where `id` = '{$articleid}' LIMIT 1");
if ($article) {
$cateinfo = $this->db->GetOne("SELECT * FROM `@#_category` where `cateid` = '{$article['cateid']}' LIMIT 1");
} else {
$cateinfo = array("info" => null);
}
$info = unserialize($cateinfo['info']);
$title = $article['title'] . "_" . _cfg("web_name");
$keywords = $article['keywords'];
$description = $article['description'];
if (!isset($info['template_show'])) {
$info['template_show'] = "article_show.show.html";
}
$template = explode('.', $info['template_show']);
include templates($template[0], $template[1]);
}
示例11: get_cityqq
public function get_cityqq()
{
$prov = urldecode(trim($this->segment(4)));
$cityv = urldecode(trim($this->segment(5)));
$couv = urldecode(trim($this->segment(6)));
$prov = safe_replace($prov);
$cityv = safe_replace($cityv);
$couv = safe_replace($couv);
if (!_is_utf8($prov)) {
$prov = iconv("GBK", "UTF-8", $prov);
}
if (!_is_utf8($cityv)) {
$cityv = iconv("GBK", "UTF-8", $cityv);
}
if (!_is_utf8($couv)) {
$couv = iconv("GBK", "UTF-8", $couv);
}
$str = '----请选择----';
if ($prov != $str && $cityv == $str && $couv == $str) {
$res = $this->db->GetList("SELECT * FROM `@#_qqset` where `province`='{$prov}'");
}
if ($prov != $str && $cityv != $str && $couv == $str) {
$res = $this->db->GetList("SELECT * FROM `@#_qqset` where `province`='{$prov}' and `city`='{$cityv}'");
}
if ($prov != $str && $cityv != $str && $couv != $str) {
$res = $this->db->GetList("SELECT * FROM `@#_qqset` where `province`='{$prov}' and `city`='{$cityv}' and `county`='{$couv}'");
}
if (!empty($res)) {
$str = '<ul>';
foreach ($res as $v) {
$str .= '<li><dt><img border="0" alt="' . $v['name'] . '" src="' . G_TEMPLATES_IMAGE . '/logo.jpg"></dt><dt>' . $v['name'];
if ($v['full'] == '已满') {
$str .= '<img src="' . G_TEMPLATES_IMAGE . '/qqhot.gif"/>';
}
$str .= '</dt><dd><a href="' . $v['qqurl'] . '">' . $v['qq'] . '</a></dd></li>';
}
$str .= '</ul>';
} else {
$email = System::load_sys_config('email', 'user');
$str = "<div class='nothing'>该地区暂无QQ群加盟," . _cfg("web_name_two") . "诚邀您加盟,详情请咨询Email:<a href='mailto:" . $email . "' target='_blank' >" . $email . "</div>";
}
echo $str;
}
示例12: login
public function login()
{
if (isset($_POST['ajax'])) {
$location = WEB_PATH . '/' . ROUTE_M . '/index';
$message = array("error" => false, 'text' => $location);
$username = $_POST['username'];
$password = $_POST['password'];
$code = strtoupper($_POST['code']);
if (empty($username)) {
$message['error'] = true;
$message['text'] = "请输入用户名!";
echo json_encode($message);
exit;
}
if (empty($password)) {
$message['error'] = true;
$message['text'] = "请输入密码!";
echo json_encode($message);
exit;
}
if (_cfg("web_off")) {
if (empty($code)) {
$message['error'] = true;
$message['text'] = "请输入验证码!";
echo json_encode($message);
exit;
}
if (md5($code) != _getcookie('checkcode')) {
$message['error'] = true;
$message['text'] = "验证码输入错误";
echo json_encode($message);
exit;
}
}
$info = $this->db->GetOne("SELECT * FROM `@#_admin` WHERE `username` = '{$username}' LIMIT 1");
if (!$info) {
$message['error'] = true;
$message['text'] = "登录失败,请检查用户名或密码!";
echo json_encode($message);
exit;
}
if ($info['userpass'] != md5($password)) {
$message['error'] = true;
$message['text'] = "登陆失败!";
echo json_encode($message);
exit;
}
if (!$message['error']) {
_setcookie("AID", _encrypt($info['uid'], 'ENCODE'));
_setcookie("ASHELL", _encrypt(md5($info['username'] . $info['userpass']) . md5($_SERVER['HTTP_USER_AGENT'])));
$_SESSION['token'] = md5($info['username'] . $info['userpass']);
$this->AdminInfo = $info;
$time = time();
$ip = _get_ip();
$this->db->Query("UPDATE `@#_admin` SET `logintime`='{$time}' WHERE (`uid`='{$info['uid']}')");
$this->db->Query("UPDATE `@#_admin` SET `loginip`='{$ip}' WHERE (`uid`='{$info['uid']}')");
}
echo json_encode($message);
exit;
} else {
include $this->tpl(ROUTE_M, 'user.login');
}
}
示例13: unset
<li><a href="<?php
echo $img['url'];
?>
" target="_blank"><img src="<?php
echo G_UPLOAD_PATH;
?>
/linkimg/<?php
echo $img['logo'];
?>
"/></a></li>
<?php
}
}
$ln++;
unset($ln);
?>
</ul>
</div>
<div class="links_exp">
<h3><b>联系方式</b></h3>
<p>
电话:<?php
echo _cfg("cell");
?>
<br>
</p>
</div>
<?php
include templates("index", "footer");
示例14: glist
public function glist()
{
$select = $this->segment(4) ? $this->segment(4) : '0_0_0';
$select = explode("_", $select);
$select[] = '0';
$select[] = '0';
$cid = abs(intval($select[0]));
$bid = abs(intval($select[1]));
$order = abs(intval($select[2]));
$orders = '';
switch ($order) {
case '1':
$orders = 'order by `shenyurenshu` ASC';
break;
case '2':
$orders = "and `renqi` = '1'";
break;
case '3':
$orders = 'order by `shenyurenshu` ASC';
break;
case '4':
$orders = 'order by `time` DESC';
break;
case '5':
$orders = 'order by `money` DESC';
break;
case '6':
$orders = 'order by `money` ASC';
break;
default:
$orders = 'order by `order` ASC,`id` DESC';
}
/* 设置了查询分类ID 和品牌ID */
if (!$cid) {
$brand = $this->db->GetList("select id,cateid,name from `@#_brand` where 1 order by `order` DESC");
$daohang_title = '所有分类';
} else {
//$brand=$this->db->GetList("select id,cateid,name from `@#_brand` where `cateid` LIKE '%$cid%' order by `order` DESC");
//2014-11-18 lq 修复品牌错乱问题
$brand = $this->db->GetList("select id,cateid,name from `@#_brand` where CONCAT(',',`cateid`,',') LIKE '%,{$cid},%' order by `order` DESC");
$daohang = $this->db->GetOne("select cateid,name,parentid,info from `@#_category` where `cateid` = '{$cid}' LIMIT 1");
$daohang['info'] = unserialize($daohang['info']);
$daohang_title = empty($daohang['info']['meta_title']) ? $daohang['name'] : $daohang['info']['meta_title'];
$keywords = $daohang['info']['meta_keywords'];
$description = $daohang['info']['meta_description'];
}
$title = $daohang_title . "_商品列表_" . _cfg("web_name");
//分页
$num = 20;
/* 设置了查询分类ID 和品牌ID */
if ($cid && $bid) {
$sun_id_str = "'" . $cid . "'";
$sun_cate = $this->db->GetList("SELECT cateid from `@#_category` where `parentid` = '{$daohang['cateid']}'");
foreach ($sun_cate as $v) {
$sun_id_str .= "," . "'" . $v['cateid'] . "'";
}
$total = $this->db->GetCount("select id from `@#_shoplist` WHERE `q_uid` is null and `brandid`='{$bid}' and `cateid` in ({$sun_id_str})");
} else {
if ($bid) {
$total = $this->db->GetCount("select id from `@#_shoplist` WHERE `q_uid` is null and `brandid`='{$bid}'");
} elseif ($cid) {
$sun_id_str = "'" . $cid . "'";
$sun_cate = $this->db->GetList("SELECT cateid from `@#_category` where `parentid` = '{$daohang['cateid']}'");
foreach ($sun_cate as $v) {
$sun_id_str .= "," . "'" . $v['cateid'] . "'";
}
$total = $this->db->GetCount("select id from `@#_shoplist` WHERE `q_uid` is null and `cateid` in ({$sun_id_str})");
} else {
$total = $this->db->GetCount("select id from `@#_shoplist` WHERE `q_uid` is null");
}
}
$page = System::load_sys_class('page');
if (isset($_GET['p'])) {
$pagenum = $_GET['p'];
} else {
$pagenum = 1;
}
$page->config($total, $num, $pagenum, "0");
if ($pagenum > $page->page) {
$pagenum = $page->page;
}
if ($cid && $bid) {
$shoplist = $this->db->GetPage("select * from `@#_shoplist` where `q_uid` is null and `brandid`='{$bid}' and `cateid` in ({$sun_id_str}) {$orders}", array("num" => $num, "page" => $pagenum, "type" => 1, "cache" => 0));
} else {
if ($bid) {
$shoplist = $this->db->GetPage("select * from `@#_shoplist` where `q_uid` is null and `brandid`='{$bid}' {$orders}", array("num" => $num, "page" => $pagenum, "type" => 1, "cache" => 0));
} elseif ($cid) {
$shoplist = $this->db->GetPage("select * from `@#_shoplist` where `q_uid` is null and `cateid` in ({$sun_id_str}) {$orders}", array("num" => $num, "page" => $pagenum, "type" => 1, "cache" => 0));
} else {
$shoplist = $this->db->GetPage("select * from `@#_shoplist` where `q_uid` is null {$orders}", array("num" => $num, "page" => $pagenum, "type" => 1, "cache" => 0));
}
}
$this_time = time();
include templates("index", "glist");
}
示例15: nei
public function nei()
{
$id = abs(intval($this->segment(4)));
if (!$id) {
_message("页面错误");
}
$tiezi = $this->db->GetOne("select * from `@#_quanzi_tiezi` where `id`='{$id}'");
if (!$tiezi) {
_message("页面错误");
}
$dianji = $tiezi['dianji'] + 1;
$this->db->Query("UPDATE `@#_quanzi_tiezi` SET `dianji`='{$dianji}' where `id`='{$id}'");
$title = $tiezi['title'] . "_" . _cfg("web_name");
$keywords = $tiezi['title'];
$description = _strcut($tiezi['neirong'], 0, 250);
$member = $this->db->GetOne("select * from `@#_member` where `uid`='{$tiezi['hueiyuan']}'");
$quanzi = $this->db->GetOne("select * from `@#_quanzi` where `id` = '{$tiezi['qzid']}'");
$num = 10;
$total = $this->db->GetCount("select * from `@#_quanzi_hueifu` where `tzid` = '{$tiezi['id']}'");
$page = System::load_sys_class('page');
if (isset($_GET['p'])) {
$pagenum = $_GET['p'];
} else {
$pagenum = 1;
}
$page->config($total, $num, $pagenum, "0");
if ($pagenum > $page->page) {
$pagenum = $page->page;
}
$hueifu = $this->db->GetPage("select * from `@#_quanzi_hueifu` WHERE tzid='{$tiezi['id']}' order by id DESC", array("num" => $num, "page" => $pagenum, "type" => 1, "cache" => 0));
foreach ($hueifu as $key => $val) {
$hueifu[$key]['hueifu'] = _htmtocode($hueifu[$key]['hueifu']);
}
include templates("group", "nei");
}