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
  • SimpleXMLExtended
  • TreeItem
  • UploadList
  • UploadSearchResultList

Functions

  • _getCurrentTypes
  • _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
  • 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
  • endsWith
  • 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
  • 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
  • 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:  * 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: $dbfs = new cApiDbfsCollection();
 81: 
 82: if ($action == 'upl_delete') {
 83:     if (cApiDbfs::isDbfs($path)) {
 84:         $dbfs->remove($path . '/.');
 85:     } else {
 86:         // Check for files
 87:         if (uplHasFiles($path)) {
 88:             $failedFiles = array();
 89:             if (is_dir($cfgClient[$client]['upl']['path'] . $path)) {
 90: 
 91:                 $directory = @opendir($cfgClient[$client]['upl']['path'] . $path);
 92:                 if (false !== $directory) {
 93:                     while (false !== ($dir_entry = readdir($directory))) {
 94:                         if ($dir_entry != '.' && $dir_entry != '..') {
 95:                             $res = @ unlink($cfgClient[$client]['upl']['path'] . $path . $dir_entry);
 96: 
 97:                             if ($res == false) {
 98:                                 $failedFiles[] = $dir_entry;
 99:                             }
100:                         }
101:                     }
102:                 }
103:                 closedir($directory);
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: // #############################################################################
126: // Uploadfiles tree on file system
127: 
128: $file = 'Upload';
129: $pathstring = '';
130: 
131: $rootTreeItem = new TreeItem();
132: $rootTreeItem->custom['level'] = 0;
133: $rootTreeItem->name = i18n("Upload directory");
134: $aInvalidDirectories = uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"], $rootTreeItem, 2);
135: if (count($aInvalidDirectories) > 0) {
136:     $sWarningInfo = i18n('The following directories contains invalid characters and were ignored: ');
137:     $sSeperator = '<br>';
138:     $sFiles = implode(', ', $aInvalidDirectories);
139:     $sRenameString = i18n('Please click here in order to rename automatically.');
140:     $sRenameHref = $sess->url("main.php?area=$area&frame=$frame&force_rename=true");
141:     $sRemameLink = '<a href="' . $sRenameHref . '">' . $sRenameString . '</a>';
142:     $sNotificationString = $sWarningInfo . $sSeperator . $sFiles . $sSeperator . $sSeperator . $sRemameLink;
143: 
144:     $sErrorString = $notification->returnNotification('warning', $sNotificationString, 1);
145:     $tpl->set('s', 'WARNING', $sErrorString);
146: } else {
147:     $tpl->set('s', 'WARNING', '');
148: }
149: 
150: // Mark all items in the expandedList as expanded
151: foreach ($uplexpandedList as $key => $value) {
152:     $rootTreeItem->markExpanded($value);
153: }
154: 
155: // Collapse and expand the tree
156: if (is_string($collapse)) {
157:     $rootTreeItem->markCollapsed($collapse);
158: }
159: 
160: if (is_string($expand)) {
161:     $rootTreeItem->markExpanded($expand);
162: }
163: 
164: $uplexpandedList = array();
165: $rootTreeItem->getExpandedList($uplexpandedList);
166: 
167: $currentuser->setUserProperty('system', 'upl_expandstate', serialize($uplexpandedList));
168: 
169: $objects = array();
170: $rootTreeItem->traverse($objects);
171: unset($objects[0]);
172: 
173: if ($appendparameters == 'filebrowser') {
174:     $mtree = new cGuiTree('b58f0ae3-8d4e-4bb3-a754-5f0628863364');
175:     $cattree = conFetchCategoryTree();
176:     $marray = array();
177: 
178:     foreach ($cattree as $key => $catitem) {
179:         $no_start = true;
180:         $no_online = true;
181:         $no_start = !strHasStartArticle($catitem['idcat'], $lang);
182:         $no_online = !$catitem['visible'];
183: 
184:         $icon = 'images/';
185:         if ($catitem['visible'] == 1) {
186:             if ($catitem['public'] == 0) {
187:                 // Category is not public
188:                 $icon .= ($no_start || $no_online) ? 'folder_on_error_locked.gif' : 'folder_on_locked.gif';
189:             } else {
190:                 // Category is public
191:                 $icon .= ($no_start || $no_online) ? 'folder_on_error.gif' : 'folder_on.gif';
192:             }
193:         } else {
194:             // Category is offline
195:             if ($catitem['public'] == 0) {
196:                 // Category is locked
197:                 $icon .= ($no_start || $no_online) ? 'folder_off_error_locked.gif' : 'folder_off_locked.gif';
198:             } else {
199:                 // Category is public
200:                 $icon .= ($no_start || $no_online) ? 'folder_off_error.gif' : 'folder_off.gif';
201:             }
202:         }
203: 
204:         $idcat = $catitem['idcat'];
205: 
206:         $name = '&nbsp;<a href="' . $sess->url("main.php?area=$area&frame=5&idcat=$idcat&appendparameters=$appendparameters") . '" target="right_bottom">' . $catitem['name'] . '</a>';
207:         $marray[] = array(
208:             'id' => $catitem['idcat'],
209:             'name' => $name,
210:             'level' => $catitem['level'],
211:             'attributes' => array(
212:                 'icon' => $icon
213:             )
214:         );
215:     }
216: 
217:     $mtree->setTreeName(i18n("Categories"));
218:     $mtree->setIcon('images/grid_folder.gif');
219:     $mtree->importTable($marray);
220: 
221:     $baselink = new cHTMLLink();
222:     $baselink->setCLink($area, $frame, '');
223:     $baselink->setCustom('appendparameters', $appendparameters);
224: 
225:     $mtree->setBaseLink($baselink);
226:     $mtree->setBackgroundMode(TREEVIEW_BACKGROUND_SHADED);
227:     $mtree->setMouseoverMode(cGuiTree::TREEVIEW_MOUSEOVER_NONE);
228:     $mtree->setCollapsed($collapsed);
229:     $mtree->processParameters();
230: 
231:     $collapsed = array();
232:     $mtree->getCollapsedList($collapsed);
233: 
234:     $tpl->set('s', 'CATBROWSER', $mtree->render());
235:     $tpl->set('s', 'APPENDPARAMETERS', '\'&appendparameters=' . $appendparameters . '\'');
236: } else {
237:     $tpl->set('s', 'CATBROWSER', '');
238:     $tpl->set('s', 'APPENDPARAMETERS', '\'&appendparameters=' . $appendparameters . '\'');
239: }
240: 
241: chdir(cRegistry::getBackendPath());
242: 
243: $idFsPathPrefix = 'fs_';
244: 
245: // create javascript multilink
246: $tmp_mstr = '<a id="root" href="javascript:Con.multiLink(\'%s\', \'%s\',\'%s\', \'%s\')">%s</a>';
247: $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);
248: 
249: $tpl->set('d', 'ID_PATH', $idFsPathPrefix . 'root');
250: $tpl->set('d', 'DATA_PATH', $pathstring);
251: $tpl->set('d', 'INDENT', 3);
252: $tpl->set('d', 'DIRNAME', $mstr);
253: $tpl->set('d', 'EDITBUTTON', '');
254: $tpl->set('d', 'DELETEBUTTON', '');
255: $tpl->set('d', 'COLLAPSE', '');
256: $tpl->next();
257: 
258: if (is_array($objects)) {
259:     foreach ($objects as $a_file) {
260:         $file = $a_file->name;
261:         $depth = $a_file->custom['level'] - 1;
262:         $pathstring = str_replace($cfgClient[$client]['upl']['path'], '', $a_file->id);
263:         $a_file->collapsed_icon = 'images/grid_expand.gif';
264:         $a_file->expanded_icon = 'images/grid_collapse.gif';
265:         $dlevels[$depth] = $a_file->custom['lastitem'];
266:         $imgcollapse = getUplExpandCollapseButton($a_file);
267:         $fileurl = rawurlencode($path . $file . '/');
268:         $pathurl = rawurlencode($path);
269: 
270:         // Indent for every level
271:         $indent = 18 + (($depth - 1) * 18);
272: 
273:         // create javascript multilink # -> better create meaningful comments
274:         $tmp_mstr = '<a href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
275:         $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);
276: 
277:         $hasFiles = uplHasFiles($pathstring);
278:         $hasSubdirs = uplHasSubdirs($pathstring);
279: 
280:         if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
281:             // $deletebutton = '
282:             // <a title="' . i18n("Delete directory") . '"
283:             // href="javascript:void(0)"
284:             // onclick="event.cancelBubble=true;Con.showConfirmation(&quot;' .
285:             // i18n("Do you really want to delete the following directory:") .
286:             // '<b>' . $file . '</b>&quot;, function() { deleteDirectory(&quot;'
287:             // . $pathstring . '&quot;); });return false;">
288:             // aa<img src="' . $cfg['path']['images'] . 'delete.gif" border="0"
289:             // title="' . i18n("Delete directory") . '" alt="' . i18n("Delete
290:             // directory") . '">
291:             // </a>';
292:             $deletebutton = '
293:     <a class="jsDelete" title="' . i18n("Delete directory") . '" href="javascript:void(0)">
294:         <img src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . i18n("Delete directory") . '" alt="' . i18n("Delete directory") . '">
295:     </a>';
296:         } else {
297:             if ($hasFiles) {
298:                 $message = i18n("Directory contains files");
299:             } else {
300:                 $message = i18n("Permission denied");
301:             }
302:             $deletebutton = '<img src="' . $cfg['path']['images'] . 'delete_inact.gif" border="0" alt="' . $message . '" title="' . $message . '">';
303:         }
304: 
305:         $gline = '';
306:         for ($i = 1; $i < $depth; $i++) {
307:             if ($dlevels[$i] == false && $i != 0) {
308:                 $gline .= '<img class="vAlignMiddle" src="images/grid_linedown.gif" width="18">';
309:             } else {
310:                 $gline .= '<img class="vAlignMiddle" src="images/spacer.gif" width="18" height="18">';
311:             }
312:         }
313: 
314:         $parent = str_replace($cfgClient[$client]['upl']['path'], '', $a_file->custom['parent']);
315: 
316:         $idAttrPath = str_replace(array(
317:             '/',
318:             ':'
319:         ), array(
320:             '_',
321:             ''
322:         ), trim($pathstring, '/'));
323:         $tpl->set('d', 'ID_PATH', $idFsPathPrefix . $idAttrPath);
324:         $tpl->set('d', 'DATA_PATH', $pathstring);
325:         $tpl->set('d', 'INDENT', 0);
326:         $tpl->set('d', 'DIRNAME', $mstr);
327:         $tpl->set('d', 'EDITBUTTON', '');
328:         $tpl->set('d', 'DELETEBUTTON', $deletebutton);
329:         $tpl->set('d', 'COLLAPSE', $gline . $imgcollapse);
330:         $tpl->next();
331:     }
332: }
333: 
334: $tpl->set('d', 'DELETEBUTTON', '&nbsp;');
335: $tpl->set('d', 'DIRNAME', '');
336: $tpl->set('d', 'EDITBUTTON', '');
337: $tpl->set('d', 'COLLAPSE', "");
338: $tpl->next();
339: 
340: // #############################################################################
341: // Database-based filesystem (DBFS)
342: 
343: $idDbfsPathPrefix = 'dbfs_';
344: $file = i18n("Database file system");
345: $pathstring = cApiDbfs::PROTOCOL_DBFS;
346: $rootTreeItem = new TreeItem();
347: $rootTreeItem->custom['level'] = 0;
348: 
349: uplRecursiveDBDirectoryList('', $rootTreeItem, 2, $client);
350: 
351: // Mark all items in the expandedList as expanded
352: foreach ($upldbfsexpandedList as $key => $value) {
353:     $rootTreeItem->markExpanded($value);
354: }
355: 
356: // Collapse and expand the tree
357: if (is_string($collapse)) {
358:     $rootTreeItem->markCollapsed($collapse);
359: }
360: 
361: if (is_string($expand)) {
362:     $rootTreeItem->markExpanded($expand);
363: }
364: 
365: $upldbfsexpandedList = array();
366: $rootTreeItem->getExpandedList($upldbfsexpandedList);
367: 
368: $currentuser->setUserProperty('system', 'upl_dbfs_expandstate', serialize($upldbfsexpandedList));
369: 
370: $objects = array();
371: $rootTreeItem->traverse($objects);
372: 
373: unset($objects[0]);
374: 
375: $tmp_mstr = '<a href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
376: $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);
377: 
378: $tpl->set('d', 'ID_PATH', $idDbfsPathPrefix . 'root');
379: $tpl->set('d', 'DATA_PATH', $pathstring);
380: $tpl->set('d', 'INDENT', 3);
381: $tpl->set('d', 'DIRNAME', $mstr);
382: $tpl->set('d', 'EDITBUTTON', '');
383: $tpl->set('d', 'DELETEBUTTON', '');
384: $tpl->set('d', 'COLLAPSE', '');
385: $tpl->next();
386: 
387: $dbfsc = new cApiDbfsCollection();
388: 
389: $dlevels = array();
390: 
391: if (is_array($objects)) {
392:     foreach ($objects as $a_file) {
393:         $file = $a_file->name;
394:         $depth = $a_file->custom['level'] - 1;
395:         $pathstring = $a_file->id;
396:         $a_file->collapsed_icon = 'images/grid_expand.gif';
397:         $a_file->expanded_icon = 'images/grid_collapse.gif';
398:         $dlevels[$depth] = $a_file->custom['lastitem'];
399:         $collapse = getUplExpandCollapseButton($a_file);
400:         $fileurl = rawurlencode($path . $file . '/');
401:         $pathurl = rawurlencode($path);
402: 
403:         if ($file == 'tmp') {
404:             echo 'tmp2<br>';
405:         }
406: 
407:         // Indent for every level
408:         $indent = 18 + (($depth - 1) * 18);
409: 
410:         // create javascript multilink
411:         $tmp_mstr = '<a href="javascript:Con.multiLink(\'%s\', \'%s\', \'%s\', \'%s\')">%s</a>';
412:         $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);
413: 
414:         $hasFiles = $dbfsc->hasFiles($pathstring);
415: 
416:         if (!$hasFiles && $perm->have_perm_area_action($tmp_area, 'upl_rmdir')) {
417:             // $deletebutton = '
418:             // <a title="' . i18n("Delete directory") . '"
419:             // href="javascript:void(0)"
420:             // onclick="event.cancelBubble=true;Con.showConfirmation(&quot;' .
421:             // i18n("Do you really want to delete the following directory:") .
422:             // '<b>' . $file . '</b>' . '&quot;, function() {
423:             // deleteDirectory(&quot;' . $pathstring . '&quot;); });return
424:             // false;">
425:             // <img class="vAlignMiddle" src="' . $cfg['path']['images'] .
426:             // 'delete.gif" border="0" title="' . i18n("Delete directory") . '"
427:             // alt="' . i18n("Delete directory") . '">
428:             // </a>';
429:             $deletebutton = '
430:     <a class="jsDelete" title="' . i18n("Delete directory") . '" href="javascript:void(0)">
431:        <img class="vAlignMiddle" src="' . $cfg['path']['images'] . 'delete.gif" border="0" title="' . i18n("Delete directory") . '" alt="' . i18n("Delete directory") . '">
432:     </a>';
433:         } else {
434:             if ($hasFiles) {
435:                 $message = i18n("Directory contains files");
436:             } else {
437:                 $message = i18n("Permission denied");
438:             }
439:             $deletebutton = '<img class="vAlignMiddle" src="' . $cfg['path']['images'] . 'delete_inact.gif" border="0" alt="' . $message . '" title="' . $message . '">';
440:         }
441: 
442:         $gline = '';
443:         for ($i = 1; $i < $depth; $i++) {
444:             if ($dlevels[$i] == false && $i != 0) {
445:                 $gline .= '<img class="vAlignMiddle" src="images/grid_linedown.gif" align="middle">';
446:             } else {
447:                 $gline .= '<img class="vAlignMiddle" src="images/spacer.gif" width="18" height="18" align="middle">';
448:             }
449:         }
450: 
451:         $parent = str_replace($cfgClient[$client]['upl']['path'], '', $a_file->custom['parent']);
452: 
453:         $idAttrPath = str_replace(array(
454:             '/',
455:             ':'
456:         ), array(
457:             '_',
458:             ''
459:         ), trim($pathstring, '/'));
460:         $tpl->set('d', 'ID_PATH', $idDbfsPathPrefix . $idAttrPath);
461:         $tpl->set('d', 'DATA_PATH', $pathstring);
462:         $tpl->set('d', 'INDENT', 0);
463:         $tpl->set('d', 'DIRNAME', $mstr);
464:         $tpl->set('d', 'EDITBUTTON', '');
465:         $tpl->set('d', 'DELETEBUTTON', $deletebutton);
466:         $tpl->set('d', 'COLLAPSE', $gline . $collapse);
467:         $tpl->next();
468:     }
469: }
470: 
471: $pathPrefix = (cApiDbfs::isDbfs($path)) ? $idDbfsPathPrefix : $idFsPathPrefix;
472: $idAttrPath = str_replace(array(
473:     '/',
474:     ':'
475: ), array(
476:     '_',
477:     ''
478: ), trim($path, '/'));
479: $tpl->set('s', 'ID_PATH', $pathPrefix . $idAttrPath);
480: $tpl->set('s', 'DELETE_MSG', i18n("Do you really want to delete the following directory:") . '<b>{path}</b>');
481: 
482: chdir(cRegistry::getBackendPath());
483: 
484: $tpl->generate($cfg['path']['templates'] . $cfg['templates']['upl_dirs_overview']);
485: 
CMS CONTENIDO 4.9.5 API documentation generated by ApiGen 2.8.0