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


PHP MOXMAN::getConfig方法代码示例

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


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

示例1: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $request = $httpContext->getRequest();
     $response = $httpContext->getResponse();
     try {
         $config = MOXMAN::getConfig();
         $allItems = $config->getAll();
         $licenseKey = trim($config->get("general.license"));
         $installed = !empty($allItems);
         $response->disableCache();
         $response->setHeader('Content-type', 'application/json');
         if ($installed && !$config->get('filesystem.rootpath')) {
             throw new MOXMAN_Exception("You must configure filesystem.rootpath.");
         }
         if ($request->getMethod() != 'POST') {
             throw new MOXMAN_Exception("Not a HTTP post request.");
         }
         if ($installed && !preg_match('/^([0-9A-Z]{4}\\-){7}[0-9A-Z]{4}$/', $licenseKey)) {
             throw new MOXMAN_Exception("Invalid license key specified in config.");
         }
         $authInfo = (object) array("token" => MOXMAN_Http_Csrf::createToken(MOXMAN::getConfig()->get('general.license')), "installed" => $installed, "loggedin" => MOXMAN::getAuthManager()->isAuthenticated(), "loginurl" => $config->get("authenticator.login_page", ""), "standalone" => MOXMAN::getAuthManager()->hasStandalone(), "overwrite_action" => $config->get("filesystem.overwrite_action", ""));
         $args = new MOXMAN_Auth_AuthInfoEventArgs();
         MOXMAN::getPluginManager()->get("core")->fire("AuthInfo", $args);
         foreach ($args->getInfo() as $key => $value) {
             $authInfo->{$key} = $value;
         }
         $response->sendJson($authInfo);
     } catch (Exception $e) {
         $response->sendJson((object) array("error" => array("code" => $e->getCode(), "message" => $e->getMessage())));
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:36,代码来源:AuthHandler.php

示例2: authenticate

 public function authenticate(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     if ($config->get('SymfonyAuthenticator.application_name') == '') {
         die('You should define a SymfonyAuthenticator.application_name name in Moxiemanager config file.');
     }
     if ($config->get('SymfonyAuthenticator.application_env') == '') {
         die('You should define a SymfonyAuthenticator.application_env in Moxiemanager config file.');
     }
     if ($config->get('SymfonyAuthenticator.project_configuration_path') == '') {
         die('You should define a SymfonyAuthenticator.project_configuration_path in Moxiemanager config file.');
     }
     require_once $config->get('SymfonyAuthenticator.project_configuration_path');
     $configuration = ProjectConfiguration::getApplicationConfiguration($config->get('SymfonyAuthenticator.application_name'), $config->get('SymfonyAuthenticator.application_env'), false);
     $context = sfContext::createInstance($configuration);
     // Is the user authenticated ?
     if ($context->getUser()->isAuthenticated()) {
         // Do we need a special role to access to the moxiemanager ?
         if ($config->get('SymfonyAuthenticator.credential') != '') {
             if ($context->getUser()->hasCredential($config->get('SymfonyAuthenticator.credential'))) {
                 return true;
             } else {
                 return false;
             }
         }
         return true;
     }
     return false;
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:29,代码来源:Plugin.php

示例3: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $request = $httpContext->getRequest();
     $response = $httpContext->getResponse();
     $response->disableCache();
     $response->setHeader('Content-type', 'text/javascript');
     // Set prefix if it's a tinymce language pack or not
     $prefix = MOXMAN_ROOT . '/langs/moxman_';
     if ($request->get("tinymce")) {
         $prefix = MOXMAN_ROOT . '/langs/';
     }
     // Load TinyMCE specific pack if it exists
     $langCode = preg_replace('/[^a-z_\\-]/i', '', $request->get('code'));
     if ($langCode) {
         $langFile = $prefix . $langCode . '.js';
         if (file_exists($langFile)) {
             $response->sendContent(file_get_contents($langFile));
             return;
         }
     }
     // Fallback to configured language pack
     $langCode = MOXMAN::getConfig()->get("general.language");
     if ($langCode) {
         $langFile = $prefix . $langCode . '.js';
         if (file_exists($langFile)) {
             $response->sendContent(file_get_contents($langFile));
             return;
         }
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:35,代码来源:LanguageHandler.php

示例4: authenticate

 public function authenticate(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     $session = new CI_Session();
     // Check logged in key
     $sessionValue = $session->userdata($config->get("CodeIgniterAuthenticator.logged_in_key", "loggedin"));
     if (!$sessionValue || $sessionValue === "false") {
         return false;
     }
     // Extend config with session prefixed sessions
     $sessionConfig = array();
     $configPrefix = $config->get("CodeIgniterAuthenticator.config_prefix", "moxiemanager");
     if ($configPrefix) {
         $allData = $session->all_userdata();
         foreach ($allData as $key => $value) {
             if (strpos($key, $configPrefix) === 0) {
                 $sessionConfig[substr($key, strlen($configPrefix) + 1)] = $value;
             }
         }
     }
     // Extend the config with the session config
     $config->extend($sessionConfig);
     // Replace ${user} with all config items
     $key = $config->get("CodeIgniterAuthenticator.user_key");
     if ($key) {
         $value = $session->userdata($key);
         $config->replaceVariable("user", $value);
         $user->setName($value);
     }
     return true;
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:31,代码来源:Plugin.php

示例5: add

 public function add($params)
 {
     if (MOXMAN::getConfig()->get('general.demo')) {
         throw new MOXMAN_Exception("This action is restricted in demo mode.", MOXMAN_Exception::DEMO_MODE);
     }
     if (isset($params->paths) && is_array($params->paths)) {
         $paths = $params->paths;
         $files = MOXMAN_Util_Json::decode(MOXMAN::getUserStorage()->get("favorites.files", "[]"));
         // If files is larger then max size then crop it
         $max = intval(MOXMAN::getConfig()->get("favorites.max"));
         if (count($files) >= $max) {
             $files = array_slice($files, count($files) - $max);
         }
         foreach ($files as $file) {
             for ($i = count($paths) - 1; $i >= 0; $i--) {
                 if ($file->path == $paths[$i]) {
                     array_splice($paths, $i, 1);
                 }
             }
         }
         // Add new files
         foreach ($paths as $path) {
             $file = MOXMAN::getFile($path);
             $files[] = array("path" => $file->getPublicPath(), "size" => $file->getSize(), "isdir" => $file->isDirectory(), "mdate" => $file->getLastModified());
         }
         MOXMAN::getUserStorage()->put("favorites.files", MOXMAN_Util_Json::encode($files));
     }
     return true;
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:29,代码来源:Plugin.php

示例6: authenticate

 public function authenticate(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     $session = MOXMAN_Http_Context::getCurrent()->getSession();
     // Check logged in key
     $sessionValue = $session->get($config->get("SessionAuthenticator.logged_in_key"), false);
     if (!$sessionValue || $sessionValue === "false") {
         return false;
     }
     // Extend config with session prefixed sessions
     $sessionConfig = array();
     $configPrefix = $config->get("SessionAuthenticator.config_prefix");
     if ($configPrefix) {
         foreach ($_SESSION as $key => $value) {
             if (strpos($key, $configPrefix) === 0) {
                 $sessionConfig[substr($key, strlen($configPrefix) + 1)] = $value;
             }
         }
     }
     // Extend the config with the session config
     $config->extend($sessionConfig);
     // Replace ${user} with all config items
     $key = $config->get("SessionAuthenticator.user_key");
     if ($key && isset($_SESSION[$key])) {
         $config->replaceVariable("user", $session->get($key));
     }
     // The user is authenticated so let them though
     return true;
 }
开发者ID:tremor-od,项目名称:pizza.loc,代码行数:29,代码来源:Plugin.php

示例7: startSession

 public static function startSession()
 {
     $sessionName = MOXMAN::getConfig()->get("SessionAuthenticator.session_name");
     if ($sessionName) {
         @session_name($sessionName);
     }
     if (session_id() == '') {
         @session_start();
     }
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:10,代码来源:Plugin.php

示例8: authenticate

 public function authenticate(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     if (!isLogged()) {
         return false;
     }
     $s = getUsername();
     $sPath = BX_DIRECTORY_PATH_ROOT . 'media/moxie/files/' . substr($s, 0, 1) . '/' . substr($s, 0, 2) . '/' . substr($s, 0, 3) . '/' . $s;
     bx_mkdir_r($sPath);
     $config->put('filesystem.rootpath', $sPath);
     $config->replaceVariable("user", $s);
     $user->setName($s);
     return true;
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:14,代码来源:Plugin.php

示例9: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $config = MOXMAN::getConfig();
     $response = $httpContext->getResponse();
     $response->disableCache();
     $response->setHeader('Content-type', 'text/html');
     if (!$config->get("general.debug")) {
         $response->sendContent("Debugging not configured, you need to set general.debug to true in config.php file.");
         return;
     }
     $request = $httpContext->getRequest();
     if ($request->get("info")) {
         phpinfo();
         return;
     }
     $sitepaths = MOXMAN_Util_PathUtils::getSitePaths();
     $scriptFilename = $_SERVER["SCRIPT_FILENAME"];
     if (realpath($scriptFilename) != $scriptFilename) {
         $scriptFilename = $scriptFilename . "<br />(" . realpath($scriptFilename) . ")";
     }
     if (function_exists("imagecreatefromjpeg")) {
         $gdInfo = gd_info();
         $outInfo = "Ver:" . $gdInfo["GD Version"];
         $outInfo .= " GIF:" . ($gdInfo["GIF Create Support"] ? "Y" : "N");
         $outInfo .= " PNG:" . ($gdInfo["PNG Support"] ? "Y" : "N");
         $outInfo .= " JPEG:" . ($gdInfo["JPEG Support"] ? "Y" : "N");
     } else {
         $outInfo = "N/A";
         $gdInfo = array();
     }
     $user = MOXMAN::getAuthManager()->getUser();
     $result = array("MOXMAN_ROOT" => MOXMAN_ROOT, "realpath('.')" => realpath("."), "Config.php rootpath" => $config->get("filesystem.rootpath"), "Config.php wwwroot" => $config->get("filesystem.local.wwwroot"), "wwwroot resolve" => $sitepaths["wwwroot"], "wwwroot realpath" => realpath($sitepaths["wwwroot"]), "prefix resolve" => $sitepaths["prefix"], "storage path" => MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $config->get("storage.path")), "storage writable" => is_writable(MOXMAN_Util_PathUtils::toAbsolute(MOXMAN_ROOT, $config->get("storage.path"))), "script filename" => $scriptFilename, "script name" => $_SERVER["SCRIPT_NAME"], "GD" => $outInfo, "memory_limit" => @ini_get("memory_limit"), "upload_max_filesize" => @ini_get("upload_max_filesize"), "post_max_size" => @ini_get("post_max_size"), "file_uploads" => @ini_get("file_uploads") ? "Yes" : "No", "PHP Version" => phpversion(), "Time" => date('Y-m-d H:i:s', time()), "Time UTC" => date('Y-m-d H:i:s', time() - date("Z")), "Authenticated" => MOXMAN::getAuthManager()->isAuthenticated(), "User" => $user ? $user->getName() : "N/A");
     $out = "<html><body><table border='1'>";
     foreach ($result as $name => $value) {
         if ($value === true) {
             $value = "True";
         } else {
             if ($value === false) {
                 $value = "False";
             }
         }
         $out .= "<tr>";
         $out .= "<td>" . $name . "&nbsp;</td><td>" . $value . "&nbsp;</td>";
         $out .= "</tr>";
     }
     $out .= "</table><a href='?action=debug&info=true'>Show phpinfo</a>";
     $out .= "</body></html>";
     $response->sendContent($out);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:54,代码来源:DebugHandler.php

示例10: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $response = $httpContext->getResponse();
     $response->setHeader('Content-type', 'text/javascript');
     $config = MOXMAN::getConfig();
     $plugins = explode(',', $config->get("general.plugins"));
     $content = "";
     foreach ($plugins as $plugin) {
         $path = MOXMAN_PLUGINS . '/' . $plugin . '/Plugin.js';
         if (file_exists($path)) {
             $content .= file_get_contents($path);
         }
     }
     $response->sendContent($content);
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:20,代码来源:PluginJsHandler.php

示例11: login

 public function login(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     foreach ($config->get('basicauthenticator.users') as $userItem) {
         if ($userItem["username"] == $user->getName() && $userItem["password"] == $user->getPassword()) {
             if ($user->isPersistent()) {
                 setcookie("moxmanauth", hash("sha256", $userItem["username"] . $userItem["password"] . $config->get('general.license')));
             } else {
                 $_SESSION["moxman_authUser"] = $user->getName();
             }
             return true;
         }
     }
     return false;
 }
开发者ID:tremor-od,项目名称:pizza.loc,代码行数:15,代码来源:Plugin.php

示例12: processRequest

 /**
  * Process a request using the specified context.
  *
  * @param MOXMAN_Http_Context $httpContext Context instance to pass to use for the handler.
  */
 public function processRequest(MOXMAN_Http_Context $httpContext)
 {
     $request = $httpContext->getRequest();
     $response = $httpContext->getResponse();
     $langCode = preg_replace('/[^a-z_\\-]/i', '', $request->get('code', MOXMAN::getConfig()->get("general.language")));
     $response->disableCache();
     $response->setHeader('Content-type', 'text/javascript');
     if ($request->get("tinymce")) {
         $langFile = MOXMAN_ROOT . '/langs/' . $langCode . '.js';
     } else {
         $langFile = MOXMAN_ROOT . '/langs/moxman_' . $langCode . '.js';
     }
     if (file_exists($langFile)) {
         $response->sendContent(file_get_contents($langFile));
     }
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:21,代码来源:LanguageHandler.php

示例13: authenticate

 public function authenticate(MOXMAN_Auth_User $user)
 {
     $config = MOXMAN::getConfig();
     $secretKey = $config->get("ExternalAuthenticator.secret_key");
     $authUrl = $config->get("ExternalAuthenticator.external_auth_url");
     if (!$secretKey || !$authUrl) {
         throw new MOXMAN_Exception("No key/url set for ExternalAuthenticator, check config.");
     }
     // Build url
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
         $url = "https://";
     } else {
         $url = "http://";
     }
     $url .= $_SERVER['HTTP_HOST'];
     if ($_SERVER['SERVER_PORT'] != 80) {
         $url .= ':' . $_SERVER['SERVER_PORT'];
     }
     $httpClient = new MOXMAN_Http_HttpClient($url);
     $authUrl = MOXMAN_Util_PathUtils::toAbsolute(dirname($_SERVER["REQUEST_URI"]) . '/plugins/ExternalAuthenticator', $authUrl);
     $request = $httpClient->createRequest($url . $authUrl);
     $cookie = '';
     foreach ($_COOKIE as $name => $value) {
         $cookie .= ($cookie ? '; ' : '') . $name . '=' . $value;
     }
     $request->setHeader('cookie', $cookie);
     $seed = $cookie . uniqid() . time();
     $hash = hash_hmac('sha256', $seed, $secretKey);
     $response = $request->send(array("seed" => $seed, "hash" => $hash));
     $json = json_decode($response->getBody());
     if (!$json) {
         throw new MOXMAN_Exception("Did not get a proper JSON response from Auth url.");
     }
     if (isset($json->result)) {
         foreach ($json->result as $key => $value) {
             $key = str_replace('_', '.', $key);
             $config->put($key, $value);
         }
         return true;
     } else {
         if (isset($json->error)) {
             throw new MOXMAN_Exception($json->error->message . " - " . $json->error->code);
         } else {
             throw new MOXMAN_Exception("Generic unknown error, did not get a proper JSON response from Auth url.");
         }
     }
 }
开发者ID:GHarutyunyan,项目名称:cms,代码行数:47,代码来源:Plugin.php

示例14: add

 public function add($path)
 {
     $files = MOXMAN_Util_Json::decode(MOXMAN::getUserStorage()->get("uploaded.files", "[]"));
     // If files is larger then max size then crop it
     $max = intval(MOXMAN::getConfig()->get("uploaded.max", 20));
     if (count($files) >= $max) {
         $files = array_slice($files, count($files) - $max);
     }
     // Remove existing paths
     for ($i = 0; $i < count($files); $i++) {
         if ($files[$i]->path == $path) {
             array_splice($files, $i, 1);
         }
     }
     $file = MOXMAN::getFile($path);
     $files[] = array("path" => $file->getPublicPath(), "size" => $file->getSize(), "isdir" => $file->isDirectory(), "mdate" => $file->getLastModified());
     MOXMAN::getUserStorage()->put("uploaded.files", MOXMAN_Util_Json::encode($files));
 }
开发者ID:GHarutyunyan,项目名称:cms,代码行数:18,代码来源:Plugin.php

示例15: execute

 /**
  * Executes the command logic with the specified RPC parameters.
  *
  * @param Object $params Command parameters sent from client.
  * @return Object Result object to be passed back to client.
  */
 public function execute($params)
 {
     $templatePath = MOXMAN_ROOT . '/install/config.template.php';
     if (file_exists($templatePath)) {
         // Get all data
         $license = trim($params->license);
         $authenticator = $params->authenticator;
         $username = $params->username;
         $password = $params->password;
         $loggedInKey = $params->logged_in_key;
         // Verify input
         if (!preg_match('/^([0-9A-Z]{4}\\-){7}[0-9A-Z]{4}$/', $license)) {
             throw new MOXMAN_Exception("Invalid license: " . $license);
         }
         // Update the license since it will later be used by the csrf logic
         MOXMAN::getConfig()->put("general.license", $license);
         if ($authenticator == "BasicAuthenticator") {
             $params->authenticator = "BasicAuthenticator";
             if (!$username) {
                 throw new MOXMAN_Exception("User name can't be empty.");
             }
             if (!$password) {
                 throw new MOXMAN_Exception("Password can't be empty.");
             }
         }
         if ($authenticator == "SessionAuthenticator") {
             $params->authenticator = "SessionAuthenticator";
             if (!$loggedInKey) {
                 throw new MOXMAN_Exception("Session name can't be empty.");
             }
         }
         // Replace template variables
         $template = file_get_contents($templatePath);
         foreach ($params as $key => $value) {
             $template = str_replace('<' . $key . '>', $value, $template);
         }
         if (!is_writable(MOXMAN_ROOT . "/config.php") || !file_put_contents(MOXMAN_ROOT . "/config.php", $template)) {
             return $template;
         }
     } else {
         throw new MOXMAN_Exception("Failed to locate config template.");
     }
     return true;
 }
开发者ID:codekanzlei,项目名称:cake-cktools,代码行数:50,代码来源:InstallCommand.php


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