• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Reg类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


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


示例18: blackListCountry

 /**
  * Blacklist given country
  * 
  * @param string $countryCode
  * @throws InvalidArgumentException
  * @throws RuntimeException
  */
 public function blackListCountry($countryCode)
 {
     if (!Reg::get(ConfigManager::getConfig('GeoIP', 'GeoIP')->Objects->GeoIP)->isValidCountryCode($countryCode)) {
         throw new InvalidArgumentException("Invalid country code specified for blacklisting");
     }
     $this->query->exec("SELECT count(*) as `count` FROM `" . Tbl::get('TBL_SECURITY_BLACKLISTED_COUNTRIES', 'IpFilter') . "`\n\t\t\t\t\t\t\t\tWHERE `country`='{$countryCode}'");
     if ($this->query->fetchField('count') != 0) {
         throw new RuntimeException("Sorry, this country already blacklisted!");
     }
     $this->query->exec("INSERT INTO `" . Tbl::get('TBL_SECURITY_BLACKLISTED_COUNTRIES', 'IpFilter') . "` \n\t\t\t\t\t\t\t\t(`country`) VALUES ('{$countryCode}') ");
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:18,代码来源:IpFilterManager.class.php


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


示例20: redirectController

/**
 * Call other controller with given URI.
 * Can be used to call different controller using some logic.
 * WARNING! All GET parameters are being lost upon redirection. 
 * 
 * @param string $uri
 */
function redirectController($uri)
{
    $_SERVER['REQUEST_URI'] = SITE_PATH . $uri;
    $_GET = array();
    if (Reg::get('packageMgr')->isPluginLoaded("RewriteURL", "RewriteURL")) {
        Reg::get(ConfigManager::getConfig("RewriteURL", "RewriteURL")->Objects->rewriteURL)->parseURL();
    }
    $newNav = Reg::get(ConfigManager::getConfig("SiteNavigation", "SiteNavigation")->Objects->RequestParser)->parse();
    Reg::register(ConfigManager::getConfig("SiteNavigation", "SiteNavigation")->ObjectsIgnored->Nav, $newNav, true);
    Reg::get(ConfigManager::getConfig("SiteNavigation", "SiteNavigation")->Objects->Controller)->exec();
}
开发者ID:Welvin,项目名称:stingle,代码行数:18,代码来源:helpers.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Regex类代码示例发布时间:2022-05-23
下一篇:
PHP Reflector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap