diff --git a/conlite/includes/include.upl_dirs_overview.php b/conlite/includes/include.upl_dirs_overview.php
index 7fd8fb2..99f52bb 100644
--- a/conlite/includes/include.upl_dirs_overview.php
+++ b/conlite/includes/include.upl_dirs_overview.php
@@ -1,15 +1,15 @@
0) {
+if (!(int) $client > 0) {
#if there is no client selected, display empty page
$oPage = new cPage;
$oPage->render();
return;
}
-function getExpandCollapseButton($item)
-{
+function getExpandCollapseButton($item) {
global $sess, $PHP_SELF, $frame, $area, $appendparameters;
$selflink = "main.php";
- if ((is_countable($item->subitems) ? count($item->subitems) : 0) > 0) {
+ if (count($item->subitems) > 0) {
if ($item->collapsed == true) {
$expandlink = $sess->url($selflink . "?area=$area&frame=$frame&appendparameters=$appendparameters&expand=" . $item->id);
return ('');
@@ -56,10 +55,12 @@ function getExpandCollapseButton($item)
$collapselink = $sess->url($selflink . "?area=$area&appendparameters=$appendparameters&frame=$frame&collapse=" . $item->id);
return ('');
}
- } elseif ($item->custom["lastitem"]) {
- return '';
} else {
- return '';
+ if ($item->custom["lastitem"]) {
+ return '';
+ } else {
+ return '';
+ }
}
}
@@ -72,7 +73,7 @@ if (!isset($path) && $sess->is_registered("upl_last_path")) {
$path = $upl_last_path;
}
-if (is_null($path)) {
+if(is_null($path)) {
$path = '';
}
@@ -89,18 +90,20 @@ $uplexpandedList = unserialize($currentuser->getUserProperty("system", "upl_expa
$upldbfsexpandedList = unserialize($currentuser->getUserProperty("system", "upl_dbfs_expandstate"));
if (!is_array($uplexpandedList)) {
- $uplexpandedList = [];
+ $uplexpandedList = array();
}
if (!is_array($upldbfsexpandedList)) {
- $upldbfsexpandedList = [];
+ $upldbfsexpandedList = array();
}
-if ($action == "upl_renamedir" && $perm->have_perm_area_action("upl", "upl_renamedir")) {
- uplRenameDirectory($oldname, $newname, $parent);
- $path = $cfgClient[$client]['upl']['path'] . $parent . $newname . "/";
- if (in_array($cfgClient[$client]['upl']['path'] . $parent . $oldname . "/", $uplexpandedList)) {
- $uplexpandedList[] = $cfgClient[$client]['upl']['path'] . $parent . $newname . "/";
+if ($action == "upl_renamedir") {
+ if ($perm->have_perm_area_action("upl", "upl_renamedir")) {
+ uplRenameDirectory($oldname, $newname, $parent);
+ $path = $cfgClient[$client]['upl']['path'] . $parent . $newname . "/";
+ if (in_array($cfgClient[$client]['upl']['path'] . $parent . $oldname . "/", $uplexpandedList)) {
+ $uplexpandedList[] = $cfgClient[$client]['upl']['path'] . $parent . $newname . "/";
+ }
}
}
@@ -113,22 +116,23 @@ if ($action == "upl_delete") {
if (is_dbfs($path)) {
$dbfs->remove($path . "/.");
} else {
- $failedFiles = [];
/* Check for files */
if (uplHasFiles($path)) {
+ $failedFiles = array();
+
$directory = opendir($cfgClient[$client]["upl"]["path"] . $path);
while (false !== ($dir_entry = readdir($directory))) {
if ($dir_entry != "." && $dir_entry != "..") {
$res = @ unlink($cfgClient[$client]["upl"]["path"] . $path . $dir_entry);
- if (!$res) {
+ if ($res == false) {
$failedFiles[] = $dir_entry;
}
}
}
}
- if ($failedFiles !== []) {
+ if (count($failedFiles) > 0) {
$notification->displayNotification("warning", i18n("Failed to delete the following files:") . "
" . implode("
", $failedFiles));
} else {
$res = @ rmdir($cfgClient[$client]['upl']['path'] . $path);
@@ -150,14 +154,14 @@ $pathstring = '';
*/
$user_upload_path = getEffectiveSetting("upload", "userpath");
-if (is_string($user_upload_path) && !empty($user_upload_path)) {
+if (is_string($user_upload_path) AND!empty($user_upload_path)) {
trim($user_upload_path);
$file = $user_upload_path;
- if (!str_ends_with($user_upload_path, "/")) {
+ if (substr($user_upload_path, -1) != "/") {
$user_upload_path .= "/";
}
$pathstring = $user_upload_path;
- if (!str_ends_with($cfgClient[$client]["upl"]["path"], "/") && str_starts_with($user_upload_path, "/")) {
+ if (substr($cfgClient[$client]["upl"]["path"], -1) != "/" AND substr($user_upload_path, 0, 1) == "/") {
$user_upload_path = substr($user_upload_path, 1);
}
}
@@ -167,7 +171,7 @@ $rootTreeItem->custom["level"] = 0;
$rootTreeItem->name = i18n("Upload directory");
$aInvalidDirectories = uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"] . $user_upload_path, $rootTreeItem, 2);
-if ((is_countable($aInvalidDirectories) ? count($aInvalidDirectories) : 0) > 0) {
+if (count($aInvalidDirectories) > 0) {
$sWarningInfo = i18n('The following directories contains invalid characters and were ignored: ');
$sSeperator = '
';
$sFiles = implode(', ', $aInvalidDirectories);
@@ -183,7 +187,7 @@ if ((is_countable($aInvalidDirectories) ? count($aInvalidDirectories) : 0) > 0)
}
/* Mark all items in the expandedList as expanded */
-foreach ($uplexpandedList as $value) {
+foreach ($uplexpandedList as $key => $value) {
$rootTreeItem->markExpanded($value);
}
@@ -196,23 +200,23 @@ if (is_string($expand)) {
$rootTreeItem->markExpanded($expand);
}
-$uplexpandedList = [];
+$uplexpandedList = Array();
$rootTreeItem->getExpandedList($uplexpandedList);
$currentuser->setUserProperty("system", "upl_expandstate", serialize($uplexpandedList));
-$objects = [];
+$objects = Array();
$rootTreeItem->traverse($objects);
unset($objects[0]);
-$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? cRegistry::getConfigValue('color', 'table_light') : cRegistry::getConfigValue('color', 'table_dark');
+$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
if ($appendparameters == "filebrowser") {
$mtree = new cWidgetTreeView("b58f0ae3-8d4e-4bb3-a754-5f0628863364");
$cattree = conFetchCategoryTree();
- $marray = [];
+ $marray = array();
- foreach ($cattree as $catitem) {
+ foreach ($cattree as $key => $catitem) {
$no_start = true;
$no_online = true;
$no_start = !strHasStartArticle($catitem["idcat"], $lang);
@@ -221,26 +225,44 @@ if ($appendparameters == "filebrowser") {
if ($catitem["visible"] == 1) {
if ($catitem["public"] == 0) {
- $tmp_img = $no_start || $no_online ? "folder_on_error_locked.gif" : "folder_on_locked.gif";
- } elseif ($no_start || $no_online) {
- # Category is public
- # Error found
- $tmp_img = "folder_on_error.gif";
+ if ($no_start || $no_online) {
+ # Error found
+ $tmp_img = "folder_on_error_locked.gif";
+ } else {
+ # No error found
+ $tmp_img = "folder_on_locked.gif";
+ }
} else {
- # No error found
- $tmp_img = "folder_on.gif";
+ # Category is public
+ if ($no_start || $no_online) {
+ # Error found
+ $tmp_img = "folder_on_error.gif";
+ } else {
+ # No error found
+ $tmp_img = "folder_on.gif";
+ }
}
- } elseif ($catitem['public'] == 0) {
- # Category is offline
- # Category is locked
- $tmp_img = $no_start || $no_online ? "folder_off_error_locked.gif" : "folder_off_locked.gif";
- } elseif ($no_start || $no_online) {
- # Category is public
- # Error found
- $tmp_img = "folder_off_error.gif";
} else {
- # No error found
- $tmp_img = "folder_off.gif";
+ # Category is offline
+ if ($catitem['public'] == 0) {
+ # Category is locked
+ if ($no_start || $no_online) {
+ # Error found
+ $tmp_img = "folder_off_error_locked.gif";
+ } else {
+ # No error found
+ $tmp_img = "folder_off_locked.gif";
+ }
+ } else {
+ # Category is public
+ if ($no_start || $no_online) {
+ # Error found
+ $tmp_img = "folder_off_error.gif";
+ } else {
+ # No error found
+ $tmp_img = "folder_off.gif";
+ }
+ }
}
$icon = "./images/" . $tmp_img;
@@ -248,7 +270,7 @@ if ($appendparameters == "filebrowser") {
$idcat = $catitem["idcat"];
$name = ' ' . $catitem["name"] . '';
- $marray[] = ["id" => $catitem["idcat"], "name" => $name, "level" => $catitem["level"], "attributes" => ["icon" => $icon]];
+ $marray[] = array("id" => $catitem["idcat"], "name" => $name, "level" => $catitem["level"], "attributes" => array("icon" => $icon));
}
$mtree->setTreeName(i18n("Categories"));
@@ -265,7 +287,7 @@ if ($appendparameters == "filebrowser") {
$mtree->setCollapsed($collapsed);
$mtree->processParameters();
- $collapsed = [];
+ $collapsed = array();
$mtree->getCollapsedList($collapsed);
$tpl->set('s', 'CATBROWSER', $mtree->render());
@@ -282,8 +304,8 @@ $tpl->set('s', 'SID', $sess->id);
# create javascript multilink
$tmp_mstr = '%s';
$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"),
- '' . $file);
+ 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"),
+ '' . $file);
$tpl->set('d', 'PATH', $pathstring);
$tpl->set('d', 'BGCOLOR', $bgcolor);
@@ -317,10 +339,10 @@ if (is_array($objects)) {
# create javascript multilink # -> better create meaningful comments
$tmp_mstr = '%s';
$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"),
- '' . $file);
+ $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"),
+ '' . $file);
$hasFiles = uplHasFiles($pathstring);
$hasSubdirs = uplHasSubdirs($pathstring);
@@ -328,7 +350,11 @@ if (is_array($objects)) {
if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
$deletebutton = '' . $file . '\', \'deleteDirectory(\\\'' . $pathstring . '\\\')\')">';
} else {
- $message = $hasFiles ? i18n("Directory contains files") : i18n("Permission denied");
+ if ($hasFiles) {
+ $message = i18n("Directory contains files");
+ } else {
+ $message = i18n("Permission denied");
+ }
$deletebutton = "";
}
@@ -377,7 +403,7 @@ $rootTreeItem->custom["level"] = 0;
uplRecursiveDBDirectoryList("", $rootTreeItem, 2);
/* Mark all items in the expandedList as expanded */
-foreach ($upldbfsexpandedList as $value) {
+foreach ($upldbfsexpandedList as $key => $value) {
$rootTreeItem->markExpanded($value);
}
@@ -390,12 +416,12 @@ if (is_string($expand)) {
$rootTreeItem->markExpanded($expand);
}
-$upldbfsexpandedList = [];
+$upldbfsexpandedList = Array();
$rootTreeItem->getExpandedList($upldbfsexpandedList);
$currentuser->setUserProperty("system", "upl_dbfs_expandstate", serialize($upldbfsexpandedList));
-$objects = [];
+$objects = Array();
$rootTreeItem->traverse($objects);
unset($objects[0]);
@@ -404,8 +430,8 @@ $bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["co
$tmp_mstr = '%s';
$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"),
- '' . $file);
+ 'right_bottom', $sess->url("main.php?area=$area&frame=4&path=$pathstring&appendparameters=$appendparameters"),
+ '' . $file);
$tpl->set('d', 'PATH', $pathstring);
$tpl->set('d', 'BGCOLOR', $bgcolor);
@@ -418,17 +444,17 @@ $tpl->next();
$dbfsc = new DBFSCollection;
-$dlevels = [];
+$dlevels = array();
if (is_array($objects)) {
- foreach ($objects as $object) {
- $file = $object->name;
- $depth = $object->custom["level"] - 1;
- $pathstring = $object->id;
- $object->collapsed_icon = "images/grid_expand.gif";
- $object->expanded_icon = "images/grid_collapse.gif";
- $dlevels[$depth] = $object->custom["lastitem"];
- $collapse = getExpandCollapseButton($object);
+ foreach ($objects as $a_file) {
+ $file = $a_file->name;
+ $depth = $a_file->custom["level"] - 1;
+ $pathstring = $a_file->id;
+ $a_file->collapsed_icon = "images/grid_expand.gif";
+ $a_file->expanded_icon = "images/grid_collapse.gif";
+ $dlevels[$depth] = $a_file->custom["lastitem"];
+ $collapse = getExpandCollapseButton($a_file);
$fileurl = rawurlencode($path . $file . '/');
$pathurl = rawurlencode($path);
@@ -448,15 +474,19 @@ if (is_array($objects)) {
# create javascript multilink
$tmp_mstr = '%s';
$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"),
- '' . $file);
+ 'right_top', $sess->url("main.php?area=$area&frame=3&path=$pathstring&appendparameters=$appendparameters"),
+ '' . $file);
$hasFiles = $dbfsc->hasFiles($pathstring);
if (!$hasFiles && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
$deletebutton = '' . $file . '\', \'deleteDirectory(\\\'' . $pathstring . '\\\')\')">';
} else {
- $message = $hasFiles ? i18n("Directory contains files") : i18n("Permission denied");
+ if ($hasFiles) {
+ $message = i18n("Directory contains files");
+ } else {
+ $message = i18n("Permission denied");
+ }
$deletebutton = "";
}
@@ -477,7 +507,7 @@ if (is_array($objects)) {
}
}
- $parent = str_replace($cfgClient[$client]['upl']['path'], "", $object->custom["parent"]);
+ $parent = str_replace($cfgClient[$client]['upl']['path'], "", $a_file->custom["parent"]);
$tpl->set('d', 'DIRNAME', $mstr);
$tpl->set('d', 'EDITBUTTON', '');
$tpl->set('d', 'DELETEBUTTON', $deletebutton);