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

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

Functions

  • addArtspec
  • 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
  • conMakeInlineScript
  • 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
  • extractNumber
  • generateDisplayFilePath
  • generateJs
  • 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
  • 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
  • setSystemProperty
  • showTree
  • startTiming
  • statCreateLocationString
  • statDisplayTopChooser
  • statDisplayYearlyTopChooser
  • statGetAvailableMonths
  • statGetAvailableYears
  • statResetStatistic
  • statsArchive
  • statsDisplayInfo
  • statsOverviewAll
  • statsOverviewTop
  • statsOverviewTopYear
  • statsOverviewYear
  • strAssignTemplate
  • strBuildSqlValues
  • strCheckTreeForErrors
  • strCopyCategory
  • strCopyTree
  • strDeeperCategoriesArray
  • strDeleteCategory
  • strHasArticles
  • strHasStartArticle
  • 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
  • tplGetContainerNumbersInLayout
  • tplGetContainerTypes
  • tplGetInUsedData
  • tplIsTemplateInUse
  • tplPreparseLayout
  • tplProcessSendContainerConfiguration
  • updateClientCache
  • updateFileInformation
  • uplCreateFriendlyName
  • uplDirectoryListRecursive
  • uplGetDirectoriesToExclude
  • uplGetFileExtension
  • uplGetFileIcon
  • uplGetFileTypeDescription
  • uplGetThumbnail
  • uplHasFiles
  • uplHasSubdirs
  • uplmkdir
  • uplRecursiveDBDirectoryList
  • uplRecursiveDirectoryList
  • uplRenameDirectory
  • uplSearch
  • uplSyncDirectory
  • uplSyncDirectoryDBFS
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the backend page for the directory overview in upload
  5:  * section.
  6:  *
  7:  * @package Core
  8:  * @subpackage Backend
  9:  * @version SVN Revision $Rev:$
 10:  *
 11:  * @author Timo Hummel
 12:  * @copyright four for business AG <www.4fb.de>
 13:  * @license http://www.contenido.org/license/LIZENZ.txt
 14:  * @link http://www.4fb.de
 15:  * @link http://www.contenido.org
 16:  */
 17: 
 18: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 19: 
 20: cInclude('includes', 'functions.con.php');
 21: cInclude('includes', 'functions.str.php');
 22: 
 23: if (!(int) $client > 0) {
 24:     // if there is no client selected, display empty page
 25:     $oPage = new cGuiPage('upl_dirs_overview');
 26:     $oPage->render();
 27:     return;
 28: }
 29: 
 30: /**
 31:  *
 32:  * @param unknown_type $item
 33:  * @return string
 34:  */
 35: function getUplExpandCollapseButton($item) {
 36:     global $sess, $PHP_SELF, $frame, $area, $appendparameters;
 37:     $selflink = 'main.php';
 38: 
 39:     if (count($item->subitems) > 0) {
 40:         if ($item->collapsed == true) {
 41:             $expandlink = $sess->url($selflink . "?area=$area&frame=$frame&appendparameters=$appendparameters&expand=" . $item->id);
 42:             return ('<a href="' . $expandlink . '" alt="' . i18n('Open category') . '" title="' . i18n('Open category') . '"><img src="' . $item->collapsed_icon . '" alt="" border="0" align="middle" width="18"></a>');
 43:         } else {
 44:             $collapselink = $sess->url($selflink . "?area=$area&appendparameters=$appendparameters&frame=$frame&collapse=" . $item->id);
 45:             return ('<a href="' . $collapselink . '" alt="' . i18n('Close category') . '" title="' . i18n('Close category') . '"><img src="' . $item->expanded_icon . '" alt="" border="0" align="middle" width="18"></a>');
 46:         }
 47:     } else {
 48:         if ($item->custom['lastitem']) {
 49:             return '<img class="vAlignMiddle" alt="" src="images/but_lastnode.gif" width="18" height="18">';
 50:         } else {
 51:             return '<img class="vAlignMiddle" alt="" src="images/grid_collapse.gif" width="18" height="18">';
 52:         }
 53:     }
 54: }
 55: 
 56: // Create Folder
 57: // ixxed by Timo Trautmann double database entries also called by action upl_mkdir
 58: // Use remembered path from upl_last_path (from session)
 59: if (!isset($path) && $sess->isRegistered('upl_last_path')) {
 60:     $path = $upl_last_path;
 61: }
 62: 
 63: $appendparameters = $_REQUEST['appendparameters'];
 64: 
 65: if (!isset($action))
 66:     $action = '';
 67: 
 68: if ($tmp_area == '') {
 69:     $tmp_area = $area; // $tmp_area used at two places for unknown reasons...
 70: }
 71: 
 72: $uplexpandedList = unserialize($currentuser->getUserProperty('system', 'upl_expandstate'));
 73: $upldbfsexpandedList = unserialize($currentuser->getUserProperty('system', 'upl_dbfs_expandstate'));
 74: 
 75: if (!is_array($uplexpandedList)) {
 76:     $uplexpandedList = array();
 77: }
 78: 
 79: if (!is_array($upldbfsexpandedList)) {
 80:     $upldbfsexpandedList = array();
 81: }
 82: 
 83: $dbfs = new cApiDbfsCollection();
 84: 
 85: if ($action == 'upl_delete') {
 86:     if (cApiDbfs::isDbfs($path)) {
 87:         $dbfs->remove($path . '/.');
 88:     } else {
 89:         // Check for files
 90:         if (uplHasFiles($path)) {
 91:             $failedFiles = array();
 92:             if (is_dir($cfgClient[$client]['upl']['path'] . $path)) {
 93:                 if (false !== ($directory = cDirHandler::read($uploadPath))) {
 94:                     foreach ($directory as $dir_entry) {
 95:                         if (cFileHandler::fileNameIsDot($dir_entry) === false) {
 96:                             $res = cFileHandler::remove($cfgClient[$client]['upl']['path'] . $path . $dir_entry);
 97: 
 98:                             if ($res == false) {
 99:                                 $failedFiles[] = $dir_entry;
100:                             }
101:                         }
102:                     }
103:                 }
104:             }
105:         }
106: 
107:         if (count($failedFiles) > 0) {
108:             $notification->displayNotification('warning', i18n("Failed to delete the following files:") . '<br><br>' . implode('<br>', $failedFiles));
109:         } else {
110:             $res = @rmdir($cfgClient[$client]['upl']['path'] . $path);
111:             if ($res == false) {
112:                 $notification->displayNotification('warning', sprintf(i18n("Failed to remove directory %s"), $path));
113:             }
114:         }
115:     }
116: }
117: 
118: $tpl->reset();
119: 
120: // Show notification for error in dir name from upl_mkdir.action
121: if ($errno === '0703') {
122:     $tpl->set('s', 'WARNING', $notification->returnNotification('error', i18n('Directories with special characters and spaces are not allowed.')));
123: }
124: 
125: // Uploadfiles tree on file system
126: 
127: $file = 'Upload';
128: $pathstring = '';
129: 
130: $rootTreeItem = new TreeItem();
131: $rootTreeItem->custom['level'] = 0;
132: $rootTreeItem->name = i18n("Upload directory");
133: $aInvalidDirectories = uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"], $rootTreeItem, 2);
134: if (count($aInvalidDirectories) > 0) {
135:     $sWarningInfo = i18n('The following directories contains invalid characters and were ignored: ');
136:     $sSeperator = '<br>';
137:     $sFiles = implode(', ', $aInvalidDirectories);
138:     $sRenameString = i18n('Please click here in order to rename automatically.');
139:     $sRenameHref = $sess->url("main.php?area=$area&frame=$frame&force_rename=true");
140:     $sRemameLink = '<a href="' . $sRenameHref . '">' . $sRenameString . '</a>';
141:     $sNotificationString = $sWarningInfo . $sSeperator . $sFiles . $sSeperator . $sSeperator . $sRemameLink;
142: 
143:     $sErrorString = $notification->returnNotification('warning', $sNotificationString, 1);
144:     $tpl->set('s', 'WARNING', $sErrorString);
145: } else {
146:     $tpl->set('s', 'WARNING', '');
147: }
148: 
149: // Mark all items in the expandedList as expanded
150: foreach ($uplexpandedList as $key => $value) {
151:     $rootTreeItem->markExpanded($value);
152: }
153: 
154: // Collapse and expand the tree
155: if (is_string($collapse)) {
156:     $rootTreeItem->markCollapsed($collapse);
157: }
158: 
159: if (is_string($expand)) {
160:     $rootTreeItem->markExpanded($expand);
161: }
162: 
163: $uplexpandedList = array();
164: $rootTreeItem->getExpandedList($uplexpandedList);
165: 
166: $currentuser->setUserProperty('system', 'upl_expandstate', serialize($uplexpandedList));
167: 
168: $objects = array();
169: $rootTreeItem->traverse($objects);
170: unset($objects[0]);
171: 
172: if ($appendparameters == 'filebrowser') {
173:     $mtree = new cGuiTree('b58f0ae3-8d4e-4bb3-a754-5f0628863364');
174:     $cattree = conFetchCategoryTree();
175:     $marray = array();
176: 
177:     foreach ($cattree as $key => $catitem) {
178:         $no_start = true;
179:         $no_online = true;
180:         $no_start = !strHasStartArticle($catitem['idcat'], $lang);
181:         $no_online = !$catitem['visible'];
182: 
183:         $icon = 'images/';
184:         if ($catitem['visible'] == 1) {
185:             if ($catitem['public'] == 0) {
186:                 // Category is not public
187:                 $icon .= ($no_start || $no_online) ? 'folder_on_error_locked.gif' : 'folder_on_locked.gif';
188:             } else {
189:                 // Category is public
190:                 $icon .= ($no_start || $no_online) ? 'folder_on_error.gif' : 'folder_on.gif';
191:             }
192:         } else {
193:             // Category is offline
194:             if ($catitem['public'] == 0) {
195:                 // Category is locked
196:                 $icon .= ($no_start || $no_online) ? 'folder_off_error_locked.gif' : 'folder_off_locked.gif';
197:             } else {
198:                 // Category is public
199:                 $icon .= ($no_start || $no_online) ? 'folder_off_error.gif' : 'folder_off.gif';
200:             }
201:         }
202: 
203:         $idcat = $catitem['idcat'];
204: 
205:         $name = '&nbsp;<a href="' . $sess->url("main.php?area=$area&frame=5&idcat=$idcat&appendparameters=$appendparameters") . '" target="right_bottom">' . $catitem['name'] . '</a>';
206:         $marray[] = array(
207:             'id' => $catitem['idcat'],
208:             'name' => $name,
209:             'level' => $catitem['level'],
210:             'attributes' => array(
211:                 'icon' => $icon
212:             )
213:         );
214:     }
215: 
216:     $mtree->setTreeName(i18n("Categories"));
217:     $mtree->setIcon('images/grid_folder.gif');
218:     $mtree->importTable($marray);
219: 
220:     $baselink = new cHTMLLink();
221:     $baselink->setCLink($area, $frame, '');
222:     $baselink->setCustom('appendparameters', $appendparameters);
223: 
224:     $mtree->setBaseLink($baselink);
225:     $mtree->setCollapsed($collapsed);
226:     $mtree->processParameters();
227: 
228:     $collapsed = array();
229:     $mtree->getCollapsedList($collapsed);
230: 
231:     $tpl->set('s', 'CATBROWSER', $mtree->render());
232:     $tpl->set('s', 'APPENDPARAMETERS', '\'&appendparameters=' . $appendparameters . '\'');
233: } else {
234:     $tpl->set('s', 'CATBROWSER', '');
235:     $tpl->set('s', 'APPENDPARAMETERS', '\'&appendparameters=' . $appendparameters . '\'');
236: }
237: 
238: chdir(cRegistry::getBackendPath());
239: 
240: $idFsPathPrefix = 'fs_';
241: 
242: // create javascript multilink
243: $tmp_mstr = '<a id="root" href="javascript:Con.multiLink(\'%s\', \'%s\',\'%s\', \'%s\')">%s</a>';
244: $mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"), 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"), '<img class="vAlignMiddle" src="images/ordner_oben.gif" align="middle" alt="" border="0"><img src="images/spacer.gif" width="5" border="0">' . $file);
245: 
246: $tpl->set('d', 'ID_PATH', $idFsPathPrefix . 'root');
247: $tpl->set('d', 'DATA_PATH', $pathstring);
248: $tpl->set('d', 'INDENT', 3);
249: $tpl->set('d', 'DIRNAME', $mstr);
250: $tpl->set('d', 'EDITBUTTON', '');
251: $tpl->set('d', 'DELETEBUTTON', '');
252: $tpl->set('d', 'COLLAPSE', '');
253: $tpl->next();
254: 
255: if (is_array($objects)) {
256:     foreach ($objects as $a_file) {
257:         $file = $a_file->name;
258:         $depth = $a_file->custom['level'] - 1;
259:         $pathstring = str_replace($cfgClient[$client]['upl']['path'], '', $a_file->id);
260:         $a_file->collapsed_icon = 'images/grid_expand.gif';
261:         $a_file->expanded_icon = 'images/grid_collapse.gif';
262:         $dlevels[$depth] = $a_file->custom['lastitem'];
263:         $imgcollapse = getUplExpandCollapseButton($a_file);
264:         $fileurl = rawurlencode($path . $file . '/');
265:         $pathurl = rawurlencode($path);
266: 
267:         // Indent for every level
268:         $indent = 18 + (($depth - 1) * 18);
269: 
270:         // create javascript multilink
271:         $tmp_mstr = '<a href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
272:         $mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"), 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"), '<img class="vAlignMiddle" src="images/grid_folder.gif" border="0" alt=""><img src="images/spacer.gif" align="middle" width="5" border="0">' . $file);
273: 
274:         $hasFiles = uplHasFiles($pathstring);
275:         $hasSubdirs = uplHasSubdirs($pathstring);
276: 
277:         if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
278:             // $deletebutton = '
279:             // <a title="' . i18n("Delete directory") . '"
280:             // href="javascript:void(0)"
281:             // onclick="event.cancelBubble=true;Con.showConfirmation(&quot;' .
282:             // i18n("Do you really want to delete the following directory:") .
283:             // '<b>' . $file . '</b>&quot;, function() { deleteDirectory(&quot;'
284:             // . $pathstring . '&quot;); });return false;">
285:             // aa<img src="' . $cfg['path']['images'] . 'delete.gif" border="0"
286:             // title="' . i18n("Delete directory") . '" alt="' . i18n("Delete
287:             // directory") . '">
288:             // </a>';
289:             $deletebutton = '
290:     <a class="jsDelete" title="' . i18n("Delete directory") . '" href="javascript:void(0)">
291:         <img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . i18n("Delete directory") . '" alt="' . i18n("Delete directory") . '">
292:     </a>';
293:         } else {
294:             if ($hasFiles) {
295:                 $message = i18n("Directory contains files");
296:             } else {
297:                 $message = i18n("Permission denied");
298:             }
299:             $deletebutton = '<img src="' . $cfg['path']['images'] . 'delete_inact.gif" border="0" alt="' . $message . '" title="' . $message . '">';
300:         }
301: 
302:         $gline = '';
303:         for ($i = 1; $i < $depth; $i++) {
304:             if ($dlevels[$i] == false && $i != 0) {
305:                 $gline .= '<img class="vAlignMiddle" alt="" src="images/grid_linedown.gif" width="18">';
306:             } else {
307:                 $gline .= '<img class="vAlignMiddle" alt="" src="images/spacer.gif" width="18" height="18">';
308:             }
309:         }
310: 
311:         $parent = str_replace($cfgClient[$client]['upl']['path'], '', $a_file->custom['parent']);
312: 
313:         $idAttrPath = str_replace(array(
314:             '/',
315:             ':'
316:         ), array(
317:             '_',
318:             ''
319:         ), trim($pathstring, '/'));
320:         $tpl->set('d', 'ID_PATH', $idFsPathPrefix . $idAttrPath);
321:         $tpl->set('d', 'DATA_PATH', $pathstring);
322:         $tpl->set('d', 'INDENT', 0);
323:         $tpl->set('d', 'DIRNAME', $mstr);
324:         $tpl->set('d', 'EDITBUTTON', '');
325:         $tpl->set('d', 'DELETEBUTTON', $deletebutton);
326:         $tpl->set('d', 'COLLAPSE', $gline . $imgcollapse);
327:         $tpl->next();
328:     }
329: }
330: 
331: $tpl->set('d', 'DELETEBUTTON', '&nbsp;');
332: $tpl->set('d', 'DIRNAME', '');
333: $tpl->set('d', 'EDITBUTTON', '');
334: $tpl->set('d', 'COLLAPSE', "");
335: $tpl->next();
336: 
337: // Database-based filesystem (DBFS)
338: 
339: $idDbfsPathPrefix = 'dbfs_';
340: $file = i18n("Database file system");
341: $pathstring = cApiDbfs::PROTOCOL_DBFS;
342: $rootTreeItem = new TreeItem();
343: $rootTreeItem->custom['level'] = 0;
344: 
345: uplRecursiveDBDirectoryList('', $rootTreeItem, 2, $client);
346: 
347: // Mark all items in the expandedList as expanded
348: foreach ($upldbfsexpandedList as $key => $value) {
349:     $rootTreeItem->markExpanded($value);
350: }
351: 
352: // Collapse and expand the tree
353: if (is_string($collapse)) {
354:     $rootTreeItem->markCollapsed($collapse);
355: }
356: 
357: if (is_string($expand)) {
358:     $rootTreeItem->markExpanded($expand);
359: }
360: 
361: $upldbfsexpandedList = array();
362: $rootTreeItem->getExpandedList($upldbfsexpandedList);
363: 
364: $currentuser->setUserProperty('system', 'upl_dbfs_expandstate', serialize($upldbfsexpandedList));
365: 
366: $objects = array();
367: $rootTreeItem->traverse($objects);
368: 
369: unset($objects[0]);
370: 
371: $tmp_mstr = '<a href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
372: $mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"), 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"), '<img class="vAlignMiddle" src="images/ordner_oben.gif" alt="" border="0"><img src="images/spacer.gif" width="5" border="0">' . $file);
373: 
374: $tpl->set('d', 'ID_PATH', $idDbfsPathPrefix . 'root');
375: $tpl->set('d', 'DATA_PATH', $pathstring);
376: $tpl->set('d', 'INDENT', 3);
377: $tpl->set('d', 'DIRNAME', $mstr);
378: $tpl->set('d', 'EDITBUTTON', '');
379: $tpl->set('d', 'DELETEBUTTON', '');
380: $tpl->set('d', 'COLLAPSE', '');
381: $tpl->next();
382: 
383: $dbfsc = new cApiDbfsCollection();
384: 
385: $dlevels = array();
386: 
387: if (is_array($objects)) {
388:     foreach ($objects as $a_file) {
389:         $file = $a_file->name;
390:         $depth = $a_file->custom['level'] - 1;
391:         $pathstring = $a_file->id;
392:         $a_file->collapsed_icon = 'images/grid_expand.gif';
393:         $a_file->expanded_icon = 'images/grid_collapse.gif';
394:         $dlevels[$depth] = $a_file->custom['lastitem'];
395:         $collapse = getUplExpandCollapseButton($a_file);
396:         $fileurl = rawurlencode($path . $file . '/');
397:         $pathurl = rawurlencode($path);
398: 
399:         if ($file == 'tmp') {
400:             echo 'tmp2<br>';
401:         }
402: 
403:         // Indent for every level
404:         $indent = 18 + (($depth - 1) * 18);
405: 
406:         // create javascript multilink
407:         $tmp_mstr = '<a href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
408:         $mstr = sprintf($tmp_mstr, 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"), 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"), '<img class="vAlignMiddle" src="images/grid_folder.gif" border="0" alt=""><img src="images/spacer.gif" align="middle" width="5" border="0">' . $file);
409: 
410:         $hasFiles = $dbfsc->hasFiles($pathstring);
411: 
412:         if (!$hasFiles && $perm->have_perm_area_action($tmp_area, 'upl_rmdir')) {
413:             // $deletebutton = '
414:             // <a title="' . i18n("Delete directory") . '"
415:             // href="javascript:void(0)"
416:             // onclick="event.cancelBubble=true;Con.showConfirmation(&quot;' .
417:             // i18n("Do you really want to delete the following directory:") .
418:             // '<b>' . $file . '</b>' . '&quot;, function() {
419:             // deleteDirectory(&quot;' . $pathstring . '&quot;); });return
420:             // false;">
421:             // <img class="vAlignMiddle" src="' . $cfg['path']['images'] .
422:             // 'delete.gif" border="0" title="' . i18n("Delete directory") . '"
423:             // alt="' . i18n("Delete directory") . '">
424:             // </a>';
425:             $deletebutton = '
426:     <a class="jsDelete" title="' . i18n("Delete directory") . '" href="javascript:void(0)">
427:        <img class="vAlignMiddle" src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . i18n("Delete directory") . '" alt="' . i18n("Delete directory") . '">
428:     </a>';
429:         } else {
430:             if ($hasFiles) {
431:                 $message = i18n("Directory contains files");
432:             } else {
433:                 $message = i18n("Permission denied");
434:             }
435:             $deletebutton = '<img class="vAlignMiddle" alt="" src="' . $cfg['path']['images'] . 'delete_inact.gif" border="0" alt="' . $message . '" title="' . $message . '">';
436:         }
437: 
438:         $gline = '';
439:         for ($i = 1; $i < $depth; $i++) {
440:             if ($dlevels[$i] == false && $i != 0) {
441:                 $gline .= '<img class="vAlignMiddle" src="images/grid_linedown.gif" alt="" align="middle">';
442:             } else {
443:                 $gline .= '<img class="vAlignMiddle" src="images/spacer.gif" width="18" height="18" alt="" align="middle">';
444:             }
445:         }
446: 
447:         $parent = str_replace($cfgClient[$client]['upl']['path'], '', $a_file->custom['parent']);
448: 
449:         $idAttrPath = str_replace(array(
450:             '/',
451:             ':'
452:         ), array(
453:             '_',
454:             ''
455:         ), trim($pathstring, '/'));
456:         $tpl->set('d', 'ID_PATH', $idDbfsPathPrefix . $idAttrPath);
457:         $tpl->set('d', 'DATA_PATH', $pathstring);
458:         $tpl->set('d', 'INDENT', 0);
459:         $tpl->set('d', 'DIRNAME', $mstr);
460:         $tpl->set('d', 'EDITBUTTON', '');
461:         $tpl->set('d', 'DELETEBUTTON', $deletebutton);
462:         $tpl->set('d', 'COLLAPSE', $gline . $collapse);
463:         $tpl->next();
464:     }
465: }
466: 
467: $pathPrefix = (cApiDbfs::isDbfs($path)) ? $idDbfsPathPrefix : $idFsPathPrefix;
468: $idAttrPath = str_replace(array(
469:     '/',
470:     ':'
471: ), array(
472:     '_',
473:     ''
474: ), trim($path, '/'));
475: $tpl->set('s', 'ID_PATH', $pathPrefix . $idAttrPath);
476: $tpl->set('s', 'DELETE_MSG', i18n("Do you really want to delete the following directory:") . '<b>{path}</b>');
477: 
478: chdir(cRegistry::getBackendPath());
479: 
480: $tpl->generate($cfg['path']['templates'] . $cfg['templates']['upl_dirs_overview']);
481: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0