Location: PHPKode > scripts > Bohemian Image Gallery > w3easyAdmin/index.php
<?php
################################################################
// w3easyAdmin | PHP Admin Script | w3easy.org cms project     #
// main script                                                 #
// Copyright (C) 2011 and 2012 Joachim Haack                   #
// <http://w3easy.org/>                                        #
// <http://www.w3nord.de/>                                     #
                                                               #
$version_w3eA  = "0.892 (alpha)";                              #
$v_datum       = "2012";                                       #
$title_w3eA    = "w3easyAdmin ";                               #
                                                               #
// This program is free software: you can redistribute         #
// it and/or modify it under the terms of the                  #
// GNU General Public License as published by                  #
// the Free Software Foundation, either version 3 of           #
// the License, or (at your option) any later version          #
                                                               #
// Keep intact all copyright notices!                          #
                                                               #
// This program is distributed in the hope that it will        #
// be useful, but WITHOUT ANY WARRANTY; without even the       #
// implied warranty of MERCHANTABILITY or FITNESS FOR          #
// A PARTICULAR PURPOSE.                                       #
// See the GNU General Public License for more details.        #
                                                               #
// You should have received a copy of the                      #
// GNU General Public License along with this program.         #
// If not, see <http://www.gnu.org/licenses/>.                 #
################################################################

// changelog
// 080 => 081 changed $text 'trim()'
// 081 => 082 changed chmod options, octdec($newChmodValue)
// 082 => 083 changed file permissions / file owner part corrected
// 083 => 084 added: copy file, rename file
// 084 => 085 added: corrections
// 085 => 086 added: security radio buttons, realpath()
// 086 => 087 improved: module integration // changed: folder structure
// 087 => 088 changed: style submit and reset buttons, form 3 hidden fields
// 088 => 089 added: rename folder, last edit
// 089 => 0891 added: error messages, if external modules are missing (w3easyAdmin_light)
// 0891 => 0892 added: error handling '$last_edit_file'

// action
$action = $_SERVER['PHP_SELF'];
// inclusions
include ("w3eA_config.php");
include ("w3eA_functions.php");
// inclusion backup functionality
include ("w3eB_config.php");
include ("w3eB_functions.php");

// specification
if ($secure_edit != "no"){$sec_edit_input = '<input type="radio" name="todo_Sec" value="edit">';}
else {$sec_edit_input = '';}

// quick folder option list
if ($name_quick_folder_1 != "") {$quick_folder_1 = "<option>".$name_quick_folder_1."</option>\n";} else {$name_quick_folder_1 = "";}
if ($name_quick_folder_2 != "") {$quick_folder_2 = "<option>".$name_quick_folder_2."</option>\n";} else {$name_quick_folder_2 = "";}
if ($name_quick_folder_3 != "") {$quick_folder_3 = "<option>".$name_quick_folder_3."</option>\n";} else {$name_quick_folder_3 = "";}
if ($name_quick_folder_4 != "") {$quick_folder_4 = "<option>".$name_quick_folder_4."</option>\n";} else {$name_quick_folder_4 = "";}
if ($name_quick_folder_5 != "") {$quick_folder_5 = "<option>".$name_quick_folder_5."</option>\n";} else {$name_quick_folder_5 = "";}
if ($name_quick_folder_6 != "") {$quick_folder_6 = "<option>".$name_quick_folder_6."</option>\n";} else {$name_quick_folder_6 = "";}
if ($name_quick_folder_7 != "") {$quick_folder_7 = "<option>".$name_quick_folder_7."</option>\n";} else {$name_quick_folder_7 = "";}
if ($name_quick_folder_8 != "") {$quick_folder_8 = "<option>".$name_quick_folder_8."</option>\n";} else {$name_quick_folder_8 = "";}
if ($name_quick_folder_9 != "") {$quick_folder_9 = "<option>".$name_quick_folder_9."</option>\n";} else {$name_quick_folder_9 = "";}
if ($name_quick_folder_10 != "") {$quick_folder_10 = "<option>".$name_quick_folder_10."</option>\n";} else {$name_quick_folder_10 = "";}

// quick file option list
if ($name_quick_file_1 != "") {$quick_file_1 = "<option>".$name_quick_file_1."</option>\n";} else {$name_quick_file_1 = "";}
if ($name_quick_file_2 != "") {$quick_file_2 = "<option>".$name_quick_file_2."</option>\n";} else {$name_quick_file_2 = "";}
if ($name_quick_file_3 != "") {$quick_file_3 = "<option>".$name_quick_file_3."</option>\n";} else {$name_quick_file_3 = "";}
if ($name_quick_file_4 != "") {$quick_file_4 = "<option>".$name_quick_file_4."</option>\n";} else {$name_quick_file_4 = "";}
if ($name_quick_file_5 != "") {$quick_file_5 = "<option>".$name_quick_file_5."</option>\n";} else {$name_quick_file_5 = "";}
if ($name_quick_file_6 != "") {$quick_file_6 = "<option>".$name_quick_file_6."</option>\n";} else {$name_quick_file_6 = "";}
if ($name_quick_file_7 != "") {$quick_file_7 = "<option>".$name_quick_file_7."</option>\n";} else {$name_quick_file_7 = "";}
if ($name_quick_file_8 != "") {$quick_file_8 = "<option>".$name_quick_file_8."</option>\n";} else {$name_quick_file_8 = "";}
if ($name_quick_file_9 != "") {$quick_file_9 = "<option>".$name_quick_file_9."</option>\n";} else {$name_quick_file_9 = "";}
if ($name_quick_file_10 != "") {$quick_file_10 = "<option>".$name_quick_file_10."</option>\n";} else {$name_quick_file_10 = "";}

// $_POST
$form_sent 			   = $_POST['form_sent'];

$folder_selector	   = $_POST['folder_selector'];
$folder_selected	   = $_POST['folder_selected'];
$p1_fold_selected	   = $_POST['p1_fold_selected'];
$p2_fold_selected	   = $_POST['p2_fold_selected'];
$p3_fold_selected	   = $_POST['p3_fold_selected'];
$p4_fold_selected	   = $_POST['p4_fold_selected'];
$p5_fold_selected	   = $_POST['p5_fold_selected'];
$p6_fold_selected	   = $_POST['p6_fold_selected'];
$p7_fold_selected	   = $_POST['p7_fold_selected'];
$quick_folder_selector = $_POST['quick_folder_selector'];

$file_selector		   = $_POST['file_selector'];
$file_selected		   = $_POST['file_selected'];
$quick_file_selector   = $_POST['quick_file_selector'];

$todo				   = $_POST['todo'];
$todo_Sec			   = $_POST['todo_Sec'];
$new_file			   = $_POST['new_file'];
$new_folder			   = $_POST['new_folder'];
$todo21				   = $_POST['todo21'];
$todo21_hist		   = $_POST['todo21_hist'];
$todo22				   = $_POST['todo22'];
$todo22_hist		   = $_POST['todo22_hist'];
$wysiwyg               = $_POST['wysiwyg'];
$wysiwyg_hist          = $_POST['wysiwyg_hist'];
$explorer              = $_POST['explorer'];
$explorer_hist         = $_POST['explorer_hist'];
$newChmodValue         = $_POST['new_chmod_value'];

if($todo == "cancel_options") {$todo_Sec = "cancel_options";}

