當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config::getValue方法代碼示例

本文整理匯總了PHP中Config::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::getValue方法的具體用法?PHP Config::getValue怎麽用?PHP Config::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Config的用法示例。


在下文中一共展示了Config::getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Setup

 /**
  * Set up class properties etc.
  */
 private function Setup()
 {
     // place for additional sets
     // e.g. $this->aConfig[ section_key ][ value_key ] = value
     $sAppConfigIni = DOCROOT . $this->oConfig->getValue(sprintf('applications.%s.config_file', $this->oRouter->getApplicationName()));
     $this->oConfig->loadIniFile($sAppConfigIni);
     $this->sLogsDirectory = $this->getConfig('General.Logs_directory', DOCROOT . 'logs/');
     $this->sLogsDirectory .= date('Y-m-d') . '/';
     // set main framework path
     $this->addPath('Lithium');
     // set application path received from config file
     if ($sAppPath = $this->getConfig('General.App_path')) {
         $this->addPath($sAppPath);
         Loader::addPath(DOCROOT . $sAppPath);
     }
     // add path for external classes
     Loader::addPath(DOCROOT);
     // set language
     if ($sLanguage = $this->getConfig('Locale.Language')) {
         $this->sLanguage = $sLanguage;
     }
     Core_Model::setLithium($this);
     Core_Module::setLithium($this);
     Database_Driver::setLithium($this);
     // initialize router
     $this->oRouter->init();
     View::setRouter($this->oRouter);
     Module_Sorter::setRouter($this->oRouter);
     Module_Pagination::setRouter($this->oRouter);
 }
開發者ID:maxwroc,項目名稱:PHP,代碼行數:33,代碼來源:Lithium.php

示例2: newUserLDAP

 /**
  * Crear un nuevo usuario en la BBDD con los datos de LDAP.
  * Esta función crea los usuarios de LDAP en la BBDD para almacenar infomación del mismo
  * y utilizarlo en caso de fallo de LDAP
  *
  * @param User $User
  * @return bool
  */
 public static function newUserLDAP(User $User)
 {
     $passdata = UserPass::makeUserPassHash($User->getUserPass());
     $groupId = Config::getValue('ldap_defaultgroup', 0);
     $profileId = Config::getValue('ldap_defaultprofile', 0);
     $query = 'INSERT INTO usrData SET ' . 'user_name = :name,' . 'user_groupId = :groupId,' . 'user_login = :login,' . 'user_pass = :pass,' . 'user_hashSalt = :hashSalt,' . 'user_email = :email,' . 'user_notes = :notes,' . 'user_profileId = :profileId,' . 'user_isLdap = 1,' . 'user_isDisabled = :isDisabled';
     $data['name'] = $User->getUserName();
     $data['login'] = $User->getUserLogin();
     $data['pass'] = $passdata['pass'];
     $data['hashSalt'] = $passdata['salt'];
     $data['email'] = $User->getUserEmail();
     $data['notes'] = _('Usuario de LDAP');
     $data['groupId'] = $groupId;
     $data['profileId'] = $profileId;
     $data['isDisabled'] = $groupId === 0 || $profileId === 0 ? 1 : 0;
     if (DB::getQuery($query, __FUNCTION__, $data) === false) {
         return false;
     }
     if (!$groupId || !$profileId) {
         $Log = new Log(_('Activación Cuenta'));
         $Log->addDescription(_('Su cuenta está pendiente de activación.'));
         $Log->addDescription(_('En breve recibirá un email de confirmación.'));
         $Log->writeLog();
         Email::sendEmail($Log, $User->getUserEmail(), false);
     }
     Log::writeNewLogAndEmail(_('Nuevo usuario de LDAP'), sprintf("%s (%s)", $User->getUserName(), $User->getUserLogin()));
     return true;
 }
開發者ID:bitking,項目名稱:sysPass,代碼行數:36,代碼來源:UserLdap.class.php

示例3: parseURL

 /**
  * Parse current request url
  */
 protected function parseURL()
 {
     $aUrlParts = explode('/', $this->getCurrentPath());
     $iUrlPos = 1;
     if ($this->bUrlContainsAppName) {
         // in first pos we have app name so we switch to controller name
         $iUrlPos++;
     }
     $this->sControllerName = sprintf('Controller_%s', ucfirst(strtolower($this->oConfig->getValue('router.default_controller', 'index'))));
     $this->sFunctionName = sprintf('%sAction', strtolower($this->oConfig->getValue('router.default_function', 'index')));
     // Check if we should use different then default controller
     if (!empty($aUrlParts[$iUrlPos])) {
         $this->sControllerName = 'Controller_' . ucfirst($aUrlParts[$iUrlPos]);
         // Function name
         $iUrlPos++;
         if (!empty($aUrlParts[$iUrlPos])) {
             $this->sFunctionName = strtolower($aUrlParts[$iUrlPos]) . 'Action';
             //params pos
             $iUrlPos++;
             if (!empty($aUrlParts[$iUrlPos])) {
                 for ($i = $iUrlPos; $i < count($aUrlParts); $i++) {
                     $this->aParams[] = $aUrlParts[$i];
                 }
             }
         }
         // if function
     }
     // if controller
 }
