diff --git a/.gitignore b/.gitignore
index 3a734c4..052815a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@
!/cms/data/layouts/
/cms/data/layouts/*
/conlite/includes/include.style_edit_form_1.php
+/cms/config.local.php
+/cms/dflip/
diff --git a/cms/upload/.gitignore b/cms/upload/.gitignore
new file mode 100644
index 0000000..70825cd
--- /dev/null
+++ b/cms/upload/.gitignore
@@ -0,0 +1,6 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
+!/Flexslider
+!/Gallery
\ No newline at end of file
diff --git a/conlite/classes/con2con/class.filehandler.php b/conlite/classes/con2con/class.filehandler.php
index d8300e8..a0bd96f 100644
--- a/conlite/classes/con2con/class.filehandler.php
+++ b/conlite/classes/con2con/class.filehandler.php
@@ -443,15 +443,13 @@ class cFileHandler {
* true if the given filename is valid, false otherwise
*/
public static function validateFilename($filename, $notifyAndExitOnFailure = true) {
+
+ $notification = new Contenido_Notification();
// check if filename only contains valid characters
if (preg_match('/[^a-z0-9._-]/i', $filename)) {
// validation failure...
if ($notifyAndExitOnFailure) {
- // display notification and exit
- cRegistry::addErrorMessage(i18n('Wrong file name.'));
- $page = new cGuiPage('generic_page');
- $page->abortRendering();
- $page->render();
+ $notification->displayNotification("error", i18n("Please insert file name."));
exit();
}
@@ -463,7 +461,6 @@ class cFileHandler {
// validation failure...
if ($notifyAndExitOnFailure) {
// display notification and exit
- $notification = new cGuiNotification();
$notification->displayNotification("error", i18n("Please insert file name."));
exit();
}
diff --git a/conlite/classes/template/class.template.php b/conlite/classes/template/class.template.php
index fe15000..8004a23 100644
--- a/conlite/classes/template/class.template.php
+++ b/conlite/classes/template/class.template.php
@@ -194,7 +194,7 @@ class Template {
$sModName = strtolower(uplCreateFriendlyName($tmpModule->get('name')));
$aModFileEditConf = $tmpModule->getModFileEditConf();
unset($tmpModule);
- $sTmpPath = $aModFileEditConf['modPath'] . $sModName . "/template/" . $template;
+ $sTmpPath = $aModFileEditConf['modPath'] . $sModName . "/template/" . str_replace('templates/', '', $template);
if (is_readable($sTmpPath)) {
$template = $sTmpPath;
$bModTplUsed = TRUE;
diff --git a/conlite/includes/functions.file.php b/conlite/includes/functions.file.php
index f0d8088..f1fa2dd 100644
--- a/conlite/includes/functions.file.php
+++ b/conlite/includes/functions.file.php
@@ -1,4 +1,5 @@
query($sSql);
@@ -82,7 +82,7 @@ function removeFileInformation($iIdClient, $sFilename, $sType, $oDb) {
* description - Description which was inserted for this file
*
*/
-function getFileInformation ($iIdClient, $sFilename, $sType, $oDb) {
+function getFileInformation($iIdClient, $sFilename, $sType, $oDb) {
global $cfg;
if (!isset($oDb) || !is_object($oDb)) {
@@ -94,7 +94,7 @@ function getFileInformation ($iIdClient, $sFilename, $sType, $oDb) {
$sType = Contenido_Security::filter((string) $sType, $oDb);
$aFileInformation = array();
- $sSql = "SELECT * FROM `".$cfg["tab"]["file_information"]."` WHERE idclient=$iIdClient AND
+ $sSql = "SELECT * FROM `" . $cfg["tab"]["file_information"] . "` WHERE idclient=$iIdClient AND
filename='$sFilename' AND
type='$sType';";
$oDb->query($sSql);
@@ -145,13 +145,13 @@ function updateFileInformation($iIdClient, $sFilename, $sType, $sAuthor, $sDescr
$sDescription = Contenido_Security::filter((string) stripslashes($sDescription), $oDb);
$sAuthor = Contenido_Security::filter((string) $sAuthor, $oDb);
- $sSql = "SELECT * from `".$cfg["tab"]["file_information"]."` WHERE idclient=$iIdClient AND
+ $sSql = "SELECT * from `" . $cfg["tab"]["file_information"] . "` WHERE idclient=$iIdClient AND
filename='$sFilename' AND
type='$sType';";
$oDb->query($sSql);
if ($oDb->num_rows() == 0) {
$iNextId = $oDb->nextid('con_style_file_information');
- $sSql = "INSERT INTO `".$cfg["tab"]["file_information"]."` ( `idsfi` ,
+ $sSql = "INSERT INTO `" . $cfg["tab"]["file_information"] . "` ( `idsfi` ,
`idclient` ,
`type` ,
`filename` ,
@@ -172,7 +172,7 @@ function updateFileInformation($iIdClient, $sFilename, $sType, $sAuthor, $sDescr
'$sDescription'
);";
} else {
- $sSql = "UPDATE `".$cfg["tab"]["file_information"]."` SET `lastmodified` = NOW(),
+ $sSql = "UPDATE `" . $cfg["tab"]["file_information"] . "` SET `lastmodified` = NOW(),
`modifiedby` = '$sAuthor',
`description` = '$sDescription',
`filename` = '$sFilenameNew'
@@ -187,7 +187,6 @@ function updateFileInformation($iIdClient, $sFilename, $sType, $sAuthor, $sDescr
$oDb->free();
}
-
/**
* Writes passed data into a file using binary mode.
*
@@ -199,44 +198,31 @@ function updateFileInformation($iIdClient, $sFilename, $sType, $sAuthor, $sDescr
* @return (string|void) Either content of file o nothing
*/
function fileEdit($filename, $sCode, $path) {
- global $notification;
+ $oNot = new Contenido_Notification();
// FIXME: fileValidateFilename does also the validation but display another message!
if (strlen(trim($filename)) == 0) {
- $notification->displayNotification("error", i18n("Please insert filename."));
+ $oNot->displayNotification("error", i18n("Please insert filename."));
return false;
}
+ cFileHandler::validateFilename($filename);
- fileValidateFilename($filename, true);
-
- // FIXME: Should be replaced against file_put_contents($path . $filename, FILE_BINARY | LOCK_EX | FILE_APPEND)
-
- if (is_writable($path.$filename)) {
+ if (is_writable($path . $filename)) {
if (strlen(stripslashes(trim($sCode))) > 0) {
- # open file
- if (!$handle = fopen($path.$filename, "wb+")) {
- $notification->displayNotification("error", sprintf(i18n("Could not open file %s"), $path.$filename));
- exit;
+ if (!empty($sCode)) {
+ $sCode = mb_convert_encoding($sCode, 'UTF-8', 'OLD-ENCODING');
}
- # write file
- if (!fwrite($handle, stripslashes($sCode))) {
- $notification->displayNotification("error", sprintf(i18n("Could not write file %s"), $path.$filename));
- exit;
- }
-
- fclose($handle);
+ cFileHandler::write($path . $filename, $sCode);
return true;
-
} else {
return false;
}
} else {
- $notification->displayNotification("error", sprintf(i18n("%s is not writable"), $path.$filename));
+ $oNot->displayNotification("error", sprintf(i18n("%s is not writable"), $path . $filename));
exit;
}
}
-
/**
* Reads content of file into memory using binary mode and returns it back.
*
@@ -247,28 +233,13 @@ function fileEdit($filename, $sCode, $path) {
* @return (string|void) Either content of file o nothing
*/
function getFileContent($filename, $path) {
- global $notification;
-
- // FIXME: Should be replaced against file_get_contents($path . $filename, FILE_BINARY)
-
- if (!$handle = fopen($path.$filename, "rb")) {
- $notification->displayNotification("error", sprintf(i18n("Can not open file%s "), $path.$filename));
- exit;
- }
-
- do {
- $_data = fread($handle, 4096);
- if (strlen($_data) == 0) {
- break;
- }
- $sFileContents .= $_data;
- } while(true);
-
- fclose($handle);
- return $sFileContents;
+ $sCode = cFileHandler::read($path . $filename);
+ if (!empty($sCode)) {
+ $sCode = mb_convert_encoding($sCode, 'UTF-8', 'OLD-ENCODING');
+ }
+ return $sCode;
}
-
/**
* Returns the filetype (extension).
*
@@ -280,7 +251,6 @@ function getFileType($filename) {
return $aFileName[count($aFileName) - 1];
}
-
/**
* Creates a file.
*
@@ -291,26 +261,18 @@ function getFileType($filename) {
* @return (void|bool) Either true on success or nothing
*/
function createFile($filename, $path) {
- global $notification;
+ $oNot = new Contenido_Notification();
- fileValidateFilename($filename, true);
+ cFileHandler::validateFilename($filename);
- # create the file
- if (touch($path.$filename)) {
- # change file access permission
- if(chmod ($path.$filename, 0777)) {
- return true;
- } else {
- $notification->displayNotification("error", $path.$filename." ".i18n("Unable to change file access permission."));
- exit;
- }
+ if (cFileHandler::create($path . $filename)) {
+ return true;
} else {
- $notification->displayNotification("error", sprintf(i18n("Unable to create file %s"), $path.$filename));
+ $oNot->displayNotification("error", sprintf(i18n("Unable to create file %s"), $path . $filename));
exit;
}
}
-
/**
* Renames a existing file.
*
@@ -322,25 +284,24 @@ function createFile($filename, $path) {
* @return (void|string) Either new filename or nothing
*/
function renameFile($sOldFile, $sNewFile, $path) {
- global $notification;
+ $oNot = new Contenido_Notification();
fileValidateFilename($sNewFile, true);
- if (is_writable($path.$sOldFile)) {
+ if (is_writable($path . $sOldFile)) {
# rename file
- if (rename($path.$sOldFile, $path.$sNewFile)) {
+ if (rename($path . $sOldFile, $path . $sNewFile)) {
return $sNewFile;
} else {
- $notification->displayNotification("error", sprintf(i18n("Can not rename file %s"),$path.$sOldFile));
+ $oNot->displayNotification("error", sprintf(i18n("Can not rename file %s"), $path . $sOldFile));
exit;
}
} else {
- $notification->displayNotification("error", sprintf(i18n("%s is not writable"), $path.$sOldFile));
+ $oNot->displayNotification("error", sprintf(i18n("%s is not writable"), $path . $sOldFile));
exit;
}
}
-
/**
* Validates passed filename. Filename can contain alphanumeric characters, dot, underscore or a hyphen.
*
@@ -352,13 +313,13 @@ function renameFile($sOldFile, $sNewFile, $path) {
* @return (void|bool) Either validation result or nothing (depends on second parameter)
*/
function fileValidateFilename($filename, $notifyAndExitOnFailure = true) {
- global $notification;
-
+
if (preg_match('/[^a-z0-9._-]/i', $filename)) {
// validation failure...
if ($notifyAndExitOnFailure == true) {
+ $oNot = new Contenido_Notification();
// display notification and exit
- $notification->displayNotification('error', i18n('Wrong filename.'));
+ $oNot->displayNotification('error', i18n('Wrong filename.'));
exit;
}
return false;
diff --git a/conlite/includes/include.js_edit_form.php b/conlite/includes/include.js_edit_form.php
index dd6e247..5ea649d 100644
--- a/conlite/includes/include.js_edit_form.php
+++ b/conlite/includes/include.js_edit_form.php
@@ -1,4 +1,5 @@
reset();
-if (!$perm->have_perm_area_action($area, $action))
-{
+if (!$perm->have_perm_area_action($area, $action)) {
$notification->displayNotification("error", i18n("Permission denied"));
} else if (!(int) $client > 0) {
- #if there is no client selected, display empty page
- $page->render();
+ #if there is no client selected, display empty page
+ $page->render();
} else {
$path = $cfgClient[$client]["js"]["path"];
- $sTempFilename = stripslashes($_REQUEST['tmp_file']);
+ $sTempFilename = stripslashes($_REQUEST['tmp_file']);
$sOrigFileName = $sTempFilename;
-
- if (getFileType($_REQUEST['file']) != $sFileType AND strlen(stripslashes(trim($_REQUEST['file']))) > 0)
- {
- $sFilename .= stripslashes($_REQUEST['file']).".$sFileType";
- }else
- {
- $sFilename .= stripslashes($_REQUEST['file']);
+
+ if (getFileType($_REQUEST['file']) != $sFileType AND strlen(stripslashes(trim($_REQUEST['file']))) > 0) {
+ $sFilename .= stripslashes($_REQUEST['file']) . ".$sFileType";
+ } else {
+ $sFilename .= stripslashes($_REQUEST['file']);
}
-
+
if (stripslashes($_REQUEST['file'])) {
$sReloadScript = "";
} else {
$sReloadScript = "";
}
-
+
// Content Type is template
- $sTypeContent = "js";
- $aFileInfo = getFileInformation ($client, $sTempFilename, $sTypeContent, $db);
-
- # create new file
- if ( $_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send')
- {
- $sTempFilename = $sFilename;
- createFile($sFilename, $path);
- $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
+ $sTypeContent = "js";
+ $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
+
+ # create new file
+ if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') {
+ $sTempFilename = $sFilename;
+ createFile($sFilename, $path);
+ $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
updateFileInformation($client, $sFilename, 'js', $auth->auth['uid'], $_REQUEST['description'], $db);
$sReloadScript .= "";
}
- # edit selected file
- if ( $_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send')
- {
- if ($sFilename != $sTempFilename)
- {
- $sTempFilename = renameFile($sTempFilename, $sFilename, $path);
+ # edit selected file
+ if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') {
+ if ($sFilename != $sTempFilename) {
+ $sTempFilename = renameFile($sTempFilename, $sFilename, $path);
$sReloadScript .= "";
- }else
- {
- $sTempFilename = $sFilename;
- }
-
- updateFileInformation($client, $sOrigFileName, 'js', $auth->auth['uid'], $_REQUEST['description'], $db, $sFilename);
-
+ } else {
+ $sTempFilename = $sFilename;
+ }
+
+ updateFileInformation($client, $sOrigFileName, 'js', $auth->auth['uid'], $_REQUEST['description'], $db, $sFilename);
+
/**
- * START TRACK VERSION
- **/
- if((count($aFileInfo) == 0) || ((int)$aFileInfo["idsfi"] == 0)) {
- $aFileInfo = getFileInformation ($client, $sTempFilename, $sTypeContent, $db);
+ * START TRACK VERSION
+ * */
+ if ((count($aFileInfo) == 0) || ((int) $aFileInfo["idsfi"] == 0)) {
+ $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
$aFileInfo['description'] = '';
}
-
- if(count($aFileInfo) > 0 && $aFileInfo["idsfi"] !="") {
+
+ if (count($aFileInfo) > 0 && $aFileInfo["idsfi"] != "") {
$oVersion = new VersionFile($aFileInfo["idsfi"], $aFileInfo, $sFilename, $sTypeContent, $cfg, $cfgClient, $db, $client, $area, $frame, $sOrigFileName);
// Create new Jscript Version in cms/version/js/ folder
$oVersion->createNewVersion();
}
-
- /**
- * END TRACK VERSION
- **/
-
- $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
-
- }
-
- # generate edit form
- if (isset($_REQUEST['action']))
- {
+
+ /**
+ * END TRACK VERSION
+ * */
+ $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
+ }
+
+ # generate edit form
+ if (isset($_REQUEST['action'])) {
$aFileInfo = getFileInformation($client, $sFilename, $sTypeContent, $db);
-
- $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action'];
-
- if ($_REQUEST['action'] == $sActionEdit)
- {
- $sCode = getFileContent($sFilename, $path);
- }else
- {
- $sCode = stripslashes($_REQUEST['code']); # stripslashes is required here in case of creating a new file
- }
-
+
+ $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action'];
+
+ if ($_REQUEST['action'] == $sActionEdit) {
+ $sCode = getFileContent($sFilename, $path);
+ } else {
+ $sCode = stripslashes($_REQUEST['code']); # stripslashes is required here in case of creating a new file
+ }
+
$form = new UI_Table_Form("file_editor");
$form->addHeader(i18n("Edit file"));
$form->setWidth("100%");
@@ -163,28 +151,26 @@ if (!$perm->have_perm_area_action($area, $action))
$form->setVar("frame", $frame);
$form->setVar("status", 'send');
$form->setVar("tmp_file", $sTempFilename);
-
+
$tb_name = new cHTMLTextbox("file", $sFilename, 60);
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code");
- $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
-
+ $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
+
$ta_code->setStyle("font-family: monospace;width: 100%;");
$descr->setStyle("font-family: monospace;width: 100%;");
$ta_code->updateAttributes(array("wrap" => getEffectiveSetting('script_editor', 'wrap', 'off')));
-
- $form->add(i18n("Name"),$tb_name);
+
+ $form->add(i18n("Name"), $tb_name);
$form->add(i18n("Description"), $descr->render());
- $form->add(i18n("Code"),$ta_code);
-
+ $form->add(i18n("Code"), $ta_code);
+
$page->setContent($form->render());
-
+
$oEditArea = new EditArea('code', 'js', substr(strtolower($belang), 0, 2), true, $cfg);
$page->addScript('editarea', $oEditArea->renderScript());
-
+
$page->addScript('reload', $sReloadScript);
- $page->render();
-
+ $page->render();
}
}
-
?>
\ No newline at end of file
diff --git a/conlite/includes/include.style_edit_form.php b/conlite/includes/include.style_edit_form.php
index 2b549e4..68047d6 100644
--- a/conlite/includes/include.style_edit_form.php
+++ b/conlite/includes/include.style_edit_form.php
@@ -1,4 +1,5 @@
setEncoding("utf-8");
$tpl->reset();
-if (!$perm->have_perm_area_action($area, $action))
-{
+if (!$perm->have_perm_area_action($area, $action)) {
$notification->displayNotification("error", i18n("Permission denied"));
} else if (!(int) $client > 0) {
- #if there is no client selected, display empty page
- $page->render();
-} else {
+ #if there is no client selected, display empty page
+ $page->render();
+} else {
$path = $cfgClient[$client]["css"]["path"];
if (stripslashes($_REQUEST['file'])) {
$sReloadScript = "";
@@ -68,114 +67,102 @@ if (!$perm->have_perm_area_action($area, $action))
$sReloadScript = "";
}
- $sTempFilename = stripslashes($_REQUEST['tmp_file']);
+ $sTempFilename = stripslashes($_REQUEST['tmp_file']);
$sOrigFileName = $sTempFilename;
-
- if (getFileType($_REQUEST['file']) != $sFileType AND strlen(stripslashes(trim($_REQUEST['file']))) > 0)
- {
- $sFilename .= stripslashes($_REQUEST['file']).".$sFileType";
- }else
- {
- $sFilename .= stripslashes($_REQUEST['file']);
+
+ if (getFileType($_REQUEST['file']) != $sFileType AND strlen(stripslashes(trim($_REQUEST['file']))) > 0) {
+ $sFilename .= stripslashes($_REQUEST['file']) . ".$sFileType";
+ } else {
+ $sFilename .= stripslashes($_REQUEST['file']);
}
-
+
if (stripslashes($_REQUEST['file'])) {
$sReloadScript = "";
} else {
$sReloadScript = "";
- }
-
+ }
+
// Content Type is css
- $sTypeContent = "css";
- $aFileInfo = getFileInformation ($client, $sTempFilename, $sTypeContent, $db);
-
- # create new file
- if ( $_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send')
- {
- $sTempFilename = $sFilename;
- createFile($sFilename, $path);
- $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
+ $sTypeContent = "css";
+ $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
+
+ # create new file
+ if ($_REQUEST['action'] == $sActionCreate AND $_REQUEST['status'] == 'send') {
+ $sTempFilename = $sFilename;
+ createFile($sFilename, $path);
+ $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
updateFileInformation($client, $sFilename, 'css', $auth->auth['uid'], $_REQUEST['description'], $db);
$sReloadScript .= "";
}
- # edit selected file
- if ( $_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send')
- {
- if ($sFilename != $sTempFilename)
- {
- $sTempFilename = renameFile($sTempFilename, $sFilename, $path);
+ # edit selected file
+ if ($_REQUEST['action'] == $sActionEdit AND $_REQUEST['status'] == 'send') {
+ if ($sFilename != $sTempFilename) {
+ $sTempFilename = renameFile($sTempFilename, $sFilename, $path);
$sReloadScript .= "";
- }else
- {
- $sTempFilename = $sFilename;
- }
-
-
+ } else {
+ $sTempFilename = $sFilename;
+ }
+
+
updateFileInformation($client, $sOrigFileName, 'css', $auth->auth['uid'], $_REQUEST['description'], $db, $sFilename);
-
- /**
- * START TRACK VERSION
- **/
+
+ /**
+ * START TRACK VERSION
+ * */
// For read Fileinformation an get the id of current File
cInclude("includes", "functions.file.php");
-
- if((count($aFileInfo) == 0) || ((int)$aFileInfo["idsfi"] == 0)) {
- $aFileInfo = getFileInformation ($client, $sTempFilename, $sTypeContent, $db);
+
+ if ((count($aFileInfo) == 0) || ((int) $aFileInfo["idsfi"] == 0)) {
+ $aFileInfo = getFileInformation($client, $sTempFilename, $sTypeContent, $db);
$aFileInfo['description'] = '';
}
-
- if((count($aFileInfo) == 0) || ($aFileInfo["idsfi"] !="")) {
- $oVersion = new VersionFile($aFileInfo["idsfi"], $aFileInfo, $sFilename, $sTypeContent, $cfg, $cfgClient, $db, $client, $area, $frame, $sOrigFileName);
+
+ if ((count($aFileInfo) == 0) || ($aFileInfo["idsfi"] != "")) {
+ $oVersion = new VersionFile($aFileInfo["idsfi"], $aFileInfo, $sFilename, $sTypeContent, $cfg, $cfgClient, $db, $client, $area, $frame, $sOrigFileName);
// Create new version
$oVersion->createNewVersion();
}
- /**
- * END TRACK VERSION
- **/
-
-
- $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
-
- }
-
- # generate edit form
- if (isset($_REQUEST['action'])) {
-
- $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action'];
-
- if ($_REQUEST['action'] == $sActionEdit)
- {
- $sCode = getFileContent($sFilename, $path);
- }else
- {
- $sCode = stripslashes($_REQUEST['code']); # stripslashes is required here in case of creating a new file
- }
-
- $aFileInfo = getFileInformation ($client, $sTempFilename, "css", $db);
+ /**
+ * END TRACK VERSION
+ * */
+ $bEdit = fileEdit($sFilename, $_REQUEST['code'], $path);
+ }
+
+ # generate edit form
+ if (isset($_REQUEST['action'])) {
+
+ $sAction = ($bEdit) ? $sActionEdit : $_REQUEST['action'];
+
+ if ($_REQUEST['action'] == $sActionEdit) {
+ $sCode = getFileContent($sFilename, $path);
+ } else {
+ $sCode = stripslashes($_REQUEST['code']); # stripslashes is required here in case of creating a new file
+ }
+
+ $aFileInfo = getFileInformation($client, $sTempFilename, "css", $db);
-
$form = new UI_Table_Form("file_editor");
$form->addHeader(i18n("Edit file"));
$form->setWidth("100%");
@@ -184,28 +171,26 @@ if (!$perm->have_perm_area_action($area, $action))
$form->setVar("frame", $frame);
$form->setVar("status", 'send');
$form->setVar("tmp_file", $sTempFilename);
-
+
$tb_name = new cHTMLTextbox("file", $sFilename, 60);
$ta_code = new cHTMLTextarea("code", clHtmlSpecialChars($sCode), 100, 35, "code");
- $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
+ $descr = new cHTMLTextarea("description", clHtmlSpecialChars($aFileInfo["description"]), 100, 5);
-
$ta_code->setStyle("font-family: monospace;width: 100%;");
$descr->setStyle("font-family: monospace;width: 100%;");
$ta_code->updateAttributes(array("wrap" => getEffectiveSetting('style_editor', 'wrap', 'off')));
-
- $form->add(i18n("Name"),$tb_name);
+
+ $form->add(i18n("Name"), $tb_name);
$form->add(i18n("Description"), $descr->render());
- $form->add(i18n("Code"),$ta_code);
-
+ $form->add(i18n("Code"), $ta_code);
+
$page->setContent($form->render());
-
+
$oEditArea = new EditArea('code', 'css', substr(strtolower($belang), 0, 2), true, $cfg);
$page->addScript('editarea', $oEditArea->renderScript());
-
+
$page->addScript('reload', $sReloadScript);
- $page->render();
+ $page->render();
}
}
-
?>
\ No newline at end of file
diff --git a/conlite/includes/include.style_files_overview.php b/conlite/includes/include.style_files_overview.php
index c6bea75..bb01ed7 100644
--- a/conlite/includes/include.style_files_overview.php
+++ b/conlite/includes/include.style_files_overview.php
@@ -1,4 +1,5 @@
reset();
if (!(int) $client > 0) {
- #if there is no client selected, display empty page
- $oPage = new cPage;
- $oPage->render();
- return;
+ #if there is no client selected, display empty page
+ $oPage = new cPage;
+ $oPage->render();
+ return;
}
$path = $cfgClient[$client]["css"]["path"];
@@ -55,7 +55,7 @@ $sActionEdit = 'style_edit';
$sScriptTemplate = '
-
+
';
$tpl->set('s', 'JAVASCRIPT', $sScriptTemplate);
# delete file
-if ($action == $sActionDelete)
-{
- if (!strrchr($_REQUEST['delfile'], "/"))
- {
- if (file_exists($path.$_REQUEST['delfile']))
- {
- unlink($path.$_REQUEST['delfile']);
+if ($action == $sActionDelete) {
+ if (!strrchr($_REQUEST['delfile'], "/")) {
+ if (file_exists($path . $_REQUEST['delfile'])) {
+ unlink($path . $_REQUEST['delfile']);
removeFileInformation($client, $_REQUEST['delfile'], 'css', $db);
}
}
-
}
-if ($handle = opendir($path))
-{
+// show folders
+
+function scanAllDir($dir, $sFileType = null, $bShowEmptyDir = false) {
+ $result = [];
+ foreach (scandir($dir) as $filename) {
+ if ($filename[0] === '.')
+ continue;
+ $filePath = $dir . DIRECTORY_SEPARATOR . $filename;
+ if (is_dir($filePath)) {
+ $tmp = [];
+ foreach (scanAllDir($filePath, $sFileType) as $childFilename) {
+ if (is_null($sFileType) || pathinfo($filePath . DIRECTORY_SEPARATOR . $childFilename, PATHINFO_EXTENSION) == $sFileType) {
+ $tmp[] = $childFilename;
+ }
+ }
+ if ($bShowEmptyDir || !empty($tmp)) {
+ $result[] = array(
+ 'folder' => $filename,
+ 'files' => $tmp
+ );
+ }
+ unset($tmp);
+ } else {
+ if (is_null($sFileType) || pathinfo($filePath, PATHINFO_EXTENSION) == $sFileType) {
+ $result[] = $filename;
+ }
+ }
+ }
+ return $result;
+}
+
+echo "
";
+print_r(scanAllDir($path, 'css', true));
+
+if ($handle = opendir($path)) {
$aFiles = array();
-
- while ($file = readdir($handle))
- {
- if(substr($file, (strlen($file) - (strlen($sFileType) + 1)), (strlen($sFileType) + 1)) == ".$sFileType" AND is_readable($path.$file))
- {
- $aFiles[] = $file;
- }elseif (substr($file, (strlen($file) - (strlen($sFileType) + 1)), (strlen($sFileType) + 1)) == ".$sFileType" AND !is_readable($path.$file))
- {
- $notification->displayNotification("error", $file." ".i18n("is not readable!"));
+
+ while ($file = readdir($handle)) {
+ if (substr($file, (strlen($file) - (strlen($sFileType) + 1)), (strlen($sFileType) + 1)) == ".$sFileType" AND is_readable($path . $file)) {
+ $aFiles[] = $file;
+ } elseif (substr($file, (strlen($file) - (strlen($sFileType) + 1)), (strlen($sFileType) + 1)) == ".$sFileType" AND!is_readable($path . $file)) {
+ $notification->displayNotification("error", $file . " " . i18n("is not readable!"));
}
}
closedir($handle);
-
+
// display files
- if (is_array($aFiles))
- {
-
- sort($aFiles);
-
- foreach ($aFiles as $filename)
- {
-
+ if (is_array($aFiles)) {
+
+ sort($aFiles);
+
+ foreach ($aFiles as $filename) {
+
$bgcolor = ( is_int($tpl->dyn_cnt / 2) ) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
$tpl->set('d', 'BGCOLOR', $bgcolor);
-
+
$tmp_mstr = '%s';
- $html_filename = sprintf($tmp_mstr, 'right_top',
- $sess->url("main.php?area=$area&frame=3&file=$filename"),
- 'right_bottom',
- $sess->url("main.php?area=$area&frame=4&action=$sActionEdit&file=$filename&tmp_file=$filename"),
- $filename, $filename, clHtmlSpecialChars($filename));
-
+ $html_filename = sprintf($tmp_mstr, 'right_top',
+ $sess->url("main.php?area=$area&frame=3&file=$filename"),
+ 'right_bottom',
+ $sess->url("main.php?area=$area&frame=4&action=$sActionEdit&file=$filename&tmp_file=$filename"),
+ $filename, $filename, clHtmlSpecialChars($filename));
+
$tpl->set('d', 'FILENAME', $html_filename);
-
+
$delTitle = i18n("Delete File");
- $delDescr = sprintf(i18n("Do you really want to delete the following file:
%s
"),$filename);
-
- if ($perm->have_perm_area_action('style', $sActionDelete))
- {
- $tpl->set('d', 'DELETE', '');
- }else
- {
- $tpl->set('d', 'DELETE', '');
+ $delDescr = sprintf(i18n("Do you really want to delete the following file:
%s
"), $filename);
+
+ if ($perm->have_perm_area_action('style', $sActionDelete)) {
+ $tpl->set('d', 'DELETE', '');
+ } else {
+ $tpl->set('d', 'DELETE', '');
}
-
+
if (stripslashes($_REQUEST['file']) == $filename) {
$tpl->set('d', 'ID', 'id="marked"');
} else {
$tpl->set('d', 'ID', '');
}
-
+
$tpl->next();
-
- }
+ }
}
-}else
-{
+} else {
if ((int) $client > 0) {
- $notification->displayNotification("error", i18n("Directory is not existing or readable!")."
$path");
+ $notification->displayNotification("error", i18n("Directory is not existing or readable!") . "
$path");
}
}
$tpl->generate($cfg['path']['templates'] . $cfg['templates']['files_overview']);
-
?>
\ No newline at end of file
diff --git a/conlite/includes/include.upl_dirs_overview.php b/conlite/includes/include.upl_dirs_overview.php
index d5c481f..d9535ee 100644
--- a/conlite/includes/include.upl_dirs_overview.php
+++ b/conlite/includes/include.upl_dirs_overview.php
@@ -1,4 +1,5 @@
0) {
- #if there is no client selected, display empty page
- $oPage = new cPage;
- $oPage->render();
- return;
+ #if there is no client selected, display empty page
+ $oPage = new cPage;
+ $oPage->render();
+ return;
}
-function getExpandCollapseButton($item)
-{
- global $sess, $PHP_SELF, $frame, $area, $appendparameters;
- $selflink = "main.php";
+function getExpandCollapseButton($item) {
+ global $sess, $PHP_SELF, $frame, $area, $appendparameters;
+ $selflink = "main.php";
- if (count($item->subitems) > 0)
- {
- if ($item->collapsed == true)
- {
- $expandlink = $sess->url($selflink."?area=$area&frame=$frame&appendparameters=$appendparameters&expand=".$item->id);
- return ('');
- } else
- {
- $collapselink = $sess->url($selflink."?area=$area&appendparameters=$appendparameters&frame=$frame&collapse=".$item->id);
- return ('');
- }
- } else
- {
- if ($item->custom["lastitem"])
- {
- return '';
- } else
- {
- return '';
- }
- }
+ if (count($item->subitems) > 0) {
+ if ($item->collapsed == true) {
+ $expandlink = $sess->url($selflink . "?area=$area&frame=$frame&appendparameters=$appendparameters&expand=" . $item->id);
+ return ('');
+ } else {
+ $collapselink = $sess->url($selflink . "?area=$area&appendparameters=$appendparameters&frame=$frame&collapse=" . $item->id);
+ return ('');
+ }
+ } else {
+ if ($item->custom["lastitem"]) {
+ return '';
+ } else {
+ return '';
+ }
+ }
}
#################
@@ -76,44 +69,38 @@ function getExpandCollapseButton($item)
#################
#Fixxed by Timo Trautmann double database entries also called by action upl_mkdir
// Use remembered path from upl_last_path (from session)
-if (!isset($path) && $sess->is_registered("upl_last_path"))
-{
- $path = $upl_last_path;
+if (!isset($path) && $sess->is_registered("upl_last_path")) {
+ $path = $upl_last_path;
}
-$appendparameters = $_REQUEST["appendparameters"];
+$appendparameters = $_REQUEST["appendparameters"];
-if (!isset ($action))
- $action = "";
+if (!isset($action))
+ $action = "";
if ($tmp_area == "") {
- $tmp_area = $area; // $tmp_area used at two places for unknown reasons...
+ $tmp_area = $area; // $tmp_area used at two places for unknown reasons...
}
-$uplexpandedList = unserialize($currentuser->getUserProperty("system", "upl_expandstate"));
-$upldbfsexpandedList = unserialize($currentuser->getUserProperty("system", "upl_dbfs_expandstate"));
+$uplexpandedList = unserialize($currentuser->getUserProperty("system", "upl_expandstate"));
+$upldbfsexpandedList = unserialize($currentuser->getUserProperty("system", "upl_dbfs_expandstate"));
-if (!is_array($uplexpandedList))
-{
- $uplexpandedList = array ();
+if (!is_array($uplexpandedList)) {
+ $uplexpandedList = array();
}
-if (!is_array($upldbfsexpandedList))
-{
- $upldbfsexpandedList = array ();
+if (!is_array($upldbfsexpandedList)) {
+ $upldbfsexpandedList = array();
}
-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."/";
- }
- }
+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 . "/";
+ }
+ }
}
###################
@@ -121,45 +108,35 @@ if ($action == "upl_renamedir")
###################
$dbfs = new DBFSCollection;
-if ($action == "upl_delete")
-{
- if (is_dbfs($path))
- {
- $dbfs->remove($path."/.");
- } else
- {
- /* Check for files */
- if (uplHasFiles($path))
- {
- $failedFiles = array ();
+if ($action == "upl_delete") {
+ if (is_dbfs($path)) {
+ $dbfs->remove($path . "/.");
+ } else {
+ /* 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);
+ $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 == false)
- {
- $failedFiles[] = $dir_entry;
- }
- }
- }
- }
+ if ($res == false) {
+ $failedFiles[] = $dir_entry;
+ }
+ }
+ }
+ }
- if (count($failedFiles) > 0)
- {
- $notification->displayNotification("warning", i18n("Failed to delete the following files:")."
".implode("
", $failedFiles));
- } else
- {
- $res = @ rmdir($cfgClient[$client]['upl']['path'].$path);
- if ($res == false)
- {
- $notification->displayNotification("warning", sprintf(i18n("Failed to remove directory %s"), $path));
- }
- }
- }
+ if (count($failedFiles) > 0) {
+ $notification->displayNotification("warning", i18n("Failed to delete the following files:") . "
" . implode("
", $failedFiles));
+ } else {
+ $res = @ rmdir($cfgClient[$client]['upl']['path'] . $path);
+ if ($res == false) {
+ $notification->displayNotification("warning", sprintf(i18n("Failed to remove directory %s"), $path));
+ }
+ }
+ }
}
$tpl->reset();
@@ -167,28 +144,28 @@ $tpl->reset();
$file = 'Upload';
$pathstring = '';
/*
-$rootTreeItem = new TreeItem;
-$rootTreeItem->custom["level"] = 0;
-$rootTreeItem->name = i18n("Upload directory");
-*/
-$user_upload_path = getEffectiveSetting("upload","userpath");
+ $rootTreeItem = new TreeItem;
+ $rootTreeItem->custom["level"] = 0;
+ $rootTreeItem->name = i18n("Upload directory");
+ */
+$user_upload_path = getEffectiveSetting("upload", "userpath");
-if (is_string($user_upload_path) AND !empty($user_upload_path)) {
- trim($user_upload_path);
- $file = $user_upload_path;
- if (substr($user_upload_path, -1) != "/") {
- $user_upload_path .= "/";
+if (is_string($user_upload_path) AND!empty($user_upload_path)) {
+ trim($user_upload_path);
+ $file = $user_upload_path;
+ if (substr($user_upload_path, -1) != "/") {
+ $user_upload_path .= "/";
}
- $pathstring = $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);
+ $pathstring = $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);
}
}
$rootTreeItem = new TreeItem;
$rootTreeItem->custom["level"] = 0;
$rootTreeItem->name = i18n("Upload directory");
-$aInvalidDirectories = uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"].$user_upload_path, $rootTreeItem, 2);
+$aInvalidDirectories = uplRecursiveDirectoryList($cfgClient[$client]["upl"]["path"] . $user_upload_path, $rootTreeItem, 2);
if (count($aInvalidDirectories) > 0) {
$sWarningInfo = i18n('The following directories contains invalid characters and were ignored: ');
@@ -196,9 +173,9 @@ if (count($aInvalidDirectories) > 0) {
$sFiles = implode(', ', $aInvalidDirectories);
$sRenameString = i18n('Please click here in order to rename automatically.');
$sRenameHref = $sess->url("main.php?area=$area&frame=$frame&force_rename=true");
- $sRemameLink = ''.$sRenameString.'';
- $sNotificationString = $sWarningInfo.$sSeperator.$sFiles.$sSeperator.$sSeperator.$sRemameLink;
-
+ $sRemameLink = '' . $sRenameString . '';
+ $sNotificationString = $sWarningInfo . $sSeperator . $sFiles . $sSeperator . $sSeperator . $sRemameLink;
+
$sErrorString = $notification->returnNotification("warning", $sNotificationString, 1);
$tpl->set('s', 'WARNING', $sErrorString);
} else {
@@ -206,139 +183,114 @@ if (count($aInvalidDirectories) > 0) {
}
/* Mark all items in the expandedList as expanded */
-foreach ($uplexpandedList as $key => $value)
-{
- $rootTreeItem->markExpanded($value);
+foreach ($uplexpandedList as $key => $value) {
+ $rootTreeItem->markExpanded($value);
}
/* Collapse and expand the tree */
-if (is_string($collapse))
-{
- $rootTreeItem->markCollapsed($collapse);
+if (is_string($collapse)) {
+ $rootTreeItem->markCollapsed($collapse);
}
-if (is_string($expand))
-{
- $rootTreeItem->markExpanded($expand);
+if (is_string($expand)) {
+ $rootTreeItem->markExpanded($expand);
}
-$uplexpandedList = Array ();
+$uplexpandedList = Array();
$rootTreeItem->getExpandedList($uplexpandedList);
$currentuser->setUserProperty("system", "upl_expandstate", serialize($uplexpandedList));
-$objects = Array ();
+$objects = Array();
$rootTreeItem->traverse($objects);
-unset ($objects[0]);
+unset($objects[0]);
$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 = array ();
+if ($appendparameters == "filebrowser") {
+ $mtree = new cWidgetTreeView("b58f0ae3-8d4e-4bb3-a754-5f0628863364");
+ $cattree = conFetchCategoryTree();
+ $marray = array();
- foreach ($cattree as $key => $catitem)
- {
- $no_start = true;
- $no_online = true;
- $no_start = !strHasStartArticle($catitem["idcat"], $lang);
-
- $no_online = !$catitem["visible"];
-
- if ($catitem["visible"] == 1)
- {
- if ($catitem["public"] == 0)
- {
- 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
- {
- # 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";
- }
- }
- } else
- {
- # Category is offline
- if ($catitem['public'] == 0)
- {
- # Category is locked
- if ($no_start || $no_online)
- {
- # Error found
- $tmp_img = "folder_off_error_locked.gif";
+ foreach ($cattree as $key => $catitem) {
+ $no_start = true;
+ $no_online = true;
+ $no_start = !strHasStartArticle($catitem["idcat"], $lang);
- } else
- {
- # No error found
- $tmp_img = "folder_off_locked.gif";
+ $no_online = !$catitem["visible"];
- }
+ if ($catitem["visible"] == 1) {
+ if ($catitem["public"] == 0) {
+ 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 {
+ # 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";
+ }
+ }
+ } else {
+ # 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";
+ }
+ }
+ }
- } else
- {
- # Category is public
- if ($no_start || $no_online)
- {
- # Error found
- $tmp_img = "folder_off_error.gif";
+ $icon = "./images/" . $tmp_img;
- } else
- {
- # No error found
- $tmp_img = "folder_off.gif";
+ $idcat = $catitem["idcat"];
- }
- }
- }
-
- $icon = "./images/".$tmp_img;
+ $name = ' ' . $catitem["name"] . '';
+ $marray[] = array("id" => $catitem["idcat"], "name" => $name, "level" => $catitem["level"], "attributes" => array("icon" => $icon));
+ }
- $idcat = $catitem["idcat"];
-
- $name = ' '.$catitem["name"].'';
- $marray[] = array ("id" => $catitem["idcat"], "name" => $name, "level" => $catitem["level"], "attributes" => array ("icon" => $icon));
- }
+ $mtree->setTreeName(i18n("Categories"));
+ $mtree->setIcon("images/grid_folder.gif");
+ $mtree->importTable($marray);
- $mtree->setTreeName(i18n("Categories"));
- $mtree->setIcon("images/grid_folder.gif");
- $mtree->importTable($marray);
+ $baselink = new cHTMLLink;
+ $baselink->setCLink($area, $frame, "");
+ $baselink->setCustom("appendparameters", $appendparameters);
- $baselink = new cHTMLLink;
- $baselink->setCLink($area, $frame, "");
- $baselink->setCustom("appendparameters", $appendparameters);
+ $mtree->setBaseLink($baselink);
+ $mtree->setBackgroundMode(TREEVIEW_BACKGROUND_SHADED);
+ $mtree->setMouseoverMode(TREEVIEW_MOUSEOVER_NONE);
+ $mtree->setCollapsed($collapsed);
+ $mtree->processParameters();
- $mtree->setBaseLink($baselink);
- $mtree->setBackgroundMode(TREEVIEW_BACKGROUND_SHADED);
- $mtree->setMouseoverMode(TREEVIEW_MOUSEOVER_NONE);
- $mtree->setCollapsed($collapsed);
- $mtree->processParameters();
+ $collapsed = array();
+ $mtree->getCollapsedList($collapsed);
- $collapsed = array ();
- $mtree->getCollapsedList($collapsed);
-
- $tpl->set('s', 'CATBROWSER', $mtree->render());
- $tpl->set('s', 'APPENDPARAMETERS', 'url += \'&appendparameters='.$appendparameters.'\'');
-} else
-{
- $tpl->set('s', 'CATBROWSER', '');
- $tpl->set('s', 'APPENDPARAMETERS', 'url += \'&appendparameters='.$appendparameters.'\'');
+ $tpl->set('s', 'CATBROWSER', $mtree->render());
+ $tpl->set('s', 'APPENDPARAMETERS', 'url += \'&appendparameters=' . $appendparameters . '\'');
+} else {
+ $tpl->set('s', 'CATBROWSER', '');
+ $tpl->set('s', 'APPENDPARAMETERS', 'url += \'&appendparameters=' . $appendparameters . '\'');
}
chdir($cfg['path']['contenido']);
@@ -347,9 +299,9 @@ $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);
+$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);
$tpl->set('d', 'PATH', $pathstring);
$tpl->set('d', 'BGCOLOR', $bgcolor);
@@ -360,86 +312,74 @@ $tpl->set('d', 'DELETEBUTTON', '');
$tpl->set('d', 'COLLAPSE', '');
$tpl->next();
+if (is_array($objects)) {
+ foreach ($objects as $a_file) {
+ $file = $a_file->name;
+ $depth = $a_file->custom["level"] - 1;
+ $pathstring = str_replace($cfgClient[$client]['upl']['path'], "", $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"];
+ $imgcollapse = getExpandCollapseButton($a_file);
+ $fileurl = rawurlencode($path . $file . '/');
+ $pathurl = rawurlencode($path);
-if (is_array($objects))
-{
- foreach ($objects as $a_file)
- {
- $file = $a_file->name;
- $depth = $a_file->custom["level"] - 1;
- $pathstring = str_replace($cfgClient[$client]['upl']['path'], "", $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"];
- $imgcollapse = getExpandCollapseButton($a_file);
- $fileurl = rawurlencode($path.$file.'/');
- $pathurl = rawurlencode($path);
+ # Indent for every level
+ $cnt = $depth;
+ $indent = 18;
- # Indent for every level
- $cnt = $depth;
- $indent = 18;
+ for ($i = 0; $i < $cnt; $i++) {
+ $indent += 18;
+ }
- for ($i = 0; $i < $cnt; $i ++)
- {
- $indent += 18;
- }
+ # 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);
- # 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);
-
- $hasFiles = uplHasFiles($pathstring);
- $hasSubdirs = uplHasSubdirs($pathstring);
+ $hasFiles = uplHasFiles($pathstring);
+ $hasSubdirs = uplHasSubdirs($pathstring);
- if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir"))
- {
- $deletebutton = ''.$file.'\', \'deleteDirectory(\\\''.$pathstring.'\\\')\')">';
- } else
- {
- if ($hasFiles)
- {
- $message = i18n("Directory contains files");
- } else
- {
- $message = i18n("Permission denied");
- }
+ if ((!$hasSubdirs) && (!$hasFiles) && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
+ $deletebutton = '' . $file . '\', \'deleteDirectory(\\\'' . $pathstring . '\\\')\')">';
+ } else {
+ if ($hasFiles) {
+ $message = i18n("Directory contains files");
+ } else {
+ $message = i18n("Permission denied");
+ }
- $deletebutton = "";
- }
+ $deletebutton = "";
+ }
- $bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
+ $bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
- $tpl->set('d', 'PATH', $pathstring);
- $tpl->set('d', 'BGCOLOR', $bgcolor);
- $tpl->set('d', 'INDENT', 0);
+ $tpl->set('d', 'PATH', $pathstring);
+ $tpl->set('d', 'BGCOLOR', $bgcolor);
+ $tpl->set('d', 'INDENT', 0);
- $gline = "";
+ $gline = "";
- for ($i = 1; $i < $depth; $i ++)
- {
- if ($dlevels[$i] == false && $i != 0)
- {
- $gline .= '';
- } else
- {
- $gline .= '';
- }
- }
+ for ($i = 1; $i < $depth; $i++) {
+ if ($dlevels[$i] == false && $i != 0) {
+ $gline .= '';
+ } else {
+ $gline .= '';
+ }
+ }
- $parent = str_replace($cfgClient[$client]['upl']['path'], "", $a_file->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);
+ $tpl->set('d', 'DIRNAME', $mstr);
+ $tpl->set('d', 'EDITBUTTON', '');
+ $tpl->set('d', 'DELETEBUTTON', $deletebutton);
- $tpl->set('d', 'COLLAPSE', $gline.$imgcollapse);
- $tpl->next();
-
- }
+ $tpl->set('d', 'COLLAPSE', $gline . $imgcollapse);
+ $tpl->next();
+ }
}
$tpl->set('d', 'DELETEBUTTON', ' ');
@@ -459,38 +399,35 @@ $rootTreeItem->custom["level"] = 0;
uplRecursiveDBDirectoryList("", $rootTreeItem, 2);
/* Mark all items in the expandedList as expanded */
-foreach ($upldbfsexpandedList as $key => $value)
-{
- $rootTreeItem->markExpanded($value);
+foreach ($upldbfsexpandedList as $key => $value) {
+ $rootTreeItem->markExpanded($value);
}
/* Collapse and expand the tree */
-if (is_string($collapse))
-{
- $rootTreeItem->markCollapsed($collapse);
+if (is_string($collapse)) {
+ $rootTreeItem->markCollapsed($collapse);
}
-if (is_string($expand))
-{
- $rootTreeItem->markExpanded($expand);
+if (is_string($expand)) {
+ $rootTreeItem->markExpanded($expand);
}
-$upldbfsexpandedList = Array ();
+$upldbfsexpandedList = Array();
$rootTreeItem->getExpandedList($upldbfsexpandedList);
$currentuser->setUserProperty("system", "upl_dbfs_expandstate", serialize($upldbfsexpandedList));
-$objects = Array ();
+$objects = Array();
$rootTreeItem->traverse($objects);
-unset ($objects[0]);
+unset($objects[0]);
$bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
$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);
+$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);
$tpl->set('d', 'PATH', $pathstring);
$tpl->set('d', 'BGCOLOR', $bgcolor);
@@ -503,92 +440,79 @@ $tpl->next();
$dbfsc = new DBFSCollection;
-$dlevels = array ();
+$dlevels = array();
-if (is_array($objects))
-{
- 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);
+if (is_array($objects)) {
+ 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);
- if($file == 'tmp')
- {
- echo 'tmp2
';
+ if ($file == 'tmp') {
+ echo 'tmp2
';
+ }
+
+ # Indent for every level
+ $cnt = $depth;
+ $indent = 18;
+
+ for ($i = 0; $i < $cnt; $i++) {
+ # 18 px for every level
+ $indent += 18;
+ }
+
+ # 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);
+
+ $hasFiles = $dbfsc->hasFiles($pathstring);
+
+ if (!$hasFiles && $perm->have_perm_area_action($tmp_area, "upl_rmdir")) {
+ $deletebutton = '' . $file . '\', \'deleteDirectory(\\\'' . $pathstring . '\\\')\')">';
+ } else {
+ if ($hasFiles) {
+ $message = i18n("Directory contains files");
+ } else {
+ $message = i18n("Permission denied");
+ }
+
+ $deletebutton = "";
+ }
+
+ $bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
+
+ $tpl->set('d', 'PATH', $pathstring);
+ $tpl->set('d', 'BGCOLOR', $bgcolor);
+ $tpl->set('d', 'INDENT', 0);
+
+ $gline = "";
+
+ for ($i = 1; $i < $depth; $i++) {
+ if ($dlevels[$i] == false && $i != 0) {
+ $gline .= '';
+ } else {
+ $gline .= '';
+ }
+ }
+
+ $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);
+ $tpl->set('d', 'COLLAPSE', $gline . $collapse);
+ $tpl->next();
}
-
- # Indent for every level
- $cnt = $depth;
- $indent = 18;
-
- for ($i = 0; $i < $cnt; $i ++)
- {
- # 18 px for every level
- $indent += 18;
- }
-
- # 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);
-
- $hasFiles = $dbfsc->hasFiles($pathstring);
-
- if (!$hasFiles && $perm->have_perm_area_action($tmp_area, "upl_rmdir"))
- {
- $deletebutton = ''.$file.'\', \'deleteDirectory(\\\''.$pathstring.'\\\')\')">';
- } else
- {
- if ($hasFiles)
- {
- $message = i18n("Directory contains files");
- } else
- {
- $message = i18n("Permission denied");
- }
-
- $deletebutton = "";
- }
-
- $bgcolor = (is_int($tpl->dyn_cnt / 2)) ? $cfg["color"]["table_light"] : $cfg["color"]["table_dark"];
-
- $tpl->set('d', 'PATH', $pathstring);
- $tpl->set('d', 'BGCOLOR', $bgcolor);
- $tpl->set('d', 'INDENT', 0);
-
- $gline = "";
-
- for ($i = 1; $i < $depth; $i ++)
- {
- if ($dlevels[$i] == false && $i != 0)
- {
- $gline .= '';
- } else
- {
- $gline .= '';
- }
- }
-
- $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);
- $tpl->set('d', 'COLLAPSE', $gline.$collapse);
- $tpl->next();
-
- }
}
$tpl->set('s', 'ID_PATH', $path);
chdir($cfg["path"]["contenido"]);
-$tpl->generate($cfg['path']['templates'].$cfg['templates']['upl_dirs_overview']);
-
+$tpl->generate($cfg['path']['templates'] . $cfg['templates']['upl_dirs_overview']);
?>
\ No newline at end of file
diff --git a/conlite/templates/standard/template.files_overview.html b/conlite/templates/standard/template.files_overview.html
index b46f5ad..135461e 100644
--- a/conlite/templates/standard/template.files_overview.html
+++ b/conlite/templates/standard/template.files_overview.html
@@ -1,35 +1,35 @@
-
-
-
-
-
-
- {JAVASCRIPT}
-
-
+
+
+
+
+
+
+ {JAVASCRIPT}
+
+
-
-
-
- |
-
-
-
- {FILENAME} |
- {DELETE} |
-
-
- |
- |
-
-
-
+
+
+
+ |
+
+
+
+ {FILENAME} |
+ {DELETE} |
+
+
+ |
+ |
+
+
+
-
-
+
+