// w3eb
// $w3eB_form_sent = $_POST['w3eB_form_sent'];
// $todo           = $_POST['todo']; // see above
// $text           = stripslashes($_POST['text']);
// $charset        = "UTF-8"; // see config

##########################################################

// Quick Format & Preview
if ($todo21 != "") {
	$todo21_hist = $todo21;
}
else {
	$todo21_hist = $_POST['todo21_hist'];	
}

if ($todo22 != "") {
	$todo22_hist = $todo22;
}
else {
	$todo22_hist = $_POST['todo22_hist'];	
}

if ($todo21_hist == "quickformat" && $todo22_hist == "preview"){
	$body = "<body onload='showBox(); showBox2();'>\n";
}
else if ($todo21_hist == "quickformat" && $todo22_hist != "preview"){
	$body = "<body onload='showBox();'>\n";
}
else if ($todo21_hist != "quickformat" && $todo22_hist == "preview"){
	$body = "<body onload='showBox2();'>\n";
}
else{
	$body = "<body>\n";
}

##########################################################

// folder determination
if ($form_sent	== "") {
	$path_to_folder = $folder_base;
	$path_to_folder = explode("/",$path_to_folder); // value is taken from config.php
	$path_to_folder  = array_reverse($path_to_folder);
	if (isset($path_to_folder[1])) {$folder_selected = $path_to_folder[1]; $slash_p0 = "/";}
		else {$folder_selected = ""; $slash_p0 = "./";}
	if (isset($path_to_folder[2])){$p1_fold_selected = $path_to_folder[2]; $slash_p1 = "/";}
		else {$p1_fold_selected = ""; $slash_p1 = "";}
	if (isset($path_to_folder[3])){$p2_fold_selected = $path_to_folder[3]; $slash_p2 = "/";}
		else {$p2_fold_selected = ""; $slash_p2 = "";}
	if (isset($path_to_folder[4])){$p3_fold_selected = $path_to_folder[4]; $slash_p3 = "/";}
		else {$p3_fold_selected = ""; $slash_p3 = "";}
	if (isset($path_to_folder[5])){$p4_fold_selected = $path_to_folder[5]; $slash_p4 = "/";}
		else {$p4_fold_selected = ""; $slash_p4 = "";}
	if (isset($path_to_folder[6])){$p5_fold_selected = $path_to_folder[6]; $slash_p5 = "/";}
		else {$p5_fold_selected = ""; $slash_p5 = "";}
	if (isset($path_to_folder[7])){$p6_fold_selected = $path_to_folder[7]; $slash_p6 = "/";}
		else {$p6_fold_selected = ""; $slash_p6 = "";}
	if (isset($path_to_folder[8])){$p7_fold_selected = $path_to_folder[8]; $slash_p7 = "/";}
		else {$p7_fold_selected = ""; $slash_p7 = "";}
		
	$path_to_folder  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
	$path_to_folder .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
	$path_to_folder .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$folder_selected.$slash_p0;
	$folder_status		= "&nbsp; Selected: ".$path_to_folder;
}