開發者ID:maxwroc,項目名稱:PHP,代碼行數:32,代碼來源:Router.php

示例4: __construct

 private function __construct()
 {
     try {
         $databaseHost = Config::getValue('mysql/host');
         $databaseName = Config::getValue('mysql/db');
         $databaseUsername = Config::getValue('mysql/username');
         $databasePassword = Config::getValue('mysql/password');
         $this->_pdo = new PDO('mysql:host=' . $databaseHost . ';dbname=' . $databaseName, $databaseUsername, $databasePassword, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }
開發者ID:nelfurion,項目名稱:HackTues-v1-web,代碼行數:12,代碼來源:database.php

示例5: getConnectString

 /**
  * Generates a connect string to use when creating a PDO object.
  * @param Config $config
  * @return string PDO connect string
  */
 public static function getConnectString($config)
 {
     //set default db type to mysql if not set
     $db_type = $config->getValue('db_type');
     if (!$db_type) {
         $db_type = 'mysql';
     }
     $db_socket = $config->getValue('db_socket');
     if (!$db_socket) {
         $db_port = $config->getValue('db_port');
         if (!$db_port) {
             $db_socket = '';
         } else {
             $db_socket = ";port=" . $config->getValue('db_port');
         }
     } else {
         $db_socket = ";unix_socket=" . $db_socket;
     }
     $db_string = sprintf("%s:dbname=%s;host=%s%s", $db_type, $config->getValue('db_name'), $config->getValue('db_host'), $db_socket);
     return $db_string;
 }
開發者ID:rayyan,項目名稱:ThinkUp,代碼行數:26,代碼來源:class.PDODAO.php

示例6: getGlobalLang

 /**
  * Establece el lenguaje de la aplicación.
  * Esta función establece el lenguaje según esté definido en la configuración o en el navegador.
  */
 private function getGlobalLang()
 {
     $browserLang = $this->getBrowserLang();
     $configLang = Config::getValue('sitelang');
     // Establecer a en_US si no existe la traducción o no es español
     if (!$configLang && !$this->checkLangFile($browserLang) && !preg_match('/^es_.*/i', $browserLang)) {
         $lang = 'en_US';
     } else {
         $lang = $configLang ? $configLang : $browserLang;
     }
     return $lang;
 }
開發者ID:bitking,項目名稱:sysPass,代碼行數:16,代碼來源:Language.class.php

示例7: update

 public function update($id, $request)
 {
     $config = new Config(CONFIG . 'app.json');
     $config->parseFile();
     $data = $request->getParameters();
     if (isset($data['userRankSubmit'])) {
         if (User::exists($id)) {
             $user = User::find($id);
             $data['ranks'][$config->getValue('rankAdmin')] = ['Administrateur', 'danger'];
             $data['ranks'][$config->getValue('rankModo')] = ['Modérateur', 'warning'];
             $data['ranks'][$config->getValue('rankTeam')] = ['Equipe', 'success'];
             $data['ranks'][$config->getValue('rankContributor')] = ['Contributeur', 'info'];
             $data['ranks'][$config->getValue('rankUser')] = ['Utilisateur', 'primary'];
             $user->rank = $data['rank'];
             $user->save();
             $data['user'] = $user;
             $r = new ViewResponse("admin/settings/edit_user", $data);
             $r->addMessage(ViewMessage::success($user->username . " désormais {$data['ranks'][$user->rank][0]}"));
             return $r;
         }
     }
 }
開發者ID:boulama,項目名稱:DreamVids,代碼行數:22,代碼來源:settings_controller.php

示例8: connect

 /**
  *
  * Connect to database using PDO
  * @return PDO
  */
 private function connect()
 {
     $db_string = sprintf("mysql:dbname=%s;host=%s", $this->config->getValue('db_name'), $this->config->getValue('db_host'));
     if ($this->DEBUG) {
         echo "DEBUG: Connecting to {$db_string}\n";
     }
     $db_socket = $this->config->getValue('db_socket');
     if ($db_socket) {
         $db_string .= ";unix_socket=" . $db_socket;
     }
     $pdo = new PDO($db_string, $this->config->getValue('db_user'), $this->config->getValue('db_password'));
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return $pdo;
 }
開發者ID:nix4,項目名稱:ThinkUp,代碼行數:19,代碼來源:class.ModelMaker.php

示例9: connect

 /**
  *
  * Connect to database using PDO
  * @return PDO
  */
 private function connect()
 {
     $db_string = sprintf("mysql:dbname=test;host=localhost");
     /*
     if ($this->DEBUG) {
         echo "DEBUG: Connecting to $db_string\n";
     }
     */
     $db_socket = $this->config->getValue('db_socket');
     if ($db_socket) {
         $db_string .= ";unix_socket=" . $db_socket;
     }
     $pdo = new PDO($db_string, 'root', '');
     $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return $pdo;
 }
開發者ID:prabhatse,項目名稱:olx_hack,代碼行數:21,代碼來源:class.ModelMaker.php

示例10: init

 public static function init()
 {
     if (!Config::getValue('php')) {
         return;
     }
     // debug
     if (Config::getValue('php', 'debug')) {
         error_reporting(E_ALL);
         ini_set('display_errors', 'On');
         ini_set('display_startup_errors', 'On');
     }
     // session
     if (Config::getValue('php', 'session')) {
         session_cache_limiter(false);
         session_start();
         if ($tmp = Config::getValue('php', 'session_lifetime')) {
             ini_set("session.cookie_lifetime", $tmp);
         }
     }
     // cas
     if ($tmp = Config::getValue('php', 'timezone', 'Europe/Prague')) {
         date_default_timezone_set($tmp);
     }
     // locales
     if ($locality = Config::getValue('php', 'locality')) {
         if (in_array(explode('.', $locality, 2)[0], Config::getValue('php', 'locales_available'))) {
             // Set language
             putenv('LC_ALL=' . $locality);
             setlocale(LC_ALL, $locality);
             setlocale(LC_MESSAGES, $locality);
             // Specify the location of the translation tables
             if ($localization_name = Config::getValue('php', 'localization_name')) {
                 bindtextdomain($localization_name, './locales');
                 bind_textdomain_codeset($localization_name, 'UTF-8');
                 textdomain($localization_name);
             }
         } else {
             error_log("Unsupported locales" . $locales);
         }
     }
 }
開發者ID:kourim,項目名稱:limedca,代碼行數:41,代碼來源:config.class.php

示例11: searchADUserInGroup

 /**
  * Buscar al usuario en un grupo.
  *
  * @param string $userLogin con el login del usuario
  * @throws \Exception
  * @return bool
  */
 public static function searchADUserInGroup($userLogin)
 {
     if (Ldap::$_isADS === false) {
         return false;
     }
     $log = new Log(__FUNCTION__);
     $ldapGroup = Config::getValue('ldap_group');
     // El filtro de grupo no está establecido
     if (empty($ldapGroup)) {
         return true;
     }
     // Obtenemos el DN del grupo
     if (!($groupDN = Ldap::searchGroupDN())) {
         return false;
     }
     $filter = '(memberof:1.2.840.113556.1.4.1941:=' . $groupDN . ')';
     $filterAttr = array("sAMAccountName");
     $searchRes = @ldap_search(Ldap::$_ldapConn, Ldap::$_searchBase, $filter, $filterAttr);
     if (!$searchRes) {
         $log->addDescription(_('Error al buscar el grupo de usuarios'));
         $log->addDescription('LDAP ERROR: ' . ldap_error(Ldap::$_ldapConn) . '(' . ldap_errno(Ldap::$_ldapConn) . ')');
         $log->addDescription('LDAP FILTER: ' . $filter);
         $log->writeLog();
         throw new \Exception(_('Error al buscar el grupo de usuarios'));
     }
     if (@ldap_count_entries(Ldap::$_ldapConn, $searchRes) === 0) {
         $log->addDescription(_('No se encontró el grupo con ese nombre'));
         $log->addDescription('LDAP ERROR: ' . ldap_error(Ldap::$_ldapConn) . '(' . ldap_errno(Ldap::$_ldapConn) . ')');
         $log->addDescription('LDAP FILTER: ' . $filter);
         $log->writeLog();
         throw new \Exception(_('No se encontró el grupo con ese nombre'));
     }
     foreach (ldap_get_entries(Ldap::$_ldapConn, $searchRes) as $entry) {
         if ($userLogin === $entry['samaccountname'][0]) {
             return true;
         }
     }
     return false;
 }
開發者ID:bitking,項目名稱:sysPass,代碼行數:46,代碼來源:LdapADS.class.php

示例12: getConnection

 /**
  * Realizar la conexión con la BBDD.
  * Esta función utiliza PDO para conectar con la base de datos.
  * @return PDO
  * @throws \Exception
  */
 public function getConnection()
 {
     if (!$this->_db) {
         $dbhost = Config::getValue('dbhost');
         $dbuser = Config::getValue('dbuser');
         $dbpass = Config::getValue('dbpass');
         $dbname = Config::getValue('dbname');
         $dbport = Config::getValue('dbport', 3306);
         if (empty($dbhost) || empty($dbuser) || empty($dbpass) || empty($dbname)) {
             throw new \Exception(_('No es posible conectar con la BD'), 1);
         }
         try {
             $dsn = 'mysql:host=' . $dbhost . ';port=' . $dbport . ';dbname=' . $dbname . ';charset=utf8';
             //                $this->db = new PDO($dsn, $dbuser, $dbpass, array(PDO::ATTR_PERSISTENT => true));
             $this->_db = new PDO($dsn, $dbuser, $dbpass);
         } catch (\Exception $e) {
             throw $e;
         }
     }
     $this->_db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
     $this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     return $this->_db;
 }
開發者ID:nuxsmin,項目名稱:sysMonDash,代碼行數:29,代碼來源:DBConnectionFactory.class.php

示例13: __construct

 /**
  * Constructor
  */
 function __construct()
 {
     $userResultsPerPage = Session::getUserPreferences()->getResultsPerPage();
     $this->setLimitCount($userResultsPerPage > 0 ? $userResultsPerPage : Config::getValue('account_count'));
     $this->setSortViews(Session::getUserPreferences()->isSortViews());
 }
開發者ID:bitking,項目名稱:sysPass,代碼行數:9,代碼來源:AccountSearch.class.php

示例14: getEmailObject

 /**
  * Inicializar la clase PHPMailer.
  *
  * @param string $mailTo con la dirección del destinatario
  * @param string $action con la acción realizada
  * @return false|\PHPMailer
  */
 private static function getEmailObject($mailTo, $action)
 {
     $appName = Util::getAppInfo('appname');
     $mailFrom = Config::getValue('mail_from');
     $mailServer = Config::getValue('mail_server');
     $mailPort = Config::getValue('mail_port', 25);
     $mailAuth = Config::getValue('mail_authenabled', FALSE);
     if ($mailAuth) {
         $mailUser = Config::getValue('mail_user');
         $mailPass = Config::getValue('mail_pass');
     }
     if (!$mailServer) {
         return false;
     }
     if (empty($mailTo)) {
         $mailTo = $mailFrom;
     }
     require_once EXTENSIONS_PATH . '/phpmailer/class.phpmailer.php';
     require_once EXTENSIONS_PATH . '/phpmailer/class.smtp.php';
     $mail = new \PHPMailer();
     $mail->isSMTP();
     $mail->CharSet = 'utf-8';
     $mail->Host = $mailServer;
     $mail->Port = $mailPort;
     if ($mailAuth) {
         $mail->SMTPAuth = $mailAuth;
         $mail->Username = $mailUser;
         $mail->Password = $mailPass;
     }
     $mail->SMTPSecure = strtolower(Config::getValue('mail_security'));
     //$mail->SMTPDebug = 2;
     //$mail->Debugoutput = 'error_log';
     $mail->setFrom($mailFrom, $appName);
     $mail->addAddress($mailTo);
     $mail->addReplyTo($mailFrom, $appName);
     $mail->WordWrap = 100;
     $mail->Subject = $appName . ' (' . _('Aviso') . ') - ' . $action;
     return $mail;
 }
開發者ID:bitking,項目名稱:sysPass,代碼行數:46,代碼來源:Email.class.php

示例15:

    $form["Abilit"] = 5;
    $form["Access"] = 0;
    $form["Login"] = "";
    $form["Password"] = "";
    $form["confpass"] = "";
}

if (isset($_POST['Submit'])) {
    //controllo i campi
    if (empty($form["Cognome"]))
        $msg .= "1+";
    if (empty($form["Login"]))
        $msg .= "2+";
    if (empty($form["Password"]))
        $msg .= "3+";
    if (strlen($form["Password"]) < $config->getValue('psw_min_length'))
        $msg .= "4+";
    if ($form["Password"] != $form["confpass"] )
        $msg .= "5+";
    if ($form["Abilit"] > $user_data["Abilit"] )
        $msg .= "6+";
    if (! empty($_FILES['userfile']['name'])) {
        if (!( $_FILES['userfile']['type'] == "image/jpeg" || $_FILES['userfile']['type'] == "image/pjpeg"))
            $msg .= "7+";
            // controllo che il file non sia pi&ugrave; grande di 10kb
        if ( $_FILES['userfile']['size'] > 10999)
            $msg .= "8+";
    }
    if ($form["Abilit"] < 9) {
        $ricerca=$form["Login"];
        $rs_utente = gaz_dbi_dyn_query("*", $gTables['admin'], "Login <> '$ricerca' and Abilit ='9'", "Login",0,1);
開發者ID:andreabia,項目名稱:gazie,代碼行數:31,代碼來源:admin_utente.php


注:本文中的Config::getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。