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


PHP Reg类代码示例

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


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

示例1: Reg

 public function Reg($param)
 {
     //echo 'hello';
     import('SC.Reg.Reg');
     $userReg = new Reg($param);
     $result = $userReg->run();
     echo $result;
 }
开发者ID:iOSDevelopment2016,项目名称:SuperCourseServer,代码行数:8,代码来源:Api.class.php

示例2: 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);
     }
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:39,代码来源:UserAuthorization.class.php

示例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;
     }
 }
开发者ID:Welvin,项目名称:stingle,代码行数:26,代码来源:ConversationAttachmentManager.class.php

示例4: isAuthorized

function isAuthorized()
{
    if (Reg::isRegistered(ConfigManager::getConfig("Users", "Users")->ObjectsIgnored->User)) {
        return true;
    }
    return false;
}
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:helpers.inc.php

示例5: 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);
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:7,代码来源:LoaderGeoIPGps.class.php

示例6: 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);
}
开发者ID:Welvin,项目名称:stingle,代码行数:11,代码来源:modifier.gpsName.php

示例7: 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 "";
}
开发者ID:Welvin,项目名称:stingle,代码行数:13,代码来源:modifier.ipToCountryCode.php

示例8: hookParseURL

 public function hookParseURL()
 {
     // Parse URL rewriting
     if (!defined('IS_CGI')) {
         Reg::get($this->config->Objects->rewriteURL)->parseURL();
     }
 }
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:LoaderRewriteURL.class.php

示例9: 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);
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:7,代码来源:LoaderYubikey.class.php

示例10: hookUserAuthorization

 public function hookUserAuthorization()
 {
     $user = Reg::get($this->config->Objects->UserAuthorization)->getUserFromRequest();
     if (is_a($user, "User")) {
         Reg::register($this->config->ObjectsIgnored->User, $user);
     }
 }
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:LoaderUsers.class.php

示例11: 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)");
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:8,代码来源:DBLogger.class.php

示例12: 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;
}
开发者ID:alexamiryan,项目名称:stingle,代码行数:18,代码来源:modifier.glink.php

示例13: 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);
 }
开发者ID:Welvin,项目名称:stingle,代码行数:13,代码来源:JSON.class.php

示例14: 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);
     }
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:9,代码来源:LoaderSmartyHostTpl.class.php

示例15: 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);
     }
 }
开发者ID:Welvin,项目名称:stingle,代码行数:15,代码来源:ExternalUserManager.class.php


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