if ($form_sent	!= ""){
	if ($quick_folder_selector != "Quick folder"){
		if ($name_quick_folder_1 != "" && $quick_folder_selector == $name_quick_folder_1){
			$path_to_folder = $path_quick_folder_1;}
		else if	($name_quick_folder_2 != "" && $quick_folder_selector == $name_quick_folder_2){
			$path_to_folder = $path_quick_folder_2;}
		else if	($name_quick_folder_3 != "" && $quick_folder_selector == $name_quick_folder_3){
			$path_to_folder = $path_quick_folder_3;}
		else if	($name_quick_folder_4 != "" && $quick_folder_selector == $name_quick_folder_4){
			$path_to_folder = $path_quick_folder_4;}
		else if	($name_quick_folder_5 != "" && $quick_folder_selector == $name_quick_folder_5){
			$path_to_folder = $path_quick_folder_5;}
		else if	($name_quick_folder_6 != "" && $quick_folder_selector == $name_quick_folder_6){
			$path_to_folder = $path_quick_folder_6;}
		else if	($name_quick_folder_7 != "" && $quick_folder_selector == $name_quick_folder_7){
			$path_to_folder = $path_quick_folder_7;}
		else if	($name_quick_folder_8 != "" && $quick_folder_selector == $name_quick_folder_8){
			$path_to_folder = $path_quick_folder_8;}
		else if	($name_quick_folder_9 != "" && $quick_folder_selector == $name_quick_folder_9){
			$path_to_folder = $path_quick_folder_9;}
		else if	($name_quick_folder_10 != "" && $quick_folder_selector == $name_quick_folder_10){
			$path_to_folder = $path_quick_folder_10;}

		$path_to_folder = explode("/",$path_to_folder); // value is taken from config.php
		$path_to_folder  = array_reverse($path_to_folder);
		if (isset($path_to_folder[1])) {$folder_selected = $path_to_folder[1]; $slash_p0 = "/";}
			else {$folder_selected = ""; $slash_p0 = "./";}
		if (isset($path_to_folder[2])){$p1_fold_selected = $path_to_folder[2]; $slash_p1 = "/";}
			else {$p1_fold_selected = ""; $slash_p1 = "";}
		if (isset($path_to_folder[3])){$p2_fold_selected = $path_to_folder[3]; $slash_p2 = "/";}
			else {$p2_fold_selected = ""; $slash_p2 = "";}
		if (isset($path_to_folder[4])){$p3_fold_selected = $path_to_folder[4]; $slash_p3 = "/";}
			else {$p3_fold_selected = ""; $slash_p3 = "";}
		if (isset($path_to_folder[5])){$p4_fold_selected = $path_to_folder[5]; $slash_p4 = "/";}
			else {$p4_fold_selected = ""; $slash_p4 = "";}
		if (isset($path_to_folder[6])){$p5_fold_selected = $path_to_folder[6]; $slash_p5 = "/";}
			else {$p5_fold_selected = ""; $slash_p5 = "";}
			
		if (isset($path_to_folder[7])){$p6_fold_selected = $path_to_folder[7]; $slash_p6 = "/";}
			else {$p6_fold_selected = ""; $slash_p6 = "";}
		if (isset($path_to_folder[8])){$p7_fold_selected = $path_to_folder[8]; $slash_p7 = "/";}
			else {$p7_fold_selected = ""; $slash_p7 = "";}						
			
        $path_to_folder  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
		$path_to_folder .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
		$path_to_folder .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$folder_selected.$slash_p0;
		$folder_status		= "&nbsp; Selected: ".$path_to_folder;
	}
	
	else if ($quick_file_selector != "Quick file"){
		if ($name_quick_file_1 != "" && $quick_file_selector == $name_quick_file_1){
			$path_to_folder = $path_quick_file_1;}
		else if	($name_quick_file_2 != "" && $quick_file_selector == $name_quick_file_2){
			$path_to_folder = $path_quick_file_2;}
		else if	($name_quick_file_3 != "" && $quick_file_selector == $name_quick_file_3){
			$path_to_folder = $path_quick_file_3;}
		else if	($name_quick_file_4 != "" && $quick_file_selector == $name_quick_file_4){
			$path_to_folder = $path_quick_file_4;}
		else if	($name_quick_file_5 != "" && $quick_file_selector == $name_quick_file_5){
			$path_to_folder = $path_quick_file_5;}
		else if	($name_quick_file_6 != "" && $quick_file_selector == $name_quick_file_6){
			$path_to_folder = $path_quick_file_6;}
		else if	($name_quick_file_7 != "" && $quick_file_selector == $name_quick_file_7){
			$path_to_folder = $path_quick_file_7;}
		else if	($name_quick_file_8 != "" && $quick_file_selector == $name_quick_file_8){
			$path_to_folder = $path_quick_file_8;}
		else if	($name_quick_file_9 != "" && $quick_file_selector == $name_quick_file_9){
			$path_to_folder = $path_quick_file_9;}
		else if	($name_quick_file_10 != "" && $quick_file_selector == $name_quick_file_10){
			$path_to_folder = $path_quick_file_10;}
		
		$path_to_folder = explode("/",$path_to_folder); // value is taken from config.php
		$path_to_folder  = array_reverse($path_to_folder);
		if (isset($path_to_folder[1])) {$folder_selected = $path_to_folder[1]; $slash_p0 = "/";}
			else {$folder_selected = ""; $slash_p0 = "./";}
		if (isset($path_to_folder[2])){$p1_fold_selected = $path_to_folder[2]; $slash_p1 = "/";}
			else {$p1_fold_selected = ""; $slash_p1 = "";}
		if (isset($path_to_folder[3])){$p2_fold_selected = $path_to_folder[3]; $slash_p2 = "/";}
			else {$p2_fold_selected = ""; $slash_p2 = "";}
		if (isset($path_to_folder[4])){$p3_fold_selected = $path_to_folder[4]; $slash_p3 = "/";}
			else {$p3_fold_selected = ""; $slash_p3 = "";}
		if (isset($path_to_folder[5])){$p4_fold_selected = $path_to_folder[5]; $slash_p4 = "/";}
			else {$p4_fold_selected = ""; $slash_p4 = "";}
		if (isset($path_to_folder[6])){$p5_fold_selected = $path_to_folder[6]; $slash_p5 = "/";}
			else {$p5_fold_selected = ""; $slash_p5 = "";}
			
		if (isset($path_to_folder[7])){$p6_fold_selected = $path_to_folder[7]; $slash_p6 = "/";}
			else {$p6_fold_selected = ""; $slash_p6 = "";}
		if (isset($path_to_folder[8])){$p7_fold_selected = $path_to_folder[8]; $slash_p7 = "/";}
			else {$p7_fold_selected = ""; $slash_p7 = "";}						
			
        $path_to_folder  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
		$path_to_folder .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
		$path_to_folder .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$folder_selected.$slash_p0;
		$folder_status		= "&nbsp; Selected: ".$path_to_folder;	
	}	
	else if ($folder_selector == "Select folder" && $quick_folder_selector == "Quick folder" && $quick_file_selector == "Quick file"){
		if ($folder_selected == "") {$slash_p0 = "./";} else {$slash_p0 = "/";}
		if ($p1_fold_selected == "") {$slash_p1 = "";} else {$slash_p1 = "/";}
		if ($p2_fold_selected == "") {$slash_p2 = "";} else {$slash_p2 = "/";}
		if ($p3_fold_selected == "") {$slash_p3 = "";} else {$slash_p3 = "/";}
		if ($p4_fold_selected == "") {$slash_p4 = "";} else {$slash_p4 = "/";}
		if ($p5_fold_selected == "") {$slash_p5 = "";} else {$slash_p5 = "/";}
		
		if ($p6_fold_selected == "") {$slash_p6 = "";} else {$slash_p6 = "/";}
		if ($p7_fold_selected == "") {$slash_p7 = "";} else {$slash_p7 = "/";}
		
        $path_to_folder  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
		$path_to_folder .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
		$path_to_folder .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$folder_selected.$slash_p0;
		$folder_status		= "&nbsp; Selected: ".$path_to_folder;	
	}
	else if ($folder_selector == "One folder up"){
		$folder_selected	= $p1_fold_selected;
		$p1_fold_selected	= $p2_fold_selected;
		$p2_fold_selected	= $p3_fold_selected;
		$p3_fold_selected	= $p4_fold_selected;
		$p4_fold_selected	= $p5_fold_selected;
		$p5_fold_selected	= $p6_fold_selected;
		$p6_fold_selected	= $p7_fold_selected;
		$p7_fold_selected	= "";		
		if ($folder_selected  != ""){$slash_p0 = "/";} else {$slash_p0 = "./";}
		if ($p1_fold_selected != ""){$slash_p1 = "/";} else {$slash_p1 = "";}
		if ($p2_fold_selected != ""){$slash_p2 = "/";} else {$slash_p2 = "";}
		if ($p3_fold_selected != ""){$slash_p3 = "/";} else {$slash_p3 = "";}
		if ($p4_fold_selected != ""){$slash_p4 = "/";} else {$slash_p4 = "";}
		if ($p5_fold_selected != ""){$slash_p5 = "/";} else {$slash_p5 = "";}

		if ($p6_fold_selected != ""){$slash_p6 = "/";} else {$slash_p6 = "";}
		if ($p7_fold_selected != ""){$slash_p7 = "/";} else {$slash_p7 = "";}
		
        $path_to_folder  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
		$path_to_folder .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
		$path_to_folder .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$folder_selected.$slash_p0;
		$folder_status		= "&nbsp; Selected: ".$path_to_folder;	
	}
	else if ($folder_selector != "Select folder" && $folder_selector != "One folder up"){
		if ($p7_fold_selected  != ""){
			$folder_status_2 = " <span class='warning'>[End Sel]</span> ";
		}
		else {
			$p7_fold_selected = $p6_fold_selected;
			$p6_fold_selected = $p5_fold_selected;
			$p5_fold_selected = $p4_fold_selected;
			$p4_fold_selected = $p3_fold_selected;
			$p3_fold_selected = $p2_fold_selected;
			$p2_fold_selected = $p1_fold_selected;
			$p1_fold_selected = $folder_selected;
			$folder_selected = $folder_selector;
			$folder_status_2 = "";
		}
		if ($folder_selected  != ""){$slash_p0 = "/";} else {$slash_p0 = "./";}
		if ($p1_fold_selected != ""){$slash_p1 = "/";} else {$slash_p1 = "";}
		if ($p2_fold_selected != ""){$slash_p2 = "/";} else {$slash_p2 = "";}
		if ($p3_fold_selected != ""){$slash_p3 = "/";} else {$slash_p3 = "";}
		if ($p4_fold_selected != ""){$slash_p4 = "/";} else {$slash_p4 = "";}
		if ($p5_fold_selected != ""){$slash_p5 = "/";} else {$slash_p5 = "";}
		
		if ($p6_fold_selected != ""){$slash_p6 = "/";} else {$slash_p6 = "";}
		if ($p7_fold_selected != ""){$slash_p7 = "/";} else {$slash_p7 = "";}
		
        $path_to_folder  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
		$path_to_folder .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
		$path_to_folder .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$folder_selected.$slash_p0;
		$folder_status		= "&nbsp; Selected: ".$path_to_folder.$folder_status_2;
	}	
}

##########################################################

// file determination
$ff_mm_text   = " <span class='warning'>[f/f missmatch => no edit!]</span>";
$ff_html_text = "&nbsp; <span class='warning'>Cannot load file containing html-element 'textarea'.</span>";

