Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • 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
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • 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
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the file information collection and item class.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       GenericDB_Model
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Konstantinos Katikakis
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: cInclude('includes', 'functions.file.php');
 19: 
 20: /**
 21:  * File information collection.
 22:  *
 23:  * @package          Core
 24:  * @subpackage       GenericDB_Model
 25:  */
 26: class cApiFileInformationCollection extends ItemCollection {
 27: 
 28:     public function __construct() {
 29:         global $cfg;
 30:         parent::__construct($cfg['tab']['file_information'], 'idsfi');
 31:         $this->_setItemClass('cApiFileInformation');
 32:     }
 33: 
 34:     /**
 35:      * Creates a new entry in the database
 36:      *
 37:      * @param $typeContent type of the entry
 38:      * @param $filename name of the file
 39:      * @param $description an optional description
 40:      * @return cApiFileInformation the new item
 41:      */
 42:     public function create($typeContent, $filename, $description = '') {
 43:         $client = cRegistry::getClientId();
 44:         $auth = cRegistry::getAuth();
 45:         $item = new cApiFileInformation();
 46:         $item->loadByMany(array(
 47:             'idclient' => $client,
 48:             'type' => $typeContent,
 49:             'filename' => $filename
 50:         ));
 51:         if (!$item->isLoaded()) {
 52:             $item = parent::createNewItem();
 53: 
 54:             $item->set('idclient', $client);
 55:             $item->set('type', $typeContent);
 56:             $item->set('filename', $filename);
 57:             $item->set('created', date('Y-m-d H:i:s'));
 58:             $item->set('lastmodified', date('Y-m-d H:i:s'));
 59:             $item->set('author', $auth->auth['uid']);
 60:             $item->set('modifiedby', $auth->auth['uid']);
 61:             $item->set('description', $description);
 62:             $item->store();
 63: 
 64:             return $item;
 65:         } else {
 66:             return $this->updateFile($filename, $typeContent, $description);
 67:         }
 68:     }
 69: 
 70:     /**
 71:      * updates a new entry in the database
 72:      *
 73:      * @param $filename name of the file
 74:      * @param $typeContent type of the entry
 75:      * @param $description an optional description
 76:      * @param $newFilename an optional new filename
 77:      * @param $author an optional author
 78:      * @return cApiFileInformation the updated item
 79:      */
 80:     public function updateFile($filename, $typeContent, $description = '', $newFilename = '', $author = '') {
 81:         $auth = cRegistry::getAuth();
 82:         $client = cRegistry::getClientId();
 83:         $item = new cApiFileInformation();
 84:         $item->loadByMany(array(
 85:             'idclient' => $client,
 86:             'type' => $typeContent,
 87:             'filename' => $filename
 88:         ));
 89:         $id = $item->get('idsfi');
 90:         if ($item->isLoaded()) {
 91:             $item->set('idsfi', $id);
 92:             $item->set('lastmodified', date('Y-m-d H:i:s'));
 93:             $item->set('description', $description);
 94:             $item->set('modifiedby', $auth->auth['uid']);
 95:             if (!empty($newFilename)) {
 96:                 $item->set('filename', $newFilename);
 97:             }
 98:             if (!empty($author)) {
 99:                 $item->set('author', $author);
100:             }
101:             $item->store();
102:         }
103: 
104:         return $item;
105:     }
106: 
107:     /**
108:      * Deletes all found items in the table matching the passed field and it's value.
109:      * Deletes also cached e entries and any existing properties.
110:      *
111:      * @param array wioth parameters
112:      * @return void
113:      */
114:     public function removeFileInformation(array $values) {
115:         $item = new cApiFileInformation();
116:         $item->loadByMany($values);
117:         $idsfi = $item->get('idsfi');
118:         return $this->delete($idsfi);
119:     }
120: 
121:     /**
122:      * return an array with fileinformations from the database
123:      *
124:      * @param $filename name of the file
125:      * @param $type type of the entry
126:      * @return array
127:      */
128:     public function getFileInformation($filename, $type) {
129:         $client = cRegistry::getClientId();
130:         $fileInformation = array();
131:         $item = new cApiFileInformation();
132:         $item->loadByMany(array(
133:             'idclient' => $client,
134:             'type' => $type,
135:             'filename' => $filename
136:         ));
137:         if ($item->isLoaded()) {
138:             $fileInformation['idsfi'] = $item->get('idsfi');
139:             $fileInformation['created'] = $item->get('created');
140:             $fileInformation['lastmodified'] = $item->get('lastmodified');
141:             $fileInformation['author'] = cSecurity::unFilter($item->get('author'));
142:             $fileInformation['modifiedby'] = $item->get('modifiedby');
143:             $fileInformation['description'] = cSecurity::unFilter($item->get('description'));
144:         }
145:         return $fileInformation;
146:     }
147: 
148: }
149: 
150: /**
151:  * File information item.
152:  *
153:  * @package          Core
154:  * @subpackage       GenericDB_Model
155:  */
156: class cApiFileInformation extends Item {
157: 
158:     public function __construct($id = false) {
159:         global $cfg;
160:         parent::__construct($cfg['tab']['file_information'], 'idsfi');
161:         if ($id !== false) {
162:             $this->loadByPrimaryKey($id);
163:         }
164:     }
165: 
166: }
167: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0