本文整理汇总了PHP中ConfigManager::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getConfig方法的具体用法?PHP ConfigManager::getConfig怎么用?PHP ConfigManager::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAuthorized
function isAuthorized()
{
if (Reg::isRegistered(ConfigManager::getConfig("Users", "Users")->ObjectsIgnored->User)) {
return true;
}
return false;
}
示例2: loadYubikeyUserAuthorization
protected function loadYubikeyUserAuthorization()
{
$usersConfig = ConfigManager::getConfig("Users", "Users");
$resultingConfig = ConfigManager::mergeConfigs($usersConfig->AuxConfig, $this->config->AuxConfig);
$yubikeyUserAuthorization = new YubikeyUserAuthorization(Reg::get($usersConfig->Objects->UserManagement), $resultingConfig);
$this->register($yubikeyUserAuthorization);
}
示例3: loadrewriteAliasURL
protected function loadrewriteAliasURL()
{
$rewriteURLconfig = $this->packageManager->getPluginConfig("RewriteURL", "RewriteURL")->AuxConfig;
$hostConfig = ConfigManager::getConfig("Host", "Host");
$this->rewriteAliasURL = new RewriteAliasURL($rewriteURLconfig, $this->aliasMap->getAliasMap(Reg::get($hostConfig->Objects->Host)));
$this->register($this->rewriteAliasURL);
}
示例4: loadGeoIPGps
protected function loadGeoIPGps()
{
$geoIPConfig = ConfigManager::getConfig("GeoIP", "GeoIP");
$gpsConfig = ConfigManager::getConfig("Gps", "Gps");
$geoIpGps = new GeoIPGps(Reg::get($geoIPConfig->Objects->GeoIP), Reg::get($gpsConfig->Objects->Gps));
$this->register($geoIpGps);
}
示例5: decrypt
public static function decrypt($string, $key = null, $salt = null, $iv = null)
{
$config = ConfigManager::getConfig('Crypto', 'AES256')->AuxConfig;
if ($key === null) {
$key = $config->key;
}
if ($salt === null) {
$salt = $config->salt;
}
if ($iv === null) {
$iv = $config->iv;
}
$td = mcrypt_module_open('rijndael-128', '', MCRYPT_MODE_CBC, '');
$ks = mcrypt_enc_get_key_size($td);
$bs = mcrypt_enc_get_block_size($td);
$iv = substr(hash("sha256", $iv), 0, $bs);
// Create key
$key = Crypto::pbkdf2("sha512", $key, $salt, $config->pbkdfRounds, $ks);
// Initialize encryption module for decryption
mcrypt_generic_init($td, $key, $iv);
$decryptedString = "";
// Decrypt encrypted string
try {
if (ctype_xdigit($string)) {
$decryptedString = trim(mdecrypt_generic($td, pack("H*", $string)));
}
} catch (ErrorException $e) {
}
// Terminate decryption handle and close module
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
// Show string
return $decryptedString;
}
示例6: doLogin
/**
* Does login operation
* @param string $username
* @param string $password
* @param bool $writeCookie
* @param bool $isPasswordEncrypted
*
* @throws RuntimeException (Codes: 1 - Incorrect login/password combination, 2 - Account is disabled)
*/
public function doLogin($username, $password, $writeCookie = false, $isPasswordEncrypted = false)
{
if ($this->um->checkCredentials($username, $password, $isPasswordEncrypted)) {
$this->usr = $this->um->getObjectByLogin($username);
$this->authorize($this->usr);
$this->saveUserId($this->usr->getId());
if ($writeCookie) {
$secs = getdate();
$exp_time = $secs[0] + 60 * 60 * 24 * $this->config->rememberDaysCount;
$cookie_value = $this->usr->getId() . ":" . hash('sha256', $username . ":" . md5($password));
setcookie($this->config->loginCookieName, $cookie_value, $exp_time, '/');
}
if (Reg::get('packageMgr')->isPluginLoaded("Security", "RequestLimiter") and $this->config->bruteForceProtectionEnabled) {
$this->query->exec("DELETE FROM `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` WHERE `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
}
} else {
if (Reg::get('packageMgr')->isPluginLoaded("Security", "RequestLimiter") and $this->config->bruteForceProtectionEnabled) {
$this->query->exec("SELECT `count` \n\t\t\t\t\t\t\t\t\t\t\tFROM `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` \n\t\t\t\t\t\t\t\t\t\t\tWHERE `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
$failedAuthCount = $this->query->fetchField('count');
$newFailedAuthCount = $failedAuthCount + 1;
if ($newFailedAuthCount >= $this->config->failedAuthLimit) {
Reg::get(ConfigManager::getConfig("Security", "RequestLimiter")->Objects->RequestLimiter)->blockIP();
$this->query->exec("DELETE FROM `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` WHERE `ip`='" . $_SERVER['REMOTE_ADDR'] . "'");
throw new RequestLimiterTooManyAuthTriesException("Too many unsucessful authorization tries.");
}
$this->query->exec("INSERT INTO `" . Tbl::get('TBL_SECURITY_INVALID_LOGINS_LOG') . "` (`ip`) \n\t\t\t\t\t\t\t\t\t\tVALUES ('" . $_SERVER['REMOTE_ADDR'] . "')\n\t\t\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE `count` = `count` + 1");
}
throw new RuntimeException("Incorrect login/password combination", static::EXCEPTION_INCORRECT_LOGIN_PASSWORD);
}
}
示例7: updateAttachmentMessageId
public function updateAttachmentMessageId($attachmentId, $newMessageId)
{
if (empty($attachmentId) or !is_numeric($attachmentId)) {
throw new InvalidIntegerArgumentException("\$attachmentId have to be non zero integer.");
}
if (empty($newMessageId) or !is_numeric($newMessageId)) {
throw new InvalidIntegerArgumentException("\$newMessageId have to be non zero integer.");
}
$convMgr = Reg::get(ConfigManager::getConfig("Messaging", "Conversations")->Objects->ConversationManager);
$filter = new ConversationMessagesFilter();
$filter->setId($newMessageId);
$message = $convMgr->getConversationMessage($filter);
$qb = new QueryBuilder();
$qb->update(Tbl::get('TBL_CONVERSATION_ATTACHEMENTS'))->set(new Field('message_id'), $message->id)->where($qb->expr()->equal(new Field('id'), $attachmentId));
MySqlDbManager::getDbObject()->startTransaction();
try {
$convMgr->setMessageHasAttachment($message);
$affected = $this->query->exec($qb->getSQL())->affected();
if (!MySqlDbManager::getDbObject()->commit()) {
MySqlDbManager::getDbObject()->rollBack();
}
} catch (Exception $e) {
MySqlDbManager::getDbObject()->rollBack();
throw $e;
}
}
示例8: hookSetTemplateByHost
public function hookSetTemplateByHost()
{
$smarty = Reg::get(ConfigManager::getConfig("Smarty", "Smarty")->Objects->Smarty);
$host = Reg::get(ConfigManager::getConfig("Host", "Host")->Objects->Host);
$templateByHost = SmartyHostTpl::getTemplateByHost($host);
if ($templateByHost !== false) {
$smarty->setTemplate($templateByHost);
}
}
示例9: jsonOutput
/**
* Make Json output and disable Smarty output
* @param array $array
*/
public static function jsonOutput($array)
{
$smartyConfig = ConfigManager::getConfig("Output", "Smarty");
Reg::get($smartyConfig->Objects->Smarty)->disableOutput();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
echo self::jsonEncode($array);
}
示例10: findFreeRandomUsername
/**
* Function get random username
* @param string $prefix is name of current external plugin
* @return string
*/
private static function findFreeRandomUsername($prefix)
{
$um = Reg::get(ConfigManager::getConfig("Users", "Users")->Objects->UserManager);
$possibleUsername = $prefix . "_" . generateRandomString(6);
if (!$um->isLoginExists($possibleUsername, 0)) {
return $possibleUsername;
} else {
return static::findFreeRandomUsername($prefix);
}
}
示例11: __construct
public function __construct()
{
$this->memcacheConfig = ConfigManager::getConfig("Db", "Memcache")->AuxConfig;
if (strpos($this->memcacheConfig->keyPrefix, ":")) {
throw new RuntimeException("Memcache key prefix can't contain colon \":\"!");
}
if ($this->memcacheConfig->enabled) {
$this->memcache = new MemcacheWrapper($this->memcacheConfig->host, $this->memcacheConfig->port);
}
}
示例12: enableMemcache
public function enableMemcache()
{
$this->memcacheConfig = ConfigManager::getConfig("Db", "Memcache")->AuxConfig;
if ($this->memcacheConfig->enabled) {
$memcache = new Memcache();
if ($memcache->pconnect($this->memcacheConfig->host, $this->memcacheConfig->port)) {
Minify::setCache(new Minify_Cache_Memcache($memcache));
}
}
}
示例13: hookClearUserSmartyCache
public function hookClearUserSmartyCache($params)
{
if (isset($params["userId"]) && !empty($params["userId"]) && is_numeric($params["userId"])) {
$memcacheConfig = ConfigManager::getConfig('Db', 'Memcache')->AuxConfig;
if (!empty($memcacheConfig) and $memcacheConfig->enabled == true) {
$memcached = new MemcacheWrapper($memcacheConfig->host, $memcacheConfig->port);
$memcached->invalidateCacheByTag("smrt:u" . $params["userId"]);
}
}
}
示例14: getTextAliasObjectFromData
protected function getTextAliasObjectFromData($data, $cacheMinutes = null)
{
$textAlias = new TextAlias();
$hostLanguagePair = HostLanguageManager::getHostLanguagePair($data['host_language'], $cacheMinutes);
$textAlias->id = $data['id'];
$textAlias->textValue = Reg::get(ConfigManager::getConfig("Texts")->Objects->TextsValuesManager)->getTextValueById($data['value_id'], $cacheMinutes);
$textAlias->language = $hostLanguagePair['language'];
$textAlias->host = $hostLanguagePair['host'];
$textAlias->hostLanguageId = $data['host_language'];
return $textAlias;
}
示例15: __construct
/**
* Class constructor
*
* @param MySqlDatabase db
* @param Logger $logger
* @param bool $memcahe_on
*
*/
public function __construct(MySqlDatabase $db, Logger $logger = null)
{
parent::__construct($db, $logger);
$this->memcacheConfig = ConfigManager::getConfig("Db", "Memcache")->AuxConfig;
if (strpos($this->memcacheConfig->keyPrefix, ":")) {
throw new RuntimeException("Memcache key prefix can't contain colon \":\"!");
}
if ($this->memcacheConfig->enabled) {
$this->memcache = new MemcacheWrapper($this->memcacheConfig->host, $this->memcacheConfig->port);
}
}