if ($form_sent 		== "") {
// if ($form_sent 		!= "yes") {
	$file_selected 	= "";
	$text 			= "";
	$sel_dis        = "sel_dis";
	$file_status	= "&nbsp; No file selected";
}
else if ($form_sent != "") {
// else if ($form_sent == "yes") {	
	if ($file_selector == "Cancel selection"){
		$file_selected	= "";
		$text 		 	= "";
		$sel_dis        = "sel_dis";
		$file_status	= "&nbsp; Selection cancelled => no file selected";
	}
	else if($file_selector  == "Select file" && $quick_file_selector == "Quick file"){
		if ($file_selected  != ""){
			if ($file_fault_html  == "yes"){ // ???
				$file_selected	= "";
				$text           = "";
				$file_status    = $ff_html_text;
			}
			else {
				$file_selected	= $file_selected;
//				$text 		 	= trim(stripslashes($_POST['text']));
				$text 		 	= stripslashes($_POST['text']);
				if (is_file($path_to_folder.$file_selected) != true){
					$file_fault_mm = "yes";
					$sel_dis       = "sel_dis";
					$file_status   = "&nbsp; Selected: ".$file_selected.$ff_mm_text;
				}
				else {
					$file_fault_mm = "";
					$sel_dis       = "sel_dis";
					$file_status   = "&nbsp; Selected: ".$file_selected;
				}				
			}
		}
		else {
			$file_selected		= "";
			$text               = "";
			$sel_dis            = "sel_dis";
			$file_status		= "&nbsp; No file selected";
		}		
	}
	else if ($quick_file_selector != "Quick file"){
		if	($name_quick_file_1 != "" && $quick_file_selector == $name_quick_file_1)
			{$file_quick_file = $file_quick_file_1;}
		else if ($name_quick_file_2 != "" && $quick_file_selector == $name_quick_file_2)
			{$file_quick_file = $file_quick_file_2;}
		else if ($name_quick_file_3 != "" && $quick_file_selector == $name_quick_file_3)
			{$file_quick_file = $file_quick_file_3;}
		else if ($name_quick_file_4 != "" && $quick_file_selector == $name_quick_file_4)
			{$file_quick_file = $file_quick_file_4;}
		else if ($name_quick_file_5 != "" && $quick_file_selector == $name_quick_file_5)
			{$file_quick_file = $file_quick_file_5;}
		else if ($name_quick_file_6 != "" && $quick_file_selector == $name_quick_file_6)
			{$file_quick_file = $file_quick_file_6;}
		else if ($name_quick_file_7 != "" && $quick_file_selector == $name_quick_file_7)
			{$file_quick_file = $file_quick_file_7;}
		else if ($name_quick_file_8 != "" && $quick_file_selector == $name_quick_file_8)
			{$file_quick_file = $file_quick_file_8;}
		else if ($name_quick_file_9 != "" && $quick_file_selector == $name_quick_file_9)
			{$file_quick_file = $file_quick_file_9;}
		else if ($name_quick_file_10 != "" && $quick_file_selector == $name_quick_file_10)
			{$file_quick_file = $file_quick_file_10;}

		$file_selected = $file_quick_file;
		if (is_file ($path_to_folder.$file_selected) == true){
			$text 		 	= read($path_to_folder,$file_selected);
			$sel_dis        = "sel_dis";
			$file_status	= "&nbsp; Selected: ".$file_selected;			
		}
		else {
			$file_selected	= "";
			$sel_dis        = "warning";
			$file_status	= "&nbsp; Selected: File does not exist";
		}
	}
	else if ($file_selector != "Select file" && $file_selector != "Cancel selection"){
		$file_selected = $file_selector;
		if (is_file ($path_to_folder.$file_selected) == true){
		################
			$text_test      = read($path_to_folder,$file_selected);
			if (substr_count($text_test,"<textarea") < 1){
				$text = $text_test;
				$sel_dis     = "sel_dis";
				$file_status = "&nbsp; Selected: ".$file_selected;}
			else {
				$file_selected   = ""; // ???
				$text            = "";
				$file_fault_html = "yes";
				$file_status     = $ff_html_text;
			}
		################
		}
		else {
			$file_selected	= "";
			$sel_dis        = "warning";
			$file_status	= "&nbsp; Selected: File does not exist";
		}
	}
}

##########################################################

// Create folder
if ($folder_selected != "Cancel selection" && $todo == "create_fold"){
	$folder_to_create = $path_to_folder.$new_folder;
	if (!is_dir ($folder_to_create)){
		mkdir ($folder_to_create, 0777);
		$result_class = "result_ok";
		$result = "The folder '".$new_folder."' was created";
	}
	else {
		$result_class = "result_no";
		$result = "The folder already exists";
	}
}

// Rename folder // 2012-06-19
if ($todo == "rename_fold" || $todo_Sec == "rename_fold"){
	if ($todo == "rename_fold" && $todo_Sec == "rename_fold"){
		$folder_to_rename = $path_to_folder;
//		$folder_renamed   = $path_to_folder.$new_folder;

		$folder_renamed  = $p7_fold_selected.$slash_p7.$p6_fold_selected.$slash_p6;
		$folder_renamed .= $p5_fold_selected.$slash_p5.$p4_fold_selected.$slash_p4.$p3_fold_selected.$slash_p3;
		$folder_renamed .= $p2_fold_selected.$slash_p2.$p1_fold_selected.$slash_p1.$new_folder.$slash_p0;

		if (!is_dir ($folder_to_rename)){
			$result_class = "result_no";
			$result = "No folder selected";
		}
		else if (is_dir ($folder_renamed)){
			$result_class = "result_no";
			$result = "Folder already exists";
		}	
		else{
			rename ($folder_to_rename, $folder_renamed);
			$result_class = "result_ok";
			$result = "The folder '".$path_to_folder."' was renamed to '".$new_folder."'";
		}
	}
	else{
		$result_class = "result_no";
		$result = "Check both radio buttons!";	
	}
}

// Delete folder
if ($todo == "delete_fold" || $todo_Sec == "delete_fold"){
	if ($todo == "delete_fold" && $todo_Sec == "delete_fold"){
		$folder_to_delete = $path_to_folder;
	/*
		if ($folder_selected == ""){
			$result_class = "result_no";
			$result = "No folder selected";	
		}
		else if ($folder_selector == "Cancel selection"){
			$result_class = "result_no";
			$result = "...but you just cancelled selection... ???";		
		}
	*/
		if (is_dir ($folder_to_delete)){		
			$folder = $path_to_folder;
			$select = "fof";
			if (ordner_leer_oder_voll($folder, $select) == "empty (no ".$select.")"){			
				rmdir ($folder_to_delete);
				$result_class = "result_ok";
				$result = "The folder '".$path_to_folder."' was deleted";
			}
			else {
				$result_class = "result_no";
				$result = "Folder is not empty";
			}
		}
		else {
			$result_class = "result_no";
			$result = "The folder does not exist";
		}
	}
	else{
		$result_class = "result_no";
		$result = "Check both radio buttons!";	
	}
}

// chmod folder
if ($todo == "chmod_folder"){
	$folder_to_chmod = $path_to_folder;
	if (is_dir ($folder_to_chmod)){
		clearstatcache ();
		if ($newChmodValue != "permissions"){
			chmod ($folder_to_chmod, octdec($newChmodValue));
			$result_class = "result_ok";
			$result = "Folder permissions of '".$folder_to_chmod."' were changed";
		}
		else{
			$result_class = "result_no";
			$result = "Folder permissions were not changed";
		}
	}
}

/*
// edit file
if ($todo == "edit"){
	$file_to_write_to = $path_to_folder.$file_selected;
	if ($file_selected != ""){
		if (is_file($file_to_write_to)){
			write ($path_to_folder, $file_selected, $text);
			$result_class = "result_ok";
			$result = "The file '".$file_selected."' was edited";
		}
		else {
			$result_class = "result_no";
			$result = "The file does not exist";		
		}
	}
	else {
		$result_class = "result_no";
		$result = "No file selected";
	}
}
*/
// edit file
if ($todo == "edit" || $todo_Sec == "edit"){
	if ($todo == "edit" && $todo_Sec == "edit" || $todo == "edit" && $secure_edit == "no"){
		$file_to_write_to = $path_to_folder.$file_selected;
		if ($file_selected != ""){
			if (is_file($file_to_write_to)){
				write ($path_to_folder, $file_selected, $text);
				$result_class = "result_ok";
				$result = "The file '".$file_selected."' was edited";
			}
			else {
				$result_class = "result_no";
				$result = "The file does not exist";		
			}
		}
		else {
			$result_class = "result_no";
			$result = "No file selected";
		}
	}
	else{
		$result_class = "result_no";
		$result = "Check both radio buttons!";	
	}
}

// chmod file
if ($todo == "chmod_file"){
	$file_to_chmod = $path_to_folder.$file_selected;
	if (is_file($file_to_chmod)){
//		clearstatcache ();
		if ($newChmodValue != "permissions"){
			// chown ($file_to_chmod,"test"); ##### !!!!! #####
			chmod ($file_to_chmod, octdec($newChmodValue));
			$result_class = "result_ok";
			$result = "File permissions of '".$file_selected."' were changed";
		}
		else {
			$result_class = "result_no";
			$result = "File permissions were not changed";
		}
	}
	else{
		$result_class = "result_no";
		$result = "No file selected";
	}	
}

// Create file
if ($todo == "create_file"){
	$file_to_create = $path_to_folder.$new_file;
	if (!is_file ($file_to_create)){
		write ($path_to_folder, $new_file, $text);
		$result_class = "result_ok";
		$result = "The file '".$new_file."' was created";
	}
	else {
		$result_class = "result_no";
		$result = "The file already exists";
	}
}

// Copy file // 2012-05-08
if ($todo == "copy_file"){
	$file_to_copy = $path_to_folder.$file_selected;
	$file_copy    = $path_to_folder.$new_file;	
	if (!is_file ($file_to_copy)){
		$result_class = "result_no";
		$result = "No file selected";
	}
	else if (is_file ($file_copy)){
		$result_class = "result_no";
		$result = "File already exists";
	}	
	else{
		copy ($file_to_copy, $file_copy);
		$result_class = "result_ok";
		$result = "The file '".$file_selected."' was copied to '".$new_file."'";
	}
}

// Rename file // 2012-05-24
if ($todo == "rename_file" || $todo_Sec == "rename_file"){
	if ($todo == "rename_file" && $todo_Sec == "rename_file"){
		$file_to_rename = $path_to_folder.$file_selected;
		$file_renamed   = $path_to_folder.$new_file;
		if (!is_file ($file_to_rename)){
			$result_class = "result_no";
			$result = "No file selected";
		}
		else if (is_file ($file_renamed)){
			$result_class = "result_no";
			$result = "File already exists";
		}	
		else{
			rename ($file_to_rename, $file_renamed);
			$result_class = "result_ok";
			$result = "The file '".$file_selected."' was renamed to '".$new_file."'";
		}
	}
	else{
		$result_class = "result_no";
		$result = "Check both radio buttons!";	
	}
}

// delete file
if ($todo == "delete_file" || $todo_Sec == "delete_file"){
	if ($todo == "delete_file" && $todo_Sec == "delete_file"){
		if ($file_selected != ""){	
			$file_to_delete = $path_to_folder.$file_selected;
			if (is_file($file_to_delete)){
				unlink ($file_to_delete);
				$result_class = "result_ok";
				$result = "The file '".$file_selected."' was deleted";
			}
			else {
				$result_class = "result_no";
				$result = "The file does not exist";
			}
		}
		else{
			$result_class = "result_no";
			$result = "No file selected";		
		}
	}
	else{
		$result_class = "result_no";
		$result = "Check both radio buttons!";	
	}
}

// file upload
if ($todo == "upload"){
	$upload_folder 	= $path_to_folder;
	$file_selected  = "";
	$upload_dir 	= $upload_folder.$_FILES['upload_file']['name'];
	if (file_exists($upload_folder.$_FILES['upload_file']['name'])){
		$result_class = "result_no";
		$result = "File already exists or no file selected";
	}	
	else if (move_uploaded_file($_FILES['upload_file']['tmp_name'], $upload_dir)) {
		$result_class = "result_ok";
		$result = "File upload successful";
	}
	else{
		$result_class = "result_no";
		$result = "File upload was not successful";
	}
}

##########################################################

$show_fold 			= show_dir($path_to_folder, "folder", "option");
$show_file 			= show_dir($path_to_folder, "files", "option");
$show_fof			= show_dir($path_to_folder, "fof", "option");

##########################################################

// explorer
if      ($explorer == "explorer_off") {$explorer_hist = "explorer_off";}
else if ($explorer == "explorer_on") {$explorer_hist = "explorer_on";}
if ($explorer_hist == "explorer_on"){
$folderEx = show_dir($path_to_folder, "folder", "p");
$filesEx = show_dir($path_to_folder, "files", "p");
$explorer=<<<EXPLORER
<!--<div id='mbox3'>-->
<div class='explorer_left'>
<p class='explorer_head'>
Folder<br><span class='explorer_path'>$path_to_folder</span></p>
$folderEx
</div>
<div class='explorer_right'>
<p class='explorer_head'>
Files<br><span class='explorer_path'>$file_selected &nbsp;</span></p>
$filesEx
</div>
<p class='clearer'>&nbsp;</p>
<!--</div>-->
EXPLORER;
}
else {$explorer = "";}

##########################################################

// wysiwyg
$cke_missing  = "The wysiwyg editor 'CKEditor' was not found. \n";
$cke_missing .= "Make sure, that the CKEditor scriptfolder is in the 'w3easyAdmin/modules/' directory. \n";
$cke_missing .= "Presumably you could download the CKEditor from it's website: \n";
$cke_missing .= "http://ckeditor.com/ \n";
$cke_missing .= "Read in the w3easyAdmin help file how to integrate the CKEditor. \n";

if      ($wysiwyg == "wysiwyg_off") {$wysiwyg_hist = "wysiwyg_off";}
else if ($wysiwyg == "wysiwyg_on") {$wysiwyg_hist = "wysiwyg_on";}
if ($wysiwyg_hist == "wysiwyg_on"){
	if (file_exists('modules/ckeditor/ckeditor.js')){
$wysiwyg_script =<<<WYSIWYG_SCRIPT
<!-- CKEDITOR 1 -->
<script type="text/javascript" src="$pt_cke_cfg"></script>
<!-- CKEDITOR 1 -->
WYSIWYG_SCRIPT;

$wysiwyg_textarea =<<<WYSIWYG_TEXTAREA
<textarea id="editor" name="text">$text</textarea>
<!-- CKEDITOR 2 -->
<script type="text/javascript">CKEDITOR.replace('editor',
    {
        customConfig : '$pt_w3eA_cke_cfg'
    }
	);</script>
<!-- CKEDITOR 2 -->
WYSIWYG_TEXTAREA;
	}
	else {
		$wysiwyg_script   = "";
		$file_selected 	  = "";
		// $file_status	  = "&nbsp; No file selected or selection cancelled";
		$wysiwyg_textarea = "<textarea name='text'>".$cke_missing."</textarea>";
	}
}
else {
	$wysiwyg_script   = "";
	$wysiwyg_textarea = "<textarea name='text'>".$text."</textarea>";
}

####################################################################

// w3easyBackup script
if ($form_sent == "yes" && ($todo == "start_backup" || $todo == "mail_backup" || $todo == "mail_delete")){
	$result_class = "result_neutral";
	$result  = "";
	
	// code by Vikas Patial | Email: hide@address.com | http://www.ngcoders.com - BEGIN
	// File: paypal.php | Version: 1.0.0 | Copyright: (c) 2007 - Vikas Patial 
	// You are free to use, distribute, and modify this software under the terms of the
	// GNU General Public License. See the included license.txt file.
	
	// $backupName
	$domain = stripslashes($domain); // added by w3easy.org 
	$backupName = $domain."_backup_".date('Y-m-d-H-i-s').'.zip'; // changed by w3easy.org 
	$createZip = new createZip;
	
	##### added by w3easy.org - BEGIN	
	// root files
	if ($root_files == "yes"){
		$handle  = opendir($path_to_root);		
		while ($file = readdir($handle)) {
			if (is_file($path_to_root.$file) === true) {
		        if ($file != '.' && $file != '..') {
		        	$fileContents = file_get_contents($path_to_root.$file);
					$createZip->addFile($fileContents,$file);
				}
			}
		}
	}	
	##### added by w3easy.org - END
	
	if (isset($configBackup) && is_array($configBackup) && count($configBackup)>0){
	    // Lets backup any files or folders if any
	    foreach ($configBackup as $dir)
	    {
	    	// dir basename
	        $basename = basename($dir);
			// dir basename
			if (file_exists($dir)){ ### added by w3easy 2011-11-13
		        if (is_file($dir)){
		            $fileContents = file_get_contents($dir);
		            $createZip->addFile($fileContents,$basename);
		        }
		        else{
		            $createZip->addDirectory($basename."/");
		            $files = directoryToArray($dir,true);
		            $files = array_reverse($files);
		
		            foreach ($files as $file){
		                $zipPath = explode($dir,$file);
		                $zipPath = $zipPath[1];
		                // skip any if required
		                $skip = false;
						if (isset($configSkip) && is_array($configSkip) && count($configSkip)>0){ ### added by w3easy.org 
			                foreach ($configSkip as $skipObject){
			                    if (strpos($file,$skipObject) === 0){
			                        $skip = true;
			                        break;
			                    }
			                }
						} // added by w3easy.org 
		                if ($skip) {
		                    continue;
		                }
		                if (is_dir($file)){
		                    $createZip->addDirectory($basename."/".$zipPath);
		                }
		                else{
		                    $fileContents = file_get_contents($file);
		                    $createZip->addFile($fileContents,$basename."/".$zipPath);
		                }
		            }
		        }
			}	### added by w3nord 2011-11-13
			else {$result .= "<span class='result_eB_no'> File or folder ".$dir." doesn't exist.</span>\n";}
	    }
	}	


	// saving databases - BEGIN
	if (isset($configBackupDB) && is_array($configBackupDB) && count($configBackupDB)>0){    
	     foreach ($configBackupDB as $db)
	     {
	         $backup = new MySQL_Backup(); 
	         $backup->server   = $db['server'];
	         $backup->username = $db['username'];
	         $backup->password = $db['password'];
	         $backup->database = $db['database'];
	         $backup->tables   = $db['tables'];
	         
	         $backup->backup_dir = $configBackupDir;         
	         $sqldump = $backup->Execute(MSB_STRING,"",false);
	         $createZip->addFile($sqldump,$db['database'].'-sqldump.sql');         
	     }
	}
	// saving databases - END

	
	$fileName = $configBackupDir.$backupName;
	$fd       = fopen ($fileName, "wb");
	flock ($fd,2);
	$out      = fwrite ($fd, $createZip -> getZippedfile());
	flock ($fd,3);
	fclose ($fd);
	$result .=  "<span class='result_eB_ok'>Backup .zip file was created.</span>\n";
	
	// Dump done now lets email the user 
	if ($todo == "mail_backup" || $todo == "mail_delete"){ // added by w3easy.org 
		if (isset($configEmail) && !empty($configEmail)){
		    mailAttachment($fileName,$configEmail,'hide@address.com','Backup Script', 
			'hide@address.com','Backup - '.$backupName,"Backup file is attached");
			$result .=  "<span class='result_eB_ok'> Backup mail was sent.</span>\n";
		}
		else { // added by w3easy.org 
			$result .= "<span class='result_eB_no'> Mail address not found.</span>\n";
		}
	} // added by w3easy.org 
	// added by w3easy.org - BEGIN
	if ($todo == "mail_delete"){
		sleep(1);
		unlink($fileName);
		sleep(1);
		if (file_exists($fileName)!= true){
			$result .=  "<span class='result_eB_ok'> Backup .zip file was deleted.</span>\n";
		}
		else {
			$result .=  "<span class='result_eB_no'> Backup .zip file was not deleted.</span>\n";
		}
	}	// added by w3easy.org - END
}
// code by Vikas Patial | Email: hide@address.com | http://www.ngcoders.com - END

####################################################################

// form 1
$form =<<<FORM
<!-- editor form -->
<form class='editform' action="$action" method="POST" accept-charset="$charset">
<table border='0' cellpadding='5' cellspacing='5'>
<tr><td width='124'></td><td width='124'></td><td width='124'></td>
<td width='124'></td><td width='124'></td><td width='124'></td></tr>

<!-- view options -->
<tr><td colspan='6'>
<p class="options_view">
<input type="radio" name="wysiwyg" value="wysiwyg_on"> wysiwyg on &nbsp; 
<input type="radio" name="wysiwyg" value="wysiwyg_off"> wysiwyg off
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="radio" name="explorer" value="explorer_on"> explorer on &nbsp; 
<input type="radio" name="explorer" value="explorer_off"> explorer off
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="radio" name="todo21" value="quickformat"> <a class='js_link' onclick='javascript:showBox();'>Quick Format</a> &nbsp;  
<input type="radio" name="todo21" value="cancel_qf"> <a class='js_link' onclick='javascript:hideBox();'>Close</a>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="radio" name="todo22" value="preview"> <a class='js_link' onclick='javascript:showBox2();'>Preview</a> &nbsp;  
<input type="radio" name="todo22" value="cancel_pv"> <a class='js_link' onclick='javascript:hideBox2();'>Close</a>
</p>
</td></tr>

<!-- explorer (hmmm... maybe viewer ??? -->
<tr><td colspan='6'>$explorer</td></tr>

<!-- selectors and hidden fields (fof) -->
<tr>
<td width='124'>
<select class='select' name="quick_folder_selector" size="1">
<option>Quick folder</option>
$quick_folder_1 $quick_folder_2 $quick_folder_3 $quick_folder_4 $quick_folder_5 $quick_folder_6 $quick_folder_7 $quick_folder_8 $quick_folder_9 $quick_folder_10</select>
</td>
<td>
<select class='select' name="folder_selector" size="1">
<option>Select folder</option>
<option>One folder up</option>
$show_fold<!-- &nbsp; -->
</select>
<input type="hidden" name="quick_folder_selected" value="$quick_folder_selected">
<input type="hidden" name="folder_selected" value="$folder_selected">
<input type="hidden" name="p1_fold_selected" value="$p1_fold_selected">
<input type="hidden" name="p2_fold_selected" value="$p2_fold_selected">
<input type="hidden" name="p3_fold_selected" value="$p3_fold_selected">
<input type="hidden" name="p4_fold_selected" value="$p4_fold_selected">
<input type="hidden" name="p5_fold_selected" value="$p5_fold_selected">
<input type="hidden" name="p6_fold_selected" value="$p6_fold_selected">
<input type="hidden" name="p7_fold_selected" value="$p7_fold_selected">
<input type="hidden" name="quick_file_selected" value="$quick_file_selected">
<input type="hidden" name="file_selected" value="$file_selected">
</td>
<td colspan='3'><p class='sel_dis'>$folder_status</p></td>
<td><input class='textfeld' type="text" name="new_folder" value="new_folder"></td>
</tr>

<tr>
<td width='124'>
<select class='select' name="quick_file_selector" size="1">
<option>Quick file</option>
$quick_file_1 $quick_file_2 $quick_file_3 $quick_file_4 $quick_file_5 $quick_file_6 $quick_file_7 $quick_file_8 $quick_file_9 $quick_file_10</select>
</td>
<td>
<select class='select' name="file_selector" size="1">
<option>Select file</option>
<option>Cancel selection</option>
$show_file<!-- &nbsp; -->
</select>
</td>
<td colspan='3'><p class='$sel_dis'>$file_status</p></td>
<td><input class='textfeld' type="text" name="new_file" value="new_file.txt"></td>
</tr>

<!-- textarea and fof options -->
<tr>
<td colspan='5'>$wysiwyg_textarea</td>
<td class='options_edit_td'>
<p class='todo'></p>
<p class='todo'><input type="radio" name="todo" value="create_fold"> Create folder</p>
<p class='todo'><input type="radio" name="todo" value="create_file"> Create file</p>
<hr>
<p class='todo'><input type="radio" name="todo" value="edit">
$sec_edit_input Edit file</p>
<p class='todo'><input type="radio" name="todo" value="rename_file">
<input type="radio" name="todo_Sec" value="rename_file"> Rename file</p>
<p class='todo'><input type="radio" name="todo" value="copy_file"> Copy file</p>
<hr>
<p class='todo'><input type="radio" name="todo" value="rename_fold">
<input type="radio" name="todo_Sec" value="rename_fold"> Rename dir</p>
<p class='todo'><input type="radio" name="todo" value="delete_fold">
<input type="radio" name="todo_Sec" value="delete_fold"> Delete folder</p>
<p class='todo'><input type="radio" name="todo" value="delete_file">
<input type="radio" name="todo_Sec" value="delete_file"> Delete file</p>
<hr>
<p class='todo'><input type="radio" name="todo" value="chmod_folder"> Chmod folder</p>
<p class='todo'><input type="radio" name="todo" value="chmod_file"> Chmod file</p>

<select class='select' name="new_chmod_value" size="1">
<option>permissions</option>
<option>0777</option>
<option>0775</option>
<option>0770</option>
<option>0755</option>
<option>0750</option>
<option>0700</option>
<option>0666</option>
<option>0664</option>
<option>0660</option>
<option>0644</option>
<option>0640</option>
<option>0600</option>
</select>
</td>
</tr>

<!-- backup options -->
<tr>
<td colspan='5'><p class="options_backup">
<input class='radio' type='radio' name='todo' value='start_backup'> Backup &nbsp; &nbsp; &nbsp; 
<input class='radio' type='radio' name='todo' value='mail_backup'> Backup &amp; Mail &nbsp; &nbsp; &nbsp; 
<input class='radio' type='radio' name='todo' value='mail_delete'> Backup, Mail &amp; Delete &nbsp; &nbsp; &nbsp; 
</p></td>
<td><p class="options_cancel">
<input type="radio" name="todo" value="cancel_options"> <strong>Cancel options</strong>
</p></td>
</tr>
<tr><td></td></tr>

<!-- submit button and result phrase, more hidden fields-->
<tr>
<td><input class="input_submit" type="submit" value="submit"></td>
<td colspan='5'> &nbsp; <p class='$result_class'>$result</p>
</td>
<td>
<input type="hidden" name="todo21_hist" value="$todo21_hist">
<input type="hidden" name="todo22_hist" value="$todo22_hist">
<input type="hidden" name="wysiwyg_hist" value="$wysiwyg_hist">
<input type="hidden" name="explorer_hist" value="$explorer_hist">
<input type="hidden" name="form_sent" value="yes">
</td></tr>
<!-- &nbsp; -->
</table>
</form>\n
FORM;

##########################################################

$form_2 = <<<FORM_2
<!-- reset form -->
<form action="$action" method="POST">
<table border='0' cellpadding='5' cellspacing='5'><tr>
<td width='124'><input class="input_reset" type="submit" value="total reset"></td>
</tr>
</table>
</form>\n
FORM_2;

##########################################################

$form_3 = <<<FORM_3
<!-- upload form -->
<form action="$action" method="post" enctype="multipart/form-data">
<table border='0' cellpadding='5' cellspacing='5'>
<tr>
<td width='124'></td>
<td width='124'></td>
<td width='124'></td>
<td width='124'></td>
<td width='124'></td>
<td width='124'></td>
</tr>
<tr>
<td colspan='5'>
<p class='upload'>
<input type="radio" name="todo" value="upload">&nbsp;<strong>File Upload</strong> &nbsp; &nbsp; &nbsp; 
<input type="radio" name="todo" value="cancel_options">&nbsp;<strong>Cancel Upload</strong> &nbsp; &nbsp; &nbsp; 
<input type="file" name="upload_file">&nbsp;
<input type="submit" value="Upload">
</p></td>
<!-- &nbsp; -->
<td>
<input type="hidden" name="form_sent" value="upload">
<input type="hidden" name="folder_selector" value="Select folder">
<input type="hidden" name="folder_selected" value="$folder_selected">
<input type="hidden" name="p1_fold_selected" value="$p1_fold_selected">
<input type="hidden" name="p2_fold_selected" value="$p2_fold_selected">
<input type="hidden" name="p3_fold_selected" value="$p3_fold_selected">
<input type="hidden" name="p4_fold_selected" value="$p4_fold_selected">
<input type="hidden" name="p5_fold_selected" value="$p5_fold_selected">
<input type="hidden" name="p6_fold_selected" value="$p6_fold_selected">
<input type="hidden" name="p7_fold_selected" value="$p7_fold_selected">
<input type="hidden" name="file_selector" value="Select file">
<input type="hidden" name="file_selected" value="$file_selected"><!-- hm... -->
<input type="hidden" name="quick_file_selector" value="Quick file">
<input type="hidden" name="quick_folder_selector" value="Quick folder">
</td>
<!-- &nbsp; -->
</tr>
</table>
</form>\n
FORM_3;

##########################################################

// Formatting
$headline  = htmlentities("<h1>Headline</h1> or <h2>Headline</h2> or <h3>Headline</h3> ... <h6>Headline</h6>");
$phrase    = htmlentities("<p>YOUR PHRASE</p> or <p>&nbsp;</p>");
$separator = htmlentities("<br>");
$img_path  = "<?php echo \$path ?>pics/YOUR-PIC.jpg";
$image     = htmlentities("<img src='$img_path' width='' height='' alt=''>");
$image_2   = htmlentities("<img src='pics/YOUR-PIC.gif' width='' height='' alt=''>");
$iframe    = htmlentities("<iframe src='' width='' height='' frameborder='0' scrolling='no'></iframe>");
$link      = htmlentities("<a href='http://www.link.com'>LINK TITLE</a>");
$blank     = htmlentities("&nbsp;");

$formatting = <<<FORMATTING
<!-- quick formatting -->
<div id='mbox'>
<h2>Quick Formatting</h2>
<table class='formatting' border='0' cellpadding='2' cellspacing='2'><tr>
<td width='150'>Headlines:</td><td width='600'>$headline</td></tr>
<tr><td>Phrase:</td><td>$phrase</td></tr>
<tr><td>Iframe:</td><td>$iframe</td>
<tr><td>Image:</td><td>$image_2</td></tr>
<tr><td>Image:</td><td>$image</td></tr>
<tr><td>Link:</td><td>$link</td></tr>
<tr><td>Line break:</td><td>$separator</td></tr>
<tr><td>Blank:</td><td>$blank</td>
</tr></table>
</div>\n
FORMATTING;

##########################################################

// Preview
$preview_file = $path_to_folder.$file_selected;
$preview = <<<PREVIEW
<!-- preview -->
<div id='mbox2'>
<h2>Preview</h2>
<iframe class='pre_frame' src='$preview_file' width='766' height='200' frameborder='0' scrolling='auto'>view</iframe>
</div>\n
PREVIEW;

##########################################################

// Display
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>">
<title><?php echo $title_w3eA; ?></title>
<META NAME="language" CONTENT="en">
<META NAME="keywords" CONTENT="Online, Editor, w3easy, Editor">
<META NAME="description" CONTENT="Online Editor w3EasyEditor by w3easy.org.">
<META NAME="generator" CONTENT="w3EasyAdmin - www.w3easy.org">
<link type='text/css' rel='stylesheet' href='styles/w3eA.css'>
<?php
if ($wysiwyg == "wysiwyg_on" && $wysiwyg_hist == "wysiwyg_on"){
echo "<style type='text/css'>";
echo "textarea {height:134px;}";
echo "</style>\n";
}
?>
<script type='text/javascript' language='JavaScript' src='w3eA_magic-box.js'></script>
<?php echo $wysiwyg_script; ?>
</head>

<?php echo $body; ?>
<div id='w3easyeditor'>
<h1 class='title'><?php echo $title_w3eA.$version_w3eA; ?></h1>
<p class='copyright'>
<?php echo $title_w3eA." ".$version_w3eA." © ".$v_datum." by <a href='http://w3easy.org' target='_blank'>w3easy.org</a>\n"; ?>
</p>
<?php 
echo "<p class='you_are_here'>You are here: ";
echo "<a class='domain' href='/'>http://".$domain."</a>".$action."\n";
echo "<span style='float:right;'>";
// echo "<a target='_blank' href='w3eA_help.txt'>Help</a> | ";
echo "<a class='js_link' onclick='javascript:helpWin();'>Help</a> | ";
if ($pt_w3eA_kcf_fr != "")   {echo "<a href='".$pt_w3eA_kcf_fr."' target='_blank'>KCFinder</a> | ";}
if ($pt_w3eA_phftp_fr != "") {echo "<a href='".$pt_w3eA_phftp_fr."' target='_blank'>PHFTP</a> | ";}
if ($pt_w3eA_jscrypt != "")  {echo "<a href='".$pt_w3eA_jscrypt."' target='_blank'>JSCrypt</a> | ";}
if ($pt_w3eProtect != "")    {echo "<a href='".$pt_w3eProtect."' target='_blank'>w3easyProtect</a> | ";}
echo "<a href='".$path_to_admin."'>Admin</a> | ";
echo "<a href='".$path_to_root."'>Site</a></span>\n";
echo "</p>\n";
?>
<p class='attention'><strong>
<span class='warning'>Attention:</span> By using this tool you accept, that you use it completely on your own risk! We give no warranties at all!<br>
<span class='warning'>Warning:</span> Be very careful: With this tool inaccurately used you could damage your website and even yor local pc seriously!</strong></p>

<?php
echo $form;
echo "\n";
echo $form_2;
echo "\n";
echo $form_3;
echo "\n";
echo $formatting;
echo "\n";
echo $preview;

// test
/*
echo $qfile;
echo "Pfad zum Ordner: &nbsp; ".$path_to_folder;
echo "<br>";
echo showPOST();
echo "<br>";
var_dump ($path_quick_file);
*/

/*
// test
echo "<div style='padding:5px; border:1px solid white;'>\n";
var_dump ($_POST);
echo "<p>&nbsp;</p>";
echo "Pfad zum Ordner: &nbsp; ".$path_to_folder;
echo "<br>";
echo "Ordner: &nbsp; ".$folder_selected;
echo "<br>";
echo "<h3>_POST</h3>\n";
echo "<p>\n";
echo showPOST();
echo "</p>\n";
echo $path_to_folder.$file_selected;
echo "<br>";
echo "<p>mode: ".decoct(fileperms($path_to_folder.$file_selected))."</p>\n";
echo "<br>";
echo "form sent: &nbsp; ".$form_sent;
echo "</div>\n";
*/

// File permissions and Fileowner
if (file_exists($path_to_folder.$file_selected)){
	$file_info = "permissions: ".decoct(fileperms($path_to_folder.$file_selected));
	$fileowner = fileowner($path_to_folder.$file_selected);
	if ($fileowner != false){
		$array = posix_getpwuid($fileowner);
		$fileowner_2 = "";
		foreach($array as $key => $val){$fileowner_2 .= $key.": ".$val."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";}
	}
	else {$file_info .= " &nbsp;&nbsp;&nbsp; no owner identified";}
}
// realpath
$realpath_file_selected = realpath($path_to_folder.$file_selected);
// last edit
if (file_exists($path_to_folder.$file_selected)){
	$last_edit_file = date("Y-m-d | H:i:s", filemtime($path_to_folder.$file_selected));}
else {$last_edit_file = "file doesn't exist";}
$last_edit_w3easyAdmin = date("Y-m-d | H:i:s", filemtime("index.php"));
// various informations
echo "<p style='margin-left:5px; padding:2px 5px; border:1px solid #fff; display:inline-block;'>";
echo "<strong>File info:</strong> ".$file_info;
echo "&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;";
echo "<strong>Current user:</strong> ".get_current_user()."<br>";
echo "<strong>File owner:</strong> ".$fileowner_2."<br>";
echo "<strong>File last edit:</strong> ".$last_edit_file."<br>";
echo "<strong>Realpath:</strong> ".$realpath_file_selected."<br>";
echo "</p>\n";
echo "<p style='margin:5px 10px;'><strong>Script last edit:</strong> ".$last_edit_w3easyAdmin."</p>\n";
?>
</div>
</body>
</html>
Return current item: Bohemian Image Gallery