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

PHP Tbl类代码示例

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

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



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

示例1: customInitBeforeObjects

 protected function customInitBeforeObjects()
 {
     Tbl::registerTableNames('TextsGroupManager');
     Tbl::registerTableNames('TextsManager');
     Tbl::registerTableNames('TextsValuesManager');
     Tbl::registerTableNames('TextsAliasManager');
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:7,代码来源:LoaderTexts.class.php


示例2: checkCredentials

 /**
  * Check validity of username, password and other auth factors
  * 
  * @param string $username
  * @param string $password
  * @param array $additionalCredentials
  * @param boolean $writeCookie
  * @throws UserAuthFailedException
  * @return User
  */
 public function checkCredentials($username, $password, $additionalCredentials = array(), $writeCookie = false)
 {
     $qb = new QueryBuilder();
     $qb->select(new Field('id'), new Field('password'), new Field('salt'))->from(Tbl::get('TBL_USERS', 'UserManager'))->where($qb->expr()->equal(new Field('login'), $username));
     $this->query->exec($qb->getSQL());
     if ($this->query->countRecords() == 1) {
         $userData = $this->query->fetchRecord();
         $hashToCheck = static::getUserPasswordHash($password, $userData['salt']);
         if ($userData['password'] === $hashToCheck) {
             $usr = $this->doLogin($userData['id'], $additionalCredentials, $writeCookie);
             try {
                 $hookParams = array("user" => $usr, "additionalCredentials" => $additionalCredentials);
                 HookManager::callHook("UserAuthSuccess", $hookParams);
             } catch (UserAuthFailedException $e) {
                 $this->doLogout();
                 throw $e;
             }
             return $usr;
         }
     }
     // Failed login nothing returned from above code
     $hookParams = array("username" => $username, "password" => $password, "additionalCredentials" => $additionalCredentials);
     HookManager::callHook("UserAuthFail", $hookParams);
     throw new UserAuthFailedException("Incorrect login/password combination");
 }
开发者ID:Welvin,项目名称:stingle,代码行数:35,代码来源:UserAuthorization.class.php


示例3: queryString

 protected static function queryString($lang_id = null, $host_id = null, $module = null, $page = null, $cacheMinutes = null)
 {
     $qb = new QueryBuilder();
     $qb->select(new Field('title'), new Field('meta_keywords'), new Field('meta_description'))->from(Tbl::get('TBL_PAGE_INFO'));
     if ($lang_id === null) {
         $qb->andWhere($qb->expr()->isNull(new Field('lang_id')));
     } else {
         $qb->andWhere($qb->expr()->equal(new Field('lang_id'), $lang_id));
     }
     if ($host_id === null) {
         $qb->andWhere($qb->expr()->isNull(new Field('host_id')));
     } else {
         $qb->andWhere($qb->expr()->equal(new Field('host_id'), $host_id));
     }
     if ($module === null) {
         $qb->andWhere($qb->expr()->isNull(new Field('module')));
     } else {
         $qb->andWhere($qb->expr()->equal(new Field('module'), $module));
     }
     if ($page === null) {
         $qb->andWhere($qb->expr()->isNull(new Field('page')));
     } else {
         $qb->andWhere($qb->expr()->equal(new Field('page'), $page));
     }
     return $qb->getSQL();
 }
开发者ID:Welvin,项目名称:stingle,代码行数:26,代码来源:PageInfo.class.php


示例4: 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


示例5: getLastId

 public function getLastId()
 {
     $qb = new QueryBuilder();
     $qb->select($qb->expr()->max(new Field('id'), 'lastId'))->from(Tbl::get('TBL_CHAT_MESSAGES'));
     $lastId = $this->query->exec($qb->getSQL())->fetchField('lastId');
     return empty($lastId) ? 0 : $lastId;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:ChatMessageManager.class.php


示例6: unblockIP

 /**
  * Unblock blocked IP
  * @param string $ip
  */
 public function unblockIP($ip = null)
 {
     if ($ip === null) {
         $ip = $_SERVER['REMOTE_ADDR'];
     }
     $this->query->exec("DELETE FROM `" . Tbl::get('TBL_SECURITY_FLOODER_IPS') . "` WHERE `ip` = '{$ip}'");
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:11,代码来源:RequestLimiter.class.php


示例7: 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


示例8: fillUsersGps

 public function fillUsersGps($userId, $leafId)
 {
     $this->query->exec("delete from `" . Tbl::get('TBL_USERS_GPS') . "` where `user_id`='{$userId}'");
     $gpsTree = $this->getNodeTree($leafId);
     foreach ($gpsTree as $treeNode) {
         $this->query->exec("INSERT INTO `" . Tbl::get('TBL_USERS_GPS') . "` (`user_id`,`node_id`) VALUES('{$userId}','{$treeNode["node_id"]}')");
     }
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:8,代码来源:UsersGps.class.php


示例9: isValidCountryCode

 /**
  * Check if given country code is valid
  * 
  * @param string $countryCode
  * @param int $cacheMinutes
  */
 public function isValidCountryCode($countryCode = null, $cacheMinutes = null)
 {
     $this->query->exec("SELECT count(*) as `count` FROM " . Tbl::get('TBL_LOCATIONS') . "\n\t\t\t\t\t\t\t\tWHERE `country`='{$countryCode}'", $cacheMinutes);
     $count = $this->query->fetchField('count');
     if ($count > 0) {
         return true;
     }
     return false;
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:15,代码来源:GeoIP.class.php


示例10: queryString

 protected static function queryString($lang_id = null, $host_id = null, $module = null, $page = null)
 {
     $lang_where = "lang_id " . ($lang_id === null ? "IS NULL " : "=" . $lang_id);
     $host_where = "host_id " . ($host_id === null ? "IS NULL " : "=" . $host_id);
     $module_where = "module " . ($module === null ? "IS NULL " : "='" . $module . "'");
     $page_where = "page " . ($page === null ? "IS NULL " : "='" . $page . "'");
     $query = "SELECT `title`,\t`meta_keywords`, `meta_description` FROM `" . Tbl::get('TBL_PAGE_INFO') . "` \n\t\t\t\t\tWHERE  " . $lang_where . "\n\t\t\t\t\tAND " . $host_where . "\n\t\t\t\t\tAND " . $module_where . "\n\t\t\t\t\tAND " . $page_where;
     return $query;
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:9,代码来源:PageInfo.class.php


示例11: 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


示例12: __construct

 public function __construct($headersOnly = true)
 {
     parent::__construct();
     if ($headersOnly) {
         $this->qb->select(new Field("*"));
     } else {
         $this->qb->select(array(new Field('id', 'main'), new Field('subject', 'main'), new Field('date', 'main'), new Field('sender', 'extra'), new Field('read', 'extra'), new Field('trashed', 'extra'), new Field('deleted', 'extra')));
     }
     $this->qb->from(Tbl::get('TBL_MESSAGES', 'MessageManagement'), "main")->leftJoin(Tbl::get('TBL_EXTRA', 'MessageManagement'), "extra", $this->qb->expr()->equal(new Field('id', 'main'), new Field('message_id', 'extra')));
 }
开发者ID:Welvin,项目名称:stingle,代码行数:10,代码来源:MessageFilter.class.php


示例13: deleteGroup

 public function deleteGroup(TextsGroup $group)
 {
     if (empty($group->id)) {
         throw new InvalidArgumentException("Group ID have to be specified");
     }
     if (!is_numeric($group->id)) {
         throw new InvalidArgumentException("Group ID have to be integer");
     }
     $this->query->exec("DELETE FROM `" . Tbl::get('TBL_TEXTS_GROUPS') . "` WHERE `id`='{$group->id}'");
     return $this->query->affected();
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:11,代码来源:TextsGroupManager.class.php


示例14: deleteAllAliasesForTextValue

 public function deleteAllAliasesForTextValue(TextValue $textValue)
 {
     if (empty($textValue->id)) {
         throw new InvalidArgumentException("Text Value ID have to be specified");
     }
     if (!is_numeric($textValue->id)) {
         throw new InvalidArgumentException("Text Value ID have to be integer");
     }
     $this->query->exec("DELETE FROM `" . Tbl::get('TBL_TEXTS_ALIASES') . "` WHERE `value_id`='{$textValue->id}'");
     return $this->query->affected();
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:11,代码来源:TextsAliasManager.class.php


示例15: isValidCountryCode

 /**
  * Check if given country code is valid
  * 
  * @param string $countryCode
  * @param int $cacheMinutes
  */
 public function isValidCountryCode($countryCode = null, $cacheMinutes = null)
 {
     $qb = new QueryBuilder();
     $qb->select($qb->expr()->count("*", "count"))->from(Tbl::get('TBL_LOCATIONS'))->where($qb->expr(new Field('country'), $countryCode));
     $this->query->exec($qb->getSQL(), $cacheMinutes);
     $count = $this->query->fetchField('count');
     if ($count > 0) {
         return true;
     }
     return false;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:17,代码来源:GeoIP.class.php


示例16: getAllLanguages

 public static function getAllLanguages($cacheMinutes = null)
 {
     $languages = array();
     $sql = MySqlDbManager::getQueryObject();
     $sql->exec("SELECT * FROM `" . Tbl::get('TBL_LANGUAGES') . "`", $cacheMinutes);
     while (($lang_data = $sql->fetchRecord()) != false) {
         $l = new Language();
         static::setData($lang_data, $l);
         $languages[] = $l;
     }
     return $languages;
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:12,代码来源:Language.class.php


示例17: getAllHosts

 /**
  * Get all hosts
  *@return array Set of Host objects
  */
 public static function getAllHosts($cacheMinutes = null)
 {
     $hosts = array();
     $sql = MySqlDbManager::getQueryObject();
     $sql->exec("SELECT * FROM `" . Tbl::get('TBL_HOSTS', 'Host') . "`", $cacheMinutes);
     while (($host_data = $sql->fetchRecord()) != false) {
         $h = new Host();
         Host::setData($host_data, $h);
         $hosts[] = $h;
     }
     return $hosts;
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:16,代码来源:HostManager.class.php


示例18: setControllerTemplateByHost

 public static function setControllerTemplateByHost(Host $host, $controller, $template)
 {
     $sql = MySqlDbManager::getQueryObject();
     $qb = new QueryBuilder();
     if (!empty($controller) or !empty($template)) {
         $qb->insert(Tbl::get('TBL_HOST_CONTROLLER_TEMPLATE'))->values(array('host_id' => $host->id, 'controller' => $controller, 'template' => $template))->onDuplicateKeyUpdate()->set(new Field('controller'), $controller)->set(new Field('template'), $template);
     } else {
         $qb->delete(Tbl::get('TBL_HOST_CONTROLLER_TEMPLATE'))->where($qb->expr()->equal(new Field('host_id'), $host->id));
     }
     $sql->exec($qb->getSQL());
     return $sql->affected();
 }
开发者ID:Welvin,项目名称:stingle,代码行数:12,代码来源:HostControllerTemplate.class.php


示例19: fillUsersGps

 public function fillUsersGps($userId, $leafId)
 {
     $qb = new QueryBuilder();
     $qb->delete(Tbl::get('TBL_USERS_GPS'))->where($qb->expr()->equal(new Field('user_id'), $userId));
     $this->query->exec($qb->getSQL());
     $gpsTree = $this->getNodeTree($leafId);
     foreach ($gpsTree as $treeNode) {
         $qb = new QueryBuilder();
         $qb->insert(Tbl::get('TBL_USERS_GPS'))->values(array('user_id' => $userId, 'node_id' => $treeNode["node_id"]));
         $this->query->exec($qb->getSQL());
     }
 }
开发者ID:Welvin,项目名称:stingle,代码行数:12,代码来源:UsersGps.class.php


示例20: logRequest

 public static function logRequest($dbInstanceKey = null)
 {
     $sql = MySqlDbManager::getQueryObject($dbInstanceKey);
     $userId = "NULL";
     $userObjectSerialized = "''";
     $userObj = Reg::get(ConfigManager::getConfig("Users", "Users")->ObjectsIgnored->User);
     if ($userObj->isAuthorized()) {
         $userId = $userObj->getId();
         $userObjectSerialized = "'" . mysql_real_escape_string(serialize($userObj)) . "'";
     }
     $sql->exec("INSERT DELAYED INTO `" . Tbl::get("TBL_REQUEST_LOG") . "` \n\t\t\t\t\t\t(`user_id`, `user_obj`,`session_id`, `get`, `post`, `server`, `cookies`, `session`, `response`)\n\t\t\t\t\t\tVALUES\t(\n\t\t\t\t\t\t\t\t\t{$userId},\n\t\t\t\t\t\t\t\t\t{$userObjectSerialized},\n\t\t\t\t\t\t\t\t\t'" . session_id() . "',\n\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string(serialize($_GET)) . "',\n\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string(serialize($_POST)) . "',\n\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string(serialize($_SERVER)) . "',\n\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string(serialize($_COOKIE)) . "',\n\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string(serialize($_SESSION)) . "',\n\t\t\t\t\t\t\t\t\t'" . mysql_real_escape_string(ob_get_contents()) . "'\n\t\t\t\t\t\t\t\t)");
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:12,代码来源:RequestLoggerUsers.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Teacher类代码示例发布时间:2022-05-23
下一篇:
PHP TbHtml类代码示例发布时间: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