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