当前位置: 首页>>代码示例>>PHP>>正文


PHP config::get方法代码示例

本文整理汇总了PHP中config::get方法的典型用法代码示例。如果您正苦于以下问题:PHP config::get方法的具体用法?PHP config::get怎么用?PHP config::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config的用法示例。


在下文中一共展示了config::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: config

 function __construct()
 {
     include "config.php";
     $config = new config();
     define("LOGIN_PATH", dirname(__FILE__) . "/" . $config->get("auth", "login-path"));
     session_start();
     if (isset($_POST["email"]) and isset($_POST["password"])) {
         // load user information
         $users = $config->get("auth", "users");
         // find current user
         foreach ($users as $user) {
             if ($user["email"] == $_POST["email"]) {
                 break;
             }
         }
         // verify password and set session cookie
         if (password_verify($_POST["password"], $user["hash"])) {
             $_SESSION["user"] = array("email" => $user["email"], "name" => $user["name"]);
         } else {
             $this->login();
         }
     } elseif (!isset($_SESSION["user"])) {
         $this->login();
     }
 }
开发者ID:JonathanHolvey,项目名称:php-cms-tools,代码行数:25,代码来源:auth.php

示例2: get_code

 function get_code($order,$payment) {
     $data_order_id      = $order['id'];
     $data_amount        = $order['orderamount'];
     $data_return_url    = pay::url(basename(__FILE__,'.php'));
     $data_pay_account   = $payment['paypal_account'];
     $currency_code      = $payment['paypal_currency'];
     $data_notify_url    = pay::url(basename(__FILE__,'.php'));
     define('SERVER_HTTP',$_SERVER['SERVER_PORT'] == '443'?'https://': 'http://');
     define('SITE_URL',SERVER_HTTP.$_SERVER['HTTP_HOST']);
     $cancel_return      = SITE_URL.config::get('base_url');
     $def_url  = '<br /><form style="text-align:center;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">'.
             "<input type='hidden' name='cmd' value='_xclick'>".
             "<input type='hidden' name='business' value='$data_pay_account'>".
             "<input type='hidden' name='item_name' value='$order[order_sn]'>".
             "<input type='hidden' name='amount' value='$data_amount'>".
             "<input type='hidden' name='currency_code' value='$currency_code'>".
             "<input type='hidden' name='return' value='$data_return_url'>".
             "<input type='hidden' name='invoice' value='$data_order_id'>".
             "<input type='hidden' name='charset' value='utf-8'>".
             "<input type='hidden' name='no_shipping' value='1'>".
             "<input type='hidden' name='no_note' value=''>".
             "<input type='hidden' name='notify_url' value='$data_notify_url'>".
             "<input type='hidden' name='rm' value='2'>".
             "<input type='hidden' name='cancel_return' value='$cancel_return'>".
             "<input type='submit' value='".$GLOBALS['_LANG']['paypal_button'] ."'>".
             "</form><br />";
     return $def_url;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:28,代码来源:paypal.php

示例3: login

 public function login($username = null, $pass = null, $remember = false)
 {
     if (!$username && !$pass && $this->exist()) {
         Session::put($this->_sessionName, $this->data()->id);
     } else {
         $user = $this->find($username);
         if ($user) {
             if ($this->_data->password === Hash::make($pass, $this->_data->salt)) {
                 Session::put($this->_sessionName, $this->_data->id);
                 if ($remember) {
                     $hash = hash::unique();
                     $hashCheck = $this->_db->get('user_session', array('user_id', '=', $this->data()->id));
                     if (!$hashCheck->count()) {
                         $this->_db->insert('user_session', array('user_id' => $this->_data->id, 'hash' => $hash));
                     } else {
                         $hash = $hashCheck->first()->hash;
                     }
                     Cookies::put($this->_cookieName, $hash, config::get('remember/expiry'));
                 }
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:Root3287,项目名称:PHP-Blog,代码行数:25,代码来源:User.class.php

示例4: update014

function update014()
{
    global $url, $smarty;
    //Checking if this Update already done
    if (CURRENT_DB_UPDATE < "014") {
        if (is_null(config::get('014updatestatus'))) {
            config::set('014updatestatus', 0);
        }
        $qry = DBFactory::getDBQuery(true);
        if (config::get('014updatestatus') < 1) {
            // Add killmail summary. time, hash, trust.
            $sql = 'CREATE TABLE IF NOT EXISTS `kb3_mails` (
  `kll_id` int(11) NOT NULL auto_increment,
  `kll_timestamp` datetime NOT NULL default "0000-00-00 00:00:00",
  `kll_external_id` int(8) default NULL,
  `kll_hash` BINARY(16) NOT NULL,
  `kll_trust` TINYINT NOT NULL DEFAULT 0,
  PRIMARY KEY  (`kll_id`),
  UNIQUE KEY `external_id` (`kll_external_id`),
  UNIQUE KEY `time_hash` (`kll_timestamp`,`kll_hash`)
) Engine=InnoDB';
            $qry->execute($sql);
        }
        killCache();
        config::set("DBUpdate", "014");
        $qry->execute("INSERT INTO kb3_config (cfg_site, cfg_key, cfg_value) SELECT cfg_site, 'DBUpdate', '014' FROM kb3_config GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '014'");
        config::del("014updatestatus");
        $smarty->assign('refresh', 1);
        $smarty->assign('content', "Update 014 completed.");
        $smarty->display('update.tpl');
        die;
    }
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:33,代码来源:update.php

示例5: init

 function init() {
     $user='';
     $guest = front::get('guest');
     if($guest=='1'&&config::get('opguestadd')) {
         $user = 'Guest';
     }else {
         if(cookie::get('login_username') &&cookie::get('login_password')) {
             $user=new user();
             $user=$user->getrow(array('username'=>cookie::get('login_username')));
         }
     }
     if(cookie::get('login_username') &&cookie::get('login_password')) {
         $guestuser=new user();
         $guestuser=$guestuser->getrow(array('username'=>cookie::get('login_username')));
     }
     $this->view->guestuser = $guestuser;
     if(!$user &&front::$act != 'login'&&front::$act != 'register')  front::redirect(url::create('user/login'));
     $this->view->user=$user;
     $this->_user=new user;
     $this->table=front::get('manage');
     if($this->table <>'archive'&&$this->table <>'orders') exit('PAGE NOT FOUND!');
     $this->_table=new $this->table;
     $this->_table->getFields();
     $this->view->form=$this->_table->get_form();
     $this->_pagesize=config::get('manage_pagesize');
     $this->view->manage=$this->table;
     $this->view->primary_key=$this->_table->primary_key;
     if(!front::get('page')) front::$get['page']=1;
     $manage='table_'.$this->table;
     $this->manage=new $manage;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:31,代码来源:manage_act.php

示例6: run

 public static function run($uri)
 {
     self::$router = new Router($uri);
     self::$db = new DB(config::get('db.host'), config::get('db.name'), config::get('db.user'), config::get('db.password'));
     Lang::load(self::$router->getLanguage());
     if ($_POST and (isset($_POST['username_in']) and isset($_POST['password_in'])) or isset($_POST['exit'])) {
         $us = new RegisterController();
         if (isset($_POST['exit'])) {
             $us->LogOut();
         } else {
             $us->Login($_POST);
         }
     }
     if (self::$router->getController() == 'admin' and !Session::getSession('root') or self::$router->getController() == 'myblog' and !Session::getSession('id')) {
         self::$router->setController(Config::get('default_controller'));
         self::$router->setAction(Config::get('default_action'));
         Session::setSession('message', 'Отказ в доступе');
     }
     $controller_class = ucfirst(self::$router->getController()) . 'Controller';
     $controller_method = strtolower(self::$router->getMethodPrefix() . self::$router->getAction());
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $controller_object->{$controller_method}();
         $view_object = new View($controller_object->getData());
         $content = $view_object->render();
     } else {
         throw new Exception('Method ' . $controller_method . ' of class ' . $controller_class . ' does not exist');
     }
     $layout = self::$router->getRoute();
     $layout_path = VIEWS_PATH . DS . $layout . '.html';
     $layout_view_object = new View(compact('content'), $layout_path);
     echo $layout_view_object->render();
 }
开发者ID:seletskyy,项目名称:blog_mvc,代码行数:33,代码来源:app.class.php

示例7: getBaseData

 public function getBaseData()
 {
     $apis = config::get('apis.routes');
     $formatApi = array();
     foreach ($apis as $key => $api) {
         $apiGroup = $this->_genGroup($api);
         $apiMethod = $key;
         $routingKey = $api['uses'];
         //echo $key.':'.$routingKey."\n";continue;
         $apiParams = $this->_getParams($routingKey);
         $formatApi[$apiGroup][$apiMethod]['description'] = $apiParams['description'];
         $formatApi[$apiGroup][$apiMethod]['required_oauth'] = $api['oauth'];
         //$formatApi[$apiGroup][$apiMethod]['description'] = $this->_getDescription($routingkey);
         foreach ($apiParams['params'] as $paramKey => $param) {
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['name'] = $paramKey;
             //以后更新数据过滤,就采用这个方式获取必填项
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['required'] = $this->_genRequired($param['valid']);
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['type'] = $param['type'];
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['example'] = $param['example'];
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['default'] = $param['default'];
             $formatApi[$apiGroup][$apiMethod]['params'][$paramKey]['description'] = $param['description'];
         }
     }
     return $formatApi;
 }
开发者ID:453111208,项目名称:bbc,代码行数:25,代码来源:data.php

示例8: remotelogin_action

 function remotelogin_action() {
     cookie::del('passinfo');
     $this->view->loginfalse=cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI']));
     if (front::$args) {
         $user=new user();
         $args = xxtea_decrypt(base64_decode(front::$args), config::get('cookie_password'));
         $user=$user->getrow(unserialize($args));
         if (is_array($user)) {
             if ($user['groupid'] == '888')
                 front::$isadmin=true;
             cookie::set('login_username',$user['username']);
             cookie::set('login_password',front::cookie_encode($user['password']));
             session::set('username',$user['username']);
             require_once ROOT.'/celive/include/config.inc.php';
             require_once ROOT.'/celive/include/celive.class.php';
             $login=new celive();
             $login->auth();
             $GLOBALS['auth']->remotelogin($user['username'],$user['password']);
             $GLOBALS['auth']->check_login1();
             front::$user=$user;
         }elseif (!is_array(front::$user) ||!isset(front::$isadmin)) {
             cookie::set('loginfalse'.md5($_SERVER['REQUEST_URI']),(int) cookie::get('loginfalse'.md5($_SERVER['REQUEST_URI'])) +1,time() +3600);
             event::log('loginfalse','失败 user='.$user['username']);
             front::flash('密码错误或不存在该管理员!');
             front::refresh(url('admin/login',true));
         }
     }
     $this->render();
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:29,代码来源:admin_act.php

示例9: __getApiInfo

 private function __getApiInfo(&$params, &$response)
 {
     //提取系统参数
     $method = $params['method'];
     $timestamp = $params['timestamp'];
     $format = $params['format'];
     $v = $params['v'];
     $sign_type = $params['sign_type'];
     $sign = $params['sign'];
     $exception = 'LogicException';
     if (!base_rpc_validate::isValidate($params)) {
         return $response->sendError('system.systemParams.signError', app::get('base')->_('签名错误'), $format, $exception);
     }
     if (!($format == 'json' || $format == 'xml')) {
         return $response->sendError('system.systemParams.formatError', app::get('base')->_('返回格式设定必须是json或者xml'), $format, $exception);
     }
     if (!is_numeric($timestamp)) {
         return $response->sendError('system.systemParams.timestampFormatError', app::get('base')->_('时间格式错误(包含非数字的字符)'), $format, $exception);
     }
     if (time() - intval($timestamp) > 300) {
         return $response->sendError('system.systemParams.timeOut', app::get('base')->_('请求已超时'), $format, $exception);
     }
     $apis = config::get('apis.routes');
     if (!isset($apis[$method])) {
         return $response->sendError('system.systemParams.methodNotFound', app::get('base')->_('找不到请求API'), $format, $exception);
     }
     if (!in_array($v, $apis[$method]['version'])) {
         return $response->sendError('system.systemParams.versionNotMatch', app::get('base')->_('API版本不匹配'), $format, $exception);
     }
     return $apis[$method];
 }
开发者ID:453111208,项目名称:bbc,代码行数:31,代码来源:server.php

示例10: make

 public static function make($string, $salt = "")
 {
     if ($salt = "") {
         $salt = config::get('encryption/salt');
     }
     return hash('sha256', $string, $salt);
 }
开发者ID:Jay-En,项目名称:BonePHP,代码行数:7,代码来源:Hash.php

示例11: article

 public function article($uri)
 {
     $this->template->content = View::factory('blog/view')->bind('post', $post)->bind('comments', $comments)->bind('form', $form);
     $post = ORM::factory('blog_post', (string) $uri);
     // Show 404 if we don't find posts
     if (!$post->loaded) {
         Event::run('system.404');
     }
     $comments = $post->blog_comments;
     $this->head->title->prepend($post->title);
     if (!($post->comment_status === 'open' and config::get('blog.comment_status') === 'open')) {
         return;
     }
     $form = Formo::factory()->plugin('csrf')->add('text', 'author', array('label' => __('Name')))->add('text', 'email', array('label' => __('Email')))->add('text', 'url', array('label' => __('Homepage')))->add('textarea', 'content', array('label' => __('Comment')))->add('submit', 'submit', array('label' => __('Submit')))->pre_filter('all', 'trim')->pre_filter('author', 'security::xss_clean')->pre_filter('content', 'security::xss_clean')->pre_filter('url', 'security::xss_clean')->pre_filter('url', 'format::url')->add_rule('author', 'required', __('You must provide your name'))->add_rule('author', 'length[2,40]', __('Your Name is too long'))->add_rule('email', 'valid::email', __('Email address is not valid'))->add_rule('content', 'required', __('You must enter a comment'));
     if (config::get('blog.enable_captcha') === 'yes') {
         $form->add('captcha', 'security', array('label' => __('Security code')));
         $form->security->error_msg = __('Invalid security code');
     }
     if ($form->validate()) {
         $comment = ORM::factory('blog_comment');
         $comment->author = $form->author->value;
         $comment->email = $form->email->value;
         $comment->content = $form->content->value;
         $comment->url = $form->url->value;
         $comment->ip = $this->input->ip_address();
         $comment->agent = Kohana::$user_agent;
         $comment->date = date("Y-m-d H:i:s", time());
         $post->add_comment($comment);
         Event::run('blog.comment_added', $comment);
         Cache::instance()->delete('s7n_blog_feed');
         Cache::instance()->delete('s7n_blog_feed_comments');
         url::redirect($post->url());
     }
     $form = View::factory('blog/form_comment', $form->get(TRUE));
 }
开发者ID:googlecode-mirror,项目名称:s7ncms,代码行数:35,代码来源:blog.php

示例12: conectar

 public static function conectar()
 {
     //Si no esta conectado, se conecta, sino, no.
     if (self::$conexion === null) {
         $svr = config::get('bd.servidor', 'localhost');
         $usr = config::get('bd.usuario', 'root');
         $pwd = config::get('bd.clave', '');
         $dbn = config::get('bd.nombre', '');
         self::$depurar = config::get('bd.depurar', false);
         self::$conexion = new mysqli($svr, $usr, $pwd, $dbn);
         if (!mysqli_connect_error()) {
             $charset = config::get('bd.charset', '');
             if (!empty($charset)) {
                 self::$conexion->set_charset($charset);
             }
         }
         //if
         if (!mysqli_connect_error()) {
             if (self::$depurar) {
                 log::mensajeLin(__METHOD__ . ' Ok');
             }
             self::$error = false;
         } else {
             self::$error = 'Error BD(' . mysqli_connect_errno() . '): ' . mysqli_connect_error();
             self::$conexion = null;
             log::mensajeLin(__METHOD__ . ' ' . self::$error);
         }
         //if
     }
     //if
     return self::$conexion !== null;
 }
开发者ID:OliverUrones,项目名称:individual,代码行数:32,代码来源:modelos.php

示例13: manage_action

    function manage_action() {
        if(!config::get('sms_username') || !config::get('sms_password')){
            echo '<script>alert("您需要先设置用户名和密码才能使用短信管理功能!");window.location.href="'.url('config/system/set/sms').'";</script>';
            exit;
        }
        include_once("phprpc/phprpc_client.php");
        $client = new PHPRPC_Client();
        $client->setProxy(NULL);
        $client->useService('http://pay.cmseasy.cn/sms.php');
        $client->setKeyLength(128);
        $client->setEncryptMode(3);
        $info = $client->getInfo(config::get('sms_username'),md5(config::get('sms_password')));
        $info[0] = intval($info[0]);
        $info[1] = intval($info[1]);
        $this->view->info = $info;
        if (front::post('submit')) {
            if (front::post('act') == 'test') {
                $rs = sendMsg(front::post('mobile'),'test');
                if($rs->SendSMSResult == '0'){
                    front::flash('发送成功');
                }else{
                    front::flash('发送失败,请检查用户名、密码或剩余条数');
                }
            }
        }else{
			if($info[0] < 50) front::flash('你的剩余短信不足50条,请及时充值');
		}
    }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:28,代码来源:sms_admin.php

示例14: send_to_center

 static function send_to_center($app_id, $data = null, $method = 'node.reg')
 {
     $app_info = app::get($app_id)->define();
     $obj_app = app::get($app_id);
     // 生成参数...
     $api_data = array('certi_app' => $method, 'certificate_id' => base_certificate::certi_id(), 'node_type' => 'ecos.' . $app_id, 'url' => kernel::base_url(true), 'version' => $app_info['version'], 'channel_ver' => $app_info['api_ver'], 'api_ver' => '1.2', 'format' => 'json', 'api_url' => kernel::base_url(1) . kernel::url_prefix() . '/api');
     //更新时,多带个参数
     if ($method == 'node.update') {
         $api_data['node_id'] = base_shopnode::node_id($app_id);
     }
     ksort($api_data);
     foreach ($api_data as $key => $value) {
         $str .= $value;
     }
     $api_data['certi_ac'] = strtoupper(md5($str . base_certificate::token()));
     $http = kernel::single('base_httpclient');
     $http->set_timeout(6);
     $result = $http->post(config::get('link.license_center'), $api_data);
     $result = json_decode($result, true);
     if ($result['res'] == 'succ') {
         return self::set_node_id($result['info'], $app_id);
     } else {
         return false;
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:25,代码来源:shopnode.php

示例15: assignCredentials

 /**
  * Update the sign-in credentials for the specific user.
  *
  * @param UserRecord $user The user to update the credentials for
  * @return Boolean True on success
  */
 public function assignCredentials(UserRecord $user)
 {
     $db = new DatabaseConnection();
     // Generate a new salt and hash the password
     $salt = $this->generateSalt();
     // What hashing algorithm to use
     $ha = config::get('lepton.user.hashalgorithm', 'md5');
     $ps = $user->password . $salt;
     $hp = hash($ha, $ps);
     if ($user->userid == null) {
         $uuid = UUID::v4();
         try {
             $id = $db->insertRow("REPLACE INTO " . LEPTON_DB_PREFIX . "users (username,salt,password,email,flags,registered,uuid) VALUES (%s,%s,%s,%s,%s,NOW(),%s)", $user->username, $salt, $hp, $user->email, $user->flags, $uuid);
             $user->userid = $id;
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     } else {
         try {
             $db->updateRow("UPDATE " . LEPTON_DB_PREFIX . "users SET username=%s,salt=%s,password=%s,email=%s,flags=%s WHERE id=%d", $user->username, $salt, $hp, $user->email, $user->flags, $user->userid);
         } catch (Exception $e) {
             throw $e;
             // TODO: Handle exception
         }
     }
     return true;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:34,代码来源:defaultauthbackend.php


注:本文中的config::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。