diff --git a/DefaultConf.php b/DefaultConf.php index 6754364..29dc4ac 100644 --- a/DefaultConf.php +++ b/DefaultConf.php @@ -1,298 +1,319 @@ $value) { - if(is_array($post_return[$key])) { - $post_return[$key] = cleanREQUEST($post_return[$key]); - } else { - // Nullbytes abfangen! - if (strpos("tmp".$value, "\x00") > 0 or strpos("tmp".$key, "\x00") > 0) { - die(); - } - # auf manchen Systemen mus ein stripslashes() gemacht werden - if(strpos("tmp".$value,'\\') > 0 - and addslashes(stripslashes($value)) == $value) { - $value = stripslashes($value); - } - # auf manchen Systemen mus ein stripslashes() gemacht werden - if(strpos("tmp".$key,'\\') > 0 - and addslashes(stripslashes($key)) == $key) { - $value = stripslashes($key); - } - $post_return[$key] = $value; - } - } - return $post_return; + foreach ($post_return as $key => $value) { + if (is_array($post_return [$key])) { + $post_return [$key] = cleanREQUEST($post_return [$key]); + } else { + // Nullbytes abfangen! + if (strpos("tmp" . $value, "\x00") > 0 or strpos("tmp" . $key, "\x00") > 0) { + die(); + } + // auf manchen Systemen mus ein stripslashes() gemacht werden + if (strpos("tmp" . $value, '\\') > 0 and addslashes(stripslashes($value)) == $value) { + $value = stripslashes($value); + } + // auf manchen Systemen mus ein stripslashes() gemacht werden + if (strpos("tmp" . $key, '\\') > 0 and addslashes(stripslashes($key)) == $key) { + $value = stripslashes($key); + } + $post_return [$key] = $value; + } + } + return $post_return; } -# Alle Platzhalter +// Alle Platzhalter function makePlatzhalter($all = false) { - # Alle Platzhalter für die Selctbox im Editor als array - $platzhalter = array( - '{BASE_URL}', - '{CATEGORY_NAME}', - '{CATEGORY}', - '{CATEGORY_URL}', - '{PAGE_NAME}', - '{PAGE_FILE}', - '{PAGE_URL}', - '{PAGE}', - '{SEARCH}', - '{SITEMAPLINK}', - '{CMSINFO}', - '{TABLEOFCONTENTS}' - ); - # Die Rstlichen Platzhalter - $platzhalter_rest = array( - '{CSS_FILE}', - '{CHARSET}', - '{FAVICON_FILE}', - '{LAYOUT_DIR}', - '{WEBSITE_TITLE}', - '{WEBSITE_KEYWORDS}', - '{WEBSITE_DESCRIPTION}', - '{WEBSITE_NAME}', - '{MAINMENU}', - '{DETAILMENU}', - '{MEMORYUSAGE}', - '{EXECUTETIME}' - ); + // Alle Platzhalter für die Selctbox im Editor als array + $platzhalter = array( + '{BASE_URL}', + '{CATEGORY_NAME}', + '{CATEGORY}', + '{CATEGORY_URL}', + '{PAGE_NAME}', + '{PAGE_FILE}', + '{PAGE_URL}', + '{PAGE}', + '{SEARCH}', + '{SITEMAPLINK}', + '{CMSINFO}', + '{TABLEOFCONTENTS}' + ); + // Die Rstlichen Platzhalter + $platzhalter_rest = array( + '{CSS_FILE}', + '{CHARSET}', + '{FAVICON_FILE}', + '{LAYOUT_DIR}', + '{WEBSITE_TITLE}', + '{WEBSITE_KEYWORDS}', + '{WEBSITE_DESCRIPTION}', + '{WEBSITE_NAME}', + '{MAINMENU}', + '{DETAILMENU}', + '{MEMORYUSAGE}', + '{EXECUTETIME}' + ); - if($all) { - $platzhalter = array_merge($platzhalter,$platzhalter_rest); - } - return $platzhalter; + if ($all) { + $platzhalter = array_merge($platzhalter, $platzhalter_rest); + } + return $platzhalter; } -# $conf_datei = voller pfad und conf Dateiname oder nur Array Name +// $conf_datei = voller pfad und conf Dateiname oder nur Array Name function makeDefaultConf($conf_datei) { - $basic = array( - 'text' => array( - 'adminmail' => '', - 'language' => 'deDE', - 'noupload' => 'php,php3,php4,php5'), - 'digit' => array( - 'backupmsgintervall' => '30', - 'chmodnewfilesatts' => '', - 'lastbackup' => time(), - 'maximageheight' => '', - 'maximagewidth' => '', - 'maxnumberofuploadfiles' => '5', - 'textareaheight' => '270'), - 'checkbox' => array( - 'overwriteuploadfiles' => 'false', - 'sendadminmail' => 'false', - 'showTooltips' => 'true', - 'usebigactionicons' => 'false', - 'showexpert' => 'false'), - # das sind die Expert Parameter von basic - 'expert' => array( - 'noupload', - 'backupmsgintervall', - 'lastbackup', - 'maxnumberofuploadfiles', - 'showTooltips', - 'textareaheight', - 'usebigactionicons', - 'overwriteuploadfiles') - ); + $basic = array( + 'text' => array( + 'adminmail' => '', + 'language' => 'deDE', + 'noupload' => 'php,php3,php4,php5' + ), + 'digit' => array( + 'backupmsgintervall' => '30', + 'chmodnewfilesatts' => '', + 'lastbackup' => time(), + 'maximageheight' => '', + 'maximagewidth' => '', + 'maxnumberofuploadfiles' => '5', + 'textareaheight' => '270' + ), + 'checkbox' => array( + 'overwriteuploadfiles' => 'false', + 'sendadminmail' => 'false', + 'showTooltips' => 'true', + 'usebigactionicons' => 'false', + 'showexpert' => 'false' + ), + // das sind die Expert Parameter von basic + 'expert' => array( + 'noupload', + 'backupmsgintervall', + 'lastbackup', + 'maxnumberofuploadfiles', + 'showTooltips', + 'textareaheight', + 'usebigactionicons', + 'overwriteuploadfiles' + ) + ); - $main = array( - 'text' => array( - 'shortenlinks' => '0', - 'titlebarseparator' => '%20%3A%3A%20', - 'usesubmenu' => '1', - 'websitedescription' => '', - 'websitekeywords' => '', - 'websitetitle' => 'moziloCMS%20-%20Das%20CMS%20f%C3%BCr%20Einsteiger'), - 'select' => array( - 'cmslanguage' => 'deDE', - 'cmslayout' => 'moziloCMS', - 'defaultcat' => '10_Willkommen', - 'titlebarformat' => '%7BWEBSITE%7D'), - 'checkbox' => array( - 'hidecatnamedpages' => 'false', - 'modrewrite' => 'false', - 'replaceemoticons' => 'true', - 'showhiddenpagesasdefaultpage' => ' false', - 'showhiddenpagesincmsvariables' => ' false', - 'showhiddenpagesinlastchanged' => 'false', - 'showhiddenpagesinsearch' => 'false', - 'showhiddenpagesinsitemap' => 'false', - 'showsyntaxtooltips' => 'true', - 'targetblank_download' => 'true', - 'targetblank_link' => 'true', - 'usecmssyntax' => 'true', - 'usecmseditarea' => 'true'), - # das sind die Expert Parameter von main - 'expert' => array( - 'hidecatnamedpages', - 'modrewrite', - 'showhiddenpagesasdefaultpage', - 'showhiddenpagesincmsvariables', - 'showhiddenpagesinlastchanged', - 'showhiddenpagesinsearch', - 'showhiddenpagesinsitemap', - 'targetblank_download', - 'targetblank_link', - 'showsyntaxtooltips', - 'replaceemoticons', - 'shortenlinks', - 'usecmssyntax', - 'usesubmenu', - 'usecmseditarea') - ); + $main = array( + 'text' => array( + 'shortenlinks' => '0', + 'titlebarseparator' => '%20%3A%3A%20', + 'usesubmenu' => '1', + 'websitedescription' => '', + 'websitekeywords' => '', + 'websitetitle' => 'moziloCMS%20-%20Das%20CMS%20f%C3%BCr%20Einsteiger' + ), + 'select' => array( + 'cmslanguage' => 'deDE', + 'cmslayout' => 'moziloCMS', + 'defaultcat' => '10_Willkommen', + 'titlebarformat' => '%7BWEBSITE%7D' + ), + 'checkbox' => array( + 'hidecatnamedpages' => 'false', + 'modrewrite' => 'false', + 'replaceemoticons' => 'true', + 'showhiddenpagesasdefaultpage' => ' false', + 'showhiddenpagesincmsvariables' => ' false', + 'showhiddenpagesinlastchanged' => 'false', + 'showhiddenpagesinsearch' => 'false', + 'showhiddenpagesinsitemap' => 'false', + 'showsyntaxtooltips' => 'true', + 'targetblank_download' => 'true', + 'targetblank_link' => 'true', + 'usecmssyntax' => 'true', + 'usecmseditarea' => 'true' + ), + // das sind die Expert Parameter von main + 'expert' => array( + 'hidecatnamedpages', + 'modrewrite', + 'showhiddenpagesasdefaultpage', + 'showhiddenpagesincmsvariables', + 'showhiddenpagesinlastchanged', + 'showhiddenpagesinsearch', + 'showhiddenpagesinsitemap', + 'targetblank_download', + 'targetblank_link', + 'showsyntaxtooltips', + 'replaceemoticons', + 'shortenlinks', + 'usecmssyntax', + 'usesubmenu', + 'usecmseditarea' + ) + ); - $syntax = array('wikipedia' => '[link={DESCRIPTION}|http://de.wikipedia.org/wiki/{VALUE}]'); -/* - $formular = array('formularmail' => '', - 'contactformusespamprotection' => 'true', - 'contactformwaittime' => '15', - 'mail' => ',true,true', - 'message' => ',true,true', - 'name' => ',true,true', - 'website' => ',true,false'); -*/ - $logindata = array('falselogincount' => '0', - 'falselogincounttemp' => '0', - 'initialpw' => 'true', - 'initialsetup' => 'true', - 'loginlockstarttime' => '', - 'name' => 'admin', - 'pw' => '19ad89bc3e3c9d7ef68b89523eff1987'); + $syntax = array( + 'wikipedia' => '[link={DESCRIPTION}|http://de.wikipedia.org/wiki/{VALUE}]' + ); + /* + * $formular = array('formularmail' => '', + * 'contactformusespamprotection' => 'true', + * 'contactformwaittime' => '15', + * 'mail' => ',true,true', + * 'message' => ',true,true', + * 'name' => ',true,true', + * 'website' => ',true,false'); + */ + $logindata = array( + 'falselogincount' => '0', + 'falselogincounttemp' => '0', + 'initialpw' => 'true', + 'initialsetup' => 'true', + 'loginlockstarttime' => '', + 'name' => 'admin', + 'pw' => '19ad89bc3e3c9d7ef68b89523eff1987' + ); - $downloads = array('_downloadcounterstarttime' => time()); + $downloads = array( + '_downloadcounterstarttime' => time() + ); - $version = array('cmsversion' => '1.12.php7', - 'cmsname' => 'Amalia', - 'revision' => '958'); + $version = array( + 'cmsversion' => '1.12.php8', + 'cmsname' => 'Amalia', + 'revision' => '958' + ); - $gallery = array('digit' => array( - 'maxheight' => '', - 'maxwidth' => '', - 'maxthumbheight' => '100', - 'maxthumbwidth' => '100'), -## 'checkbox' => array( -## 'createthumbs' => 'true'), - 'expert' => array( -## 'createthumbs', - 'maxthumbheight', - 'maxthumbwidth') - ); + $gallery = array( + 'digit' => array( + 'maxheight' => '', + 'maxwidth' => '', + 'maxthumbheight' => '100', + 'maxthumbwidth' => '100' + ), + // # 'checkbox' => array( + // # 'createthumbs' => 'true'), + 'expert' => array( + // # 'createthumbs', + 'maxthumbheight', + 'maxthumbwidth' + ) + ); - $plugin = array('active' => 'true'); + $plugin = array( + 'active' => 'true' + ); - $passwords = array('# Kategorie/Inhaltsseite' => 'password'); + $passwords = array( + '# Kategorie/Inhaltsseite' => 'password' + ); - # ist eine *.conf datei angegeben wird das jeweilige array ohne expert und nur der inhalt der subarrays zurückgegeben - if(strpos($conf_datei,".conf") > 0) { - $name = substr(basename($conf_datei),0,-(strlen(".conf"))); - # beim erzeugen duerfen sub arrays nicht mit rein - foreach($$name as $key => $value) { - if($key == "expert") continue; - if(is_array($value)) { - foreach($value as $key => $value) { - $return_array[$key] = $value; - } - } else { - $return_array = $$name; - break; - } - } - return $return_array; - # ist es keine *.conf einfach das ganze array zurück - } else { - return $$conf_datei; - } + // ist eine *.conf datei angegeben wird das jeweilige array ohne expert und nur der inhalt der subarrays zurückgegeben + if (strpos($conf_datei, ".conf") > 0) { + $name = substr(basename($conf_datei), 0, -(strlen(".conf"))); + // beim erzeugen duerfen sub arrays nicht mit rein + foreach ($$name as $key => $value) { + if ($key == "expert") + continue; + if (is_array($value)) { + foreach ($value as $key => $value) { + $return_array [$key] = $value; + } + } else { + $return_array = $$name; + break; + } + } + return $return_array; + // ist es keine *.conf einfach das ganze array zurück + } else { + return $$conf_datei; + } } // ------------------------------------------------------------------------------ // Handelt es sich um ein valides Verzeichnis / eine valide Datei? // ------------------------------------------------------------------------------ function isValidDirOrFile($file) { - # Alles, was einen Punkt vor der Datei hat - if(strpos($file,".") === 0) { - return false; - } - # alle PHP-Dateien - if(substr($file,-4) == ".php") { - return false; - } - # ...und der Rest - if(in_array($file, array( - "Thumbs.db", // Windows-spezifisch - "__MACOSX", // Mac-spezifisch - "settings" // Eclipse - ))) { - return false; - } - return true; + // Alles, was einen Punkt vor der Datei hat + if (strpos($file, ".") === 0) { + return false; + } + // alle PHP-Dateien + if (substr($file, -4) == ".php") { + return false; + } + // ...und der Rest + if (in_array($file, array( + "Thumbs.db", // Windows-spezifisch + "__MACOSX", // Mac-spezifisch + "settings" // Eclipse + ))) { + return false; + } + return true; } -# $filetype = "dir" nur ordner -# $filetype = "file" nur dateien -# $filetype = array(".txt",".hid",...) nur die mit dieser ext -# Achtung Punkt nicht vergessen Gross/Kleinschreibung ist egal -# $filetype = false alle dateien -# $sort_type = "sort" (Default) oder "natcasesort" oder "none" -function getDirAsArray($dir,$filetype = false,$sort_type = "sort") { - $dateien = array(); - if(is_dir($dir) and false !== ($currentdir = opendir($dir))) { - while(false !== ($file = readdir($currentdir))) { - # keine gültige datei gleich zur nächsten datei - if(!isValidDirOrFile($file)) - continue; - # nur mit ext - if(is_array($filetype)) { - # alle ext im array in kleinschreibung wandeln - $filetype = array_map('strtolower', $filetype); - $ext = strtolower(substr($file,strrpos($file,"."))); - if(in_array($ext,$filetype)) { - $dateien[] = $file; - } - # nur dir oder file - // AZI 2017-09-17: Auch Symlinks müssen beachtet werden - //} elseif(filetype($dir."/".$file) == $filetype) { - } elseif(filetype($dir."/".$file) == $filetype || filetype($dir."/".$file) == 'link') { - // /AZI - $dateien[] = $file; - # alle - } elseif(!$filetype) { - $dateien[] = $file; - } - } - closedir($currentdir); - if($sort_type == "sort") - sort($dateien); - elseif($sort_type == "natcasesort") - natcasesort($dateien); - } - return $dateien; +// $filetype = "dir" nur ordner +// $filetype = "file" nur dateien +// $filetype = array(".txt",".hid",...) nur die mit dieser ext +// Achtung Punkt nicht vergessen Gross/Kleinschreibung ist egal +// $filetype = false alle dateien +// $sort_type = "sort" (Default) oder "natcasesort" oder "none" +function getDirAsArray($dir, $filetype = false, $sort_type = "sort") { + $dateien = array(); + if (is_dir($dir) and false !== ($currentdir = opendir($dir))) { + while (false !== ($file = readdir($currentdir))) { + // keine gültige datei gleich zur nächsten datei + if (!isValidDirOrFile($file)) + continue; + // nur mit ext + if (is_array($filetype)) { + // alle ext im array in kleinschreibung wandeln + $filetype = array_map('strtolower', $filetype); + $ext = strtolower(substr($file, strrpos($file, "."))); + if (in_array($ext, $filetype)) { + $dateien [] = $file; + } + // nur dir oder file + // AZI 2017-09-17: Auch Symlinks müssen beachtet werden + // } elseif(filetype($dir."/".$file) == $filetype) { + } elseif (filetype($dir . "/" . $file) == $filetype || filetype($dir . "/" . $file) == 'link') { + // /AZI + $dateien [] = $file; + // alle + } elseif (!$filetype) { + $dateien [] = $file; + } + } + closedir($currentdir); + if ($sort_type == "sort") + sort($dateien); + elseif ($sort_type == "natcasesort") + natcasesort($dateien); + } + return $dateien; } ?> diff --git a/admin/Crypt.php b/admin/Crypt.php index b06476c..f94a256 100644 --- a/admin/Crypt.php +++ b/admin/Crypt.php @@ -1,19 +1,17 @@ \ No newline at end of file diff --git a/admin/categories_array.php b/admin/categories_array.php index 47067fb..f962e77 100755 --- a/admin/categories_array.php +++ b/admin/categories_array.php @@ -1,820 +1,821 @@ '#CCFFCC', - 'check_url' => '#CCE9F9', - 'check_url_full' => '#C9E9F9', - 'check_digit' => '#CCE6FF', - 'check_new_position_empty' => '#E6CCFF', - 'check_is_file' => '#FFCC99', - 'check_name_too_long' => '#FFFF99', - 'check_name_exist' => '#99FF99', - 'check_new_name_empty' => '#FF6666', - 'check_too_many_pages' => '#FFFF33', - 'check_doubles_digit_copy_move' => '#4D9900', - 'check_copy_same_cat' => '#33FFFF', - 'files_error_exists' => '#33FFFF', - 'files_error_name' => '#33FFFF', - 'files_error_wrongext' => '#33FFFF', - 'php_error' => '#33FFFF', - 'check_doubles_name_cat' => '#33FFFF', - 'check_doubles_name_page' => '#33FFFF', - 'check_doubles_digit_same_cat' => '#FFCCCC'); - -# beim ersten aufruf von cat oder page mussen einige variable vorbereitet werden +$error_color = array( + 'check_name' => '#CCFFCC', + 'check_url' => '#CCE9F9', + 'check_url_full' => '#C9E9F9', + 'check_digit' => '#CCE6FF', + 'check_new_position_empty' => '#E6CCFF', + 'check_is_file' => '#FFCC99', + 'check_name_too_long' => '#FFFF99', + 'check_name_exist' => '#99FF99', + 'check_new_name_empty' => '#FF6666', + 'check_too_many_pages' => '#FFFF33', + 'check_doubles_digit_copy_move' => '#4D9900', + 'check_copy_same_cat' => '#33FFFF', + 'files_error_exists' => '#33FFFF', + 'files_error_name' => '#33FFFF', + 'files_error_wrongext' => '#33FFFF', + 'php_error' => '#33FFFF', + 'check_doubles_name_cat' => '#33FFFF', + 'check_doubles_name_page' => '#33FFFF', + 'check_doubles_digit_same_cat' => '#FFCCCC' +); + +// beim ersten aufruf von cat oder page mussen einige variable vorbereitet werden function makePostCatPageReturnVariable($pages = false) { - global $error_color; - - $max_cat_page = 100; - - $cat_array = getDirAsArray(CONTENT_DIR_REL,"dir","sort"); - - if(count($cat_array) > $max_cat_page) { - $post['error_messages']['check_too_many_categories'][] = NULL; - } - # wenn es nur cat ist wird $cat_array = cat $page_array = $cat_array - if($pages === false) { - # Wichtig wegen new Kategorie - $cat_array[$max_cat_page] = NULL; - $page_array = $cat_array; - unset($cat_array); - $cat_array['cat'] = 'cat'; - } - $test_doubles_position_cat = array(); - $test_doubles_name_cat = array(); - foreach($cat_array as $cat) { - $test_doubles_position[$cat] = array(); - $test_doubles_name[$cat] = array(); - # nach dopelten Positionen und namen suchen wichtig bei FTP - if($cat != 'cat' and strpos($cat,EXT_LINK) === false) { - $cat_position = substr($cat,0,2); - if(in_array($cat_position,$test_doubles_position_cat)) { - $post['error_messages']['check_doubles_position_cat'][] = $cat_position; - } - $test_doubles_position_cat[] = $cat_position; - $cat_name = substr($cat,3); - if(in_array($cat_name,$test_doubles_name_cat)) { - foreach(array_keys($test_doubles_name_cat,$cat_name) as $pos_doubles) { - $post[sprintf("%02d",$pos_doubles).'_'.$cat_name]['error_html']['cat_name'] = 'style="background-color:'.$error_color['check_doubles_name_cat'].';" '; - } - $post[$cat]['error_html']['cat_name'] = 'style="background-color:'.$error_color['check_doubles_name_cat'].';" '; - $post['error_messages']['check_doubles_name_cat']['color'] = $error_color['check_doubles_name_cat']; - } - $test_doubles_name_cat[sprintf("%1d",$cat_position)] = $cat_name; - } - if($pages === true) { - if(substr($cat,-(strlen(EXT_LINK))) == EXT_LINK) { - continue; - } - $page_array = getDirAsArray(CONTENT_DIR_REL.$cat,array(EXT_PAGE,EXT_HIDDEN,EXT_DRAFT,EXT_LINK),"sort"); - if(!isset($post[$cat]['error_html']['cat_name'])) { - $post[$cat]['error_html']['cat_name'] = NULL; - } - if(count($page_array) > $max_cat_page) { - $post['error_messages']['check_too_many_pages']['color'] = $error_color['check_too_many_pages']; - $post[$cat]['error_html']['cat_name'] = 'style="background-color:'.$error_color['check_too_many_pages'].';" '; - } - # Wichtig wegen new Inhaltseite - $page_array[$max_cat_page] = NULL; - # die möglichkeit nach action die sachen aufzucklapen (editsite) - $post[$cat]['error_html']['display_cat'] = NULL; - } - foreach($page_array as $pos => $file) { - $position = substr($file,0,2); - # New cat page - if($pos == $max_cat_page) { - $file = EXT_LINK; - $position = NULL; - } else { - $pos = sprintf("%1d",substr($file,0,2)); - } - - $post[$cat]['error_html']['name'][$pos] = NULL; - $post[$cat]['error_html']['display'][$pos] = NULL; - $post[$cat]['error_html']['new_position'][$pos] = NULL; - $post[$cat]['error_html']['new_name'][$pos] = NULL; - $post[$cat]['error_html']['password'][$pos] = NULL; - $post[$cat]['password'][$pos] = NULL; - $post[$cat]['position'][$pos] = $position; - $post[$cat]['new_position'][$pos] = $post[$cat]['position'][$pos]; - $post[$cat]['new_name'][$pos] = NULL; - $post[$cat]['copy'][$pos] = NULL; - # wird nur bei Inhaltseiten gebraucht (move Inhaltseiten in andere Kategory) - if($pages === true) { - $post[$cat]['new_cat'][$pos] = NULL; - $post[$cat]['ext'][$pos] = substr($file,-(strlen(EXT_LINK))); - } - # file ist ein LINK - if(strpos("tmp".$file,EXT_LINK)) { # "tmp" deshalb damit strpos() EXT_LINK findet (strpos = schneller) - $post[$cat]['checked_selv'][$pos] = NULL; - $post[$cat]['checked_blank'][$pos] = ' checked="checked"'; - if(strpos($file,"-_self-")) { - $exlink = explode("-_self-",$file); - $post[$cat]['checked_selv'][$pos] = ' checked="checked"'; - $post[$cat]['checked_blank'][$pos] = NULL; - $post[$cat]['target'][$pos] = '-_self-'; - } - elseif(strpos($file,"-_blank-")) { - $exlink = explode("-_blank-",$file); - $post[$cat]['target'][$pos] = '-_blank-'; - } - if($pos != $max_cat_page) { - $post[$cat]['name'][$pos] = substr($exlink[0],3); - $post[$cat]['url'][$pos] = substr($exlink[1],0,-(strlen(EXT_LINK))); - if($pages === true) { - $post[$cat]['ext'][$pos] = EXT_LINK; - } - } - $post[$cat]['new_url'][$pos] = NULL; - $post[$cat]['error_html']['new_url'][$pos] = NULL; - # file ist eine Kategorie oder Inhaltseite - } else { - if($pages === true) { - $post[$cat]['name'][$pos] = substr($file,3,-(strlen(EXT_LINK))); - } else { - $post[$cat]['name'][$pos] = substr($file,3); - } - } - # nach dopelten Positionen und Namen suchen wichtig bei FTP - if(in_array($position,$test_doubles_position[$cat])) { - if($cat != 'cat') { - $post['error_messages']['check_doubles_position_page'][$pos] = substr($cat,3)." -> ".$position; - } else { - $post['error_messages']['check_doubles_position_cat'][$pos] = $position; - } - } - $test_doubles_position[$cat][] = $position; - $file_name = substr($file,3); - if(strpos($file,EXT_LINK) === false) { - if(in_array($file_name,$test_doubles_name[$cat])) { - if($cat != 'cat') { - foreach(array_keys($test_doubles_name[$cat],$file_name) as $pos_doubles) { - $post[$cat]['error_html']['name'][$pos_doubles] = 'style="background-color:'.$error_color['check_doubles_name_page'].';" '; - } - $post[$cat]['error_html']['name'][$pos] = 'style="background-color:'.$error_color['check_doubles_name_page'].';" '; - $post[$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['error_messages']['check_doubles_name_page']['color'] = $error_color['check_doubles_name_page']; - } else { - foreach(array_keys($test_doubles_name[$cat],$file_name) as $pos_doubles) { - $post[$cat]['error_html']['name'][$pos_doubles] = 'style="background-color:'.$error_color['check_doubles_name_cat'].';" '; - } - $post[$cat]['error_html']['name'][$pos] = 'style="background-color:'.$error_color['check_doubles_name_cat'].';" '; - $post['error_messages']['check_doubles_name_cat']['color'] = $error_color['check_doubles_name_cat']; - } - } - $test_doubles_name[$cat][$pos] = $file_name; - } - } - } - return $post; + global $error_color; + + $max_cat_page = 100; + + $cat_array = getDirAsArray(CONTENT_DIR_REL, "dir", "sort"); + + if (count($cat_array) > $max_cat_page) { + $post ['error_messages'] ['check_too_many_categories'] [] = NULL; + } + // wenn es nur cat ist wird $cat_array = cat $page_array = $cat_array + if ($pages === false) { + // Wichtig wegen new Kategorie + $cat_array [$max_cat_page] = NULL; + $page_array = $cat_array; + unset($cat_array); + $cat_array ['cat'] = 'cat'; + } + $test_doubles_position_cat = array(); + $test_doubles_name_cat = array(); + foreach ($cat_array as $cat) { + $test_doubles_position [$cat] = array(); + $test_doubles_name [$cat] = array(); + // nach dopelten Positionen und namen suchen wichtig bei FTP + if ($cat != 'cat' and strpos($cat, EXT_LINK) === false) { + $cat_position = substr($cat, 0, 2); + if (in_array($cat_position, $test_doubles_position_cat)) { + $post ['error_messages'] ['check_doubles_position_cat'] [] = $cat_position; + } + $test_doubles_position_cat [] = $cat_position; + $cat_name = substr($cat, 3); + if (in_array($cat_name, $test_doubles_name_cat)) { + foreach (array_keys($test_doubles_name_cat, $cat_name) as $pos_doubles) { + $post [sprintf("%02d", $pos_doubles) . '_' . $cat_name] ['error_html'] ['cat_name'] = 'style="background-color:' . $error_color ['check_doubles_name_cat'] . ';" '; + } + $post [$cat] ['error_html'] ['cat_name'] = 'style="background-color:' . $error_color ['check_doubles_name_cat'] . ';" '; + $post ['error_messages'] ['check_doubles_name_cat'] ['color'] = $error_color ['check_doubles_name_cat']; + } + $test_doubles_name_cat [sprintf("%1d", $cat_position)] = $cat_name; + } + if ($pages === true) { + if (substr($cat, -(strlen(EXT_LINK))) == EXT_LINK) { + continue; + } + $page_array = getDirAsArray(CONTENT_DIR_REL . $cat, array( + EXT_PAGE, + EXT_HIDDEN, + EXT_DRAFT, + EXT_LINK + ), "sort"); + if (!isset($post [$cat] ['error_html'] ['cat_name'])) { + $post [$cat] ['error_html'] ['cat_name'] = NULL; + } + if (count($page_array) > $max_cat_page) { + $post ['error_messages'] ['check_too_many_pages'] ['color'] = $error_color ['check_too_many_pages']; + $post [$cat] ['error_html'] ['cat_name'] = 'style="background-color:' . $error_color ['check_too_many_pages'] . ';" '; + } + // Wichtig wegen new Inhaltseite + $page_array [$max_cat_page] = NULL; + // die möglichkeit nach action die sachen aufzucklapen (editsite) + $post [$cat] ['error_html'] ['display_cat'] = NULL; + } + foreach ($page_array as $pos => $file) { + // New cat page + if ($pos == $max_cat_page) { + $file = EXT_LINK; + $position = NULL; + } else { + $pos = sprintf("%1d", substr($file, 0, 2)); + $position = substr($file, 0, 2); + } + + $post [$cat] ['error_html'] ['name'] [$pos] = NULL; + $post [$cat] ['error_html'] ['display'] [$pos] = NULL; + $post [$cat] ['error_html'] ['new_position'] [$pos] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$pos] = NULL; + $post [$cat] ['error_html'] ['password'] [$pos] = NULL; + $post [$cat] ['password'] [$pos] = NULL; + $post [$cat] ['position'] [$pos] = $position; + $post [$cat] ['new_position'] [$pos] = $post [$cat] ['position'] [$pos]; + $post [$cat] ['new_name'] [$pos] = NULL; + $post [$cat] ['copy'] [$pos] = NULL; + // wird nur bei Inhaltseiten gebraucht (move Inhaltseiten in andere Kategory) + if ($pages === true) { + $post [$cat] ['new_cat'] [$pos] = NULL; + $post [$cat] ['ext'] [$pos] = substr($file, -(strlen(EXT_LINK))); + } + // file ist ein LINK + if (strpos("tmp" . $file, EXT_LINK)) { // "tmp" deshalb damit strpos() EXT_LINK findet (strpos = schneller) + $post [$cat] ['checked_selv'] [$pos] = NULL; + $post [$cat] ['checked_blank'] [$pos] = ' checked="checked"'; + if (strpos($file, "-_self-")) { + $exlink = explode("-_self-", $file); + $post [$cat] ['checked_selv'] [$pos] = ' checked="checked"'; + $post [$cat] ['checked_blank'] [$pos] = NULL; + $post [$cat] ['target'] [$pos] = '-_self-'; + } elseif (strpos($file, "-_blank-")) { + $exlink = explode("-_blank-", $file); + $post [$cat] ['target'] [$pos] = '-_blank-'; + } + if ($pos != $max_cat_page) { + $post [$cat] ['name'] [$pos] = substr($exlink [0], 3); + $post [$cat] ['url'] [$pos] = substr($exlink [1], 0, -(strlen(EXT_LINK))); + if ($pages === true) { + $post [$cat] ['ext'] [$pos] = EXT_LINK; + } + } + $post [$cat] ['new_url'] [$pos] = NULL; + $post [$cat] ['error_html'] ['new_url'] [$pos] = NULL; + // file ist eine Kategorie oder Inhaltseite + } else { + if ($pages === true) { + $post [$cat] ['name'] [$pos] = substr($file, 3, -(strlen(EXT_LINK))); + } else { + $post [$cat] ['name'] [$pos] = substr($file, 3); + } + } + // nach dopelten Positionen und Namen suchen wichtig bei FTP + if (in_array($position, $test_doubles_position [$cat])) { + if ($cat != 'cat') { + $post ['error_messages'] ['check_doubles_position_page'] [$pos] = substr($cat, 3) . " -> " . $position; + } else { + $post ['error_messages'] ['check_doubles_position_cat'] [$pos] = $position; + } + } + $test_doubles_position [$cat] [] = $position; + $file_name = substr($file, 3); + if (strpos($file, EXT_LINK) === false) { + if (in_array($file_name, $test_doubles_name [$cat])) { + if ($cat != 'cat') { + foreach (array_keys($test_doubles_name [$cat], $file_name) as $pos_doubles) { + $post [$cat] ['error_html'] ['name'] [$pos_doubles] = 'style="background-color:' . $error_color ['check_doubles_name_page'] . ';" '; + } + $post [$cat] ['error_html'] ['name'] [$pos] = 'style="background-color:' . $error_color ['check_doubles_name_page'] . ';" '; + $post [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['error_messages'] ['check_doubles_name_page'] ['color'] = $error_color ['check_doubles_name_page']; + } else { + foreach (array_keys($test_doubles_name [$cat], $file_name) as $pos_doubles) { + $post [$cat] ['error_html'] ['name'] [$pos_doubles] = 'style="background-color:' . $error_color ['check_doubles_name_cat'] . ';" '; + } + $post [$cat] ['error_html'] ['name'] [$pos] = 'style="background-color:' . $error_color ['check_doubles_name_cat'] . ';" '; + $post ['error_messages'] ['check_doubles_name_cat'] ['color'] = $error_color ['check_doubles_name_cat']; + } + } + $test_doubles_name [$cat] [$pos] = $file_name; + } + } + } + return $post; } -# die daten die von cat oder page übermitelt wurden überprüfen +// die daten die von cat oder page übermitelt wurden überprüfen function checkPostCatPageReturnVariable() { - global $specialchars; - global $error_color; - global $PASSWORDS; - - $max_cat_page = 100; - - foreach ($_POST['categories'] as $cat => $tmp) { - # die möglichkeit nach action die sachen aufzucklapen (editsite) - $post[$cat]['error_html']['display_cat'] = NULL; - if(isset($post[$cat]['error_html']['display_cat'])) { - $post[$cat]['error_html']['display_cat'] = 'style="display:block;" '; - } - if(count($_POST['categories'][$cat]['position']) > $max_cat_page + 1) { - $post['error_messages']['check_too_many_categories'][] = NULL; - } - foreach ($_POST['categories'][$cat]['position'] as $pos => $tmp) {# str_replace('/','%2F',) - # erstmal die Sonderzeichen umwandeln - if(isset($_POST['categories'][$cat]['name'][$pos])) { - $_POST['categories'][$cat]['name'][$pos] = $specialchars->replaceSpecialChars($_POST['categories'][$cat]['name'][$pos],false); - } - if(isset($_POST['categories'][$cat]['new_name'][$pos])) { - $_POST['categories'][$cat]['new_name'][$pos] = $specialchars->replaceSpecialChars($_POST['categories'][$cat]['new_name'][$pos],false); - } - if(isset($_POST['categories'][$cat]['url'][$pos])) { - $_POST['categories'][$cat]['url'][$pos] = str_replace('/','%2F',$specialchars->replaceSpecialChars($_POST['categories'][$cat]['url'][$pos],false)); - } - if(isset($_POST['categories'][$cat]['new_url'][$pos])) { - $_POST['categories'][$cat]['new_url'][$pos] = str_replace('/','%2F',$specialchars->replaceSpecialChars($_POST['categories'][$cat]['new_url'][$pos],false)); - } - if(isset($_POST['categories'][$cat]['new_cat'][$pos])) { - $_POST['categories'][$cat]['new_cat'][$pos] = $specialchars->replaceSpecialChars($_POST['categories'][$cat]['new_cat'][$pos],false); - } - $post[$cat]['error_html']['cat_name'] = NULL; - if(count($_POST['categories'][$cat]['position'][$pos]) > $max_cat_page + 1) { - $post['error_messages']['check_too_many_pages']['color'] = $error_color['check_too_many_pages']; - $post['error_messages']['check_too_many_pages'][] = $cat; - $post[$cat]['error_html']['cat_name'] = 'style="background-color:'.$error_color['check_too_many_pages'].';" '; - } - - if($cat == 'cat') { - $post[$cat]['ext'][$pos] = NULL; - } - $post[$cat]['error_html']['display'][$pos] = NULL; - if(isset($post[$cat]['error_html']['display'][$pos])) { - $post[$cat]['error_html']['display'][$pos] = 'style="display:block;" '; - } - # Neue Kategorie oder Inhaltseite Position oder Name dürfen nicht lehr sein - if($pos == $max_cat_page) { - if(empty($_POST['categories'][$cat]['new_position'][$pos]) and !empty($_POST['categories'][$cat]['new_name'][$pos])) { - $post['error_messages']['check_new_position_empty']['color'] = $error_color['check_new_position_empty']; - $post['error_messages']['check_new_position_empty'][] = NULL; - $post[$cat]['error_html']['new_position'][$pos] = 'style="background-color:'.$error_color['check_new_position_empty'].';" '; - } - if(!empty($_POST['categories'][$cat]['new_position'][$pos]) and empty($_POST['categories'][$cat]['new_name'][$pos])) { - $post['error_messages']['check_new_name_empty']['color'] = $error_color['check_new_name_empty']; - $post['error_messages']['check_new_name_empty'][] = NULL; - $post[$cat]['error_html']['new_name'][$pos] = 'style="background-color:'.$error_color['check_new_name_empty'].';" '; - } - if(empty($_POST['categories'][$cat]['new_position'][$pos]) and empty($_POST['categories'][$cat]['new_name'][$pos]) and !empty($_POST['categories'][$cat]['new_url'][$pos])) { - $post['error_messages']['check_new_position_empty']['color'] = $error_color['check_new_position_empty']; - $post['error_messages']['check_new_position_empty'][] = NULL; - $post[$cat]['error_html']['new_position'][$pos] = 'style="background-color:'.$error_color['check_new_position_empty'].';" '; - $post['error_messages']['check_new_name_empty'][] = NULL; - $post[$cat]['error_html']['new_name'][$pos] = 'style="background-color:'.$error_color['check_new_name_empty'].';" '; - } - $_POST['categories'][$cat]['new_cat'][$pos] = NULL; - } - $post[$cat]['copy'][$pos] = NULL; - if(isset($_POST['categories'][$cat]['copy'][$pos])) { - $post[$cat]['copy'][$pos] = ' checked'; - } - - if(isset($_POST['categories'][$cat]['position'][$pos])) { - $post[$cat]['position'][$pos] = $_POST['categories'][$cat]['position'][$pos]; - } - if(!isset($post[$cat]['error_html']['new_position'][$pos])) { - $post[$cat]['error_html']['new_position'][$pos] = NULL; - } - - if(isset($_POST['categories'][$cat]['new_position'][$pos])) { - # nach doppelten new_position suchen auser new cat page oder move copy page - $doubles = array_keys($_POST['categories'][$cat]['new_position'],sprintf("%02d",$pos)); - $doubles_count = count($doubles); - if(in_array($max_cat_page,$doubles)) { - $doubles_count--; - } - if(in_array(sprintf("%02d",$pos),$doubles)) { - $doubles_count--; - } - if($doubles_count > 1) { - foreach($doubles as $tmp => $error_posi) { - $post['error_messages']['check_doubles_digit_same_cat']['color'] = $error_color['check_doubles_digit_same_cat']; - $post['error_messages']['check_doubles_digit_same_cat'][] = NULL; - $post[$cat]['error_html']['new_position'][$error_posi] = 'style="background-color:'.$error_color['check_doubles_digit_same_cat'].';" '; - } - } - # Neue Page Cat - if(empty($_POST['categories'][$cat]['new_position'][$pos]) and empty($_POST['categories'][$cat]['position'][$pos])) { - $post[$cat]['new_position'][$pos] = NULL; - # Neue Position auf Zahl Prüfen und 2stelig machen - } elseif(ctype_digit($_POST['categories'][$cat]['new_position'][$pos])) { - $post[$cat]['new_position'][$pos] = sprintf("%02d",$_POST['categories'][$cat]['new_position'][$pos]); - } else { -# $post[$cat]['error']['invalid_digit'][$pos] = true; - $post['error_messages']['check_digit']['color'] = $error_color['check_digit']; - $post['error_messages']['check_digit'][] = NULL; - $post[$cat]['error_html']['new_position'][$pos] = 'style="background-color:'.$error_color['check_digit'].';" '; - $post[$cat]['new_position'][$pos] = trim($_POST['categories'][$cat]['new_position'][$pos]); - } - } - # wenn es keine Kategorie ist 0 ansonsten $ext_len = strlen($post[$cat]['ext'][$pos]) - $ext_len = 0; - if(isset($_POST['categories'][$cat]['ext'][$pos])) { - $post[$cat]['ext'][$pos] = $_POST['categories'][$cat]['ext'][$pos]; - $ext_len = strlen($post[$cat]['ext'][$pos]); - } - $name_len = 0; - $post[$cat]['name'][$pos] = NULL; - if(isset($_POST['categories'][$cat]['name'][$pos])) { - $post[$cat]['name'][$pos] = $_POST['categories'][$cat]['name'][$pos]; - $name_len = strlen($post[$cat]['name'][$pos]); - } - - - $post[$cat]['error_html']['password'][$pos] = NULL; - $post[$cat]['password'][$pos] = NULL; - if(isset($_POST['categories'][$cat]['password_del'][$pos])) { - $post[$cat]['password_del'][$pos] = "true"; - } -# Paswort prüfen noch hier!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if(!empty($_POST['categories'][$cat]['password'][$pos])) { - $post[$cat]['password'][$pos] = $_POST['categories'][$cat]['password'][$pos]; - } - - if(!isset($post[$cat]['error_html']['new_name'][$pos])) { - $post[$cat]['error_html']['new_name'][$pos] = NULL; - } - if(!isset($post[$cat]['error_html']['name'][$pos])) { - $post[$cat]['error_html']['name'][$pos] = NULL; - } - if(isset($_POST['categories'][$cat]['new_name'][$pos])) { - $post[$cat]['new_name'][$pos] = NULL; - # Cat Page Umbenen bei Page in gleicher Cat - if(strlen(trim($_POST['categories'][$cat]['new_name'][$pos])) > "0") { - $post[$cat]['new_name'][$pos] = $_POST['categories'][$cat]['new_name'][$pos]; - $newname = $post[$cat]['new_name'][$pos]; - $name_len = strlen($newname); - if(!preg_match(ALLOWED_SPECIALCHARS_REGEX, $newname) or stristr($newname,"%5E")) { - $post['error_messages']['check_name']['color'] = $error_color['check_name']; - $post['error_messages']['check_name'][] = NULL; - $post[$cat]['error_html']['new_name'][$pos] = 'style="background-color:'.$error_color['check_name'].';" '; - } - $test_cat = $cat; - if(isset($_POST['categories'][$cat]['new_cat'][$pos])) { - $test_cat = $_POST['categories'][$cat]['new_cat'][$pos]; - } - if(!isset($_POST['categories'][$cat]['url'][$pos]) and empty($_POST['categories'][$cat]['new_url'][$pos]) and $test_cat == $cat) { - if(isset($_POST['categories'][$cat]['name']) and is_array($_POST['categories'][$cat]['name']) and count(array_keys($_POST['categories'][$cat]['name'], $newname)) > 0) { - $tmp_pos = array_keys($_POST['categories'][$cat]['name'], $newname); - # Neu Name gipts schonn auser wenn der Name auch Umbenant wird - if(empty($_POST['categories'][$cat]['new_name'][$tmp_pos[0]])) { - $post[$cat]['error_html']['name'][$tmp_pos[0]] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - $post['error_messages']['check_name_exist']['color'] = $error_color['check_name_exist']; - $post['error_messages']['check_name_exist'][] = NULL; - $post[$cat]['error_html']['new_name'][$pos] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - } - # wenn Neu Name mehr wie einmal in Neu Nmamen ist - if(count(array_keys($_POST['categories'][$cat]['new_name'], $_POST['categories'][$cat]['new_name'][$pos])) > 1) { - $post['error_messages']['check_name_exist']['color'] = $error_color['check_name_exist']; - $post['error_messages']['check_name_exist'][] = NULL; - $post[$cat]['error_html']['new_name'][$pos] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - } - } - } else { - if(!isset($post[$cat]['error_html']['new_name'][$pos])) { - $post[$cat]['error_html']['new_name'][$pos] = NULL; - } - } - } - } - $url_len = 0; - if(isset($_POST['categories'][$cat]['url'][$pos])) { - $post[$cat]['url'][$pos] = $_POST['categories'][$cat]['url'][$pos]; - $url_len = strlen($post[$cat]['url'][$pos]); - # urls haben immer eine ext. - $ext_len = strlen(EXT_LINK); - } - $post[$cat]['error_html']['new_url'][$pos] = NULL; - $post[$cat]['new_url'][$pos] = NULL; - if(isset($_POST['categories'][$cat]['new_url'][$pos])) { - $post[$cat]['new_url'][$pos] = trim(str_replace(array("\r\n","\n","\r"),'',$_POST['categories'][$cat]['new_url'][$pos])); - if(strlen($post[$cat]['new_url'][$pos]) > "0") { - $url_len = strlen($post[$cat]['new_url'][$pos]); - # urls haben immer eine ext. - $ext_len = strlen(EXT_LINK); - if(!preg_match(ALLOWED_SPECIALCHARS_REGEX, $post[$cat]['new_url'][$pos]) or stristr($post[$cat]['new_url'][$pos],"%5E")) { - $post['error_messages']['check_url']['color'] = $error_color['check_url']; - $post['error_messages']['check_url'][] = NULL; - $post[$cat]['error_html']['new_url'][$pos] = 'style="background-color:'.$error_color['check_url'].';" '; - } - if(strpos($post[$cat]['new_url'][$pos],"%3A%2F%2F") < 1) { - $post['error_messages']['check_url_full']['color'] = $error_color['check_url_full']; - $post['error_messages']['check_url_full'][] = NULL; - $post[$cat]['error_html']['new_url'][$pos] = 'style="background-color:'.$error_color['check_url'].';" '; - } - } - } - $target_len = 0; - $post[$cat]['target'][$pos] = NULL; - if(isset($_POST['categories'][$cat]['target'][$pos])) { - $post[$cat]['target'][$pos] = $_POST['categories'][$cat]['target'][$pos]; - $target_len = 8; # -_blank- - if($post[$cat]['target'][$pos] == "-_self-") { - $target_len = 7; # -_self- - } - } - if(isset($_POST['categories'][$cat]['new_target'][$pos])) { - $post[$cat]['checked_selv'][$pos] = ''; - $post[$cat]['checked_blank'][$pos] = ' checked="checked"'; - $target_len = 8; # -_blank- - if($_POST['categories'][$cat]['new_target'][$pos] == "-_self-") { - $target_len = 7; # -_self- - $post[$cat]['checked_selv'][$pos] = ' checked="checked"'; - $post[$cat]['checked_blank'][$pos] = ''; - } - $post[$cat]['new_target'][$pos] = NULL; - if($_POST['categories'][$cat]['new_target'][$pos] != $post[$cat]['target'][$pos]) { - $post[$cat]['new_target'][$pos] = $_POST['categories'][$cat]['new_target'][$pos]; - } - } - - # hab ich hier, drin um bei copymove nicht extra noch eine foreach zu machen - # ist dafür zuständig wenn Inhaltseite in andere Kategorie verschoben wird - if(isset($_POST['categories'][$cat]['new_cat'][$pos])) { - $post[$cat]['new_cat'][$pos] = $_POST['categories'][$cat]['new_cat'][$pos]; - if($post[$cat]['new_cat'][$pos] != $cat or !empty($post[$cat]['copy'][$pos])) { - $post['move_copy']['source']['cat'][$pos] = $cat; - $post['move_copy']['source']['position'][$pos] = $post[$cat]['position'][$pos]; - $post['move_copy']['source']['name'][$pos] = $post[$cat]['name'][$pos]; - $move_copy_test['new_position'][] = $post[$cat]['new_position'][$pos]; - if(!empty($post[$cat]['copy'][$pos])) { - $post['move_copy']['source']['copy'][$pos] = $post[$cat]['copy'][$pos]; - } - $post['move_copy']['desti']['cat'][$pos] = $post[$cat]['new_cat'][$pos]; - $post['move_copy']['desti']['new_position'][$pos] = $post[$cat]['new_position'][$pos]; - $post['move_copy']['desti']['ext'][$pos] = $post[$cat]['ext'][$pos]; - - $move_copy_test['new_cat'][] = $post[$cat]['new_cat'][$pos]; - $move_copy_test['org_cat'][] = $cat; - if(!empty($post[$cat]['new_name'][$pos])) { - $post['move_copy']['desti']['name'][$pos] = $post[$cat]['new_name'][$pos]; - $move_copy_test['name'][] = $post[$cat]['new_name'][$pos]; - $move_copy_test['pos_org_name'][] = $pos; - } else { - $post['move_copy']['desti']['name'][$pos] = $post[$cat]['name'][$pos]; - $move_copy_test['name'][] = $post[$cat]['name'][$pos]; - $move_copy_test['pos_org_name'][] = $pos; - } - if(isset($post[$cat]['url'][$pos])) { - $post['move_copy']['source']['name'][$pos] .= $post[$cat]['target'][$pos].$post[$cat]['url'][$pos]; - - $new_target = $post[$cat]['target'][$pos]; - if(!empty($post[$cat]['new_target'][$pos])) { - $new_target = $post[$cat]['new_target'][$pos]; - } - - $new_url = $post[$cat]['url'][$pos]; - if(!empty($post[$cat]['new_url'][$pos])) { - $new_url = $post[$cat]['new_url'][$pos]; - } - $post['move_copy']['desti']['name'][$pos] .= $new_target.$new_url; - } - } - } - # maximale länge der ordner oder dateinamen - $max_zeichen = 255; - # prüfen der cat page auf max_zeichen - if((3 + $name_len + $target_len + $url_len + $ext_len) > $max_zeichen) { - if(!empty($post[$cat]['new_url'][$pos])) { - $post[$cat]['error_html']['new_url'][$pos] = 'style="background-color:'.$error_color['check_name_too_long'].';" '; - } - if(!empty($post[$cat]['new_name'][$pos])) { - $post[$cat]['error_html']['new_name'][$pos] = 'style="background-color:'.$error_color['check_name_too_long'].';" '; - } - $post['error_messages']['check_name_too_long']['color'] = $error_color['check_name_too_long']; - $post['error_messages']['check_name_too_long'][] = NULL; - } - unset($name_len,$target_len,$url_len,$ext_len); - - if($cat != "cat") { - $kategorie = $cat."/"; - } else { - $kategorie = NULL; - } - # existiert die cat oder page überhaupt - if(!isset($post[$cat]['url'][$pos]) and isset($post[$cat]['position'][$pos]) and isset($post[$cat]['name'][$pos])) { - $file_test = CONTENT_DIR_REL.$kategorie.$post[$cat]['position'][$pos]."_".$post[$cat]['name'][$pos].$post[$cat]['ext'][$pos]; - If(is_file($file_test)) { - $tt = true; - } elseif(is_dir($file_test)) { - $tt = true; - } else { - $post['error_messages']['check_is_file']['color'] = $error_color['check_is_file']; - $post['error_messages']['check_is_file'][] = NULL; - $post[$cat]['error_html']['name'][$pos] = 'style="background-color:'.$error_color['check_is_file'].';" '; - } - } elseif(isset($post[$cat]['url'][$pos]) and isset($post[$cat]['position'][$pos]) and isset($post[$cat]['name'][$pos]) and isset($post[$cat]['target'][$pos]) and isset($post[$cat]['url'][$pos])) { - $file_test =CONTENT_DIR_REL.$kategorie.$post[$cat]['position'][$pos]."_".$post[$cat]['name'][$pos].$post[$cat]['target'][$pos].$post[$cat]['url'][$pos].EXT_LINK; - if(is_file($file_test)) { - $tt = true; - } elseif(is_dir($file_test)) { - $tt = true; - } else { - $post['error_messages']['check_is_file']['color'] = $error_color['check_is_file']; - $post['error_messages']['check_is_file'][] = NULL; - $post[$cat]['error_html']['name'][$pos] = 'style="background-color:'.$error_color['check_is_file'].';" '; - } - } - # nochmal wenn error gesetzt ist um alle edit sachen auszucklapen - if(!empty($post[$cat]['error_html'])) { - foreach ($post[$cat]['error_html'] as $test => $tmp) { - if(!empty($post[$cat]['error_html'][$test][$pos])) { - if($cat != "cat") { - $post[$cat]['error_html']['display_cat'] = 'style="display:block;" '; - } - if(!empty($post[$cat]['new_name'][$pos]) or !empty($post[$cat]['new_url'][$pos])) { - $post[$cat]['error_html']['display'][$pos] = 'style="display:block;" '; - } - } - } - } - } - } # foreach cat end - - # prüfen wenn page in andere cat cp oder mv wird obs die da schonn gibt - if(isset($move_copy_test)) { - foreach($move_copy_test['new_cat'] as $move_copy_pos => $tmp) { - $newname = $move_copy_test['name'][$move_copy_pos]; - $cat = $move_copy_test['new_cat'][$move_copy_pos]; - $org_cat = $move_copy_test['org_cat'][$move_copy_pos]; - $org_pos = $move_copy_test['pos_org_name'][$move_copy_pos]; - - # wenn bei move copy in gleiche Kategorie source new_position mehr wie 2 mal vorkomt error - $doubles = array_keys($move_copy_test['new_position'],$move_copy_test['new_position'][$move_copy_pos]); - if(count($doubles) > 1) { - $post['error_messages']['check_doubles_digit_copy_move']['color'] = $error_color['check_doubles_digit_copy_move']; - $post['error_messages']['check_doubles_digit_copy_move'][] = NULL; - $post[$org_cat]['error_html']['new_position'][$org_pos] = 'style="background-color:'.$error_color['check_doubles_digit_copy_move'].';" '; - $post[$org_cat]['error_html']['display_cat'] = 'style="display:block;" '; - } - - - if(count(array_keys($post[$cat]['name'], $newname)) > 0 or count(array_keys($post[$cat]['new_name'], $newname)) > 0) { - $tmp_pos_name = array_keys($post[$cat]['name'], $newname); - $tmp_pos_new_name = array_keys($post[$cat]['new_name'], $newname); - # Neu Name gipts schonn auser wenn der Name auch Umbenant wird - if(count($tmp_pos_name) > 0 and $cat != $org_cat) { - $post[$cat]['error_html']['name'][$tmp_pos_name[0]] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - $post['error_messages']['check_name_exist']['color'] = $error_color['check_name_exist']; - $post['error_messages']['check_name_exist'][] = NULL; - } - if(count($tmp_pos_new_name) > 0 and $cat != $org_cat) { - $post['error_messages']['check_name_exist']['color'] = $error_color['check_name_exist']; - $post['error_messages']['check_name_exist'][] = NULL; - $post[$cat]['error_html']['new_name'][$tmp_pos_new_name[0]] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - $post[$cat]['error_html']['display'][$tmp_pos_new_name[0]] = 'style="display:block;" '; - } - if(empty($post[$org_cat]['new_name'][$org_pos])) { - $post[$org_cat]['error_html']['name'][$org_pos] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - } else { - $post[$org_cat]['error_html']['new_name'][$org_pos] = 'style="background-color:'.$error_color['check_name_exist'].';" '; - } - if($cat == $org_cat) { - $post['error_messages']['check_copy_same_cat']['color'] = $error_color['check_copy_same_cat']; - $post['error_messages']['check_copy_same_cat'][] = NULL; - $post[$org_cat]['error_html']['name'][$org_pos] = 'style="background-color:'.$error_color['check_copy_same_cat'].';" '; - if(isset($post[$org_cat]['error_html']['new_name'][$org_pos])) { - unset($post[$org_cat]['error_html']['new_name'][$org_pos]); - } - } - $post[$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post[$org_cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post[$org_cat]['error_html']['display'][$org_pos] = 'style="display:block;" '; - } - } - } - return $post; + global $specialchars; + global $error_color; + global $PASSWORDS; + + $max_cat_page = 100; + + foreach ($_POST ['categories'] as $cat => $tmp) { + // die möglichkeit nach action die sachen aufzucklapen (editsite) + $post [$cat] ['error_html'] ['display_cat'] = NULL; + if (isset($post [$cat] ['error_html'] ['display_cat'])) { + $post [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + } + if (count($_POST ['categories'] [$cat] ['position']) > $max_cat_page + 1) { + $post ['error_messages'] ['check_too_many_categories'] [] = NULL; + } + foreach ($_POST ['categories'] [$cat] ['position'] as $pos => $tmp) { // str_replace('/','%2F',) + // erstmal die Sonderzeichen umwandeln + if (isset($_POST ['categories'] [$cat] ['name'] [$pos])) { + $_POST ['categories'] [$cat] ['name'] [$pos] = $specialchars->replaceSpecialChars($_POST ['categories'] [$cat] ['name'] [$pos], false); + } + if (isset($_POST ['categories'] [$cat] ['new_name'] [$pos])) { + $_POST ['categories'] [$cat] ['new_name'] [$pos] = $specialchars->replaceSpecialChars($_POST ['categories'] [$cat] ['new_name'] [$pos], false); + } + if (isset($_POST ['categories'] [$cat] ['url'] [$pos])) { + $_POST ['categories'] [$cat] ['url'] [$pos] = str_replace('/', '%2F', $specialchars->replaceSpecialChars($_POST ['categories'] [$cat] ['url'] [$pos], false)); + } + if (isset($_POST ['categories'] [$cat] ['new_url'] [$pos])) { + $_POST ['categories'] [$cat] ['new_url'] [$pos] = str_replace('/', '%2F', $specialchars->replaceSpecialChars($_POST ['categories'] [$cat] ['new_url'] [$pos], false)); + } + if (isset($_POST ['categories'] [$cat] ['new_cat'] [$pos])) { + $_POST ['categories'] [$cat] ['new_cat'] [$pos] = $specialchars->replaceSpecialChars($_POST ['categories'] [$cat] ['new_cat'] [$pos], false); + } + $post [$cat] ['error_html'] ['cat_name'] = NULL; + if ($_POST ['categories'] [$cat] ['position'] [$pos] > $max_cat_page + 1) { + $post ['error_messages'] ['check_too_many_pages'] ['color'] = $error_color ['check_too_many_pages']; + $post ['error_messages'] ['check_too_many_pages'] [] = $cat; + $post [$cat] ['error_html'] ['cat_name'] = 'style="background-color:' . $error_color ['check_too_many_pages'] . ';" '; + } + + if ($cat == 'cat') { + $post [$cat] ['ext'] [$pos] = NULL; + } + $post [$cat] ['error_html'] ['display'] [$pos] = NULL; + if (isset($post [$cat] ['error_html'] ['display'] [$pos])) { + $post [$cat] ['error_html'] ['display'] [$pos] = 'style="display:block;" '; + } + // Neue Kategorie oder Inhaltseite Position oder Name dürfen nicht lehr sein + if ($pos == $max_cat_page) { + if (empty($_POST ['categories'] [$cat] ['new_position'] [$pos]) and !empty($_POST ['categories'] [$cat] ['new_name'] [$pos])) { + $post ['error_messages'] ['check_new_position_empty'] ['color'] = $error_color ['check_new_position_empty']; + $post ['error_messages'] ['check_new_position_empty'] [] = NULL; + $post [$cat] ['error_html'] ['new_position'] [$pos] = 'style="background-color:' . $error_color ['check_new_position_empty'] . ';" '; + } + if (!empty($_POST ['categories'] [$cat] ['new_position'] [$pos]) and empty($_POST ['categories'] [$cat] ['new_name'] [$pos])) { + $post ['error_messages'] ['check_new_name_empty'] ['color'] = $error_color ['check_new_name_empty']; + $post ['error_messages'] ['check_new_name_empty'] [] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$pos] = 'style="background-color:' . $error_color ['check_new_name_empty'] . ';" '; + } + if (empty($_POST ['categories'] [$cat] ['new_position'] [$pos]) and empty($_POST ['categories'] [$cat] ['new_name'] [$pos]) and !empty($_POST ['categories'] [$cat] ['new_url'] [$pos])) { + $post ['error_messages'] ['check_new_position_empty'] ['color'] = $error_color ['check_new_position_empty']; + $post ['error_messages'] ['check_new_position_empty'] [] = NULL; + $post [$cat] ['error_html'] ['new_position'] [$pos] = 'style="background-color:' . $error_color ['check_new_position_empty'] . ';" '; + $post ['error_messages'] ['check_new_name_empty'] [] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$pos] = 'style="background-color:' . $error_color ['check_new_name_empty'] . ';" '; + } + $_POST ['categories'] [$cat] ['new_cat'] [$pos] = NULL; + } + $post [$cat] ['copy'] [$pos] = NULL; + if (isset($_POST ['categories'] [$cat] ['copy'] [$pos])) { + $post [$cat] ['copy'] [$pos] = ' checked'; + } + + if (isset($_POST ['categories'] [$cat] ['position'] [$pos])) { + $post [$cat] ['position'] [$pos] = $_POST ['categories'] [$cat] ['position'] [$pos]; + } + if (!isset($post [$cat] ['error_html'] ['new_position'] [$pos])) { + $post [$cat] ['error_html'] ['new_position'] [$pos] = NULL; + } + + if (isset($_POST ['categories'] [$cat] ['new_position'] [$pos])) { + // nach doppelten new_position suchen auser new cat page oder move copy page + $doubles = array_keys($_POST ['categories'] [$cat] ['new_position'], sprintf("%02d", $pos)); + $doubles_count = count($doubles); + if (in_array($max_cat_page, $doubles)) { + $doubles_count--; + } + if (in_array(sprintf("%02d", $pos), $doubles)) { + $doubles_count--; + } + if ($doubles_count > 1) { + foreach ($doubles as $tmp => $error_posi) { + $post ['error_messages'] ['check_doubles_digit_same_cat'] ['color'] = $error_color ['check_doubles_digit_same_cat']; + $post ['error_messages'] ['check_doubles_digit_same_cat'] [] = NULL; + $post [$cat] ['error_html'] ['new_position'] [$error_posi] = 'style="background-color:' . $error_color ['check_doubles_digit_same_cat'] . ';" '; + } + } + // Neue Page Cat + if (empty($_POST ['categories'] [$cat] ['new_position'] [$pos]) and empty($_POST ['categories'] [$cat] ['position'] [$pos])) { + $post [$cat] ['new_position'] [$pos] = NULL; + // Neue Position auf Zahl Prüfen und 2stelig machen + } elseif (ctype_digit($_POST ['categories'] [$cat] ['new_position'] [$pos])) { + $post [$cat] ['new_position'] [$pos] = sprintf("%02d", $_POST ['categories'] [$cat] ['new_position'] [$pos]); + } else { + // $post[$cat]['error']['invalid_digit'][$pos] = true; + $post ['error_messages'] ['check_digit'] ['color'] = $error_color ['check_digit']; + $post ['error_messages'] ['check_digit'] [] = NULL; + $post [$cat] ['error_html'] ['new_position'] [$pos] = 'style="background-color:' . $error_color ['check_digit'] . ';" '; + $post [$cat] ['new_position'] [$pos] = trim($_POST ['categories'] [$cat] ['new_position'] [$pos]); + } + } + // wenn es keine Kategorie ist 0 ansonsten $ext_len = strlen($post[$cat]['ext'][$pos]) + $ext_len = 0; + if (isset($_POST ['categories'] [$cat] ['ext'] [$pos])) { + $post [$cat] ['ext'] [$pos] = $_POST ['categories'] [$cat] ['ext'] [$pos]; + $ext_len = strlen($post [$cat] ['ext'] [$pos]); + } + $name_len = 0; + $post [$cat] ['name'] [$pos] = NULL; + if (isset($_POST ['categories'] [$cat] ['name'] [$pos])) { + $post [$cat] ['name'] [$pos] = $_POST ['categories'] [$cat] ['name'] [$pos]; + $name_len = strlen($post [$cat] ['name'] [$pos]); + } + + $post [$cat] ['error_html'] ['password'] [$pos] = NULL; + $post [$cat] ['password'] [$pos] = NULL; + if (isset($_POST ['categories'] [$cat] ['password_del'] [$pos])) { + $post [$cat] ['password_del'] [$pos] = "true"; + } + // Paswort prüfen noch hier!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + if (!empty($_POST ['categories'] [$cat] ['password'] [$pos])) { + $post [$cat] ['password'] [$pos] = $_POST ['categories'] [$cat] ['password'] [$pos]; + } + + if (!isset($post [$cat] ['error_html'] ['new_name'] [$pos])) { + $post [$cat] ['error_html'] ['new_name'] [$pos] = NULL; + } + if (!isset($post [$cat] ['error_html'] ['name'] [$pos])) { + $post [$cat] ['error_html'] ['name'] [$pos] = NULL; + } + if (isset($_POST ['categories'] [$cat] ['new_name'] [$pos])) { + $post [$cat] ['new_name'] [$pos] = NULL; + // Cat Page Umbenen bei Page in gleicher Cat + if (strlen(trim($_POST ['categories'] [$cat] ['new_name'] [$pos])) > "0") { + $post [$cat] ['new_name'] [$pos] = $_POST ['categories'] [$cat] ['new_name'] [$pos]; + $newname = $post [$cat] ['new_name'] [$pos]; + $name_len = strlen($newname); + if (!preg_match(ALLOWED_SPECIALCHARS_REGEX, $newname) or stristr($newname, "%5E")) { + $post ['error_messages'] ['check_name'] ['color'] = $error_color ['check_name']; + $post ['error_messages'] ['check_name'] [] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$pos] = 'style="background-color:' . $error_color ['check_name'] . ';" '; + } + $test_cat = $cat; + if (isset($_POST ['categories'] [$cat] ['new_cat'] [$pos])) { + $test_cat = $_POST ['categories'] [$cat] ['new_cat'] [$pos]; + } + if (!isset($_POST ['categories'] [$cat] ['url'] [$pos]) and empty($_POST ['categories'] [$cat] ['new_url'] [$pos]) and $test_cat == $cat) { + if (isset($_POST ['categories'] [$cat] ['name']) and is_array($_POST ['categories'] [$cat] ['name']) and count(array_keys($_POST ['categories'] [$cat] ['name'], $newname)) > 0) { + $tmp_pos = array_keys($_POST ['categories'] [$cat] ['name'], $newname); + // Neu Name gipts schonn auser wenn der Name auch Umbenant wird + if (empty($_POST ['categories'] [$cat] ['new_name'] [$tmp_pos [0]])) { + $post [$cat] ['error_html'] ['name'] [$tmp_pos [0]] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + $post ['error_messages'] ['check_name_exist'] ['color'] = $error_color ['check_name_exist']; + $post ['error_messages'] ['check_name_exist'] [] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$pos] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + } + // wenn Neu Name mehr wie einmal in Neu Nmamen ist + if (count(array_keys($_POST ['categories'] [$cat] ['new_name'], $_POST ['categories'] [$cat] ['new_name'] [$pos])) > 1) { + $post ['error_messages'] ['check_name_exist'] ['color'] = $error_color ['check_name_exist']; + $post ['error_messages'] ['check_name_exist'] [] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$pos] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + } + } + } else { + if (!isset($post [$cat] ['error_html'] ['new_name'] [$pos])) { + $post [$cat] ['error_html'] ['new_name'] [$pos] = NULL; + } + } + } + } + $url_len = 0; + if (isset($_POST ['categories'] [$cat] ['url'] [$pos])) { + $post [$cat] ['url'] [$pos] = $_POST ['categories'] [$cat] ['url'] [$pos]; + $url_len = strlen($post [$cat] ['url'] [$pos]); + // urls haben immer eine ext. + $ext_len = strlen(EXT_LINK); + } + $post [$cat] ['error_html'] ['new_url'] [$pos] = NULL; + $post [$cat] ['new_url'] [$pos] = NULL; + if (isset($_POST ['categories'] [$cat] ['new_url'] [$pos])) { + $post [$cat] ['new_url'] [$pos] = trim(str_replace(array( + "\r\n", + "\n", + "\r" + ), '', $_POST ['categories'] [$cat] ['new_url'] [$pos])); + if (strlen($post [$cat] ['new_url'] [$pos]) > "0") { + $url_len = strlen($post [$cat] ['new_url'] [$pos]); + // urls haben immer eine ext. + $ext_len = strlen(EXT_LINK); + if (!preg_match(ALLOWED_SPECIALCHARS_REGEX, $post [$cat] ['new_url'] [$pos]) or stristr($post [$cat] ['new_url'] [$pos], "%5E")) { + $post ['error_messages'] ['check_url'] ['color'] = $error_color ['check_url']; + $post ['error_messages'] ['check_url'] [] = NULL; + $post [$cat] ['error_html'] ['new_url'] [$pos] = 'style="background-color:' . $error_color ['check_url'] . ';" '; + } + if (strpos($post [$cat] ['new_url'] [$pos], "%3A%2F%2F") < 1) { + $post ['error_messages'] ['check_url_full'] ['color'] = $error_color ['check_url_full']; + $post ['error_messages'] ['check_url_full'] [] = NULL; + $post [$cat] ['error_html'] ['new_url'] [$pos] = 'style="background-color:' . $error_color ['check_url'] . ';" '; + } + } + } + $target_len = 0; + $post [$cat] ['target'] [$pos] = NULL; + if (isset($_POST ['categories'] [$cat] ['target'] [$pos])) { + $post [$cat] ['target'] [$pos] = $_POST ['categories'] [$cat] ['target'] [$pos]; + $target_len = 8; // -_blank- + if ($post [$cat] ['target'] [$pos] == "-_self-") { + $target_len = 7; // -_self- + } + } + if (isset($_POST ['categories'] [$cat] ['new_target'] [$pos])) { + $post [$cat] ['checked_selv'] [$pos] = ''; + $post [$cat] ['checked_blank'] [$pos] = ' checked="checked"'; + $target_len = 8; // -_blank- + if ($_POST ['categories'] [$cat] ['new_target'] [$pos] == "-_self-") { + $target_len = 7; // -_self- + $post [$cat] ['checked_selv'] [$pos] = ' checked="checked"'; + $post [$cat] ['checked_blank'] [$pos] = ''; + } + $post [$cat] ['new_target'] [$pos] = NULL; + if ($_POST ['categories'] [$cat] ['new_target'] [$pos] != $post [$cat] ['target'] [$pos]) { + $post [$cat] ['new_target'] [$pos] = $_POST ['categories'] [$cat] ['new_target'] [$pos]; + } + } + + // hab ich hier, drin um bei copymove nicht extra noch eine foreach zu machen + // ist dafür zuständig wenn Inhaltseite in andere Kategorie verschoben wird + if (isset($_POST ['categories'] [$cat] ['new_cat'] [$pos])) { + $post [$cat] ['new_cat'] [$pos] = $_POST ['categories'] [$cat] ['new_cat'] [$pos]; + if ($post [$cat] ['new_cat'] [$pos] != $cat or !empty($post [$cat] ['copy'] [$pos])) { + $post ['move_copy'] ['source'] ['cat'] [$pos] = $cat; + $post ['move_copy'] ['source'] ['position'] [$pos] = $post [$cat] ['position'] [$pos]; + $post ['move_copy'] ['source'] ['name'] [$pos] = $post [$cat] ['name'] [$pos]; + $move_copy_test ['new_position'] [] = $post [$cat] ['new_position'] [$pos]; + if (!empty($post [$cat] ['copy'] [$pos])) { + $post ['move_copy'] ['source'] ['copy'] [$pos] = $post [$cat] ['copy'] [$pos]; + } + $post ['move_copy'] ['desti'] ['cat'] [$pos] = $post [$cat] ['new_cat'] [$pos]; + $post ['move_copy'] ['desti'] ['new_position'] [$pos] = $post [$cat] ['new_position'] [$pos]; + $post ['move_copy'] ['desti'] ['ext'] [$pos] = $post [$cat] ['ext'] [$pos]; + + $move_copy_test ['new_cat'] [] = $post [$cat] ['new_cat'] [$pos]; + $move_copy_test ['org_cat'] [] = $cat; + if (!empty($post [$cat] ['new_name'] [$pos])) { + $post ['move_copy'] ['desti'] ['name'] [$pos] = $post [$cat] ['new_name'] [$pos]; + $move_copy_test ['name'] [] = $post [$cat] ['new_name'] [$pos]; + $move_copy_test ['pos_org_name'] [] = $pos; + } else { + $post ['move_copy'] ['desti'] ['name'] [$pos] = $post [$cat] ['name'] [$pos]; + $move_copy_test ['name'] [] = $post [$cat] ['name'] [$pos]; + $move_copy_test ['pos_org_name'] [] = $pos; + } + if (isset($post [$cat] ['url'] [$pos])) { + $post ['move_copy'] ['source'] ['name'] [$pos] .= $post [$cat] ['target'] [$pos] . $post [$cat] ['url'] [$pos]; + + $new_target = $post [$cat] ['target'] [$pos]; + if (!empty($post [$cat] ['new_target'] [$pos])) { + $new_target = $post [$cat] ['new_target'] [$pos]; + } + + $new_url = $post [$cat] ['url'] [$pos]; + if (!empty($post [$cat] ['new_url'] [$pos])) { + $new_url = $post [$cat] ['new_url'] [$pos]; + } + $post ['move_copy'] ['desti'] ['name'] [$pos] .= $new_target . $new_url; + } + } + } + // maximale länge der ordner oder dateinamen + $max_zeichen = 255; + // prüfen der cat page auf max_zeichen + if ((3 + $name_len + $target_len + $url_len + $ext_len) > $max_zeichen) { + if (!empty($post [$cat] ['new_url'] [$pos])) { + $post [$cat] ['error_html'] ['new_url'] [$pos] = 'style="background-color:' . $error_color ['check_name_too_long'] . ';" '; + } + if (!empty($post [$cat] ['new_name'] [$pos])) { + $post [$cat] ['error_html'] ['new_name'] [$pos] = 'style="background-color:' . $error_color ['check_name_too_long'] . ';" '; + } + $post ['error_messages'] ['check_name_too_long'] ['color'] = $error_color ['check_name_too_long']; + $post ['error_messages'] ['check_name_too_long'] [] = NULL; + } + unset($name_len, $target_len, $url_len, $ext_len); + + if ($cat != "cat") { + $kategorie = $cat . "/"; + } else { + $kategorie = NULL; + } + // existiert die cat oder page überhaupt + if (!isset($post [$cat] ['url'] [$pos]) and isset($post [$cat] ['position'] [$pos]) and isset($post [$cat] ['name'] [$pos])) { + $file_test = CONTENT_DIR_REL . $kategorie . $post [$cat] ['position'] [$pos] . "_" . $post [$cat] ['name'] [$pos] . $post [$cat] ['ext'] [$pos]; + If (is_file($file_test)) { + $tt = true; + } elseif (is_dir($file_test)) { + $tt = true; + } else { + $post ['error_messages'] ['check_is_file'] ['color'] = $error_color ['check_is_file']; + $post ['error_messages'] ['check_is_file'] [] = NULL; + $post [$cat] ['error_html'] ['name'] [$pos] = 'style="background-color:' . $error_color ['check_is_file'] . ';" '; + } + } elseif (isset($post [$cat] ['url'] [$pos]) and isset($post [$cat] ['position'] [$pos]) and isset($post [$cat] ['name'] [$pos]) and isset($post [$cat] ['target'] [$pos]) and isset($post [$cat] ['url'] [$pos])) { + $file_test = CONTENT_DIR_REL . $kategorie . $post [$cat] ['position'] [$pos] . "_" . $post [$cat] ['name'] [$pos] . $post [$cat] ['target'] [$pos] . $post [$cat] ['url'] [$pos] . EXT_LINK; + if (is_file($file_test)) { + $tt = true; + } elseif (is_dir($file_test)) { + $tt = true; + } else { + $post ['error_messages'] ['check_is_file'] ['color'] = $error_color ['check_is_file']; + $post ['error_messages'] ['check_is_file'] [] = NULL; + $post [$cat] ['error_html'] ['name'] [$pos] = 'style="background-color:' . $error_color ['check_is_file'] . ';" '; + } + } + // nochmal wenn error gesetzt ist um alle edit sachen auszucklapen + if (!empty($post [$cat] ['error_html'])) { + foreach ($post [$cat] ['error_html'] as $test => $tmp) { + if (!empty($post [$cat] ['error_html'] [$test] [$pos])) { + if ($cat != "cat") { + $post [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + } + if (!empty($post [$cat] ['new_name'] [$pos]) or !empty($post [$cat] ['new_url'] [$pos])) { + $post [$cat] ['error_html'] ['display'] [$pos] = 'style="display:block;" '; + } + } + } + } + } + } // foreach cat end + + // prüfen wenn page in andere cat cp oder mv wird obs die da schonn gibt + if (isset($move_copy_test)) { + foreach ($move_copy_test ['new_cat'] as $move_copy_pos => $tmp) { + $newname = $move_copy_test ['name'] [$move_copy_pos]; + $cat = $move_copy_test ['new_cat'] [$move_copy_pos]; + $org_cat = $move_copy_test ['org_cat'] [$move_copy_pos]; + $org_pos = $move_copy_test ['pos_org_name'] [$move_copy_pos]; + + // wenn bei move copy in gleiche Kategorie source new_position mehr wie 2 mal vorkomt error + $doubles = array_keys($move_copy_test ['new_position'], $move_copy_test ['new_position'] [$move_copy_pos]); + if (count($doubles) > 1) { + $post ['error_messages'] ['check_doubles_digit_copy_move'] ['color'] = $error_color ['check_doubles_digit_copy_move']; + $post ['error_messages'] ['check_doubles_digit_copy_move'] [] = NULL; + $post [$org_cat] ['error_html'] ['new_position'] [$org_pos] = 'style="background-color:' . $error_color ['check_doubles_digit_copy_move'] . ';" '; + $post [$org_cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + } + + if (count(array_keys($post [$cat] ['name'], $newname)) > 0 or count(array_keys($post [$cat] ['new_name'], $newname)) > 0) { + $tmp_pos_name = array_keys($post [$cat] ['name'], $newname); + $tmp_pos_new_name = array_keys($post [$cat] ['new_name'], $newname); + // Neu Name gipts schonn auser wenn der Name auch Umbenant wird + if (count($tmp_pos_name) > 0 and $cat != $org_cat) { + $post [$cat] ['error_html'] ['name'] [$tmp_pos_name [0]] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + $post ['error_messages'] ['check_name_exist'] ['color'] = $error_color ['check_name_exist']; + $post ['error_messages'] ['check_name_exist'] [] = NULL; + } + if (count($tmp_pos_new_name) > 0 and $cat != $org_cat) { + $post ['error_messages'] ['check_name_exist'] ['color'] = $error_color ['check_name_exist']; + $post ['error_messages'] ['check_name_exist'] [] = NULL; + $post [$cat] ['error_html'] ['new_name'] [$tmp_pos_new_name [0]] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + $post [$cat] ['error_html'] ['display'] [$tmp_pos_new_name [0]] = 'style="display:block;" '; + } + if (empty($post [$org_cat] ['new_name'] [$org_pos])) { + $post [$org_cat] ['error_html'] ['name'] [$org_pos] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + } else { + $post [$org_cat] ['error_html'] ['new_name'] [$org_pos] = 'style="background-color:' . $error_color ['check_name_exist'] . ';" '; + } + if ($cat == $org_cat) { + $post ['error_messages'] ['check_copy_same_cat'] ['color'] = $error_color ['check_copy_same_cat']; + $post ['error_messages'] ['check_copy_same_cat'] [] = NULL; + $post [$org_cat] ['error_html'] ['name'] [$org_pos] = 'style="background-color:' . $error_color ['check_copy_same_cat'] . ';" '; + if (isset($post [$org_cat] ['error_html'] ['new_name'] [$org_pos])) { + unset($post [$org_cat] ['error_html'] ['new_name'] [$org_pos]); + } + } + $post [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post [$org_cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post [$org_cat] ['error_html'] ['display'] [$org_pos] = 'style="display:block;" '; + } + } + } + return $post; } -# hilfs function um messges text der keine lehrzeichen hat ab $max_string_len umzubrechen +// hilfs function um messges text der keine lehrzeichen hat ab $max_string_len umzubrechen function messagesOutLen($string) { - $max_string_len = 105; - $new_string = NULL; - for($s = 0;strlen($string) > strlen($new_string);$s = ($s + $max_string_len)) { - # String oder Restsring ist kleiner $max_string_len - if(strlen(substr($string,$s)) <= $max_string_len) { - $new_string .= substr($string,$s)."
"; - # im Teilsring ist ein Lehrzeichen. Ab dem Lehrzeichen ist neuer Teilstring - } elseif(strrpos(substr($string,$s,$max_string_len)," ") > 1) { - $len = strrpos(substr($string,$s,$max_string_len)," "); - $new_string .= substr($string,$s,$len); - $s = $s - ($max_string_len - strrpos(substr($string,$s,$max_string_len)," ")); - # im Teilsring ist kein Lehrzeichen
einsetzen. Ab dem
ist neuer Teilstring - } else { - $new_string .= substr($string,$s,$max_string_len)."
"; - } - } - return $new_string; + $max_string_len = 105; + $new_string = ''; + for($s = 0; strlen($string) > strlen($new_string); $s = ($s + $max_string_len)) { + // String oder Restsring ist kleiner $max_string_len + if (strlen(substr($string, $s)) <= $max_string_len) { + $new_string .= substr($string, $s) . "
"; + // im Teilsring ist ein Lehrzeichen. Ab dem Lehrzeichen ist neuer Teilstring + } elseif (strrpos(substr($string, $s, $max_string_len), " ") > 1) { + $len = strrpos(substr($string, $s, $max_string_len), " "); + $new_string .= substr($string, $s, $len); + $s = $s - ($max_string_len - strrpos(substr($string, $s, $max_string_len), " ")); + // im Teilsring ist kein Lehrzeichen
einsetzen. Ab dem
ist neuer Teilstring + } else { + $new_string .= substr($string, $s, $max_string_len) . "
"; + } + } + return $new_string; } -# messages und error_messages erzeugen +// messages und error_messages erzeugen function categoriesMessages($post) { - function Messages($post, $message_art, $message_error) { - global $specialchars; - $return_text = NULL; - foreach($post[$message_art] as $error_language => $error_array) { - $error_titel = getLanguageValue($error_language); - if(empty($error_titel)) { - $error_titel = $error_language." MUSS NOCH INS LANGUAGE"; - } - - if($error_language == 'updateReferences') { - $titel_tmp = getLanguageValue(key($post[$message_art][$error_language])); - if(empty($titel_tmp)) { - $titel_tmp = $error_language." MUSS NOCH INS LANGUAGE"; - } - $error_titel = $error_titel."
".$titel_tmp; - $error_array = $post[$message_art][$error_language][key($post[$message_art][$error_language])]; - } - $error_inhalt = NULL; - foreach($error_array as $key => $inhalt) { - if(empty($inhalt)) { - continue; - } - if($key == 'color' and isset($post[$message_art][$error_language]['color'])) { - if(!empty($post[$message_art][$error_language]['color'])) { - $error_titel .= '     '; - continue; - } else { - $error_titel .= ' BITTE MELDEN! Farben Fehlt'; - continue; - } - } - $error_inhalt .= '→  '.messagesOutLen(str_replace("<b>></b>",">",$specialchars->rebuildSpecialChars($inhalt, true, true))); - } - if(!empty($error_inhalt)) { - $error_text = $error_titel.'
'.$error_inhalt.''; - } else { - $error_text = $error_titel; - } - $return_text .= returnMessage($message_error, $error_text); - } - return $return_text; - } - - $return_text = NULL; - if(isset($post['error_messages'])) { - $message_art = 'error_messages'; - $message_error = false; - $return_text .= Messages($post, $message_art, $message_error); - } - if(isset($post['messages'])) { - $message_art = 'messages'; - $message_error = true; - $return_text .= Messages($post, $message_art, $message_error); - } - return $return_text; + function Messages($post, $message_art, $message_error) { + global $specialchars; + $return_text = NULL; + foreach ($post [$message_art] as $error_language => $error_array) { + $error_titel = getLanguageValue($error_language); + if (empty($error_titel)) { + $error_titel = $error_language . " MUSS NOCH INS LANGUAGE"; + } + + if ($error_language == 'updateReferences') { + $titel_tmp = getLanguageValue(key($post [$message_art] [$error_language])); + if (empty($titel_tmp)) { + $titel_tmp = $error_language . " MUSS NOCH INS LANGUAGE"; + } + $error_titel = $error_titel . "
" . $titel_tmp; + $error_array = $post [$message_art] [$error_language] [key($post [$message_art] [$error_language])]; + } + $error_inhalt = NULL; + foreach ($error_array as $key => $inhalt) { + if (empty($inhalt)) { + continue; + } + if ($key == 'color' and isset($post [$message_art] [$error_language] ['color'])) { + if (!empty($post [$message_art] [$error_language] ['color'])) { + $error_titel .= '     '; + continue; + } else { + $error_titel .= ' BITTE MELDEN! Farben Fehlt'; + continue; + } + } + $error_inhalt .= '→  ' . messagesOutLen(str_replace("<b>></b>", ">", $specialchars->rebuildSpecialChars($inhalt, true, true))); + } + if (!empty($error_inhalt)) { + $error_text = $error_titel . '
' . $error_inhalt . ''; + } else { + $error_text = $error_titel; + } + $return_text .= returnMessage($message_error, $error_text); + } + return $return_text; + } + + $return_text = NULL; + if (isset($post ['error_messages'])) { + $message_art = 'error_messages'; + $message_error = false; + $return_text .= Messages($post, $message_art, $message_error); + } + if (isset($post ['messages'])) { + $message_art = 'messages'; + $message_error = true; + $return_text .= Messages($post, $message_art, $message_error); + } + return $return_text; } -function askMessages($title,$message,$input_name,$input_value,$input2_name = false,$input2_value = false) { - global $icon_size; - global $specialchars; - $input2 = NULL; - if($input2_name and $input2_value) - $input2 = ''; - $ask = '
'.getLanguageValue($title).':
' - .'→  '.messagesOutLen($specialchars->rebuildSpecialChars($message,true,true)).'' - .'
' - .''.getLanguageValue("yes") - .''.getLanguageValue("no") - .''.$input2.'
'; - return $ask; +function askMessages($title, $message, $input_name, $input_value, $input2_name = false, $input2_value = false) { + global $icon_size; + global $specialchars; + $input2 = ''; + if ($input2_name and $input2_value) + $input2 = ''; + $ask = '
' . getLanguageValue($title) . ':
' . '→  ' . messagesOutLen($specialchars->rebuildSpecialChars($message, true, true)) . '' . '
' . '' . getLanguageValue("yes") . '' . getLanguageValue("no") . '' . $input2 . '
'; + return $ask; } -# Nur Positions Verschiebung Position -> Neue Position inerhalb einer Kategorie oder Kategorie selbst -# !!!!! new_position darf nur einmal vorkommen !!!!!!!!!!!!!! -# Reihenvolge der änderungen: -# 1. new_positionen -# 2. Neue Kategorie, Inhaltseiten oder move_copy aus anderer Kategorie wenn diese auf eine new_positionen wierd -# die Position geandert und $new_move_cat_page_newposition erzeugt -# 3. Kategorie oder Inhaltseiten die betroffen sind weil auf ihrer Position eine Verschobene oder -# neue Kategorie oder Inhaltseiten soll, dann wierd ein freier Platz für sie gesucht -# Gebraucht wird immer Original Position und Neue Position optional ein array mit den neuen Kategorie oder Inhaltseiten -# wenn bei Neue Kategorie oder Inhaltseite die Position nicht möglich ist wird array $new_move_cat_page_newposition -# zurückgegeben wo die alten neuen Positionen drin sind -# Aufbau der Arrays: -# $org_position Position ohne null => Position mit null -# $new_position Neue Position ohne null => Neue Position mit null -# $new_move_cat_page irgend eine zahl => Neue Position mit null -function position_move($org_position,$new_position,$new_move_cat_page = false) { - $max_cat_page = 100; - $array_return['move'] = false; - -# $array_sorce_desti = array_combine($org_position,$new_position); - $array_sorce_desti = array(); - foreach($org_position as $pos => $inhalt) { - $array_sorce_desti[$org_position[$pos]] = $new_position[$pos]; - } - # nur die geänderten positionen ins array - foreach($array_sorce_desti as $key => $value) { - if(empty($key)) unset($array_sorce_desti[$key]); - if($key == $value) unset($array_sorce_desti[$key]); - } - - if(count($array_sorce_desti) == 0 and $new_move_cat_page === false) { - # raushier nichts zu tun - return $array_return; - } - - # ein flip damit es einfacher ist die array zu bilden - $array_desti_sorce = array_flip($array_sorce_desti); - # $array_org $array_new_posi bilden - for($i = 0; $i < $max_cat_page; $i++) { - $array_org[$i] = NULL; - $array_new_posi[$i] = NULL; - # hier die Org_positionen rein die nicht umbenant werden - if(isset($org_position[$i]) and !isset($array_sorce_desti[sprintf("%02d",$i)])) { - $array_org[$i] = $org_position[$i]; - } - # hier die New_Positionen rein - if(isset($array_desti_sorce[sprintf("%02d",$i)])) { - $array_new_posi[$i] = $array_desti_sorce[sprintf("%02d",$i)]; - } - } - # die neuen (Kategorie oder Inhaltseite) oder aus anderer Kategorie stammenden einbauen - if($new_move_cat_page !== false) { - foreach($new_move_cat_page as $new_cat_page) { - # die neuen (move copy aus anderer Kategorie) Kategorien oder Inhaltseiten einbauen - # wenn der Platz im $array_new_posi frei einfach rein ansonsten eine freie suchen - if(empty($array_new_posi[sprintf("%1d",$new_cat_page)])) { - $array_new_posi[sprintf("%1d",$new_cat_page)] = $new_cat_page; - } else { - # freie Position suchen - # Richtung = $posi bis $max_cat_page - for($new_posi = sprintf("%1d",$new_cat_page); $new_posi < $max_cat_page; $new_posi++) { - if(empty($array_new_posi[$new_posi])) { - $array_new_posi[$new_posi] = sprintf("%02d",$new_posi); - # array erstellen wo die new_move_cat_page_Position => neuen Positionen - $new_move_cat_page_newposition[$new_cat_page] = sprintf("%02d",$new_posi); - $treffer = true; - break; - } - } - # keine frei Position gefunden also noch mal von hinten suchen - if($treffer === false) { - # Richtung = $posi bis 0 - for($new_posi = sprintf("%1d",$new_cat_page); $new_posi >= 0; $new_posi--) { - if(empty($array_new_posi[$new_posi])) { - $array_new_posi[$new_posi] = sprintf("%02d",$new_posi); - # array erstellen wo die new_move_cat_page_Position => neuen Positionen - $new_move_cat_page_newposition[$new_cat_page] = sprintf("%02d",$new_posi); - break; - } - } - } - } - } - } - # wann muss ich von hinten anfangen und wann ist alles erledigt um die for abzubrechen - $change_count = 0; - $lehr = 0; - for($posi = $max_cat_page - 1; $posi >= 0; $posi--) { - if(!empty($array_new_posi[$posi])) { - $change_count++; - } - if(!isset($array_org[$posi])) { - $lehr++; - } - if($lehr > $change_count and !isset($back)) { - $back = $posi; - break; - } - } - # ab hier die Org_Position in $array_new_posi einbauen - for($posi = 0; $posi < $max_cat_page; $posi++) { - # nichts mehr zu tun raus - if(isset($back) and $back == $posi) { - break; - } - # wenn Org_Position nicht umbenant wird continue - if(isset($array_org[$posi]) and empty($array_new_posi[$posi])) { - continue; - # hier wird umbenant - } elseif(isset($array_org[$posi]) and !empty($array_new_posi[$posi])) { - # ab der position ersten freien nehmen weil die Org_Position bereitz mit einer New_position belegt ist - # Richtung = $posi bis $max_cat_page - for($new_posi = $posi; $new_posi < $max_cat_page; $new_posi++) { - if(empty($array_new_posi[$new_posi])) { - $array_new_posi[$new_posi] = $array_org[$posi]; - break; - } - } - } - } - if(isset($back) and $back == $posi) { - $merk_posi = $posi; - for($posi = $max_cat_page - 1; $posi >= $merk_posi; $posi--) { - if(isset($array_org[$posi]) and empty($array_new_posi[$posi])) { - continue; - # hier wird umbenant - } elseif(isset($array_org[$posi]) and !empty($array_new_posi[$posi])) { - # ab der position ersten freien nehmen weil die Org_Position bereitz mit einer New_position belegt ist - # Richtung = Rest $posi bis 0 - for($new_posi = $posi; $new_posi >= 0; $new_posi--) { - if(empty($array_new_posi[$new_posi])) { - $array_new_posi[$new_posi] = $array_org[$posi]; - break; - } - } - } - } - } - # in $array_new_posi sind die Positionen so eingeortnet New_Position => Org_Position - foreach($array_new_posi as $new_posi => $org_posi) { - if(!empty($array_new_posi[$new_posi])) { - if(sprintf("%02d",$new_posi) != $org_posi) { - # New_Position => Org_Position ändern nach Org_Position => New_Position und lehre entfernen - # Aufbau: Org Position mit null => Neue Position ohne null - $array_return['move'][sprintf("%1d",$org_posi)] = sprintf("%02d",$new_posi); - } - } - } - - # nur wenn von dieser fuction die Positionen geändert wurden - if(isset($new_move_cat_page_newposition)) { - # Aufbau: Orig Position mit null => Neue (von dieser function) oder Orig Position mit null - $array_return['move_cat_page_newposition'] = $new_move_cat_page_newposition; - } else { - $array_return['move_cat_page_newposition'] = false; - } - return $array_return; +// Nur Positions Verschiebung Position -> Neue Position inerhalb einer Kategorie oder Kategorie selbst +// !!!!! new_position darf nur einmal vorkommen !!!!!!!!!!!!!! +// Reihenvolge der änderungen: +// 1. new_positionen +// 2. Neue Kategorie, Inhaltseiten oder move_copy aus anderer Kategorie wenn diese auf eine new_positionen wierd +// die Position geandert und $new_move_cat_page_newposition erzeugt +// 3. Kategorie oder Inhaltseiten die betroffen sind weil auf ihrer Position eine Verschobene oder +// neue Kategorie oder Inhaltseiten soll, dann wierd ein freier Platz für sie gesucht +// Gebraucht wird immer Original Position und Neue Position optional ein array mit den neuen Kategorie oder Inhaltseiten +// wenn bei Neue Kategorie oder Inhaltseite die Position nicht möglich ist wird array $new_move_cat_page_newposition +// zurückgegeben wo die alten neuen Positionen drin sind +// Aufbau der Arrays: +// $org_position Position ohne null => Position mit null +// $new_position Neue Position ohne null => Neue Position mit null +// $new_move_cat_page irgend eine zahl => Neue Position mit null +function position_move($org_position, $new_position, $new_move_cat_page = array()) { + $max_cat_page = 100; + $array_return ['move'] = array(); + + // $array_sorce_desti = array_combine($org_position,$new_position); + $array_sorce_desti = array(); + foreach ($org_position as $pos => $inhalt) { + $array_sorce_desti [$org_position [$pos]] = $new_position [$pos]; + } + // nur die geänderten positionen ins array + foreach ($array_sorce_desti as $key => $value) { + if (empty($key)) + unset($array_sorce_desti [$key]); + if ($key == $value) + unset($array_sorce_desti [$key]); + } + + if (count($array_sorce_desti) == 0 and $new_move_cat_page === false) { + // raushier nichts zu tun + return $array_return; + } + + // ein flip damit es einfacher ist die array zu bilden + $array_desti_sorce = array_flip($array_sorce_desti); + // $array_org $array_new_posi bilden + for($i = 0; $i < $max_cat_page; $i++) { + $array_org [$i] = NULL; + $array_new_posi [$i] = NULL; + // hier die Org_positionen rein die nicht umbenant werden + if (isset($org_position [$i]) and !isset($array_sorce_desti [sprintf("%02d", $i)])) { + $array_org [$i] = $org_position [$i]; + } + // hier die New_Positionen rein + if (isset($array_desti_sorce [sprintf("%02d", $i)])) { + $array_new_posi [$i] = $array_desti_sorce [sprintf("%02d", $i)]; + } + } + // die neuen (Kategorie oder Inhaltseite) oder aus anderer Kategorie stammenden einbauen + if (count($new_move_cat_page) > 0) { + foreach ($new_move_cat_page as $new_cat_page) { + // die neuen (move copy aus anderer Kategorie) Kategorien oder Inhaltseiten einbauen + // wenn der Platz im $array_new_posi frei einfach rein ansonsten eine freie suchen + if (empty($array_new_posi [sprintf("%1d", $new_cat_page)])) { + $array_new_posi [sprintf("%1d", $new_cat_page)] = $new_cat_page; + } else { + // freie Position suchen + // Richtung = $posi bis $max_cat_page + for($new_posi = sprintf("%1d", $new_cat_page); $new_posi < $max_cat_page; $new_posi++) { + if (empty($array_new_posi [$new_posi])) { + $array_new_posi [$new_posi] = sprintf("%02d", $new_posi); + // array erstellen wo die new_move_cat_page_Position => neuen Positionen + $new_move_cat_page_newposition [$new_cat_page] = sprintf("%02d", $new_posi); + $treffer = true; + break; + } + } + // keine frei Position gefunden also noch mal von hinten suchen + if ($treffer === false) { + // Richtung = $posi bis 0 + for($new_posi = sprintf("%1d", $new_cat_page); $new_posi >= 0; $new_posi--) { + if (empty($array_new_posi [$new_posi])) { + $array_new_posi [$new_posi] = sprintf("%02d", $new_posi); + // array erstellen wo die new_move_cat_page_Position => neuen Positionen + $new_move_cat_page_newposition [$new_cat_page] = sprintf("%02d", $new_posi); + break; + } + } + } + } + } + } + // wann muss ich von hinten anfangen und wann ist alles erledigt um die for abzubrechen + $change_count = 0; + $lehr = 0; + for($posi = $max_cat_page - 1; $posi >= 0; $posi--) { + if (!empty($array_new_posi [$posi])) { + $change_count++; + } + if (!isset($array_org [$posi])) { + $lehr++; + } + if ($lehr > $change_count and !isset($back)) { + $back = $posi; + break; + } + } + // ab hier die Org_Position in $array_new_posi einbauen + for($posi = 0; $posi < $max_cat_page; $posi++) { + // nichts mehr zu tun raus + if (isset($back) and $back == $posi) { + break; + } + // wenn Org_Position nicht umbenant wird continue + if (isset($array_org [$posi]) and empty($array_new_posi [$posi])) { + continue; + // hier wird umbenant + } elseif (isset($array_org [$posi]) and !empty($array_new_posi [$posi])) { + // ab der position ersten freien nehmen weil die Org_Position bereitz mit einer New_position belegt ist + // Richtung = $posi bis $max_cat_page + for($new_posi = $posi; $new_posi < $max_cat_page; $new_posi++) { + if (empty($array_new_posi [$new_posi])) { + $array_new_posi [$new_posi] = $array_org [$posi]; + break; + } + } + } + } + if (isset($back) and $back == $posi) { + $merk_posi = $posi; + for($posi = $max_cat_page - 1; $posi >= $merk_posi; $posi--) { + if (isset($array_org [$posi]) and empty($array_new_posi [$posi])) { + continue; + // hier wird umbenant + } elseif (isset($array_org [$posi]) and !empty($array_new_posi [$posi])) { + // ab der position ersten freien nehmen weil die Org_Position bereitz mit einer New_position belegt ist + // Richtung = Rest $posi bis 0 + for($new_posi = $posi; $new_posi >= 0; $new_posi--) { + if (empty($array_new_posi [$new_posi])) { + $array_new_posi [$new_posi] = $array_org [$posi]; + break; + } + } + } + } + } + // in $array_new_posi sind die Positionen so eingeortnet New_Position => Org_Position + foreach ($array_new_posi as $new_posi => $org_posi) { + if (!empty($array_new_posi [$new_posi])) { + if (sprintf("%02d", $new_posi) != $org_posi) { + // New_Position => Org_Position ändern nach Org_Position => New_Position und lehre entfernen + // Aufbau: Org Position mit null => Neue Position ohne null + $array_return ['move'] [sprintf("%1d", $org_posi)] = sprintf("%02d", $new_posi); + } + } + } + + // nur wenn von dieser fuction die Positionen geändert wurden + if (isset($new_move_cat_page_newposition)) { + // Aufbau: Orig Position mit null => Neue (von dieser function) oder Orig Position mit null + $array_return ['move_cat_page_newposition'] = $new_move_cat_page_newposition; + } else { + $array_return ['move_cat_page_newposition'] = false; + } + return $array_return; } - - - ?> \ No newline at end of file diff --git a/admin/filesystem.php b/admin/filesystem.php index 29a21d8..227ec9b 100644 --- a/admin/filesystem.php +++ b/admin/filesystem.php @@ -1,526 +1,576 @@ get($confpara),ENT_COMPAT,CHARSET); - if(empty($text)) { - return "FEHLER = ".$confpara; - } - $text = str_replace(array("<",">"),array("<",">"), $text); - return $text; +/** + * -------------------------------------------------------------------------------- + * + * @author: Oliver Lorenz + * Liest aus dem Language-File eine Bistimmte Variable aus. + * -------------------------------------------------------------------------------- + */ +function getLanguageValue($confpara, $title = false) { + global $BASIC_LANGUAGE; + if (isset($_REQUEST ['javascript']) and $title) { + return NULL; + } + $text = htmlentities($BASIC_LANGUAGE->get($confpara), ENT_COMPAT, CHARSET); + if (empty($text)) { + return "FEHLER = " . $confpara; + } + $text = str_replace(array( + "<", + ">" + ), array( + "<", + ">" + ), $text); + return $text; } -/**-------------------------------------------------------------------------------- - @author: Oliver Lorenz - Gibt alle enthaltenen Ordner in ein Array aus - --------------------------------------------------------------------------------*/ -# ACHTUNG DIE function solte nicht mehr benutzt werden nimm getDirAsArray() -# ist nur noch wegen einigen Plugins drin -function getDirs($dir,$complet = false,$exclude_link = false) -{ - - $vergeben = array(); - if (is_dir($dir)) - { - $handle = opendir($dir); - while($file = readdir($handle)) - { - if($exclude_link !== false and preg_match('/-_blank-|-_self-/', $file)) { - continue; - } - if(isValidDirOrFile($file) && !is_file("$dir/$file")) - { - if($complet === false) - array_push($vergeben, substr($file,0,2)); - else - array_push($vergeben,$file); - } - } - closedir($handle); - } - sort($vergeben); - return $vergeben; +/** + * -------------------------------------------------------------------------------- + * + * @author: Oliver Lorenz + * Gibt alle enthaltenen Ordner in ein Array aus + * -------------------------------------------------------------------------------- + */ +// ACHTUNG DIE function solte nicht mehr benutzt werden nimm getDirAsArray() +// ist nur noch wegen einigen Plugins drin +function getDirs($dir, $complet = false, $exclude_link = false) { + $vergeben = array(); + if (is_dir($dir)) { + $handle = opendir($dir); + while ($file = readdir($handle)) { + if ($exclude_link !== false and preg_match('/-_blank-|-_self-/', $file)) { + continue; + } + if (isValidDirOrFile($file) && !is_file("$dir/$file")) { + if ($complet === false) + array_push($vergeben, substr($file, 0, 2)); + else + array_push($vergeben, $file); + } + } + closedir($handle); + } + sort($vergeben); + return $vergeben; } -/**-------------------------------------------------------------------------------- - @author: Arvid Zimmermann - Gibt alle enthaltenen Dateien in ein Array aus - --------------------------------------------------------------------------------*/ -# ACHTUNG DIE function solte nicht mehr benutzt werden nimm getDirAsArray() -# ist nur noch wegen einigen Plugins drin -function getFiles($dir, $excludeextension) -{ - //$dir = stripslashes($dir); - $files = array(); - $handle = opendir($dir); - while($file = readdir($handle)) { - if(isValidDirOrFile($file) && ($file != CONTENT_FILES_DIR_NAME)) { - // auszuschließende Extensions nicht berücksichtigen - if ($excludeextension != "") { - if (substr($file, strlen($file)-4, strlen($file)) != "$excludeextension") - array_push($files, $file); - } - else - array_push($files, $file); - } - } - closedir($handle); - return $files; +/** + * -------------------------------------------------------------------------------- + * + * @author: Arvid Zimmermann + * Gibt alle enthaltenen Dateien in ein Array aus + * -------------------------------------------------------------------------------- + */ +// ACHTUNG DIE function solte nicht mehr benutzt werden nimm getDirAsArray() +// ist nur noch wegen einigen Plugins drin +function getFiles($dir, $excludeextension) { + // $dir = stripslashes($dir); + $files = array(); + $handle = opendir($dir); + while ($file = readdir($handle)) { + if (isValidDirOrFile($file) && ($file != CONTENT_FILES_DIR_NAME)) { + // auszuschließende Extensions nicht berücksichtigen + if ($excludeextension != "") { + if (substr($file, strlen($file) - 4, strlen($file)) != "$excludeextension") + array_push($files, $file); + } else + array_push($files, $file); + } + } + closedir($handle); + return $files; } -/*-------------------------------------------------------------------------------- - @author: Oliver Lorenz - Sucht nach einem Ordner der mit einer Bestimmten Nummern-Praefix beginnt - --------------------------------------------------------------------------------*/ -function specialNrDir($dir, $nr) -{ - if (is_dir($dir)){ - $handle = opendir($dir); - while($file = readdir($handle)) - { - if(isValidDirOrFile($file) and is_dir("$dir/$file")) - { - if(substr($file,0,2)==$nr) - { - closedir($handle); - return substr($file,3); - } - } - } - } +/* + * -------------------------------------------------------------------------------- + * @author: Oliver Lorenz + * Sucht nach einem Ordner der mit einer Bestimmten Nummern-Praefix beginnt + * -------------------------------------------------------------------------------- + */ +function specialNrDir($dir, $nr) { + if (is_dir($dir)) { + $handle = opendir($dir); + while ($file = readdir($handle)) { + if (isValidDirOrFile($file) and is_dir("$dir/$file")) { + if (substr($file, 0, 2) == $nr) { + closedir($handle); + return substr($file, 3); + } + } + } + } } -/*-------------------------------------------------------------------------------- - @author: Oliver Lorenz - Legt die Ordnerstuktur für eine neue Kategorie an - --------------------------------------------------------------------------------*/ +/* + * -------------------------------------------------------------------------------- + * @author: Oliver Lorenz + * Legt die Ordnerstuktur für eine neue Kategorie an + * -------------------------------------------------------------------------------- + */ function createCategory($new_cat) { - global $specialchars; - global $ADMIN_CONF; - # dummy fehlermeldung erzeugen - @chmod(); - @mkdir ("../".CONTENT_DIR_NAME."/".$new_cat); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $error['php_error'][] = $last_error['message']; - } elseif(!is_dir("../".CONTENT_DIR_NAME."/".$new_cat)) { - $error['category_error_new'][] = $new_cat; - } - # ist kein Link - if(!preg_match('/-_blank-|-_self-/', $new_cat)) { - @mkdir ("../".CONTENT_DIR_NAME."/".$new_cat."/".CONTENT_FILES_DIR_NAME); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $error['php_error'][] = $last_error['message']; - } elseif(!is_dir("../".CONTENT_DIR_NAME."/".$new_cat."/".CONTENT_FILES_DIR_NAME)) { - $error['category_error_new'][] = $new_cat."/".CONTENT_FILES_DIR_NAME; - } - } - if(isset($error['php_error']) or isset($error['category_error_new'])) { - # wenns hier schonn ne meldung gibt dann gleich Raus - return $error; - } - # bis hier kein fehler dann solte das chmod auch fehlerfrei gehen - useChmod("../".CONTENT_DIR_NAME."/".$new_cat); - # ist kein Link - if(!preg_match('/-_blank-|-_self-/', $new_cat)) { - useChmod("../".CONTENT_DIR_NAME."/".$new_cat."/".CONTENT_FILES_DIR_NAME); - } + global $specialchars; + global $ADMIN_CONF; + @mkdir("../" . CONTENT_DIR_NAME . "/" . $new_cat); + $line_error = __LINE__ - 1; + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $error ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir("../" . CONTENT_DIR_NAME . "/" . $new_cat)) { + $error ['category_error_new'] [] = $new_cat; + } + // ist kein Link + if (!preg_match('/-_blank-|-_self-/', $new_cat)) { + @mkdir("../" . CONTENT_DIR_NAME . "/" . $new_cat . "/" . CONTENT_FILES_DIR_NAME); + $line_error = __LINE__ - 1; + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $error ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir("../" . CONTENT_DIR_NAME . "/" . $new_cat . "/" . CONTENT_FILES_DIR_NAME)) { + $error ['category_error_new'] [] = $new_cat . "/" . CONTENT_FILES_DIR_NAME; + } + } + if (isset($error ['php_error']) or isset($error ['category_error_new'])) { + // wenns hier schonn ne meldung gibt dann gleich Raus + return $error; + } + // bis hier kein fehler dann solte das chmod auch fehlerfrei gehen + useChmod("../" . CONTENT_DIR_NAME . "/" . $new_cat); + // ist kein Link + if (!preg_match('/-_blank-|-_self-/', $new_cat)) { + useChmod("../" . CONTENT_DIR_NAME . "/" . $new_cat . "/" . CONTENT_FILES_DIR_NAME); + } } function getGalleriesAsSelect($selectedgallery) { - global $specialchars; - $dirs = array(); - $handle = opendir('../galerien'); - while (($file = readdir($handle))) { - if (isValidDirOrFile($file)) - array_push($dirs, $file); - } - closedir($handle); - sort($dirs); - $select = ""; - return $select; + global $specialchars; + $dirs = array(); + $handle = opendir('../galerien'); + while (($file = readdir($handle))) { + if (isValidDirOrFile($file)) + array_push($dirs, $file); + } + closedir($handle); + sort($dirs); + $select = ""; + return $select; } // gibt Verzeichnisinhalte als Array zurück (ignoriert dabei Dateien, wenn $includefiles == true) -# ACHTUNG DIE function solte nicht mehr benutzt werden nimm getDirAsArray() -# ist nur noch wegen einigen Plugins drin +// ACHTUNG DIE function solte nicht mehr benutzt werden nimm getDirAsArray() +// ist nur noch wegen einigen Plugins drin function getDirContentAsArray($dir, $hiddeposition = true) { - $dircontent = array(); - if (is_dir($dir)) { - $handle = opendir($dir); - while($file = readdir($handle)) { - if(isValidDirOrFile($file)) { - if (!is_file("$dir/$file")) { - # wenn $hiddeposition = true keine Position - if($hiddeposition === true) - array_push($dircontent, substr($file,3)); - else - array_push($dircontent, $file); - } - } - } - closedir($handle); - } - natcasesort($dircontent); - return $dircontent; + $dircontent = array(); + if (is_dir($dir)) { + $handle = opendir($dir); + while ($file = readdir($handle)) { + if (isValidDirOrFile($file)) { + if (!is_file("$dir/$file")) { + // wenn $hiddeposition = true keine Position + if ($hiddeposition === true) + array_push($dircontent, substr($file, 3)); + else + array_push($dircontent, $file); + } + } + } + closedir($handle); + } + natcasesort($dircontent); + return $dircontent; } function dirsize($dir) { - if (!is_dir($dir) or !is_readable($dir)) return FALSE; - $size = 0; - $dh = opendir($dir); - while(($entry = readdir($dh)) !== false) { - if(!isValidDirOrFile($entry)) - continue; - if(is_dir( $dir . "/" . $entry)) - $size += dirsize($dir . "/" . $entry); - else - $size += filesize($dir . "/" . $entry); - } - closedir($dh); - return $size; + if (!is_dir($dir) or !is_readable($dir)) + return FALSE; + $size = 0; + $dh = opendir($dir); + while (($entry = readdir($dh)) !== false) { + if (!isValidDirOrFile($entry)) + continue; + if (is_dir($dir . "/" . $entry)) + $size += dirsize($dir . "/" . $entry); + else + $size += filesize($dir . "/" . $entry); + } + closedir($dh); + return $size; } -function convertFileSizeUnit($filesize){ - if ($filesize < 1024) - return $filesize . " B"; - elseif ($filesize < 1048576) - return round(($filesize/1024) , 2) . " KB"; - else - return round(($filesize/1024/1024) , 2) . " MB"; +function convertFileSizeUnit($filesize) { + if ($filesize < 1024) + return $filesize . " B"; + elseif ($filesize < 1048576) + return round(($filesize / 1024), 2) . " KB"; + else + return round(($filesize / 1024 / 1024), 2) . " MB"; } + /* -// ------------------------------------------------------------------------------ -// Handelt es sich um ein valides Verzeichnis / eine valide Datei? -// ------------------------------------------------------------------------------ -function isValidDirOrFile($file) { - # Alles was einen Punkt vor der Datei hat - if(strpos($file,".") === 0) { - return false; - } - # alle php Dateien - if(substr($file,-4) == ".php") { - return false; - } - # und der Rest - if(in_array($file, array( - "Thumbs.db", // Windows-spezifisch - "__MACOSX", // Mac-spezifisch - "settings" // Eclipse - ))) { - return false; - } - return true; -} -*/ + * // ------------------------------------------------------------------------------ + * // Handelt es sich um ein valides Verzeichnis / eine valide Datei? + * // ------------------------------------------------------------------------------ + * function isValidDirOrFile($file) { + * # Alles was einen Punkt vor der Datei hat + * if(strpos($file,".") === 0) { + * return false; + * } + * # alle php Dateien + * if(substr($file,-4) == ".php") { + * return false; + * } + * # und der Rest + * if(in_array($file, array( + * "Thumbs.db", // Windows-spezifisch + * "__MACOSX", // Mac-spezifisch + * "settings" // Eclipse + * ))) { + * return false; + * } + * return true; + * } + */ // ------------------------------------------------------------------------------ // Ändert Referenzen auf eine Inhaltsseite in allen anderen Inhaltsseiten // ------------------------------------------------------------------------------ function updateReferencesInAllContentPages($oldCategory, $oldPage, $newCategory, $newPage) { - # Wichtig !!!!!! - # Rename CAT: $oldPage und $newPage müssen leer sein, $oldCategory und $newCategory aber gesetzt - # Rename PAGE: $newCategory muss leer sein, $oldCategory, $oldPage und $newPage aber gesetzt - # Move PAGE: Alle müssen gefüllt sein - - $error = NULL; - // Alle Kategorien einlesen - $contentdirhandle = opendir(CONTENT_DIR_REL); - while($currentcategory = readdir($contentdirhandle)) { - if(isValidDirOrFile($currentcategory)) { - // Alle Inhaltseiten der aktuellen Kategorie einlesen - $cathandle = opendir(CONTENT_DIR_REL.$currentcategory); - while($currentpage = readdir($cathandle)) { - if(isValidDirOrFile($currentpage) && is_file(CONTENT_DIR_REL.$currentcategory."/".$currentpage)) { - // Datei öffnen - $pagehandle = @fopen(CONTENT_DIR_REL.$currentcategory."/".$currentpage, "r"); - // Inhalt auslesen - $pagecontent = @fread($pagehandle, @filesize(CONTENT_DIR_REL.$currentcategory."/".$currentpage)); - // Datei schließen - @fclose($pagehandle); - # um diese Attribute geht es - $allowed_attributes = array("seite","datei","bild","bildlinks","bildrechts","include"); - # kommt eins von den Attributen im Content vor - # Suche nach [Attribut| - preg_match("/(\[".implode('=|\[',$allowed_attributes)."=).*/Umis",$pagecontent,$matches_1); - # Suche nach [Attribut= - preg_match("/(\[".implode('\||\[',$allowed_attributes)."\|).*/Umis",$pagecontent,$matches_2); - # nichts gefunden nächste seite - if(count($matches_1) == 0 and count($matches_2) == 0) continue; - // Referenzen im Inhalt ersetzen - $result = updateReferencesInText($pagecontent, $currentcategory, $currentpage, $oldCategory, $oldPage, $newCategory, $newPage, $allowed_attributes); - // Ersetzung nur vornehmen, wenn überhaupt Referenzen auftauchen - if ($result[0]) { - // Inhaltsseite speichern - $error_tmp = saveContentToPage($result[1], CONTENT_DIR_REL.$currentcategory."/".$currentpage); - if(!empty($error_tmp)) { - if(is_array($error)) { - $error = array_merge_recursive($error,$error_tmp); - } else { - $error = $error_tmp; - } - } - } - } - } - closedir($cathandle); - } - } - closedir($contentdirhandle); - return $error; + // Wichtig !!!!!! + // Rename CAT: $oldPage und $newPage müssen leer sein, $oldCategory und $newCategory aber gesetzt + // Rename PAGE: $newCategory muss leer sein, $oldCategory, $oldPage und $newPage aber gesetzt + // Move PAGE: Alle müssen gefüllt sein + $error = NULL; + // Alle Kategorien einlesen + $contentdirhandle = opendir(CONTENT_DIR_REL); + while ($currentcategory = readdir($contentdirhandle)) { + if (isValidDirOrFile($currentcategory)) { + // Alle Inhaltseiten der aktuellen Kategorie einlesen + $cathandle = opendir(CONTENT_DIR_REL . $currentcategory); + while ($currentpage = readdir($cathandle)) { + if (isValidDirOrFile($currentpage) && is_file(CONTENT_DIR_REL . $currentcategory . "/" . $currentpage)) { + // Datei öffnen + $pagehandle = @fopen(CONTENT_DIR_REL . $currentcategory . "/" . $currentpage, "r"); + // Inhalt auslesen + $pagecontent = @fread($pagehandle, @filesize(CONTENT_DIR_REL . $currentcategory . "/" . $currentpage)); + // Datei schließen + @fclose($pagehandle); + // um diese Attribute geht es + $allowed_attributes = array( + "seite", + "datei", + "bild", + "bildlinks", + "bildrechts", + "include" + ); + // kommt eins von den Attributen im Content vor + // Suche nach [Attribut| + preg_match("/(\[" . implode('=|\[', $allowed_attributes) . "=).*/Umis", $pagecontent, $matches_1); + // Suche nach [Attribut= + preg_match("/(\[" . implode('\||\[', $allowed_attributes) . "\|).*/Umis", $pagecontent, $matches_2); + // nichts gefunden nächste seite + if (count($matches_1) == 0 and count($matches_2) == 0) + continue; + // Referenzen im Inhalt ersetzen + $result = updateReferencesInText($pagecontent, $currentcategory, $currentpage, $oldCategory, $oldPage, $newCategory, $newPage, $allowed_attributes); + // Ersetzung nur vornehmen, wenn überhaupt Referenzen auftauchen + if ($result [0]) { + // Inhaltsseite speichern + $error_tmp = saveContentToPage($result [1], CONTENT_DIR_REL . $currentcategory . "/" . $currentpage); + if (!empty($error_tmp)) { + if (is_array($error)) { + $error = array_merge_recursive($error, $error_tmp); + } else { + $error = $error_tmp; + } + } + } + } + } + closedir($cathandle); + } + } + closedir($contentdirhandle); + return $error; } - + // ------------------------------------------------------------------------------ // Ändert Referenzen auf eine Inhaltsseite in einem übergebenen Text // ------------------------------------------------------------------------------ function updateReferencesInText($currentPagesContent, $currentPagesCategory, $movedPage, $oldCategory, $oldPage, $newCategory, $newPage, $allowed_attributes) { - global $specialchars; + global $specialchars; - $pos_currentPagesCategory = $specialchars->rebuildSpecialChars($currentPagesCategory,false,false); - $pos_oldCategory = $specialchars->rebuildSpecialChars($oldCategory,false,false); - $pos_oldPage = $specialchars->rebuildSpecialChars($oldPage,false,false); - $pos_newCategory = $specialchars->rebuildSpecialChars($newCategory,false,false); - $pos_newPage = $specialchars->rebuildSpecialChars($newPage,false,false); - $movedPage = $specialchars->rebuildSpecialChars($movedPage,false,false); + $pos_currentPagesCategory = $specialchars->rebuildSpecialChars($currentPagesCategory, false, false); + $pos_oldCategory = $specialchars->rebuildSpecialChars($oldCategory, false, false); + $pos_oldPage = $specialchars->rebuildSpecialChars($oldPage, false, false); + $pos_newCategory = $specialchars->rebuildSpecialChars($newCategory, false, false); + $pos_newPage = $specialchars->rebuildSpecialChars($newPage, false, false); + $movedPage = $specialchars->rebuildSpecialChars($movedPage, false, false); - $changesmade = false; + $changesmade = false; - # ein Hack weil in Inhaltsete ein ^ vor [ und ] ist im Dateinamen aber nicht - $hack_eckigeklamern = str_replace(array("[","]"),array("^[","^]"),array($pos_oldCategory,$pos_oldPage,$pos_newCategory,$pos_newPage)); + // ein Hack weil in Inhaltsete ein ^ vor [ und ] ist im Dateinamen aber nicht + $hack_eckigeklamern = str_replace(array( + "[", + "]" + ), array( + "^[", + "^]" + ), array( + $pos_oldCategory, + $pos_oldPage, + $pos_newCategory, + $pos_newPage + )); - $oldCategory = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern[0],3)); - $oldPage = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern[1],3,-4)); - $newCategory = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern[2],3)); - $newPage = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern[3],3,-4)); + $oldCategory = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern [0], 3)); + $oldPage = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern [1], 3, -4)); + $newCategory = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern [2], 3)); + $newPage = $specialchars->getHtmlEntityDecode(substr($hack_eckigeklamern [3], 3, -4)); - # ein Hack weil dieses preg_match_all nicht mit ^, [ und ] im attribut umgehen kann - $currentPagesContentmatches = str_replace(array("^[","^]"),array("^[","^]"),$currentPagesContent); - // Nach Texten in eckigen Klammern suchen - preg_match_all("/\[([^\[\]]+)\|([^\[\]]*)\]/Um", $currentPagesContentmatches, $matches); + // ein Hack weil dieses preg_match_all nicht mit ^, [ und ] im attribut umgehen kann + $currentPagesContentmatches = str_replace(array( + "^[", + "^]" + ), array( + "^[", + "^]" + ), $currentPagesContent); + // Nach Texten in eckigen Klammern suchen + preg_match_all("/\[([^\[\]]+)\|([^\[\]]*)\]/Um", $currentPagesContentmatches, $matches); -# $allowed_attributes = array("seite","kategorie","datei","bild","bildlinks","bildrechts","include"); + // $allowed_attributes = array("seite","kategorie","datei","bild","bildlinks","bildrechts","include"); - // Für jeden Treffer... -$debug = false; # true false - foreach ($matches[0] as $i => $match) { -if($debug) echo "alle matches = $match -----------
\n"; - # ein Hack weil dieses preg_match_all nicht mit ^, [ und ] im attribut umgehen kann - $match = str_replace(array("^[","^]"),array("^[","^]"),$match); - // ...Auswertung und Verarbeitung der Informationen - $attribute = $matches[1][$i]; - $replace_match = ""; - if(strstr($attribute,"=")) { - $allowed_test = substr($attribute,0,strpos($attribute,"=")); - } else { - $allowed_test = $attribute; - } - if(in_array($allowed_test,$allowed_attributes)) - { -if($debug) echo "match = $match -----------
\n"; -if($debug) echo "datei = $pos_currentPagesCategory/$movedPage
\n"; - # weil oldPage und newPage lehr sind Kategorie rename - if(!empty($oldCategory) and !empty($newCategory) and empty($oldPage) and empty($newPage)) - { - # einfach alle oldCategory -> newCategory - if(strstr($match,"|".$oldCategory.":") or strstr($match,"|".$oldCategory."]")) - { - $replace_match = str_replace($oldCategory,$newCategory,$match); -if($debug) echo "cat = $match -> $replace_match
\n"; - } - } - # weil newCategory lehr Inhaltseite rename - if(!empty($oldCategory) and empty($newCategory) and !empty($oldPage) and !empty($newPage)) - { - # ist [attribut|oldCategory:oldPage] dann oldPage -> newPage - # oder ist [attribut|oldPage] und die untersuchende datei in oldCategory dann oldPage -> newPage - if((strstr($match,"|$oldCategory:$oldPage]") or (strstr($match,"|$oldPage]") - and $pos_oldCategory == $pos_currentPagesCategory ))) - { - $replace_match = str_replace($oldPage,$newPage,$match); -if($debug) echo "page = $match -> $replace_match
\n"; - } - } - # alles voll dann move Inhaltseite in andere Kategorie - if(!empty($oldCategory) and !empty($newCategory) and !empty($oldPage) and !empty($newPage)) - { - # weil in der zu bearbeitende Inhaltseite ein Object ist - # das in alten Kategorie liegt neue Kategorie einfügen - if($movedPage == $pos_newPage - and !strstr($match,":") - and $oldCategory != $newCategory) - { - $replace_match = str_replace("|","|$oldCategory:",$match); -if($debug) echo "+++cat = $match -> $replace_match
\n"; - } - # weil in der zu bearbeitende Inhaltseite ein Object ist - # das in der Kategorie liegt in die die Inhaltseite verschoben wird, - # Kategorie entfernen - elseif($movedPage == $pos_newPage - and strstr($match,":") - and $pos_currentPagesCategory == $pos_newCategory) - { - $replace_match = str_replace("|$newCategory:","|",$match); -if($debug) echo "---cat = $match -> $replace_match
\n"; - } - # alle andern Inhaltseiten die [attribut|oldCategory:oldPage] enthalten ändern - elseif(strstr($match,"|$oldCategory:$oldPage]")) - { - $replace_match = str_replace("$oldCategory:$oldPage","$newCategory:$newPage",$match); -if($debug) echo "cat_page = $match -> $replace_match
\n"; - } - } - # änderung nur wenn was geändert wurde - if(!empty($replace_match) and $matches[0][$i] != $replace_match) { - # ein Hack weil dieses preg_match_all nicht mit ^, [ und ] im attribut umgehen kann - $matches[0][$i] = str_replace(array("^[","^]"),array("^[","^]"),$matches[0][$i]); - $currentPagesContent = str_replace ($matches[0][$i], $replace_match, $currentPagesContent); -if($debug) echo "diff == match = ".$matches[0][$i]." | replace_match = $replace_match
\n"; - $changesmade = true; - } -if($debug) echo "
\n"; - } - } - // Konvertierten Seiteninhalt zurückgeben - return array($changesmade, $currentPagesContent); + // Für jeden Treffer... + $debug = false; // true false + foreach ($matches [0] as $i => $match) { + if ($debug) + echo "alle matches = $match -----------
\n"; + // ein Hack weil dieses preg_match_all nicht mit ^, [ und ] im attribut umgehen kann + $match = str_replace(array( + "^[", + "^]" + ), array( + "^[", + "^]" + ), $match); + // ...Auswertung und Verarbeitung der Informationen + $attribute = $matches [1] [$i]; + $replace_match = ""; + if (strstr($attribute, "=")) { + $allowed_test = substr($attribute, 0, strpos($attribute, "=")); + } else { + $allowed_test = $attribute; + } + if (in_array($allowed_test, $allowed_attributes)) { + if ($debug) + echo "match = $match -----------
\n"; + if ($debug) + echo "datei = $pos_currentPagesCategory/$movedPage
\n"; + // weil oldPage und newPage lehr sind Kategorie rename + if (!empty($oldCategory) and !empty($newCategory) and empty($oldPage) and empty($newPage)) { + // einfach alle oldCategory -> newCategory + if (strstr($match, "|" . $oldCategory . ":") or strstr($match, "|" . $oldCategory . "]")) { + $replace_match = str_replace($oldCategory, $newCategory, $match); + if ($debug) + echo "cat = $match -> $replace_match
\n"; + } + } + // weil newCategory lehr Inhaltseite rename + if (!empty($oldCategory) and empty($newCategory) and !empty($oldPage) and !empty($newPage)) { + // ist [attribut|oldCategory:oldPage] dann oldPage -> newPage + // oder ist [attribut|oldPage] und die untersuchende datei in oldCategory dann oldPage -> newPage + if ((strstr($match, "|$oldCategory:$oldPage]") or (strstr($match, "|$oldPage]") and $pos_oldCategory == $pos_currentPagesCategory))) { + $replace_match = str_replace($oldPage, $newPage, $match); + if ($debug) + echo "page = $match -> $replace_match
\n"; + } + } + // alles voll dann move Inhaltseite in andere Kategorie + if (!empty($oldCategory) and !empty($newCategory) and !empty($oldPage) and !empty($newPage)) { + // weil in der zu bearbeitende Inhaltseite ein Object ist + // das in alten Kategorie liegt neue Kategorie einfügen + if ($movedPage == $pos_newPage and !strstr($match, ":") and $oldCategory != $newCategory) { + $replace_match = str_replace("|", "|$oldCategory:", $match); + if ($debug) + echo "+++cat = $match -> $replace_match
\n"; + } // weil in der zu bearbeitende Inhaltseite ein Object ist + // das in der Kategorie liegt in die die Inhaltseite verschoben wird, + // Kategorie entfernen + elseif ($movedPage == $pos_newPage and strstr($match, ":") and $pos_currentPagesCategory == $pos_newCategory) { + $replace_match = str_replace("|$newCategory:", "|", $match); + if ($debug) + echo "---cat = $match -> $replace_match
\n"; + } // alle andern Inhaltseiten die [attribut|oldCategory:oldPage] enthalten ändern + elseif (strstr($match, "|$oldCategory:$oldPage]")) { + $replace_match = str_replace("$oldCategory:$oldPage", "$newCategory:$newPage", $match); + if ($debug) + echo "cat_page = $match -> $replace_match
\n"; + } + } + // änderung nur wenn was geändert wurde + if (!empty($replace_match) and $matches [0] [$i] != $replace_match) { + // ein Hack weil dieses preg_match_all nicht mit ^, [ und ] im attribut umgehen kann + $matches [0] [$i] = str_replace(array( + "^[", + "^]" + ), array( + "^[", + "^]" + ), $matches [0] [$i]); + $currentPagesContent = str_replace($matches [0] [$i], $replace_match, $currentPagesContent); + if ($debug) + echo "diff == match = " . $matches [0] [$i] . " | replace_match = $replace_match
\n"; + $changesmade = true; + } + if ($debug) + echo "
\n"; + } + } + // Konvertierten Seiteninhalt zurückgeben + return array( + $changesmade, + $currentPagesContent + ); } -# gibt die Rechte zurück ist $dir true wird das x bit gesetzt +// gibt die Rechte zurück ist $dir true wird das x bit gesetzt function getChmod($dir = false) { - global $ADMIN_CONF; - $mode = $ADMIN_CONF->get("chmodnewfilesatts"); - if(strlen($mode) > 0) { - if($dir === true) { - // X-Bit setzen, um Verzeichniszugriff zu garantieren - if(substr($mode,0,1) >= 2 and substr($mode,0,1) <= 6) $mode = $mode + 100; - if(substr($mode,1,1) >= 2 and substr($mode,1,1) <= 6) $mode = $mode + 10; - if(substr($mode,2,1) >= 2 and substr($mode,2,1) <= 6) $mode = $mode + 1; - } - return octdec($mode); - } - # Der server Vergibt die Rechte - return false; + global $ADMIN_CONF; + $mode = $ADMIN_CONF->get("chmodnewfilesatts"); + if (strlen($mode) > 0) { + if ($dir === true) { + // X-Bit setzen, um Verzeichniszugriff zu garantieren + if (substr($mode, 0, 1) >= 2 and substr($mode, 0, 1) <= 6) + $mode = $mode + 100; + if (substr($mode, 1, 1) >= 2 and substr($mode, 1, 1) <= 6) + $mode = $mode + 10; + if (substr($mode, 2, 1) >= 2 and substr($mode, 2, 1) <= 6) + $mode = $mode + 1; + } + return octdec($mode); + } + // Der server Vergibt die Rechte + return false; } -# ändert die dateirechte +// ändert die dateirechte function changeChmod($file) { - $error_new = NULL; - $dir = NULL; - if(is_dir($file)) { - $dir = true; - } - # nicht zu tun - if(getChmod() === false) { - return $error_new; - } - @chmod($file, getChmod($dir)); - $line_error = __LINE__ - 1; # wichtig direkt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - # clearstatcache() damit fileperms() sauber Arbeitet - clearstatcache(); - if($last_error['line'] == $line_error) { - # dummy fehlermeldung erzeugen - @chmod(); - $error_new['php_error'] = $file." - ".$last_error['message']; - } elseif(substr(decoct(fileperms($file)), -3) != decoct(getChmod($dir))) { - $error_new['chmod_error'] = $file; - } - return $error_new; + $error_new = NULL; + $dir = NULL; + if (is_dir($file)) { + $dir = true; + } + // nicht zu tun + if (getChmod() === false) { + return $error_new; + } + @chmod($file, getChmod($dir)); + $line_error = __LINE__ - 1; // wichtig direkt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + // clearstatcache() damit fileperms() sauber Arbeitet + clearstatcache(); + if ($last_error ['line'] == $line_error) { + // dummy fehlermeldung erzeugen + @chmod(); + $error_new ['php_error'] = $file . " - " . $last_error ['message']; + } elseif (substr(decoct(fileperms($file)), -3) != decoct(getChmod($dir))) { + $error_new ['chmod_error'] = $file; + } + return $error_new; } -# änder die dateirechte Recursiv wenn kein Parameter über geben wird das array $ordner benutzt +// änder die dateirechte Recursiv wenn kein Parameter über geben wird das array $ordner benutzt function useChmod($dir = false, $error = NULL) { - global $error; + global $error; - if($dir === false) { - $ordner = array("conf", - "../".CMS_DIR_NAME."/conf", - "../".CONTENT_DIR_NAME,"../galerien"); - foreach($ordner as $dirs) { - $error_tmp = useChmod($dirs,$error); - if(is_array($error_tmp)) { - $error[key($error_tmp)] = $error_tmp[key($error_tmp)]; - } - } - return $error; - } else { - # nicht zu tuhn - if(getChmod() === false) { - return; - } - if(is_dir($dir)) { - $error_tmp = changeChmod($dir); - if(is_array($error_tmp)) { - $error[key($error_tmp)][] = $error_tmp[key($error_tmp)]; - } - $handle = opendir($dir); - while($file = readdir($handle)) { - if(isValidDirOrFile($file)) { - if(is_dir($dir.'/'.$file)) { - $error_tmp = useChmod($dir.'/'.$file,$error); - if(is_array($error_tmp)) { - $error[key($error_tmp)] = $error_tmp[key($error_tmp)]; - } - } elseif(is_file($dir.'/'.$file)) { - $error_tmp = changeChmod($dir.'/'.$file); - if(is_array($error_tmp)) { - $error[key($error_tmp)][] = $error_tmp[key($error_tmp)]; - } - } - } - } - closedir($handle); - } elseif(is_file($dir)) { - $error_tmp = changeChmod($dir); - if(is_array($error_tmp)) { - $error[key($error_tmp)][] = $error_tmp[key($error_tmp)]; - } - } - return $error; - } + if ($dir === false) { + $ordner = array( + "conf", + "../" . CMS_DIR_NAME . "/conf", + "../" . CONTENT_DIR_NAME, + "../galerien" + ); + foreach ($ordner as $dirs) { + $error_tmp = useChmod($dirs, $error); + if (is_array($error_tmp)) { + $error [key($error_tmp)] = $error_tmp [key($error_tmp)]; + } + } + return $error; + } else { + // nicht zu tuhn + if (getChmod() === false) { + return; + } + if (is_dir($dir)) { + $error_tmp = changeChmod($dir); + if (is_array($error_tmp)) { + $error [key($error_tmp)] [] = $error_tmp [key($error_tmp)]; + } + $handle = opendir($dir); + while ($file = readdir($handle)) { + if (isValidDirOrFile($file)) { + if (is_dir($dir . '/' . $file)) { + $error_tmp = useChmod($dir . '/' . $file, $error); + if (is_array($error_tmp)) { + $error [key($error_tmp)] = $error_tmp [key($error_tmp)]; + } + } elseif (is_file($dir . '/' . $file)) { + $error_tmp = changeChmod($dir . '/' . $file); + if (is_array($error_tmp)) { + $error [key($error_tmp)] [] = $error_tmp [key($error_tmp)]; + } + } + } + } + closedir($handle); + } elseif (is_file($dir)) { + $error_tmp = changeChmod($dir); + if (is_array($error_tmp)) { + $error [key($error_tmp)] [] = $error_tmp [key($error_tmp)]; + } + } + return $error; + } } - ?> diff --git a/admin/index.php b/admin/index.php index cbcd83c..df8067a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -3,41 +3,42 @@ $ADMIN_TITLE = "moziloAdmin"; $CMS_DIR_NAME = "cms"; -define("CMS_DIR_NAME",$CMS_DIR_NAME); +define("CMS_DIR_NAME", $CMS_DIR_NAME); $ADMIN_DIR_NAME = "admin"; -define("ADMIN_DIR_NAME",$ADMIN_DIR_NAME); +define("ADMIN_DIR_NAME", $ADMIN_DIR_NAME); -# bei winsystemen gibts nicht immer $_SERVER["SCRIPT_FILENAME"] -if(isset($_SERVER["SCRIPT_FILENAME"])) - $BASE_DIR = $_SERVER["SCRIPT_FILENAME"]; +// bei winsystemen gibts nicht immer $_SERVER["SCRIPT_FILENAME"] +if (isset($_SERVER ["SCRIPT_FILENAME"])) + $BASE_DIR = $_SERVER ["SCRIPT_FILENAME"]; else - $BASE_DIR = __FILE__; -# falls da bei winsystemen \\ drin sind in \ wandeln -$BASE_DIR = str_replace("\\\\", "\\",$BASE_DIR); -# zum schluss noch den teil denn wir nicht brauchen abschneiden -$BASE_DIR = substr($BASE_DIR,0,-(strlen(ADMIN_DIR_NAME."/index.php"))); -define("BASE_DIR",$BASE_DIR); - -$BASE_DIR_CMS = BASE_DIR.CMS_DIR_NAME."/"; -define("BASE_DIR_CMS",$BASE_DIR_CMS); -$BASE_DIR_ADMIN = BASE_DIR.ADMIN_DIR_NAME."/"; -define("BASE_DIR_ADMIN",$BASE_DIR_ADMIN); -$URL_BASE = substr($_SERVER['PHP_SELF'],0,strpos($_SERVER['PHP_SELF'],ADMIN_DIR_NAME."/index.php")); -define("URL_BASE",$URL_BASE); - -if(is_file(BASE_DIR_CMS."DefaultConf.php")) { - require_once(BASE_DIR_CMS."DefaultConf.php"); + $BASE_DIR = __FILE__; +// falls da bei winsystemen \\ drin sind in \ wandeln +$BASE_DIR = str_replace("\\\\", "\\", $BASE_DIR); +// zum schluss noch den teil denn wir nicht brauchen abschneiden +$BASE_DIR = substr($BASE_DIR, 0, -(strlen(ADMIN_DIR_NAME . "/index.php"))); +define("BASE_DIR", $BASE_DIR); + +$BASE_DIR_CMS = BASE_DIR . CMS_DIR_NAME . "/"; +define("BASE_DIR_CMS", $BASE_DIR_CMS); +$BASE_DIR_ADMIN = BASE_DIR . ADMIN_DIR_NAME . "/"; +define("BASE_DIR_ADMIN", $BASE_DIR_ADMIN); +$URL_BASE = substr($_SERVER ['PHP_SELF'], 0, strpos($_SERVER ['PHP_SELF'], ADMIN_DIR_NAME . "/index.php")); +define("URL_BASE", $URL_BASE); + +if (is_file(BASE_DIR_CMS . "DefaultConf.php")) { + require_once (BASE_DIR_CMS . "DefaultConf.php"); } else { - die("Fatal Error ".BASE_DIR_CMS."DefaultConf.php Datei existiert nicht"); + die("Fatal Error " . BASE_DIR_CMS . "DefaultConf.php Datei existiert nicht"); } -require_once(BASE_DIR_CMS.'idna_convert.class.php'); +require_once (BASE_DIR_CMS . 'idna_convert.class.php'); $Punycode = new idna_convert(); $_GET = cleanREQUEST($_GET); $_REQUEST = cleanREQUEST($_REQUEST); $_POST = cleanREQUEST($_POST); -if(isset($_FILE)) $_FILE = cleanREQUEST($_FILE); +if (isset($_FILE)) + $_FILE = cleanREQUEST($_FILE); // CHARSET erzwingen - experimentell! // @ini_set("default_charset", CHARSET); @@ -46,257 +47,272 @@ @ini_set("display_errors", 0); // debug session-var initial mit false anlegen wenn nicht vorhanden -if (!isset($_SESSION["debug"])) { - $_SESSION["debug"] = false; +if (!isset($_SESSION ["debug"])) { + $_SESSION ["debug"] = false; } // wenn debug als url parameter angegeben... -if (isset($_GET["debug"])) { - if ($_GET["debug"] === "0") { - // debug=0 -> ausschalten - $_SESSION["debug"] = false; - } else { - // debug=[irgendwas] -> einschalten - $_SESSION["debug"] = true; - error_reporting(-1); - ini_set("display_errors", 1); - } +if (isset($_GET ["debug"])) { + if ($_GET ["debug"] === "0") { + // debug=0 -> ausschalten + $_SESSION ["debug"] = false; + } else { + // debug=[irgendwas] -> einschalten + $_SESSION ["debug"] = true; + error_reporting(-1); + ini_set("display_errors", 1); + } } // Session Fixation durch Vergabe einer neuen Session-ID beim ersten Login verhindern - if (!isset($_SESSION['PHPSESSID'])) { - session_regenerate_id(true); - $_SESSION['PHPSESSID'] = true; - } +if (!isset($_SESSION ['PHPSESSID'])) { + session_regenerate_id(true); + $_SESSION ['PHPSESSID'] = true; +} // Login ueberpruefen -if (!isset($_SESSION['login_okay']) or !$_SESSION['login_okay']) { - header("location:login.php?logout=true"); - die(""); +if (!isset($_SESSION ['login_okay']) or !$_SESSION ['login_okay']) { + header("location:login.php?logout=true"); + die(""); } -if ($_SESSION["debug"]) { - ob_start(); - echo "SESSION -------------------\n"; - print_r($_SESSION); - echo "POST -------------------\n"; - print_r($_POST); - echo "FILES -------------------\n"; - print_r($_FILES); - echo "REQUEST -------------------\n"; - print_r($_REQUEST); - $debug_txt = ob_get_contents(); - ob_end_clean(); +if ($_SESSION ["debug"]) { + ob_start(); + echo "SESSION -------------------\n"; + print_r($_SESSION); + echo "POST -------------------\n"; + print_r($_POST); + echo "FILES -------------------\n"; + print_r($_FILES); + echo "REQUEST -------------------\n"; + print_r($_REQUEST); + $debug_txt = ob_get_contents(); + ob_end_clean(); } // Pfade -$CONTENT_DIR_REL = BASE_DIR.CONTENT_DIR_NAME."/"; -define("CONTENT_DIR_REL",$CONTENT_DIR_REL); -$GALLERIES_DIR_REL = BASE_DIR.GALLERIES_DIR_NAME."/"; -define("GALLERIES_DIR_REL",$GALLERIES_DIR_REL); -$PLUGIN_DIR_REL = BASE_DIR.PLUGIN_DIR_NAME."/"; -define("PLUGIN_DIR_REL",$PLUGIN_DIR_REL); - - -require_once(BASE_DIR_CMS."CatPageClass.php"); +$CONTENT_DIR_REL = BASE_DIR . CONTENT_DIR_NAME . "/"; +define("CONTENT_DIR_REL", $CONTENT_DIR_REL); +$GALLERIES_DIR_REL = BASE_DIR . GALLERIES_DIR_NAME . "/"; +define("GALLERIES_DIR_REL", $GALLERIES_DIR_REL); +$PLUGIN_DIR_REL = BASE_DIR . PLUGIN_DIR_NAME . "/"; +define("PLUGIN_DIR_REL", $PLUGIN_DIR_REL); + +require_once (BASE_DIR_CMS . "CatPageClass.php"); $CatPage = new CatPageClass(); -require_once(BASE_DIR_ADMIN."filesystem.php"); -require_once(BASE_DIR_ADMIN."string.php"); -require_once(BASE_DIR_CMS."Smileys.php"); -require_once(BASE_DIR_CMS."Mail.php"); -require_once(BASE_DIR_ADMIN."categories_array.php"); +require_once (BASE_DIR_ADMIN . "filesystem.php"); +require_once (BASE_DIR_ADMIN . "string.php"); +require_once (BASE_DIR_CMS . "Smileys.php"); +require_once (BASE_DIR_CMS . "Mail.php"); +require_once (BASE_DIR_ADMIN . "categories_array.php"); -# Fatal Errors sofort beenden -if(!is_dir(BASE_DIR_ADMIN."conf")) { - die("Fatal Error ".BASE_DIR_ADMIN."conf Verzeichnis existiert nicht"); +// Fatal Errors sofort beenden +if (!is_dir(BASE_DIR_ADMIN . "conf")) { + die("Fatal Error " . BASE_DIR_ADMIN . "conf Verzeichnis existiert nicht"); } -if(!is_dir(BASE_DIR_CMS."conf")) { - die("Fatal Error ".BASE_DIR_CMS."conf Verzeichnis existiert nicht"); +if (!is_dir(BASE_DIR_CMS . "conf")) { + die("Fatal Error " . BASE_DIR_CMS . "conf Verzeichnis existiert nicht"); } -$ADMIN_CONF = new Properties(BASE_DIR_ADMIN."conf/basic.conf",true); -if(!isset($ADMIN_CONF->properties['readonly'])) { - die($ADMIN_CONF->properties['error']); +$ADMIN_CONF = new Properties(BASE_DIR_ADMIN . "conf/basic.conf", true); +if (!isset($ADMIN_CONF->properties ['readonly'])) { + die($ADMIN_CONF->properties ['error']); } -$BASIC_LANGUAGE = new Properties(BASE_DIR_ADMIN."sprachen/language_".$ADMIN_CONF->get("language").".conf",true); -if(!isset($BASIC_LANGUAGE->properties['readonly'])) { - die($BASIC_LANGUAGE->properties['error']); +$BASIC_LANGUAGE = new Properties(BASE_DIR_ADMIN . "sprachen/language_" . $ADMIN_CONF->get("language") . ".conf", true); +if (!isset($BASIC_LANGUAGE->properties ['readonly'])) { + die($BASIC_LANGUAGE->properties ['error']); } -# Errors nicht ganz so tragisch -if(!is_dir(BASE_DIR.CONTENT_DIR_NAME)) { - die(getLanguageValue("error_dir")." ".BASE_DIR.CONTENT_DIR_NAME."/"); +// Errors nicht ganz so tragisch +if (!is_dir(BASE_DIR . CONTENT_DIR_NAME)) { + die(getLanguageValue("error_dir") . " " . BASE_DIR . CONTENT_DIR_NAME . "/"); } -if(!is_dir(BASE_DIR."layouts")) { - die(getLanguageValue("error_dir")." ".BASE_DIR."layouts/"); +if (!is_dir(BASE_DIR . "layouts")) { + die(getLanguageValue("error_dir") . " " . BASE_DIR . "layouts/"); } -if(!is_dir(BASE_DIR_CMS."sprachen")) { - die(getLanguageValue("error_dir")." ".BASE_DIR_CMS."sprachen/"); +if (!is_dir(BASE_DIR_CMS . "sprachen")) { + die(getLanguageValue("error_dir") . " " . BASE_DIR_CMS . "sprachen/"); } -if(!is_dir(BASE_DIR."galerien")) { - die(getLanguageValue("error_dir")." ".BASE_DIR.GALLERIES_DIR_NAME."/"); +if (!is_dir(BASE_DIR . "galerien")) { + die(getLanguageValue("error_dir") . " " . BASE_DIR . GALLERIES_DIR_NAME . "/"); } -$CMS_CONF = new Properties(BASE_DIR_CMS."conf/main.conf",true); -if(!isset($CMS_CONF->properties['readonly'])) { - die($CMS_CONF->properties['error']); +$CMS_CONF = new Properties(BASE_DIR_CMS . "conf/main.conf", true); +if (!isset($CMS_CONF->properties ['readonly'])) { + die($CMS_CONF->properties ['error']); } -$VERSION_CONF = new Properties(BASE_DIR_CMS."conf/version.conf",true); -if(!isset($VERSION_CONF->properties['readonly'])) { - die($VERSION_CONF->properties['error']); +$VERSION_CONF = new Properties(BASE_DIR_CMS . "conf/version.conf", true); +if (!isset($VERSION_CONF->properties ['readonly'])) { + die($VERSION_CONF->properties ['error']); } -$DOWNLOAD_COUNTS = new Properties(BASE_DIR_CMS."conf/downloads.conf",true); -if(!isset($DOWNLOAD_COUNTS->properties['readonly'])) { - die($DOWNLOAD_COUNTS->properties['error']); +$DOWNLOAD_COUNTS = new Properties(BASE_DIR_CMS . "conf/downloads.conf", true); +if (!isset($DOWNLOAD_COUNTS->properties ['readonly'])) { + die($DOWNLOAD_COUNTS->properties ['error']); } -$GALLERY_CONF = new Properties(BASE_DIR_CMS."conf/gallery.conf",true); -if(!isset($GALLERY_CONF->properties['readonly'])) { - die($GALLERY_CONF->properties['error']); +$GALLERY_CONF = new Properties(BASE_DIR_CMS . "conf/gallery.conf", true); +if (!isset($GALLERY_CONF->properties ['readonly'])) { + die($GALLERY_CONF->properties ['error']); } -$LOGINCONF = new Properties(BASE_DIR_ADMIN."conf/logindata.conf",true); -# die muss schreiben geöffnet werden können -if(isset($LOGINCONF->properties['error'])) { - die($LOGINCONF->properties['error']); +$LOGINCONF = new Properties(BASE_DIR_ADMIN . "conf/logindata.conf", true); +// die muss schreiben geöffnet werden können +if (isset($LOGINCONF->properties ['error'])) { + die($LOGINCONF->properties ['error']); } -$PASSWORDS = new Properties(BASE_DIR_CMS."conf/passwords.conf",true); -# die muss schreiben geöffnet werden können -if(isset($PASSWORDS->properties['error'])) { - die($PASSWORDS->properties['error']); +$PASSWORDS = new Properties(BASE_DIR_CMS . "conf/passwords.conf", true); +// die muss schreiben geöffnet werden können +if (isset($PASSWORDS->properties ['error'])) { + die($PASSWORDS->properties ['error']); } - -$USER_SYNTAX_FILE = BASE_DIR_CMS."conf/syntax.conf"; -$USER_SYNTAX = new Properties($USER_SYNTAX_FILE,true); -if($CMS_CONF->properties['usecmssyntax'] == "true" and !isset($USER_SYNTAX->properties['readonly'])) { - die($USER_SYNTAX->properties['error']); +$USER_SYNTAX_FILE = BASE_DIR_CMS . "conf/syntax.conf"; +$USER_SYNTAX = new Properties($USER_SYNTAX_FILE, true); +if ($CMS_CONF->properties ['usecmssyntax'] == "true" and !isset($USER_SYNTAX->properties ['readonly'])) { + die($USER_SYNTAX->properties ['error']); } /* - -// Abwärtskompatibilität: Downloadcounter initalisieren -if ($DOWNLOAD_COUNTS->get("_downloadcounterstarttime") == "" and !isset($DOWNLOAD_COUNTS->properties['error'])) - $DOWNLOAD_COUNTS->set("_downloadcounterstarttime", time()); -*/ + * + * // Abwärtskompatibilität: Downloadcounter initalisieren + * if ($DOWNLOAD_COUNTS->get("_downloadcounterstarttime") == "" and !isset($DOWNLOAD_COUNTS->properties['error'])) + * $DOWNLOAD_COUNTS->set("_downloadcounterstarttime", time()); + */ $ALLOWED_SPECIALCHARS_REGEX = $specialchars->getSpecialCharsRegex(); -define("ALLOWED_SPECIALCHARS_REGEX",$ALLOWED_SPECIALCHARS_REGEX); +define("ALLOWED_SPECIALCHARS_REGEX", $ALLOWED_SPECIALCHARS_REGEX); -$icon_size = "24x24"; # 16x16 22x22 24x24 32x32 48x48 -$icon_size_tabs = "16x16"; # 16x16 22x22 24x24 32x32 48x48 +$icon_size = "24x24"; // 16x16 22x22 24x24 32x32 48x48 +$icon_size_tabs = "16x16"; // 16x16 22x22 24x24 32x32 48x48 $post = NULL; -# getRequestParam() verarbeitet nur $_POST sachen deshalb hier eine ausnahme -if(isset($_REQUEST['javascript']) and $_REQUEST['javascript'] == "ja") $_POST['javascript'] = "ja"; - -# hier das tabs array -$array_tabs = array("home","category","page","files","gallery","config","admin","plugins"); - -# Plugin-Tab nur anzeigen wenn plugin Ordner mit mind. einem plugin vorhanden ist -if (count(getDirAsArray(PLUGIN_DIR_REL, "dir")) < 1 ) { - $array_tabs = array("home","category","page","files","gallery","config","admin"); +// getRequestParam() verarbeitet nur $_POST sachen deshalb hier eine ausnahme +if (isset($_REQUEST ['javascript']) and $_REQUEST ['javascript'] == "ja") + $_POST ['javascript'] = "ja"; + +// hier das tabs array +$array_tabs = array( + "home", + "category", + "page", + "files", + "gallery", + "config", + "admin", + "plugins" +); + +// Plugin-Tab nur anzeigen wenn plugin Ordner mit mind. einem plugin vorhanden ist +if (count(getDirAsArray(PLUGIN_DIR_REL, "dir")) < 1) { + $array_tabs = array( + "home", + "category", + "page", + "files", + "gallery", + "config", + "admin" + ); } $action = 'home'; -foreach($array_tabs as $pos => $tab) { - # actives tab - if(isset($_REQUEST['action_'.$pos])) { - $action = $tab; - $post['makepara'] = "yes"; - break; - } - # actives tab in dem grade gearbeitet wird - if(isset($_POST['action_activ'])) { - $action_html = $specialchars->rebuildSpecialChars($_POST['action_activ'], false, true); - if($action_html == getLanguageValue($tab."_button")) { - $action = $tab; - break; - } - } +foreach ($array_tabs as $pos => $tab) { + // actives tab + if (isset($_REQUEST ['action_' . $pos])) { + $action = $tab; + $post ['makepara'] = "yes"; + break; + } + // actives tab in dem grade gearbeitet wird + if (isset($_POST ['action_activ'])) { + $action_html = $specialchars->rebuildSpecialChars($_POST ['action_activ'], false, true); + if ($action_html == getLanguageValue($tab . "_button")) { + $action = $tab; + break; + } + } } -# IE Hack input image -if(isset($_POST['confirm_true']) or isset($_POST['confirm_true_x'])) - $_POST['confirm'] = "true"; -if(isset($_POST['confirm_false']) or isset($_POST['confirm_false_x'])) - $_POST['confirm'] = "false"; - -# action_data parameter die mit cat page zu tun haben -if(isset($_POST['action_data'])) { - # ist das Array für Kategorien oder Inhaltseiten nicht erzeugen - $post['makepara'] = "no"; - if(isset($_POST['checkpara']) and $_POST['checkpara'] == "yes") { - $post['categories'] = checkPostCatPageReturnVariable(); - } - # aus checkPostCatPageReturnVariable error_messages umsetzen - if(isset($post['categories']['error_messages'])) { - $post['error_messages'] = $post['categories']['error_messages']; - unset($post['categories']['error_messages']); - } - # aus checkPostCatPageReturnVariable move_copy umsetzen - if(isset($post['categories']['move_copy'])) { - $post['move_copy'] = $post['categories']['move_copy']; - unset($post['categories']['move_copy']); - } - # action_data standartkomform aufbauen - $post['action_data'] = $_POST['action_data']; - $action_key = key($post['action_data']); - if(is_array($post['action_data'][$action_key])) { - $cat = key($post['action_data'][$action_key]); - if(is_array($post['action_data'][$action_key][$cat])) { - $page = key($post['action_data'][$action_key][$cat]); - $post['action_data'][$action_key][$cat] = $page; - } - } +// IE Hack input image +if (isset($_POST ['confirm_true']) or isset($_POST ['confirm_true_x'])) + $_POST ['confirm'] = "true"; +if (isset($_POST ['confirm_false']) or isset($_POST ['confirm_false_x'])) + $_POST ['confirm'] = "false"; + +// action_data parameter die mit cat page zu tun haben +if (isset($_POST ['action_data'])) { + // ist das Array für Kategorien oder Inhaltseiten nicht erzeugen + $post ['makepara'] = "no"; + if (isset($_POST ['checkpara']) and $_POST ['checkpara'] == "yes") { + $post ['categories'] = checkPostCatPageReturnVariable(); + } + // aus checkPostCatPageReturnVariable error_messages umsetzen + if (isset($post ['categories'] ['error_messages'])) { + $post ['error_messages'] = $post ['categories'] ['error_messages']; + unset($post ['categories'] ['error_messages']); + } + // aus checkPostCatPageReturnVariable move_copy umsetzen + if (isset($post ['categories'] ['move_copy'])) { + $post ['move_copy'] = $post ['categories'] ['move_copy']; + unset($post ['categories'] ['move_copy']); + } + // action_data standartkomform aufbauen + $post ['action_data'] = $_POST ['action_data']; + $action_key = key($post ['action_data']); + if (is_array($post ['action_data'] [$action_key])) { + $cat = key($post ['action_data'] [$action_key]); + if (is_array($post ['action_data'] [$action_key] [$cat])) { + $page = key($post ['action_data'] [$action_key] [$cat]); + $post ['action_data'] [$action_key] [$cat] = $page; + } + } } -# POST umsetzen nach $post bei config und admin -if($action == 'config' or $action == 'admin' ) { - if(is_array($_POST) and count($_POST) > 0) { - foreach($_POST as $key => $inhalt) { - $post[$key] = getRequestParam($key, true); - } - } +// POST umsetzen nach $post bei config und admin +if ($action == 'config' or $action == 'admin') { + if (is_array($_POST) and count($_POST) > 0) { + foreach ($_POST as $key => $inhalt) { + $post [$key] = getRequestParam($key, true); + } + } } - -if($LOGINCONF->get("initialsetup") == "true") { - $action = "admin"; +if ($LOGINCONF->get("initialsetup") == "true") { + $action = "admin"; } -# Backup Erinnerung bestätigen +// Backup Erinnerung bestätigen $error_backup = NULL; -if(getRequestParam("lastbackup_yes", true)) { - $post['makepara'] = "yes"; - if($specialchars->rebuildSpecialChars(getRequestParam("lastbackup_yes", true), false, true) == getLanguageValue("yes")) { - if(!isset($ADMIN_CONF->properties['error'])) { - $ADMIN_CONF->set("lastbackup",time()); - } else { - $error_backup = returnMessage(false, $ADMIN_CONF->properties['error']); - } - } +if (getRequestParam("lastbackup_yes", true)) { + $post ['makepara'] = "yes"; + if ($specialchars->rebuildSpecialChars(getRequestParam("lastbackup_yes", true), false, true) == getLanguageValue("yes")) { + if (!isset($ADMIN_CONF->properties ['error'])) { + $ADMIN_CONF->set("lastbackup", time()); + } else { + $error_backup = returnMessage(false, $ADMIN_CONF->properties ['error']); + } + } } -# Function aufrufen +// Function aufrufen $functionreturn = array(); $functionreturn = $action($post); -$pagetitle = $functionreturn[0]; -$pagecontent = $functionreturn[1]; +$pagetitle = $functionreturn [0]; +$pagecontent = $functionreturn [1]; -// Aufbau der gesamten Seite -$html = ''."\n"; +// Aufbau der gesamten Seite +$html = '' . "\n"; $html .= "\n"; $html .= ""; -$html .= ''; -# usecmseditarea -if($CMS_CONF->get('usecmseditarea') == "true" and isset($post['action_data']['editsite'])) { - require_once(BASE_DIR_ADMIN."edit_area/mozilo_edit_area.php"); - $html .= $editor_area_html; +$html .= ''; +// usecmseditarea +if ($CMS_CONF->get('usecmseditarea') == "true" and isset($post ['action_data'] ['editsite'])) { + require_once (BASE_DIR_ADMIN . "edit_area/mozilo_edit_area.php"); + $html .= $editor_area_html; } else - $html .= ''; + $html .= ''; $html .= ''; $html .= "$ADMIN_TITLE - $pagetitle"; $html .= ''; @@ -309,21 +325,20 @@ $html .= ""; $html .= ''; - -if($ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_help_logout_button = createTooltipWZ("help_logout_button","",",WIDTH,200,CLICKCLOSE,true"); - $tooltip_help_website_button = createTooltipWZ("help_website_button","",",WIDTH,200,CLICKCLOSE,true"); +if ($ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_help_logout_button = createTooltipWZ("help_logout_button", "", ",WIDTH,200,CLICKCLOSE,true"); + $tooltip_help_website_button = createTooltipWZ("help_website_button", "", ",WIDTH,200,CLICKCLOSE,true"); } else { - $tooltip_help_logout_button = NULL; - $tooltip_help_website_button = NULL; + $tooltip_help_logout_button = NULL; + $tooltip_help_website_button = NULL; } -$width_height = substr($icon_size,0,2); +$width_height = substr($icon_size, 0, 2); $html .= ''; $html .= '"; @@ -332,19 +347,22 @@ $html .= '
'; $html .= ''; -$html .= ''; -$html .= ''; -$html .= ''; +$html .= ''; +$html .= ''; +$html .= ''; $html .= '
'.$ADMIN_TITLE.' - '.$pagetitle.'
' . $ADMIN_TITLE . ' - ' . $pagetitle . '
'; $html .= "
'; $html .= ''; -# Menue Tabs erzeugen -foreach($array_tabs as $position => $language) { - if($ADMIN_CONF->get("showTooltips") == "true") { - $tooltip = createTooltipWZ($language."_button",$language."_text",",WIDTH,400"); - } else { - $tooltip = NULL; - } - if($action == $language) $activ = "_activ"; else $activ = NULL; - $html .= ''; - # width="24" height="24" +// Menue Tabs erzeugen +foreach ($array_tabs as $position => $language) { + if ($ADMIN_CONF->get("showTooltips") == "true") { + $tooltip = createTooltipWZ($language . "_button", $language . "_text", ",WIDTH,400"); + } else { + $tooltip = NULL; + } + if ($action == $language) + $activ = "_activ"; + else + $activ = NULL; + $html .= ''; + // width="24" height="24" } $html .= ''; @@ -354,4140 +372,4228 @@ $html .= '"; -if ($_SESSION["debug"]) { - ob_start(); - echo "
";
-    if (function_exists("error_get_last")) {
-        print_r(@error_get_last());
-    }
-    echo $debug_txt;
-    echo '$post ------------------------'."\n";
-    if (isset($post)) {
-        print_r($post);
-    }
-    echo "
"; - $debug_txt = ob_get_contents(); - ob_end_clean(); - $html .= ""; +if ($_SESSION ["debug"]) { + ob_start(); + echo "
";
+	if (function_exists("error_get_last")) {
+		print_r(@error_get_last());
+	}
+	echo $debug_txt;
+	echo '$post ------------------------' . "\n";
+	if (isset($post)) {
+		print_r($post);
+	}
+	echo "
"; + $debug_txt = ob_get_contents(); + ob_end_clean(); + $html .= ""; } $html .= '
'; - $html .= ''.getLanguageValue($language."_button").''; - $html .= ''; - $html .= ''; + $html .= '' . getLanguageValue($language . "_button") . ''; + $html .= ''; + $html .= ' 
'; $enctype = NULL; -if($action == 'files' or $action == 'gallery' or $action == 'plugins') { - $enctype = ' enctype="multipart/form-data"'; +if ($action == 'files' or $action == 'gallery' or $action == 'plugins') { + $enctype = ' enctype="multipart/form-data"'; } -$html .= '
'; +$html .= ''; $html .= ''; - -if($LOGINCONF->get("initialpw") == "true" and $LOGINCONF->get("initialsetup") == "false") { - $html .= returnMessage(false, getLanguageValue("initialpw")); +if ($LOGINCONF->get("initialpw") == "true" and $LOGINCONF->get("initialsetup") == "false") { + $html .= returnMessage(false, getLanguageValue("initialpw")); } // Warnung, wenn seit dem letzten Login Logins fehlgeschlagen sind if ($LOGINCONF->get("falselogincount") > 0) { - $html .= returnMessage(false, getLanguageValue("warning_false_logins")." ".$LOGINCONF->get("falselogincount")); - // Gesamt-Counter fuer falsche Logins zuruecksetzen - if(!isset($LOGINCONF->properties['error'])) { - $LOGINCONF->set("falselogincount", 0); - } + $html .= returnMessage(false, getLanguageValue("warning_false_logins") . " " . $LOGINCONF->get("falselogincount")); + // Gesamt-Counter fuer falsche Logins zuruecksetzen + if (!isset($LOGINCONF->properties ['error'])) { + $LOGINCONF->set("falselogincount", 0); + } } -if(!isset($_REQUEST['link']) and $CMS_CONF->get('modrewrite') == "true") { - $html .= returnMessage(false, getLanguageValue("error_no_modrewrite")); +if (!isset($_REQUEST ['link']) and $CMS_CONF->get('modrewrite') == "true") { + $html .= returnMessage(false, getLanguageValue("error_no_modrewrite")); } $html .= $error_backup; // Warnung, wenn die letzte Backupwarnung mehr als $intervallsetting Tage her ist $intervallsetting = $ADMIN_CONF->get("backupmsgintervall"); if (($intervallsetting != "") && preg_match("/^[0-9]+$/", $intervallsetting) && ($intervallsetting > 0)) { - $intervallinseconds = 60 * 60 * 24 * $intervallsetting; - $lastbackup = $ADMIN_CONF->get("lastbackup"); - // initial: nur setzen - if ($lastbackup == "") { - if(!isset($ADMIN_CONF->properties['error'])) { - $ADMIN_CONF->set("lastbackup",time()); - } else { - $html .= returnMessage(false, $ADMIN_CONF->properties['error']); - } - } - // wenn schon gesetzt: pruefen und ggfs. warnen - else { - $nextbackup = $lastbackup + $intervallinseconds; - if($nextbackup <= time()) { - $html .= returnMessage(false, getLanguageValue("admin_messages_backup").'
Bitte bestätigen '); - } - } + $intervallinseconds = 60 * 60 * 24 * $intervallsetting; + $lastbackup = $ADMIN_CONF->get("lastbackup"); + // initial: nur setzen + if ($lastbackup == "") { + if (!isset($ADMIN_CONF->properties ['error'])) { + $ADMIN_CONF->set("lastbackup", time()); + } else { + $html .= returnMessage(false, $ADMIN_CONF->properties ['error']); + } + } // wenn schon gesetzt: pruefen und ggfs. warnen + else { + $nextbackup = $lastbackup + $intervallinseconds; + if ($nextbackup <= time()) { + $html .= returnMessage(false, getLanguageValue("admin_messages_backup") . '
Bitte bestätigen '); + } + } } $html .= $pagecontent; $html .= '
'; $html .= "
".$debug_txt."
" . $debug_txt . "
'; $html .= ""; // Ausgabe gem. CHARSET deklarieren -header('content-type: text/html; charset='.CHARSET); +header('content-type: text/html; charset=' . CHARSET); // Ausgabe der kompletten Seite echo $html; -/*------------------------------ - Zusätzliche Funktionen - ------------------------------ */ - +/* + * ------------------------------ + * Zusätzliche Funktionen + * ------------------------------ + */ function home($post) { - global $CMS_CONF; - global $VERSION_CONF; - global $ADMIN_CONF; - - $pagecontent = NULL; - $modrewrite = getLanguageValue("home_error_mod_rewrite"); - if(isset($_REQUEST['link']) and $_REQUEST['link'] == "rewrite") { - $modrewrite = getLanguageValue("home_messages_mod_rewrite"); - } - - $safemode = getLanguageValue("no"); - if(ini_get('safe_mode')) { - $post['error_messages']['home_error_safe_mode'][] = NULL; - $safemode = ''.getLanguageValue("yes").''; - } - - if(!extension_loaded("gd")) { - $post['error_messages']['home_error_gd'][] = NULL; - $gdlibinstalled = getLanguageValue("no"); - } - else { - $gdlibinstalled = getLanguageValue("yes"); - } - - $test_mail_adress = NULL; -/* if($ADMIN_CONF->get("adminmail") != "") { - $test_mail_adress = $ADMIN_CONF->get("adminmail"); - }*/ - if(getRequestParam('test_mail_adresse', true) != "") { - $test_mail_adress = getRequestParam('test_mail_adresse', true); - } - // Testmail schicken - if (getRequestParam('test_mail', true)) { - if (getRequestParam('test_mail_adresse', true) and getRequestParam('test_mail_adresse', true) != "") { - if(isMailAvailable()) { - sendMail(getLanguageValue("mailtest_mailsubject"), getLanguageValue("mailtest_mailcontent"),getRequestParam('test_mail_adresse', true),getRequestParam('test_mail_adresse', true), getRequestParam('test_mail_adresse', true)); - $post['messages']['home_messages_test_mail'][] = getRequestParam('test_mail_adresse', true); - } else { - $post['error_messages']['home_messages_no_mail'][] = NULL; - } - } else { - $post['error_messages']['home_error_test_mail'][] = NULL; - } - } - - $pagecontent .= categoriesMessages($post); - - $pagecontent .= ''.getLanguageValue("home_button").''; - $pagecontent .= "

"; - $pagecontent .= getLanguageValue("home_text_welcome"); - $pagecontent .= "

"; - - $path = BASE_DIR; - $cmssize = convertFileSizeUnit(dirsize($path)); - $pagecontent .= '' - // CMS-INFOS - ."" - .'' - ."" - // Zeile "CMS-VERSION" - ."" - .'" - .'' - ."" - // Zeile "Gesamtgröße des CMS" - ."" - .'" - .'" - ."" - // SERVER-INFOS - ."" - .'' - ."" - // Zeile "Installationspfad" - ."" - .'" - .'" - ."" - // Zeile "PHP-Version" - ."" - .'" - .'" - ."" - // Zeile "Safe Mode" - ."" - .'" - .'" - ."" - // Zeile "GDlib installiert" - ."" - .'" - .'" - ."" - // test - ."" - .'' - ."" - ."" - .'" - .'' - ."" - ."" - .'' - ."" - ."" - .'" - .'' - ."" - - - ."
'.getLanguageValue("cmsinfo").'
'.getLanguageValue("cmsversion_text")."'.$VERSION_CONF->get("cmsversion").' ("'.$VERSION_CONF->get("cmsname").'")
'.getLanguageValue("cmsrevision_text").' '.$VERSION_CONF->get("revision").'
'.getLanguageValue("cmssize_text")."'.$cmssize."
'.getLanguageValue("serverinfo").'
'.getLanguageValue("installpath_text")."'.$path."
'.getLanguageValue("phpversion_text")."'.phpversion()."
'.getLanguageValue("home_text_safemode")."'.$safemode."
'.getLanguageValue("home_text_gd")."'.$gdlibinstalled."
'.getLanguageValue("home_titel_mod_rewrite").'
'.getLanguageValue("home_text_mod_rewrite")."'.$modrewrite.'
'.getLanguageValue("home_titel_test_mail").'
'.getLanguageValue("home_text_test_mail")."   
"; - return array(getLanguageValue("home_button"), $pagecontent); + global $CMS_CONF; + global $VERSION_CONF; + global $ADMIN_CONF; + + $pagecontent = NULL; + $modrewrite = getLanguageValue("home_error_mod_rewrite"); + if (isset($_REQUEST ['link']) and $_REQUEST ['link'] == "rewrite") { + $modrewrite = getLanguageValue("home_messages_mod_rewrite"); + } + + $safemode = getLanguageValue("no"); + if (ini_get('safe_mode')) { + $post ['error_messages'] ['home_error_safe_mode'] [] = NULL; + $safemode = '' . getLanguageValue("yes") . ''; + } + + if (!extension_loaded("gd")) { + $post ['error_messages'] ['home_error_gd'] [] = NULL; + $gdlibinstalled = getLanguageValue("no"); + } else { + $gdlibinstalled = getLanguageValue("yes"); + } + + $test_mail_adress = NULL; + /* + * if($ADMIN_CONF->get("adminmail") != "") { + * $test_mail_adress = $ADMIN_CONF->get("adminmail"); + * } + */ + if (getRequestParam('test_mail_adresse', true) != "") { + $test_mail_adress = getRequestParam('test_mail_adresse', true); + } + // Testmail schicken + if (getRequestParam('test_mail', true)) { + if (getRequestParam('test_mail_adresse', true) and getRequestParam('test_mail_adresse', true) != "") { + if (isMailAvailable()) { + sendMail(getLanguageValue("mailtest_mailsubject"), getLanguageValue("mailtest_mailcontent"), getRequestParam('test_mail_adresse', true), getRequestParam('test_mail_adresse', true), getRequestParam('test_mail_adresse', true)); + $post ['messages'] ['home_messages_test_mail'] [] = getRequestParam('test_mail_adresse', true); + } else { + $post ['error_messages'] ['home_messages_no_mail'] [] = NULL; + } + } else { + $post ['error_messages'] ['home_error_test_mail'] [] = NULL; + } + } + + $pagecontent .= categoriesMessages($post); + + $pagecontent .= '' . getLanguageValue("home_button") . ''; + $pagecontent .= "

"; + $pagecontent .= getLanguageValue("home_text_welcome"); + $pagecontent .= "

"; + + $path = BASE_DIR; + $cmssize = convertFileSizeUnit(dirsize($path)); + $pagecontent .= '' . + // CMS-INFOS + "" . '' . "" . + // Zeile "CMS-VERSION" + "" . '" . '' . "" . + // Zeile "Gesamtgröße des CMS" + "" . '" . '" . "" . + // SERVER-INFOS + "" . '' . "" . + // Zeile "Installationspfad" + "" . '" . '" . "" . + // Zeile "PHP-Version" + "" . '" . '" . "" . + // Zeile "Safe Mode" + "" . '" . '" . "" . + // Zeile "GDlib installiert" + "" . '" . '" . "" . + // test + "" . '' . "" . "" . '" . '' . "" . "" . '' . "" . "" . '" . '' . "" . "
' . getLanguageValue("cmsinfo") . '
' . getLanguageValue("cmsversion_text") . "' . $VERSION_CONF->get("cmsversion") . ' ("' . $VERSION_CONF->get("cmsname") . '")
' . getLanguageValue("cmsrevision_text") . ' ' . $VERSION_CONF->get("revision") . '
' . getLanguageValue("cmssize_text") . "' . $cmssize . "
' . getLanguageValue("serverinfo") . '
' . getLanguageValue("installpath_text") . "' . $path . "
' . getLanguageValue("phpversion_text") . "' . phpversion() . "
' . getLanguageValue("home_text_safemode") . "' . $safemode . "
' . getLanguageValue("home_text_gd") . "' . $gdlibinstalled . "
' . getLanguageValue("home_titel_mod_rewrite") . '
' . getLanguageValue("home_text_mod_rewrite") . "' . $modrewrite . '
' . getLanguageValue("home_titel_test_mail") . '
' . getLanguageValue("home_text_test_mail") . "   
"; + return array( + getLanguageValue("home_button"), + $pagecontent + ); } function category($post) { - global $specialchars; - global $ADMIN_CONF; - global $icon_size; - $max_cat_page = 100; - $max_strlen = 255; - - - if(isset($post['action_data']) and !isset($post['error_messages'])) { - $action_data_key = key($post['action_data']); - if($action_data_key == "editcategory") { - $post = editCategory($post); - } elseif($action_data_key == "deletecategory") { - $post = deleteCategory($post); - } - } - - if(isset($post['makepara']) and $post['makepara'] == "yes") { - $post['categories'] = makePostCatPageReturnVariable(); - if(isset($post['categories']['error_messages'])) { - $post['error_messages'] = $post['categories']['error_messages']; - unset($post['categories']['error_messages']); - } - } - - $pagecontent = ''; - $pagecontent .= ''; - - $pagecontent .= categoriesMessages($post); - - if(isset($post['ask'])) { - $pagecontent .= $post['ask']; - } - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_category_help = 'help'; - } else { - $tooltip_category_help = 'help'; - } - - $pagecontent .= ''.getLanguageValue("category_button").''; - $pagecontent .= $tooltip_category_help; - $pagecontent .= "

".getLanguageValue("category_text")."

"; - - # Die getLanguageValue() und createTooltipWZ() erzeugen - $array_getLanguageValue = array("pages","files","url","position","name","new_name", - "url_adress","url_new_adress","url_adress_description","contents","category_button_change", - "category_button_delete","target","toggle_show","toggle_hide"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getLanguageValue as $language) { - ${"text_".$language} = getLanguageValue($language); - } - $title_category_button_delete = getLanguageValue('category_button_delete',true); - - $array_getTooltipValue = array("help_new_url","help_target_blank","help_target_self","help_target","help_url", - "category_help_new_position","category_help_new_name","category_help_position","category_help_delete", - "category_help_name","category_help_edit"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getTooltipValue as $language) { - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); - } else { - ${"tooltip_".$language} = NULL; - } - } - - $pagecontent .= ''; - foreach ($post['categories']['cat']['position'] as $pos => $position) { - if(isset($post['displays']['cat']['error_html']['display'][$pos])) { - $post['categories']['cat']['error_html']['display'][$pos] = $post['displays']['cat']['error_html']['display'][$pos]; - } - if(!isset($display_new_cat)) { - $pagecontent .= ''; - # Neue Kategorie nicht Anzeigen wenn es schonn 100 Kategorien gibt - if(count($post['categories']['cat']['position']) < $max_cat_page + 1) { - $pagecontent .= ''; - } - $display_new_cat = true; - } - if($pos == $max_cat_page) { - continue; - } - if (!isset($post['categories']['cat']['url'][$pos])) { - $file = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - // Anzahl Inhaltsseiten auslesen - $pagescount = 0; - if($pageshandle = opendir(CONTENT_DIR_REL.$file)) { - while (($currentpage = readdir($pageshandle))) { - if(is_file(CONTENT_DIR_REL.$file."/".$currentpage)) - $pagescount++; - } - closedir($pageshandle); - } - // Anzahl Dateien auslesen - $filecount = 0; - if($fileshandle = opendir(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME)) { - while (($filesdir = readdir($fileshandle))) { - if(isValidDirOrFile($filesdir)) - $filecount++; - } - closedir($fileshandle); - } - $text = '('.$pagescount.' '.$text_pages.', '.$filecount.' '.$text_files.')'; - } else { - $text = '('.$text_url.' target = '.substr($post['categories']['cat']['target'][$pos],2,-1).')'; - } - - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= ''; - $pagecontent .= '
' - .'' - .'' - .'' - .'' - .'' - .''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '' - .''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '
'.$text_position.''.$text_name.'' - .''.$text_url_adress.' '.$text_url_adress_description.' '.getLanguageValue("blank").''.getLanguageValue("self").'
'; - $pagecontent .= ''.$text_target.'
'; - $pagecontent .= '
'; - - $pagecontent .= ''; - if(!isset($display_new_cat_name)) { - $pagecontent .= ''; - $display_new_cat_name = true; - } - $pagecontent .= '
'.$text_position.''.$text_name.''.$text_contents.' 
'; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''.$specialchars->rebuildSpecialChars($post['categories']['cat']['name'][$pos], true, true).''; -# ein Test das auch der Name Toggle bar ist -# $pagecontent .= ''.$specialchars->rebuildSpecialChars($post['categories']['cat']['name'][$pos], true, true).''; - $pagecontent .= ''.$text.''; - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $del_dir = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - if(isset($post['categories']['cat']['url'][$pos])) { - $del_dir = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos].$post['categories']['cat']['target'][$pos].$post['categories']['cat']['url'][$pos].EXT_LINK; - } - $pagecontent .= ''; - $pagecontent .= '
'; - if(isset($post['categories']['cat']['url'][$pos])) { - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '
'.$text_new_name.''.$text_url_adress.''; - $pagecontent .= ''; - $pagecontent .= ' '.getLanguageValue("blank").''.getLanguageValue("self").' 
'.$text_url_new_adress.''.$text_target.' 
'; - } else - $pagecontent .= '
'.$text_new_name.'
 
'; - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= ''; - $pagecontent .= '
'; - return array(getLanguageValue("category_button"), $pagecontent); + global $specialchars; + global $ADMIN_CONF; + global $icon_size; + $max_cat_page = 100; + $max_strlen = 255; + + if (isset($post ['action_data']) and !isset($post ['error_messages'])) { + $action_data_key = key($post ['action_data']); + if ($action_data_key == "editcategory") { + $post = editCategory($post); + } elseif ($action_data_key == "deletecategory") { + $post = deleteCategory($post); + } + } + + if (isset($post ['makepara']) and $post ['makepara'] == "yes") { + $post ['categories'] = makePostCatPageReturnVariable(); + if (isset($post ['categories'] ['error_messages'])) { + $post ['error_messages'] = $post ['categories'] ['error_messages']; + unset($post ['categories'] ['error_messages']); + } + } + + $pagecontent = ''; + $pagecontent .= ''; + + $pagecontent .= categoriesMessages($post); + + if (isset($post ['ask'])) { + $pagecontent .= $post ['ask']; + } + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_category_help = 'help'; + } else { + $tooltip_category_help = 'help'; + } + + $pagecontent .= '' . getLanguageValue("category_button") . ''; + $pagecontent .= $tooltip_category_help; + $pagecontent .= "

" . getLanguageValue("category_text") . "

"; + + // Die getLanguageValue() und createTooltipWZ() erzeugen + $array_getLanguageValue = array( + "pages", + "files", + "url", + "position", + "name", + "new_name", + "url_adress", + "url_new_adress", + "url_adress_description", + "contents", + "category_button_change", + "category_button_delete", + "target", + "toggle_show", + "toggle_hide" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getLanguageValue as $language) { + ${"text_" . $language} = getLanguageValue($language); + } + $title_category_button_delete = getLanguageValue('category_button_delete', true); + + $array_getTooltipValue = array( + "help_new_url", + "help_target_blank", + "help_target_self", + "help_target", + "help_url", + "category_help_new_position", + "category_help_new_name", + "category_help_position", + "category_help_delete", + "category_help_name", + "category_help_edit" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getTooltipValue as $language) { + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + ${"tooltip_" . $language} = createTooltipWZ("", $language, ",WIDTH,200,CLICKCLOSE,true"); + } else { + ${"tooltip_" . $language} = NULL; + } + } + + $pagecontent .= ''; + foreach ($post ['categories'] ['cat'] ['position'] as $pos => $position) { + if (isset($post ['displays'] ['cat'] ['error_html'] ['display'] [$pos])) { + $post ['categories'] ['cat'] ['error_html'] ['display'] [$pos] = $post ['displays'] ['cat'] ['error_html'] ['display'] [$pos]; + } + if (!isset($display_new_cat)) { + $pagecontent .= ''; + // Neue Kategorie nicht Anzeigen wenn es schonn 100 Kategorien gibt + if (count($post ['categories'] ['cat'] ['position']) < $max_cat_page + 1) { + $pagecontent .= ''; + } + $display_new_cat = true; + } + if ($pos == $max_cat_page) { + continue; + } + if (!isset($post ['categories'] ['cat'] ['url'] [$pos])) { + $file = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + // Anzahl Inhaltsseiten auslesen + $pagescount = 0; + if ($pageshandle = opendir(CONTENT_DIR_REL . $file)) { + while (($currentpage = readdir($pageshandle))) { + if (is_file(CONTENT_DIR_REL . $file . "/" . $currentpage)) + $pagescount++; + } + closedir($pageshandle); + } + // Anzahl Dateien auslesen + $filecount = 0; + if ($fileshandle = opendir(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME)) { + while (($filesdir = readdir($fileshandle))) { + if (isValidDirOrFile($filesdir)) + $filecount++; + } + closedir($fileshandle); + } + $text = '(' . $pagescount . ' ' . $text_pages . ', ' . $filecount . ' ' . $text_files . ')'; + } else { + $text = '(' . $text_url . ' target = ' . substr($post ['categories'] ['cat'] ['target'] [$pos], 2, -1) . ')'; + } + + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= ''; + $pagecontent .= '
' . '' . '' . '' . '' . '' . ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '' . ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '
' . $text_position . '' . $text_name . '' . '' . $text_url_adress . ' ' . $text_url_adress_description . ' ' . getLanguageValue("blank") . '' . getLanguageValue("self") . '
'; + $pagecontent .= '' . $text_target . '
'; + $pagecontent .= '
'; + + $pagecontent .= ''; + if (!isset($display_new_cat_name)) { + $pagecontent .= ''; + $display_new_cat_name = true; + } + $pagecontent .= '
' . $text_position . '' . $text_name . '' . $text_contents . ' 
'; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '' . $specialchars->rebuildSpecialChars($post ['categories'] ['cat'] ['name'] [$pos], true, true) . ''; + // ein Test das auch der Name Toggle bar ist + // $pagecontent .= ''.$specialchars->rebuildSpecialChars($post['categories']['cat']['name'][$pos], true, true).''; + $pagecontent .= '' . $text . ''; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $del_dir = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + if (isset($post ['categories'] ['cat'] ['url'] [$pos])) { + $del_dir = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos] . $post ['categories'] ['cat'] ['target'] [$pos] . $post ['categories'] ['cat'] ['url'] [$pos] . EXT_LINK; + } + $pagecontent .= ''; + $pagecontent .= '
'; + if (isset($post ['categories'] ['cat'] ['url'] [$pos])) { + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '
' . $text_new_name . '' . $text_url_adress . ''; + $pagecontent .= ''; + $pagecontent .= ' ' . getLanguageValue("blank") . '' . getLanguageValue("self") . ' 
' . $text_url_new_adress . '' . $text_target . ' 
'; + } else + $pagecontent .= '
' . $text_new_name . '
 
'; + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= ''; + $pagecontent .= '
'; + return array( + getLanguageValue("category_button"), + $pagecontent + ); } - - function editCategory($post) { - global $specialchars; - global $CMS_CONF; - global $PASSWORDS; - $max_cat_page = 100; - - $new_move_cat_page = false; - if(!empty($post['categories']['cat']['new_position'][$max_cat_page])) { - $new_move_cat_page[] = $post['categories']['cat']['new_position'][$max_cat_page]; - } - - $array_return = position_move($post['categories']['cat']['position'],$post['categories']['cat']['new_position'],$new_move_cat_page); - - # Rename Vorbereiten - foreach ($post['categories']['cat']['position'] as $pos => $position) { - # $max_cat_page = new_cat - if($pos == $max_cat_page) { - continue; - } - if(isset($array_return['move'][sprintf("%1d",$position)])) { - $post['categories']['cat']['new_position'][$pos] = $array_return['move'][sprintf("%1d",$position)]; - } - # wenn new_name, new_target, new_url - if(!empty($post['categories']['cat']['new_name'][$pos])) - $newname[$pos] = $post['categories']['cat']['new_position'][$pos]."_".$post['categories']['cat']['new_name'][$pos]; - else - $newname[$pos] = $post['categories']['cat']['new_position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - if(isset($post['categories']['cat']['url'][$pos])) { - $orgname[$pos] = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos].$post['categories']['cat']['target'][$pos].$post['categories']['cat']['url'][$pos].EXT_LINK; - if(!empty($post['categories']['cat']['new_target'][$pos])) - $newname[$pos] = $newname[$pos].$post['categories']['cat']['new_target'][$pos]; - else - $newname[$pos] = $newname[$pos].$post['categories']['cat']['target'][$pos]; - if(!empty($post['categories']['cat']['new_url'][$pos])) - $newname[$pos] = $newname[$pos].$post['categories']['cat']['new_url'][$pos].EXT_LINK; - else - $newname[$pos] = $newname[$pos].$post['categories']['cat']['url'][$pos].EXT_LINK; - } else { - $orgname[$pos] = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - } - if($newname[$pos] == $orgname[$pos]) { - unset($newname[$pos],$orgname[$pos]); - } - } - - # Rename $orgname[$pos] -> $newname[$pos] - if(isset($newname)) { - foreach ($newname as $pos => $tmp) { - @rename(CONTENT_DIR_REL.$orgname[$pos], CONTENT_DIR_REL.$newname[$pos]); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - $post['display']['cat']['error_html']['display'][$pos] = 'style="display:block;" '; - } elseif(!is_dir(CONTENT_DIR_REL.$newname[$pos])) { - $post['error_messages']['category_error_rename'][] = $orgname[$pos]; - $post['displays']['cat']['error_html']['display'][$pos] = 'style="display:block;" '; - } else { - if(!isset($post['categories']['cat']['url'][$pos])) { - // Referenzen auf die umbenannte Kategorie in der Download-Statistik ändern - renameCategoryInDownloadStats($orgname[$pos],$newname[$pos]); - // Referenzen auf die umbenannte Kategorie in allen Inhaltsseiten ändern - $error['updateReferences'] = updateReferencesInAllContentPages($orgname[$pos],"",$newname[$pos],""); - if(is_array($error['updateReferences'])) { - $post['makepara'] = "yes"; - if(isset($post['error_messages']) and is_array($post['error_messages'])) { - $post['error_messages'] = array_merge_recursive($post['error_messages'],$error); - } else { - $post['error_messages'] = $error; - } - } - if($CMS_CONF->get('defaultcat') == $orgname[$pos]) { - $CMS_CONF->set('defaultcat',$newname[$pos]); - $post['messages']['category_message_defaultcat'][] = $newname[$pos]; - } - } - # CatPage vom Password ändern - if(is_array($PASSWORDS->properties)) { - foreach($PASSWORDS->properties as $catpage => $pass) { - $pas_cat = explode("/",$catpage); - if($pas_cat[0] == $orgname[$pos]) { - $tmp_pas = $PASSWORDS->get($catpage); - $PASSWORDS->delete($catpage); - $PASSWORDS->set($newname[$pos].'/'.$pas_cat[1],$tmp_pas); - } - } - } - $post['messages']['category_message_rename'][] = $orgname[$pos]." > ".$newname[$pos]; - $post['makepara'] = "yes"; - } - } - } - # Neue Kategorie erstellen - if(!empty($post['categories']['cat']['new_position'][$max_cat_page])) { - $new_position = $post['categories']['cat']['new_position'][$max_cat_page]; - # Aufbau: Orig Position mit null => Neue (von dieser function) oder Orig Position mit null - if(isset($array_return['new_move_cat_page_newposition']) and is_array($array_return['new_move_cat_page_newposition'])) { - if(isset($array_return['new_move_cat_page_newposition'][$post['categories']['cat']['new_position'][$max_cat_page]])) { - $new_position = $array_return['new_move_cat_page_newposition'][$post['categories']['cat']['new_position'][$max_cat_page]]; - } - } - $new_cat = $new_position."_".$post['categories']['cat']['new_name'][$max_cat_page]; - - if(!empty($post['categories']['cat']['new_url'][$max_cat_page])) { - $new_cat .= $post['categories']['cat']['new_target'][$max_cat_page].$post['categories']['cat']['new_url'][$max_cat_page].EXT_LINK; - } - $post['error_messages'] = createCategory($new_cat); - if(isset($post['error_messages'])) { - $post['makepara'] = "no"; # kein makePostCatPageReturnVariable() - } else { - if(empty($post['categories']['cat']['new_url'][$max_cat_page])) { - $post['messages']['category_message_new'][] = "$new_cat"; - } else { - $post['messages']['message_link'][] = "$new_cat"; - } - $post['makepara'] = "yes"; # kein makePostCatPageReturnVariable() - } - } - return $post; + global $specialchars; + global $CMS_CONF; + global $PASSWORDS; + $max_cat_page = 100; + + $new_move_cat_page = array(); + if (!empty($post ['categories'] ['cat'] ['new_position'] [$max_cat_page])) { + $new_move_cat_page [] = $post ['categories'] ['cat'] ['new_position'] [$max_cat_page]; + } + + $array_return = position_move($post ['categories'] ['cat'] ['position'], $post ['categories'] ['cat'] ['new_position'], $new_move_cat_page); + + // Rename Vorbereiten + foreach ($post ['categories'] ['cat'] ['position'] as $pos => $position) { + // $max_cat_page = new_cat + if ($pos == $max_cat_page) { + continue; + } + if (isset($array_return ['move'] [sprintf("%1d", $position)])) { + $post ['categories'] ['cat'] ['new_position'] [$pos] = $array_return ['move'] [sprintf("%1d", $position)]; + } + // wenn new_name, new_target, new_url + if (!empty($post ['categories'] ['cat'] ['new_name'] [$pos])) + $newname [$pos] = $post ['categories'] ['cat'] ['new_position'] [$pos] . "_" . $post ['categories'] ['cat'] ['new_name'] [$pos]; + else + $newname [$pos] = $post ['categories'] ['cat'] ['new_position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + if (isset($post ['categories'] ['cat'] ['url'] [$pos])) { + $orgname [$pos] = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos] . $post ['categories'] ['cat'] ['target'] [$pos] . $post ['categories'] ['cat'] ['url'] [$pos] . EXT_LINK; + if (!empty($post ['categories'] ['cat'] ['new_target'] [$pos])) + $newname [$pos] = $newname [$pos] . $post ['categories'] ['cat'] ['new_target'] [$pos]; + else + $newname [$pos] = $newname [$pos] . $post ['categories'] ['cat'] ['target'] [$pos]; + if (!empty($post ['categories'] ['cat'] ['new_url'] [$pos])) + $newname [$pos] = $newname [$pos] . $post ['categories'] ['cat'] ['new_url'] [$pos] . EXT_LINK; + else + $newname [$pos] = $newname [$pos] . $post ['categories'] ['cat'] ['url'] [$pos] . EXT_LINK; + } else { + $orgname [$pos] = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + } + if ($newname [$pos] == $orgname [$pos]) { + unset($newname [$pos], $orgname [$pos]); + } + } + + // Rename $orgname[$pos] -> $newname[$pos] + if (isset($newname)) { + foreach ($newname as $pos => $tmp) { + @rename(CONTENT_DIR_REL . $orgname [$pos], CONTENT_DIR_REL . $newname [$pos]); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + $post ['display'] ['cat'] ['error_html'] ['display'] [$pos] = 'style="display:block;" '; + } elseif (!is_dir(CONTENT_DIR_REL . $newname [$pos])) { + $post ['error_messages'] ['category_error_rename'] [] = $orgname [$pos]; + $post ['displays'] ['cat'] ['error_html'] ['display'] [$pos] = 'style="display:block;" '; + } else { + if (!isset($post ['categories'] ['cat'] ['url'] [$pos])) { + // Referenzen auf die umbenannte Kategorie in der Download-Statistik ändern + renameCategoryInDownloadStats($orgname [$pos], $newname [$pos]); + // Referenzen auf die umbenannte Kategorie in allen Inhaltsseiten ändern + $error ['updateReferences'] = updateReferencesInAllContentPages($orgname [$pos], "", $newname [$pos], ""); + if (is_array($error ['updateReferences'])) { + $post ['makepara'] = "yes"; + if (isset($post ['error_messages']) and is_array($post ['error_messages'])) { + $post ['error_messages'] = array_merge_recursive($post ['error_messages'], $error); + } else { + $post ['error_messages'] = $error; + } + } + if ($CMS_CONF->get('defaultcat') == $orgname [$pos]) { + $CMS_CONF->set('defaultcat', $newname [$pos]); + $post ['messages'] ['category_message_defaultcat'] [] = $newname [$pos]; + } + } + // CatPage vom Password ändern + if (is_array($PASSWORDS->properties)) { + foreach ($PASSWORDS->properties as $catpage => $pass) { + $pas_cat = explode("/", $catpage); + if ($pas_cat [0] == $orgname [$pos]) { + $tmp_pas = $PASSWORDS->get($catpage); + $PASSWORDS->delete($catpage); + $PASSWORDS->set($newname [$pos] . '/' . $pas_cat [1], $tmp_pas); + } + } + } + $post ['messages'] ['category_message_rename'] [] = $orgname [$pos] . " > " . $newname [$pos]; + $post ['makepara'] = "yes"; + } + } + } + // Neue Kategorie erstellen + if (!empty($post ['categories'] ['cat'] ['new_position'] [$max_cat_page])) { + $new_position = $post ['categories'] ['cat'] ['new_position'] [$max_cat_page]; + // Aufbau: Orig Position mit null => Neue (von dieser function) oder Orig Position mit null + if (isset($array_return ['new_move_cat_page_newposition']) and is_array($array_return ['new_move_cat_page_newposition'])) { + if (isset($array_return ['new_move_cat_page_newposition'] [$post ['categories'] ['cat'] ['new_position'] [$max_cat_page]])) { + $new_position = $array_return ['new_move_cat_page_newposition'] [$post ['categories'] ['cat'] ['new_position'] [$max_cat_page]]; + } + } + $new_cat = $new_position . "_" . $post ['categories'] ['cat'] ['new_name'] [$max_cat_page]; + + if (!empty($post ['categories'] ['cat'] ['new_url'] [$max_cat_page])) { + $new_cat .= $post ['categories'] ['cat'] ['new_target'] [$max_cat_page] . $post ['categories'] ['cat'] ['new_url'] [$max_cat_page] . EXT_LINK; + } + $post ['error_messages'] = createCategory($new_cat); + if (isset($post ['error_messages'])) { + $post ['makepara'] = "no"; // kein makePostCatPageReturnVariable() + } else { + if (empty($post ['categories'] ['cat'] ['new_url'] [$max_cat_page])) { + $post ['messages'] ['category_message_new'] [] = "$new_cat"; + } else { + $post ['messages'] ['message_link'] [] = "$new_cat"; + } + $post ['makepara'] = "yes"; // kein makePostCatPageReturnVariable() + } + } + return $post; } function deleteCategory($post) { - global $specialchars; - global $CMS_CONF; - global $PASSWORDS; - global $icon_size; - - # Nachfragen wirklich Löschen - if(!isset($_POST['confirm'])) { - $del_cat = key($post['action_data']['deletecategory']); - $post['ask'] = askMessages("category_ask_delete",$del_cat,'action_data[deletecategory]',$post['action_data']['deletecategory'],"del_cat",$del_cat); - $post['makepara'] = "yes"; - return $post; - } - # Kategorie Löschen - if(isset($_POST['confirm']) and $_POST['confirm'] == "true" and isset($_POST['del_cat']) and !empty($_POST['del_cat'])) { - $del_cat = CONTENT_DIR_REL.$_POST['del_cat']; - $post['error_messages'] = deleteDir($del_cat); - if(!file_exists($_POST['del_cat'])) { - // Alle Dateien der gelöschten Kategorie aus Downloadstatistik entfernen - deleteCategoryFromDownloadStats($_POST['del_cat']); - $post['messages']['category_message_delete'][] = $_POST['del_cat']; - $post['makepara'] = "yes"; - if($CMS_CONF->get('defaultcat') == $_POST['del_cat']) { - $tmp_array = getDirAsArray(CONTENT_DIR_REL,"dir","none"); - - $CMS_CONF->set('defaultcat',$tmp_array[0]); - $post['messages']['category_message_defaultcat'][] = $tmp_array[0]; - } - # CatPage vom Password ändern - if(is_array($PASSWORDS->properties)) { - foreach($PASSWORDS->properties as $catpage => $pass) { - $pas_cat = explode("/",$catpage); - if($pas_cat[0] == $_POST['del_cat']) { - $PASSWORDS->delete($catpage); - } - } - } - return $post; - } else { - if(!isset($post['error_messages'])) { - $post['error_messages']['category_error_delete'][] = $_POST['del_cat']; - } - $post['makepara'] = "yes"; - return $post; - } - } - return $post; + global $specialchars; + global $CMS_CONF; + global $PASSWORDS; + global $icon_size; + + // Nachfragen wirklich Löschen + if (!isset($_POST ['confirm'])) { + $del_cat = key($post ['action_data'] ['deletecategory']); + $post ['ask'] = askMessages("category_ask_delete", $del_cat, 'action_data[deletecategory]', $post ['action_data'] ['deletecategory'], "del_cat", $del_cat); + $post ['makepara'] = "yes"; + return $post; + } + // Kategorie Löschen + if (isset($_POST ['confirm']) and $_POST ['confirm'] == "true" and isset($_POST ['del_cat']) and !empty($_POST ['del_cat'])) { + $del_cat = CONTENT_DIR_REL . $_POST ['del_cat']; + $post ['error_messages'] = deleteDir($del_cat); + if (!file_exists($_POST ['del_cat'])) { + // Alle Dateien der gelöschten Kategorie aus Downloadstatistik entfernen + deleteCategoryFromDownloadStats($_POST ['del_cat']); + $post ['messages'] ['category_message_delete'] [] = $_POST ['del_cat']; + $post ['makepara'] = "yes"; + if ($CMS_CONF->get('defaultcat') == $_POST ['del_cat']) { + $tmp_array = getDirAsArray(CONTENT_DIR_REL, "dir", "none"); + + $CMS_CONF->set('defaultcat', $tmp_array [0]); + $post ['messages'] ['category_message_defaultcat'] [] = $tmp_array [0]; + } + // CatPage vom Password ändern + if (is_array($PASSWORDS->properties)) { + foreach ($PASSWORDS->properties as $catpage => $pass) { + $pas_cat = explode("/", $catpage); + if ($pas_cat [0] == $_POST ['del_cat']) { + $PASSWORDS->delete($catpage); + } + } + } + return $post; + } else { + if (!isset($post ['error_messages'])) { + $post ['error_messages'] ['category_error_delete'] [] = $_POST ['del_cat']; + } + $post ['makepara'] = "yes"; + return $post; + } + } + return $post; } function page($post) { - global $specialchars; - global $ADMIN_CONF; - global $CMS_CONF; - global $PASSWORDS; - global $icon_size; - - $max_cat_page = 100; - $max_strlen = 255; - $pagecontent = ''; - - - - - if(isset($post['action_data']) and !isset($post['error_messages'])) { - if(key($post['action_data']) == "editsite") { - $post = editSite($post); - if($post['editsite'] == 'yes') { - $pagecontent .= categoriesMessages($post); - $cat = key($post['action_data']['editsite']); - $page = $post['action_data']['editsite'][$cat]; - global $CMS_CONF; - - $page_draft = "?action=draft"; - $link = URL_BASE.substr($cat,3).'/'.substr($page,3,-(strlen(EXT_PAGE))).".html"; - if($CMS_CONF->get("modrewrite") != "true") { - $link = URL_BASE."index.php?cat=".substr($cat,3)."&page=".substr($page,3,-(strlen(EXT_PAGE))); - $page_draft = "&action=draft"; - } - - if(substr($page,-(strlen(EXT_DRAFT))) != EXT_DRAFT) - $page_draft = NULL; - - $pagecontent .= ''.getLanguageValue("page_edit").' → '.$specialchars->rebuildSpecialChars(substr($cat,3), true, true).'/'.$specialchars->rebuildSpecialChars(substr($page,3,-(strlen(EXT_PAGE))), true, true).'

'; - $pagecontent .= $post['content']; - $pagecontent .= ''; - return array(getLanguageValue("page_button"), $pagecontent); - } - } - if(key($post['action_data']) == "deletesite") { - $post = deleteSite($post); - } - if(key($post['action_data']) == "copymovesite") { - $post = copymoveSite($post); - } - } - $pagecontent .= ''; - - if(isset($post['makepara']) and $post['makepara'] == "yes") { - $post['categories'] = makePostCatPageReturnVariable(true); - if(isset($post['categories']['error_messages'])) { - $post['error_messages'] = $post['categories']['error_messages']; - unset($post['categories']['error_messages']); - } - } - - if(isset($post['ask'])) { - $pagecontent .= $post['ask']; - } - - $pagecontent .= categoriesMessages($post); - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= ''.getLanguageValue("page_button").''; - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_page_help = 'help'; - } else { - $tooltip_page_help = 'help'; - } - $pagecontent .= $tooltip_page_help; - $pagecontent .= "

".getLanguageValue("page_text")."

"; - - $pagecontent .= '';# border="0" - $pagecontent .= ''; - - - # Die getLanguageValue() und createTooltipWZ() erzeugen - $array_getLanguageValue = array("pages","position","name","new_name","url_adress","url_new_adress","url_adress_description","page_button_edit","page_move","page_status","page_saveasdraft","page_saveasnormal","page_saveashidden","page_copy","page_button_edit","page_button_delete","page_password","page_password_del","target","toggle_show","toggle_hide"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getLanguageValue as $language) { - ${"text_".$language} = getLanguageValue($language); - } - $title_page_button_edit = getLanguageValue('page_button_edit',true); - $title_page_button_delete = getLanguageValue('page_button_delete',true); - - $array_getTooltipValue = array("help_new_url","help_target_blank","help_target_self","help_target","help_url","page_help_edit","page_help_position","page_help_new_position","page_help_name","page_help_new_name","page_help_move","page_help_editieren","page_help_edit_pages","page_help_delete","page_help_copy","page_help_password","page_help_password_del","page_page_help_show","page_link_help_show"); - - # Variable erzeugen z.B. pages = $tooltip_pages - foreach($array_getTooltipValue as $language) { - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); - } else { - ${"tooltip_".$language} = NULL; - } - } - - foreach ($post['categories'] as $cat => $tmp) { - unset($display_new_cat,$display_new_cat_name); - if(isset($post['display'][$cat]['error_html']['display_cat'])) { - $post['categories'][$cat]['error_html']['display_cat'] = $post['display'][$cat]['error_html']['display_cat']; - } - - $pagecontent .= ''; - $pagecontent .= ''; - } - $pagecontent .= ''; - $pagecontent .= '
'; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '
'; - $pagecontent .= ''.$specialchars->rebuildSpecialChars(substr($cat,3), true, true).''; - $pagescount = 0; - if($pageshandle = opendir(CONTENT_DIR_REL.$cat."/")) { - while (($currentpage = readdir($pageshandle))) { - if(is_file(CONTENT_DIR_REL.$cat."/".$currentpage) and ctype_digit(substr($currentpage,0,2))) - $pagescount++; - } - closedir($pageshandle); - } - $text = '('.$pagescount.' '.$text_pages.')'; - $pagecontent .= ''.$text.' '; - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= '
';# align="right" - if(getRequestParam('javascript', true)) { - - $pagecontent .= ''; - } - $pagecontent .= '
'; - - $pagecontent .= ''; - foreach ($post['categories'][$cat]['position'] as $pos => $tmp) { - if(isset($post['display'][$cat]['error_html']['display'][$pos])) { - $post['categories'][$cat]['error_html']['display'][$pos] = $post['display'][$cat]['error_html']['display'][$pos]; - } - # Neue Inhaltseite oder Link - if(!isset($display_new_cat)) { - $pagecontent .= ''; - $display_new_cat = true; - } - if($pos == $max_cat_page) continue; - # Select Box erstellen - $select_box = ''."\n"; - - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - } # foreach page - $pagecontent .= '
'; - $pagecontent .= ''; - $pagecontent .= '' - .'' - .'' - .'' - .'' - .''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '' - .''; - $pagecontent .= ''; - $pagecontent .= '
'.$text_position.''.$text_name.''.$text_url_adress.' '.$text_url_adress_description.' '.getLanguageValue("blank").''.getLanguageValue("self").'
'; - $pagecontent .= ''.$text_target.'
'; - - $pagecontent .= '
'; - - $pagecontent .= ''; - if(!isset($display_new_cat_name)) { - $pagecontent .= ''; - $display_new_cat_name = true; - } - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - - $pagecontent .= '
'.$text_position.''.$text_name.''.$text_page_status.''.$text_page_move.'  
'; - if($post['categories'][$cat]['ext'][$pos] == EXT_PAGE) { - $text = "(".$text_page_saveasnormal.")"; - } elseif($post['categories'][$cat]['ext'][$pos] == EXT_DRAFT) { - $text = "(".$text_page_saveasdraft.")"; - } elseif($post['categories'][$cat]['ext'][$pos] == EXT_HIDDEN) { - $text = "(".$text_page_saveashidden.")"; - } elseif(isset($post['categories'][$cat]['url'][$pos])) { - $text = "(".$text_target." ".substr($post['categories'][$cat]['target'][$pos],2,-1).")"; - } else { - $text = NULL; - } - $tooltip_url = $tooltip_page_page_help_show; - $page_draft = "&action=draft"; - $url = URL_BASE."index.php?cat=".$cat."&page=".$post['categories'][$cat]['name'][$pos]; - if($CMS_CONF->get("modrewrite") == "true") { - $url = URL_BASE.$cat."/".$post['categories'][$cat]['name'][$pos].".html"; - $page_draft = "?action=draft"; - } - if($post['categories'][$cat]['ext'][$pos] != EXT_DRAFT) - $page_draft = NULL; - if(isset($post['categories'][$cat]['url'][$pos])) { - $url = str_replace("%3A%2F%2F","://",$post['categories'][$cat]['url'][$pos]); - $tooltip_url = $tooltip_page_link_help_show; - } - $pagecontent .= ''.$specialchars->rebuildSpecialChars($post['categories'][$cat]['name'][$pos],true,true).''; - $pagecontent .= ''.$text.''.$select_box.''.$text_page_copy.' '; - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - if(!isset($post['categories'][$cat]['url'][$pos])) { - $pagecontent .= ''; - $pagecontent .= ''; - } else {#'.substr($icon_size,0,2).' - $pagecontent .= ' '; - } - $pagecontent .= '
'; - $pagecontent .= '
'; - - if(isset($post['categories'][$cat]['url'][$pos])) { - $pagecontent .= '' - .''; - $pagecontent .= ''; - $pagecontent .= '' - .'' - .'' - .''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '' - .''; - $pagecontent .= ''; - $pagecontent .= '
'.$text_new_name.''.$text_url_adress.''; - $pagecontent .= ''; - $pagecontent .= ' '.getLanguageValue("blank").''.getLanguageValue("self").'
'.$text_url_new_adress.''.$text_target.'
'; - } else { - $pagecontent .= '' - .''. - '' - .''; - $pagecontent .= '' - .'' - .'' - .''; - $pagecontent .= '
'.$text_new_name.' '.$text_page_password.' 
 '; - if($PASSWORDS->get($cat."/".$post['categories'][$cat]['position'][$pos]."_".$post['categories'][$cat]['name'][$pos])) { - $pagecontent .= ''.$text_page_password_del.' '; - } else { - $pagecontent .= ' '; - } - $pagecontent .= '
'; - } - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= '
'; - $pagecontent .= '
'; - return array(getLanguageValue("page_button"), $pagecontent); + global $specialchars; + global $ADMIN_CONF; + global $CMS_CONF; + global $PASSWORDS; + global $icon_size; + + $max_cat_page = 100; + $max_strlen = 255; + $pagecontent = ''; + + if (isset($post ['action_data']) and !isset($post ['error_messages'])) { + if (key($post ['action_data']) == "editsite") { + $post = editSite($post); + if ($post ['editsite'] == 'yes') { + $pagecontent .= categoriesMessages($post); + $cat = key($post ['action_data'] ['editsite']); + $page = $post ['action_data'] ['editsite'] [$cat]; + global $CMS_CONF; + + $page_draft = "?action=draft"; + $link = URL_BASE . substr($cat, 3) . '/' . substr($page, 3, -(strlen(EXT_PAGE))) . ".html"; + if ($CMS_CONF->get("modrewrite") != "true") { + $link = URL_BASE . "index.php?cat=" . substr($cat, 3) . "&page=" . substr($page, 3, -(strlen(EXT_PAGE))); + $page_draft = "&action=draft"; + } + + if (substr($page, -(strlen(EXT_DRAFT))) != EXT_DRAFT) + $page_draft = NULL; + + $pagecontent .= '' . getLanguageValue("page_edit") . ' → ' . $specialchars->rebuildSpecialChars(substr($cat, 3), true, true) . '/' . $specialchars->rebuildSpecialChars(substr($page, 3, -(strlen(EXT_PAGE))), true, true) . '

'; + $pagecontent .= $post ['content']; + $pagecontent .= ''; + return array( + getLanguageValue("page_button"), + $pagecontent + ); + } + } + if (key($post ['action_data']) == "deletesite") { + $post = deleteSite($post); + } + if (key($post ['action_data']) == "copymovesite") { + $post = copymoveSite($post); + } + } + $pagecontent .= ''; + + if (isset($post ['makepara']) and $post ['makepara'] == "yes") { + $post ['categories'] = makePostCatPageReturnVariable(true); + if (isset($post ['categories'] ['error_messages'])) { + $post ['error_messages'] = $post ['categories'] ['error_messages']; + unset($post ['categories'] ['error_messages']); + } + } + + if (isset($post ['ask'])) { + $pagecontent .= $post ['ask']; + } + + $pagecontent .= categoriesMessages($post); + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '' . getLanguageValue("page_button") . ''; + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_page_help = 'help'; + } else { + $tooltip_page_help = 'help'; + } + $pagecontent .= $tooltip_page_help; + $pagecontent .= "

" . getLanguageValue("page_text") . "

"; + + $pagecontent .= ''; // border="0" + $pagecontent .= ''; + + // Die getLanguageValue() und createTooltipWZ() erzeugen + $array_getLanguageValue = array( + "pages", + "position", + "name", + "new_name", + "url_adress", + "url_new_adress", + "url_adress_description", + "page_button_edit", + "page_move", + "page_status", + "page_saveasdraft", + "page_saveasnormal", + "page_saveashidden", + "page_copy", + "page_button_edit", + "page_button_delete", + "page_password", + "page_password_del", + "target", + "toggle_show", + "toggle_hide" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getLanguageValue as $language) { + ${"text_" . $language} = getLanguageValue($language); + } + $title_page_button_edit = getLanguageValue('page_button_edit', true); + $title_page_button_delete = getLanguageValue('page_button_delete', true); + + $array_getTooltipValue = array( + "help_new_url", + "help_target_blank", + "help_target_self", + "help_target", + "help_url", + "page_help_edit", + "page_help_position", + "page_help_new_position", + "page_help_name", + "page_help_new_name", + "page_help_move", + "page_help_editieren", + "page_help_edit_pages", + "page_help_delete", + "page_help_copy", + "page_help_password", + "page_help_password_del", + "page_page_help_show", + "page_link_help_show" + ); + + // Variable erzeugen z.B. pages = $tooltip_pages + foreach ($array_getTooltipValue as $language) { + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + ${"tooltip_" . $language} = createTooltipWZ("", $language, ",WIDTH,200,CLICKCLOSE,true"); + } else { + ${"tooltip_" . $language} = NULL; + } + } + + foreach ($post ['categories'] as $cat => $tmp) { + unset($display_new_cat, $display_new_cat_name); + if (isset($post ['display'] [$cat] ['error_html'] ['display_cat'])) { + $post ['categories'] [$cat] ['error_html'] ['display_cat'] = $post ['display'] [$cat] ['error_html'] ['display_cat']; + } + + $pagecontent .= ''; + $pagecontent .= ''; + } + $pagecontent .= ''; + $pagecontent .= '
'; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '
'; + $pagecontent .= '' . $specialchars->rebuildSpecialChars(substr($cat, 3), true, true) . ''; + $pagescount = 0; + if ($pageshandle = opendir(CONTENT_DIR_REL . $cat . "/")) { + while (($currentpage = readdir($pageshandle))) { + if (is_file(CONTENT_DIR_REL . $cat . "/" . $currentpage) and ctype_digit(substr($currentpage, 0, 2))) + $pagescount++; + } + closedir($pageshandle); + } + $text = '(' . $pagescount . ' ' . $text_pages . ')'; + $pagecontent .= '' . $text . ' '; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= '
'; // align="right" + if (getRequestParam('javascript', true)) { + + $pagecontent .= ''; + } + $pagecontent .= '
'; + + $pagecontent .= ''; + foreach ($post ['categories'] [$cat] ['position'] as $pos => $tmp) { + if (isset($post ['display'] [$cat] ['error_html'] ['display'] [$pos])) { + $post ['categories'] [$cat] ['error_html'] ['display'] [$pos] = $post ['display'] [$cat] ['error_html'] ['display'] [$pos]; + } + // Neue Inhaltseite oder Link + if (!isset($display_new_cat)) { + $pagecontent .= ''; + $display_new_cat = true; + } + if ($pos == $max_cat_page) + continue; + // Select Box erstellen + $select_box = '' . "\n"; + + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + } // foreach page + $pagecontent .= '
'; + $pagecontent .= ''; + $pagecontent .= '' . '' . '' . '' . '' . ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '' . ''; + $pagecontent .= ''; + $pagecontent .= '
' . $text_position . '' . $text_name . '' . $text_url_adress . ' ' . $text_url_adress_description . ' ' . getLanguageValue("blank") . '' . getLanguageValue("self") . '
'; + $pagecontent .= '' . $text_target . '
'; + + $pagecontent .= '
'; + + $pagecontent .= ''; + if (!isset($display_new_cat_name)) { + $pagecontent .= ''; + $display_new_cat_name = true; + } + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + + $pagecontent .= '
' . $text_position . '' . $text_name . '' . $text_page_status . '' . $text_page_move . '  
'; + if ($post ['categories'] [$cat] ['ext'] [$pos] == EXT_PAGE) { + $text = "(" . $text_page_saveasnormal . ")"; + } elseif ($post ['categories'] [$cat] ['ext'] [$pos] == EXT_DRAFT) { + $text = "(" . $text_page_saveasdraft . ")"; + } elseif ($post ['categories'] [$cat] ['ext'] [$pos] == EXT_HIDDEN) { + $text = "(" . $text_page_saveashidden . ")"; + } elseif (isset($post ['categories'] [$cat] ['url'] [$pos])) { + $text = "(" . $text_target . " " . substr($post ['categories'] [$cat] ['target'] [$pos], 2, -1) . ")"; + } else { + $text = NULL; + } + $tooltip_url = $tooltip_page_page_help_show; + $page_draft = "&action=draft"; + $url = URL_BASE . "index.php?cat=" . $cat . "&page=" . $post ['categories'] [$cat] ['name'] [$pos]; + if ($CMS_CONF->get("modrewrite") == "true") { + $url = URL_BASE . $cat . "/" . $post ['categories'] [$cat] ['name'] [$pos] . ".html"; + $page_draft = "?action=draft"; + } + if ($post ['categories'] [$cat] ['ext'] [$pos] != EXT_DRAFT) + $page_draft = NULL; + if (isset($post ['categories'] [$cat] ['url'] [$pos])) { + $url = str_replace("%3A%2F%2F", "://", $post ['categories'] [$cat] ['url'] [$pos]); + $tooltip_url = $tooltip_page_link_help_show; + } + $pagecontent .= '' . $specialchars->rebuildSpecialChars($post ['categories'] [$cat] ['name'] [$pos], true, true) . ''; + $pagecontent .= '' . $text . '' . $select_box . '' . $text_page_copy . ' '; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + if (!isset($post ['categories'] [$cat] ['url'] [$pos])) { + $pagecontent .= ''; + $pagecontent .= ''; + } else { // '.substr($icon_size,0,2).' + $pagecontent .= ' '; + } + $pagecontent .= '
'; + $pagecontent .= '
'; + + if (isset($post ['categories'] [$cat] ['url'] [$pos])) { + $pagecontent .= '' . ''; + $pagecontent .= ''; + $pagecontent .= '' . '' . '' . ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '' . ''; + $pagecontent .= ''; + $pagecontent .= '
' . $text_new_name . '' . $text_url_adress . ''; + $pagecontent .= ''; + $pagecontent .= ' ' . getLanguageValue("blank") . '' . getLanguageValue("self") . '
' . $text_url_new_adress . '' . $text_target . '
'; + } else { + $pagecontent .= '' . '' . '' . ''; + $pagecontent .= '' . '' . '' . ''; + $pagecontent .= '
' . $text_new_name . ' ' . $text_page_password . ' 
 '; + if ($PASSWORDS->get($cat . "/" . $post ['categories'] [$cat] ['position'] [$pos] . "_" . $post ['categories'] [$cat] ['name'] [$pos])) { + $pagecontent .= '' . $text_page_password_del . ' '; + } else { + $pagecontent .= ' '; + } + $pagecontent .= '
'; + } + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= '
'; + $pagecontent .= '
'; + return array( + getLanguageValue("page_button"), + $pagecontent + ); } - function editSite($post) { - global $specialchars; - - $cat = key($post['action_data']['editsite']); - $page = $post['action_data']['editsite'][$cat]; - - $post['editsite'] = 'yes'; - $content = "editsite"; - if(isset($_POST['save']) or isset($_POST['savetemp'])) { - $new_ext = $_POST['saveas']; - $new_page = substr($post['action_data']['editsite'][$cat],0,-(strlen(EXT_PAGE))).$new_ext; - if($new_page != $post['action_data']['editsite'][$cat]) { - @rename(CONTENT_DIR_REL.$cat."/".$page,CONTENT_DIR_REL.$cat."/".$new_page); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_file(CONTENT_DIR_REL.$cat."/".$new_page)) { - $post['error_messages']['page_message_rename'][] = $page." > ".$new_page; - } else { - # ext hat sich geändert - $page = $new_page; - } - } - $error = saveContentToPage($_POST['pagecontent'],CONTENT_DIR_REL.$cat."/".$page); - if(is_array($error)) { - if(isset($post['error_messages'])) { - $post['error_messages'] = array_merge_recursive($post['error_messages'],$error); - } else { - $post['error_messages'] = $error; - } - $content = $_POST['pagecontent']; - } - - $edit_next_page = false; - if(isset($_POST['save']) and !isset($post['error_messages']) - and isset($_POST['edit_next_page']) and !empty($_POST['edit_next_page'])) { - if(is_file(CONTENT_DIR_REL.$_POST['edit_next_page'])) { - $cat_page = explode("/",$_POST['edit_next_page']); - $cat = $cat_page[0]; - $page = $cat_page[1]; - $content = 'editsite'; - unset($post['action_data']['editsite']); - $post['action_data']['editsite'][$cat_page[0]] = $cat_page[1]; - $edit_next_page = true; - } - } - - if(!isset($post['error_messages'])) - $post['messages']['page_message_edit'][] = NULL; - if(isset($_POST['savetemp']) or isset($post['error_messages']) or $edit_next_page) { - $post['content'] = showEditPageForm($cat, $page,$content); - } else { - $post['editsite'] = 'no'; - } - } elseif(isset($_POST['cancel'])) { - $post['editsite'] = 'no'; - } else { - $post['content'] = showEditPageForm($cat, $page,$content); - } - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['makepara'] = "yes"; - return $post; + global $specialchars; + + $cat = key($post ['action_data'] ['editsite']); + $page = $post ['action_data'] ['editsite'] [$cat]; + + $post ['editsite'] = 'yes'; + $content = "editsite"; + if (isset($_POST ['save']) or isset($_POST ['savetemp'])) { + $new_ext = $_POST ['saveas']; + $new_page = substr($post ['action_data'] ['editsite'] [$cat], 0, -(strlen(EXT_PAGE))) . $new_ext; + if ($new_page != $post ['action_data'] ['editsite'] [$cat]) { + @rename(CONTENT_DIR_REL . $cat . "/" . $page, CONTENT_DIR_REL . $cat . "/" . $new_page); + $line_error = __LINE__ - 1; + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_file(CONTENT_DIR_REL . $cat . "/" . $new_page)) { + $post ['error_messages'] ['page_message_rename'] [] = $page . " > " . $new_page; + } else { + // ext hat sich geändert + $page = $new_page; + } + } + $error = saveContentToPage($_POST ['pagecontent'], CONTENT_DIR_REL . $cat . "/" . $page); + if (is_array($error)) { + if (isset($post ['error_messages'])) { + $post ['error_messages'] = array_merge_recursive($post ['error_messages'], $error); + } else { + $post ['error_messages'] = $error; + } + $content = $_POST ['pagecontent']; + } + + $edit_next_page = false; + if (isset($_POST ['save']) and !isset($post ['error_messages']) and isset($_POST ['edit_next_page']) and !empty($_POST ['edit_next_page'])) { + if (is_file(CONTENT_DIR_REL . $_POST ['edit_next_page'])) { + $cat_page = explode("/", $_POST ['edit_next_page']); + $cat = $cat_page [0]; + $page = $cat_page [1]; + $content = 'editsite'; + unset($post ['action_data'] ['editsite']); + $post ['action_data'] ['editsite'] [$cat_page [0]] = $cat_page [1]; + $edit_next_page = true; + } + } + + if (!isset($post ['error_messages'])) + $post ['messages'] ['page_message_edit'] [] = NULL; + if (isset($_POST ['savetemp']) or isset($post ['error_messages']) or $edit_next_page) { + $post ['content'] = showEditPageForm($cat, $page, $content); + } else { + $post ['editsite'] = 'no'; + } + } elseif (isset($_POST ['cancel'])) { + $post ['editsite'] = 'no'; + } else { + $post ['content'] = showEditPageForm($cat, $page, $content); + } + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['makepara'] = "yes"; + return $post; } function copymoveSite($post) { - global $specialchars; - global $PASSWORDS; - $max_cat_page = 100; - - require_once(BASE_DIR_ADMIN."Crypt.php"); - $pwcrypt = new Crypt(); - # wenn Verschoben wird unset die Position der Inhaltseite aus anderer Kategorie - # damit bei position_move() die Positionen frei sind - if(isset($post['move_copy'])) { - foreach($post['move_copy']['source']['position'] as $position => $tmp) { - if(!isset($post['move_copy']['source']['copy'][$position])) { - unset($post['categories'][$post['move_copy']['source']['cat'][$position]]['position'][$position]); - unset($post['categories'][$post['move_copy']['source']['cat'][$position]]['new_position'][$position]); - } - } - } - # Alle Kategorien durch gehen - foreach($post['categories'] as $cat => $tmp) { - # Kategorien die keine Inhaltseiten haben und auch keine neue = continue -# kommentiert weil Inhaltseite in Lehre copy move nach cat nicht ging -// if(count($post['categories'][$cat]['position']) <= 1 and empty($post['categories'][$cat]['new_position'][$max_cat_page])) { -// continue; -// } - - # rename bauen wenn die position sich nicht geändert hat aber was anderes - foreach($post['categories'][$cat]['position'] as $pos => $tmp) { - # Neue Inhaltseite nicht hier - if($pos == $max_cat_page) { - continue; - } - # Inhaltseiten Paswort Schutz sachen - $tmp_page = $post['categories'][$cat]['position'][$pos]."_".$post['categories'][$cat]['name'][$pos]; - if($PASSWORDS->get($cat."/".$tmp_page) - and !empty($post['categories'][$cat]['password_del'][$pos])) - { - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['messages']['page_message_del_password'][] = $tmp_page; - $PASSWORDS->delete($cat."/".$tmp_page); - } - if(!$PASSWORDS->get($cat."/".$tmp_page) - and !empty($post['categories'][$cat]['password'][$pos]) - and empty($post['categories'][$cat]['password_del'][$pos])) - { - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['display'][$cat]['error_html']['display'][$pos] = 'style="display:block;" '; - $post['messages']['page_message_new_password'][] = $tmp_page; - $PASSWORDS->set($cat."/".$tmp_page,$pwcrypt->encrypt($post['categories'][$cat]['password'][$pos])); - $post['categories'][$cat]['password'][$pos] = NULL; - } elseif($PASSWORDS->get($cat."/".$tmp_page) != $pwcrypt->encrypt($post['categories'][$cat]['password'][$pos]) - and !empty($post['categories'][$cat]['password'][$pos]) - and empty($post['categories'][$cat]['password_del'][$pos])) - { - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['display'][$cat]['error_html']['display'][$pos] = 'style="display:block;" '; - $post['messages']['page_message_change_password'][] = $tmp_page; - $PASSWORDS->set($cat."/".$tmp_page,$pwcrypt->encrypt($post['categories'][$cat]['password'][$pos])); - $post['categories'][$cat]['password'][$pos] = NULL; - } - # Neue Position nicht hier - if($post['categories'][$cat]['position'][$pos] != $post['categories'][$cat]['new_position'][$pos]) { - continue; - } - # Die Inhaltseite wird Kopiert also kein Rename hier - if(isset($post['categories'][$cat]['copy'][$pos])) { - continue; - } - # Nur wenn new_name oder new_url oder new_target - if(isset($post['categories'][$cat]['url'][$pos])) { - if(empty($post['categories'][$cat]['new_name'][$pos]) and empty($post['categories'][$cat]['new_url'][$pos]) and empty($post['categories'][$cat]['new_target'][$pos])) { - continue; - } - } elseif(empty($post['categories'][$cat]['new_name'][$pos])) { - continue; - } - $name = $post['categories'][$cat]['name'][$pos]; - if(!empty($post['categories'][$cat]['new_name'][$pos])) { - $name = $post['categories'][$cat]['new_name'][$pos]; - } - # Wenns kein Link ist - if(!isset($post['categories'][$cat]['url'][$pos])) { - $rename_newname[$cat][$pos] = $post['categories'][$cat]['new_position'][$pos].'_'.$name.$post['categories'][$cat]['ext'][$pos]; - $rename_orgname[$cat][$pos] = $post['categories'][$cat]['position'][$pos].'_'.$post['categories'][$cat]['name'][$pos].$post['categories'][$cat]['ext'][$pos]; - } else { - # Wenns ein Link ist - $url = $post['categories'][$cat]['url'][$pos]; - if(!empty($post['categories'][$cat]['new_url'][$pos])) { - $url = $post['categories'][$cat]['new_url'][$pos]; - } - $target = $post['categories'][$cat]['target'][$pos]; - if(!empty($post['categories'][$cat]['new_target'][$pos])) { - $target = $post['categories'][$cat]['new_target'][$pos]; - } - $rename_newname[$cat][$pos] = $post['categories'][$cat]['new_position'][$pos].'_'.$name.$target.$url.$post['categories'][$cat]['ext'][$pos]; - $rename_orgname[$cat][$pos] = $post['categories'][$cat]['position'][$pos].'_'.$post['categories'][$cat]['name'][$pos].$post['categories'][$cat]['target'][$pos].$post['categories'][$cat]['url'][$pos].$post['categories'][$cat]['ext'][$pos]; - } - } - - # Neue Inhaltseite - $new_move_cat_page = false; - if(!empty($post['categories'][$cat]['new_position'][$max_cat_page])) { - $new_move_cat_page[] = $post['categories'][$cat]['new_position'][$max_cat_page]; - } - # Die Copy Move sachen ins Arrey einsetzen (Inhaltseiten die aus andere Kategorie kommen) - if(isset($post['move_copy']) and in_array($cat,$post['move_copy']['desti']['cat'])) { - $z = 0; - foreach($post['move_copy']['desti']['new_position'] as $position => $new_position) { - $new_move_cat_page[] = $new_position; - if(isset($post['move_copy']['source']['copy'][$position])) { - $move_copy_newname[$z]['copy'] = $post['move_copy']['source']['copy'][$position]; - } - $move_copy_newname[$z]['name'] = $post['move_copy']['desti']['name'][$position].$post['move_copy']['desti']['ext'][$position]; - - $move_copy_newname[$z]['position'] = $new_position; - $move_copy_newname[$z]['org_name'] = $post['move_copy']['source']['cat'][$position]."/".$post['move_copy']['source']['position'][$position]."_".$post['move_copy']['source']['name'][$position].$post['move_copy']['desti']['ext'][$position]; - $z++; - - } - } - # jetzt alle position_move sachen machen (Neue Inhaltseite, copy_move und Positions wechsel) - $array_return = position_move($post['categories'][$cat]['position'],$post['categories'][$cat]['new_position'],$new_move_cat_page); - - # hier die Inhatseiten aus anderer Kategorie fürs copy unlink bauen - if(isset($move_copy_newname)) { - foreach($move_copy_newname as $z => $tmp) { - # wenn die Position von position_move() geändert wurde - $new_position = $move_copy_newname[$z]['position']; - if(isset($array_return['move_cat_page_newposition'][$move_copy_newname[$z]['position']])) { - $new_position = $array_return['move_cat_page_newposition'][$move_copy_newname[$z]['position']]; - } - if(!isset($move_copy_newname[$z]['copy'])) { - $move_move[$cat][$z] = true; - } - $move_orgname[$cat][$z] = $move_copy_newname[$z]['org_name']; - $move_newname[$cat][$z] = $cat."/".$new_position."_".$move_copy_newname[$z]['name']; - } - unset($move_copy_newname); - } - - # die neuen Positionen einsetzen - if($array_return['move'] !== false) { - foreach($array_return['move'] as $pos => $new_position) { - # Die Inhaltseite wird Kopiert also kein Rename hier - if(isset($post['categories'][$cat]['copy'][$pos])) { - continue; - } - $name = $post['categories'][$cat]['name'][$pos]; - if(!empty($post['categories'][$cat]['new_name'][$pos])) { - $name = $post['categories'][$cat]['new_name'][$pos]; - } - # Wenns kein Link ist - if(!isset($post['categories'][$cat]['url'][$pos])) { - $rename_newname[$cat][$pos] = $new_position.'_'.$name.$post['categories'][$cat]['ext'][$pos]; - $rename_orgname[$cat][$pos] = $post['categories'][$cat]['position'][$pos].'_'.$post['categories'][$cat]['name'][$pos].$post['categories'][$cat]['ext'][$pos]; - } else { - # Wenns ein Link ist - $url = $post['categories'][$cat]['url'][$pos]; - if(!empty($post['categories'][$cat]['new_url'][$pos])) { - $url = $post['categories'][$cat]['new_url'][$pos]; - } - $target = $post['categories'][$cat]['target'][$pos]; - if(!empty($post['categories'][$cat]['new_target'][$pos])) { - $target = $post['categories'][$cat]['new_target'][$pos]; - } - $rename_newname[$cat][$pos] = $new_position.'_'.$name.$target.$url.$post['categories'][$cat]['ext'][$pos]; - $rename_orgname[$cat][$pos] = $post['categories'][$cat]['position'][$pos].'_'.$post['categories'][$cat]['name'][$pos].$post['categories'][$cat]['target'][$pos].$post['categories'][$cat]['url'][$pos].$post['categories'][$cat]['ext'][$pos]; - } - } - } - # die neue Inhaltseite - if(!empty($post['categories'][$cat]['new_position'][$max_cat_page])) { - $new_position = $post['categories'][$cat]['new_position'][$max_cat_page]; - $new_page[$cat] = $new_position."_".$post['categories'][$cat]['new_name'][$max_cat_page].EXT_DRAFT; - if(!empty($post['categories'][$cat]['new_url'][$max_cat_page])) { - $new_page[$cat] = $new_position."_".$post['categories'][$cat]['new_name'][$max_cat_page].$post['categories'][$cat]['new_target'][$max_cat_page].$post['categories'][$cat]['new_url'][$max_cat_page].EXT_LINK; - } - } - } - # Rename - if(isset($rename_newname)) { - foreach($rename_newname as $cat => $tmp) { - $array = $rename_newname[$cat]; - $notaus = 0; - end($array); - $last_key = key($array); - reset($array); - $count_merker = count($array); - while(list($z,$tmp) = each($array) and $notaus != "300") { - if(!is_file(CONTENT_DIR_REL.$cat."/".$rename_newname[$cat][$z])) { -#echo "rename = ".CONTENT_DIR_REL.$cat."/".$rename_newname[$cat][$z]."
\n"; -# foreach($rename_newname[$cat] as $z => $tmp) { - @rename(CONTENT_DIR_REL.$cat."/".$rename_orgname[$cat][$z],CONTENT_DIR_REL.$cat."/".$rename_newname[$cat][$z]); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - if(substr($rename_orgname[$cat][$z],3) != substr($rename_newname[$cat][$z],3)) { - $post['display'][$cat]['error_html']['display'][sprintf("%1d",substr($rename_orgname[$cat][$z],0,2))] = 'style="display:block;" '; # letzte cat ausklappen - } - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; # letzte cat ausklappen - $post['makepara'] = "no"; # kein makePostCatPageReturnVariable() - } elseif(!is_file(CONTENT_DIR_REL.$cat."/".$rename_newname[$cat][$z])) { - $post['error_messages']['page_error_rename'][] = $cat."/".$rename_orgname[$cat][$z]." > ".$cat."/".$rename_newname[$cat][$z]; - if(substr($rename_orgname[$cat][$z],3) != substr($rename_newname[$cat][$z],3)) { - $post['display'][$cat]['error_html']['display'][sprintf("%1d",substr($rename_orgname[$cat][$z],0,2))] = 'style="display:block;" '; # letzte cat ausklappen - } - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; # letzte cat ausklappen - $post['makepara'] = "no"; # kein makePostCatPageReturnVariable() - # Alles gut - } else { - if($PASSWORDS->get($cat."/".substr($rename_orgname[$cat][$z],0,-(strlen(EXT_LINK))))) { - $tmp_pas = $PASSWORDS->get($cat."/".substr($rename_orgname[$cat][$z],0,-(strlen(EXT_LINK)))); - $PASSWORDS->delete($cat."/".substr($rename_orgname[$cat][$z],0,-(strlen(EXT_LINK)))); - $PASSWORDS->set($cat."/".substr($rename_newname[$cat][$z],0,-(strlen(EXT_LINK))),$tmp_pas); - } - $post['messages']['page_message_rename'][] = $cat."/".$rename_orgname[$cat][$z]." > ".$cat."/".$rename_newname[$cat][$z]; - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; # letzte cat ausklappen - $post['makepara'] = "yes"; # makePostCatPageReturnVariable() - # nur wenn name != neu_name also die Position wird nicht berücksichtigt - if(substr($rename_orgname[$cat][$z],3) != substr($rename_newname[$cat][$z],3)) { - $error_message['updateReferences'] = updateReferencesInAllContentPages($cat, $rename_orgname[$cat][$z], "", $rename_newname[$cat][$z]); - if(is_array($error_message['updateReferences'])) { - $post['makepara'] = "yes"; - if(isset($post['error_messages']) and is_array($post['error_messages'])) { - $post['error_messages'] = array_merge_recursive($post['error_messages'],$error_message); - } else { - $post['error_messages'] = $error_message; - } - } - } - } - - unset($array[$z]); - } - if($last_key == $z and count($array) != $count_merker) { - end($array); - $last_key = key($array); - reset($array); - $count_merker = count($array); - } - $notaus++; - } #end - } - } - # Copy Move - if(isset($move_newname)) { - foreach($move_newname as $cat => $tmp) { - foreach($move_newname[$cat] as $z => $tmp) { - # Einfach mal Kopieren - @copy(CONTENT_DIR_REL.$move_orgname[$cat][$z],CONTENT_DIR_REL.$move_newname[$cat][$z]); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - $error = true; - } elseif(!is_file(CONTENT_DIR_REL.$move_newname[$cat][$z])) { - $post['error_messages']['page_error_copy'][] = $move_orgname[$cat][$z]." > ".$move_newname[$cat][$z]; - $error = true; - } - # wenn Verschoben werden soll und copy erfolgreich war - if(isset($move_move[$cat][$z]) and is_file(CONTENT_DIR_REL.$move_newname[$cat][$z])) { - @unlink(CONTENT_DIR_REL.$move_orgname[$cat][$z]); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - $error = true; - } elseif(is_file(CONTENT_DIR_REL.$move_orgname[$cat][$z])) { - $post['error_messages']['page_error_delete'][] = $move_orgname[$cat][$z]." > ".$move_newname[$cat][$z]; - $error = true; - } else { - # Weil Verschoben - $error_message['updateReferences'] = updateReferencesInAllContentPages(dirname($move_orgname[$cat][$z]), basename($move_orgname[$cat][$z]), $cat, basename($move_newname[$cat][$z])); - if(is_array($error_message['updateReferences'])) { - $post['makepara'] = "yes"; - if(isset($post['error_messages']) and is_array($post['error_messages'])) { - $post['error_messages'] = array_merge_recursive($post['error_messages'],$error_message); - } else { - $post['error_messages'] = $error_message; - } - } - } - } - # Fehler meldung - if(isset($error)) { - $post['makepara'] = "yes"; # kein makePostCatPageReturnVariable() - $post['display'][dirname($move_orgname[$cat][$z])]['error_html']['display_cat'] = 'style="display:block;" '; - unset($error); - } else { - if($PASSWORDS->get(substr($move_orgname[$cat][$z],0,-(strlen(EXT_LINK))))) { - $tmp_pas = $PASSWORDS->get(substr($move_orgname[$cat][$z],0,-(strlen(EXT_LINK)))); - $PASSWORDS->delete(substr($move_orgname[$cat][$z],0,-(strlen(EXT_LINK)))); - $PASSWORDS->set(substr($move_newname[$cat][$z],0,-(strlen(EXT_LINK))),$tmp_pas); - } - # Erfogs meldungen - $post['messages']['page_message_copy_move'][] = $move_orgname[$cat][$z]." > ".$move_newname[$cat][$z]; - $post['display'][dirname($move_orgname[$cat][$z])]['error_html']['display_cat'] = 'style="display:block;" '; - $post['makepara'] = "yes"; # makePostCatPageReturnVariable() - } - } #end - } - } - # Neue Inhaltseite - if(isset($new_page)) { - foreach($new_page as $cat => $tmp) { - $page_inhalt = "Das ist ein Link";#EXT_LINK EXT_PAGE - if(substr($new_page[$cat],-4) == EXT_DRAFT) { - $page_inhalt = "[ueber1|".str_replace(array("[","]"),array("^[","^]"),$specialchars->rebuildSpecialChars(substr($new_page[$cat], 3,strlen($new_page[$cat])-7), false, false))."]"; - } - $error = saveContentToPage($page_inhalt,CONTENT_DIR_REL.$cat."/".$new_page[$cat]); - # Fehler beim anlegen also return - if(is_array($error)) { - if(isset($post['error_messages'])) { - $post['error_messages'] = array_merge_recursive($post['error_messages'], $error); - } else { - $post['error_messages'] = $error; - } - } else { - if(empty($post['categories'][$cat]['new_url'][$max_cat_page])) { - # Editieren der Neuen Inhaltseite und hier Fertig weiter gehts nach dem Speichern mit editSite() - $post['messages']['page_message_new'][] = $cat."/".$new_page[$cat]; - $post['editsite'] = 'no'; - } else { - $post['messages']['message_link'][] = $cat."/".$new_page[$cat]; - } - } - unset($error); - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; # letzte cat ausklappen - } - $post['makepara'] = "yes"; # kein makePostCatPageReturnVariable() - $post['editsite'] = 'no'; - } - - return $post; + global $specialchars; + global $PASSWORDS; + $max_cat_page = 100; + + require_once (BASE_DIR_ADMIN . "Crypt.php"); + $pwcrypt = new Crypt(); + // wenn Verschoben wird unset die Position der Inhaltseite aus anderer Kategorie + // damit bei position_move() die Positionen frei sind + if (isset($post ['move_copy'])) { + foreach ($post ['move_copy'] ['source'] ['position'] as $position => $tmp) { + if (!isset($post ['move_copy'] ['source'] ['copy'] [$position])) { + unset($post ['categories'] [$post ['move_copy'] ['source'] ['cat'] [$position]] ['position'] [$position]); + unset($post ['categories'] [$post ['move_copy'] ['source'] ['cat'] [$position]] ['new_position'] [$position]); + } + } + } + // Alle Kategorien durch gehen + foreach ($post ['categories'] as $cat => $tmp) { + // Kategorien die keine Inhaltseiten haben und auch keine neue = continue + // kommentiert weil Inhaltseite in Lehre copy move nach cat nicht ging + // if(count($post['categories'][$cat]['position']) <= 1 and empty($post['categories'][$cat]['new_position'][$max_cat_page])) { + // continue; + // } + + // rename bauen wenn die position sich nicht geändert hat aber was anderes + foreach ($post ['categories'] [$cat] ['position'] as $pos => $tmp) { + // Neue Inhaltseite nicht hier + if ($pos == $max_cat_page) { + continue; + } + // Inhaltseiten Paswort Schutz sachen + $tmp_page = $post ['categories'] [$cat] ['position'] [$pos] . "_" . $post ['categories'] [$cat] ['name'] [$pos]; + if ($PASSWORDS->get($cat . "/" . $tmp_page) and !empty($post ['categories'] [$cat] ['password_del'] [$pos])) { + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['messages'] ['page_message_del_password'] [] = $tmp_page; + $PASSWORDS->delete($cat . "/" . $tmp_page); + } + if (!$PASSWORDS->get($cat . "/" . $tmp_page) and !empty($post ['categories'] [$cat] ['password'] [$pos]) and empty($post ['categories'] [$cat] ['password_del'] [$pos])) { + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['display'] [$cat] ['error_html'] ['display'] [$pos] = 'style="display:block;" '; + $post ['messages'] ['page_message_new_password'] [] = $tmp_page; + $PASSWORDS->set($cat . "/" . $tmp_page, $pwcrypt->encrypt($post ['categories'] [$cat] ['password'] [$pos])); + $post ['categories'] [$cat] ['password'] [$pos] = NULL; + } elseif ($PASSWORDS->get($cat . "/" . $tmp_page) != $pwcrypt->encrypt($post ['categories'] [$cat] ['password'] [$pos]) and !empty($post ['categories'] [$cat] ['password'] [$pos]) and empty($post ['categories'] [$cat] ['password_del'] [$pos])) { + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['display'] [$cat] ['error_html'] ['display'] [$pos] = 'style="display:block;" '; + $post ['messages'] ['page_message_change_password'] [] = $tmp_page; + $PASSWORDS->set($cat . "/" . $tmp_page, $pwcrypt->encrypt($post ['categories'] [$cat] ['password'] [$pos])); + $post ['categories'] [$cat] ['password'] [$pos] = NULL; + } + // Neue Position nicht hier + if ($post ['categories'] [$cat] ['position'] [$pos] != $post ['categories'] [$cat] ['new_position'] [$pos]) { + continue; + } + // Die Inhaltseite wird Kopiert also kein Rename hier + if (isset($post ['categories'] [$cat] ['copy'] [$pos])) { + continue; + } + // Nur wenn new_name oder new_url oder new_target + if (isset($post ['categories'] [$cat] ['url'] [$pos])) { + if (empty($post ['categories'] [$cat] ['new_name'] [$pos]) and empty($post ['categories'] [$cat] ['new_url'] [$pos]) and empty($post ['categories'] [$cat] ['new_target'] [$pos])) { + continue; + } + } elseif (empty($post ['categories'] [$cat] ['new_name'] [$pos])) { + continue; + } + $name = $post ['categories'] [$cat] ['name'] [$pos]; + if (!empty($post ['categories'] [$cat] ['new_name'] [$pos])) { + $name = $post ['categories'] [$cat] ['new_name'] [$pos]; + } + // Wenns kein Link ist + if (!isset($post ['categories'] [$cat] ['url'] [$pos])) { + $rename_newname [$cat] [$pos] = $post ['categories'] [$cat] ['new_position'] [$pos] . '_' . $name . $post ['categories'] [$cat] ['ext'] [$pos]; + $rename_orgname [$cat] [$pos] = $post ['categories'] [$cat] ['position'] [$pos] . '_' . $post ['categories'] [$cat] ['name'] [$pos] . $post ['categories'] [$cat] ['ext'] [$pos]; + } else { + // Wenns ein Link ist + $url = $post ['categories'] [$cat] ['url'] [$pos]; + if (!empty($post ['categories'] [$cat] ['new_url'] [$pos])) { + $url = $post ['categories'] [$cat] ['new_url'] [$pos]; + } + $target = $post ['categories'] [$cat] ['target'] [$pos]; + if (!empty($post ['categories'] [$cat] ['new_target'] [$pos])) { + $target = $post ['categories'] [$cat] ['new_target'] [$pos]; + } + $rename_newname [$cat] [$pos] = $post ['categories'] [$cat] ['new_position'] [$pos] . '_' . $name . $target . $url . $post ['categories'] [$cat] ['ext'] [$pos]; + $rename_orgname [$cat] [$pos] = $post ['categories'] [$cat] ['position'] [$pos] . '_' . $post ['categories'] [$cat] ['name'] [$pos] . $post ['categories'] [$cat] ['target'] [$pos] . $post ['categories'] [$cat] ['url'] [$pos] . $post ['categories'] [$cat] ['ext'] [$pos]; + } + } + + // Neue Inhaltseite + $new_move_cat_page = array(); + if (!empty($post ['categories'] [$cat] ['new_position'] [$max_cat_page])) { + $new_move_cat_page [] = $post ['categories'] [$cat] ['new_position'] [$max_cat_page]; + } + // Die Copy Move sachen ins Arrey einsetzen (Inhaltseiten die aus andere Kategorie kommen) + if (isset($post ['move_copy']) and in_array($cat, $post ['move_copy'] ['desti'] ['cat'])) { + $z = 0; + foreach ($post ['move_copy'] ['desti'] ['new_position'] as $position => $new_position) { + $new_move_cat_page [] = $new_position; + if (isset($post ['move_copy'] ['source'] ['copy'] [$position])) { + $move_copy_newname [$z] ['copy'] = $post ['move_copy'] ['source'] ['copy'] [$position]; + } + $move_copy_newname [$z] ['name'] = $post ['move_copy'] ['desti'] ['name'] [$position] . $post ['move_copy'] ['desti'] ['ext'] [$position]; + + $move_copy_newname [$z] ['position'] = $new_position; + $move_copy_newname [$z] ['org_name'] = $post ['move_copy'] ['source'] ['cat'] [$position] . "/" . $post ['move_copy'] ['source'] ['position'] [$position] . "_" . $post ['move_copy'] ['source'] ['name'] [$position] . $post ['move_copy'] ['desti'] ['ext'] [$position]; + $z++; + } + } + // jetzt alle position_move sachen machen (Neue Inhaltseite, copy_move und Positions wechsel) + $array_return = position_move($post ['categories'] [$cat] ['position'], $post ['categories'] [$cat] ['new_position'], $new_move_cat_page); + + // hier die Inhatseiten aus anderer Kategorie fürs copy unlink bauen + if (isset($move_copy_newname)) { + foreach ($move_copy_newname as $z => $tmp) { + // wenn die Position von position_move() geändert wurde + $new_position = $move_copy_newname [$z] ['position']; + if (isset($array_return ['move_cat_page_newposition'] [$move_copy_newname [$z] ['position']])) { + $new_position = $array_return ['move_cat_page_newposition'] [$move_copy_newname [$z] ['position']]; + } + if (!isset($move_copy_newname [$z] ['copy'])) { + $move_move [$cat] [$z] = true; + } + $move_orgname [$cat] [$z] = $move_copy_newname [$z] ['org_name']; + $move_newname [$cat] [$z] = $cat . "/" . $new_position . "_" . $move_copy_newname [$z] ['name']; + } + unset($move_copy_newname); + } + + // die neuen Positionen einsetzen + if ($array_return ['move'] !== false) { + foreach ($array_return ['move'] as $pos => $new_position) { + // Die Inhaltseite wird Kopiert also kein Rename hier + if (isset($post ['categories'] [$cat] ['copy'] [$pos])) { + continue; + } + $name = $post ['categories'] [$cat] ['name'] [$pos]; + if (!empty($post ['categories'] [$cat] ['new_name'] [$pos])) { + $name = $post ['categories'] [$cat] ['new_name'] [$pos]; + } + // Wenns kein Link ist + if (!isset($post ['categories'] [$cat] ['url'] [$pos])) { + $rename_newname [$cat] [$pos] = $new_position . '_' . $name . $post ['categories'] [$cat] ['ext'] [$pos]; + $rename_orgname [$cat] [$pos] = $post ['categories'] [$cat] ['position'] [$pos] . '_' . $post ['categories'] [$cat] ['name'] [$pos] . $post ['categories'] [$cat] ['ext'] [$pos]; + } else { + // Wenns ein Link ist + $url = $post ['categories'] [$cat] ['url'] [$pos]; + if (!empty($post ['categories'] [$cat] ['new_url'] [$pos])) { + $url = $post ['categories'] [$cat] ['new_url'] [$pos]; + } + $target = $post ['categories'] [$cat] ['target'] [$pos]; + if (!empty($post ['categories'] [$cat] ['new_target'] [$pos])) { + $target = $post ['categories'] [$cat] ['new_target'] [$pos]; + } + $rename_newname [$cat] [$pos] = $new_position . '_' . $name . $target . $url . $post ['categories'] [$cat] ['ext'] [$pos]; + $rename_orgname [$cat] [$pos] = $post ['categories'] [$cat] ['position'] [$pos] . '_' . $post ['categories'] [$cat] ['name'] [$pos] . $post ['categories'] [$cat] ['target'] [$pos] . $post ['categories'] [$cat] ['url'] [$pos] . $post ['categories'] [$cat] ['ext'] [$pos]; + } + } + } + // die neue Inhaltseite + if (!empty($post ['categories'] [$cat] ['new_position'] [$max_cat_page])) { + $new_position = $post ['categories'] [$cat] ['new_position'] [$max_cat_page]; + $new_page [$cat] = $new_position . "_" . $post ['categories'] [$cat] ['new_name'] [$max_cat_page] . EXT_DRAFT; + if (!empty($post ['categories'] [$cat] ['new_url'] [$max_cat_page])) { + $new_page [$cat] = $new_position . "_" . $post ['categories'] [$cat] ['new_name'] [$max_cat_page] . $post ['categories'] [$cat] ['new_target'] [$max_cat_page] . $post ['categories'] [$cat] ['new_url'] [$max_cat_page] . EXT_LINK; + } + } + } + // Rename + if (isset($rename_newname)) { + foreach ($rename_newname as $cat => $tmp) { + $array = $rename_newname [$cat]; + $notaus = 0; + end($array); + $last_key = key($array); + reset($array); + $count_merker = count($array); + // while (list ($z, $tmp) = each($array) and $notaus != "300") { + foreach ($array as $z => $tmp) { + if ($notaus == 300) { + break; + } + if (!is_file(CONTENT_DIR_REL . $cat . "/" . $rename_newname [$cat] [$z])) { + // echo "rename = ".CONTENT_DIR_REL.$cat."/".$rename_newname[$cat][$z]."
\n"; + // foreach($rename_newname[$cat] as $z => $tmp) { + @rename(CONTENT_DIR_REL . $cat . "/" . $rename_orgname [$cat] [$z], CONTENT_DIR_REL . $cat . "/" . $rename_newname [$cat] [$z]); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + if (substr($rename_orgname [$cat] [$z], 3) != substr($rename_newname [$cat] [$z], 3)) { + $post ['display'] [$cat] ['error_html'] ['display'] [sprintf("%1d", substr($rename_orgname [$cat] [$z], 0, 2))] = 'style="display:block;" '; // letzte cat ausklappen + } + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; // letzte cat ausklappen + $post ['makepara'] = "no"; // kein makePostCatPageReturnVariable() + } elseif (!is_file(CONTENT_DIR_REL . $cat . "/" . $rename_newname [$cat] [$z])) { + $post ['error_messages'] ['page_error_rename'] [] = $cat . "/" . $rename_orgname [$cat] [$z] . " > " . $cat . "/" . $rename_newname [$cat] [$z]; + if (substr($rename_orgname [$cat] [$z], 3) != substr($rename_newname [$cat] [$z], 3)) { + $post ['display'] [$cat] ['error_html'] ['display'] [sprintf("%1d", substr($rename_orgname [$cat] [$z], 0, 2))] = 'style="display:block;" '; // letzte cat ausklappen + } + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; // letzte cat ausklappen + $post ['makepara'] = "no"; // kein makePostCatPageReturnVariable() + // Alles gut + } else { + if ($PASSWORDS->get($cat . "/" . substr($rename_orgname [$cat] [$z], 0, -(strlen(EXT_LINK))))) { + $tmp_pas = $PASSWORDS->get($cat . "/" . substr($rename_orgname [$cat] [$z], 0, -(strlen(EXT_LINK)))); + $PASSWORDS->delete($cat . "/" . substr($rename_orgname [$cat] [$z], 0, -(strlen(EXT_LINK)))); + $PASSWORDS->set($cat . "/" . substr($rename_newname [$cat] [$z], 0, -(strlen(EXT_LINK))), $tmp_pas); + } + $post ['messages'] ['page_message_rename'] [] = $cat . "/" . $rename_orgname [$cat] [$z] . " > " . $cat . "/" . $rename_newname [$cat] [$z]; + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; // letzte cat ausklappen + $post ['makepara'] = "yes"; // makePostCatPageReturnVariable() + // nur wenn name != neu_name also die Position wird nicht berücksichtigt + if (substr($rename_orgname [$cat] [$z], 3) != substr($rename_newname [$cat] [$z], 3)) { + $error_message ['updateReferences'] = updateReferencesInAllContentPages($cat, $rename_orgname [$cat] [$z], "", $rename_newname [$cat] [$z]); + if (is_array($error_message ['updateReferences'])) { + $post ['makepara'] = "yes"; + if (isset($post ['error_messages']) and is_array($post ['error_messages'])) { + $post ['error_messages'] = array_merge_recursive($post ['error_messages'], $error_message); + } else { + $post ['error_messages'] = $error_message; + } + } + } + } + + unset($array [$z]); + } + if ($last_key == $z and count($array) != $count_merker) { + end($array); + $last_key = key($array); + reset($array); + $count_merker = count($array); + } + $notaus++; + } // end + } + } + // Copy Move + if (isset($move_newname)) { + foreach ($move_newname as $cat => $tmp) { + foreach ($move_newname [$cat] as $z => $tmp) { + // Einfach mal Kopieren + @copy(CONTENT_DIR_REL . $move_orgname [$cat] [$z], CONTENT_DIR_REL . $move_newname [$cat] [$z]); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + $error = true; + } elseif (!is_file(CONTENT_DIR_REL . $move_newname [$cat] [$z])) { + $post ['error_messages'] ['page_error_copy'] [] = $move_orgname [$cat] [$z] . " > " . $move_newname [$cat] [$z]; + $error = true; + } + // wenn Verschoben werden soll und copy erfolgreich war + if (isset($move_move [$cat] [$z]) and is_file(CONTENT_DIR_REL . $move_newname [$cat] [$z])) { + @unlink(CONTENT_DIR_REL . $move_orgname [$cat] [$z]); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + $error = true; + } elseif (is_file(CONTENT_DIR_REL . $move_orgname [$cat] [$z])) { + $post ['error_messages'] ['page_error_delete'] [] = $move_orgname [$cat] [$z] . " > " . $move_newname [$cat] [$z]; + $error = true; + } else { + // Weil Verschoben + $error_message ['updateReferences'] = updateReferencesInAllContentPages(dirname($move_orgname [$cat] [$z]), basename($move_orgname [$cat] [$z]), $cat, basename($move_newname [$cat] [$z])); + if (is_array($error_message ['updateReferences'])) { + $post ['makepara'] = "yes"; + if (isset($post ['error_messages']) and is_array($post ['error_messages'])) { + $post ['error_messages'] = array_merge_recursive($post ['error_messages'], $error_message); + } else { + $post ['error_messages'] = $error_message; + } + } + } + } + // Fehler meldung + if (isset($error)) { + $post ['makepara'] = "yes"; // kein makePostCatPageReturnVariable() + $post ['display'] [dirname($move_orgname [$cat] [$z])] ['error_html'] ['display_cat'] = 'style="display:block;" '; + unset($error); + } else { + if ($PASSWORDS->get(substr($move_orgname [$cat] [$z], 0, -(strlen(EXT_LINK))))) { + $tmp_pas = $PASSWORDS->get(substr($move_orgname [$cat] [$z], 0, -(strlen(EXT_LINK)))); + $PASSWORDS->delete(substr($move_orgname [$cat] [$z], 0, -(strlen(EXT_LINK)))); + $PASSWORDS->set(substr($move_newname [$cat] [$z], 0, -(strlen(EXT_LINK))), $tmp_pas); + } + // Erfogs meldungen + $post ['messages'] ['page_message_copy_move'] [] = $move_orgname [$cat] [$z] . " > " . $move_newname [$cat] [$z]; + $post ['display'] [dirname($move_orgname [$cat] [$z])] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['makepara'] = "yes"; // makePostCatPageReturnVariable() + } + } // end + } + } + // Neue Inhaltseite + if (isset($new_page)) { + foreach ($new_page as $cat => $tmp) { + $page_inhalt = "Das ist ein Link"; // EXT_LINK EXT_PAGE + if (substr($new_page [$cat], -4) == EXT_DRAFT) { + $page_inhalt = "[ueber1|" . str_replace(array( + "[", + "]" + ), array( + "^[", + "^]" + ), $specialchars->rebuildSpecialChars(substr($new_page [$cat], 3, strlen($new_page [$cat]) - 7), false, false)) . "]"; + } + $error = saveContentToPage($page_inhalt, CONTENT_DIR_REL . $cat . "/" . $new_page [$cat]); + // Fehler beim anlegen also return + if (is_array($error)) { + if (isset($post ['error_messages'])) { + $post ['error_messages'] = array_merge_recursive($post ['error_messages'], $error); + } else { + $post ['error_messages'] = $error; + } + } else { + if (empty($post ['categories'] [$cat] ['new_url'] [$max_cat_page])) { + // Editieren der Neuen Inhaltseite und hier Fertig weiter gehts nach dem Speichern mit editSite() + $post ['messages'] ['page_message_new'] [] = $cat . "/" . $new_page [$cat]; + $post ['editsite'] = 'no'; + } else { + $post ['messages'] ['message_link'] [] = $cat . "/" . $new_page [$cat]; + } + } + unset($error); + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; // letzte cat ausklappen + } + $post ['makepara'] = "yes"; // kein makePostCatPageReturnVariable() + $post ['editsite'] = 'no'; + } + + return $post; } - function deleteSite($post) { - global $specialchars; - global $PASSWORDS; - global $icon_size; - - $cat = key($post['action_data']['deletesite']); - $del_page = $cat."/".$post['action_data']['deletesite'][$cat]; - # Nachfragen wirklich Löschen - if(!isset($_POST['confirm'])) { - $post['ask'] = askMessages("page_ask_delete",$post['action_data']['deletesite'][$cat],'action_data[deletesite]['.$cat.']',$post['action_data']['deletesite'][$cat]); - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['makepara'] = "yes"; - return $post; - } - # Seite Löschen - if(isset($_POST['confirm'])) { - if($_POST['confirm'] == "true") { - @unlink(CONTENT_DIR_REL.$del_page); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(file_exists(CONTENT_DIR_REL.$del_page)) { - $post['error_messages']['page_error_delete'][] = $del_cat; - $post['makepara'] = "yes"; # makePostCatPageReturnVariable() - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - return $post; - } else { - $post['messages']['page_message_delete'][] = $post['action_data']['deletesite'][$cat]; - $post['makepara'] = "yes"; # makePostCatPageReturnVariable() - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - if($PASSWORDS->get(substr($del_page,0,-(strlen(EXT_LINK))))) { - $PASSWORDS->delete(substr($del_page,0,-(strlen(EXT_LINK)))); - } - return $post; - } - } else { - $post['display'][$cat]['error_html']['display_cat'] = 'style="display:block;" '; - $post['makepara'] = "yes"; # makePostCatPageReturnVariable() - return $post; - } - } + global $specialchars; + global $PASSWORDS; + global $icon_size; + + $cat = key($post ['action_data'] ['deletesite']); + $del_page = $cat . "/" . $post ['action_data'] ['deletesite'] [$cat]; + // Nachfragen wirklich Löschen + if (!isset($_POST ['confirm'])) { + $post ['ask'] = askMessages("page_ask_delete", $post ['action_data'] ['deletesite'] [$cat], 'action_data[deletesite][' . $cat . ']', $post ['action_data'] ['deletesite'] [$cat]); + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['makepara'] = "yes"; + return $post; + } + // Seite Löschen + if (isset($_POST ['confirm'])) { + if ($_POST ['confirm'] == "true") { + @unlink(CONTENT_DIR_REL . $del_page); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error = null; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error === null) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (file_exists(CONTENT_DIR_REL . $del_page)) { + $post ['error_messages'] ['page_error_delete'] [] = $del_cat; + $post ['makepara'] = "yes"; // makePostCatPageReturnVariable() + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + return $post; + } else { + $post ['messages'] ['page_message_delete'] [] = $post ['action_data'] ['deletesite'] [$cat]; + $post ['makepara'] = "yes"; // makePostCatPageReturnVariable() + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + if ($PASSWORDS->get(substr($del_page, 0, -(strlen(EXT_LINK))))) { + $PASSWORDS->delete(substr($del_page, 0, -(strlen(EXT_LINK)))); + } + return $post; + } + } else { + $post ['display'] [$cat] ['error_html'] ['display_cat'] = 'style="display:block;" '; + $post ['makepara'] = "yes"; // makePostCatPageReturnVariable() + return $post; + } + } } function gallery($post) { - global $ADMIN_CONF; - global $specialchars; - global $GALLERY_CONF; - global $icon_size; - - $max_strlen = 255; - - $pagecontent = ''; - - $gallery = makeDefaultConf("gallery"); - - if(isset($_POST['gallery']) and is_array($_POST['gallery'])) { - $post['gallery'] = $_POST['gallery']; - } - - # error colors mit null fühlen - foreach($gallery as $type => $type_array) { - if($type == 'expert') continue; - foreach($gallery[$type] as $syntax_name => $dumy) { - $post['gallery']['error_html'][$syntax_name] = NULL; - } - } - - if(isset($post['action_data']) and !isset($post['error_messages'])) { - $action_data_key = key($post['action_data']); - if($action_data_key == "deletegalleryimg") { - $post = deleteGalleryImg($post); - } - if($action_data_key == "deletegallery") { - $post = deleteGallery($post); - } - $post = editGallery($post); - } - if(isset($_FILES)) { - $post = newGalleryImg($post); - } - if(isset($_POST['new_gallery']) and strlen($_POST['new_gallery']) > 0) { - $post = newGallery($post); - } - - $dircontent = getDirAsArray(GALLERIES_DIR_REL,"dir","sort"); - # Galerien array bilden mit den dazugehörigen Bilder - # wenn die Galerie oder die Bilder mit FTP Hochgeladen wurden Automatisch umbennen - foreach ($dircontent as $pos => $currentgalerien) { - $test_galerie = $specialchars->replaceSpecialChars($specialchars->rebuildSpecialChars($currentgalerien, false, false),false); - if(!file_exists(GALLERIES_DIR_REL.$currentgalerien."/texte.conf")) { - touch(GALLERIES_DIR_REL.$currentgalerien."/texte.conf"); - $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/texte.conf"); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - } - } - if($test_galerie != $currentgalerien) { - if(in_array($test_galerie,$dircontent)) { - $post['error_messages']['gallery_error_ftp_rename_exist'][] = $test_galerie; - # die Galerie aus dem array nehmen der fehler muss mit ftp behoben werden - unset($dircontent[$pos]); - continue; - } else { - @rename(GALLERIES_DIR_REL.$currentgalerien,GALLERIES_DIR_REL.$test_galerie); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - # die Galerie aus dem array nehmen der fehler muss mit ftp behoben werden - unset($dircontent[$pos]); - continue; - } elseif(!is_dir(GALLERIES_DIR_REL.$test_galerie)) { - $post['error_messages']['gallery_error_ftp_rename'][] = $test_galerie; - # die Galerie aus dem array nehmen der fehler muss mit ftp behoben werden - unset($dircontent[$pos]); - continue; - } else { - $post['messages']['gallery_message_ftp_rename'][] = $test_galerie; - $currentgalerien = $test_galerie; - $dircontent[$pos] = $test_galerie; - } - } - } -/* - $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - }*/ - - if(!is_dir(GALLERIES_DIR_REL.$currentgalerien.'/'.PREVIEW_DIR_NAME)) { - @mkdir(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_dir(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME)) { - $post['error_messages']['gallery_error_new_preview'][] = $currentgalerien; - } else { - $post['messages']['gallery_message_ftp_preview'][] = $test_galerie; - } - } -/* - if(is_dir(GALLERIES_DIR_REL.$currentgalerien.'/'.PREVIEW_DIR_NAME)) { - $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - } - }*/ - $gallerypics[$currentgalerien] = getDirAsArray(GALLERIES_DIR_REL.$currentgalerien,"file","none"); - $count_preview_pic = 0; - foreach($gallerypics[$currentgalerien] as $pos => $file) { - # nur Bilder zulassen - if(is_dir($file) or count(@getimagesize(GALLERIES_DIR_REL.$currentgalerien.'/'.$file)) < 2) { - unset($gallerypics[$currentgalerien][$pos]); - continue; - } -/* - $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/".$file); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - }*/ - if(is_file(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$file)) { -/* - $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$file); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - }*/ - $count_preview_pic++; - } - $test_pic = $specialchars->replaceSpecialChars($specialchars->rebuildSpecialChars($file, false, false),false); - if($test_pic != $file) { - if(in_array($test_pic,$gallerypics[$currentgalerien])) { - $post['error_messages']['gallery_error_ftp_rename_pic_exist'][] = $currentgalerien." - ".$test_pic; - # das Bild aus dem array nehmen der fehler muss mit ftp behoben werden - unset($gallerypics[$currentgalerien][$pos]); - } else { - @rename(GALLERIES_DIR_REL.$currentgalerien."/".$file,GALLERIES_DIR_REL.$currentgalerien."/".$test_pic); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - # das Bild aus dem array nehmen der fehler muss mit ftp behoben werden - unset($gallerypics[$currentgalerien][$pos]); - } elseif(!is_file(GALLERIES_DIR_REL.$currentgalerien."/".$test_pic)) { - $post['error_messages']['gallery_error_ftp_rename_pic'][] = $currentgalerien." - ".$test_pic; - # das Bild aus dem array nehmen der fehler muss mit ftp behoben werden - unset($gallerypics[$currentgalerien][$pos]); - } else { - if(is_file(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$file)) { - @rename(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$file,GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$test_pic); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_file(GALLERIES_DIR_REL.$currentgalerien."/".$test_pic)) { - $post['error_messages']['gallery_error_ftp_rename_pic'][] = PREVIEW_DIR_NAME."/".$currentgalerien." - ".$test_pic; - } - } - # if($GALLERY_CONF->get("usethumbs") == "true" and !is_file(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$test_pic)) { - if(!is_file(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$test_pic)) { - require_once(BASE_DIR_CMS."Image.php"); - scaleImage($test_pic, GALLERIES_DIR_REL.$currentgalerien.'/', GALLERIES_DIR_REL.$currentgalerien.'/'.PREVIEW_DIR_NAME.'/', $GALLERY_CONF->get('maxthumbwidth'), $GALLERY_CONF->get('maxthumbheight')); - if(is_file(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$test_pic)) { - $post['messages']['gallery_message_ftp_make_thumb'][] = $currentgalerien." - ".$test_pic; - $count_preview_pic++; - } - } - $post['messages']['gallery_message_ftp_rename_pic'][] = $currentgalerien." - ".$test_pic; - $gallerypics[$currentgalerien][$pos] = $test_pic; - } - } - } - } - # hinweis wenn nicht alle vorschau bilder existieren - # if($GALLERY_CONF->get("usethumbs") == "true" and count($gallerypics[$currentgalerien]) != $count_preview_pic) { - if(count($gallerypics[$currentgalerien]) != $count_preview_pic) { - $post['error_messages']['gallery_error_ftp_preview_pic'][] = $currentgalerien; - } - sort($gallerypics[$currentgalerien]); - } - - if($ADMIN_CONF->get('showexpert') == "false") { - foreach($gallery['expert'] as $syntax_name) { - $post['gallery']['setings'][$syntax_name] = $GALLERY_CONF->get($syntax_name); - } - } - - $pagecontent .= categoriesMessages($post); - - if(isset($post['ask'])) { - $pagecontent .= $post['ask']; - } - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_gallery_help = 'help'; - } else { - $tooltip_gallery_help = 'help'; - } - - $pagecontent .= ''.getLanguageValue("gallery_button").''; - $pagecontent .= $tooltip_gallery_help; - $pagecontent .= "

".getLanguageValue("gallery_text")."

"; - - $array_getLanguageValue = array("gallery_scale","gallery_scale_thumbs", "gallery_create_thumbs", - "gallery_scaleimages","gallery_rebuildthumbs","gallery_size","gallery_subtitle","gallery_button_cut","gallery_newname", - "gallery_button_img_delete","gallery_button_gallery_delete","target","toggle_show","toggle_hide","gallery_no_preview"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getLanguageValue as $language) { - ${"text_".$language} = getLanguageValue($language); - } - - $array_getTooltipValue = array("help_target_blank","help_target_self","help_target","gallery_help_scale","gallery_help_scale_thumbs","gallery_help_input_scale", - "gallery_help_create_thumbs","gallery_help_all_picture_scale","gallery_help_all_thumbs_new","gallery_help_size","gallery_help_picture","gallery_help_subtitle","gallery_help_name", - "gallery_help_del","gallery_help_target","gallery_help_conf","gallery_help_edit","gallery_help_newname","gallery_help_usedfgallery","gallery_help_overwrite"); - - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getTooltipValue as $language) { - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); - } else { - ${"tooltip_".$language} = NULL; - } - } - - if(!isset($post['gallery']['error_html']['display_setings'])) { - $post['gallery']['error_html']['display_setings'] = NULL; - } - - $pagecontent .= ''; - $overwrite = NULL; - $pagecontent .= ''; - $pagecontent .= ''; - # setings end - - $pagecontent .= ''; - $toggle_pos = 0; - - foreach ($dircontent as $pos => $currentgalerien) { - if(!isset($post['gallery']['error_html']['newname'][$currentgalerien])) { - $post['gallery']['error_html']['newname'][$currentgalerien] = NULL; - } - if(!isset($post['gallery']['error_html']['display'][$currentgalerien])) { - $post['gallery']['error_html']['display'][$currentgalerien] = NULL; - } - - $pagecontent .= ''; - $pagecontent .= '
'; - $pagecontent .= ''; - - $pagecontent .= ''; - - $pagecontent .= '
'; - $pagecontent .= '   '.getLanguageValue("files_button_overwrite").''; - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= '
'; - # setings start - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - - if($ADMIN_CONF->get('showexpert') == "true") { -## $pagecontent .= ''; -## $pagecontent .= ''; -## $pagecontent .= ''; - - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - } - - $pagecontent .= ''; - $pagecontent .= '
'.$text_gallery_scale.' x  '.getLanguageValue("pixels").'
'.$text_gallery_create_thumbs.''.buildCheckBox("gallery[setings][createthumbs]", $GALLERY_CONF->get("createthumbs")).'
'.$text_gallery_scale_thumbs.' x  '.getLanguageValue("pixels").'
'; - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - # Neue Gallery - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '
'.getLanguageValue("gallery_new").' 
 
'; - $pagecontent .= '
'; - $pagecontent .= ''; - - $pagecontent .= ''; - $pagecontent .= '
'.$specialchars->rebuildSpecialChars($currentgalerien, true, true).''; - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= '
'; - # gallery setup - $pagecontent .= ''; - -# $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - - - - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; + $toggle_pos++; + } + + $pagecontent .= ''; + + $pagecontent .= '
   '.$text_gallery_scaleimages.''; - $pagecontent .= '
   '.$text_gallery_rebuildthumbs.''; - $pagecontent .= '
'; - $pagecontent .= ''.$text_gallery_newname.''; - $pagecontent .= ''.getLanguageValue("gallery_newimage").'
'; - $pagecontent .= ' -
+ global $ADMIN_CONF; + global $specialchars; + global $GALLERY_CONF; + global $icon_size; + + $max_strlen = 255; + + $pagecontent = ''; + + $gallery = makeDefaultConf("gallery"); + + if (isset($_POST ['gallery']) and is_array($_POST ['gallery'])) { + $post ['gallery'] = $_POST ['gallery']; + } + + // error colors mit null fühlen + foreach ($gallery as $type => $type_array) { + if ($type == 'expert') + continue; + foreach ($gallery [$type] as $syntax_name => $dumy) { + $post ['gallery'] ['error_html'] [$syntax_name] = NULL; + } + } + + if (isset($post ['action_data']) and !isset($post ['error_messages'])) { + $action_data_key = key($post ['action_data']); + if ($action_data_key == "deletegalleryimg") { + $post = deleteGalleryImg($post); + } + if ($action_data_key == "deletegallery") { + $post = deleteGallery($post); + } + $post = editGallery($post); + } + if (isset($_FILES)) { + $post = newGalleryImg($post); + } + if (isset($_POST ['new_gallery']) and strlen($_POST ['new_gallery']) > 0) { + $post = newGallery($post); + } + + $dircontent = getDirAsArray(GALLERIES_DIR_REL, "dir", "sort"); + // Galerien array bilden mit den dazugehörigen Bilder + // wenn die Galerie oder die Bilder mit FTP Hochgeladen wurden Automatisch umbennen + foreach ($dircontent as $pos => $currentgalerien) { + $test_galerie = $specialchars->replaceSpecialChars($specialchars->rebuildSpecialChars($currentgalerien, false, false), false); + if (!file_exists(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf")) { + touch(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf"); + $error = changeChmod(GALLERIES_DIR_REL . $currentgalerien . "/texte.conf"); + if (is_array($error)) { + $post ['error_messages'] [key($error)] [] = $error [key($error)]; + } + } + if ($test_galerie != $currentgalerien) { + if (in_array($test_galerie, $dircontent)) { + $post ['error_messages'] ['gallery_error_ftp_rename_exist'] [] = $test_galerie; + // die Galerie aus dem array nehmen der fehler muss mit ftp behoben werden + unset($dircontent [$pos]); + continue; + } else { + @rename(GALLERIES_DIR_REL . $currentgalerien, GALLERIES_DIR_REL . $test_galerie); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + // die Galerie aus dem array nehmen der fehler muss mit ftp behoben werden + unset($dircontent [$pos]); + continue; + } elseif (!is_dir(GALLERIES_DIR_REL . $test_galerie)) { + $post ['error_messages'] ['gallery_error_ftp_rename'] [] = $test_galerie; + // die Galerie aus dem array nehmen der fehler muss mit ftp behoben werden + unset($dircontent [$pos]); + continue; + } else { + $post ['messages'] ['gallery_message_ftp_rename'] [] = $test_galerie; + $currentgalerien = $test_galerie; + $dircontent [$pos] = $test_galerie; + } + } + } + /* + * $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien); + * if(is_array($error)) { + * $post['error_messages'][key($error)][] = $error[key($error)]; + * } + */ + + if (!is_dir(GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME)) { + @mkdir(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME)) { + $post ['error_messages'] ['gallery_error_new_preview'] [] = $currentgalerien; + } else { + $post ['messages'] ['gallery_message_ftp_preview'] [] = $test_galerie; + } + } + /* + * if(is_dir(GALLERIES_DIR_REL.$currentgalerien.'/'.PREVIEW_DIR_NAME)) { + * $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME); + * if(is_array($error)) { + * $post['error_messages'][key($error)][] = $error[key($error)]; + * } + * } + */ + $gallerypics [$currentgalerien] = getDirAsArray(GALLERIES_DIR_REL . $currentgalerien, "file", "none"); + $count_preview_pic = 0; + foreach ($gallerypics [$currentgalerien] as $pos => $file) { + // nur Bilder zulassen + $imgSizeData = @getimagesize(GALLERIES_DIR_REL . $currentgalerien . '/' . $file); + $isImage = $imgSizeData !== false; + if (is_dir($file) or !$isImage) { + unset($gallerypics [$currentgalerien] [$pos]); + continue; + } + /* + * $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/".$file); + * if(is_array($error)) { + * $post['error_messages'][key($error)][] = $error[key($error)]; + * } + */ + if (is_file(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME . "/" . $file)) { + /* + * $error = changeChmod(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$file); + * if(is_array($error)) { + * $post['error_messages'][key($error)][] = $error[key($error)]; + * } + */ + $count_preview_pic++; + } + $test_pic = $specialchars->replaceSpecialChars($specialchars->rebuildSpecialChars($file, false, false), false); + if ($test_pic != $file) { + if (in_array($test_pic, $gallerypics [$currentgalerien])) { + $post ['error_messages'] ['gallery_error_ftp_rename_pic_exist'] [] = $currentgalerien . " - " . $test_pic; + // das Bild aus dem array nehmen der fehler muss mit ftp behoben werden + unset($gallerypics [$currentgalerien] [$pos]); + } else { + @rename(GALLERIES_DIR_REL . $currentgalerien . "/" . $file, GALLERIES_DIR_REL . $currentgalerien . "/" . $test_pic); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + // das Bild aus dem array nehmen der fehler muss mit ftp behoben werden + unset($gallerypics [$currentgalerien] [$pos]); + } elseif (!is_file(GALLERIES_DIR_REL . $currentgalerien . "/" . $test_pic)) { + $post ['error_messages'] ['gallery_error_ftp_rename_pic'] [] = $currentgalerien . " - " . $test_pic; + // das Bild aus dem array nehmen der fehler muss mit ftp behoben werden + unset($gallerypics [$currentgalerien] [$pos]); + } else { + if (is_file(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME . "/" . $file)) { + @rename(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME . "/" . $file, GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME . "/" . $test_pic); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_file(GALLERIES_DIR_REL . $currentgalerien . "/" . $test_pic)) { + $post ['error_messages'] ['gallery_error_ftp_rename_pic'] [] = PREVIEW_DIR_NAME . "/" . $currentgalerien . " - " . $test_pic; + } + } + // if($GALLERY_CONF->get("usethumbs") == "true" and !is_file(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$test_pic)) { + if (!is_file(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME . "/" . $test_pic)) { + require_once (BASE_DIR_CMS . "Image.php"); + scaleImage($test_pic, GALLERIES_DIR_REL . $currentgalerien . '/', GALLERIES_DIR_REL . $currentgalerien . '/' . PREVIEW_DIR_NAME . '/', $GALLERY_CONF->get('maxthumbwidth'), $GALLERY_CONF->get('maxthumbheight')); + if (is_file(GALLERIES_DIR_REL . $currentgalerien . "/" . PREVIEW_DIR_NAME . "/" . $test_pic)) { + $post ['messages'] ['gallery_message_ftp_make_thumb'] [] = $currentgalerien . " - " . $test_pic; + $count_preview_pic++; + } + } + $post ['messages'] ['gallery_message_ftp_rename_pic'] [] = $currentgalerien . " - " . $test_pic; + $gallerypics [$currentgalerien] [$pos] = $test_pic; + } + } + } + } + // hinweis wenn nicht alle vorschau bilder existieren + // if($GALLERY_CONF->get("usethumbs") == "true" and count($gallerypics[$currentgalerien]) != $count_preview_pic) { + if (count($gallerypics [$currentgalerien]) != $count_preview_pic) { + $post ['error_messages'] ['gallery_error_ftp_preview_pic'] [] = $currentgalerien; + } + sort($gallerypics [$currentgalerien]); + } + + if ($ADMIN_CONF->get('showexpert') == "false") { + foreach ($gallery ['expert'] as $syntax_name) { + $post ['gallery'] ['setings'] [$syntax_name] = $GALLERY_CONF->get($syntax_name); + } + } + + $pagecontent .= categoriesMessages($post); + + if (isset($post ['ask'])) { + $pagecontent .= $post ['ask']; + } + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_gallery_help = 'help'; + } else { + $tooltip_gallery_help = 'help'; + } + + $pagecontent .= '' . getLanguageValue("gallery_button") . ''; + $pagecontent .= $tooltip_gallery_help; + $pagecontent .= "

" . getLanguageValue("gallery_text") . "

"; + + $array_getLanguageValue = array( + "gallery_scale", + "gallery_scale_thumbs", + "gallery_create_thumbs", + "gallery_scaleimages", + "gallery_rebuildthumbs", + "gallery_size", + "gallery_subtitle", + "gallery_button_cut", + "gallery_newname", + "gallery_button_img_delete", + "gallery_button_gallery_delete", + "target", + "toggle_show", + "toggle_hide", + "gallery_no_preview" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getLanguageValue as $language) { + ${"text_" . $language} = getLanguageValue($language); + } + + $array_getTooltipValue = array( + "help_target_blank", + "help_target_self", + "help_target", + "gallery_help_scale", + "gallery_help_scale_thumbs", + "gallery_help_input_scale", + "gallery_help_create_thumbs", + "gallery_help_all_picture_scale", + "gallery_help_all_thumbs_new", + "gallery_help_size", + "gallery_help_picture", + "gallery_help_subtitle", + "gallery_help_name", + "gallery_help_del", + "gallery_help_target", + "gallery_help_conf", + "gallery_help_edit", + "gallery_help_newname", + "gallery_help_usedfgallery", + "gallery_help_overwrite" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getTooltipValue as $language) { + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + ${"tooltip_" . $language} = createTooltipWZ("", $language, ",WIDTH,200,CLICKCLOSE,true"); + } else { + ${"tooltip_" . $language} = NULL; + } + } + + if (!isset($post ['gallery'] ['error_html'] ['display_setings'])) { + $post ['gallery'] ['error_html'] ['display_setings'] = NULL; + } + + $pagecontent .= ''; + $overwrite = NULL; + $pagecontent .= ''; + $pagecontent .= ''; + // setings end + + $pagecontent .= ''; + $toggle_pos = 0; + + foreach ($dircontent as $pos => $currentgalerien) { + if (!isset($post ['gallery'] ['error_html'] ['newname'] [$currentgalerien])) { + $post ['gallery'] ['error_html'] ['newname'] [$currentgalerien] = NULL; + } + if (!isset($post ['gallery'] ['error_html'] ['display'] [$currentgalerien])) { + $post ['gallery'] ['error_html'] ['display'] [$currentgalerien] = NULL; + } + + $pagecontent .= ''; + $pagecontent .= '"; + if ($pos == $max_cols_check) { + $pagecontent .= ""; + if (count($gallerypics [$currentgalerien]) > $max_cols_check) { + $max_cols_check = $pos + $max_cols; + $new_tr = true; + } + } + } + // wenn die spalten nicht $max_cols sind dann den rest noch erstellen + if ($pos != $max_cols_check) { + for($rest = $pos + 1; $rest <= $max_cols_check; $rest++) { // '.$rest.' + $pagecontent .= ''; + } + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= ''; + + $pagecontent .= ''; + + $pagecontent .= '
'; + $pagecontent .= '   ' . getLanguageValue("files_button_overwrite") . ''; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= '
'; + // setings start + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + + if ($ADMIN_CONF->get('showexpert') == "true") { + // # $pagecontent .= ''; + // # $pagecontent .= ''; + // # $pagecontent .= ''; + + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + } + + $pagecontent .= ''; + $pagecontent .= '
' . $text_gallery_scale . ' x  ' . getLanguageValue("pixels") . '
'.$text_gallery_create_thumbs.''.buildCheckBox("gallery[setings][createthumbs]", $GALLERY_CONF->get("createthumbs")).'
' . $text_gallery_scale_thumbs . ' x  ' . getLanguageValue("pixels") . '
'; + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + // Neue Gallery + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '
' . getLanguageValue("gallery_new") . ' 
 
'; + $pagecontent .= '
'; + $pagecontent .= ''; + + $pagecontent .= ''; + $pagecontent .= '
' . $specialchars->rebuildSpecialChars($currentgalerien, true, true) . ''; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= '
'; + // gallery setup + $pagecontent .= ''; + + // $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; - $pagecontent .= '
   ' . $text_gallery_scaleimages . ''; + $pagecontent .= '
   ' . $text_gallery_rebuildthumbs . ''; + $pagecontent .= '
'; + $pagecontent .= '' . $text_gallery_newname . ''; + $pagecontent .= '' . getLanguageValue("gallery_newimage") . '
'; + $pagecontent .= ' +
'; - $pagecontent .= '
'; - # inhalt gallery - $pagecontent .= ''; - $subtitle = new Properties(GALLERIES_DIR_REL.$currentgalerien."/texte.conf",true); - $max_cols = 3; - $max_cols_check = $max_cols; - $td_width = round(100 / $max_cols).'%'; - $pagecontent .= ""; - $new_tr = false; - foreach ($gallerypics[$currentgalerien] as $pos => $file) { - # ausgleich weil pos mit 0 anfängt - $pos = $pos + 1; - $lastsavedanchor = "";#$lastsavedanchor = " id=\"lastsavedimage\""; - $size = getimagesize(GALLERIES_DIR_REL.$currentgalerien."/".$file); - // Vorschaubild anzeigen, wenn vorhanden; sonst Text - if (file_exists(GALLERIES_DIR_REL.$currentgalerien."/".PREVIEW_DIR_NAME."/".$file)) { - $preview = '' - .''.$specialchars->rebuildSpecialChars($file, true, true).''; - } else { - $preview = '
'.$text_gallery_no_preview.'
'; - } - if($new_tr === true) { - $pagecontent .= ""; - $new_tr = false; - }# - $pagecontent .= ''; - $toggle_pos++; - } - - $pagecontent .= ''; - - $pagecontent .= '
'; - $pagecontent .= ''; - $pagecontent .= '
'; - return array(getLanguageValue("gallery_button"), $pagecontent); + $pagecontent .= "
 
'; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= ''; + $pagecontent .= '
'; + return array( + getLanguageValue("gallery_button"), + $pagecontent + ); } - function newGalleryImg($post) { - global $specialchars; - global $GALLERY_CONF; - - $forceoverwrite = ""; - if (isset($_POST['overwrite'])) { - $forceoverwrite = $_POST['overwrite']; - } - - foreach($_FILES as $array_name => $tmp) { - if($_FILES[$array_name]['error'] == 0) { - $gallery = explode("_",$array_name); - unset($gallery[0]); - unset($gallery[count($gallery)]); - $gallery_tmp = NULL; - foreach($gallery as $tmp) { - $gallery_tmp .= $tmp."_"; - } - $gallery[1] = substr($gallery_tmp,0,-1); - $error = uploadFile($_FILES[$array_name], GALLERIES_DIR_REL.$gallery[1]."/", $forceoverwrite,$GALLERY_CONF->get('maxwidth'), $GALLERY_CONF->get('maxtheight')); - if(!empty($error)) { - $post['error_messages'][key($error)][] = $gallery[1]."/".$error[key($error)]; - } else { - require_once(BASE_DIR_CMS."Image.php"); - $pict = $specialchars->replaceSpecialChars($_FILES[$array_name]['name'],false); - $size = GetImageSize(GALLERIES_DIR_REL.$gallery[1]."/".$pict); - if($size[0] <= $GALLERY_CONF->get('maxthumbwidth') and $size[1] <= $GALLERY_CONF->get('maxthumbheight')) { - copy(GALLERIES_DIR_REL.$gallery[1]."/".$pict,GALLERIES_DIR_REL.$gallery[1]."/".PREVIEW_DIR_NAME."/".$pict); - } else { - scaleImage($pict, GALLERIES_DIR_REL.$gallery[1]."/", GALLERIES_DIR_REL.$gallery[1]."/".PREVIEW_DIR_NAME."/", $GALLERY_CONF->get('maxthumbwidth'), $GALLERY_CONF->get('maxthumbheight')); - } - useChmod(GALLERIES_DIR_REL.$gallery[1]."/".PREVIEW_DIR_NAME."/".$pict); - $post['messages']['gallery_message_new_img'][] = $_FILES[$array_name]['name']." > ".$gallery[1]; - $post['gallery']['error_html']['display'][$gallery[1]] = ' style="display:block;"'; - } - } - } - return $post; + global $specialchars; + global $GALLERY_CONF; + + $forceoverwrite = ""; + if (isset($_POST ['overwrite'])) { + $forceoverwrite = $_POST ['overwrite']; + } + + foreach ($_FILES as $array_name => $tmp) { + if ($_FILES [$array_name] ['error'] == 0) { + $gallery = explode("_", $array_name); + unset($gallery [0]); + unset($gallery [count($gallery)]); + $gallery_tmp = NULL; + foreach ($gallery as $tmp) { + $gallery_tmp .= $tmp . "_"; + } + $gallery [1] = substr($gallery_tmp, 0, -1); + $error = uploadFile($_FILES [$array_name], GALLERIES_DIR_REL . $gallery [1] . "/", $forceoverwrite, $GALLERY_CONF->get('maxwidth'), $GALLERY_CONF->get('maxtheight')); + if (!empty($error)) { + $post ['error_messages'] [key($error)] [] = $gallery [1] . "/" . $error [key($error)]; + } else { + require_once (BASE_DIR_CMS . "Image.php"); + $pict = $specialchars->replaceSpecialChars($_FILES [$array_name] ['name'], false); + $size = GetImageSize(GALLERIES_DIR_REL . $gallery [1] . "/" . $pict); + if ($size [0] <= $GALLERY_CONF->get('maxthumbwidth') and $size [1] <= $GALLERY_CONF->get('maxthumbheight')) { + copy(GALLERIES_DIR_REL . $gallery [1] . "/" . $pict, GALLERIES_DIR_REL . $gallery [1] . "/" . PREVIEW_DIR_NAME . "/" . $pict); + } else { + scaleImage($pict, GALLERIES_DIR_REL . $gallery [1] . "/", GALLERIES_DIR_REL . $gallery [1] . "/" . PREVIEW_DIR_NAME . "/", $GALLERY_CONF->get('maxthumbwidth'), $GALLERY_CONF->get('maxthumbheight')); + } + useChmod(GALLERIES_DIR_REL . $gallery [1] . "/" . PREVIEW_DIR_NAME . "/" . $pict); + $post ['messages'] ['gallery_message_new_img'] [] = $_FILES [$array_name] ['name'] . " > " . $gallery [1]; + $post ['gallery'] ['error_html'] ['display'] [$gallery [1]] = ' style="display:block;"'; + } + } + } + return $post; } - function newGallery($post) { - global $specialchars; - global $ADMIN_CONF; - - if(isset($_POST['new_gallery'])) - $galleryname = $specialchars->replaceSpecialChars($_POST['new_gallery'],false); - - if($_SERVER["REQUEST_METHOD"] == "POST") { - if(isset($galleryname) and preg_match(ALLOWED_SPECIALCHARS_REGEX, $galleryname)) { - // Galerieverzeichnis schon vorhanden? Wenn nicht: anlegen! - if(!file_exists(GALLERIES_DIR_REL.$galleryname)) { - @mkdir(GALLERIES_DIR_REL.$galleryname); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_dir(GALLERIES_DIR_REL.$galleryname)) { - $post['error_messages']['gallery_error_new'][] = $galleryname; - } else { - @mkdir(GALLERIES_DIR_REL.$galleryname."/".PREVIEW_DIR_NAME); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_dir(GALLERIES_DIR_REL.$galleryname."/".PREVIEW_DIR_NAME)) { - $post['error_messages']['gallery_error_new_preview'][] = $galleryname; - } else { - @touch(GALLERIES_DIR_REL.$galleryname."/texte.conf"); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_file(GALLERIES_DIR_REL.$galleryname."/texte.conf")) { - $post['error_messages']['gallery_error_datei_conf'][] = $galleryname."/texte.conf"; - } else { - $error = changeChmod(GALLERIES_DIR_REL.$galleryname); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - } - $error = changeChmod(GALLERIES_DIR_REL.$galleryname."/".PREVIEW_DIR_NAME); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - } - $error = changeChmod(GALLERIES_DIR_REL.$galleryname."/texte.conf"); - if(is_array($error)) { - $post['error_messages'][key($error)][] = $error[key($error)]; - } - $post['messages']['gallery_message_new'][] = $specialchars->rebuildSpecialChars($galleryname, true, true); - } - } - } - } else { - $post['error_messages']['gallery_error_exists'][] = $specialchars->rebuildSpecialChars($galleryname, true, true); - } - } else { - $post['error_messages']['gallery_error_name'][] = $specialchars->rebuildSpecialChars($galleryname, true, true); - } - } - return $post; + global $specialchars; + global $ADMIN_CONF; + + if (isset($_POST ['new_gallery'])) + $galleryname = $specialchars->replaceSpecialChars($_POST ['new_gallery'], false); + + if ($_SERVER ["REQUEST_METHOD"] == "POST") { + if (isset($galleryname) and preg_match(ALLOWED_SPECIALCHARS_REGEX, $galleryname)) { + // Galerieverzeichnis schon vorhanden? Wenn nicht: anlegen! + if (!file_exists(GALLERIES_DIR_REL . $galleryname)) { + @mkdir(GALLERIES_DIR_REL . $galleryname); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir(GALLERIES_DIR_REL . $galleryname)) { + $post ['error_messages'] ['gallery_error_new'] [] = $galleryname; + } else { + @mkdir(GALLERIES_DIR_REL . $galleryname . "/" . PREVIEW_DIR_NAME); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir(GALLERIES_DIR_REL . $galleryname . "/" . PREVIEW_DIR_NAME)) { + $post ['error_messages'] ['gallery_error_new_preview'] [] = $galleryname; + } else { + @touch(GALLERIES_DIR_REL . $galleryname . "/texte.conf"); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_file(GALLERIES_DIR_REL . $galleryname . "/texte.conf")) { + $post ['error_messages'] ['gallery_error_datei_conf'] [] = $galleryname . "/texte.conf"; + } else { + $error = changeChmod(GALLERIES_DIR_REL . $galleryname); + if (is_array($error)) { + $post ['error_messages'] [key($error)] [] = $error [key($error)]; + } + $error = changeChmod(GALLERIES_DIR_REL . $galleryname . "/" . PREVIEW_DIR_NAME); + if (is_array($error)) { + $post ['error_messages'] [key($error)] [] = $error [key($error)]; + } + $error = changeChmod(GALLERIES_DIR_REL . $galleryname . "/texte.conf"); + if (is_array($error)) { + $post ['error_messages'] [key($error)] [] = $error [key($error)]; + } + $post ['messages'] ['gallery_message_new'] [] = $specialchars->rebuildSpecialChars($galleryname, true, true); + } + } + } + } else { + $post ['error_messages'] ['gallery_error_exists'] [] = $specialchars->rebuildSpecialChars($galleryname, true, true); + } + } else { + $post ['error_messages'] ['gallery_error_name'] [] = $specialchars->rebuildSpecialChars($galleryname, true, true); + } + } + return $post; } function editGallery($post) { - global $specialchars; - global $GALLERY_CONF; - global $ADMIN_CONF; - - # wenn expert eingeschaltet wird müssen die expert $post gefüllt werden - $gallery = makeDefaultConf("gallery"); - if(isset($GALLERY_CONF->properties['error'])) { - $post['error_messages']['gallery_error_setings'][] = $GALLERY_CONF->properties['error']; - return $post; - } - - foreach($gallery as $type => $type_array) { - if($type == 'expert') continue; - foreach($gallery[$type] as $syntax_name => $dumy) { - $error_messages = false; - $post['gallery']['error_html'][$syntax_name] = NULL; - if($ADMIN_CONF->get('showexpert') == "false" and in_array($syntax_name,$gallery['expert'])) { - continue; - } - if($type == 'digit') { - if(isset($post['gallery']['setings'][$syntax_name])) { - $syntax_value = trim($post['gallery']['setings'][$syntax_name]); - } else continue; - if($syntax_name == "maxthumbheight" or $syntax_name == "maxthumbwidth") { - if($post['gallery']['setings']['maxthumbheight'] == "" and $post['gallery']['setings']['maxthumbwidth'] == "") { - $error_messages = 'gallery_error_thumbs_no_digit'; - } - } - # wenn eingabe keine Zahl oder mehr wie 4stelig ist - if($syntax_value != "" and (!ctype_digit($syntax_value) or strlen($syntax_value) > 4)) { - $error_messages = 'gallery_error_digit'; - } - } - if($type == 'checkbox') { - $syntax_value = "false"; - if(isset($post['gallery']['setings'][$syntax_name])) { - $syntax_value = $post['gallery']['setings'][$syntax_name]; - } - } - if($type == 'text') { - if(isset($post['gallery']['setings'][$syntax_name])) { - $syntax_value = $post['gallery']['setings'][$syntax_name]; - } else continue; - } - if($error_messages === false and $GALLERY_CONF->get($syntax_name) != $syntax_value) { - - $GALLERY_CONF->set($syntax_name, $syntax_value); - if(!isset($post['messages']['gallery_messages_setings'])) { - $post['messages']['gallery_messages_setings'][] = NULL; - } - $post['gallery']['error_html']['display_setings'] = ' style="display:block;"'; - } - if($error_messages !== false) { - $post['error_messages'][$error_messages]['color'] = "#FF7029"; - $post['error_messages'][$error_messages][] = NULL; - $post['gallery']['error_html'][$syntax_name] = 'style="background-color:#FF7029;" '; - } - } - } - - # Galerien durchgehen und änderungen machen - foreach($post['gallery'] as $gallery => $gallery_array) { - if($gallery == "setings" or $gallery == "error_html" or $gallery == "make_thumbs" or $gallery == "scale_max") continue; - # Neuer Gallery Name - if(isset($post['gallery'][$gallery]['newname']) and strlen($post['gallery'][$gallery]['newname']) > 0) { - $newname = $specialchars->replaceSpecialChars($post['gallery'][$gallery]['newname'],false); - if(!preg_match(ALLOWED_SPECIALCHARS_REGEX, $newname) or stristr($newname,"%5E")) { - $post['error_messages']['check_name']['color'] = "#FFC197"; - $post['gallery']['error_html']['newname'][$gallery] = 'style="background-color:#FFC197;" '; - $post['gallery']['error_html']['display'][$gallery] = ' style="display:block;"'; - } else { - @rename(GALLERIES_DIR_REL.$gallery,GALLERIES_DIR_REL.$newname); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_dir(GALLERIES_DIR_REL.$newname)) { - $post['error_messages']['gallery_error_newname'][] = $newname; - } else { - $post['messages']['gallery_messages_newname'][] = $newname; - $post['gallery'][$newname] = $post['gallery'][$gallery]; - unset($post['gallery'][$gallery]); - $gallery = $newname; - } - } - } - - # Subtitel setzen - if(isset($post['gallery'][$gallery]['subtitle'])) { - $gallery_subtitel = new Properties(GALLERIES_DIR_REL.$gallery."/texte.conf",true); - foreach($post['gallery'][$gallery]['subtitle'] as $img => $subtitel) { - if($gallery_subtitel->get($img) != $subtitel and is_file(GALLERIES_DIR_REL.$gallery."/".$img)) { - $gallery_subtitel->set($img, $subtitel); - $post['gallery']['error_html']['display'][$gallery] = ' style="display:block;"'; - if(isset($gallery_subtitel->properties['error'])) { - $post['error_messages']['gallery_error_subtitel'][] = $gallery_subtitel->properties['error']; - return $post; - } else { - $post['messages']['gallery_messages_subtitel'][] = $gallery.' - '.$img; - } - } - } - } - - #make_thumbs - if(isset($post['gallery'][$gallery]['make_thumbs'])) { - require_once(BASE_DIR_CMS."Image.php"); - $gallerypics = getDirAsArray(GALLERIES_DIR_REL.$gallery,"file","none"); - foreach($gallerypics as $pos => $file) { - scaleImage($file, GALLERIES_DIR_REL.$gallery.'/', GALLERIES_DIR_REL.$gallery.'/'.PREVIEW_DIR_NAME.'/', $GALLERY_CONF->get('maxthumbwidth'), $GALLERY_CONF->get('maxthumbheight'),true); - $post['gallery']['error_html']['display'][$gallery] = ' style="display:block;"'; - $post['messages']['gallery_messages_make_thumbs'][$gallery] = $gallery; - } - } - #scale_max - if(isset($post['gallery'][$gallery]['scale_max']) and ($GALLERY_CONF->get('maxwidth') > 0 or $GALLERY_CONF->get('maxheight') > 0)) { - if(isset($post['gallery']['error_html']['maxwidth']) or isset($post['gallery']['error_html']['maxheight'])) { - $post['error_messages']['gallery_error_no_scale_max'][] = NULL; - $post['gallery']['error_html']['display'][$gallery] = ' style="display:block;"'; - } else { - require_once(BASE_DIR_CMS."Image.php"); - $gallerypics = getDirAsArray(GALLERIES_DIR_REL.$gallery,"file","none"); - foreach($gallerypics as $pos => $file) { - $test_img = @getimagesize(GALLERIES_DIR_REL.$gallery.'/'.$file); - # nur Bilder zulassen - if(count($test_img) > 2) { - if($test_img[0] > $GALLERY_CONF->get('maxwidth') or $test_img[1] > $GALLERY_CONF->get('maxheight')) { - scaleImage($file, GALLERIES_DIR_REL.$gallery.'/', GALLERIES_DIR_REL.$gallery.'/', $GALLERY_CONF->get('maxwidth'), $GALLERY_CONF->get('maxheight')); - $post['gallery']['error_html']['display'][$gallery] = ' style="display:block;"'; - $post['messages']['gallery_messages_scale_max'][$gallery] = $gallery; - } - } - } - } - } - } - return $post; + global $specialchars; + global $GALLERY_CONF; + global $ADMIN_CONF; + + // wenn expert eingeschaltet wird müssen die expert $post gefüllt werden + $gallery = makeDefaultConf("gallery"); + if (isset($GALLERY_CONF->properties ['error'])) { + $post ['error_messages'] ['gallery_error_setings'] [] = $GALLERY_CONF->properties ['error']; + return $post; + } + + foreach ($gallery as $type => $type_array) { + if ($type == 'expert') + continue; + foreach ($gallery [$type] as $syntax_name => $dumy) { + $error_messages = false; + $post ['gallery'] ['error_html'] [$syntax_name] = NULL; + if ($ADMIN_CONF->get('showexpert') == "false" and in_array($syntax_name, $gallery ['expert'])) { + continue; + } + if ($type == 'digit') { + if (isset($post ['gallery'] ['setings'] [$syntax_name])) { + $syntax_value = trim($post ['gallery'] ['setings'] [$syntax_name]); + } else + continue; + if ($syntax_name == "maxthumbheight" or $syntax_name == "maxthumbwidth") { + if ($post ['gallery'] ['setings'] ['maxthumbheight'] == "" and $post ['gallery'] ['setings'] ['maxthumbwidth'] == "") { + $error_messages = 'gallery_error_thumbs_no_digit'; + } + } + // wenn eingabe keine Zahl oder mehr wie 4stelig ist + if ($syntax_value != "" and (!ctype_digit($syntax_value) or strlen($syntax_value) > 4)) { + $error_messages = 'gallery_error_digit'; + } + } + if ($type == 'checkbox') { + $syntax_value = "false"; + if (isset($post ['gallery'] ['setings'] [$syntax_name])) { + $syntax_value = $post ['gallery'] ['setings'] [$syntax_name]; + } + } + if ($type == 'text') { + if (isset($post ['gallery'] ['setings'] [$syntax_name])) { + $syntax_value = $post ['gallery'] ['setings'] [$syntax_name]; + } else + continue; + } + if ($error_messages === false and $GALLERY_CONF->get($syntax_name) != $syntax_value) { + + $GALLERY_CONF->set($syntax_name, $syntax_value); + if (!isset($post ['messages'] ['gallery_messages_setings'])) { + $post ['messages'] ['gallery_messages_setings'] [] = NULL; + } + $post ['gallery'] ['error_html'] ['display_setings'] = ' style="display:block;"'; + } + if ($error_messages !== false) { + $post ['error_messages'] [$error_messages] ['color'] = "#FF7029"; + $post ['error_messages'] [$error_messages] [] = NULL; + $post ['gallery'] ['error_html'] [$syntax_name] = 'style="background-color:#FF7029;" '; + } + } + } + + // Galerien durchgehen und änderungen machen + foreach ($post ['gallery'] as $gallery => $gallery_array) { + if ($gallery == "setings" or $gallery == "error_html" or $gallery == "make_thumbs" or $gallery == "scale_max") + continue; + // Neuer Gallery Name + if (isset($post ['gallery'] [$gallery] ['newname']) and strlen($post ['gallery'] [$gallery] ['newname']) > 0) { + $newname = $specialchars->replaceSpecialChars($post ['gallery'] [$gallery] ['newname'], false); + if (!preg_match(ALLOWED_SPECIALCHARS_REGEX, $newname) or stristr($newname, "%5E")) { + $post ['error_messages'] ['check_name'] ['color'] = "#FFC197"; + $post ['gallery'] ['error_html'] ['newname'] [$gallery] = 'style="background-color:#FFC197;" '; + $post ['gallery'] ['error_html'] ['display'] [$gallery] = ' style="display:block;"'; + } else { + @rename(GALLERIES_DIR_REL . $gallery, GALLERIES_DIR_REL . $newname); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir(GALLERIES_DIR_REL . $newname)) { + $post ['error_messages'] ['gallery_error_newname'] [] = $newname; + } else { + $post ['messages'] ['gallery_messages_newname'] [] = $newname; + $post ['gallery'] [$newname] = $post ['gallery'] [$gallery]; + unset($post ['gallery'] [$gallery]); + $gallery = $newname; + } + } + } + + // Subtitel setzen + if (isset($post ['gallery'] [$gallery] ['subtitle'])) { + $gallery_subtitel = new Properties(GALLERIES_DIR_REL . $gallery . "/texte.conf", true); + foreach ($post ['gallery'] [$gallery] ['subtitle'] as $img => $subtitel) { + if ($gallery_subtitel->get($img) != $subtitel and is_file(GALLERIES_DIR_REL . $gallery . "/" . $img)) { + $gallery_subtitel->set($img, $subtitel); + $post ['gallery'] ['error_html'] ['display'] [$gallery] = ' style="display:block;"'; + if (isset($gallery_subtitel->properties ['error'])) { + $post ['error_messages'] ['gallery_error_subtitel'] [] = $gallery_subtitel->properties ['error']; + return $post; + } else { + $post ['messages'] ['gallery_messages_subtitel'] [] = $gallery . ' - ' . $img; + } + } + } + } + + // make_thumbs + if (isset($post ['gallery'] [$gallery] ['make_thumbs'])) { + require_once (BASE_DIR_CMS . "Image.php"); + $gallerypics = getDirAsArray(GALLERIES_DIR_REL . $gallery, "file", "none"); + foreach ($gallerypics as $pos => $file) { + scaleImage($file, GALLERIES_DIR_REL . $gallery . '/', GALLERIES_DIR_REL . $gallery . '/' . PREVIEW_DIR_NAME . '/', $GALLERY_CONF->get('maxthumbwidth'), $GALLERY_CONF->get('maxthumbheight'), true); + $post ['gallery'] ['error_html'] ['display'] [$gallery] = ' style="display:block;"'; + $post ['messages'] ['gallery_messages_make_thumbs'] [$gallery] = $gallery; + } + } + // scale_max + if (isset($post ['gallery'] [$gallery] ['scale_max']) and ($GALLERY_CONF->get('maxwidth') > 0 or $GALLERY_CONF->get('maxheight') > 0)) { + if (isset($post ['gallery'] ['error_html'] ['maxwidth']) or isset($post ['gallery'] ['error_html'] ['maxheight'])) { + $post ['error_messages'] ['gallery_error_no_scale_max'] [] = NULL; + $post ['gallery'] ['error_html'] ['display'] [$gallery] = ' style="display:block;"'; + } else { + require_once (BASE_DIR_CMS . "Image.php"); + $gallerypics = getDirAsArray(GALLERIES_DIR_REL . $gallery, "file", "none"); + foreach ($gallerypics as $pos => $file) { + $test_img = @getimagesize(GALLERIES_DIR_REL . $gallery . '/' . $file); + // nur Bilder zulassen + if (count($test_img) > 2) { + if ($test_img [0] > $GALLERY_CONF->get('maxwidth') or $test_img [1] > $GALLERY_CONF->get('maxheight')) { + scaleImage($file, GALLERIES_DIR_REL . $gallery . '/', GALLERIES_DIR_REL . $gallery . '/', $GALLERY_CONF->get('maxwidth'), $GALLERY_CONF->get('maxheight')); + $post ['gallery'] ['error_html'] ['display'] [$gallery] = ' style="display:block;"'; + $post ['messages'] ['gallery_messages_scale_max'] [$gallery] = $gallery; + } + } + } + } + } + } + return $post; } - function deleteGalleryImg($post) { - global $specialchars; - global $icon_size; - - $gallery = key($post['action_data']['deletegalleryimg']); - $del_file = $post['action_data']['deletegalleryimg'][$gallery]; - - if (isset($_POST['confirm']) and ($_POST['confirm'] == "true")) { - if(file_exists(GALLERIES_DIR_REL.$gallery."/".$del_file)) { - @unlink(GALLERIES_DIR_REL.$gallery."/".$del_file); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(is_file(GALLERIES_DIR_REL.$gallery."/".$del_file)) { - $post['error_messages']['gallery_error_deleted_img'][] = $gallery." > ".$del_file; - } else { - if(file_exists(GALLERIES_DIR_REL.$gallery."/".PREVIEW_DIR_NAME."/".$del_file)) { - @unlink(GALLERIES_DIR_REL.$gallery."/".PREVIEW_DIR_NAME."/".$del_file); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(is_file(GALLERIES_DIR_REL.$gallery."/".$del_file)) { - $post['error_messages']['gallery_error_deleted_img'][] = $gallery."/".PREVIEW_DIR_NAME."/ > ".$del_file; - } - } - $subtitle = new Properties(GALLERIES_DIR_REL.$gallery."/texte.conf",true); - $subtitle->delete($del_file); - $post['messages']['gallery_message_deleted_img'][] = $gallery." > ".$del_file; - } - $post['gallery']['error_html']['display'][$gallery] = ' style="display:block;"'; - } - } else { - if (isset($_POST['confirm']) and ($_POST['confirm'] == "false")) { - $post['gallery']['error_html']['display'][$gallery] = 'style="display:block;" '; - } else { - $post['ask'] = askMessages("gallery_ask_delete_img",$del_file,'action_data[deletegalleryimg]['.$gallery.']',$del_file); - $post['gallery']['error_html']['display'][$gallery] = 'style="display:block;" '; - } - } - return $post; + global $specialchars; + global $icon_size; + + $gallery = key($post ['action_data'] ['deletegalleryimg']); + $del_file = $post ['action_data'] ['deletegalleryimg'] [$gallery]; + + if (isset($_POST ['confirm']) and ($_POST ['confirm'] == "true")) { + if (file_exists(GALLERIES_DIR_REL . $gallery . "/" . $del_file)) { + @unlink(GALLERIES_DIR_REL . $gallery . "/" . $del_file); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (is_file(GALLERIES_DIR_REL . $gallery . "/" . $del_file)) { + $post ['error_messages'] ['gallery_error_deleted_img'] [] = $gallery . " > " . $del_file; + } else { + if (file_exists(GALLERIES_DIR_REL . $gallery . "/" . PREVIEW_DIR_NAME . "/" . $del_file)) { + @unlink(GALLERIES_DIR_REL . $gallery . "/" . PREVIEW_DIR_NAME . "/" . $del_file); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (is_file(GALLERIES_DIR_REL . $gallery . "/" . $del_file)) { + $post ['error_messages'] ['gallery_error_deleted_img'] [] = $gallery . "/" . PREVIEW_DIR_NAME . "/ > " . $del_file; + } + } + $subtitle = new Properties(GALLERIES_DIR_REL . $gallery . "/texte.conf", true); + $subtitle->delete($del_file); + $post ['messages'] ['gallery_message_deleted_img'] [] = $gallery . " > " . $del_file; + } + $post ['gallery'] ['error_html'] ['display'] [$gallery] = ' style="display:block;"'; + } + } else { + if (isset($_POST ['confirm']) and ($_POST ['confirm'] == "false")) { + $post ['gallery'] ['error_html'] ['display'] [$gallery] = 'style="display:block;" '; + } else { + $post ['ask'] = askMessages("gallery_ask_delete_img", $del_file, 'action_data[deletegalleryimg][' . $gallery . ']', $del_file); + $post ['gallery'] ['error_html'] ['display'] [$gallery] = 'style="display:block;" '; + } + } + return $post; } function deleteGallery($post) { - global $specialchars; - global $icon_size; - - # Nachfragen wirklich Löschen - if(!isset($_POST['confirm'])) { - $del_gallery = key($post['action_data']['deletegallery']); - $post['ask'] = askMessages("gallery_ask_delete",$del_gallery,'action_data[deletegallery]',$post['action_data']['deletegallery'],"del_gallery",$del_gallery); - } - # Gallery Löschen - if(isset($_POST['confirm']) and $_POST['confirm'] == "true" and isset($_POST['del_gallery']) and !empty($_POST['del_gallery'])) { - $del_gallery = GALLERIES_DIR_REL.$_POST['del_gallery']; - $post['error_messages'] = deleteDir($del_gallery); - if(!file_exists(GALLERIES_DIR_REL.$_POST['del_gallery'])) { - unset($post['gallery'][$_POST['del_gallery']]); - $post['messages']['gallery_message_deleted'][] = $_POST['del_gallery']; - } else { - if(!isset($post['error_messages'])) { - $post['error_messages']['gallery_error_deleted'][] = $_POST['del_gallery']; - } - } - } - return $post; + global $specialchars; + global $icon_size; + + // Nachfragen wirklich Löschen + if (!isset($_POST ['confirm'])) { + $del_gallery = key($post ['action_data'] ['deletegallery']); + $del_gal = $post ['action_data'] ['deletegallery'] [$del_gallery]; + $post ['ask'] = askMessages("gallery_ask_delete", $del_gallery, 'action_data[deletegallery]', $post ['action_data'] ['deletegallery'] [$del_gallery], "del_gallery", $del_gallery); + } + // Gallery Löschen + if (isset($_POST ['confirm']) and $_POST ['confirm'] == "true" and isset($_POST ['del_gallery']) and !empty($_POST ['del_gallery'])) { + $del_gallery = GALLERIES_DIR_REL . $_POST ['del_gallery']; + $post ['error_messages'] = deleteDir($del_gallery); + if (!file_exists(GALLERIES_DIR_REL . $_POST ['del_gallery'])) { + unset($post ['gallery'] [$_POST ['del_gallery']]); + $post ['messages'] ['gallery_message_deleted'] [] = $_POST ['del_gallery']; + } else { + if (!isset($post ['error_messages'])) { + $post ['error_messages'] ['gallery_error_deleted'] [] = $_POST ['del_gallery']; + } + } + } + return $post; } function files($post) { - global $specialchars; - global $DOWNLOAD_COUNTS; - global $ADMIN_CONF; - global $icon_size; - - $max_cat_page = 100; - - $pagecontent = ''; - $post['categories'] = makePostCatPageReturnVariable(); - - if(isset($post['action_data']) and !isset($post['error_messages'])) { - $action_data_key = key($post['action_data']); - if($action_data_key == "newfile") { - $post = newFile($post); - } elseif($action_data_key == "deletefile") { - $post = deleteFile($post); - } - } - if(isset($post['ask'])) { - $pagecontent .= $post['ask']; - } - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_files_help = 'help'; - } else { - $tooltip_files_help = 'help'; - } - # Prüfen ob der Ordner dateien existiert wenn nicht anlegen - foreach ($post['categories']['cat']['position'] as $pos => $position) { - if($pos == $max_cat_page or isset($post['categories']['cat']['url'][$pos])) { - continue; - } - $file = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - if(!file_exists(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME)) { - $post['error_messages']['files_error_dateien'][] = CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME; - @mkdir (CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(!is_dir(CONTENT_DIR_REL.$file."/dateien")) { - $post['error_messages']['files_error_mkdir_dateien'][] = CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME; - } else { - useChmod(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME); - } - } - } - $pagecontent .= categoriesMessages($post); - - $pagecontent .= ''.getLanguageValue("files_button").''; - $pagecontent .= $tooltip_files_help; - $pagecontent .= "

".getLanguageValue("files_text")."

"; - - $maxnumberoffiles = $ADMIN_CONF->get("maxnumberofuploadfiles"); - if (!is_numeric($maxnumberoffiles) || ($maxnumberoffiles < 1)) { - $maxnumberoffiles = 5; - } - - $array_getLanguageValue = array("files","category","contents","file","files_downloads","files_uploaddate","files_size","files_text_upload","files_button_cut","files_button_delete","files_text_no_files"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getLanguageValue as $language) { - ${"text_".$language} = getLanguageValue($language); - } - $title_files_button_delete = getLanguageValue('files_button_delete',true); - $array_getTooltipValue = array("files_help_edit","files_help_delete","files_help_show","files_help_upload", - "files_help_downloads","files_help_overwrite"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getTooltipValue as $language) { - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); - } else { - ${"tooltip_".$language} = NULL; - } - } - - $pagecontent .= ''; - $pagecontent .= ''; - - foreach ($post['categories']['cat']['position'] as $pos => $position) { - unset($display_titel_dateien); - if($pos == $max_cat_page or isset($post['categories']['cat']['url'][$pos])) { - continue; - } - $file = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - // Anzahl Dateien auslesen - $filecount = 0; - if(file_exists(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME)) { - if($fileshandle = opendir(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME)) { - while (($filesdir = readdir($fileshandle))) { - if(isValidDirOrFile($filesdir)) - $filecount++; - } - closedir($fileshandle); - } - } - $text = '('.$filecount.' '.$text_files.')'; - - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ''; + } + $pagecontent .= '
'; - $pagecontent .= ''; - $overwrite = NULL; - if($ADMIN_CONF->get("overwriteuploadfiles") == "true") { - $overwrite = ' checked="checked"'; - } - $pagecontent .= '   '.getLanguageValue("files_button_overwrite").''; - $pagecontent .= '
'; - - $pagecontent .= ''; - if(!isset($display_titel)) {# Position: - $pagecontent .= ''; - $display_titel = true; - } - $pagecontent .= ''; - - $pagecontent .= ''; - $pagecontent .= '
'.$text_category.' '.$text_contents.' 
'.$specialchars->rebuildSpecialChars($post['categories']['cat']['name'][$pos], true, true).' '.$text.''; - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - - $pagecontent .= '
'; - - $file = $post['categories']['cat']['position'][$pos]."_".$post['categories']['cat']['name'][$pos]; - if (isValidDirOrFile($file) && ($subhandle = @opendir(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME))) { - $hasdata = false; - $pagecontent .= ''; - $pagecontent .= '' - .'' - .''; + $display_titel_dateien = true; + } + + $pagecontent .= $titel_dateien . '' . '' . '' . ''; + $pagecontent .= ''; + + $hasdata = true; + } + } + if (!$hasdata) + $pagecontent .= ''; + $pagecontent .= "
'.$text_files_text_upload.'
'; - $pagecontent .= ''; + } + + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_files_help = 'help'; + } else { + $tooltip_files_help = 'help'; + } + // Prüfen ob der Ordner dateien existiert wenn nicht anlegen + foreach ($post ['categories'] ['cat'] ['position'] as $pos => $position) { + if ($pos == $max_cat_page or isset($post ['categories'] ['cat'] ['url'] [$pos])) { + continue; + } + $file = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + if (!file_exists(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME)) { + $post ['error_messages'] ['files_error_dateien'] [] = CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME; + @mkdir(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME); + $line_error = __LINE__ - 1; + $last_error ['line'] = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (!is_dir(CONTENT_DIR_REL . $file . "/dateien")) { + $post ['error_messages'] ['files_error_mkdir_dateien'] [] = CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME; + } else { + useChmod(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME); + } + } + } + $pagecontent .= categoriesMessages($post); + + $pagecontent .= '' . getLanguageValue("files_button") . ''; + $pagecontent .= $tooltip_files_help; + $pagecontent .= "

" . getLanguageValue("files_text") . "

"; + + $maxnumberoffiles = $ADMIN_CONF->get("maxnumberofuploadfiles"); + if (!is_numeric($maxnumberoffiles) || ($maxnumberoffiles < 1)) { + $maxnumberoffiles = 5; + } + + $array_getLanguageValue = array( + "files", + "category", + "contents", + "file", + "files_downloads", + "files_uploaddate", + "files_size", + "files_text_upload", + "files_button_cut", + "files_button_delete", + "files_text_no_files" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getLanguageValue as $language) { + ${"text_" . $language} = getLanguageValue($language); + } + $title_files_button_delete = getLanguageValue('files_button_delete', true); + $array_getTooltipValue = array( + "files_help_edit", + "files_help_delete", + "files_help_show", + "files_help_upload", + "files_help_downloads", + "files_help_overwrite" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getTooltipValue as $language) { + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + ${"tooltip_" . $language} = createTooltipWZ("", $language, ",WIDTH,200,CLICKCLOSE,true"); + } else { + ${"tooltip_" . $language} = NULL; + } + } + + $pagecontent .= ''; + $pagecontent .= ''; + + foreach ($post ['categories'] ['cat'] ['position'] as $pos => $position) { + unset($display_titel_dateien); + if ($pos == $max_cat_page or isset($post ['categories'] ['cat'] ['url'] [$pos])) { + continue; + } + $file = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + // Anzahl Dateien auslesen + $filecount = 0; + if (file_exists(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME)) { + if ($fileshandle = opendir(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME)) { + while (($filesdir = readdir($fileshandle))) { + if (isValidDirOrFile($filesdir)) + $filecount++; + } + closedir($fileshandle); + } + } + $text = '(' . $filecount . ' ' . $text_files . ')'; + + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ''; - } - $pagecontent .= '
'; + $pagecontent .= ''; + $overwrite = NULL; + if ($ADMIN_CONF->get("overwriteuploadfiles") == "true") { + $overwrite = ' checked="checked"'; + } + $pagecontent .= '   ' . getLanguageValue("files_button_overwrite") . ''; + $pagecontent .= '
'; + + $pagecontent .= ''; + if (!isset($display_titel)) { // Position: + $pagecontent .= ''; + $display_titel = true; + } + $pagecontent .= ''; + + $pagecontent .= ''; + $pagecontent .= '
' . $text_category . ' ' . $text_contents . ' 
' . $specialchars->rebuildSpecialChars($post ['categories'] ['cat'] ['name'] [$pos], true, true) . ' ' . $text . ''; + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + + $pagecontent .= '
'; + + $file = $post ['categories'] ['cat'] ['position'] [$pos] . "_" . $post ['categories'] ['cat'] ['name'] [$pos]; + if (isValidDirOrFile($file) && ($subhandle = @opendir(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME))) { + $hasdata = false; + $pagecontent .= ''; + $pagecontent .= '' . '' . ''; - $mysubfiles = array(); - while (($subfile = readdir($subhandle))) { - array_push($mysubfiles, $subfile); - } - closedir($subhandle); - sort($mysubfiles); - foreach ($mysubfiles as $subfile) { - if (isValidDirOrFile($subfile)) { - $downloads = $DOWNLOAD_COUNTS->get($file.":".$subfile); -# $countword = getLanguageValue("data_downloads"); // Plural -# if ($downloads == "1") -# $countword = getLanguageValue("data_download"); // Singular - if ($downloads == "") - $downloads = "0"; - // Downloads pro Tag berechnen - $uploadtime = filemtime(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME."/".$subfile); - $counterstart = $DOWNLOAD_COUNTS->get("_downloadcounterstarttime"); - // Berechnungsgrundlage fuer "Downloads pro Tag": - // Entweder Upload-Zeitpunkt oder Beginn der Statistik - genommen wird der spätere Zeitpunkt - if ($uploadtime > $counterstart) - $starttime = $uploadtime; - else - $starttime = $counterstart; - $dayscounted = ceil((time() - $starttime) / (60*60*24)); - if ($dayscounted == 0) - $downloadsperday = 0; - else - $downloadsperday = round(($downloads/$dayscounted), 2); -# if ($downloads > 0) -# $downloadsperdaytext = "/ ".getLanguageValue("files_text_downloads_day")." ".$downloadsperday; - # else - $downloadsperdaytext = ""; - // Dateigröße - $filesize = filesize(CONTENT_DIR_REL.$file."/".CONTENT_FILES_DIR_NAME."/".$subfile); - - $titel_dateien = NULL; - if(!isset($display_titel_dateien)) { # Position: - $titel_dateien = ''; - $display_titel_dateien = true; - } - - $pagecontent .= $titel_dateien.'' - .'' - .'' - .''; - $pagecontent .= ''; - - $hasdata = true; - } - } - if (!$hasdata) - $pagecontent .= ''; - $pagecontent .= "
' . $text_files_text_upload . '
'; + $pagecontent .= '
'.$text_file.''.$text_files_size.''.$text_files_uploaddate.''.$text_files_downloads.' 
'.$specialchars->rebuildSpecialChars($subfile,true,true).''.convertFileSizeUnit($filesize).''.@strftime(getLanguageValue("_dateformat"), $uploadtime).''.$downloads." ".$downloadsperdaytext.''; - $pagecontent .= ''; - $pagecontent .= '
'.$text_files_text_no_files.'
"; - } - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - $pagecontent .= '
'; - $pagecontent .= ''; -# $pagecontent .= '   '.getLanguageValue("files_button_overwrite").''; - $pagecontent .= '
'; - - return array(getLanguageValue("files_button"), $pagecontent); + $mysubfiles = array(); + while (($subfile = readdir($subhandle))) { + array_push($mysubfiles, $subfile); + } + closedir($subhandle); + sort($mysubfiles); + foreach ($mysubfiles as $subfile) { + if (isValidDirOrFile($subfile)) { + $downloads = $DOWNLOAD_COUNTS->get($file . ":" . $subfile); + // $countword = getLanguageValue("data_downloads"); // Plural + // if ($downloads == "1") + // $countword = getLanguageValue("data_download"); // Singular + if ($downloads == "") + $downloads = "0"; + // Downloads pro Tag berechnen + $uploadtime = filemtime(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME . "/" . $subfile); + $counterstart = $DOWNLOAD_COUNTS->get("_downloadcounterstarttime"); + // Berechnungsgrundlage fuer "Downloads pro Tag": + // Entweder Upload-Zeitpunkt oder Beginn der Statistik - genommen wird der spätere Zeitpunkt + if ($uploadtime > $counterstart) + $starttime = $uploadtime; + else + $starttime = $counterstart; + $dayscounted = ceil((time() - $starttime) / (60 * 60 * 24)); + if ($dayscounted == 0) + $downloadsperday = 0; + else + $downloadsperday = round(($downloads / $dayscounted), 2); + // if ($downloads > 0) + // $downloadsperdaytext = "/ ".getLanguageValue("files_text_downloads_day")." ".$downloadsperday; + // else + $downloadsperdaytext = ""; + // Dateigröße + $filesize = filesize(CONTENT_DIR_REL . $file . "/" . CONTENT_FILES_DIR_NAME . "/" . $subfile); + + $titel_dateien = NULL; + if (!isset($display_titel_dateien)) { // Position: + $titel_dateien = '
' . $text_file . '' . $text_files_size . '' . $text_files_uploaddate . '' . $text_files_downloads . ' 
' . $specialchars->rebuildSpecialChars($subfile, true, true) . '' . convertFileSizeUnit($filesize) . '' . @strftime(getLanguageValue("_dateformat"), $uploadtime) . '' . $downloads . " " . $downloadsperdaytext . ''; + $pagecontent .= ''; + $pagecontent .= '
' . $text_files_text_no_files . '
"; + } + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + $pagecontent .= '
'; + $pagecontent .= ''; + // $pagecontent .= '   '.getLanguageValue("files_button_overwrite").''; + $pagecontent .= '
'; + + return array( + getLanguageValue("files_button"), + $pagecontent + ); } function newFile($post) { - global $error_color; - global $ADMIN_CONF; - - $forceoverwrite = ""; - if (isset($_POST['overwrite'])) { - $forceoverwrite = $_POST['overwrite']; - } - - foreach($_FILES as $array_name => $tmp) { - if($_FILES[$array_name]['error'] == 0) { - $cat_pos= explode("_",$array_name); - $cat = sprintf("%02d",$cat_pos[1])."_".specialNrDir(CONTENT_DIR_REL, sprintf("%02d",$cat_pos[1])); - $error = uploadFile($_FILES[$array_name], CONTENT_DIR_REL.$cat."/".CONTENT_FILES_DIR_NAME."/", $forceoverwrite,$ADMIN_CONF->get("maximagewidth"),$ADMIN_CONF->get("maximageheight")); - if(!empty($error)) { - $post['error_messages'][key($error)][] = $cat."/".$error[key($error)]; - $key = array_keys($post['categories']['cat']['position'], substr($cat,0,2)); - $post['categories']['cat']['error_html']['display'][sprintf("%1d",$key[0])] = 'style="display:block;" '; - $post['categories']['cat']['error_html']['name'][sprintf("%1d",$key[0])] = 'style="background-color:'.$error_color[key($error)].';" '; - } else { - $post['messages']['files_message_new'][] = $_FILES[$array_name]['name']." > ".$cat; - } - } - } - return $post; + global $error_color; + global $ADMIN_CONF; + + $forceoverwrite = ""; + if (isset($_POST ['overwrite'])) { + $forceoverwrite = $_POST ['overwrite']; + } + + foreach ($_FILES as $array_name => $tmp) { + if ($_FILES [$array_name] ['error'] == 0) { + $cat_pos = explode("_", $array_name); + $cat = sprintf("%02d", $cat_pos [1]) . "_" . specialNrDir(CONTENT_DIR_REL, sprintf("%02d", $cat_pos [1])); + $error = uploadFile($_FILES [$array_name], CONTENT_DIR_REL . $cat . "/" . CONTENT_FILES_DIR_NAME . "/", $forceoverwrite, $ADMIN_CONF->get("maximagewidth"), $ADMIN_CONF->get("maximageheight")); + if (!empty($error)) { + $post ['error_messages'] [key($error)] [] = $cat . "/" . $error [key($error)]; + $key = array_keys($post ['categories'] ['cat'] ['position'], substr($cat, 0, 2)); + $post ['categories'] ['cat'] ['error_html'] ['display'] [sprintf("%1d", $key [0])] = 'style="display:block;" '; + $post ['categories'] ['cat'] ['error_html'] ['name'] [sprintf("%1d", $key [0])] = 'style="background-color:' . $error_color [key($error)] . ';" '; + } else { + $post ['messages'] ['files_message_new'] [] = $_FILES [$array_name] ['name'] . " > " . $cat; + } + } + } + return $post; } function deleteFile($post) { - global $specialchars; - global $DOWNLOAD_COUNTS; - global $icon_size; - - $cat = key($post['action_data']['deletefile']); - $del_file = $post['action_data']['deletefile'][$cat]; - - if(isset($_POST['confirm']) and ($_POST['confirm'] == "false")) { - return $post; - } elseif(isset($_POST['confirm']) and ($_POST['confirm'] == "true")) { - if(file_exists(CONTENT_DIR_REL.$cat."/".CONTENT_FILES_DIR_NAME."/".$del_file)) { - @unlink(CONTENT_DIR_REL.$cat."/".CONTENT_FILES_DIR_NAME."/".$del_file); - $line_error = __LINE__ - 1; # wichtig direckt nach Befehl - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $post['error_messages']['php_error'][] = $last_error['message']; - } elseif(is_file(CONTENT_DIR_REL.$cat."/".CONTENT_FILES_DIR_NAME."/".$del_file)) { - $post['error_messages']['files_error_delete'][] = $cat." > ".$del_file; - } else { - $post['messages']['files_message_deleted'][] = $cat." > ".$del_file; - } - $key = array_keys($post['categories']['cat']['position'], substr($cat,0,2)); - $post['categories']['cat']['error_html']['display'][$key[0]] = 'style="display:block;" '; - return $post; - } - } else { - $post['ask'] = askMessages("files_ask_delete",$del_file,'action_data[deletefile]['.$cat.']',$del_file); - $key = array_keys($post['categories']['cat']['position'], substr($cat,0,2)); - $post['categories']['cat']['error_html']['display'][$key[0]] = 'style="display:block;" '; - return $post; - } - return $post; + global $specialchars; + global $DOWNLOAD_COUNTS; + global $icon_size; + + $cat = key($post ['action_data'] ['deletefile']); + $del_file = $post ['action_data'] ['deletefile'] [$cat]; + + if (isset($_POST ['confirm']) and ($_POST ['confirm'] == "false")) { + return $post; + } elseif (isset($_POST ['confirm']) and ($_POST ['confirm'] == "true")) { + if (file_exists(CONTENT_DIR_REL . $cat . "/" . CONTENT_FILES_DIR_NAME . "/" . $del_file)) { + @unlink(CONTENT_DIR_REL . $cat . "/" . CONTENT_FILES_DIR_NAME . "/" . $del_file); + $line_error = __LINE__ - 1; // wichtig direckt nach Befehl + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $post ['error_messages'] ['php_error'] [] = $last_error ['message']; + } elseif (is_file(CONTENT_DIR_REL . $cat . "/" . CONTENT_FILES_DIR_NAME . "/" . $del_file)) { + $post ['error_messages'] ['files_error_delete'] [] = $cat . " > " . $del_file; + } else { + $post ['messages'] ['files_message_deleted'] [] = $cat . " > " . $del_file; + } + $key = array_keys($post ['categories'] ['cat'] ['position'], substr($cat, 0, 2)); + $post ['categories'] ['cat'] ['error_html'] ['display'] [$key [0]] = 'style="display:block;" '; + return $post; + } + } else { + $post ['ask'] = askMessages("files_ask_delete", $del_file, 'action_data[deletefile][' . $cat . ']', $del_file); + $key = array_keys($post ['categories'] ['cat'] ['position'], substr($cat, 0, 2)); + $post ['categories'] ['cat'] ['error_html'] ['display'] [$key [0]] = 'style="display:block;" '; + return $post; + } + return $post; } function config($post) { - global $CMS_CONF; - global $specialchars; - global $USER_SYNTAX_FILE; - global $CONTACT_CONF; - global $ADMIN_CONF; - global $icon_size; - - $main = makeDefaultConf("main"); - - # error colors für die input felder vorbereiten vom main array,usersyntax und input_mail array - foreach($main as $type => $type_array) { - if($type == 'expert') continue; - foreach($main[$type] as $syntax_name => $dumy) { - $error_color[$syntax_name] = NULL; - } - } - $error_color['usersyntax'] = NULL; -/* $input_mail = makeDefaultConf("formular"); - $error_color['formularmail'] = NULL; - $error_color['contactformwaittime'] = NULL; - foreach($input_mail as $syntax_name => $dumy) { - if($syntax_name == 'formularmail') continue; - $error_color['titel_'.$syntax_name] = NULL; - } -*/ - $language_array = getDirAsArray(BASE_DIR_CMS.'sprachen',"file","natcasesort"); - $cat_array = getDirAsArray(CONTENT_DIR_REL,"dir","natcasesort"); - $layout_array = getDirAsArray(BASE_DIR."layouts","dir","natcasesort"); - - $pagecontent = ''; - - - if(isset($post['apply'])) { - $post['apply'] = $specialchars->rebuildSpecialChars(getRequestParam('apply', true), false, true); - } - - - // Änderungen speichern - if(isset($post['apply']) and $post['apply'] == getLanguageValue("config_submit")) { - - # nur wenns auch Layouts gibt - if(count($layout_array) > 0) { - # wens ein neues layout ist setings aus der layoutsettings hollen und schreiben - if($CMS_CONF->get('cmslayout') != $specialchars->replaceSpecialChars($post['cmslayout'],false)) { - $error = setLayoutAndDependentSettings($specialchars->replaceSpecialChars($post['cmslayout'],false)); - if(is_array($error)) { - $post['error_messages']['properties'][] = $error['error']; - $error_color['cmslayout'] = ' style="background-color:#FF7029;"'; - # damits nicht gespeichert wird - unset($post['cmslayout'],$post['usesubmenu']); - } else { - $post['usesubmenu'] = $error; - } - } - } - - # usecmssyntax wurde eingeschaltet also posts füllen - if(isset($post['usecmssyntax']) and $post['usecmssyntax'] == "true" and $CMS_CONF->get('usecmssyntax') == "false") { - $post['usecmseditarea'] = $CMS_CONF->get('usecmseditarea'); - $post['replaceemoticons'] = $CMS_CONF->get('replaceemoticons'); - $post['shortenlinks'] = $CMS_CONF->get('shortenlinks'); - } - # usecmssyntax ist ausgeschaltet also posts füllen - if($CMS_CONF->get('usecmssyntax') == "false") { - $post['replaceemoticons'] = $CMS_CONF->get('replaceemoticons'); - } - - foreach($main as $type => $type_array) { - if($type == 'expert') continue; - foreach($main[$type] as $syntax_name => $dumy) { - $error_messages = false; - if($ADMIN_CONF->get('showexpert') == "false" and in_array($syntax_name,$main['expert'])) { - continue; - } - if($type == 'text') { - if(isset($post[$syntax_name])) { - $text = $specialchars->replaceSpecialChars($post[$syntax_name],false); - } else continue; - if($error_messages === false and $CMS_CONF->get($syntax_name) != $text) { - $CMS_CONF->set($syntax_name, $text); - } - } - if($type == 'select') { - if(isset($post[$syntax_name])) { # wenn select lehr ist post lehr ja - $select = $specialchars->replaceSpecialChars($post[$syntax_name],false); - } else continue; - if($error_messages === false and $CMS_CONF->get($syntax_name) != $select) { - $CMS_CONF->set($syntax_name, $select); - } - } - if($type == 'checkbox') { - $checkbox = "false"; - if(isset($post[$syntax_name])) { - $checkbox = $post[$syntax_name]; - } - if($syntax_name == "modrewrite" and !isset($_REQUEST['link']) and isset($post[$syntax_name]) and $post[$syntax_name] == "true") { - $checkbox = "false"; - $post['error_messages']['config_error_modrewrite'][] = NULL; - } - if($error_messages === false and $CMS_CONF->get($syntax_name) != $checkbox) { - $CMS_CONF->set($syntax_name, $checkbox); - } - } - } - } - # Mail daten speichern -/* foreach($input_mail as $syntax_name => $dumy) { - if($syntax_name == "contactformwaittime") { - # wenn eingabe keine Zahl oder mehr wie 4stelig ist - if(!ctype_digit($post[$syntax_name]) or strlen($post[$syntax_name]) > 4) { - $post['error_messages']['config_error_nodigit_tolong']['color'] = "#FF7029"; - $error_color['contactformwaittime'] = ' style="background-color:#FF7029;"'; - } else { - $CONTACT_CONF->set($syntax_name, $post[$syntax_name]); - } - continue; - } - if($syntax_name == "contactformusespamprotection") { - $checkbox = "false"; - if(isset($post[$syntax_name])) { - $checkbox = $post[$syntax_name]; - } - if($CONTACT_CONF->get($syntax_name) != $checkbox) { - $CONTACT_CONF->set($syntax_name, $checkbox); - } - continue; - } - if($syntax_name == "formularmail") { - if($post[$syntax_name] != "" and !preg_match("/^.+@.+\..+$/",$post[$syntax_name])) { - $post['error_messages']['config_error_formularmail']['color'] = "#FF7029"; - $error_color['formularmail'] = ' style="background-color:#FF7029;"'; - $error_messages = $syntax_name; - } else { - $CONTACT_CONF->set($syntax_name,$post[$syntax_name]); - } - continue; - } - $mail_titel = $specialchars->replaceSpecialChars($post['titel_'.$syntax_name],false); - $CONTACT_CONF->set($syntax_name, $mail_titel.",".checkBoxChecked('show_'.$syntax_name).",".checkBoxChecked('mandatory_'.$syntax_name)); - } -*/ - // Speichern der benutzerdefinierten Syntaxelemente -> ERWEITERN UM PRÜFUNG! - # nur Speichern wenn auch benutzt wird - if($CMS_CONF->get('usecmssyntax') == "true") { - # usecmssyntax wurde eingeschaltet aus syntax.conf lesen - if(!isset($post['usersyntax'])) { - $usersyntax_array = file($USER_SYNTAX_FILE); - } else { - $usersyntax_array = preg_split("/\r\n|\r|\n/", $post['usersyntax']); - } - $usersyntax_text = NULL; - foreach($usersyntax_array as $zeile) { - $zeile = trim($zeile); - if(!empty($zeile)) { - $usersyntax_text .= $zeile."\n"; - # in jeder zeile muss " =" enthalten sein sonst Fehler - if(!strstr($zeile," =") !== false) { - $post['error_messages']['config_error_usersyntax']['color'] = "#FF7029"; - $post['error_messages']['config_error_usersyntax'][] = $zeile; - $error_color['usersyntax'] = ' style="background-color:#FF7029;"'; - } else { - $count = 0; - $search_tmp = substr($zeile,0,strpos($zeile," =") + strlen(" = ")); - # Dopelte einträge suchen - foreach($usersyntax_array as $zeile) { - if(substr($zeile,0,strpos($zeile," =") + strlen(" = ")) == $search_tmp) { - $count++; - } - if($count > 1) { - $post['error_messages']['config_error_usersyntax_doubles']['color'] = "#FF7029"; - $post['error_messages']['config_error_usersyntax_doubles'][$search_tmp] = $search_tmp; - $error_color['usersyntax'] = ' style="background-color:#FF7029;"'; - } - } - } - } - } - if($handle = @fopen($USER_SYNTAX_FILE, "a+")) { - $test = fread($handle,filesize($USER_SYNTAX_FILE)); - fclose($handle); - # sonst kann es pasieren das filesize im cache gespeichert wird - clearstatcache(); - # nur Speichern wenn sich was geändert hat - if($test != $usersyntax_text) { - $handle = @fopen($USER_SYNTAX_FILE, "w"); - fputs($handle, $usersyntax_text); - fclose($handle); - } - } else { - $post['error_messages']['config_error_usersyntax_write'][] = NULL; - } - } - $post['messages']['config_messages_changes'][] = NULL; - } # setings end - # Anzeige begin - - if(count($language_array) <= 0) { - $post['error_messages']['config_error_language_emty'][] = NULL; - $error_color['cmslanguage'] = ' style="background-color:#FF7029;"'; - } elseif(!in_array("language_".$CMS_CONF->get('cmslanguage').".conf",$language_array)) { - $post['error_messages']['config_error_language_existed'][] = $CMS_CONF->get('cmslanguage'); - $error_color['cmslanguage'] = ' style="background-color:#FF7029;"'; - } - - if(count($cat_array) <= 0) { - $post['error_messages']['config_error_defaultcat_emty'][] = NULL; - $error_color['defaultcat'] = ' style="background-color:#FF7029;"'; - } elseif(!in_array($CMS_CONF->get('defaultcat'),$cat_array)) { - $post['error_messages']['config_error_defaultcat_existed'][] = $CMS_CONF->get('defaultcat'); - $error_color['defaultcat'] = ' style="background-color:#FF7029;"'; - } - - if(count($layout_array) <= 0) { - $post['error_messages']['config_error_layouts_emty'][] = NULL; - $error_color['cmslayout'] = ' style="background-color:#FF7029;"'; - } elseif(!in_array($CMS_CONF->get('cmslayout'),$layout_array)) { - $post['error_messages']['config_error_layouts_existed'][] = $CMS_CONF->get('cmslayout'); - $error_color['cmslayout'] = ' style="background-color:#FF7029;"'; - } - - $pagecontent .= categoriesMessages($post); -/* tooltips noch einbauen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - $array_getTooltipValue = array("admin_help_language","admin_help_adminmail","admin_help_chmodnewfiles", - "admin_help_chmodupdate"); - - # Variable erzeugen z.B. info_many_pages = $text_info_many_pages - foreach($array_getTooltipValue as $language) { - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); - } else { - ${"tooltip_".$language} = NULL; - } - }*/ - - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_config_help = 'help'; - } else { - $tooltip_config_help = 'help'; - } - - $pagecontent .= ''.getLanguageValue("config_button").''; - $pagecontent .= $tooltip_config_help; - $pagecontent .= "

".getLanguageValue("config_text")."

"; - // ALLGEMEINE EINSTELLUNGEN - $pagecontent .= ''; - // Zeile "ÜBERNEHMEN" - # Save Buttom nur Anzeigen wenn Properties auch Speichen kann - if(!isset($CMS_CONF->properties['error']) or !isset($CONTACT_CONF->properties['error'])) { - $pagecontent .= '"; - $pagecontent .= ""; - // Zeile "WEBSITE-TITEL" - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "WEBSITE-TITELLEISTE" - $titlebarsep = $specialchars->rebuildSpecialChars($CMS_CONF->get("titlebarseparator"),true,true); - $txt_websitetitle = getLanguageValue("config_input_websitetitle"); - $txt_category = getLanguageValue("category"); - $txt_page = getLanguageValue("page"); - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "TITEL-TRENNER" - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "WEBSITE-BESCHREIBUNG" - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "WEBSITE-KEYWORDS" - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "SPRACHAUSWAHL" - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "LAYOUTAUSWAHL" - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "STANDARD-KATEGORIE" - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - - if($ADMIN_CONF->get('showexpert') == "true") { - // Zeile "NUTZE SUBMENÜ" - $checked0 = ""; - $checked1 = ""; - $checked2 = ""; - if ($CMS_CONF->get("usesubmenu") == "2") { - $checked2 = " checked=\"checked\""; - } elseif ($CMS_CONF->get("usesubmenu") == "1") { - $checked1 = " checked=\"checked\""; - } else { - $checked0 = " checked=\"checked\""; - } - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - } - - // SYNTAX-EINSTELLUNGEN - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - if($ADMIN_CONF->get('showexpert') == "true") { - // Zeile "NUTZE CMS-SYNTAX" - $pagecontent .= ""; - $pagecontent .= ""; - } - // Die folgenden Einstellungen werden nur angezeigt, wenn die CMS-Syntax aktiv ist - if ($CMS_CONF->get("usecmssyntax") == "true") { - if($ADMIN_CONF->get('showexpert') == "true") { - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "LINKS KÜRZEN" - $checked0 = ""; - $checked1 = ""; - $checked2 = ""; - if ($CMS_CONF->get("shortenlinks") == "2") - $checked2 = " checked=\"checked\""; - elseif ($CMS_CONF->get("shortenlinks") == "1") - $checked1 = " checked=\"checked\""; - else - $checked0 = " checked=\"checked\""; - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - } - - // Zeile "BENUTZERDEFINIERTE SYNTAX-ELEMENTE" - $usersyntaxdefs = ""; - $handle = @fopen($USER_SYNTAX_FILE, "r"); - $usersyntaxdefs = @fread($handle, @filesize($USER_SYNTAX_FILE)); - @fclose($handle); - # die textarea wandelt automatisch & nach & deshalb &amp; - $usersyntaxdefs = str_replace("&","&",$usersyntaxdefs); - $pagecontent .= ""; - $pagecontent .= ""; - // Zeile "ERSETZE EMOTICONS" - if($ADMIN_CONF->get('showexpert') == "true") { - $pagecontent .= ""; - $pagecontent .= ""; - $pagecontent .= ""; - } - } -/* - // KONTAKTFORMULAR-EINSTELLUNGEN formularmail - $pagecontent .= ""; - $pagecontent .= ''; - $pagecontent .= ""; - $pagecontent .= '"; - $pagecontent .= ''; - $pagecontent .= '"; - $pagecontent .= ''; - $pagecontent .= '"; - $pagecontent .= ''; - // Zeile "ANGEZEIGTE FELDER / PFLICHTFELDER" - $config_name = explode(",", ($CONTACT_CONF->get("name"))); - $config_mail = explode(",", ($CONTACT_CONF->get("mail"))); - $config_website = explode(",", ($CONTACT_CONF->get("website"))); - $config_message = explode(",", ($CONTACT_CONF->get("message"))); - $pagecontent .= '' - .'"; - $pagecontent .= ""; -*/ - if($ADMIN_CONF->get('showexpert') == "true") { - $pagecontent .= ''; - // Zeile "showhiddenpagesin" - $pagecontent .= ''; - $pagecontent .= ''; - // Zeile "Links öffnen self blank" - $pagecontent .= ''; - $pagecontent .= ''; - // Zeile "wenn page == cat" - $pagecontent .= ''; - $pagecontent .= ''; - // Zeile "mod_rewrite" - $pagecontent .= ''; - $pagecontent .= ''; - // Zeile "showsyntaxtooltips" - $pagecontent .= ''; - $pagecontent .= ''; - } - // Zeile "ÜBERNEHMEN" - # Save Buttom nur Anzeigen wenn Properties auch Speichen kann - if(!isset($CMS_CONF->properties['error']) or !isset($CONTACT_CONF->properties['error'])) { - $pagecontent .= '
'; - $pagecontent .= ''; - } - $pagecontent .= "
".getLanguageValue("config_titel_cmsglobal"); - $pagecontent .= "
".getLanguageValue("config_text_websitetitle")."rebuildSpecialChars($CMS_CONF->get("websitetitle"),true,true)."\"".$error_color['websitetitle']." />
".getLanguageValue("config_text_websitetitlebar")."
".getLanguageValue("config_text_websitetitleseparator")."rebuildSpecialChars($CMS_CONF->get("titlebarseparator"),true,true)."\"".$error_color['titlebarseparator']." />
".getLanguageValue("config_text_websitedescription")."rebuildSpecialChars($CMS_CONF->get("websitedescription"),true,true)."\"".$error_color['websitedescription']." />
".getLanguageValue("config_text_websitekeywords")."rebuildSpecialChars($CMS_CONF->get("websitekeywords"),true,true)."\"".$error_color['websitekeywords']." />
".getLanguageValue("config_text_cmslanguage")."
".getLanguageValue("config_text_cmslayout")."
".getLanguageValue("config_text_defaultcat").""; - $pagecontent .= "
".getLanguageValue("config_text_usesubmenu").""; - $pagecontent .= "".getLanguageValue("config_input_usesubmenu_1")."
"; - $pagecontent .= "".getLanguageValue("config_input_usesubmenu_2")."
"; - $pagecontent .= "".getLanguageValue("config_input_usesubmenu_3")."
"; - $pagecontent .= "
".getLanguageValue("config_titel_cmssyntax")."
".getLanguageValue("config_text_usesyntax")."" - .buildCheckBox("usecmssyntax", $CMS_CONF->get("usecmssyntax")) - .getLanguageValue("config_input_usesyntax"); - $pagecontent .= "
".getLanguageValue("config_text_editarea")."" - .buildCheckBox("usecmseditarea", $CMS_CONF->get("usecmseditarea")); - $pagecontent .= "
".getLanguageValue("config_text_syntaxshortenlinks").""; - $pagecontent .= "http://www.domain.com
"; - $pagecontent .= "www.domain.com
"; - $pagecontent .= "domain.com
"; - $pagecontent .= "
".getLanguageValue("config_text_usersyntax")."
".getLanguageValue("config_text_replaceemoticons")."" - .buildCheckBox("replaceemoticons", ($CMS_CONF->get("replaceemoticons") == "true")) - .getLanguageValue("config_input_replaceemoticons")."
'.getLanguageValue("config_titel_contact").'
'.getLanguageValue("config_text_formularmail")." -
'.getLanguageValue("config_text_contactformwaittime")." -
'.getLanguageValue("config_text_contactformusespamprotection")."'.buildCheckBox("contactformusespamprotection", ($CONTACT_CONF->get("contactformusespamprotection") == "true")).'
'.getLanguageValue("config_text_contact").'
' - .'' - .'' - .'' - .'' - .'' - .'' - .'' - .'' - .'' - ."
'.getLanguageValue("config_titel_contact_help").''.getLanguageValue("config_titel_contact_input").''.getLanguageValue("config_titel_contact_show").''.getLanguageValue("config_titel_contact_mandatory").'
'.getLanguageValue("config_input_contact_name").''.buildCheckBox("show_name", ($config_name[1] == "true")).''.buildCheckBox("mandatory_name", ($config_name[2] == "true")).'
'.getLanguageValue("config_input_contact_mail").''.buildCheckBox("show_mail", ($config_mail[1] == "true")).''.buildCheckBox("mandatory_mail", ($config_mail[2] == "true")).'
'.getLanguageValue("config_input_contact_website").''.buildCheckBox("show_website", ($config_website[1] == "true")).''.buildCheckBox("mandatory_website", ($config_website[2] == "true")).'
'.getLanguageValue("config_input_contact_textarea").''.buildCheckBox("show_message", ($config_message[1] == "true")).''.buildCheckBox("mandatory_message", ($config_message[2] == "true")).'
'.getLanguageValue("config_titel_expert").'
'.getLanguageValue("config_text_showhiddenpages").'' - // Obsolet seit 1.12 - //.buildCheckBox("showhiddenpagesinlastchanged", ($CMS_CONF->get("showhiddenpagesinlastchanged") == "true")).getLanguageValue("config_input_lastchanged").'
' - .buildCheckBox("showhiddenpagesinsearch", ($CMS_CONF->get("showhiddenpagesinsearch") == "true")).getLanguageValue("config_input_search").'
' - .buildCheckBox("showhiddenpagesinsitemap", ($CMS_CONF->get("showhiddenpagesinsitemap") == "true")).getLanguageValue("config_input_sitemap").'
' - .buildCheckBox("showhiddenpagesasdefaultpage", ($CMS_CONF->get("showhiddenpagesasdefaultpage") == "true")).getLanguageValue("config_input_pagesasdefaultpage").'
' - .buildCheckBox("showhiddenpagesincmsvariables", ($CMS_CONF->get("showhiddenpagesincmsvariables") == "true")).getLanguageValue("config_input_pagesincmsvariables").'
'.getLanguageValue("config_text_target").''.buildCheckBox("targetblank_download", ($CMS_CONF->get("targetblank_download") == "true")).getLanguageValue("config_input_download").'
'.buildCheckBox("targetblank_link", ($CMS_CONF->get("targetblank_link") == "true")).getLanguageValue("config_input_link").'
'.getLanguageValue("config_text_catnamedpages").''.buildCheckBox("hidecatnamedpages", ($CMS_CONF->get("hidecatnamedpages") == "true")).getLanguageValue("config_input_catnamedpages").'
'.getLanguageValue("config_text_modrewrite").''.buildCheckBox("modrewrite", ($CMS_CONF->get("modrewrite") == "true")).getLanguageValue("config_input_modrewrite").'
'.getLanguageValue("config_text_showsyntaxtooltips").''.buildCheckBox("showsyntaxtooltips", ($CMS_CONF->get("showsyntaxtooltips") == "true")).getLanguageValue("config_input_showsyntaxtooltips").'
'; - $pagecontent .= ''; - } - - $pagecontent .= "
"; - - return array(getLanguageValue("config_button"), $pagecontent); + global $CMS_CONF; + global $specialchars; + global $USER_SYNTAX_FILE; + global $CONTACT_CONF; + global $ADMIN_CONF; + global $icon_size; + + $main = makeDefaultConf("main"); + + // error colors für die input felder vorbereiten vom main array,usersyntax und input_mail array + foreach ($main as $type => $type_array) { + if ($type == 'expert') + continue; + foreach ($main [$type] as $syntax_name => $dumy) { + $error_color [$syntax_name] = NULL; + } + } + $error_color ['usersyntax'] = NULL; + /* + * $input_mail = makeDefaultConf("formular"); + * $error_color['formularmail'] = NULL; + * $error_color['contactformwaittime'] = NULL; + * foreach($input_mail as $syntax_name => $dumy) { + * if($syntax_name == 'formularmail') continue; + * $error_color['titel_'.$syntax_name] = NULL; + * } + */ + $language_array = getDirAsArray(BASE_DIR_CMS . 'sprachen', "file", "natcasesort"); + $cat_array = getDirAsArray(CONTENT_DIR_REL, "dir", "natcasesort"); + $layout_array = getDirAsArray(BASE_DIR . "layouts", "dir", "natcasesort"); + + $pagecontent = ''; + + if (isset($post ['apply'])) { + $post ['apply'] = $specialchars->rebuildSpecialChars(getRequestParam('apply', true), false, true); + } + + // Änderungen speichern + if (isset($post ['apply']) and $post ['apply'] == getLanguageValue("config_submit")) { + + // nur wenns auch Layouts gibt + if (count($layout_array) > 0) { + // wens ein neues layout ist setings aus der layoutsettings hollen und schreiben + if ($CMS_CONF->get('cmslayout') != $specialchars->replaceSpecialChars($post ['cmslayout'], false)) { + $error = setLayoutAndDependentSettings($specialchars->replaceSpecialChars($post ['cmslayout'], false)); + if (is_array($error)) { + $post ['error_messages'] ['properties'] [] = $error ['error']; + $error_color ['cmslayout'] = ' style="background-color:#FF7029;"'; + // damits nicht gespeichert wird + unset($post ['cmslayout'], $post ['usesubmenu']); + } else { + $post ['usesubmenu'] = $error; + } + } + } + + // usecmssyntax wurde eingeschaltet also posts füllen + if (isset($post ['usecmssyntax']) and $post ['usecmssyntax'] == "true" and $CMS_CONF->get('usecmssyntax') == "false") { + $post ['usecmseditarea'] = $CMS_CONF->get('usecmseditarea'); + $post ['replaceemoticons'] = $CMS_CONF->get('replaceemoticons'); + $post ['shortenlinks'] = $CMS_CONF->get('shortenlinks'); + } + // usecmssyntax ist ausgeschaltet also posts füllen + if ($CMS_CONF->get('usecmssyntax') == "false") { + $post ['replaceemoticons'] = $CMS_CONF->get('replaceemoticons'); + } + + foreach ($main as $type => $type_array) { + if ($type == 'expert') + continue; + foreach ($main [$type] as $syntax_name => $dumy) { + $error_messages = false; + if ($ADMIN_CONF->get('showexpert') == "false" and in_array($syntax_name, $main ['expert'])) { + continue; + } + if ($type == 'text') { + if (isset($post [$syntax_name])) { + $text = $specialchars->replaceSpecialChars($post [$syntax_name], false); + } else + continue; + if ($error_messages === false and $CMS_CONF->get($syntax_name) != $text) { + $CMS_CONF->set($syntax_name, $text); + } + } + if ($type == 'select') { + if (isset($post [$syntax_name])) { // wenn select lehr ist post lehr ja + $select = $specialchars->replaceSpecialChars($post [$syntax_name], false); + } else + continue; + if ($error_messages === false and $CMS_CONF->get($syntax_name) != $select) { + $CMS_CONF->set($syntax_name, $select); + } + } + if ($type == 'checkbox') { + $checkbox = "false"; + if (isset($post [$syntax_name])) { + $checkbox = $post [$syntax_name]; + } + if ($syntax_name == "modrewrite" and !isset($_REQUEST ['link']) and isset($post [$syntax_name]) and $post [$syntax_name] == "true") { + $checkbox = "false"; + $post ['error_messages'] ['config_error_modrewrite'] [] = NULL; + } + if ($error_messages === false and $CMS_CONF->get($syntax_name) != $checkbox) { + $CMS_CONF->set($syntax_name, $checkbox); + } + } + } + } + // Mail daten speichern + /* + * foreach($input_mail as $syntax_name => $dumy) { + * if($syntax_name == "contactformwaittime") { + * # wenn eingabe keine Zahl oder mehr wie 4stelig ist + * if(!ctype_digit($post[$syntax_name]) or strlen($post[$syntax_name]) > 4) { + * $post['error_messages']['config_error_nodigit_tolong']['color'] = "#FF7029"; + * $error_color['contactformwaittime'] = ' style="background-color:#FF7029;"'; + * } else { + * $CONTACT_CONF->set($syntax_name, $post[$syntax_name]); + * } + * continue; + * } + * if($syntax_name == "contactformusespamprotection") { + * $checkbox = "false"; + * if(isset($post[$syntax_name])) { + * $checkbox = $post[$syntax_name]; + * } + * if($CONTACT_CONF->get($syntax_name) != $checkbox) { + * $CONTACT_CONF->set($syntax_name, $checkbox); + * } + * continue; + * } + * if($syntax_name == "formularmail") { + * if($post[$syntax_name] != "" and !preg_match("/^.+@.+\..+$/",$post[$syntax_name])) { + * $post['error_messages']['config_error_formularmail']['color'] = "#FF7029"; + * $error_color['formularmail'] = ' style="background-color:#FF7029;"'; + * $error_messages = $syntax_name; + * } else { + * $CONTACT_CONF->set($syntax_name,$post[$syntax_name]); + * } + * continue; + * } + * $mail_titel = $specialchars->replaceSpecialChars($post['titel_'.$syntax_name],false); + * $CONTACT_CONF->set($syntax_name, $mail_titel.",".checkBoxChecked('show_'.$syntax_name).",".checkBoxChecked('mandatory_'.$syntax_name)); + * } + */ + // Speichern der benutzerdefinierten Syntaxelemente -> ERWEITERN UM PRÜFUNG! + // nur Speichern wenn auch benutzt wird + if ($CMS_CONF->get('usecmssyntax') == "true") { + // usecmssyntax wurde eingeschaltet aus syntax.conf lesen + if (!isset($post ['usersyntax'])) { + $usersyntax_array = file($USER_SYNTAX_FILE); + } else { + $usersyntax_array = preg_split("/\r\n|\r|\n/", $post ['usersyntax']); + } + $usersyntax_text = NULL; + foreach ($usersyntax_array as $zeile) { + $zeile = trim($zeile); + if (!empty($zeile)) { + $usersyntax_text .= $zeile . "\n"; + // in jeder zeile muss " =" enthalten sein sonst Fehler + if (!strstr($zeile, " =") !== false) { + $post ['error_messages'] ['config_error_usersyntax'] ['color'] = "#FF7029"; + $post ['error_messages'] ['config_error_usersyntax'] [] = $zeile; + $error_color ['usersyntax'] = ' style="background-color:#FF7029;"'; + } else { + $count = 0; + $search_tmp = substr($zeile, 0, strpos($zeile, " =") + strlen(" = ")); + // Dopelte einträge suchen + foreach ($usersyntax_array as $zeile) { + if (substr($zeile, 0, strpos($zeile, " =") + strlen(" = ")) == $search_tmp) { + $count++; + } + if ($count > 1) { + $post ['error_messages'] ['config_error_usersyntax_doubles'] ['color'] = "#FF7029"; + $post ['error_messages'] ['config_error_usersyntax_doubles'] [$search_tmp] = $search_tmp; + $error_color ['usersyntax'] = ' style="background-color:#FF7029;"'; + } + } + } + } + } + if ($handle = @fopen($USER_SYNTAX_FILE, "a+")) { + $test = fread($handle, filesize($USER_SYNTAX_FILE)); + fclose($handle); + // sonst kann es pasieren das filesize im cache gespeichert wird + clearstatcache(); + // nur Speichern wenn sich was geändert hat + if ($test != $usersyntax_text) { + $handle = @fopen($USER_SYNTAX_FILE, "w"); + fputs($handle, $usersyntax_text); + fclose($handle); + } + } else { + $post ['error_messages'] ['config_error_usersyntax_write'] [] = NULL; + } + } + $post ['messages'] ['config_messages_changes'] [] = NULL; + } // setings end + // Anzeige begin + + if (count($language_array) <= 0) { + $post ['error_messages'] ['config_error_language_emty'] [] = NULL; + $error_color ['cmslanguage'] = ' style="background-color:#FF7029;"'; + } elseif (!in_array("language_" . $CMS_CONF->get('cmslanguage') . ".conf", $language_array)) { + $post ['error_messages'] ['config_error_language_existed'] [] = $CMS_CONF->get('cmslanguage'); + $error_color ['cmslanguage'] = ' style="background-color:#FF7029;"'; + } + + if (count($cat_array) <= 0) { + $post ['error_messages'] ['config_error_defaultcat_emty'] [] = NULL; + $error_color ['defaultcat'] = ' style="background-color:#FF7029;"'; + } elseif (!in_array($CMS_CONF->get('defaultcat'), $cat_array)) { + $post ['error_messages'] ['config_error_defaultcat_existed'] [] = $CMS_CONF->get('defaultcat'); + $error_color ['defaultcat'] = ' style="background-color:#FF7029;"'; + } + + if (count($layout_array) <= 0) { + $post ['error_messages'] ['config_error_layouts_emty'] [] = NULL; + $error_color ['cmslayout'] = ' style="background-color:#FF7029;"'; + } elseif (!in_array($CMS_CONF->get('cmslayout'), $layout_array)) { + $post ['error_messages'] ['config_error_layouts_existed'] [] = $CMS_CONF->get('cmslayout'); + $error_color ['cmslayout'] = ' style="background-color:#FF7029;"'; + } + + $pagecontent .= categoriesMessages($post); + /* + * tooltips noch einbauen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * $array_getTooltipValue = array("admin_help_language","admin_help_adminmail","admin_help_chmodnewfiles", + * "admin_help_chmodupdate"); + * + * # Variable erzeugen z.B. info_many_pages = $text_info_many_pages + * foreach($array_getTooltipValue as $language) { + * if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + * ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); + * } else { + * ${"tooltip_".$language} = NULL; + * } + * } + */ + + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_config_help = 'help'; + } else { + $tooltip_config_help = 'help'; + } + + $pagecontent .= '' . getLanguageValue("config_button") . ''; + $pagecontent .= $tooltip_config_help; + $pagecontent .= "

" . getLanguageValue("config_text") . "

"; + // ALLGEMEINE EINSTELLUNGEN + $pagecontent .= ''; + // Zeile "ÜBERNEHMEN" + // Save Buttom nur Anzeigen wenn Properties auch Speichen kann + if (!isset($CMS_CONF->properties ['error']) or !isset($CONTACT_CONF->properties ['error'])) { + $pagecontent .= '"; + $pagecontent .= ""; + // Zeile "WEBSITE-TITEL" + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "WEBSITE-TITELLEISTE" + $titlebarsep = $specialchars->rebuildSpecialChars($CMS_CONF->get("titlebarseparator"), true, true); + $txt_websitetitle = getLanguageValue("config_input_websitetitle"); + $txt_category = getLanguageValue("category"); + $txt_page = getLanguageValue("page"); + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "TITEL-TRENNER" + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "WEBSITE-BESCHREIBUNG" + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "WEBSITE-KEYWORDS" + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "SPRACHAUSWAHL" + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "LAYOUTAUSWAHL" + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "STANDARD-KATEGORIE" + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + + if ($ADMIN_CONF->get('showexpert') == "true") { + // Zeile "NUTZE SUBMENÜ" + $checked0 = ""; + $checked1 = ""; + $checked2 = ""; + if ($CMS_CONF->get("usesubmenu") == "2") { + $checked2 = " checked=\"checked\""; + } elseif ($CMS_CONF->get("usesubmenu") == "1") { + $checked1 = " checked=\"checked\""; + } else { + $checked0 = " checked=\"checked\""; + } + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + } + + // SYNTAX-EINSTELLUNGEN + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + if ($ADMIN_CONF->get('showexpert') == "true") { + // Zeile "NUTZE CMS-SYNTAX" + $pagecontent .= ""; + $pagecontent .= ""; + } + // Die folgenden Einstellungen werden nur angezeigt, wenn die CMS-Syntax aktiv ist + if ($CMS_CONF->get("usecmssyntax") == "true") { + if ($ADMIN_CONF->get('showexpert') == "true") { + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "LINKS KÜRZEN" + $checked0 = ""; + $checked1 = ""; + $checked2 = ""; + if ($CMS_CONF->get("shortenlinks") == "2") + $checked2 = " checked=\"checked\""; + elseif ($CMS_CONF->get("shortenlinks") == "1") + $checked1 = " checked=\"checked\""; + else + $checked0 = " checked=\"checked\""; + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + } + + // Zeile "BENUTZERDEFINIERTE SYNTAX-ELEMENTE" + $usersyntaxdefs = ""; + $handle = @fopen($USER_SYNTAX_FILE, "r"); + $usersyntaxdefs = @fread($handle, @filesize($USER_SYNTAX_FILE)); + @fclose($handle); + // die textarea wandelt automatisch & nach & deshalb &amp; + $usersyntaxdefs = str_replace("&", "&", $usersyntaxdefs); + $pagecontent .= ""; + $pagecontent .= ""; + // Zeile "ERSETZE EMOTICONS" + if ($ADMIN_CONF->get('showexpert') == "true") { + $pagecontent .= ""; + $pagecontent .= ""; + $pagecontent .= ""; + } + } + /* + * // KONTAKTFORMULAR-EINSTELLUNGEN formularmail + * $pagecontent .= ""; + * $pagecontent .= ''; + * $pagecontent .= ""; + * $pagecontent .= '"; + * $pagecontent .= ''; + * $pagecontent .= '"; + * $pagecontent .= ''; + * $pagecontent .= '"; + * $pagecontent .= ''; + * // Zeile "ANGEZEIGTE FELDER / PFLICHTFELDER" + * $config_name = explode(",", ($CONTACT_CONF->get("name"))); + * $config_mail = explode(",", ($CONTACT_CONF->get("mail"))); + * $config_website = explode(",", ($CONTACT_CONF->get("website"))); + * $config_message = explode(",", ($CONTACT_CONF->get("message"))); + * $pagecontent .= '' + * .'"; + * $pagecontent .= ""; + */ + if ($ADMIN_CONF->get('showexpert') == "true") { + $pagecontent .= ''; + // Zeile "showhiddenpagesin" + $pagecontent .= ''; + $pagecontent .= ''; + // Zeile "Links öffnen self blank" + $pagecontent .= ''; + $pagecontent .= ''; + // Zeile "wenn page == cat" + $pagecontent .= ''; + $pagecontent .= ''; + // Zeile "mod_rewrite" + $pagecontent .= ''; + $pagecontent .= ''; + // Zeile "showsyntaxtooltips" + $pagecontent .= ''; + $pagecontent .= ''; + } + // Zeile "ÜBERNEHMEN" + // Save Buttom nur Anzeigen wenn Properties auch Speichen kann + if (!isset($CMS_CONF->properties ['error']) or !isset($CONTACT_CONF->properties ['error'])) { + $pagecontent .= '
'; + $pagecontent .= ''; + } + $pagecontent .= "
" . getLanguageValue("config_titel_cmsglobal"); + $pagecontent .= "
" . getLanguageValue("config_text_websitetitle") . "rebuildSpecialChars($CMS_CONF->get("websitetitle"), true, true) . "\"" . $error_color ['websitetitle'] . " />
" . getLanguageValue("config_text_websitetitlebar") . "
" . getLanguageValue("config_text_websitetitleseparator") . "rebuildSpecialChars($CMS_CONF->get("titlebarseparator"), true, true) . "\"" . $error_color ['titlebarseparator'] . " />
" . getLanguageValue("config_text_websitedescription") . "rebuildSpecialChars($CMS_CONF->get("websitedescription"), true, true) . "\"" . $error_color ['websitedescription'] . " />
" . getLanguageValue("config_text_websitekeywords") . "rebuildSpecialChars($CMS_CONF->get("websitekeywords"), true, true) . "\"" . $error_color ['websitekeywords'] . " />
" . getLanguageValue("config_text_cmslanguage") . "
" . getLanguageValue("config_text_cmslayout") . "
" . getLanguageValue("config_text_defaultcat") . ""; + $pagecontent .= "
" . getLanguageValue("config_text_usesubmenu") . ""; + $pagecontent .= "" . getLanguageValue("config_input_usesubmenu_1") . "
"; + $pagecontent .= "" . getLanguageValue("config_input_usesubmenu_2") . "
"; + $pagecontent .= "" . getLanguageValue("config_input_usesubmenu_3") . "
"; + $pagecontent .= "
" . getLanguageValue("config_titel_cmssyntax") . "
" . getLanguageValue("config_text_usesyntax") . "" . buildCheckBox("usecmssyntax", $CMS_CONF->get("usecmssyntax")) . getLanguageValue("config_input_usesyntax"); + $pagecontent .= "
" . getLanguageValue("config_text_editarea") . "" . buildCheckBox("usecmseditarea", $CMS_CONF->get("usecmseditarea")); + $pagecontent .= "
" . getLanguageValue("config_text_syntaxshortenlinks") . ""; + $pagecontent .= "http://www.domain.com
"; + $pagecontent .= "www.domain.com
"; + $pagecontent .= "domain.com
"; + $pagecontent .= "
" . getLanguageValue("config_text_usersyntax") . "
" . getLanguageValue("config_text_replaceemoticons") . "" . buildCheckBox("replaceemoticons", ($CMS_CONF->get("replaceemoticons") == "true")) . getLanguageValue("config_input_replaceemoticons") . "
'.getLanguageValue("config_titel_contact").'
'.getLanguageValue("config_text_formularmail")." + *
'.getLanguageValue("config_text_contactformwaittime")." + *
'.getLanguageValue("config_text_contactformusespamprotection")."'.buildCheckBox("contactformusespamprotection", ($CONTACT_CONF->get("contactformusespamprotection") == "true")).'
'.getLanguageValue("config_text_contact").'
' + * .'' + * .'' + * .'' + * .'' + * .'' + * .'' + * .'' + * .'' + * .'' + * ."
'.getLanguageValue("config_titel_contact_help").''.getLanguageValue("config_titel_contact_input").''.getLanguageValue("config_titel_contact_show").''.getLanguageValue("config_titel_contact_mandatory").'
'.getLanguageValue("config_input_contact_name").''.buildCheckBox("show_name", ($config_name[1] == "true")).''.buildCheckBox("mandatory_name", ($config_name[2] == "true")).'
'.getLanguageValue("config_input_contact_mail").''.buildCheckBox("show_mail", ($config_mail[1] == "true")).''.buildCheckBox("mandatory_mail", ($config_mail[2] == "true")).'
'.getLanguageValue("config_input_contact_website").''.buildCheckBox("show_website", ($config_website[1] == "true")).''.buildCheckBox("mandatory_website", ($config_website[2] == "true")).'
'.getLanguageValue("config_input_contact_textarea").''.buildCheckBox("show_message", ($config_message[1] == "true")).''.buildCheckBox("mandatory_message", ($config_message[2] == "true")).'
' . getLanguageValue("config_titel_expert") . '
' . getLanguageValue("config_text_showhiddenpages") . '' . + // Obsolet seit 1.12 + // .buildCheckBox("showhiddenpagesinlastchanged", ($CMS_CONF->get("showhiddenpagesinlastchanged") == "true")).getLanguageValue("config_input_lastchanged").'
' + buildCheckBox("showhiddenpagesinsearch", ($CMS_CONF->get("showhiddenpagesinsearch") == "true")) . getLanguageValue("config_input_search") . '
' . buildCheckBox("showhiddenpagesinsitemap", ($CMS_CONF->get("showhiddenpagesinsitemap") == "true")) . getLanguageValue("config_input_sitemap") . '
' . buildCheckBox("showhiddenpagesasdefaultpage", ($CMS_CONF->get("showhiddenpagesasdefaultpage") == "true")) . getLanguageValue("config_input_pagesasdefaultpage") . '
' . buildCheckBox("showhiddenpagesincmsvariables", ($CMS_CONF->get("showhiddenpagesincmsvariables") == "true")) . getLanguageValue("config_input_pagesincmsvariables") . '
' . getLanguageValue("config_text_target") . '' . buildCheckBox("targetblank_download", ($CMS_CONF->get("targetblank_download") == "true")) . getLanguageValue("config_input_download") . '
' . buildCheckBox("targetblank_link", ($CMS_CONF->get("targetblank_link") == "true")) . getLanguageValue("config_input_link") . '
' . getLanguageValue("config_text_catnamedpages") . '' . buildCheckBox("hidecatnamedpages", ($CMS_CONF->get("hidecatnamedpages") == "true")) . getLanguageValue("config_input_catnamedpages") . '
' . getLanguageValue("config_text_modrewrite") . '' . buildCheckBox("modrewrite", ($CMS_CONF->get("modrewrite") == "true")) . getLanguageValue("config_input_modrewrite") . '
' . getLanguageValue("config_text_showsyntaxtooltips") . '' . buildCheckBox("showsyntaxtooltips", ($CMS_CONF->get("showsyntaxtooltips") == "true")) . getLanguageValue("config_input_showsyntaxtooltips") . '
'; + $pagecontent .= ''; + } + + $pagecontent .= "
"; + + return array( + getLanguageValue("config_button"), + $pagecontent + ); } function admin($post) { - global $ADMIN_CONF; - global $LOGINCONF; - global $CMS_CONF; - global $specialchars; - global $icon_size; - - $basic = makeDefaultConf("basic"); - - # error colors für die input felder vorbereiten - foreach($basic as $type => $type_array) { - if($type == 'expert') continue; - foreach($basic[$type] as $syntax_name => $dumy) { - $error_color[$syntax_name] = NULL; - } - } - - $error_color['newname'] = NULL; - $error_color['newpw'] = NULL; - $error_color['newpwrepeat'] = NULL; - // Änderungen gespeichert - $changesmade = false; - - $pagecontent = ''; - - $error_color['language'] = NULL; - $language_array = getDirAsArray(BASE_DIR_ADMIN.'sprachen',"file","natcasesort"); - if(count($language_array) <= 0) { - $post['error_messages']['admin_error_language_emty'][] = NULL; - $error_color['language'] = ' style="background-color:#FF7029;"'; - } elseif(!in_array("language_".$ADMIN_CONF->get('language').".conf",$language_array)) { - $post['error_messages']['admin_error_languagefile_error'][] = $ADMIN_CONF->get('language'); - $error_color['language'] = ' style="background-color:#FF7029;"'; - } - - if(isset($ADMIN_CONF->properties['error'])) { - $post['apply'] = "false"; - $post['error_messages']['properties'][] = $ADMIN_CONF->properties['error']; - } - - if(isset($post['apply'])) { - $post['apply'] = $specialchars->rebuildSpecialChars($post['apply'], false, true); - } - - if(isset($post['apply']) and $post['apply'] == getLanguageValue("admin_submit") and isset($post['default'])) { -# makeDefaultConf("conf/basic.conf"); - $post['apply'] = "false"; - } - - if(isset($post['default_pw']) and $specialchars->rebuildSpecialChars($post['default_pw'], false, true) == getLanguageValue("admin_submit_default_pw")) { - $LOGINCONF->set("initialsetup", "false"); - } - - if($LOGINCONF->get("initialsetup") == "true") { - $post['messages']['initialsetup'][] = NULL; - if(strpos("tmp".$_SERVER['QUERY_STRING'],"action") > 0) { - $post['error_messages']['initialsetup_error'][] = NULL; - } - } - - // Auswertung des Formulars - if(isset($post['apply']) and $post['apply'] == getLanguageValue("admin_submit")) { - - # auf jeden fall erst mal deDE setzen ist blöd wenn kein language gesetzt ist - $ADMIN_CONF->set('language', "deDE"); - if(count($language_array) > 0) { - $ADMIN_CONF->set('language', $post['language']); - } - - # wenn expert eingeschaltet wird müssen die expert $post gefüllt werden - if(checkBoxChecked('showexpert') == "true" and $ADMIN_CONF->get('showexpert') == "false") { - foreach($basic['expert'] as $syntax) { - if($syntax == 'lastbackup' or $syntax == 'usebigactionicons') { - continue; - } - $post[$syntax] = $ADMIN_CONF->get($syntax); - } - } - - - - foreach($basic as $type => $type_array) { - if($type == 'expert') continue; - foreach($basic[$type] as $syntax_name => $dumy) { - $error_messages = false; - if(checkBoxChecked('showexpert') == "false" and in_array($syntax_name,$basic['expert'])) { - continue; - } - if($type == 'text') { - if(isset($post[$syntax_name])) { - $text = $post[$syntax_name]; - } else continue; - if($syntax_name == 'adminmail' and $text != "" and !preg_match("/^.+@.+\..+$/",$text)) { - $error_messages = $syntax_name; - } - if($error_messages === false and $ADMIN_CONF->get($syntax_name) != $text) { - if($syntax_name == 'adminmail') { - $ADMIN_CONF->set($syntax_name, $text); - } else { - $ADMIN_CONF->set($syntax_name, $specialchars->replaceSpecialChars($text,false)); - } - } - - } - if($type == 'digit') { - if($syntax_name == 'lastbackup') { - continue; - } - if(isset($post[$syntax_name])) { - $digit = trim($post[$syntax_name]); - } else continue; - # wenn eingabe keine Zahl oder mehr wie 4stelig ist - if($digit != "" and (!ctype_digit($digit) or strlen($digit) > 4)) { - $error_messages = 'nodigit_tolong'; - } elseif($syntax_name == 'chmodnewfilesatts' and !empty($digit) and !preg_match("/^[0-7]{3}$/",$digit)) { - $error_messages = $syntax_name; - } elseif($syntax_name == 'textareaheight' and $digit < 50) { - $error_messages = $syntax_name; - } elseif($syntax_name == 'maxnumberofuploadfiles' and $digit < 1) { - $error_messages = $syntax_name; - } elseif($syntax_name == 'backupmsgintervall' and ($digit < 0 or $digit == "")) { - $error_messages = $syntax_name; - } - - if($error_messages === false and $ADMIN_CONF->get($syntax_name) != $digit) { - $ADMIN_CONF->set($syntax_name, $digit); - } - } - if($type == 'checkbox') { - - $checkbox = "false"; - if(isset($post[$syntax_name])) { - $checkbox = $post[$syntax_name]; - } - if($syntax_name == 'sendadminmail' and $checkbox == "true" and $post['adminmail'] == "") { - $error_messages = $syntax_name; - } - - if($error_messages === false and $ADMIN_CONF->get($syntax_name) != $checkbox) { - $ADMIN_CONF->set($syntax_name, $checkbox); - } - } - if($error_messages !== false) { - $post['error_messages']['admin_error_'.$syntax_name]['color'] = "#FF7029"; - $post['error_messages']['admin_error_'.$syntax_name][] = NULL; - $error_color[$syntax_name] = ' style="background-color:#FF7029;"'; - } - } - } - - if(checkBoxChecked('chmodupdate') == "true" and $ADMIN_CONF->get('chmodnewfilesatts') != "") { - $error = useChmod(); - if(!empty($error)) { - $post['error_messages'] = $error; - } - } - - require_once(BASE_DIR_ADMIN."Crypt.php"); - $pwcrypt = new Crypt(); - if($post['newpw'] != "" and $pwcrypt->encrypt($post['newpw']) != $LOGINCONF->get("pw")) { - if (($post['newname'] == "" ) or ($post['newpw'] == "" ) or ($post['newpwrepeat'] == "" )) { - $post['error_messages']['pw_error_missingvalues']['color'] = "#FF7029"; - $post['error_messages']['pw_error_missingvalues'][] = NULL; - $error_color['newname'] = ' style="background-color:#FF7029;"'; - $error_color['newpw'] = ' style="background-color:#FF7029;"'; - $error_color['newpwrepeat'] = ' style="background-color:#FF7029;"'; - } elseif(strlen($post['newname']) < 5) { - $post['error_messages']['pw_error_tooshortname']['color'] = "#FF7029"; - $post['error_messages']['pw_error_tooshortname'][] = NULL; - $error_color['newname'] = ' style="background-color:#FF7029;"'; - // Neues Paßwort zweimal exakt gleich eingegeben? - } elseif ($post['newpw'] != $post['newpwrepeat']) { - $post['error_messages']['pw_error_newpwmismatch']['color'] = "#FF7029"; - $post['error_messages']['pw_error_newpwmismatch'][] = NULL; - $error_color['newpw'] = ' style="background-color:#FF7029;"'; - $error_color['newpwrepeat'] = ' style="background-color:#FF7029;"'; - // Neues Paßwort wenigstens sechs Zeichen lang und mindestens aus kleinen und großen Buchstaben sowie Zahlen bestehend? - } elseif ((strlen($post['newpw']) < 6) or !preg_match("/[0-9]/", $post['newpw']) or !preg_match("/[a-z]/", $post['newpw']) or !preg_match("/[A-Z]/", $post['newpw'])) { - $post['error_messages']['pw_error_newpwerror']['color'] = "#FF7029"; - $post['error_messages']['pw_error_newpwerror'][] = NULL; - $error_color['newpw'] = ' style="background-color:#FF7029;"'; - # Allles gut Speichen - } else { - # initialsetub sachen speichern - $LOGINCONF->set("initialsetup", "false"); - $LOGINCONF->set("initialpw", "false"); - $ADMIN_CONF->set('lastbackup', time()); - $LOGINCONF->set("name", $post['newname']); - $LOGINCONF->set("pw", $pwcrypt->encrypt($post['newpw'])); - $post['messages']['pw_messages_changes'][] = NULL; - } - } - - if($LOGINCONF->get('initialsetup') == "false") { - $post['messages']['admin_messages_changes'][] = NULL; - } else { - $post['error_messages']['admin_error_initialsetup'][] = NULL; - } - - - } #applay end - - # Anzeige begin - $pagecontent .= categoriesMessages($post); - - $array_getTooltipValue = array("admin_help_language","admin_help_adminmail","admin_help_chmodnewfiles", - "admin_help_chmodupdate"); - - # Variable erzeugen z.B. pages = $text_pages - foreach($array_getTooltipValue as $language) { - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - ${"tooltip_".$language} = createTooltipWZ("",$language,",WIDTH,200,CLICKCLOSE,true"); - } else { - ${"tooltip_".$language} = NULL; - } - } - - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_admin_help = 'help'; - } else { - $tooltip_admin_help = 'help'; - } - - - $pagecontent .= ''.getLanguageValue("admin_button").''; - $pagecontent .= $tooltip_admin_help; - $pagecontent .= "

".getLanguageValue("admin_text")."

"; - - - - $pagecontent .= ''; - // Zeile "ÜBERNEHMEN" - if(!isset($ADMIN_CONF->properties['error'])) { - $pagecontent .= ''; - } -/* $pagecontent .= ""; - $pagecontent .= ''; - $pagecontent .= "";*/ - if($LOGINCONF->get("initialsetup") == "false") { - // Zeile "ZEIGE EXPERT" - $pagecontent .= '"; - $pagecontent .= '"; - $pagecontent .= ""; - // Zeile "ZEIGE TOOLTIPS" - if($ADMIN_CONF->get('showexpert') == "true") { - $pagecontent .= '"; - $pagecontent .= '"; - $pagecontent .= ""; - } - } - // Zeile "SPRACHAUSWAHL" - $pagecontent .= '"; - if($LOGINCONF->get("initialsetup") == "false") { - // Zeile "ADMIN-MAIL" - if(isMailAvailable()) - { - $pagecontent .= ''; - $pagecontent .= '"; - $pagecontent .= ""; - - $pagecontent .= ''; - $pagecontent .= '"; - $pagecontent .= ""; - } - if($ADMIN_CONF->get('showexpert') == "true") { - // Zeile "HÖHE DES TEXTFELDES" - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ""; - // Zeile "BACKUP-ERINNERUNG" - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ""; - } - // Zeile "SETZE DATEIRECHTE FÜR NEUE DATEIEN" - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ""; - if($ADMIN_CONF->get('showexpert') == "true") { - // Zeile "MAXIMALE DATEIANZAHL BEIM UPLOAD" - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ""; - // Zeile "UPLOAD-FILTER" - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ""; - // Zeile "VORHANDENE DATEIEN BEIM UPLOAD ÜBERSCHREIBEN" - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= ""; - } - // BILD-EINSTELLUNGEN - if (extension_loaded("gd")) - { - $pagecontent .= '"; - $pagecontent .= ''; - $pagecontent .= ""; - } - } - $pagecontent .= '' - // Zeile "NEUER NAME" - .'' - .'' - ."" - // Zeile "NEUES PASSWORT" - .'' - .'' - ."" - // Zeile "NEUES PASSWORT - WIEDERHOLUNG" - .'' - .'' - .""; - - // Zeile "ÜBERNEHMEN" - if(!isset($ADMIN_CONF->properties['error'])) { - $pagecontent .= ''; - } - $pagecontent .= "
'; - if($LOGINCONF->get("initialsetup") == "true") { - $pagecontent .= '   '; - } - $pagecontent .= '
'.getLanguageValue("admin_text").'
'.getLanguageValue("admin_text_showexpert")."' - .buildCheckBox("showexpert", ($ADMIN_CONF->get("showexpert") == "true")) - .''.getLanguageValue("admin_input_showexpert")."
'.getLanguageValue("admin_text_tooltips")."' - .buildCheckBox("showTooltips", ($ADMIN_CONF->get("showTooltips") == "true")) - .getLanguageValue("admin_input_tooltips")."
'.getLanguageValue("admin_input_language").'
'.getLanguageValue("admin_text_send_adminmail").'' - .buildCheckBox("sendadminmail", ($ADMIN_CONF->get("sendadminmail") == "true")) - .getLanguageValue("admin_input_adminmail"); - $pagecontent .= "
'.getLanguageValue("admin_text_adminmail").''; - $pagecontent .= ''; - $pagecontent .= "
'.getLanguageValue("admin_text_textarea").'
'.getLanguageValue("admin_text_backup").'
'.getLanguageValue("admin_text_chmodnewfiles").'
' - .buildCheckBox("chmodupdate", false) - .''.getLanguageValue("admin_input_chmodupdate").''.''; - $pagecontent .= '
'.getLanguageValue("admin_text_maxuploadfiles").'
'.getLanguageValue("admin_text_uploadfilter").'
'.getLanguageValue("admin_text_defaultoverwrite").'' - .buildCheckBox("overwriteuploadfiles", ($ADMIN_CONF->get("overwriteuploadfiles") == "true")) - .getLanguageValue("admin_input_defaultoverwrite").'
'.getLanguageValue("admin_text_imagesmax"); - $pagecontent .= "'; - $pagecontent .= ' x  ' . getLanguageValue("pixels") . '
'.getLanguageValue("pw_text_login").'
'.getLanguageValue("pw_titel_newname").'
'.getLanguageValue("pw_titel_newpw").'
'.getLanguageValue("pw_titel_newpwrepeat").'
'; - if($LOGINCONF->get("initialsetup") == "true") { - $pagecontent .= '   '; - } - $pagecontent .= '
"; - //$pagecontent .= "
"; - return array(getLanguageValue("admin_button"), $pagecontent); + global $ADMIN_CONF; + global $LOGINCONF; + global $CMS_CONF; + global $specialchars; + global $icon_size; + + $basic = makeDefaultConf("basic"); + + // error colors für die input felder vorbereiten + foreach ($basic as $type => $type_array) { + if ($type == 'expert') + continue; + foreach ($basic [$type] as $syntax_name => $dumy) { + $error_color [$syntax_name] = NULL; + } + } + + $error_color ['newname'] = NULL; + $error_color ['newpw'] = NULL; + $error_color ['newpwrepeat'] = NULL; + // Änderungen gespeichert + $changesmade = false; + + $pagecontent = ''; + + $error_color ['language'] = NULL; + $language_array = getDirAsArray(BASE_DIR_ADMIN . 'sprachen', "file", "natcasesort"); + if (count($language_array) <= 0) { + $post ['error_messages'] ['admin_error_language_emty'] [] = NULL; + $error_color ['language'] = ' style="background-color:#FF7029;"'; + } elseif (!in_array("language_" . $ADMIN_CONF->get('language') . ".conf", $language_array)) { + $post ['error_messages'] ['admin_error_languagefile_error'] [] = $ADMIN_CONF->get('language'); + $error_color ['language'] = ' style="background-color:#FF7029;"'; + } + + if (isset($ADMIN_CONF->properties ['error'])) { + $post ['apply'] = "false"; + $post ['error_messages'] ['properties'] [] = $ADMIN_CONF->properties ['error']; + } + + if (isset($post ['apply'])) { + $post ['apply'] = $specialchars->rebuildSpecialChars($post ['apply'], false, true); + } + + if (isset($post ['apply']) and $post ['apply'] == getLanguageValue("admin_submit") and isset($post ['default'])) { + // makeDefaultConf("conf/basic.conf"); + $post ['apply'] = "false"; + } + + if (isset($post ['default_pw']) and $specialchars->rebuildSpecialChars($post ['default_pw'], false, true) == getLanguageValue("admin_submit_default_pw")) { + $LOGINCONF->set("initialsetup", "false"); + } + + if ($LOGINCONF->get("initialsetup") == "true") { + $post ['messages'] ['initialsetup'] [] = NULL; + if (strpos("tmp" . $_SERVER ['QUERY_STRING'], "action") > 0) { + $post ['error_messages'] ['initialsetup_error'] [] = NULL; + } + } + + // Auswertung des Formulars + if (isset($post ['apply']) and $post ['apply'] == getLanguageValue("admin_submit")) { + + // auf jeden fall erst mal deDE setzen ist blöd wenn kein language gesetzt ist + $ADMIN_CONF->set('language', "deDE"); + if (count($language_array) > 0) { + $ADMIN_CONF->set('language', $post ['language']); + } + + // wenn expert eingeschaltet wird müssen die expert $post gefüllt werden + if (checkBoxChecked('showexpert') == "true" and $ADMIN_CONF->get('showexpert') == "false") { + foreach ($basic ['expert'] as $syntax) { + if ($syntax == 'lastbackup' or $syntax == 'usebigactionicons') { + continue; + } + $post [$syntax] = $ADMIN_CONF->get($syntax); + } + } + + foreach ($basic as $type => $type_array) { + if ($type == 'expert') + continue; + foreach ($basic [$type] as $syntax_name => $dumy) { + $error_messages = false; + if (checkBoxChecked('showexpert') == "false" and in_array($syntax_name, $basic ['expert'])) { + continue; + } + if ($type == 'text') { + if (isset($post [$syntax_name])) { + $text = $post [$syntax_name]; + } else + continue; + if ($syntax_name == 'adminmail' and $text != "" and !preg_match("/^.+@.+\..+$/", $text)) { + $error_messages = $syntax_name; + } + if ($error_messages === false and $ADMIN_CONF->get($syntax_name) != $text) { + if ($syntax_name == 'adminmail') { + $ADMIN_CONF->set($syntax_name, $text); + } else { + $ADMIN_CONF->set($syntax_name, $specialchars->replaceSpecialChars($text, false)); + } + } + } + if ($type == 'digit') { + if ($syntax_name == 'lastbackup') { + continue; + } + if (isset($post [$syntax_name])) { + $digit = trim($post [$syntax_name]); + } else + continue; + // wenn eingabe keine Zahl oder mehr wie 4stelig ist + if ($digit != "" and (!ctype_digit($digit) or strlen($digit) > 4)) { + $error_messages = 'nodigit_tolong'; + } elseif ($syntax_name == 'chmodnewfilesatts' and !empty($digit) and !preg_match("/^[0-7]{3}$/", $digit)) { + $error_messages = $syntax_name; + } elseif ($syntax_name == 'textareaheight' and $digit < 50) { + $error_messages = $syntax_name; + } elseif ($syntax_name == 'maxnumberofuploadfiles' and $digit < 1) { + $error_messages = $syntax_name; + } elseif ($syntax_name == 'backupmsgintervall' and ($digit < 0 or $digit == "")) { + $error_messages = $syntax_name; + } + + if ($error_messages === false and $ADMIN_CONF->get($syntax_name) != $digit) { + $ADMIN_CONF->set($syntax_name, $digit); + } + } + if ($type == 'checkbox') { + + $checkbox = "false"; + if (isset($post [$syntax_name])) { + $checkbox = $post [$syntax_name]; + } + if ($syntax_name == 'sendadminmail' and $checkbox == "true" and $post ['adminmail'] == "") { + $error_messages = $syntax_name; + } + + if ($error_messages === false and $ADMIN_CONF->get($syntax_name) != $checkbox) { + $ADMIN_CONF->set($syntax_name, $checkbox); + } + } + if ($error_messages !== false) { + $post ['error_messages'] ['admin_error_' . $syntax_name] ['color'] = "#FF7029"; + $post ['error_messages'] ['admin_error_' . $syntax_name] [] = NULL; + $error_color [$syntax_name] = ' style="background-color:#FF7029;"'; + } + } + } + + if (checkBoxChecked('chmodupdate') == "true" and $ADMIN_CONF->get('chmodnewfilesatts') != "") { + $error = useChmod(); + if (!empty($error)) { + $post ['error_messages'] = $error; + } + } + + require_once (BASE_DIR_ADMIN . "Crypt.php"); + $pwcrypt = new Crypt(); + if ($post ['newpw'] != "" and $pwcrypt->encrypt($post ['newpw']) != $LOGINCONF->get("pw")) { + if (($post ['newname'] == "") or ($post ['newpw'] == "") or ($post ['newpwrepeat'] == "")) { + $post ['error_messages'] ['pw_error_missingvalues'] ['color'] = "#FF7029"; + $post ['error_messages'] ['pw_error_missingvalues'] [] = NULL; + $error_color ['newname'] = ' style="background-color:#FF7029;"'; + $error_color ['newpw'] = ' style="background-color:#FF7029;"'; + $error_color ['newpwrepeat'] = ' style="background-color:#FF7029;"'; + } elseif (strlen($post ['newname']) < 5) { + $post ['error_messages'] ['pw_error_tooshortname'] ['color'] = "#FF7029"; + $post ['error_messages'] ['pw_error_tooshortname'] [] = NULL; + $error_color ['newname'] = ' style="background-color:#FF7029;"'; + // Neues Paßwort zweimal exakt gleich eingegeben? + } elseif ($post ['newpw'] != $post ['newpwrepeat']) { + $post ['error_messages'] ['pw_error_newpwmismatch'] ['color'] = "#FF7029"; + $post ['error_messages'] ['pw_error_newpwmismatch'] [] = NULL; + $error_color ['newpw'] = ' style="background-color:#FF7029;"'; + $error_color ['newpwrepeat'] = ' style="background-color:#FF7029;"'; + // Neues Paßwort wenigstens sechs Zeichen lang und mindestens aus kleinen und großen Buchstaben sowie Zahlen bestehend? + } elseif ((strlen($post ['newpw']) < 6) or !preg_match("/[0-9]/", $post ['newpw']) or !preg_match("/[a-z]/", $post ['newpw']) or !preg_match("/[A-Z]/", $post ['newpw'])) { + $post ['error_messages'] ['pw_error_newpwerror'] ['color'] = "#FF7029"; + $post ['error_messages'] ['pw_error_newpwerror'] [] = NULL; + $error_color ['newpw'] = ' style="background-color:#FF7029;"'; + // Allles gut Speichen + } else { + // initialsetub sachen speichern + $LOGINCONF->set("initialsetup", "false"); + $LOGINCONF->set("initialpw", "false"); + $ADMIN_CONF->set('lastbackup', time()); + $LOGINCONF->set("name", $post ['newname']); + $LOGINCONF->set("pw", $pwcrypt->encrypt($post ['newpw'])); + $post ['messages'] ['pw_messages_changes'] [] = NULL; + } + } + + if ($LOGINCONF->get('initialsetup') == "false") { + $post ['messages'] ['admin_messages_changes'] [] = NULL; + } else { + $post ['error_messages'] ['admin_error_initialsetup'] [] = NULL; + } + } // applay end + + // Anzeige begin + $pagecontent .= categoriesMessages($post); + + $array_getTooltipValue = array( + "admin_help_language", + "admin_help_adminmail", + "admin_help_chmodnewfiles", + "admin_help_chmodupdate" + ); + + // Variable erzeugen z.B. pages = $text_pages + foreach ($array_getTooltipValue as $language) { + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + ${"tooltip_" . $language} = createTooltipWZ("", $language, ",WIDTH,200,CLICKCLOSE,true"); + } else { + ${"tooltip_" . $language} = NULL; + } + } + + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_admin_help = 'help'; + } else { + $tooltip_admin_help = 'help'; + } + + $pagecontent .= '' . getLanguageValue("admin_button") . ''; + $pagecontent .= $tooltip_admin_help; + $pagecontent .= "

" . getLanguageValue("admin_text") . "

"; + + $pagecontent .= ''; + // Zeile "ÜBERNEHMEN" + if (!isset($ADMIN_CONF->properties ['error'])) { + $pagecontent .= ''; + } + /* + * $pagecontent .= ""; + * $pagecontent .= ''; + * $pagecontent .= ""; + */ + if ($LOGINCONF->get("initialsetup") == "false") { + // Zeile "ZEIGE EXPERT" + $pagecontent .= '"; + $pagecontent .= '"; + $pagecontent .= ""; + // Zeile "ZEIGE TOOLTIPS" + if ($ADMIN_CONF->get('showexpert') == "true") { + $pagecontent .= '"; + $pagecontent .= '"; + $pagecontent .= ""; + } + } + // Zeile "SPRACHAUSWAHL" + $pagecontent .= '"; + if ($LOGINCONF->get("initialsetup") == "false") { + // Zeile "ADMIN-MAIL" + if (isMailAvailable()) { + $pagecontent .= ''; + $pagecontent .= '"; + $pagecontent .= ""; + + $pagecontent .= ''; + $pagecontent .= '"; + $pagecontent .= ""; + } + if ($ADMIN_CONF->get('showexpert') == "true") { + // Zeile "HÖHE DES TEXTFELDES" + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ""; + // Zeile "BACKUP-ERINNERUNG" + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ""; + } + // Zeile "SETZE DATEIRECHTE FÜR NEUE DATEIEN" + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ""; + if ($ADMIN_CONF->get('showexpert') == "true") { + // Zeile "MAXIMALE DATEIANZAHL BEIM UPLOAD" + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ""; + // Zeile "UPLOAD-FILTER" + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ""; + // Zeile "VORHANDENE DATEIEN BEIM UPLOAD ÜBERSCHREIBEN" + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= ""; + } + // BILD-EINSTELLUNGEN + if (extension_loaded("gd")) { + $pagecontent .= '"; + $pagecontent .= ''; + $pagecontent .= ""; + } + } + $pagecontent .= '' . + // Zeile "NEUER NAME" + '' . '' . "" . + // Zeile "NEUES PASSWORT" + '' . '' . "" . + // Zeile "NEUES PASSWORT - WIEDERHOLUNG" + '' . '' . ""; + + // Zeile "ÜBERNEHMEN" + if (!isset($ADMIN_CONF->properties ['error'])) { + $pagecontent .= ''; + } + $pagecontent .= "
'; + if ($LOGINCONF->get("initialsetup") == "true") { + $pagecontent .= '   '; + } + $pagecontent .= '
'.getLanguageValue("admin_text").'
' . getLanguageValue("admin_text_showexpert") . "' . buildCheckBox("showexpert", ($ADMIN_CONF->get("showexpert") == "true")) . '' . getLanguageValue("admin_input_showexpert") . "
' . getLanguageValue("admin_text_tooltips") . "' . buildCheckBox("showTooltips", ($ADMIN_CONF->get("showTooltips") == "true")) . getLanguageValue("admin_input_tooltips") . "
' . getLanguageValue("admin_input_language") . '
' . getLanguageValue("admin_text_send_adminmail") . '' . buildCheckBox("sendadminmail", ($ADMIN_CONF->get("sendadminmail") == "true")) . getLanguageValue("admin_input_adminmail"); + $pagecontent .= "
' . getLanguageValue("admin_text_adminmail") . ''; + $pagecontent .= ''; + $pagecontent .= "
' . getLanguageValue("admin_text_textarea") . '
' . getLanguageValue("admin_text_backup") . '
' . getLanguageValue("admin_text_chmodnewfiles") . '
' . buildCheckBox("chmodupdate", false) . '' . getLanguageValue("admin_input_chmodupdate") . '' . ''; + $pagecontent .= '
' . getLanguageValue("admin_text_maxuploadfiles") . '
' . getLanguageValue("admin_text_uploadfilter") . '
' . getLanguageValue("admin_text_defaultoverwrite") . '' . buildCheckBox("overwriteuploadfiles", ($ADMIN_CONF->get("overwriteuploadfiles") == "true")) . getLanguageValue("admin_input_defaultoverwrite") . '
' . getLanguageValue("admin_text_imagesmax"); + $pagecontent .= "'; + $pagecontent .= ' x  ' . getLanguageValue("pixels") . '
' . getLanguageValue("pw_text_login") . '
' . getLanguageValue("pw_titel_newname") . '
' . getLanguageValue("pw_titel_newpw") . '
' . getLanguageValue("pw_titel_newpwrepeat") . '
'; + if ($LOGINCONF->get("initialsetup") == "true") { + $pagecontent .= '   '; + } + $pagecontent .= '
"; + // $pagecontent .= ""; + return array( + getLanguageValue("admin_button"), + $pagecontent + ); } function plugins($post) { - global $ADMIN_CONF; - global $icon_size; - global $CatPage; - - require_once(BASE_DIR_CMS."Plugin.php"); - - $pagecontent = ''; - - if(getRequestParam('javascript', true)) { - $pagecontent .= ''; - } - - if(getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { - $tooltip_plugins_help = 'help'; - $tooltip_plugins_help_edit = createTooltipWZ("","plugins_help_edit",",WIDTH,200,CLICKCLOSE,true"); - } else { - $tooltip_plugins_help = 'help'; - $tooltip_plugins_help_edit = NULL; - } - - $pagecontent .= ''.getLanguageValue("plugins_titel").''; - $pagecontent .= $tooltip_plugins_help; - $pagecontent .= "

".getLanguageValue("plugins_text")."

"; - $pagecontent .= ''; - $pagecontent .= ''; - - $dircontent = getDirAsArray(PLUGIN_DIR_REL,"dir","natcasesort"); - $toggle_pos = 0; - foreach ($dircontent as $currentelement) { - if (file_exists(PLUGIN_DIR_REL.$currentelement."/index.php")) { - require_once(PLUGIN_DIR_REL.$currentelement."/index.php"); - if(class_exists( $currentelement ) and (in_array(strtolower($currentelement), get_declared_classes()) or in_array($currentelement, get_declared_classes()))) - $plugin = new $currentelement(); - else - # Plugin Dirname stimt nicht mit Plugin Classnamen überein - continue; - $plugin_error = false; - $conf_plugin = new Properties(PLUGIN_DIR_REL.$currentelement."/plugin.conf",true); - $plugin_error_conf = NULL; - if(isset($conf_plugin->properties['error'])) { - $plugin_error_conf = returnMessage(false, getLanguageValue("properties_write").'  '.$currentelement.'/plugin.conf'); - $plugin_error = true; - } - if(getRequestParam('apply', true)) { - $check_activ = "false"; - if(isset($_POST[$currentelement]['active'])) { - $check_activ = "true"; - } - if($conf_plugin->get("active") != $check_activ) { - $conf_plugin->set("active",$check_activ); - } - } - - // Enthält der Code eine Klasse mit dem Namen des Plugins? - if (class_exists($currentelement)) { - $plugin_info = $plugin->getInfo(); - $pagecontent .= ''; - - $display_toggle = NULL; - $messages = NULL; - $pagecontent_conf = NULL; - if($plugin_error === false) { - $pagecontent_start_conf = '
'; - $pagecontent .= ''; - # Plugin Info Prüfen - if(isset($plugin_info) and count($plugin_info) > 0) { - $plugin_name = strip_tags($plugin_info[0],''); - $plugin_name = htmlentities($plugin_name,ENT_COMPAT,CHARSET); - $plugin_name = str_replace(array("<",">","$"),array("<",">",""),$plugin_name); - } else { - $plugin_name = getLanguageValue('plugins_error').' '.$currentelement.''; - $plugin_error = true; - } - $pagecontent .= ''; - $pagecontent .= ''; - $pagecontent .= '
'.$plugin_name.$plugin_error_conf.''.getLanguageValue("plugins_input_active").' '.buildCheckBox($currentelement.'[active]', ($conf_plugin->get("active") == "true")).''; - if(getRequestParam('javascript', true) and $plugin_error === false) { - $pagecontent .= ''; - } - $pagecontent .= ' 
'; - $pagecontent .= '
'; - # Plugin Infos die reinvolge ist wichtig - $plugins_info_array = array("Plugin_name","plugins_titel_version","plugins_titel_description","plugins_titel_author","plugins_titel_web"); - foreach($plugins_info_array as $pos => $info) { - # Plugin Name Brauchen wir hier nicht - if($pos == 0) continue; - if($pos == 2) { - $plugin_info[$pos] = str_replace(array("<",">"),array("<",">"),$plugin_info[$pos]); - $plugin_info[$pos] = strip_tags($plugin_info[$pos], '
'); - $plugin_info[$pos] = htmlentities($plugin_info[$pos],ENT_NOQUOTES,CHARSET); - $plugin_info[$pos] = str_replace(array('&#',"<",">"),array('&#',"<",">"),$plugin_info[$pos]); - } elseif($pos == 4) { - $plugin_info[$pos] = ''.strip_tags($plugin_info[$pos]).''; - } else { - $plugin_info[$pos] = htmlentities(strip_tags($plugin_info[$pos]),ENT_COMPAT,CHARSET); - } - if(isset($plugin_info[$pos])) { - $pagecontent_conf .= '
' - .''; - } - if($pos == 4) { - # Das getInfo() array hat mehr als 4 einträge wir brauchen hier aber nur die 4 - break; - } - } -# geändert damit getConfig() nicht 2mal ausgeführt wird - $config = $plugin->getConfig(); - if(count($config) >= 1) { -# if(count($plugin->getConfig()) >= 1) { -# $config = $plugin->getConfig(); - foreach($config as $name => $inhalt) { - $error = NULL; - # Änderungen schreiben isset($_POST['apply']) - # Änderungen nur übernehmen und überprüfen, wenn das Plugin aktiviert ist - if(getRequestParam('apply', true) && $conf_plugin->get("active") == "true") { - if(isset($_POST[$currentelement][$name])) { - # ist array bei radio und select multi - if(is_array($_POST[$currentelement][$name])) { - $conf_inhalt = implode(",", $_POST[$currentelement][$name]); - # alle die kein array sind - } else { - $conf_inhalt = str_replace(array("\r\n","\r","\n"),"
",trim($_POST[$currentelement][$name])); - } - if(isset($config[$name]['regex_error'])) { - $regex_error = $config[$name]['regex_error']; - } else { - $regex_error = getLanguageValue("plugins_messages_input"); - } - if(isset($config[$name]['regex']) and strlen($conf_inhalt) > 0) { - if(preg_match($config[$name]['regex'], $conf_inhalt)) { - # bei Password und verschlüsselung an - if($config[$name]['type'] == "password" and $config[$name]['saveasmd5'] == "true") { - $conf_inhalt = md5($conf_inhalt); - } - # nur in conf schreiben wenn sich der wert geändert hat - if($conf_plugin->get("active") == "true" and $conf_plugin->get($name) != $conf_inhalt) { - $conf_plugin->set($name,$conf_inhalt); - $display_toggle = ' style="display:block;"'; - $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); - } - } else { - $error = ' style="background-color:#FF0000;"'; - $display_toggle = ' style="display:block;"'; - $messages .= returnMessage(false, $regex_error); - } - } else { - # nur in conf schreiben wenn sich der wert geändert hat und es kein password ist - if($conf_plugin->get("active") == "true" and $conf_plugin->get($name) != $conf_inhalt and $config[$name]['type'] != "password") { - $conf_plugin->set($name,$conf_inhalt); - $display_toggle = ' style="display:block;"'; - $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); - } - } - # checkbox - } elseif($conf_plugin->get("active") == "true" and $config[$name]['type'] == "checkbox" and $conf_plugin->get($name) == "true") { - $conf_plugin->set($name,"false"); - $display_toggle = ' style="display:block;"'; - $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); - # variable gibts also schreiben mit lehren wert - } elseif($conf_plugin->get("active") == "true" and $conf_plugin->get($name)) { - $conf_plugin->set($name,""); - $display_toggle = ' style="display:block;"'; - $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); - } - } - # Beschreibung und inputs der Konfiguration Bauen und ausgeben - $value = NULL; - if(strlen($conf_plugin->get($name)) > 0) { - # in einem input feld darf der inhalt keine " haben - $value = ' value="'.str_replace('"',""",$conf_plugin->get($name)).'"'; - if($config[$name]['type'] == "textarea") { - $value = str_replace("
","\n",$conf_plugin->get($name)); - } - if($config[$name]['type'] == "password") { - $value = NULL; - } - } - $maxlength = NULL; - if(isset($config[$name]['maxlength'])) { - $maxlength = ' maxlength="'.$config[$name]['maxlength'].'"'; - } - $size = NULL; - if(isset($config[$name]['size'])) { - $size = ' size="'.$config[$name]['size'].'"'; - } - $cols = NULL; - if(isset($config[$name]['cols'])) { - $cols = ' cols="'.$config[$name]['cols'].'"'; - } - $rows = NULL; - if(isset($config[$name]['rows'])) { - $rows = ' rows="'.$config[$name]['rows'].'"'; - } - $multiple = NULL; - if(isset($config[$name]['multiple']) and $config[$name]['multiple'] == "true") { - $multiple = ' multiple'; - } - $type = NULL; - $input = NULL; - if(isset($config[$name]['type'])) { - $type = ' type="'.$config[$name]['type'].'"'; - if($config[$name]['type'] == "textarea") { - $input = ''; - } elseif($config[$name]['type'] == "select") { - $plus_array = NULL; - if(!empty($multiple)) { - $plus_array = '[]'; - } - $input = ''; - } elseif($config[$name]['type'] == "radio") { - if(is_array($config[$name]['descriptions'])) { - foreach($config[$name]['descriptions'] as $key => $descriptions) { - $value = ' value="'.$key.'"'; - $checked = NULL; - if($conf_plugin->get($name) == $key) { - $checked = ' checked="checked"'; - } - $input .= $descriptions.'  
'; - } - } - } elseif($config[$name]['type'] == "checkbox") { - $checked = NULL; - if($conf_plugin->get($name) == "true") { - $checked = ' checked="checked"'; - } - $input .= '
'; - } elseif($config[$name]['type'] == "file") { - $display_toggle = ' style="display:block;"'; - $messages .= returnMessage(false, getLanguageValue("plugins_error_type_file")); - $input = '       '; - } else { - $input = ''; - } - } - # Ausgeben nowrap - $pagecontent_conf .= ''; - $pagecontent_conf .= ''; - } -// $pagecontent_conf .= '
'.getLanguageValue($info).''.$plugin_info[$pos].'
'.$config[$name]['description'].''.$input.'
'; - -// $pagecontent_conf .= ''; - } - $pagecontent_conf .= ''; - - - if(getRequestParam('javascript', true)) { - $pagecontent_conf .= ''; - } - if(!empty($messages)) { - $messages = ''.$messages.''; - } - $pagecontent_toggle = ''; - $pagecontent .= $pagecontent_toggle.$pagecontent_start_conf.$messages.$pagecontent_conf.''; -# conf end - } - } - } - $toggle_pos++; - } - $pagecontent .= ''; - $pagecontent .= ''; - return array(getLanguageValue("plugins_button"), $pagecontent); + global $ADMIN_CONF; + global $icon_size; + global $CatPage; + + require_once (BASE_DIR_CMS . "Plugin.php"); + + $pagecontent = ''; + + if (getRequestParam('javascript', true)) { + $pagecontent .= ''; + } + + if (getRequestParam('javascript', true) and $ADMIN_CONF->get("showTooltips") == "true") { + $tooltip_plugins_help = 'help'; + $tooltip_plugins_help_edit = createTooltipWZ("", "plugins_help_edit", ",WIDTH,200,CLICKCLOSE,true"); + } else { + $tooltip_plugins_help = 'help'; + $tooltip_plugins_help_edit = NULL; + } + + $pagecontent .= '' . getLanguageValue("plugins_titel") . ''; + $pagecontent .= $tooltip_plugins_help; + $pagecontent .= "

" . getLanguageValue("plugins_text") . "

"; + $pagecontent .= ''; + $pagecontent .= ''; + + $dircontent = getDirAsArray(PLUGIN_DIR_REL, "dir", "natcasesort"); + $toggle_pos = 0; + foreach ($dircontent as $currentelement) { + if (file_exists(PLUGIN_DIR_REL . $currentelement . "/index.php")) { + require_once (PLUGIN_DIR_REL . $currentelement . "/index.php"); + if (class_exists($currentelement) and (in_array(strtolower($currentelement), get_declared_classes()) or in_array($currentelement, get_declared_classes()))) + $plugin = new $currentelement(); + else + // Plugin Dirname stimt nicht mit Plugin Classnamen überein + continue; + $plugin_error = false; + $conf_plugin = new Properties(PLUGIN_DIR_REL . $currentelement . "/plugin.conf", true); + $plugin_error_conf = NULL; + if (isset($conf_plugin->properties ['error'])) { + $plugin_error_conf = returnMessage(false, getLanguageValue("properties_write") . '  ' . $currentelement . '/plugin.conf'); + $plugin_error = true; + } + if (getRequestParam('apply', true)) { + $check_activ = "false"; + if (isset($_POST [$currentelement] ['active'])) { + $check_activ = "true"; + } + if ($conf_plugin->get("active") != $check_activ) { + $conf_plugin->set("active", $check_activ); + } + } + + // Enthält der Code eine Klasse mit dem Namen des Plugins? + if (class_exists($currentelement)) { + $plugin_info = $plugin->getInfo(); + $pagecontent .= ''; + + $display_toggle = NULL; + $messages = NULL; + $pagecontent_conf = NULL; + if ($plugin_error === false) { + $pagecontent_start_conf = '
'; + $pagecontent .= ''; + // Plugin Info Prüfen + if (isset($plugin_info) and count($plugin_info) > 0) { + $plugin_name = strip_tags($plugin_info [0], ''); + $plugin_name = htmlentities($plugin_name, ENT_COMPAT, CHARSET); + $plugin_name = str_replace(array( + "<", + ">", + "$" + ), array( + "<", + ">", + "" + ), $plugin_name); + } else { + $plugin_name = getLanguageValue('plugins_error') . ' ' . $currentelement . ''; + $plugin_error = true; + } + $pagecontent .= ''; + $pagecontent .= ''; + $pagecontent .= '
' . $plugin_name . $plugin_error_conf . '' . getLanguageValue("plugins_input_active") . ' ' . buildCheckBox($currentelement . '[active]', ($conf_plugin->get("active") == "true")) . ''; + if (getRequestParam('javascript', true) and $plugin_error === false) { + $pagecontent .= ''; + } + $pagecontent .= ' 
'; + $pagecontent .= '
'; + // Plugin Infos die reinvolge ist wichtig + $plugins_info_array = array( + "Plugin_name", + "plugins_titel_version", + "plugins_titel_description", + "plugins_titel_author", + "plugins_titel_web" + ); + foreach ($plugins_info_array as $pos => $info) { + // Plugin Name Brauchen wir hier nicht + if ($pos == 0) + continue; + if ($pos == 2) { + $plugin_info [$pos] = str_replace(array( + "<", + ">" + ), array( + "<", + ">" + ), $plugin_info [$pos]); + $plugin_info [$pos] = strip_tags($plugin_info [$pos], '
'); + $plugin_info [$pos] = htmlentities($plugin_info [$pos], ENT_NOQUOTES, CHARSET); + $plugin_info [$pos] = str_replace(array( + '&#', + "<", + ">" + ), array( + '&#', + "<", + ">" + ), $plugin_info [$pos]); + } elseif ($pos == 4) { + $plugin_info [$pos] = '' . strip_tags($plugin_info [$pos]) . ''; + } else { + $plugin_info [$pos] = htmlentities(strip_tags($plugin_info [$pos]), ENT_COMPAT, CHARSET); + } + if (isset($plugin_info [$pos])) { + $pagecontent_conf .= '
' . ''; + } + if ($pos == 4) { + // Das getInfo() array hat mehr als 4 einträge wir brauchen hier aber nur die 4 + break; + } + } + // geändert damit getConfig() nicht 2mal ausgeführt wird + $config = $plugin->getConfig(); + if (count($config) >= 1) { + // if(count($plugin->getConfig()) >= 1) { + // $config = $plugin->getConfig(); + foreach ($config as $name => $inhalt) { + $error = NULL; + // Änderungen schreiben isset($_POST['apply']) + // Änderungen nur übernehmen und überprüfen, wenn das Plugin aktiviert ist + if (getRequestParam('apply', true) && $conf_plugin->get("active") == "true") { + if (isset($_POST [$currentelement] [$name])) { + // ist array bei radio und select multi + if (is_array($_POST [$currentelement] [$name])) { + $conf_inhalt = implode(",", $_POST [$currentelement] [$name]); + // alle die kein array sind + } else { + $conf_inhalt = str_replace(array( + "\r\n", + "\r", + "\n" + ), "
", trim($_POST [$currentelement] [$name])); + } + if (isset($config [$name] ['regex_error'])) { + $regex_error = $config [$name] ['regex_error']; + } else { + $regex_error = getLanguageValue("plugins_messages_input"); + } + if (isset($config [$name] ['regex']) and strlen($conf_inhalt) > 0) { + if (preg_match($config [$name] ['regex'], $conf_inhalt)) { + // bei Password und verschlüsselung an + if ($config [$name] ['type'] == "password" and $config [$name] ['saveasmd5'] == "true") { + $conf_inhalt = md5($conf_inhalt); + } + // nur in conf schreiben wenn sich der wert geändert hat + if ($conf_plugin->get("active") == "true" and $conf_plugin->get($name) != $conf_inhalt) { + $conf_plugin->set($name, $conf_inhalt); + $display_toggle = ' style="display:block;"'; + $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); + } + } else { + $error = ' style="background-color:#FF0000;"'; + $display_toggle = ' style="display:block;"'; + $messages .= returnMessage(false, $regex_error); + } + } else { + // nur in conf schreiben wenn sich der wert geändert hat und es kein password ist + if ($conf_plugin->get("active") == "true" and $conf_plugin->get($name) != $conf_inhalt and $config [$name] ['type'] != "password") { + $conf_plugin->set($name, $conf_inhalt); + $display_toggle = ' style="display:block;"'; + $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); + } + } + // checkbox + } elseif ($conf_plugin->get("active") == "true" and $config [$name] ['type'] == "checkbox" and $conf_plugin->get($name) == "true") { + $conf_plugin->set($name, "false"); + $display_toggle = ' style="display:block;"'; + $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); + // variable gibts also schreiben mit lehren wert + } elseif ($conf_plugin->get("active") == "true" and $conf_plugin->get($name)) { + $conf_plugin->set($name, ""); + $display_toggle = ' style="display:block;"'; + $messages = returnMessage(true, getLanguageValue("plugins_messages_input")); + } + } + // Beschreibung und inputs der Konfiguration Bauen und ausgeben + $value = NULL; + $pluginConfig = $conf_plugin->get($name); + if (isset($pluginConfig) && strlen($pluginConfig) > 0) { + // in einem input feld darf der inhalt keine " haben + $value = ' value="' . str_replace('"', """, $pluginConfig) . '"'; + if ($config [$name] ['type'] == "textarea") { + $value = str_replace("
", "\n", $pluginConfig); + } + if ($config [$name] ['type'] == "password") { + $value = NULL; + } + } + $maxlength = NULL; + if (isset($config [$name] ['maxlength'])) { + $maxlength = ' maxlength="' . $config [$name] ['maxlength'] . '"'; + } + $size = NULL; + if (isset($config [$name] ['size'])) { + $size = ' size="' . $config [$name] ['size'] . '"'; + } + $cols = NULL; + if (isset($config [$name] ['cols'])) { + $cols = ' cols="' . $config [$name] ['cols'] . '"'; + } + $rows = NULL; + if (isset($config [$name] ['rows'])) { + $rows = ' rows="' . $config [$name] ['rows'] . '"'; + } + $multiple = NULL; + if (isset($config [$name] ['multiple']) and $config [$name] ['multiple'] == "true") { + $multiple = ' multiple'; + } + $type = NULL; + $input = NULL; + if (isset($config [$name] ['type'])) { + $type = ' type="' . $config [$name] ['type'] . '"'; + if ($config [$name] ['type'] == "textarea") { + $input = ''; + } elseif ($config [$name] ['type'] == "select") { + $plus_array = NULL; + if (!empty($multiple)) { + $plus_array = '[]'; + } + $input = ''; + } elseif ($config [$name] ['type'] == "radio") { + if (is_array($config [$name] ['descriptions'])) { + foreach ($config [$name] ['descriptions'] as $key => $descriptions) { + $value = ' value="' . $key . '"'; + $checked = NULL; + if ($conf_plugin->get($name) == $key) { + $checked = ' checked="checked"'; + } + $input .= $descriptions . '  
'; + } + } + } elseif ($config [$name] ['type'] == "checkbox") { + $checked = NULL; + if ($conf_plugin->get($name) == "true") { + $checked = ' checked="checked"'; + } + $input .= '
'; + } elseif ($config [$name] ['type'] == "file") { + $display_toggle = ' style="display:block;"'; + $messages .= returnMessage(false, getLanguageValue("plugins_error_type_file")); + $input = '       '; + } else { + $input = ''; + } + } + // Ausgeben nowrap + $pagecontent_conf .= ''; + $pagecontent_conf .= ''; + } + // $pagecontent_conf .= '
' . getLanguageValue($info) . '' . $plugin_info [$pos] . '
' . $config [$name] ['description'] . '' . $input . '
'; + + // $pagecontent_conf .= ''; + } + $pagecontent_conf .= ''; + + if (getRequestParam('javascript', true)) { + $pagecontent_conf .= ''; + } + if (!empty($messages)) { + $messages = '' . $messages . ''; + } + $pagecontent_toggle = ''; + $pagecontent .= $pagecontent_toggle . $pagecontent_start_conf . $messages . $pagecontent_conf . ''; + // conf end + } + } + } + $toggle_pos++; + } + $pagecontent .= ''; + $pagecontent .= ''; + return array( + getLanguageValue("plugins_button"), + $pagecontent + ); } // Anzeige der Editieransicht -function showEditPageForm($cat, $page, $newsite) { - global $ADMIN_CONF; - global $CMS_CONF; - global $specialchars; - - $content = ""; - $action = 'editsite'; - - $file = CONTENT_DIR_REL.$cat."/".$page; - - # Vorhandene Inhaltseite öffnen - if ($newsite == 'editsite') { - // Inhaltsseite: Inhalt ins Textfeld holen - $handle=fopen($file, "r"); - if (filesize($file) > 0) { - $pagecontent = fread($handle, filesize($file)); - $pagecontent = str_replace("%","%25",$pagecontent); - $pagecontent = $specialchars->rebuildSpecialChars($pagecontent,true,true); - } else - $pagecontent = ""; - fclose($handle); - } else { - $pagecontent = $newsite; - } - // Anzeige der Formatsymbolleiste, wenn die CMS-Syntax aktiviert ist - if ($CMS_CONF->get("usecmssyntax") == "true") { - $content .= returnFormatToolbar($cat); - } - - // Seiteninhalt - $height = $ADMIN_CONF->get("textareaheight"); - if ($height == "") { - $height = 350; - $ADMIN_CONF->set("textareaheight", $height); - } - # Achtung das \n ist nötig weil sonst der erste zeilenumbruch verschlugt wird - $content .= '
'; - $content .= ''; - $content .= ' '; - // Zwischenspeichern-Button nicht beim Neuanlegen einer Inhaltsseite anzeigen - if($newsite != 'newsite') - $content .= ' '; - $content .= ' '; - // Auswahl "Speicher-Art" - $extension = substr($page, strlen($page)-4, 4); - $checkednormal = ""; - $checkedhidden = ""; - $checkeddraft = ""; - if ($extension == EXT_PAGE) { - $checkednormal = ' checked="checked"'; - } - if ($extension == EXT_HIDDEN) { - $checkedhidden = ' checked="checked"'; - } - if ($extension == EXT_DRAFT) { - $checkeddraft = ' checked="checked"'; - } - $content .= ' '.getLanguageValue("page_saveasnormal") - .' '.getLanguageValue("page_saveashidden") - .' '.getLanguageValue("page_saveasdraft"); - $content .= ''.getLanguageValue("page_edit_next").''. returnOverviewSelectbox(4, $cat); - return $content; +function showEditPageForm($cat, $page, $newsite) { + global $ADMIN_CONF; + global $CMS_CONF; + global $specialchars; + + $content = ""; + $action = 'editsite'; + + $file = CONTENT_DIR_REL . $cat . "/" . $page; + + // Vorhandene Inhaltseite öffnen + if ($newsite == 'editsite') { + // Inhaltsseite: Inhalt ins Textfeld holen + $handle = fopen($file, "r"); + if (filesize($file) > 0) { + $pagecontent = fread($handle, filesize($file)); + $pagecontent = str_replace("%", "%25", $pagecontent); + $pagecontent = $specialchars->rebuildSpecialChars($pagecontent, true, true); + } else + $pagecontent = ""; + fclose($handle); + } else { + $pagecontent = $newsite; + } + // Anzeige der Formatsymbolleiste, wenn die CMS-Syntax aktiviert ist + if ($CMS_CONF->get("usecmssyntax") == "true") { + $content .= returnFormatToolbar($cat); + } + + // Seiteninhalt + $height = $ADMIN_CONF->get("textareaheight"); + if ($height == "") { + $height = 350; + $ADMIN_CONF->set("textareaheight", $height); + } + // Achtung das \n ist nötig weil sonst der erste zeilenumbruch verschlugt wird + $content .= '
'; + $content .= ''; + $content .= ' '; + // Zwischenspeichern-Button nicht beim Neuanlegen einer Inhaltsseite anzeigen + if ($newsite != 'newsite') + $content .= ' '; + $content .= ' '; + // Auswahl "Speicher-Art" + $extension = substr($page, strlen($page) - 4, 4); + $checkednormal = ""; + $checkedhidden = ""; + $checkeddraft = ""; + if ($extension == EXT_PAGE) { + $checkednormal = ' checked="checked"'; + } + if ($extension == EXT_HIDDEN) { + $checkedhidden = ' checked="checked"'; + } + if ($extension == EXT_DRAFT) { + $checkeddraft = ' checked="checked"'; + } + $content .= ' ' . getLanguageValue("page_saveasnormal") . ' ' . getLanguageValue("page_saveashidden") . ' ' . getLanguageValue("page_saveasdraft"); + $content .= '' . getLanguageValue("page_edit_next") . '' . returnOverviewSelectbox(4, $cat); + return $content; } function saveContentToPage($content, $page) { - - $handle = @fopen($page, "a+"); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - fclose($handle); - if($last_error['line'] == $line_error) { - $error['php_error'][] = $last_error['message']; - # wenns hier schonn ne meldung gibt dann gleich Raus - return $error; - } elseif(empty($handle)) { - $error['page_error_save'][] = $page; - return $error; - } else { - $handle = @fopen($page, "w"); -# wird von cleanREQUEST erledigt ??????????????????? -# if(get_magic_quotes_gpc()) { -# fputs($handle, stripslashes($content)); -# } else { - fputs($handle, $content); -# } - fclose($handle); - } - if(is_file($page)) { - useChmod($page); - } else { - $error['page_error_save'][] = $page; - return $error; - } - return; + $handle = @fopen($page, "a+"); + $line_error = __LINE__ - 1; + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + fclose($handle); + if ($last_error ['line'] == $line_error) { + $error ['php_error'] [] = $last_error ['message']; + // wenns hier schonn ne meldung gibt dann gleich Raus + return $error; + } elseif (empty($handle)) { + $error ['page_error_save'] [] = $page; + return $error; + } else { + $handle = @fopen($page, "w"); + // wird von cleanREQUEST erledigt ??????????????????? + // if(get_magic_quotes_gpc()) { + // fputs($handle, stripslashes($content)); + // } else { + fputs($handle, $content); + // } + fclose($handle); + } + if (is_file($page)) { + useChmod($page); + } else { + $error ['page_error_save'] [] = $page; + return $error; + } + return; } // Lösche ein Verzeichnis rekursiv function deleteDir($path) { - // Existenz prüfen - if (!file_exists($path)) { - $error['check_is_file'][] = basename($path); - return $error; - } - $handle = opendir($path); - while ($currentelement = readdir($handle)) { - if ($currentelement == "." or $currentelement == "..") { - continue; - } - // Verzeichnis: Rekursiver Funktionsaufruf - if (is_dir($path."/".$currentelement)) { - $success = deleteDir($path."/".$currentelement); - // Datei: löschen - } else { - $success = @unlink($path."/".$currentelement); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $error['php_error'][] = $last_error['message']; - # wenns hier schonn ne meldung gibt dann gleich Raus - return $error; - } elseif(file_exists($path."/".$currentelement)) { - $error['check_del_file'][] = $path."/".$currentelement; - return $error; - } - } - } - closedir($handle); - // Verzeichnis löschen - $success = @rmdir($path); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - $error['php_error'][] = $last_error['message']; - # wenns hier schonn ne meldung gibt dann gleich Raus - return $error; - } elseif(file_exists($path)) { - $error['check_del_dir'][] = $path; - return $error; - } else return; + // Existenz prüfen + if (!file_exists($path)) { + $error ['check_is_file'] [] = basename($path); + return $error; + } + $handle = opendir($path); + while ($currentelement = readdir($handle)) { + if ($currentelement == "." or $currentelement == "..") { + continue; + } + // Verzeichnis: Rekursiver Funktionsaufruf + if (is_dir($path . "/" . $currentelement)) { + $success = deleteDir($path . "/" . $currentelement); + // Datei: löschen + } else { + $success = @unlink($path . "/" . $currentelement); + $line_error = __LINE__ - 1; + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $error ['php_error'] [] = $last_error ['message']; + // wenns hier schonn ne meldung gibt dann gleich Raus + return $error; + } elseif (file_exists($path . "/" . $currentelement)) { + $error ['check_del_file'] [] = $path . "/" . $currentelement; + return $error; + } + } + } + closedir($handle); + // Verzeichnis löschen + $success = @rmdir($path); + $line_error = __LINE__ - 1; + $last_error = NULL; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == NULL) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + $error ['php_error'] [] = $last_error ['message']; + // wenns hier schonn ne meldung gibt dann gleich Raus + return $error; + } elseif (file_exists($path)) { + $error ['check_del_dir'] [] = $path; + return $error; + } else + return; } // überprüfe, ob die gegebene Datei eine der übergebenen Endungen hat function fileHasExtension($filename, $extensions) { - foreach ($extensions as $ext) { - if (strtolower(substr($filename, strlen($filename)-(strlen($ext)+1), strlen($ext)+1)) == ".".strtolower($ext)) - return true; - } - return false; + foreach ($extensions as $ext) { + if (strtolower(substr($filename, strlen($filename) - (strlen($ext) + 1), strlen($ext) + 1)) == "." . strtolower($ext)) + return true; + } + return false; } // Gib Erfolgs- oder Fehlermeldung zurück function returnMessage($success, $message) { - global $icon_size; - if ($success === true) { - return ''.$message.''; - } else { - return ''.$message.''; - } + global $icon_size; + if ($success === true) { + return '' . $message . ''; + } else { + return '' . $message . ''; + } } // Smiley-Liste function returnSmileyBar() { - $smileys = new Smileys(BASE_DIR_CMS."smileys"); - $content = ""; - foreach($smileys->getSmileysArray() as $icon => $emoticon) { - if($icon == "readonly" or $icon == "error") { - continue; - } - $content .= ''.$emoticon.''; - } - return $content; - + $smileys = new Smileys(BASE_DIR_CMS . "smileys"); + $content = ""; + foreach ($smileys->getSmileysArray() as $icon => $emoticon) { + if ($icon == "readonly" or $icon == "error") { + continue; + } + $content .= '' . $emoticon . ''; + } + return $content; } // Selectbox mit allen benutzerdefinierten Syntaxelementen function returnUserSyntaxSelectbox() { - global $USER_SYNTAX; - $usersyntaxarray = $USER_SYNTAX->toArray(); - ksort($usersyntaxarray); - - $content = ""; - return $content; + global $USER_SYNTAX; + $usersyntaxarray = $USER_SYNTAX->toArray(); + ksort($usersyntaxarray); + + $content = ""; + return $content; } // Selectbox mit allen benutzerdefinierten Syntaxelementen function returnPlatzhalterSelectbox() { - global $specialchars; - - $platzhalter_array = makePlatzhalter(); - $selectbox = ''; - return $selectbox; + global $specialchars; + + $platzhalter_array = makePlatzhalter(); + $selectbox = ''; + return $selectbox; } - // Selectbox mit allen Plugin Platzhaltern die nichts mit dem Template zu tun haben function returnPluginSelectbox() { - global $specialchars; - - require_once(BASE_DIR_CMS."Plugin.php"); - $plugins = getDirAsArray(PLUGIN_DIR_REL,"dir","natcasesort"); - $selectbox = '"; - return $selectbox; + global $specialchars; + + require_once (BASE_DIR_CMS . "Plugin.php"); + $plugins = getDirAsArray(PLUGIN_DIR_REL, "dir", "natcasesort"); + $selectbox = '"; + return $selectbox; } - function returnFormatToolbar($currentcat) { - global $CMS_CONF; - global $USER_SYNTAX; - - // Information zeigen, wenn JavaScript nicht aktiviert - $content = "" - .'' - ."" - // Überschrift Syntaxelemente - ."" - // Überschrift Textformatierung - ."" - // Überschrift Farben - ."" - ."" - ."" - // Syntaxelemente - ."" - // Textformatierung - ."" - // Farben - ."" - ."" - ."
" - .getLanguageValue("toolbar_syntaxelements") - ."" - .getLanguageValue("toolbar_textformatting") - ."" - .getLanguageValue("toolbar_textcoloring") - ."
" - .returnFormatToolbarIcon("link") - .returnFormatToolbarIcon("mail") - .returnFormatToolbarIcon("seite") - .returnFormatToolbarIcon("kategorie") - .returnFormatToolbarIcon("datei") - .returnFormatToolbarIcon("bild") - .returnFormatToolbarIcon("bildlinks") - .returnFormatToolbarIcon("bildrechts") - .returnFormatToolbarIcon("ueber1") - .returnFormatToolbarIcon("ueber2") - .returnFormatToolbarIcon("ueber3") - .returnFormatToolbarIcon("absatz") - .returnFormatToolbarIcon("liste") - .returnFormatToolbarIcon("numliste") - ."\"Tabelle\">\\n< | >\\n]', true)\"".createUserTooltipWZ(getLanguageValue("toolbar_desc_tabelle"),"[tabelle|<< | >> < | >]").">" - ."\"Horizontale" - .returnFormatToolbarIcon("html") - .returnFormatToolbarIcon("include") - ."" - .returnFormatToolbarIcon("links") - .returnFormatToolbarIcon("zentriert") - .returnFormatToolbarIcon("block") - .returnFormatToolbarIcon("rechts") - .returnFormatToolbarIcon("fett") - .returnFormatToolbarIcon("kursiv") - .returnFormatToolbarIcon("unter") - .returnFormatToolbarIcon("durch") - ."" - .'
' - ."\"Farbe\"" - ."" - ."
" - ."" - ."\"...\"" - ."
" - ."
" - ."
" - .'' - .""; - - // Benutzerdefinierte Syntaxelemente vorbereiten - $usersyntaxarray = $USER_SYNTAX->toArray(); - - // Überschrift Inhalte - $content .= ""; - // Überschrift Benutzerdefinierte Syntaxelemente - if (count($usersyntaxarray) > 0) { - $content .= ""; - } - $content .= "" - ."" - // Inhalte - ."" - ."" - .""; - // Benutzerdefinierte Syntaxelemente - if (count($usersyntaxarray) > 0) { - $content .= ""; - } - $content .= "" - ."
" - .getLanguageValue("toolbar_contents") - ."" - .getLanguageValue("toolbar_usersyntax") - ."
".returnOverviewSelectbox(1, $currentcat)."".returnOverviewSelectbox(2, $currentcat)."".returnOverviewSelectbox(3, $currentcat)."" - .returnUserSyntaxSelectbox() - ."
"; - - // Smileys - if ($CMS_CONF->get("replaceemoticons") == "true") { - $content .= '
'.returnSmileyBar().'
'; - } - # Plugins - $content .= '' - .'' - .'' - .'' - .'
'.getLanguageValue("toolbar_platzhalter").'
'.returnPluginSelectbox().''.returnPlatzhalterSelectbox().'
'; - - return $content; + global $CMS_CONF; + global $USER_SYNTAX; + + // Information zeigen, wenn JavaScript nicht aktiviert + $content = "" . '' . "" . + // Überschrift Syntaxelemente + "" . + // Überschrift Textformatierung + "" . + // Überschrift Farben + "" . "" . "" . + // Syntaxelemente + "" . + // Textformatierung + "" . + // Farben + "" . "" . "
" . getLanguageValue("toolbar_syntaxelements") . "" . getLanguageValue("toolbar_textformatting") . "" . getLanguageValue("toolbar_textcoloring") . "
" . returnFormatToolbarIcon("link") . returnFormatToolbarIcon("mail") . returnFormatToolbarIcon("seite") . returnFormatToolbarIcon("kategorie") . returnFormatToolbarIcon("datei") . returnFormatToolbarIcon("bild") . returnFormatToolbarIcon("bildlinks") . returnFormatToolbarIcon("bildrechts") . returnFormatToolbarIcon("ueber1") . returnFormatToolbarIcon("ueber2") . returnFormatToolbarIcon("ueber3") . returnFormatToolbarIcon("absatz") . returnFormatToolbarIcon("liste") . returnFormatToolbarIcon("numliste") . "\"Tabelle\">\\n< | >\\n]', true)\"" . createUserTooltipWZ(getLanguageValue("toolbar_desc_tabelle"), "[tabelle|<< | >> < | >]") . ">" . "\"Horizontale" . returnFormatToolbarIcon("html") . returnFormatToolbarIcon("include") . "" . returnFormatToolbarIcon("links") . returnFormatToolbarIcon("zentriert") . returnFormatToolbarIcon("block") . returnFormatToolbarIcon("rechts") . returnFormatToolbarIcon("fett") . returnFormatToolbarIcon("kursiv") . returnFormatToolbarIcon("unter") . returnFormatToolbarIcon("durch") . "" . '
' . "\"Farbe\"" . "" . "
" . "" . "\"...\"" . "
" . "
" . "
" . '' . ""; + + // Benutzerdefinierte Syntaxelemente vorbereiten + $usersyntaxarray = $USER_SYNTAX->toArray(); + + // Überschrift Inhalte + $content .= ""; + // Überschrift Benutzerdefinierte Syntaxelemente + if (count($usersyntaxarray) > 0) { + $content .= ""; + } + $content .= "" . "" . + // Inhalte + "" . "" . ""; + // Benutzerdefinierte Syntaxelemente + if (count($usersyntaxarray) > 0) { + $content .= ""; + } + $content .= "" . "
" . getLanguageValue("toolbar_contents") . "" . getLanguageValue("toolbar_usersyntax") . "
" . returnOverviewSelectbox(1, $currentcat) . "" . returnOverviewSelectbox(2, $currentcat) . "" . returnOverviewSelectbox(3, $currentcat) . "" . returnUserSyntaxSelectbox() . "
"; + + // Smileys + if ($CMS_CONF->get("replaceemoticons") == "true") { + $content .= '
' . returnSmileyBar() . '
'; + } + // Plugins + $content .= '' . '' . '' . '' . '
' . getLanguageValue("toolbar_platzhalter") . '
' . returnPluginSelectbox() . '' . returnPlatzhalterSelectbox() . '
'; + + return $content; } // Rueckgabe eines Standard-Formatsymbolleisten-Icons function returnFormatToolbarIcon($tag) { - return ''.$tag.''; - + return '' . $tag . ''; } - // Rueckgabe einer Selectbox mit Elementen, die per Klick in die Inhaltsseite uebernommen werden können // $type: 1=Kategorien & Inhaltsseiten 2=Dateien 3=Galerien // 4=Kategorien & Inhaltsseiten für Edit Select Inhaltseite ohne Klick in die Inhaltsseite function returnOverviewSelectbox($type, $currentcat) { - global $specialchars; - global $CatPage; - - $elements = array(); - $selectname = ""; - $spacer = " • "; - - switch ($type) { - - // Inhaltsseiten und Kategorien - case ($type == 1 or $type == 4): - $categories = $CatPage->get_CatArray(true,false); - foreach ($categories as $catdir) { - $cleancatname = $CatPage->get_HrefText($catdir,false); - $elements[] = array($cleancatname, ":".$cleancatname); - $files = $CatPage->get_PageArray($catdir, array(EXT_PAGE,EXT_HIDDEN), true); - foreach($files as $file) { - $cleanpagename = $CatPage->get_HrefText($catdir,$file); - $completepagename = $cleanpagename; - if ($CatPage->get_Type($catdir,$file) == EXT_HIDDEN) - $completepagename = $cleanpagename." (".getLanguageValue("page_saveashidden").")"; - if($type == 4) { - $elements[] = array($spacer.$completepagename, $CatPage->get_CatPageWithPos($catdir,false)."/".$CatPage->get_CatPageWithPos($catdir,$file).$CatPage->get_Type($catdir,$file)); - } else { - if ($catdir == $currentcat) - $elements[] = array($spacer.$completepagename, $cleanpagename); - else - $elements[] = array($spacer.$completepagename, $cleancatname.":".$cleanpagename); - } - } - } - - $selectname = "pages"; - if($type == 4) - $selectname = "edit_next_page"; - break; - - // Dateien - case 2: - // alle Kategorien durchgehen - $categories = $CatPage->get_CatArray(true,false); - foreach ($categories as $catdir) { - $cleancatname = $CatPage->get_HrefText($catdir,false); - $elements[] = array($cleancatname, ":".$cleancatname); - $currentcat_filearray = $CatPage->get_FileArray($catdir); - foreach ($currentcat_filearray as $current_file) { - if ($catdir == $currentcat) - $elements[] = array($spacer.$specialchars->rebuildSpecialChars($current_file, true, true), $specialchars->rebuildSpecialChars($current_file, true, true)); - else - $elements[] = array($spacer.$specialchars->rebuildSpecialChars($current_file, true, true), $cleancatname.":".$specialchars->rebuildSpecialChars($current_file, true, true)); - } - } - $selectname = "files"; - break; - - // Galerien - case 3: - $galleries = getDirAsArray(GALLERIES_DIR_REL,"dir","natcasesort"); - foreach ($galleries as $currentgallery) { - $elements[] = array($specialchars->rebuildSpecialChars($currentgallery, false, true), $specialchars->rebuildSpecialChars($currentgallery, false, false)); - } - $selectname = "gals"; - break; - - default: - return "WRONG PARAMETER!"; - } - - // Selectbox zusammenbauen - $select = ""; - // Titel der Selectbox - switch ($type) { - // Inhaltsseiten und Kategorien - case 1: - $select .=""; - break; - // Dateien - case 2: - $select .=""; - break; - // Galerien - case 3: - $select .=""; - break; - case 4: - $select .=""; - break; - } - // Elemente der Selectbox - foreach ($elements as $element) { - $tmp_element = NULL; - if($type == 1) - $tmp_element = substr($element[1], 1); - if(substr($element[1], 0, 1) == ":") { - $select .= ""; - } else { - if(strstr($element[1],"[") or strstr($element[1],"]")) - $element[1] = str_replace(array("[","]"),array("^[","^]"),$element[1]); - $select .= ""; - } - } - $select .= ""; - return $select; + global $specialchars; + global $CatPage; + + $elements = array(); + $selectname = ""; + $spacer = " • "; + + switch ($type) { + + // Inhaltsseiten und Kategorien + case ($type == 1 or $type == 4): + $categories = $CatPage->get_CatArray(true, false); + foreach ($categories as $catdir) { + $cleancatname = $CatPage->get_HrefText($catdir, false); + $elements [] = array( + $cleancatname, + ":" . $cleancatname + ); + $files = $CatPage->get_PageArray($catdir, array( + EXT_PAGE, + EXT_HIDDEN + ), true); + foreach ($files as $file) { + $cleanpagename = $CatPage->get_HrefText($catdir, $file); + $completepagename = $cleanpagename; + if ($CatPage->get_Type($catdir, $file) == EXT_HIDDEN) + $completepagename = $cleanpagename . " (" . getLanguageValue("page_saveashidden") . ")"; + if ($type == 4) { + $elements [] = array( + $spacer . $completepagename, + $CatPage->get_CatPageWithPos($catdir, false) . "/" . $CatPage->get_CatPageWithPos($catdir, $file) . $CatPage->get_Type($catdir, $file) + ); + } else { + if ($catdir == $currentcat) + $elements [] = array( + $spacer . $completepagename, + $cleanpagename + ); + else + $elements [] = array( + $spacer . $completepagename, + $cleancatname . ":" . $cleanpagename + ); + } + } + } + + $selectname = "pages"; + if ($type == 4) + $selectname = "edit_next_page"; + break; + + // Dateien + case 2: + // alle Kategorien durchgehen + $categories = $CatPage->get_CatArray(true, false); + foreach ($categories as $catdir) { + $cleancatname = $CatPage->get_HrefText($catdir, false); + $elements [] = array( + $cleancatname, + ":" . $cleancatname + ); + $currentcat_filearray = $CatPage->get_FileArray($catdir); + foreach ($currentcat_filearray as $current_file) { + if ($catdir == $currentcat) + $elements [] = array( + $spacer . $specialchars->rebuildSpecialChars($current_file, true, true), + $specialchars->rebuildSpecialChars($current_file, true, true) + ); + else + $elements [] = array( + $spacer . $specialchars->rebuildSpecialChars($current_file, true, true), + $cleancatname . ":" . $specialchars->rebuildSpecialChars($current_file, true, true) + ); + } + } + $selectname = "files"; + break; + + // Galerien + case 3: + $galleries = getDirAsArray(GALLERIES_DIR_REL, "dir", "natcasesort"); + foreach ($galleries as $currentgallery) { + $elements [] = array( + $specialchars->rebuildSpecialChars($currentgallery, false, true), + $specialchars->rebuildSpecialChars($currentgallery, false, false) + ); + } + $selectname = "gals"; + break; + + default: + return "WRONG PARAMETER!"; + } + + // Selectbox zusammenbauen + $select = ""; + // Titel der Selectbox + switch ($type) { + // Inhaltsseiten und Kategorien + case 1: + $select .= ""; + break; + // Dateien + case 2: + $select .= ""; + break; + // Galerien + case 3: + $select .= ""; + break; + case 4: + $select .= ""; + break; + } + // Elemente der Selectbox + foreach ($elements as $element) { + $tmp_element = NULL; + if ($type == 1) + $tmp_element = substr($element [1], 1); + if (substr($element [1], 0, 1) == ":") { + $select .= ""; + } else { + if (strstr($element [1], "[") or strstr($element [1], "]")) + $element [1] = str_replace(array( + "[", + "]" + ), array( + "^[", + "^]" + ), $element [1]); + $select .= ""; + } + } + $select .= ""; + return $select; } - // alle Dateien einer Kategorie aus der Download-Statistik löschen function deleteCategoryFromDownloadStats($catname) { - global $DOWNLOAD_COUNTS; - // Download-Statistik als Array holen - $downloadsarray = $DOWNLOAD_COUNTS->toArray(); - foreach($downloadsarray as $key => $value) { - // Keys mit zu löschendem Kategorienamen: aus dem Array nehmen - $data = explode(":", $key); - if ($data[0] == $catname) { - unset($downloadsarray[$key]); - } - } - // bearbeitetes Array wieder zurueck in die Download-Statistik schreiben - $DOWNLOAD_COUNTS->setFromArray($downloadsarray); + global $DOWNLOAD_COUNTS; + // Download-Statistik als Array holen + $downloadsarray = $DOWNLOAD_COUNTS->toArray(); + foreach ($downloadsarray as $key => $value) { + // Keys mit zu löschendem Kategorienamen: aus dem Array nehmen + $data = explode(":", $key); + if ($data [0] == $catname) { + unset($downloadsarray [$key]); + } + } + // bearbeitetes Array wieder zurueck in die Download-Statistik schreiben + $DOWNLOAD_COUNTS->setFromArray($downloadsarray); } - // eine Kategorie in der Download-Statistik umbenennen function renameCategoryInDownloadStats($oldcatname, $newcatname) { - global $DOWNLOAD_COUNTS; - // Download-Statistik als Array holen - $downloadsarray = $DOWNLOAD_COUNTS->toArray(); - foreach($downloadsarray as $key => $value) { - // Keys mit zu änderndem Kategorienamen: im Array ändern - $keyparts = explode(":", $key); - if ($keyparts[0] == $oldcatname) { - $downloadsarray[$newcatname.":".$keyparts[1]] = $value; // Element mit neuem Key ans Array hängen - unset($downloadsarray[$key]); // Element mit altem Key aus Array löschen - } - } - // bearbeitetes Array wieder zurueck in die Download-Statistik schreiben - $DOWNLOAD_COUNTS->setFromArray($downloadsarray); + global $DOWNLOAD_COUNTS; + // Download-Statistik als Array holen + $downloadsarray = $DOWNLOAD_COUNTS->toArray(); + foreach ($downloadsarray as $key => $value) { + // Keys mit zu änderndem Kategorienamen: im Array ändern + $keyparts = explode(":", $key); + if ($keyparts [0] == $oldcatname) { + $downloadsarray [$newcatname . ":" . $keyparts [1]] = $value; // Element mit neuem Key ans Array hängen + unset($downloadsarray [$key]); // Element mit altem Key aus Array löschen + } + } + // bearbeitetes Array wieder zurueck in die Download-Statistik schreiben + $DOWNLOAD_COUNTS->setFromArray($downloadsarray); } // Überschreibt die layoutabhängigen CMS-Einstellungen usesubmenu function setLayoutAndDependentSettings($layoutfolder) { - global $CMS_CONF; - #global $GALLERY_CONF; - - $settingsfile = "../layouts/$layoutfolder/layoutsettings.conf"; - - // Einstellungen aus Layout-Settings laden und in den CMS-Einstellungen ueberschreiben - $layoutsettings = new Properties($settingsfile); - if(!isset($layoutsettings->properties['readonly'])) { - return $layoutsettings->properties; - } else { - $CMS_CONF->set("usesubmenu", $layoutsettings->get("usesubmenu")); - if(isset($layoutsettings->properties['usesubmenu'])) - return $layoutsettings->properties['usesubmenu']; - } + global $CMS_CONF; + // global $GALLERY_CONF; + + $settingsfile = "../layouts/$layoutfolder/layoutsettings.conf"; + + // Einstellungen aus Layout-Settings laden und in den CMS-Einstellungen ueberschreiben + $layoutsettings = new Properties($settingsfile); + if (!isset($layoutsettings->properties ['readonly'])) { + return $layoutsettings->properties; + } else { + $CMS_CONF->set("usesubmenu", $layoutsettings->get("usesubmenu")); + if (isset($layoutsettings->properties ['usesubmenu'])) + return $layoutsettings->properties ['usesubmenu']; + } } // Hochgeladene Datei ueberpruefen und speichern -function uploadFile($uploadfile, $destination, $forceoverwrite,$MAX_IMG_WIDTH,$MAX_IMG_HEIGHT){ - global $ADMIN_CONF; - global $specialchars; - - $uploadfile_name = $specialchars->replaceSpecialChars($uploadfile['name'],false); - if (isset($uploadfile) and !$uploadfile['error']) { - // nicht erlaubte Endung - if (fileHasExtension($uploadfile_name, explode(",", $ADMIN_CONF->get("noupload")))) { - return array("files_error_wrongext" => $uploadfile_name); - } - // ungueltige Zeichen im Dateinamen - elseif(!preg_match($specialchars->getFileCharsRegex(), $uploadfile_name)) { - return array("files_error_name" => $uploadfile_name); - } - // Datei vorhanden und "Überschreiben"-Checkbox nicht aktiviert - elseif (file_exists($destination.$uploadfile_name) && ($forceoverwrite != "on")) { - return array("files_error_exists" => $uploadfile_name); - } - // alles okay, hochladen! - else { - move_uploaded_file($uploadfile['tmp_name'], $destination.$uploadfile_name); - $line_error = __LINE__ - 1; - $last_error['line'] = NULL; - if(function_exists("error_get_last")) { - $last_error = @error_get_last(); - } - if($last_error['line'] == $line_error) { - return array("php_error" => $last_error['message']); - } elseif(!is_file($destination.$uploadfile_name)) { - return array("files_error_upload" => $uploadfile_name); - } - // chmod, wenn so eingestellt - useChmod($destination.$uploadfile_name);#maximagewidth maximageheight - if((!empty($MAX_IMG_WIDTH) or !empty($MAX_IMG_HEIGHT)) and preg_match("/^(\w)+(.gif|.png|.jpeg|.jpg)$/",strtolower($uploadfile_name))) { - // Bilddaten feststellen - $size = getimagesize($destination.$uploadfile_name); - // Mimetype herausfinden - $image_typ = strtolower(str_replace('image/','',$size['mime'])); - # nur wenns ein bild ist - if($image_typ == "gif" or $image_typ == "png" or $image_typ == "jpeg") { - require_once(BASE_DIR_CMS."Image.php"); - scaleImage($uploadfile_name, $destination, $destination, $MAX_IMG_WIDTH, $MAX_IMG_HEIGHT); - } else { - return array("files_error_no_image" => $uploadfile_name); - } - } - return; - } - } +function uploadFile($uploadfile, $destination, $forceoverwrite, $MAX_IMG_WIDTH, $MAX_IMG_HEIGHT) { + global $ADMIN_CONF; + global $specialchars; + + $uploadfile_name = $specialchars->replaceSpecialChars($uploadfile ['name'], false); + if (isset($uploadfile) and !$uploadfile ['error']) { + // nicht erlaubte Endung + if (fileHasExtension($uploadfile_name, explode(",", $ADMIN_CONF->get("noupload")))) { + return array( + "files_error_wrongext" => $uploadfile_name + ); + } // ungueltige Zeichen im Dateinamen + elseif (!preg_match($specialchars->getFileCharsRegex(), $uploadfile_name)) { + return array( + "files_error_name" => $uploadfile_name + ); + } // Datei vorhanden und "Überschreiben"-Checkbox nicht aktiviert + elseif (file_exists($destination . $uploadfile_name) && ($forceoverwrite != "on")) { + return array( + "files_error_exists" => $uploadfile_name + ); + } // alles okay, hochladen! + else { + move_uploaded_file($uploadfile ['tmp_name'], $destination . $uploadfile_name); + $line_error = __LINE__ - 1; + $last_error = null; + if (function_exists("error_get_last")) { + $last_error = @error_get_last(); + } + if ($last_error == null) { + $last_error ['line'] = NULL; + } + if ($last_error ['line'] == $line_error) { + return array( + "php_error" => $last_error ['message'] + ); + } elseif (!is_file($destination . $uploadfile_name)) { + return array( + "files_error_upload" => $uploadfile_name + ); + } + // chmod, wenn so eingestellt + useChmod($destination . $uploadfile_name); // maximagewidth maximageheight + if ((!empty($MAX_IMG_WIDTH) or !empty($MAX_IMG_HEIGHT)) and preg_match("/^(\w)+(.gif|.png|.jpeg|.jpg)$/", strtolower($uploadfile_name))) { + // Bilddaten feststellen + $size = getimagesize($destination . $uploadfile_name); + // Mimetype herausfinden + $image_typ = strtolower(str_replace('image/', '', $size ['mime'])); + // nur wenns ein bild ist + if ($image_typ == "gif" or $image_typ == "png" or $image_typ == "jpeg") { + require_once (BASE_DIR_CMS . "Image.php"); + scaleImage($uploadfile_name, $destination, $destination, $MAX_IMG_WIDTH, $MAX_IMG_HEIGHT); + } else { + return array( + "files_error_no_image" => $uploadfile_name + ); + } + } + return; + } + } } - // Gibt eine Checkbox mit dem uebergebenen Namen zurueck. Der Parameter checked bestimmt, ob die Checkbox angehakt ist. function buildCheckBox($name, $checked) { - $checkbox = ''; - return $checkbox; + $checkbox = ''; + return $checkbox; } // gibt zurueck, ob eine Checkbox angehakt ist function checkBoxChecked($checkboxrequest) { - if(isset($_POST[$checkboxrequest]) and ($_POST[$checkboxrequest] == "true")) { - return "true"; - } else { - return "false"; - } + if (isset($_POST [$checkboxrequest]) and ($_POST [$checkboxrequest] == "true")) { + return "true"; + } else { + return "false"; + } } // ------------------------------------------------------------------------------ // Hilfsfunktion: Sichert einen Input-Wert // ------------------------------------------------------------------------------ - function cleanInput($input) { - if (function_exists("mb_convert_encoding")) { - $input = @mb_convert_encoding($input,CHARSET,@mb_detect_encoding($input,"UTF-8,ISO-8859-1,ISO-8859-15",true)); - } - return $input; - } +function cleanInput($input) { + if (function_exists("mb_convert_encoding")) { + $input = @mb_convert_encoding($input, CHARSET, @mb_detect_encoding($input, "UTF-8,ISO-8859-1,ISO-8859-15", true)); + } + return $input; +} // ------------------------------------------------------------------------------ // Hilfsfunktion: Prueft einen Requestparameter // ------------------------------------------------------------------------------ - function getRequestParam($param, $clean) { - if (isset($_POST[$param])) { - if ($clean) { - return cleanInput($_POST[$param]); - } else { - return $_POST[$param]; - } - } - // Parameter ist nicht im Request vorhanden - else { - return false; - } - } - +function getRequestParam($param, $clean) { + if (isset($_POST [$param])) { + if ($clean) { + return cleanInput($_POST [$param]); + } else { + return $_POST [$param]; + } + } // Parameter ist nicht im Request vorhanden + else { + return false; + } +} + // ------------------------------------------------------------------------------ // Hilfsfunktion: Baut für das übergebene Thema den URL zur Hilfe zusammen // ------------------------------------------------------------------------------ - function getHelpUrlForSubject($subject) { - // Das könnte später noch mehrsprachig erweitert werden, wenn anderssprachige Dokus existieren - return "http://mozilo.de/hilfe/?thema=".$subject; - } +function getHelpUrlForSubject($subject) { + // Das könnte später noch mehrsprachig erweitert werden, wenn anderssprachige Dokus existieren + return "http://mozilo.de/hilfe/?thema=" . $subject; +} ?> \ No newline at end of file diff --git a/cms/DefaultConf.php b/cms/DefaultConf.php index fd89dfb..375d3aa 100644 --- a/cms/DefaultConf.php +++ b/cms/DefaultConf.php @@ -1,298 +1,319 @@ $value) { - if(is_array($post_return[$key])) { - $post_return[$key] = cleanREQUEST($post_return[$key]); - } else { - // Nullbytes abfangen! - if (strpos("tmp".$value, "\x00") > 0 or strpos("tmp".$key, "\x00") > 0) { - die(); - } - # auf manchen Systemen mus ein stripslashes() gemacht werden - if(strpos("tmp".$value,'\\') > 0 - and addslashes(stripslashes($value)) == $value) { - $value = stripslashes($value); - } - # auf manchen Systemen mus ein stripslashes() gemacht werden - if(strpos("tmp".$key,'\\') > 0 - and addslashes(stripslashes($key)) == $key) { - $value = stripslashes($key); - } - $post_return[$key] = $value; - } - } - return $post_return; + foreach ($post_return as $key => $value) { + if (is_array($post_return [$key])) { + $post_return [$key] = cleanREQUEST($post_return [$key]); + } else { + // Nullbytes abfangen! + if (strpos("tmp" . $value, "\x00") > 0 or strpos("tmp" . $key, "\x00") > 0) { + die(); + } + // auf manchen Systemen mus ein stripslashes() gemacht werden + if (strpos("tmp" . $value, '\\') > 0 and addslashes(stripslashes($value)) == $value) { + $value = stripslashes($value); + } + // auf manchen Systemen mus ein stripslashes() gemacht werden + if (strpos("tmp" . $key, '\\') > 0 and addslashes(stripslashes($key)) == $key) { + $value = stripslashes($key); + } + $post_return [$key] = $value; + } + } + return $post_return; } -# Alle Platzhalter +// Alle Platzhalter function makePlatzhalter($all = false) { - # Alle Platzhalter für die Selctbox im Editor als array - $platzhalter = array( - '{BASE_URL}', - '{CATEGORY_NAME}', - '{CATEGORY}', - '{CATEGORY_URL}', - '{PAGE_NAME}', - '{PAGE_FILE}', - '{PAGE_URL}', - '{PAGE}', - '{SEARCH}', - '{SITEMAPLINK}', - '{CMSINFO}', - '{TABLEOFCONTENTS}' - ); - # Die Rstlichen Platzhalter - $platzhalter_rest = array( - '{CSS_FILE}', - '{CHARSET}', - '{FAVICON_FILE}', - '{LAYOUT_DIR}', - '{WEBSITE_TITLE}', - '{WEBSITE_KEYWORDS}', - '{WEBSITE_DESCRIPTION}', - '{WEBSITE_NAME}', - '{MAINMENU}', - '{DETAILMENU}', - '{MEMORYUSAGE}', - '{EXECUTETIME}' - ); + // Alle Platzhalter für die Selctbox im Editor als array + $platzhalter = array( + '{BASE_URL}', + '{CATEGORY_NAME}', + '{CATEGORY}', + '{CATEGORY_URL}', + '{PAGE_NAME}', + '{PAGE_FILE}', + '{PAGE_URL}', + '{PAGE}', + '{SEARCH}', + '{SITEMAPLINK}', + '{CMSINFO}', + '{TABLEOFCONTENTS}' + ); + // Die Rstlichen Platzhalter + $platzhalter_rest = array( + '{CSS_FILE}', + '{CHARSET}', + '{FAVICON_FILE}', + '{LAYOUT_DIR}', + '{WEBSITE_TITLE}', + '{WEBSITE_KEYWORDS}', + '{WEBSITE_DESCRIPTION}', + '{WEBSITE_NAME}', + '{MAINMENU}', + '{DETAILMENU}', + '{MEMORYUSAGE}', + '{EXECUTETIME}' + ); - if($all) { - $platzhalter = array_merge($platzhalter,$platzhalter_rest); - } - return $platzhalter; + if ($all) { + $platzhalter = array_merge($platzhalter, $platzhalter_rest); + } + return $platzhalter; } -# $conf_datei = voller pfad und conf Dateiname oder nur Array Name +// $conf_datei = voller pfad und conf Dateiname oder nur Array Name function makeDefaultConf($conf_datei) { - $basic = array( - 'text' => array( - 'adminmail' => '', - 'language' => 'deDE', - 'noupload' => 'php,php3,php4,php5'), - 'digit' => array( - 'backupmsgintervall' => '30', - 'chmodnewfilesatts' => '', - 'lastbackup' => time(), - 'maximageheight' => '', - 'maximagewidth' => '', - 'maxnumberofuploadfiles' => '5', - 'textareaheight' => '270'), - 'checkbox' => array( - 'overwriteuploadfiles' => 'false', - 'sendadminmail' => 'false', - 'showTooltips' => 'true', - 'usebigactionicons' => 'false', - 'showexpert' => 'false'), - # das sind die Expert Parameter von basic - 'expert' => array( - 'noupload', - 'backupmsgintervall', - 'lastbackup', - 'maxnumberofuploadfiles', - 'showTooltips', - 'textareaheight', - 'usebigactionicons', - 'overwriteuploadfiles') - ); + $basic = array( + 'text' => array( + 'adminmail' => '', + 'language' => 'deDE', + 'noupload' => 'php,php3,php4,php5' + ), + 'digit' => array( + 'backupmsgintervall' => '30', + 'chmodnewfilesatts' => '', + 'lastbackup' => time(), + 'maximageheight' => '', + 'maximagewidth' => '', + 'maxnumberofuploadfiles' => '5', + 'textareaheight' => '270' + ), + 'checkbox' => array( + 'overwriteuploadfiles' => 'false', + 'sendadminmail' => 'false', + 'showTooltips' => 'true', + 'usebigactionicons' => 'false', + 'showexpert' => 'false' + ), + // das sind die Expert Parameter von basic + 'expert' => array( + 'noupload', + 'backupmsgintervall', + 'lastbackup', + 'maxnumberofuploadfiles', + 'showTooltips', + 'textareaheight', + 'usebigactionicons', + 'overwriteuploadfiles' + ) + ); - $main = array( - 'text' => array( - 'shortenlinks' => '0', - 'titlebarseparator' => '%20%3A%3A%20', - 'usesubmenu' => '1', - 'websitedescription' => '', - 'websitekeywords' => '', - 'websitetitle' => 'moziloCMS%20-%20Das%20CMS%20f%C3%BCr%20Einsteiger'), - 'select' => array( - 'cmslanguage' => 'deDE', - 'cmslayout' => 'moziloCMS', - 'defaultcat' => '10_Willkommen', - 'titlebarformat' => '%7BWEBSITE%7D'), - 'checkbox' => array( - 'hidecatnamedpages' => 'false', - 'modrewrite' => 'false', - 'replaceemoticons' => 'true', - 'showhiddenpagesasdefaultpage' => ' false', - 'showhiddenpagesincmsvariables' => ' false', - 'showhiddenpagesinlastchanged' => 'false', - 'showhiddenpagesinsearch' => 'false', - 'showhiddenpagesinsitemap' => 'false', - 'showsyntaxtooltips' => 'true', - 'targetblank_download' => 'true', - 'targetblank_link' => 'true', - 'usecmssyntax' => 'true', - 'usecmseditarea' => 'true'), - # das sind die Expert Parameter von main - 'expert' => array( - 'hidecatnamedpages', - 'modrewrite', - 'showhiddenpagesasdefaultpage', - 'showhiddenpagesincmsvariables', - 'showhiddenpagesinlastchanged', - 'showhiddenpagesinsearch', - 'showhiddenpagesinsitemap', - 'targetblank_download', - 'targetblank_link', - 'showsyntaxtooltips', - 'replaceemoticons', - 'shortenlinks', - 'usecmssyntax', - 'usesubmenu', - 'usecmseditarea') - ); + $main = array( + 'text' => array( + 'shortenlinks' => '0', + 'titlebarseparator' => '%20%3A%3A%20', + 'usesubmenu' => '1', + 'websitedescription' => '', + 'websitekeywords' => '', + 'websitetitle' => 'moziloCMS%20-%20Das%20CMS%20f%C3%BCr%20Einsteiger' + ), + 'select' => array( + 'cmslanguage' => 'deDE', + 'cmslayout' => 'moziloCMS', + 'defaultcat' => '10_Willkommen', + 'titlebarformat' => '%7BWEBSITE%7D' + ), + 'checkbox' => array( + 'hidecatnamedpages' => 'false', + 'modrewrite' => 'false', + 'replaceemoticons' => 'true', + 'showhiddenpagesasdefaultpage' => ' false', + 'showhiddenpagesincmsvariables' => ' false', + 'showhiddenpagesinlastchanged' => 'false', + 'showhiddenpagesinsearch' => 'false', + 'showhiddenpagesinsitemap' => 'false', + 'showsyntaxtooltips' => 'true', + 'targetblank_download' => 'true', + 'targetblank_link' => 'true', + 'usecmssyntax' => 'true', + 'usecmseditarea' => 'true' + ), + // das sind die Expert Parameter von main + 'expert' => array( + 'hidecatnamedpages', + 'modrewrite', + 'showhiddenpagesasdefaultpage', + 'showhiddenpagesincmsvariables', + 'showhiddenpagesinlastchanged', + 'showhiddenpagesinsearch', + 'showhiddenpagesinsitemap', + 'targetblank_download', + 'targetblank_link', + 'showsyntaxtooltips', + 'replaceemoticons', + 'shortenlinks', + 'usecmssyntax', + 'usesubmenu', + 'usecmseditarea' + ) + ); - $syntax = array('wikipedia' => '[link={DESCRIPTION}|http://de.wikipedia.org/wiki/{VALUE}]'); -/* - $formular = array('formularmail' => '', - 'contactformusespamprotection' => 'true', - 'contactformwaittime' => '15', - 'mail' => ',true,true', - 'message' => ',true,true', - 'name' => ',true,true', - 'website' => ',true,false'); -*/ - $logindata = array('falselogincount' => '0', - 'falselogincounttemp' => '0', - 'initialpw' => 'true', - 'initialsetup' => 'true', - 'loginlockstarttime' => '', - 'name' => 'admin', - 'pw' => '19ad89bc3e3c9d7ef68b89523eff1987'); + $syntax = array( + 'wikipedia' => '[link={DESCRIPTION}|http://de.wikipedia.org/wiki/{VALUE}]' + ); + /* + * $formular = array('formularmail' => '', + * 'contactformusespamprotection' => 'true', + * 'contactformwaittime' => '15', + * 'mail' => ',true,true', + * 'message' => ',true,true', + * 'name' => ',true,true', + * 'website' => ',true,false'); + */ + $logindata = array( + 'falselogincount' => '0', + 'falselogincounttemp' => '0', + 'initialpw' => 'true', + 'initialsetup' => 'true', + 'loginlockstarttime' => '', + 'name' => 'admin', + 'pw' => '19ad89bc3e3c9d7ef68b89523eff1987' + ); - $downloads = array('_downloadcounterstarttime' => time()); + $downloads = array( + '_downloadcounterstarttime' => time() + ); - $version = array('cmsversion' => '1.12.php7.3', - 'cmsname' => 'Amalia', - 'revision' => 'xxx'); + $version = array( + 'cmsversion' => '1.12.php8', + 'cmsname' => 'Amalia', + 'revision' => 'xxx' + ); - $gallery = array('digit' => array( - 'maxheight' => '', - 'maxwidth' => '', - 'maxthumbheight' => '100', - 'maxthumbwidth' => '100'), -## 'checkbox' => array( -## 'createthumbs' => 'true'), - 'expert' => array( -## 'createthumbs', - 'maxthumbheight', - 'maxthumbwidth') - ); + $gallery = array( + 'digit' => array( + 'maxheight' => '', + 'maxwidth' => '', + 'maxthumbheight' => '100', + 'maxthumbwidth' => '100' + ), + // # 'checkbox' => array( + // # 'createthumbs' => 'true'), + 'expert' => array( + // # 'createthumbs', + 'maxthumbheight', + 'maxthumbwidth' + ) + ); - $plugin = array('active' => 'true'); + $plugin = array( + 'active' => 'true' + ); - $passwords = array('# Kategorie/Inhaltsseite' => 'password'); + $passwords = array( + '# Kategorie/Inhaltsseite' => 'password' + ); - # ist eine *.conf datei angegeben wird das jeweilige array ohne expert und nur der inhalt der subarrays zurückgegeben - if(strpos($conf_datei,".conf") > 0) { - $name = substr(basename($conf_datei),0,-(strlen(".conf"))); - # beim erzeugen duerfen sub arrays nicht mit rein - foreach($$name as $key => $value) { - if($key == "expert") continue; - if(is_array($value)) { - foreach($value as $key => $value) { - $return_array[$key] = $value; - } - } else { - $return_array = $$name; - break; - } - } - return $return_array; - # ist es keine *.conf einfach das ganze array zurück - } else { - return $$conf_datei; - } + // ist eine *.conf datei angegeben wird das jeweilige array ohne expert und nur der inhalt der subarrays zurückgegeben + if (strpos($conf_datei, ".conf") > 0) { + $name = substr(basename($conf_datei), 0, -(strlen(".conf"))); + // beim erzeugen duerfen sub arrays nicht mit rein + foreach ($$name as $key => $value) { + if ($key == "expert") + continue; + if (is_array($value)) { + foreach ($value as $key => $value) { + $return_array [$key] = $value; + } + } else { + $return_array = $$name; + break; + } + } + return $return_array; + // ist es keine *.conf einfach das ganze array zurück + } else { + return $$conf_datei; + } } // ------------------------------------------------------------------------------ // Handelt es sich um ein valides Verzeichnis / eine valide Datei? // ------------------------------------------------------------------------------ function isValidDirOrFile($file) { - # Alles, was einen Punkt vor der Datei hat - if(strpos($file,".") === 0) { - return false; - } - # alle PHP-Dateien - if(substr($file,-4) == ".php") { - return false; - } - # ...und der Rest - if(in_array($file, array( - "Thumbs.db", // Windows-spezifisch - "__MACOSX", // Mac-spezifisch - "settings" // Eclipse - ))) { - return false; - } - return true; + // Alles, was einen Punkt vor der Datei hat + if (strpos($file, ".") === 0) { + return false; + } + // alle PHP-Dateien + if (substr($file, -4) == ".php") { + return false; + } + // ...und der Rest + if (in_array($file, array( + "Thumbs.db", // Windows-spezifisch + "__MACOSX", // Mac-spezifisch + "settings" // Eclipse + ))) { + return false; + } + return true; } -# $filetype = "dir" nur ordner -# $filetype = "file" nur dateien -# $filetype = array(".txt",".hid",...) nur die mit dieser ext -# Achtung Punkt nicht vergessen Gross/Kleinschreibung ist egal -# $filetype = false alle dateien -# $sort_type = "sort" (Default) oder "natcasesort" oder "none" -function getDirAsArray($dir,$filetype = false,$sort_type = "sort") { - $dateien = array(); - if(is_dir($dir) and false !== ($currentdir = opendir($dir))) { - while(false !== ($file = readdir($currentdir))) { - # keine gültige datei gleich zur nächsten datei - if(!isValidDirOrFile($file)) - continue; - # nur mit ext - if(is_array($filetype)) { - # alle ext im array in kleinschreibung wandeln - $filetype = array_map('strtolower', $filetype); - $ext = strtolower(substr($file,strrpos($file,"."))); - if(in_array($ext,$filetype)) { - $dateien[] = $file; - } - # nur dir oder file - // AZI 2017-09-17: Auch Symlinks müssen beachtet werden - //} elseif(filetype($dir."/".$file) == $filetype) { - } elseif(filetype($dir."/".$file) == $filetype || filetype($dir."/".$file) == 'link') { - // /AZI - $dateien[] = $file; - # alle - } elseif(!$filetype) { - $dateien[] = $file; - } - } - closedir($currentdir); - if($sort_type == "sort") - sort($dateien); - elseif($sort_type == "natcasesort") - natcasesort($dateien); - } - return $dateien; +// $filetype = "dir" nur ordner +// $filetype = "file" nur dateien +// $filetype = array(".txt",".hid",...) nur die mit dieser ext +// Achtung Punkt nicht vergessen Gross/Kleinschreibung ist egal +// $filetype = false alle dateien +// $sort_type = "sort" (Default) oder "natcasesort" oder "none" +function getDirAsArray($dir, $filetype = false, $sort_type = "sort") { + $dateien = array(); + if (is_dir($dir) and false !== ($currentdir = opendir($dir))) { + while (false !== ($file = readdir($currentdir))) { + // keine gültige datei gleich zur nächsten datei + if (!isValidDirOrFile($file)) + continue; + // nur mit ext + if (is_array($filetype)) { + // alle ext im array in kleinschreibung wandeln + $filetype = array_map('strtolower', $filetype); + $ext = strtolower(substr($file, strrpos($file, "."))); + if (in_array($ext, $filetype)) { + $dateien [] = $file; + } + // nur dir oder file + // AZI 2017-09-17: Auch Symlinks müssen beachtet werden + // } elseif(filetype($dir."/".$file) == $filetype) { + } elseif (filetype($dir . "/" . $file) == $filetype || filetype($dir . "/" . $file) == 'link') { + // /AZI + $dateien [] = $file; + // alle + } elseif (!$filetype) { + $dateien [] = $file; + } + } + closedir($currentdir); + if ($sort_type == "sort") + sort($dateien); + elseif ($sort_type == "natcasesort") + natcasesort($dateien); + } + return $dateien; } ?> \ No newline at end of file diff --git a/cms/SpecialChars.php b/cms/SpecialChars.php index 53d5058..b9df982 100644 --- a/cms/SpecialChars.php +++ b/cms/SpecialChars.php @@ -1,142 +1,139 @@ getHtmlEntityDecode(implode("", get_html_translation_table(HTML_ENTITIES, ENT_QUOTES))))."]+$/"; - $regex = str_replace("'", "'", $regex); - return $regex; - } + function getHtmlEntityDecode($string) { + if ((version_compare(phpversion(), '5.0') < 0)) { + $replace = array_keys(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)); + // get_html_translation_table liefert die Zeichen im ISO-8859-1 Format - wir brauchen UTF-8 + $replace = implode(",", $replace); + if (function_exists("utf8_encode")) { + $replace = utf8_encode($replace); + } elseif (function_exists("mb_convert_encoding")) { + $replace = mb_convert_encoding($replace, CHARSET); + } elseif (function_exists("iconv")) { + $replace = iconv('ISO-8859-1', CHARSET . '//IGNORE', $replace); + } + $replace = explode(",", $replace); + $string = str_replace(array_values(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)), $replace, $string); + } else { + $string = html_entity_decode($string, ENT_QUOTES, CHARSET); + } + return $string; + } -// ------------------------------------------------------------------------------ -// Inhaltsseiten/Kategorien für Speicherung umlaut- und sonderzeichenbereinigen -// ------------------------------------------------------------------------------ - function replaceSpecialChars($text,$nochmal_erlauben) { - # $nochmal_erlauben = für Tags mit src z.B. img dann muss das % auch gewandelt werden - $text = str_replace('/','ssslashhh',$text); - if(preg_match('#\%([0-9a-f]{2})#i',$text) < 1) - $text = rawurlencode(stripslashes($text)); - if($nochmal_erlauben) - $text = rawurlencode(stripslashes($text)); - $text = str_replace('ssslashhh','/',$text); - return $text; - } + // ------------------------------------------------------------------------------ + // Erlaubte Sonderzeichen als RegEx zurückgeben + // ------------------------------------------------------------------------------ + function getSpecialCharsRegex() { + $regex = "/^[a-zA-Z0-9_\%\-\s\?\!\@\.€" . addslashes($this->getHtmlEntityDecode(implode("", get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)))) . "]+$/"; + $regex = str_replace("'", "'", $regex); + return $regex; + } -// ------------------------------------------------------------------------------ -// Umlaute in Inhaltsseiten/Kategorien für Anzeige -// ------------------------------------------------------------------------------ - function rebuildSpecialChars($text, $rebuildnbsp, $html) { - $text = rawurldecode($text); - if($html) { - $test = htmlentities($text,ENT_COMPAT,CHARSET); -# hier muss noch geschraubt werden iconv gibts auf manchen systemen nicht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if(empty($test) and function_exists("iconv")) { - # htmlentities gibt einen leeren sring zurück wenn im string ein unbekantes zeichen ist - # iconv entfernt es einfach - $test = htmlentities(@iconv(CHARSET,CHARSET.'//IGNORE',$text),ENT_COMPAT,CHARSET); - } - $text = $test; - $text = str_replace('&#','&#',$text); - } - // Leerzeichen - if ($rebuildnbsp and !$html) - $text = str_replace(" ", " ", $text); - elseif(!$rebuildnbsp and $html) - $text = str_replace(" ", " ", $text); - return $text; - } + // ------------------------------------------------------------------------------ + // Inhaltsseiten/Kategorien für Speicherung umlaut- und sonderzeichenbereinigen + // ------------------------------------------------------------------------------ + function replaceSpecialChars($text, $nochmal_erlauben) { + // $nochmal_erlauben = für Tags mit src z.B. img dann muss das % auch gewandelt werden + $text = str_replace('/', 'ssslashhh', $text); + if (preg_match('#\%([0-9a-f]{2})#i', $text) < 1) + $text = rawurlencode(stripslashes($text)); + if ($nochmal_erlauben) + $text = rawurlencode(stripslashes($text)); + $text = str_replace('ssslashhh', '/', $text); + return $text; + } + // ------------------------------------------------------------------------------ + // Umlaute in Inhaltsseiten/Kategorien für Anzeige + // ------------------------------------------------------------------------------ + function rebuildSpecialChars($text, $rebuildnbsp, $html) { + $text = $text === null ? '' : $text; + $text = rawurldecode($text); + if ($html) { + $test = htmlentities($text, ENT_COMPAT, CHARSET); + // hier muss noch geschraubt werden iconv gibts auf manchen systemen nicht!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + if (empty($test) and function_exists("iconv")) { + // htmlentities gibt einen leeren sring zurück wenn im string ein unbekantes zeichen ist + // iconv entfernt es einfach + $test = htmlentities(@iconv(CHARSET, CHARSET . '//IGNORE', $text), ENT_COMPAT, CHARSET); + } + $text = $test; + $text = str_replace('&#', '&#', $text); + } + // Leerzeichen + if ($rebuildnbsp and !$html) + $text = str_replace(" ", " ", $text); + elseif (!$rebuildnbsp and $html) + $text = str_replace(" ", " ", $text); + return $text; + } -// ------------------------------------------------------------------------------ -// Für Datei-Uploads erlaubte Sonderzeichen als RegEx zurückgeben -// ------------------------------------------------------------------------------ - function getFileCharsRegex() { - $regex = "/^[a-zA-Z0-9_\%\-\.]+$/"; - return $regex; - } + // ------------------------------------------------------------------------------ + // Für Datei-Uploads erlaubte Sonderzeichen als RegEx zurückgeben + // ------------------------------------------------------------------------------ + function getFileCharsRegex() { + $regex = "/^[a-zA-Z0-9_\%\-\.]+$/"; + return $regex; + } -// ------------------------------------------------------------------------------ -// Für Datei-Uploads erlaubte Sonderzeichen userlesbar als String zurückgeben -// ------------------------------------------------------------------------------ - function getFileCharsString($sep, $charsperline) { - $filecharsstring = ""; - $filecharshtml = ""; - for ($i=65; $i<=90;$i++) - $filecharsstring .= chr($i); - for ($i=97; $i<=122;$i++) - $filecharsstring .= chr($i); - for ($i=48; $i<=57;$i++) - $filecharsstring .= chr($i); - $filecharsstring .= "_-."; - for ($i=0; $i<=strlen($filecharsstring); $i+=$charsperline) { - $filecharshtml .= htmlentities(substr($filecharsstring, $i, $charsperline),ENT_COMPAT,CHARSET)."
"; - } - return $filecharshtml; - } + // ------------------------------------------------------------------------------ + // Für Datei-Uploads erlaubte Sonderzeichen userlesbar als String zurückgeben + // ------------------------------------------------------------------------------ + function getFileCharsString($sep, $charsperline) { + $filecharsstring = ""; + $filecharshtml = ""; + for($i = 65; $i <= 90; $i++) + $filecharsstring .= chr($i); + for($i = 97; $i <= 122; $i++) + $filecharsstring .= chr($i); + for($i = 48; $i <= 57; $i++) + $filecharsstring .= chr($i); + $filecharsstring .= "_-."; + for($i = 0; $i <= strlen($filecharsstring); $i += $charsperline) { + $filecharshtml .= htmlentities(substr($filecharsstring, $i, $charsperline), ENT_COMPAT, CHARSET) . "
"; + } + return $filecharshtml; + } -// ------------------------------------------------------------------------------ -// Hilfsfunktion: Wandelt numerische Entities im übergebenen Text in Zeichen -// ------------------------------------------------------------------------------ - function numeric_entities_decode($text) { - return str_replace('&#', '&#', $text); - } + // ------------------------------------------------------------------------------ + // Hilfsfunktion: Wandelt numerische Entities im übergebenen Text in Zeichen + // ------------------------------------------------------------------------------ + function numeric_entities_decode($text) { + return str_replace('&#', '&#', $text); + } -// ------------------------------------------------------------------------------ -// Geschütze zeichen codieren -// ------------------------------------------------------------------------------ - function encodeProtectedChr($text) {# protected - # alle geschützten zeichen suchen und in html code wandeln auch das ^ - //$text = preg_replace("/\^(.)/Umsie", "'^&#'.ord('\\1').';'", $text); - $text = preg_replace_callback("/\^(.)/Umsi", function ($treffer) { - return '^&#'.ord($treffer[1]).';'; + // ------------------------------------------------------------------------------ + // Geschütze zeichen codieren + // ------------------------------------------------------------------------------ + function encodeProtectedChr($text) { // protected + // alle geschützten zeichen suchen und in html code wandeln auch das ^ + // $text = preg_replace("/\^(.)/Umsie", "'^&#'.ord('\\1').';'", $text); + $text = preg_replace_callback("/\^(.)/Umsi", function ($treffer) { + return '^&#' . ord($treffer [1]) . ';'; }, $text); - return $text; - } + return $text; + } -// ------------------------------------------------------------------------------ -// Geschütze zeichen wieder herstellen -// ------------------------------------------------------------------------------ - function decodeProtectedChr($text) { - # alle ^&#?????; suchen und als zeichen ohne ^ (^) ersetzen - //$text = preg_replace("/^&#(\d{2,5});/e", "chr('\\1')", $text); - $text = preg_replace_callback("/^&#(\d{2,5});/", function ($treffer) { - return chr($treffer[1]); + // ------------------------------------------------------------------------------ + // Geschütze zeichen wieder herstellen + // ------------------------------------------------------------------------------ + function decodeProtectedChr($text) { + // alle ^&#?????; suchen und als zeichen ohne ^ (^) ersetzen + // $text = preg_replace("/^&#(\d{2,5});/e", "chr('\\1')", $text); + $text = preg_replace_callback("/^&#(\d{2,5});/", function ($treffer) { + return chr($treffer [1]); }, $text); - return $text; - } + return $text; + } } ?> \ No newline at end of file diff --git a/cms/Syntax.php b/cms/Syntax.php index 4f70c4f..7d30305 100644 --- a/cms/Syntax.php +++ b/cms/Syntax.php @@ -1,1112 +1,1187 @@ > protokoll :// (username:password@) [(sub.)server.tld|ip-adresse] (:port) (subdirs|files) - // protokoll (https?|t?ftps?|gopher|telnets?|mms|imaps?|irc|pop3s?|rdp|smb|smtps?|sql|ssh):\/\/ - // username:password@ (\w)+\:(\w)+\@ - // (sub.)server.tld ((\w)+\.)?(\w)+\.[a-zA-Z]{2,4} - // ip-adresse (ipv4) ([\d]{1,3}\.){3}[\d]{1,3} - // port \:[\d]{1,5} - // subdirs|files (\w)+ - $this->LINK_REGEX = "/^(https?|t?ftps?|gopher|telnets?|mms|imaps?|irc|pop3s?|rdp|smb|smtps?|sql|ssh|svn)\:\/\/((\w)+\:(\w)+\@)?[((\w)+\.)?(\w)+\.[a-zA-Z]{2,4}|([\d]{1,3}\.){3}[\d]{1,3}](\:[\d]{1,5})?((\w)+)?$/"; - // Punycode-URLs können beliebige Zeichen im Domainnamen enthalten! - // $this->MAIL_REGEX = "/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/"; - $this->MAIL_REGEX = "/^.+@.+\..+$/"; - - if(!isset($GLOBALS['syntax_anchor_counter'])) - $GLOBALS['syntax_anchor_counter'] = 1; - if(!isset($GLOBALS['syntax_anchor_ueber'])) - $GLOBALS['syntax_anchor_ueber'] = array(); - if(!isset($GLOBALS['syntax_anchor_absatz'])) - $GLOBALS['syntax_anchor_absatz'] = array(); - - $syntax_elemente = get_class_methods($this); - $syntax_array = array(); - foreach($syntax_elemente as $element) { - if(substr($element,0,strlen("syntax_")) == "syntax_") - $syntax_array[] = substr($element,strlen("syntax_")); - } - - $this->syntax_user = $USER_SYNTAX->toArray(); - foreach($this->syntax_user as $user => $inhalt) { - $syntax_array[] = $user; - } - # Damit zuerst z.B. nach links und dann nach link gesucht wird sonst wird links als link gefunden - rsort($syntax_array); - - $syntax_such = "/\[(".implode("=|",$syntax_array)."=|".implode("|",$syntax_array).")([^\[\]\{\}]*)\|([^\[\]\{\}]*)\]/Um"; - $syntax_such_rest = "/\[(".implode("=|",$syntax_array)."=|".implode("|",$syntax_array).")([^\|]*)\|(.*)\]/m"; - - # Achtung es muss ---- für horizontale line angehängt werden - $syntax_such_ohne = "/\[(".implode("|",$syntax_array)."|----)\]/Um"; - - $this->activ_plugins = $activ_plugins; - $this->deactiv_plugins = $deactiv_plugins; - $plugin = array_merge($this->activ_plugins, $this->deactiv_plugins); - # Das gleiche hier mit Plugins siehe rsort weiter oben - rsort($plugin); - - $this->placeholder = array(); - foreach(makePlatzhalter(true) as $value) { - $tmp = substr($value,1,-1); - # Wens ein Plugin gibt was so heist wie der Platzhalter benutzen wir das Plugin - if(!in_array($tmp,$this->activ_plugins)) - $this->placeholder[] = $tmp; - # damit der Platzhalter wieder funktioniert müssen wir in aus $this->deactiv_plugins löschen - if(in_array($tmp,$this->deactiv_plugins)) { - if(false !== ($key = array_search($tmp, $this->deactiv_plugins))); - unset($this->deactiv_plugins[$key]); - } - } - rsort($this->placeholder); - unset($tmp_place); - - $plugin_such = "/\{(".implode("|",$plugin).")\|([^\[\]\{\}]*)\}/Um"; - $plugin_such_rest = "/\{(".implode("|",$plugin).")\|(.*)\}/m"; - $plugin_such_ohne = "/\{(".implode("|",$plugin).")\}/Um"; - $this->PLACE_SEARCH = "/\{(".implode("|",$this->placeholder).")\}/Um"; - $this->SYNTAX_SEARCH = $syntax_such; - $this->SYNTAX_SEARCH_REST = $syntax_such_rest; - $this->SYNTAX_SEARCH_OHNE = $syntax_such_ohne; - $this->PLUGIN_SEARCH = $plugin_such; - $this->PLUGIN_SEARCH_REST = $plugin_such_rest; - $this->PLUGIN_SEARCH_OHNE = $plugin_such_ohne; - $this->script_search = array(); - $this->script_replace = array(); - $this->pluginself['placeholder'] = array(); - $this->pluginself['replace'] = array(); - } - - /* - Der array aufbau der zurückgegeben wird muss immer so sein - 0 = match - 1 = plugin, syntax oder platzhalter - 2 = "description" für Syntax und UserSyntax - 3 = "value" für Plugin, Syntax und UserSyntax - */ - function clean_syntax_plugins_array($array,$array2 = false,$fill3 = NULL) { - # test array erstellen wo alle dopelten einträge eintfernt werden - $test = array_unique($array[0]); - if(count($array[0]) > count($test)) { - foreach($array[0] as $pos => $tmp) { - # alle einträge die nicht im test array sind weg machen das sind doppelte - if(!isset($test[$pos])) { - unset($array[0][$pos],$array[1][$pos],$array[2][$pos],$array[3][$pos]); - continue; - } - # wenn array 2 oder 3 nicht existieren dann erstellen - if(!isset($array[2][$pos])) - $array[2][$pos] = NULL; - if(!isset($array[3][$pos])) - $array[3][$pos] = $fill3; - } - } - # wenn array 2 oder 3 nicht existieren dann erstellen - # array_unique hat nichts gefunden also haben wir noch eine vortlaufenden key - # oder das array ist einfach lehr - if(!isset($array[2])) { - $array[2] = array(); - if(count($array[0]) > 0) - $array[2] = array_fill(0, count($array[0]), NULL); - } - if(!isset($array[3])) { - $array[3] = array(); - if(count($array[0]) > 0) - $array[3] = array_fill(0, count($array[0]), $fill3); - } - # An array2 array anhängen - if(is_array($array2)) { - $array[0] = array_merge($array2[0], $array[0]); - $array[1] = array_merge($array2[1], $array[1]); - $array[2] = array_merge($array2[2], $array[2]); - $array[3] = array_merge($array2[3], $array[3]); - } - return $array; - } - - function match_syntax_plugins() { - global $USE_CMS_SYNTAX; - - # alle