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
    • 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

  • cAjaxRequest
  • cAutoload
  • cBackend
  • cEffectiveSetting
  • cGuiScrollListAlltranslations
  • cHTMLValidator
  • cMailer
  • cModuleFileTranslation
  • cModuleHandler
  • cModuleSearch
  • cModuleSynchronizer
  • cModuleTemplateHandler
  • CodeMirror
  • cPasswordRequest
  • cPermission
  • cRegistry
  • cSystemPurge
  • cSystemtest
  • cTinyMCEEditor
  • cWYSIWYGEditor
  • FrontendList
  • HtmlParser
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _processCmsTags
  • addArtspec
  • addslashes_deep
  • addSortImages
  • backToMainArea
  • buildArticleSelect
  • buildCategorySelect
  • buildCategorySelectRights
  • buildHeapTable
  • buildStackString
  • buildTree
  • buildUserOrGroupPermsFromRequest
  • callPluginStore
  • cApiCatGetLevelNode
  • cApiImageCheckCachedImageValidity
  • cApiImageCheckImageEditingPosibility
  • cApiImageGetCacheFileName
  • cApiImageGetTargetDimensions
  • cApiImageIsAnimGif
  • cApiImgScale
  • cApiImgScaleGetMD5CacheFile
  • cApiImgScaleHQ
  • cApiImgScaleImageMagick
  • cApiImgScaleLQ
  • cApiIsImageMagickAvailable
  • cApiStrCleanURLCharacters
  • cApiStrNormalizeLineEndings
  • cApiStrRecodeString
  • cApiStrReplaceDiacritics
  • cApiStrTrimAfterWord
  • cApiStrTrimHard
  • cApiStrTrimSentence
  • cDeprecated
  • cDie
  • cError
  • checkLangInClients
  • checkPathInformation
  • cInclude
  • compareUrlStrings
  • conChangeTemplateForCat
  • conCopyArticle
  • conCopyArtLang
  • conCopyContainerConf
  • conCopyContent
  • conCopyMetaTags
  • conCopyTemplateConfiguration
  • conCreateLocationString
  • conDeeperCategoriesArray
  • conDeleteart
  • conEditArt
  • conEditFirstTime
  • conFetchCategoryTree
  • conFlagOnOffline
  • conGenerateCode
  • conGenerateCodeForAllArts
  • conGenerateCodeForAllArtsInCategory
  • conGenerateCodeForAllartsUsingLayout
  • conGenerateCodeForAllartsUsingMod
  • conGenerateCodeForAllArtsUsingTemplate
  • conGenerateCodeForArtInAllCategories
  • conGenerateCodeForClient
  • conGenerateKeywords
  • conGetAvailableMetaTagTypes
  • conGetCategoryArticleId
  • conGetCategoryAssignments
  • conGetContainerConfiguration
  • conGetContentFromArticle
  • conGetHtmlTranslationTable
  • conGetMetaValue
  • conGetTemplateConfigurationIdForArticle
  • conGetTemplateConfigurationIdForCategory
  • conGetTopmostCat
  • conGetUsedModules
  • conHtmlentities
  • conHtmlEntityDecode
  • conHtmlSpecialChars
  • conIsLocked
  • conLock
  • conLockBulkEditing
  • conMakeArticleIndex
  • conMakeCatOnline
  • conMakeOnline
  • conMakeOnlineBulkEditing
  • conMakePublic
  • conMakeStart
  • conMoveArticles
  • conPhp54Check
  • conRemoveOldCategoryArticle
  • conSaveContentEntry
  • conSetCodeFlag
  • conSetCodeFlagBulkEditing
  • conSetMetaValue
  • conSyncArticle
  • copyRightsForElement
  • createBulkEditingFunction
  • createRandomName
  • createRightsForElement
  • cWarning
  • dbGetColumns
  • dbGetIndexes
  • dbGetPrimaryKeyName
  • dbTableExists
  • dbUpgradeTable
  • defineIfNotDefined
  • deleteArtspec
  • deleteRightsForElement
  • deleteSystemProperty
  • displayDatetime
  • emptyLogFile
  • endAndLogTiming
  • endsWith
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • getAktuellType
  • getAllClientsAndLanguages
  • getArtLang
  • getArtspec
  • getAvailableContentTypes
  • getCanonicalDay
  • getCanonicalMonth
  • getDirectorySize
  • getEffectiveSetting
  • getEffectiveSettingsByType
  • getEncodingByLanguage
  • getFileContents
  • getFileInformation
  • getFileType
  • getGroupOrUserName
  • getIDForArea
  • getJsHelpContext
  • getLanguageNamesByClient
  • getLanguagesByClient
  • getmicrotime
  • getNamedFrame
  • getParam
  • getParentAreaId
  • getSearchResults
  • getStrExpandCollapseButton
  • getSystemProperties
  • getSystemPropertiesByType
  • getSystemProperty
  • getTemplateSelect
  • getUplExpandCollapseButton
  • htmldecode
  • htmlentities_iso88592
  • humanReadableSize
  • includePlugins
  • insertEmptyStrRow
  • ipMatch
  • isAlphanumeric
  • isArchive
  • isArtInMultipleUse
  • isFunctionDisabled
  • isGroup
  • isIPv4
  • isRunningFromWeb
  • isStartArticle
  • isUtf8
  • isValidMail
  • langActivateDeactivateLanguage
  • langDeleteLanguage
  • langEditLanguage
  • langGetTextDirection
  • langNewLanguage
  • langRenameLanguage
  • layDeleteLayout
  • layEditLayout
  • machineReadableSize
  • mailLogBulkEditingFunctions
  • mailLogDecodeAddresses
  • markSubMenuItem
  • mask
  • modDeleteModule
  • modEditModule
  • modTestModule
  • phpInfoToHtml
  • plugin_include
  • prCreateURLNameLocationString
  • prDeleteCacheFileContent
  • prGetCacheFileContent
  • prResolvePathViaCategoryNames
  • prResolvePathViaURLNames
  • prWriteCacheFileContent
  • putFileContents
  • recursiveCopy
  • removeFileInformation
  • renderBackendBreadcrumb
  • renderLabel
  • renderSelectProperty
  • renderTextProperty
  • saveGroupRights
  • saveRights
  • scanDirectory
  • scanPlugins
  • sendEncodingHeader
  • set_magic_quotes_gpc
  • setArtspecDefault
  • setArtspecOnline
  • setHelpContext
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • stripslashes_deep
  • strMakePublic
  • strMakeVisible
  • strMoveCatTargetallowed
  • strMoveDownCategory
  • strMoveSubtree
  • strMoveUpCategory
  • strNewCategory
  • strNewTree
  • strNextBackwards
  • strNextDeeper
  • strNextDeeperAll
  • strNextPost
  • strOrderedPostTreeList
  • strRemakeTreeTable
  • strRenameCategory
  • strRenameCategoryAlias
  • strSortPrePost
  • strSyncCategory
  • systemHavePerm
  • tplAutoFillModules
  • tplBrowseLayoutForContainers
  • tplcfgDuplicate
  • tplDeleteTemplate
  • tplDuplicateTemplate
  • tplEditTemplate
  • tplGetContainerDefault
  • tplGetContainerMode
  • tplGetContainerName
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • xmlFileToArray
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * Functions to edit files.
  4:  * Included in Area style,
  5:  * js, htmltpl in Frame right_bottom.
  6:  *
  7:  * Contains also common file and directory related functions
  8:  *
  9:  * TODO: merge with cFileHandler and cDirHandler
 10:  *
 11:  * @package Core
 12:  * @subpackage Backend
 13:  * @version SVN Revision $Rev:$
 14:  *
 15:  * @author Willi Man, Timo Trautmann
 16:  * @copyright four for business AG <www.4fb.de>
 17:  * @license http://www.contenido.org/license/LIZENZ.txt
 18:  * @link http://www.4fb.de
 19:  * @link http://www.contenido.org
 20:  */
 21: 
 22: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 23: 
 24: /**
 25:  * Function removes file meta information from database (used when a file is
 26:  * deleted)
 27:  *
 28:  * @param int $iIdClient - id of client which contains this file
 29:  * @param string $sFilename - name of corresponding file
 30:  * @param string $sType - type of file (css, js or templates)
 31:  * @param cDb $oDb - CONTENIDO database object
 32:  */
 33: function removeFileInformation($iIdClient, $sFilename, $sType, $oDb) {
 34:     global $cfg;
 35: 
 36:     if (!isset($oDb) || !is_object($oDb)) {
 37:         $oDb = cRegistry::getDb();
 38:     }
 39: 
 40:     $iIdClient = cSecurity::toInteger($iIdClient);
 41:     $sFilename = cSecurity::filter((string) $sFilename, $oDb);
 42:     $sType = cSecurity::filter((string) $sType, $oDb);
 43: 
 44:     $sSql = "DELETE FROM `" . $cfg["tab"]["file_information"] . "` WHERE idclient = $iIdClient AND
 45:             filename = '$sFilename' AND type = '$sType';";
 46:     $oDb->query($sSql);
 47:     $oDb->free();
 48: }
 49: 
 50: /**
 51:  * Function returns file meta information from database (used when files were
 52:  * versionned or description is displayed)
 53:  *
 54:  * @param int $iIdClient - id of client which contains this file
 55:  * @param string $sFilename - name of corresponding file
 56:  * @param string $sType - type of file (css, js or templates)
 57:  * @param cDb $oDb - CONTENIDO database object
 58:  * @return array Indexes:
 59:  *         idsfi - Primary key of database record
 60:  *         created - Datetime when file was created
 61:  *         lastmodified - Datetime when file was last modified
 62:  *         author - Author of file (CONTENIDO Backend User)
 63:  *         modifiedby - Last modifier of file (CONTENIDO Backend User)
 64:  *         description - Description which was inserted for this file
 65:  *
 66:  */
 67: function getFileInformation($iIdClient, $sFilename, $sType, $oDb) {
 68:     global $cfg;
 69: 
 70:     if (!isset($oDb) || !is_object($oDb)) {
 71:         $oDb = cRegistry::getDb();
 72:     }
 73: 
 74:     $iIdClient = cSecurity::toInteger($iIdClient);
 75:     $sFilename = cSecurity::filter((string) $sFilename, $oDb);
 76:     $sType = cSecurity::filter((string) $sType, $oDb);
 77: 
 78:     $aFileInformation = array();
 79:     $sSql = "SELECT * FROM `" . $cfg["tab"]["file_information"] . "` WHERE idclient = $iIdClient AND
 80:             filename = '$sFilename' AND type = '$sType';";
 81:     $oDb->query($sSql);
 82:     if ($oDb->numRows() > 0) {
 83:         $oDb->nextRecord();
 84:         $aFileInformation['idsfi'] = $oDb->f('idsfi');
 85:         $aFileInformation['created'] = $oDb->f('created');
 86:         $aFileInformation['lastmodified'] = $oDb->f('lastmodified');
 87:         $aFileInformation['author'] = cSecurity::unFilter($oDb->f('author'));
 88:         $aFileInformation['modifiedby'] = $oDb->f('modifiedby');
 89:         $aFileInformation['description'] = cSecurity::unFilter($oDb->f('description'));
 90:     }
 91:     $oDb->free();
 92: 
 93:     return $aFileInformation;
 94: }
 95: 
 96: /**
 97:  * Function updates file meta information (used when files were created or
 98:  * edited).
 99:  * It creates new database record for file meta informations if database record
100:  * does
101:  * not exist. Otherwise, existing record will be updated
102:  *
103:  * @param int $iIdClient - id of client which contains this file
104:  * @param string $sFilename - name of corresponding file
105:  * @param string $sType - type of file (css, js or templates)
106:  * @param string $sAuthor - author of file
107:  * @param string $sDescription - description of file
108:  * @param cDb $oDb - CONTENIDO database object
109:  * @param string $sFilenameNew - new filename if filename was changed (optional)
110:  */
111: function updateFileInformation($iIdClient, $sFilename, $sType, $sAuthor, $sDescription, $oDb, $sFilenameNew = '') {
112:     global $cfg;
113: 
114:     if (!isset($oDb) || !is_object($oDb)) {
115:         $oDb = cRegistry::getDb();
116:     }
117: 
118:     if ($sFilenameNew == '') {
119:         $sFilenameNew = $sFilename;
120:     }
121: 
122:     $iIdClient = cSecurity::toInteger($iIdClient);
123:     $sFilename = cSecurity::filter((string) $sFilename, $oDb);
124:     $sType = cSecurity::filter((string) $sType, $oDb);
125:     $sDescription = cSecurity::filter((string) stripslashes($sDescription), $oDb);
126:     $sAuthor = cSecurity::filter((string) $sAuthor, $oDb);
127: 
128:     $sSql = "SELECT * from `" . $cfg["tab"]["file_information"] . "` WHERE idclient = $iIdClient AND
129:             filename = '$sFilename' AND type = '$sType';";
130:     $oDb->query($sSql);
131:     if ($oDb->numRows() == 0) {
132:         // $iNextId = $oDb->nextid('con_style_file_information');
133:         $sSql = "INSERT INTO `" . $cfg["tab"]["file_information"] . "` (
134:                     `idclient` ,
135:                     `type` ,
136:                     `filename` ,
137:                     `created` ,
138:                     `lastmodified` ,
139:                     `author` ,
140:                     `modifiedby` ,
141:                     `description`)
142:                 VALUES (
143:                     $iIdClient,
144:                     '$sType',
145:                     '$sFilenameNew',
146:                     NOW(),
147:                     '0000-00-00 00:00:00',
148:                     '$sAuthor',
149:                     '',
150:                     '$sDescription'
151:                 );";
152:     } else {
153:         $sSql = "UPDATE `" . $cfg["tab"]["file_information"] . "` SET `lastmodified` = NOW(),
154:                 `modifiedby` = '$sAuthor',
155:                 `description` = '$sDescription',
156:                 `filename` = '$sFilenameNew'
157:                 WHERE idclient=$iIdClient AND
158:                       filename='$sFilename' AND
159:                       type='$sType';";
160:     }
161: 
162:     $oDb->free();
163:     $oDb->query($sSql);
164:     $oDb->free();
165: }
166: 
167: /**
168:  * Returns the filetype (extension).
169:  *
170:  * @param string $filename The file to get the type
171:  * @return string Filetype
172:  */
173: function getFileType($filename) {
174:     return cFileHandler::getExtension($filename);
175: }
176: 
177: /**
178:  * Returns the size of a directory.
179:  * AKA the combined filesizes of all files within it.
180:  * Note that this function uses filesize(). There could be problems with files
181:  * that are larger than 2GiB
182:  *
183:  * @param string The directory
184:  * @param bool true if all the subdirectories should be included in the
185:  *            calculation
186:  * @return bool int false in case of an error or the size
187:  */
188: function getDirectorySize($sDirectory, $bRecursive = false) {
189:     $ret = 0;
190:     $files = scanDirectory($sDirectory, $bRecursive);
191:     if ($files === false) {
192:         return false;
193:     }
194: 
195:     foreach ($files as $file) {
196:         $temp = cFileHandler::info($file);
197:         $ret += $temp['size'];
198:     }
199: 
200:     return $ret;
201: }
202: 
203: /**
204:  * Scans passed directory and collects all found files
205:  *
206:  * @param string $sDirectory
207:  * @param bool $bRecursive
208:  * @return bool array of found files (full path and name) or false
209:  */
210: function scanDirectory($sDirectory, $bRecursive = false) {
211:     if (substr($sDirectory, strlen($sDirectory) - 1, 1) == '/') {
212:         $sDirectory = substr($sDirectory, 0, strlen($sDirectory) - 1);
213:     }
214: 
215:     if (!is_dir($sDirectory)) {
216:         return false;
217:     }
218: 
219:     $aFiles = array();
220:     $openDirs = array();
221:     $closedDirs = array();
222:     array_push($openDirs, $sDirectory);
223: 
224:     while (count(($openDirs)) >= 1) {
225:         $sDirectory = array_pop($openDirs);
226:         if (is_dir($sDirectory)) {
227:             if (($hDirHandle = opendir($sDirectory)) !== false) {
228:                 while (($sFile = readdir($hDirHandle)) !== false) {
229:                     if ($sFile != '.' && $sFile != '..') {
230:                         $sFullpathFile = $sDirectory . '/' . $sFile;
231:                         if (is_file($sFullpathFile) && cFileHandler::readable($sFullpathFile)) {
232:                             array_push($aFiles, $sFullpathFile);
233:                         } elseif (is_dir($sFullpathFile) && $bRecursive == true) {
234:                             if (!in_array($sFullpathFile, $closedDirs)) {
235:                                 array_push($openDirs, $sFullpathFile);
236:                             }
237:                         }
238:                     }
239:                 }
240:                 closedir($hDirHandle);
241:             }
242:         }
243:         array_push($closedDirs, $sDirectory);
244:     }
245: 
246:     return $aFiles;
247: }
248: 
249: /**
250:  * Copies source directory to destination directory.
251:  *
252:  * @param string $sourcePath
253:  * @param string $destinationPath
254:  * @param int $mode Octal representation of file mode (0644, 0750, etc.)
255:  * @param array $options Some additional options as follows
256:  *        <pre>
257:  *        $options['force_overwrite'] (bool) Flag to overwrite existing
258:  *            destination file, default value is false
259:  *        </pre>
260:  */
261: function recursiveCopy($sourcePath, $destinationPath, $mode = 0777, array $options = array()) {
262:     if (!is_dir($destinationPath)) {
263:         mkdir($destinationPath, $mode);
264:     }
265: 
266:     $forceOverwrite = (isset($options['force_overwrite'])) ? (bool) $options['force_overwrite'] : false;
267:     $oldPath = getcwd();
268: 
269:     if (is_dir($sourcePath)) {
270:         chdir($sourcePath);
271:         $myhandle = opendir('.');
272: 
273:         while (($file = readdir($myhandle)) !== false) {
274:             if ($file != '.' && $file != '..') {
275:                 if (is_dir($file)) {
276:                     // Copy directory
277:                     recursiveCopy($sourcePath . $file . '/', $destinationPath . $file . '/', $mode, $options);
278:                     chdir($sourcePath);
279:                 } elseif (cFileHandler::exists($sourcePath . $file)) {
280:                     // Copy file
281:                     if (cFileHandler::exists($destinationPath . $file)) {
282:                         if ($forceOverwrite) {
283:                             copy($sourcePath . $file, $destinationPath . $file);
284:                         }
285:                     } else {
286:                         copy($sourcePath . $file, $destinationPath . $file);
287:                     }
288:                 }
289:             }
290:         }
291:         closedir($myhandle);
292:     }
293: 
294:     chdir($oldPath);
295: }
296: 
CMS CONTENIDO 4.9.2 API documentation generated by ApiGen 2.8.0