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

Classes

  • cApiAction
  • cApiActionCollection
  • cApiActionlog
  • cApiActionlogCollection
  • cApiArea
  • cApiAreaCollection
  • cApiArticle
  • cApiArticleCollection
  • cApiArticleLanguage
  • cApiArticleLanguageCollection
  • cApiArticleLanguageVersion
  • cApiArticleLanguageVersionCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • cApiContentVersion
  • cApiContentVersionCollection
  • cApiDbfs
  • cApiDbfsCollection
  • cApiFile
  • cApiFileCollection
  • cApiFileInformation
  • cApiFileInformationCollection
  • cApiFrameFile
  • cApiFrameFileCollection
  • cApiFrontendGroup
  • cApiFrontendGroupCollection
  • cApiFrontendGroupMember
  • cApiFrontendGroupMemberCollection
  • cApiFrontendPermission
  • cApiFrontendPermissionCollection
  • cApiFrontendUser
  • cApiFrontendUserCollection
  • cApiGroup
  • cApiGroupCollection
  • cApiGroupMember
  • cApiGroupMemberCollection
  • cApiGroupProperty
  • cApiGroupPropertyCollection
  • cApiInUse
  • cApiInUseCollection
  • cApiIso3166
  • cApiIso3166Collection
  • cApiIso6392
  • cApiIso6392Collection
  • cApiKeyword
  • cApiKeywordCollection
  • cApiLanguage
  • cApiLanguageCollection
  • cApiLayout
  • cApiLayoutCollection
  • cApiMailLog
  • cApiMailLogCollection
  • cApiMailLogSuccess
  • cApiMailLogSuccessCollection
  • cApiMetaTag
  • cApiMetaTagCollection
  • cApiMetaTagVersion
  • cApiMetaTagVersionCollection
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiSearchTracking
  • cApiSearchTrackingCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserPasswordRequest
  • cApiUserPasswordRequestCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the system property collection and item class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GenericDB_Model
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: /**
 17:  * User password request collection
 18:  *
 19:  * @package Core
 20:  * @subpackage GenericDB_Model
 21:  */
 22: class cApiUserPasswordRequestCollection extends ItemCollection {
 23: 
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      *
 27:      * @global array $cfg
 28:      * @param string|bool $where [optional]
 29:      *         The where clause in the select, usable to run select by creating
 30:      *         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 string|array $data [optional]
 45:      *         optional parameter for direct input of primary key value
 46:      *         (string) or multiple column name - value pairs
 47:      * @return cApiUserPasswordRequest
 48:      */
 49:     public function createNewItem($data = NULL) {
 50:         $item = parent::createNewItem($data);
 51: 
 52:         // check configuration setting for different password expiration
 53:         // value must be valid string for DateTime's time variable in its constructor
 54:         if (false === ($expiration = getEffectiveSetting('pw_request', 'user_password_reset_expiration'))
 55:         || 0 === strlen($expiration)) {
 56:             $expiration = '+4 hour';
 57:         }
 58:         $time = new DateTime('+' . $expiration, new DateTimeZone('UTC'));
 59:         $item->set('expiration', $this->escape($time->format('Y-m-d H:i:s')));
 60: 
 61:         return $item;
 62:     }
 63: 
 64:     /**
 65:      * Removes the specified entries from the database by user's id.
 66:      *
 67:      * @param int $userid
 68:      *         Specifies the user id
 69:      * @return bool
 70:      *         True if the delete was successful
 71:      */
 72:     public function deleteByUserId($userid) {
 73:         $result = $this->deleteBy('user_id', $userid);
 74:         return ($result > 0) ? true : false;
 75:     }
 76: 
 77:     /**
 78:      * Removes the specified entries from the database by token.
 79:      *
 80:      * @param int $userid
 81:      *         Specifies the user id
 82:      * @return bool
 83:      *         True if the delete was successful
 84:      */
 85:     public function deleteByToken($token) {
 86:         $result = $this->deleteBy('validation_token', $token);
 87:         return ($result > 0) ? true : false;
 88:     }
 89: 
 90:     /**
 91:      * Returns all password requests available in the system
 92:      *
 93:      * @param string $userid [optional]
 94:      *         search for a specific user id
 95:      * @param string $orderBy [optional]
 96:      *         SQL order by part
 97:      * @return array
 98:      */
 99:     public function fetchAvailableRequests($userid = false, $orderBy = 'id_pwreq ASC') {
100:         $requests = array();
101: 
102:         if (false === $userid) {
103:             $this->select('', '', $this->escape($orderBy));
104:         } else {
105:             $this->select('user_id = \'' . $this->escape($userid) . '\'', '', $this->escape($orderBy));
106:         }
107:         while (($oItem = $this->next()) !== false) {
108:             $requests[] = clone $oItem;
109:         }
110: 
111:         return $requests;
112:     }
113: 
114:     /**
115:      * Returns all non expired password requests
116:      *
117:      * @param string $userid [optional]
118:      *         search for a specific user id
119:      * @return array
120:      */
121:     public function fetchCurrentRequests($userid = false) {
122:         $requests = array();
123: 
124:         $now = new DateTime('now', new DateTimeZone('UTC'));
125:         $this->select('expiration > \'' . $this->escape($now->format('Y-m-d H:i:s')) . '\'');
126:         while (($oItem = $this->next()) !== false) {
127:             if (false === $userid) {
128:                 $requests[] = clone $oItem;
129:             } elseif ($oItem->get('user_id') === $userid) {
130:                 $requests[] = clone $oItem;
131:             }
132:         }
133: 
134:         return $requests;
135:     }
136: }
137: 
138: /**
139:  * User password request item
140:  *
141:  * @package Core
142:  * @subpackage GenericDB_Model
143:  */
144: class cApiUserPasswordRequest extends Item {
145: 
146:     /**
147:      * Constructor to create an instance of this class.
148:      *
149:      * @param mixed $mId [optional]
150:      *         Specifies the ID of item to load
151:      */
152:     public function __construct($mId = false) {
153:         global $cfg;
154:         parent::__construct($cfg['tab']['user_pw_request'], 'id_pwreq');
155:         $this->setFilters(array(), array());
156:         if ($mId !== false) {
157:             $this->loadByPrimaryKey($mId);
158:         }
159:     }
160: }
161: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0