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


PHP Config::getConfig方法代码示例

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


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

示例1: validate

 /**
  * Returns true if the file is a valid upload, after making it go through all
  * our tests.
  *
  * @param upload An FileUpload object containing information about the file
  * @return Returns true if it is valid or a negative value meaning an error otherwise:
  * <ul><li>ERROR_UPLOAD_TOO_BIG (-1): The file bigger than the maximum allowed size</li>
  * <li>ERROR_FORBIDDEN_EXTENSION: The file has a forbidden extension.</li></ul>
  */
 function validate($upload)
 {
     $config =& Config::getConfig();
     $forbiddenFilesStr = $config->getValue("upload_forbidden_files");
     $maxUploadSize = $config->getValue("maximum_file_upload_size");
     // check if we received an object of the right type, or else just quit
     if ($upload == null) {
         return false;
     }
     // first of all, check the size
     if ($maxUploadSize != 0 && $upload->getSize() > $maxUploadSize) {
         return UPLOAD_VALIDATOR_ERROR_UPLOAD_TOO_BIG;
     }
     // return true if there's nothing to do
     if (empty($forbiddenFilesStr) || !$forbiddenFilesStr) {
         return true;
     }
     // check if the filename extension is forbidden or not
     $fileName = basename($upload->getFileName());
     foreach (explode(" ", $forbiddenFilesStr) as $file) {
         if (Glob::myFnmatch($file, $fileName)) {
             return UPLOAD_VALIDATOR_ERROR_FORBIDDEN_EXTENSION;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:35,代码来源:uploadvalidator.class.php

示例2: perform

 function perform()
 {
     // update the plugin configurations to blog setting
     $config =& Config::getConfig();
     $config->setValue("plugin_moblog_mailserver", $this->_mailServer);
     $config->setValue("plugin_moblog_port", $this->_port);
     $config->setValue("plugin_moblog_username", $this->_userName);
     $config->setValue("plugin_moblog_password", $this->_password);
     $config->setValue("plugin_moblog_pseudobatch", $this->_pseudoBatch);
     if (!$config->save()) {
         $this->_view = new AdminMoblogBatchPluginSettingsView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_updating_settings"));
         $this->setCommonData();
         return false;
     }
     // if everything went ok...
     $this->_session->setValue("blogInfo", $this->_blogInfo);
     $this->saveSession();
     $this->_view = new AdminMoblogBatchPluginSettingsView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->tr("moblog_settings_saved_ok"));
     $this->setCommonData();
     // clear the cache
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:25,代码来源:adminmoblogbatchpluginupdatesettingsaction.class.php

示例3: AdminAction

 /**
  * Constructor.
  *
  * @param actionInfo An ActionInfo object as provided by the constroller
  * @param request A valid HTTP request
  */
 function AdminAction($actionInfo, $request)
 {
     $this->Action($actionInfo, $request);
     // get information about the session
     $session = HttpVars::getSession();
     $this->_session = $session["SessionInfo"];
     $this->_config =& Config::getConfig();
     // get the information about the user and quit if we don't have it...
     $this->_getUserInfo();
     if ($this->_userInfo == "") {
         header("HTTP/1.0 403 Forbidden");
         print $this->mustAuthenticatePage();
         die;
     }
     // do the same with the information about the blog
     $this->_getBlogInfo();
     if ($this->_blogInfo == "") {
         if ($this->_actionInfo->getActionParamValue() != "blogSelect") {
             header("HTTP/1.0 403 Forbidden");
             print $this->mustAuthenticatePage();
             die;
         }
     }
     // prepare the plugin manager in case we'd like to throw events
     $this->_pm =& PluginManager::getPluginManager();
     // fetch the site locale
     $this->_locale =& $this->getLocale();
     $users =& new Users();
     $this->_userBlogs = $users->getUsersBlogs($this->_userInfo->getId(), BLOG_STATUS_ACTIVE);
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:36,代码来源:adminaction.class.php

示例4: configureTemplateAction

 public function configureTemplateAction()
 {
     $CC_CONFIG = Config::getConfig();
     $baseUrl = Application_Common_OsPath::getBaseDir();
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/playouthistory/configuretemplate.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/history_styles.css?' . $CC_CONFIG['airtime_version']);
     try {
         $templateId = $this->_getParam('id');
         $historyService = new Application_Service_HistoryService();
         $template = $historyService->loadTemplate($templateId);
         $templateType = $template["type"];
         $supportedTypes = $historyService->getSupportedTemplateTypes();
         if (!in_array($templateType, $supportedTypes)) {
             throw new Exception("Error: {$templateType} is not supported.");
         }
         $getMandatoryFields = "mandatory" . ucfirst($templateType) . "Fields";
         $mandatoryFields = $historyService->{$getMandatoryFields}();
         $this->view->template_id = $templateId;
         $this->view->template_name = $template["name"];
         $this->view->template_fields = $template["fields"];
         $this->view->template_type = $templateType;
         $this->view->fileMD = $historyService->getFileMetadataTypes();
         $this->view->fields = $historyService->getFieldTypes();
         $this->view->required_fields = $mandatoryFields;
         $this->view->configured = $historyService->getConfiguredTemplateIds();
     } catch (Exception $e) {
         Logging::info("Error?");
         Logging::info($e);
         Logging::info($e->getMessage());
         $this->_forward('index', 'playouthistorytemplate');
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:32,代码来源:PlayouthistorytemplateController.php

示例5: perform

 function perform()
 {
     // fetch the data
     $this->_userName = $this->_request->getValue("userName");
     $this->_userEmail = $this->_request->getValue("userEmail");
     // try to see if there is a user who has this username and uses the
     // given mailbox as the email address
     $users = new Users();
     $userInfo = $users->getUserInfoFromUsername($this->_userName);
     // if the user doesn't exist, quit
     if (!$userInfo) {
         $this->_view = new SummaryView("resetpassword");
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // if the user exists but this is not his/her mailbox, then quit too
     if ($userInfo->getEmail() != $this->_userEmail) {
         $this->_view = new SummaryView("resetpassword");
         $this->_form->setFieldValidationStatus("userEmail", false);
         $this->setCommonData(true);
         return false;
     }
     // if everything's fine, then send out the email message with a request to
     // reset the password
     $requestHash = SummaryTools::calculatePasswordResetHash($userInfo);
     $config =& Config::getConfig();
     $baseUrl = $config->getValue("base_url");
     $resetUrl = $baseUrl . "/summary.php?op=setNewPassword&a={$requestHash}&b=" . md5($userInfo->getUsername());
     SummaryTools::sendResetEmail($userInfo, $resetUrl);
     $this->_view = new SummaryMessageView($this->_locale->tr("password_reset_message_sent_ok"));
     $this->setCommonData();
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:34,代码来源:summarysendresetemail.class.php

示例6: render

 function render()
 {
     // call the render method in the main view class... it will take care of sending the headers
     // for us and so on...
     parent::render();
     // if there is no resource to send... then we can quit right away!
     if ($this->_resource == null) {
         return;
     }
     // let's see if we really need to send some data or not...
     // send also some headers that will help caching, if configured to do so
     $config =& Config::getConfig();
     $useCaching = $config->getValue('resource_server_http_cache_enabled');
     if ($useCaching) {
         // send the "Last-Modified" header
         $resDate = $this->_resource->getTimestamp();
         $lastModified = $resDate->getDate(DATE_FORMAT_UNIXTIME);
         $cacheLifetime = $config->getValue('resource_server_http_cache_lifetime', DEFAULT_HTTP_CACHE_LIFETIME);
         // check if we have to resent the data and if not, then we're done!
         if (HttpCache::httpConditional($lastModified, $cacheLifetime)) {
             exit;
         }
     }
     // if we need to send something, then let's do it now and finish
     if ($this->_mode == RESOURCE_VIEW_MODE_PREVIEW) {
         print $this->_resource->getPreview();
     } elseif ($this->_mode == RESOURCE_VIEW_MODE_MEDIUM) {
         print $this->_resource->getMediumSizePreview();
     } else {
         while ($chunk =& $this->_resource->getDataChunk(RESOURCE_DEFAULT_CHUNK_SIZE)) {
             echo $chunk;
         }
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:35,代码来源:resourceserverview.class.php

示例7: Template

 /**
  * Constructor. 
  *
  * @param templateFile Complete path to the template file we are going to render
  */
 function Template($templateFile)
 {
     // initialize logging
     $this->log =& LoggerManager::getLogger("default");
     // create the Smarty object and set the security values
     $this->Smarty();
     $this->caching = false;
     //$this->cache_lifetime =  $cacheLifetime;
     $config =& Config::getConfig();
     $this->cache_dir = $config->getValue('temp_folder');
     $this->_templateFile = $templateFile;
     // enable the security settings
     $this->php_handling = false;
     // code is not allowed in the templates by default, unless specified otherwise
     /*if( $config->getValue( 'allow_php_code_in_templates', false ))
       	$this->security = true;
       else
       	$this->security = false;*/
     $this->security = (bool) (!$config->getValue('allow_php_code_in_templates', false));
     //$this->security = true;
     $this->secure_dir = array("./templates/admin", "./templates/");
     // default folders
     $this->compile_dir = $config->getValue('temp_folder');
     $this->template_dir = $config->getValue('template_folder');
     $this->compile_check = $config->getValue('template_compile_check', true);
     // this helps if php is running in 'safe_mode'
     $this->use_sub_dirs = false;
     // register dynamic block for every template instance
     $this->register_block('dynamic', 'smarty_block_dynamic', false);
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:35,代码来源:template.class.php

示例8: init

 public function init()
 {
     $CC_CONFIG = Config::getConfig();
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/login.phtml'))));
     // Add username element
     $this->addElement('text', 'username', array('label' => _('Username:'), 'class' => 'input_text', 'required' => true, 'value' => isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 ? 'admin' : '', 'filters' => array('StringTrim'), 'validators' => array('NotEmpty'), 'decorators' => array('ViewHelper')));
     // Add password element
     $this->addElement('password', 'password', array('label' => _('Password:'), 'class' => 'input_text', 'required' => true, 'value' => isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 ? 'admin' : '', 'filters' => array('StringTrim'), 'validators' => array('NotEmpty'), 'decorators' => array('ViewHelper')));
     $locale = new Zend_Form_Element_Select("locale");
     $locale->setLabel(_("Language:"));
     $locale->setMultiOptions(Application_Model_Locale::getLocales());
     $locale->setDecorators(array('ViewHelper'));
     $this->addElement($locale);
     $recaptchaNeeded = false;
     if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) {
         $recaptchaNeeded = true;
     }
     if ($recaptchaNeeded) {
         // recaptcha
         $this->addRecaptcha();
     }
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => _('Login'), 'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center', 'decorators' => array('ViewHelper')));
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:26,代码来源:Login.php

示例9: testGetConfigOneKey

 /**
  * Test the fetch of just one configuration key
  */
 public function testGetConfigOneKey()
 {
     $path = __DIR__ . '/' . $this->path;
     $config = new Config($path);
     $result = $config->getConfig('event/add');
     $this->assertTrue($result instanceof \Psecio\Invoke\RouteContainer);
 }
开发者ID:psecio,项目名称:invoke,代码行数:10,代码来源:ConfigTest.php

示例10: unpack

 function unpack($file, $destFolder)
 {
     // get the paths where tar and gz are
     $config =& Config::getConfig();
     $tarPath = $config->getValue("path_to_tar");
     if ($tarPath == "") {
         $tarPath = DEFAULT_TAR_PATH;
     }
     $gzipPath = $config->getValue("path_to_gzip");
     if ($gzipPath == "") {
         $gzipPath = DEFAULT_GZIP_PATH;
     }
     // and now build the command
     //$file = escapeshellarg($file);
     //$destFolder = escapeshellarg($destFolder);
     //
     // :DANGER:
     // what if the user voluntarily sets the path of gzip and tar
     // to something else? we are doing no checks here to make sure that
     // the user is giving us a valid commnand so... how could we make
     // sure that it'll work?
     //
     $cmd = "{$gzipPath} -dc {$file} | {$tarPath} xv -C {$destFolder}";
     $result = exec($cmd, $output, $retval);
     //
     // :KLUDGE:
     // apparently, we should get something in $retval but there's nothing
     // to the only way I've found to check if the command finished
     // successfully was checking if the $output array is full or empty
     //
     if (empty($output)) {
         return false;
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:35,代码来源:targzunpacker.class.php

示例11: GetMonitStatus

 public static function GetMonitStatus($p_ip)
 {
     $CC_CONFIG = Config::getConfig();
     $monit_user = $CC_CONFIG['monit_user'];
     $monit_password = $CC_CONFIG['monit_password'];
     $url = "http://{$p_ip}:2812/_status?format=xml";
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_USERPWD, "{$monit_user}:{$monit_password}");
     //wait a max of 3 seconds before aborting connection attempt
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
     $result = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     $docRoot = null;
     if ($result !== FALSE && $info["http_code"] === 200) {
         if ($result != "") {
             $xmlDoc = new DOMDocument();
             $xmlDoc->loadXML($result);
             $docRoot = $xmlDoc->documentElement;
         }
     }
     return $docRoot;
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:25,代码来源:Systemstatus.php

示例12: filter

 /**
  * Checks whether incoming comments are not bigger than our configurable threshold, via
  * the 'maximum_comment_size' config setting
  *
  * @return A PipelineResult object
  */
 function filter()
 {
     // check if we're posting a comment
     $request = $this->_pipelineRequest->getHttpRequest();
     if ($request->getValue("op") != "AddComment") {
         return new PipelineResult();
     }
     // get the value of the maximum size of a comment, in bytes
     $config =& Config::getConfig();
     $maxSize = $config->getValue("maximum_comment_size");
     // if it's 0 or negative, it can be as big
     // as needed
     if ($maxSize <= 0) {
         return new PipelineResult();
     }
     // otherwise, let's check
     $commentSize = strlen($request->getValue("commentText"));
     $topicSize = strlen($request->getValue("commentTopic"));
     if ($commentSize >= $maxSize || $topicSize >= $maxSize) {
         $result = new PipelineResult(false, COMMENT_FILTER_MAXIMUM_SIZE_EXCEEDED, "The comment is too big");
         return $result;
     }
     $result = new PipelineResult();
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:31,代码来源:commentfilter.class.php

示例13: write

 protected static function write($type, $msg)
 {
     $config = \Config::getConfig();
     $error_level = $config->get('log_level', self::HAYATE_LOG_OFF);
     if ($type <= $error_level) {
         $logdir = $config->get('log_dir', FALSE);
         try {
             if (is_dir($logdir) || @mkdir($logdir)) {
                 $filename = rtrim($logdir, '\\//') . '/log-' . date('Y-m-d') . '.log';
                 $logfile = new \SplFileObject($filename, 'a');
                 self::header($type, $logfile);
                 if (!is_string($msg)) {
                     $msg = print_r($msg, TRUE);
                 }
                 $logfile->fwrite($msg);
                 self::footer($logfile);
             } else {
                 throw new \Exception(sprintf(_('Log directory %s does not exists and could not be created.'), $logdir));
             }
         } catch (\Exception $ex) {
             if (!isset($filename)) {
                 $filename = 'not found';
             }
             trigger_error(sprintf(_('Failed to write to log file: "%s", %s'), $filename, $ex->getMessage()), E_USER_NOTICE);
         }
     }
 }
开发者ID:hayate,项目名称:unophp,代码行数:27,代码来源:Log.php

示例14: setModuleMessages

 public static function setModuleMessages($moduleName = '', $prefix = 'ms_')
 {
     $prefix = strtolower($prefix);
     $moduleName = strtolower($moduleName);
     $lang = Config::getConfig('LANG');
     if ($moduleName == '' || $moduleName == 'core') {
         $root = Config::getConfig('CORE_ROOT');
         $prefix .= 'core_';
     } else {
         $root = Config::getConfig('PACKAGES_ROOT') . $moduleName . '/';
         $prefix .= $moduleName . '_';
     }
     $dir = $root . 'loc/' . $lang . '/';
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..') {
                     $arMessages = array();
                     require_once $dir . $file;
                     foreach ($arMessages as $field => $text) {
                         static::$arMessage[strtoupper($prefix) . strtoupper($field)] = $text;
                     }
                 }
             }
             closedir($dh);
         }
     }
 }
开发者ID:msergeev06,项目名称:mj-msergeev,代码行数:28,代码来源:loc.php

示例15: process

 /**
  * Goes through the array of files and processes them accordingly.
  * The result is an array of the appropiate Resource class that has been
  * created using the ResourceFactory class.
  *
  * @return An array of Upload objects that have already been moved to a safer
  * location.
  */
 function process($destinationFolder)
 {
     // first, check if the upload feature is available
     $config =& Config::getConfig();
     if (!$config->getValue("uploads_enabled")) {
         return FILE_UPLOADS_NOT_ENABLED;
     }
     // array used to store the files that have already been saved
     $uploads = array();
     if ($destinationFolder[strlen($destinationFolder - 1)] != "/") {
         $destinationFolder .= "/";
     }
     foreach ($this->_files as $file) {
         $upload = new FileUpload($file);
         $fileName = $upload->getFileName();
         if ($this->my_move_uploaded_file($upload->getTmpName(), $destinationFolder . $fileName)) {
             $upload->setFolder($destinationFolder);
             $upload->setError(0);
         } else {
             $upload->setError(1);
         }
         array_push($uploads, $upload);
     }
     return $uploads;
 }
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:33,代码来源:fileuploads.class.php


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