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


PHP rex_sql::datetime方法代码示例

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


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

示例1: save

 protected function save()
 {
     $nexttime = $this->getElement($this->mainFieldset, 'nexttime');
     $timestamp = rex_cronjob_manager_sql::calculateNextTime($this->intervalField->getValue());
     $nexttime->setValue($timestamp ? rex_sql::datetime($timestamp) : null);
     $return = parent::save();
     rex_cronjob_manager_sql::factory()->saveNextTime();
     return $return;
 }
开发者ID:DECAF,项目名称:redaxo,代码行数:9,代码来源:form.php

示例2: save

 protected function save()
 {
     if ($this->isEditMode()) {
         $nexttime = $this->getElement($this->mainFieldset, 'nexttime');
         if (strtotime($nexttime->getValue()) > 0) {
             $interval = $this->getElement($this->mainFieldset, 'interval');
             $nexttime->setValue(rex_sql::datetime(rex_cronjob_manager_sql::calculateNextTime($interval->getValue())));
         }
     }
     $return = parent::save();
     rex_cronjob_manager_sql::factory()->saveNextTime();
     return $return;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:13,代码来源:form.php

示例3: checkLogin

 public function checkLogin()
 {
     $sql = rex_sql::factory();
     $userId = $this->getSessionVar('UID');
     $cookiename = 'rex_user_' . sha1(rex::getProperty('instname'));
     if ($cookiekey = rex_cookie($cookiename, 'string')) {
         if (!$userId) {
             $sql->setQuery('SELECT id FROM ' . rex::getTable('user') . ' WHERE cookiekey = ? LIMIT 1', [$cookiekey]);
             if ($sql->getRows() == 1) {
                 $this->setSessionVar('UID', $sql->getValue('id'));
                 setcookie($cookiename, $cookiekey, time() + 60 * 60 * 24 * 365);
             } else {
                 setcookie($cookiename, '', time() - 3600);
             }
         }
         $this->setSessionVar('STAMP', time());
     }
     $check = parent::checkLogin();
     if ($check) {
         // gelungenen versuch speichern | login_tries = 0
         if ($this->userLogin != '' || !$userId) {
             $this->regenerateSessionId();
             $params = [];
             $add = '';
             if ($this->stayLoggedIn || $cookiekey) {
                 $cookiekey = sha1($this->systemId . time() . $this->userLogin);
                 $add = 'cookiekey = ?, ';
                 $params[] = $cookiekey;
                 setcookie($cookiename, $cookiekey, time() + 60 * 60 * 24 * 365);
             }
             if (self::passwordNeedsRehash($this->user->getValue('password'))) {
                 $add .= 'password = ?, ';
                 $params[] = self::passwordHash($this->userPassword, true);
             }
             array_push($params, rex_sql::datetime(), session_id(), $this->userLogin);
             $sql->setQuery('UPDATE ' . $this->tableName . ' SET ' . $add . 'login_tries=0, lasttrydate=?, session_id=? WHERE login=? LIMIT 1', $params);
         }
         $this->user = new rex_user($this->user);
     } else {
         // fehlversuch speichern | login_tries++
         if ($this->userLogin != '') {
             $sql->setQuery('SELECT login_tries FROM ' . $this->tableName . ' WHERE login=? LIMIT 1', [$this->userLogin]);
             if ($sql->getRows() > 0) {
                 $login_tries = $sql->getValue('login_tries');
                 $sql->setQuery('UPDATE ' . $this->tableName . ' SET login_tries=login_tries+1,session_id="",cookiekey="",lasttrydate=? WHERE login=? LIMIT 1', [rex_sql::datetime(), $this->userLogin]);
                 if ($login_tries >= self::LOGIN_TRIES_1 - 1) {
                     $time = $login_tries < self::LOGIN_TRIES_2 ? self::RELOGIN_DELAY_1 : self::RELOGIN_DELAY_2;
                     $hours = floor($time / 3600);
                     $mins = floor(($time - $hours * 3600) / 60);
                     $secs = $time % 60;
                     $formatted = ($hours ? $hours . 'h ' : '') . ($hours || $mins ? $mins . 'min ' : '') . $secs . 's';
                     $this->message .= ' ' . rex_i18n::msg('login_wait', '<strong data-time="' . $time . '">' . $formatted . '</strong>');
                 }
             }
         }
     }
     if ($this->isLoggedOut() && $userId != '') {
         $sql->setQuery('UPDATE ' . $this->tableName . ' SET session_id="", cookiekey="" WHERE id=? LIMIT 1', [$userId]);
         setcookie($cookiename, '', time() - 3600);
     }
     return $check;
 }
开发者ID:skerbis,项目名称:redaxo,代码行数:62,代码来源:backend_login.php

示例4: setNextTime

 public function setNextTime($id, $interval, $resetExecutionStart = false)
 {
     $nexttime = self::calculateNextTime($interval);
     $add = $resetExecutionStart ? ', execution_start = 0' : '';
     try {
         $this->sql->setQuery('
             UPDATE  ' . REX_CRONJOB_TABLE . '
             SET     nexttime = ?' . $add . '
             WHERE   id = ?
         ', [rex_sql::datetime($nexttime), $id]);
         $success = true;
     } catch (rex_sql_exception $e) {
         $success = false;
     }
     $this->saveNextTime();
     return $success;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:17,代码来源:manager_sql.php


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