Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the system property collection and item class.
  4:  *
  5:  * @package Core
  6:  * @subpackage GenericDB_Model
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * User password request collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiUserPasswordRequestCollection extends ItemCollection {
 24: 
 25:     /**
 26:      * Constructor function.
 27:      *
 28:      * @global array $cfg
 29:      * @param string|bool $where The where clause in the select, usable to run
 30:      *        select by creating the instance
 31:      */
 32:     public function __construct($where = false) {
 33:         global $cfg;
 34:         parent::__construct($cfg['tab']['user_pw_request'], 'id_pwreq');
 35:         $this->_setItemClass('cApiUserPasswordRequest');
 36:         if ($where !== false) {
 37:             $this->select($where);
 38:         }
 39:     }
 40: 
 41:     /**
 42:      * Create a user password request by user id.
 43:      *
 44:      * @param int $userid
 45:      * @return cApiUserPasswordRequest false
 46:      */
 47:     public function createNewItem($data = NULL) {
 48:         $item = parent::createNewItem($data);
 49: 
 50:         // check configuration setting for different password expiration
 51:         // value must be valid string for DateTime's time variable in its constructor
 52:         if (false === ($expiration = getEffectiveSetting('pw_request', 'user_password_reset_expiration'))
 53:         || 0 === strlen($expiration)) {
 54:             $expiration = '+4 hour';
 55:         }
 56:         $time = new DateTime('+' . $expiration, new DateTimeZone('UTC'));
 57:         $item->set('expiration', $this->escape($time->format('Y-m-d H:i:s')));
 58: 
 59:         return $item;
 60:     }
 61: 
 62:     /**
 63:      * Removes the specified entries from the database by user's id.
 64:      *
 65:      * @param int $userid Specifies the user id
 66:      * @return bool True if the delete was successful
 67:      */
 68:     public function deleteByUserId($userid) {
 69:         $result = $this->deleteBy('user_id', $userid);
 70:         return ($result > 0) ? true : false;
 71:     }
 72: 
 73:     /**
 74:      * Removes the specified entries from the database by token.
 75:      *
 76:      * @param int $userid Specifies the user id
 77:      * @return bool True if the delete was successful
 78:      */
 79:     public function deleteByToken($token) {
 80:         $result = $this->deleteBy('validation_token', $token);
 81:         return ($result > 0) ? true : false;
 82:     }
 83: 
 84:     /**
 85:      * Returns all password requests available in the system
 86:      *
 87:      * @param string $userid search for a specific user id
 88:      * @param string $orderBy SQL order by part
 89:      * @return cApiUser[]
 90:      */
 91:     public function fetchAvailableRequests($userid = false, $orderBy = 'id_pwreq ASC') {
 92:         $requests = array();
 93: 
 94:         if (false === $userid) {
 95:             $this->select('', '', $this->escape($orderBy));
 96:         } else {
 97:             $this->select('user_id = \'' . $this->escape($userid) . '\'', '', $this->escape($orderBy));
 98:         }
 99:         while (($oItem = $this->next()) !== false) {
100:             $requests[] = clone $oItem;
101:         }
102: 
103:         return $requests;
104:     }
105: 
106:     /**
107:      * Returns all non expired password requests
108:      * @param string $userid search for a specific user id
109:      * @return cApiUser[]
110:      */
111:     public function fetchCurrentRequests($userid = false) {
112:         $requests = array();
113:         
114:         $now = new DateTime('now', new DateTimeZone('UTC'));
115:         $this->select('expiration > \'' . $this->escape($now->format('Y-m-d H:i:s')) . '\'');
116:         while (($oItem = $this->next()) !== false) {
117:             if (false === $userid) {
118:                 $requests[] = clone $oItem;
119:             } elseif ($oItem->get('user_id') === $userid) {
120:                 $requests[] = clone $oItem;
121:             }
122:         }
123:         
124:         return $requests;
125:     }
126: }
127: 
128: /**
129:  * User password request item
130:  *
131:  * @package Core
132:  * @subpackage GenericDB_Model
133:  */
134: class cApiUserPasswordRequest extends Item {
135:     /**
136:      * Constructor function
137:      *
138:      * @param mixed $mId Specifies the ID of item to load
139:      */
140:     public function __construct($mId = false) {
141:         global $cfg;
142:         parent::__construct($cfg['tab']['user_pw_request'], 'id_pwreq');
143:         $this->setFilters(array(), array());
144:         if ($mId !== false) {
145:             $this->loadByPrimaryKey($mId);
146:         }
147:     }
148: }
149: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen