本文整理汇总了PHP中Reg::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Reg::get方法的具体用法?PHP Reg::get怎么用?PHP Reg::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reg
的用法示例。
在下文中一共展示了Reg::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: smarty_modifier_gpsName
/**
* @param string $gpsId
* @return string
*/
function smarty_modifier_gpsName($gpsId)
{
if (empty($gpsId) or !is_numeric($gpsId)) {
return null;
}
return Reg::get('gps')->getNodeName($gpsId);
}
示例3: 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;
}
}
示例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: smarty_modifier_ipToCountryCode
/**
* Get Country code from IP
*
* @param string $ip
* @return string
*/
function smarty_modifier_ipToCountryCode($ip)
{
if (!empty($ip)) {
return Reg::get('geoIp')->getCountryCode($ip, -1);
}
return "";
}
示例6: hookParseURL
public function hookParseURL()
{
// Parse URL rewriting
if (!defined('IS_CGI')) {
Reg::get($this->config->Objects->rewriteURL)->parseURL();
}
}
示例7: 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);
}
}
示例8: hookUserAuthorization
public function hookUserAuthorization()
{
$user = Reg::get($this->config->Objects->UserAuthorization)->getUserFromRequest();
if (is_a($user, "User")) {
Reg::register($this->config->ObjectsIgnored->User, $user);
}
}
示例9: logCustom
public static function logCustom($name, $value)
{
$remoteIP = "";
if (isset($_SERVER['REMOTE_ADDR'])) {
$remoteIP = $_SERVER['REMOTE_ADDR'];
}
Reg::get('sql')->exec("INSERT DELAYED INTO `" . Tbl::get("TBL_MIXED_LOG") . "` \n\t\t\t\t\t\t\t\t\t\t(`session_id`,`name`,`value`,`ip`)\n\t\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . session_id() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($name) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string($value) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'{$remoteIP}'\n\t\t\t\t\t\t\t\t\t\t\t\t)");
}
示例10: smarty_modifier_glink
/**
* Make link string from given formatted string.
* If OUTPUT_LINK_STYLE is
*
* @param string $string
* @param boolean $with_gets $_GET parametrs to the end
* @param string $exclude param from $_GET. (should be coma separated)
* @return string
*/
function smarty_modifier_glink($link, $with_gets = false, $exclude = '')
{
$exclude = explode(",", $exclude);
if ($with_gets) {
$link = RewriteURL::ensureSourceLastDelimiter($link) . get_all_get_params($exclude);
}
$link = Reg::get('rewriteURL')->glink($link);
return $link;
}
示例11: 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);
}
示例12: 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);
}
}
示例13: 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);
}
}
示例14: logCustom
public static function logCustom($name, $value)
{
$remoteIP = "";
if (isset($_SERVER['REMOTE_ADDR'])) {
$remoteIP = $_SERVER['REMOTE_ADDR'];
}
$qb = new QueryBuilder();
$qb->insert(Tbl::get('TBL_MIXED_LOG'))->values(array("session_id" => session_id(), "name" => $name, "value" => $value, "ip" => $remoteIP));
Reg::get('sql')->exec($qb->getSQL());
}
示例15: smarty_modifier_glink
/**
* Make link string from given formatted string.
* If OUTPUT_LINK_STYLE is
*
* @param string $string
* @param boolean $with_gets $_GET parametrs to the end
* @param string $exclude param from $_GET. (should be coma separated)
* @return string
*/
function smarty_modifier_glink($link, $with_gets = false, $exclude = '')
{
$exclude = explode(",", $exclude);
if ($with_gets) {
RewriteURL::ensureLastSlash($link);
$link .= getAllGetParams($exclude);
}
$link = Reg::get('rewriteURL')->glink($link);
return $link;
}