ports/152082: [NEW PORT] www/encode-explorer: A PHP script to browse, create folders, upload files etc

Frank Wall fw at moov.de
Tue Nov 9 15:50:10 UTC 2010


>Number:         152082
>Category:       ports
>Synopsis:       [NEW PORT] www/encode-explorer: A PHP script to browse, create folders, upload files etc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 09 15:50:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Frank Wall
>Release:        FreeBSD 7.1-RELEASE-p11 amd64
>Organization:
>Environment:
System: FreeBSD 7.1-RELEASE-p11 FreeBSD 7.1-RELEASE-p11 #0: Fri Feb 26 19:22:31 UTC 2010
>Description:
[a follow-up to pr 145945]

Encode Explorer is an easy-to-use php script to use as an index file.
It shows files in the server and lets you browse through folders,
upload files etc. It is kept small and neat so that the source can be
used for learning.

WWW:	http://sourceforge.net/projects/encode-explorer/

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- encode-explorer-5.0.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	encode-explorer
#	encode-explorer/files
#	encode-explorer/files/extra-patch-index-php-experimental
#	encode-explorer/pkg-descr
#	encode-explorer/distinfo
#	encode-explorer/Makefile
#	encode-explorer/pkg-plist
#
echo c - encode-explorer
mkdir -p encode-explorer > /dev/null 2>&1
echo c - encode-explorer/files
mkdir -p encode-explorer/files > /dev/null 2>&1
echo x - encode-explorer/files/extra-patch-index-php-experimental
sed 's/^X//' >encode-explorer/files/extra-patch-index-php-experimental << '388c27257a613e93d3488c6ce8e4e700'
X--- index.php.orig	2009-09-27 14:58:56.000000000 +0200
X+++ index.php	2010-05-11 15:34:57.000000000 +0200
X@@ -90,6 +90,11 @@
X $_CONFIG['max_space'] = 25600;
X 
X //
X+// Activate disk space usage? Default: 1
X+// 
X+$_CONFIG['status_enable'] = 0;
X+
X+//
X // Kui sügavalt alamkataloogidest suurust näitav script faile otsib? Vaikimisi: 3
X //
X // How deep in subfilders will the script search for files? Default: 3
X@@ -126,19 +131,48 @@
X //
X // Filenames that will be hidden from the list.
X //
X-$_CONFIG['hidden_files'] = array(".ftpquota", "index.php", "index.php~", ".htaccess", ".htpasswd");
X+$_CONFIG['hidden_files'] = array(".ftpquota", ".htaccess", ".htpasswd");
X+
X+// 
X+// Send e-mail on new file uploads. The e-mail contains the path, name
X+// and download URL for the new file. Default: off
X+// 
X+$_CONFIG['notify_enable'] = 0;
X+
X+// 
X+// From: and Reply-To: address for the mail notification.
X+// Default: webmaster at example.com
X+// 
X+$_CONFIG['notify_sender'] = 'webmaster at example.com';
X+
X+//
X+// E-Mail addresses that will be notified on file upload.
X+// Default: nobody at example.com
X+//
X+$_CONFIG['notify_addresses'] = array("nobody at example.com");
X 
X //
X // Parool failide uploadimiseks. Parooli märkimisega aktiviseerub ka uploadi võimalus.
X // NB! Failide upload ei tööta zone.ee tasuta serveris ja hot.ee serveris!
X // NB! Faile saab uploadida ainult kaustadesse, millele on eelnevalt antud vastavad õigused (chmod 777)
X //
X-// Password for uploading files. You need to set the password to activate uploading.
X-// To upload into a directory it has to have proper rights.
X+// Password for all write operations, e.g. uploading and deleting files.
X //
X $_CONFIG['upload_password'] = "";
X 
X //
X+// You need to enable this to activate uploading. Default: 0
X+// To upload into a directory it has to have proper rights.
X+//
X+$_CONFIG['upload_enable'] = 1;
X+
X+//
X+// You need to enable this to activate deleting. Default: 0
X+// To delete a file or directory it has to have proper rights.
X+//
X+$_CONFIG['delete_enable'] = 0;
X+
X+//
X // Asukoht serveris. Tavaliselt ei ole vaja siia midagi panna kuna script leiab ise õige asukoha. 
X // Mõnes serveris tuleb piirangute tõttu see aadress ise teistsuguseks määrata.
X // See fail peaks asuma serveris aadressil [AADRESS]/index.php
X@@ -146,7 +180,14 @@
X //
X // Location in the server. Usually this does not have to be set manually.
X //
X-$_CONFIG['basedir'] = "";
X+$_CONFIG['basedir'] = "/home";
X+
X+
X+//
X+// Enable configuration changes from environment variables? Default: 1
X+// Set EEXPLORER_ and add the name of the config option to overwrite values.
X+//
X+$_CONFIG['enable_dynamic_config'] = 1;
X 
X 
X /***************************************************************************/
X@@ -185,16 +226,30 @@
X 	"total_used_space" => "Benutzter Speicher",
X 	"free_space" => "Freier Speicher",
X 	"password" => "Passwort",
X-	"upload" => "Upload",
X-	"failed_upload" => "Upload ist fehlgeschlagen!",
X+	"upload" => "Hochladen",
X+	"delete" => "Löschen",
X+	"failed_upload" => "Hochladen ist fehlgeschlagen!",
X+	"failed_upload_size" => "Datei ist zu groß!",
X 	"failed_move" => "Verschieben der Datei ist fehlgeschlagen!",
X 	"wrong_password" => "Falsches Passwort",
X 	"make_directory" => "Neuer Ordner",
X+	"notify_subject" => "Neue Datei wurde hochgeladen",
X+	"notify_text" => "Die folgende Datei wurde soeben hochgeladen:",
X+	"notify_file" => "Datei:",
X+	"notify_no_url" => "Datei nicht abrufbar (außerhalb vom DocumentRoot)",
X+	"notify_path" => "Pfad:",
X+	"notify_server" => "Server:",
X+	"notify_url" => "URL:",
X 	"new_dir_failed" => "Erstellen des Ordners fehlgeschlagen",
X+	"del_dir_failed" => "Löschen des Ordners fehlgeschlagen",
X+	"write_dir_denied" => "Der Ordner ist nicht schreibbar.",
X+	"dir_exists" => "Den Ordner gibt es bereits.",
X+	"write_file_denied" => "Die Datei ist nicht schreibbar.",
X+	"del_file_failed" => "Löschen der Datei fehlgeschlagen",
X 	"chmod_dir_failed" => "Veränderung der Zugriffsrechte des Ordners fehlgeschlagen",
X-	"unable_to_read_dir" => "Unable to read directory",
X+	"unable_to_read_dir" => "Verzeichnis kann nicht gelesen werden",
X 	"location" => "Location",
X-	"root" => "Root"
X+	"root" => "Start"
X );
X 
X // Greek
X@@ -226,11 +281,25 @@
X 	"free_space" => "Free space",
X 	"password" => "Password",
X 	"upload" => "Upload",
X+	"delete" => "Delete",
X 	"failed_upload" => "Failed to upload the file!",
X+	"failed_upload_size" => "File size exceeds limits!",
X 	"failed_move" => "Failed to move the file into the right directory!",
X 	"wrong_password" => "Wrong password",
X 	"make_directory" => "New dir",
X+	"notify_subject" => "New file upload",
X+	"notify_text" => "The following new file was uploaded:",
X+	"notify_file" => "File:",
X+	"notify_no_url" => "file not accessible (outside of DocumentRoot)",
X+	"notify_path" => "Path:",
X+	"notify_server" => "Server:",
X+	"notify_url" => "URL:",
X 	"new_dir_failed" => "Failed to create directory",
X+	"del_dir_failed" => "Failed to delete directory",
X+	"write_dir_denied" => "Directory is not writable.",
X+	"dir_exists" => "Directory already exists.",
X+	"write_file_denied" => "File is not writable.",
X+	"del_file_failed" => "Failed to delete file",
X 	"chmod_dir_failed" => "Failed to change directory rights",
X 	"unable_to_read_dir" => "Unable to read directory",
X 	"location" => "Location",
X@@ -554,10 +623,17 @@
X 
X #upload div.password {
X 	float:left;
X+	margin-top: 4px;
X }
X 
X #upload div.upload {
X 	float:right;
X+	margin-top: 2px;
X+}
X+
X+#upload div.delete {
X+	float:left;
X+	margin-top: 4px;
X }
X 
X #info {
X@@ -567,6 +643,7 @@
X 	width:680px;
X 	position: relative;
X 	margin: 0 auto;
X+	margin-top: 4px;
X 	text-align:center;
X }
X 
X@@ -750,6 +827,100 @@
X 	return ($a->modTime - $b->modTime);
X }
X 
X+function is_empty_dir($dir)
X+{
X+	if (($files = @scandir($dir)) && count($files) <= 2)
X+	{
X+		return true;
X+	}
X+	return false;
X+}
X+
X+// Delete a file or recursively delete a directory
X+// @param string $str Path to file or directory
X+function recursive_delete($str)
X+{
X+	if(is_file($str))
X+	{
X+		return @unlink($str);
X+	}
X+	elseif(is_dir($str))
X+	{
X+		$scan = glob(rtrim($str,'/').'/*');
X+		foreach($scan as $index=>$path)
X+		{
X+			recursive_delete($path);
X+		}
X+		return @rmdir($str);
X+	}
X+}
X+
X+// Send e-mail with the path and download-URL for an uploaded file.
X+function send_mail($path,$file)
X+{
X+	global $_CONFIG;
X+	global $_LANG;
X+
X+	// send a separate mail for every receipient for privacy reasons
X+	foreach($_CONFIG['notify_addresses'] as $receipient)
X+	{
X+		$to = $receipient;
X+		$subject = $_LANG['notify_subject'];
X+
X+		$protocol = explode("/", $_SERVER['SERVER_PROTOCOL']);
X+		$protocol = strtolower($protocol[0]);
X+
X+		// check if file was uploaded within DOCUMENT_ROOT
X+		$docroot = '/' . preg_quote($_SERVER['DOCUMENT_ROOT'],'/') . '/';
X+		$path = str_replace('/./','/',$path);
X+		if ( preg_match("$docroot","$path") )
X+                {
X+			// file is accessible, compose URL
X+			$docroot = str_replace($_SERVER['DOCUMENT_ROOT'], "", $path);
X+			$docroot = rawurlencode($docroot);
X+			$docroot = str_replace('%2F','/',$docroot);
X+			$url = $protocol . "://" . $_SERVER['SERVER_NAME'] . $docroot . rawurlencode($file);
X+                } else {
X+			// file not accessible
X+			$url = $_LANG['notify_no_url'];
X+		}
X+
X+		$message = $_LANG["notify_text"] . "\r\n" . 
X+			"\r\n" .
X+			$_LANG["notify_file"] . ' ' . $file . "\r\n" .
X+			$_LANG["notify_path"] . ' ' . $path . "\r\n" .
X+			$_LANG["notify_server"] . ' ' . $_SERVER['SERVER_NAME'] . "\r\n" .
X+			"\r\n" .
X+			$_LANG["notify_url"] . ' ' . $url . "\r\n" .
X+			"\r\n" .
X+			"\r\n" .
X+			"Encode Explorer" . "\r\n" .
X+			"\r\n";
X+
X+		$headers = 'From: ' . $_CONFIG['notify_sender'] . "\r\n" .
X+			'Reply-To: ' . $_CONFIG['notify_sender'] . "\r\n" .
X+			'Content-type: text/plain; charset=' . $_CONFIG['charset'] . "\r\n" .
X+			'MIME-Version: 1.0' . "\r\n" .
X+			'X-Mailer: Encode Explorer';
X+
X+		mail($to, $subject, $message, $headers);
X+	}
X+
X+}
X+
X+function check_post_size()
X+{
X+	$POST_MAX_SIZE = ini_get('post_max_size');
X+	$mul = substr($POST_MAX_SIZE, -1);
X+	$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
X+
X+	if ($_SERVER['CONTENT_LENGTH'] > $mul*(int)$POST_MAX_SIZE && $POST_MAX_SIZE)
X+	{
X+		return false;
X+	}
X+	return true;
X+}
X+
X //
X // The class that displays images (icons)
X //
X@@ -779,14 +950,22 @@
X //
X class FileManager
X {
X-	function checkPassword($inputPassword)
X+	function checkPassword($inputPassword,$alwaysFail = '0')
X 	{
X 		global $_CONFIG;
X 		global $_ERROR;
X 		global $_LANG;
X 
X+		// check if the result of the evaluation should always be FALSE
X+		if($alwaysFail == 1)
X+		{
X+			$_ERROR = $_LANG["wrong_password"];
X+			return false;
X+		}
X+
X 		if(strlen($_CONFIG['upload_password']) > 0 && $inputPassword == $_CONFIG['upload_password'])
X 		{
X+			$_ERROR = $_LANG["success"];
X 			return true;
X 		}
X 		else
X@@ -806,10 +985,71 @@
X 			$forbidden = array(".", "/", "\\");
X 			for($i = 0; $i < count($forbidden); $i++)
X 				$dirname = str_replace($forbidden[$i], "", $dirname);
X-			if(!mkdir($location->getDir(true, false, 0).$dirname, 0777))
X-				$_ERROR = $_LANG["new_dir_failed"];
X-			else if(!chmod($location->getDir(true, false, 0).$dirname, 0777))
X-				$error = $_LANG["chmod_dir_failed"];
X+			// check if directory already exists
X+			if (file_exists($location->getFullPath().$dirname))
X+			{
X+				$_ERROR = $_LANG["dir_exists"];
X+			} else {
X+				// check if directory is writable
X+				if(!is_writable($location->getFullPath()))
X+				{
X+					$_ERROR = $_LANG["write_dir_denied"];
X+				} else {
X+					if(!mkdir($location->getFullPath().$dirname, 0777))
X+						$_ERROR = $_LANG["new_dir_failed"];
X+					else if(!chmod($location->getFullPath().$dirname, 0777))
X+						$error = $_LANG["chmod_dir_failed"];
X+				}
X+			}
X+		}
X+	}
X+
X+	function deleteOnServer($location, $deletelist)
X+	{
X+		global $_ERROR;
X+		global $_LANG;
X+
X+		if(count($deletelist) > 0)
X+		{
X+			foreach ($deletelist as $deleteitem)
X+			{
X+				$deleteitem = urldecode($deleteitem);
X+				$deleteitem = htmlspecialchars_decode($deleteitem);
X+
X+				// check if it is a file
X+				if (is_file($deleteitem))
X+				{
X+					// check if file is writable
X+					if(!is_writable($location->getFullPath()))
X+					{
X+						$_ERROR = $_LANG["write_file_denied"];
X+					} else {
X+						if(!unlink($deleteitem))
X+							$_ERROR = $_LANG["del_file_failed"];
X+					}
X+				}
X+				// it is a directory
X+				else
X+				{
X+					// check if file is writable
X+					if(!is_writable($location->getFullPath()))
X+					{
X+						$_ERROR = $_LANG["write_dir_denied"];
X+					} else {
X+						// check if directory is empty
X+						if(!is_empty_dir($deleteitem))
X+						{
X+							// recursively delete directory
X+							if(!recursive_delete($deleteitem))
X+								$_ERROR = $_LANG["del_dir_failed"];
X+						}
X+						else {
X+							if(!rmdir($deleteitem))
X+								$_ERROR = $_LANG["del_dir_failed"];
X+						}
X+					}
X+				}
X+			}
X 		}
X 	}
X 
X@@ -819,6 +1059,13 @@
X 		global $_ERROR;
X 		global $_LANG;
X 
X+		if(!check_post_size())
X+		{
X+			$_ERROR = $_LANG["failed_upload_size"];
X+		}
X+		else
X+		{
X+
X 		$name = basename($userfile['name']);
X 		if(get_magic_quotes_gpc())
X 			$name = stripslashes($name);
X@@ -826,16 +1073,29 @@
X 		$upload_dir = $location->getFullPath();
X 		$upload_file = $upload_dir . $name;
X 
X-		if(!is_uploaded_file($userfile['tmp_name']))
X+		// check if directory is writable
X+		if(!is_writable($location->getFullPath()))
X 		{
X-			$_ERROR = $_LANG["failed_upload"];
X-		}
X-		else if(!@move_uploaded_file($userfile['tmp_name'], $upload_file))
X+			$_ERROR = $_LANG["write_dir_denied"];
X+		} else
X 		{
X-			$_ERROR = $_LANG["failed_move"];
X+			if(!is_uploaded_file($userfile['tmp_name']))
X+			{
X+				$_ERROR = $_LANG["failed_upload"];
X+			}
X+			else if(!@move_uploaded_file($userfile['tmp_name'], $upload_file))
X+			{
X+				$_ERROR = $_LANG["failed_move"];
X+			}
X+			else
X+				chmod($upload_file, 0755);
X+				// check if mail notification is enabled
X+				if ($_CONFIG['notify_enable'] == 1)
X+				{
X+					send_mail($location->getFullPath(), $name);
X+				}
X+			}
X 		}
X-		else
X-			chmod($upload_file, 0755);
X 	}
X 
X 	//
X@@ -843,12 +1103,52 @@
X 	// 
X 	function run($location)
X 	{
X-		if(isset($_POST['password']) && $this->checkPassword($_POST['password']))
X+		global $_CONFIG;
X+		global $_ERROR;
X+		global $_LANG;
X+
X+		// check if the file size exceeds PHP limits
X+		if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && $_SERVER['CONTENT_LENGTH'] > 0)
X 		{
X-			if(isset($_POST['userdir']) && strlen($_POST['userdir']) > 0)
X-				$this->newFolder($location, $_POST['userdir']);
X-			if(isset($_FILES['userfile']['name']) && strlen($_FILES['userfile']['name']) > 0)
X-				$this->uploadFile($location, $_FILES['userfile']);
X+			$_ERROR = $_LANG["failed_upload_size"];
X+		}
X+		else
X+		{
X+
X+			// This takes care of the following:
X+			// - check if upload is enabled
X+			// - check if delete is enabled
X+			// - check if a password is needed
X+			// - validate passwords
X+			// - check for empty passwords
X+			// - show error on empty or wrong passwords
X+			if ( (strlen($_CONFIG['upload_password']) == 0) || 
X+				( 
X+					(strlen($_CONFIG['upload_password']) > 0) && 
X+					(
X+						((isset($_POST['password'])) && $this->checkPassword($_POST['password'])) || 
X+				  	  	( 
X+							(
X+							(empty($_POST['password'])) && 
X+							((count($_POST['directorylist']) > 0) || (count($_POST['filelist']) > 0) || (strlen($_POST['userdir']) > 0))
X+							) && 
X+				 			$this->checkPassword($_POST['password'],1)
X+						)
X+					)
X+				)
X+			   )
X+			{
X+				// new folder
X+				if($_CONFIG['upload_enable'] == 1 && isset($_POST['userdir']) && strlen($_POST['userdir']) > 0)
X+					$this->newFolder($location, $_POST['userdir']);
X+				// delete
X+				if($_CONFIG['delete_enable'] == 1 && (isset($_POST['directorylist']) && count($_POST['directorylist']) > 0) || (isset($_POST['filelist']) && count($_POST['filelist']) > 0))
X+					$this->deleteOnServer($location, $_POST['directorylist']);
X+					$this->deleteOnServer($location, $_POST['filelist']);
X+				// upload
X+				if($_CONFIG['upload_enable'] == 1 && isset($_FILES['userfile']['name']) && strlen($_FILES['userfile']['name']) > 0)
X+					$this->uploadFile($location, $_FILES['userfile']);
X+			}
X 		}
X 	}
X }
X@@ -880,6 +1180,11 @@
X 		return urlencode($this->name);
X 	}
X 
X+	function getNameDecoded()
X+	{
X+		return htmlspecialchars_decode($this->name);
X+	}
X+
X 	//
X 	// Debugging output
X 	// 
X@@ -909,9 +1214,9 @@
X 		$this->name = htmlspecialchars($name);
X 		$this->location = $location;
X 		
X-		$this->extension = $this->findExtension($this->location->getDir(true, false, 0).$this->getName());
X-		$this->size = $this->findSize($this->location->getDir(true, false, 0).$this->getName());
X-		$this->modTime = filemtime($this->location->getDir(true, false, 0).$this->getName());
X+		$this->extension = $this->findExtension($this->location->getFullPath().$this->getName());
X+		$this->size = $this->findSize($this->location->getFullPath().$this->getNameDecoded());
X+		$this->modTime = filemtime($this->location->getFullPath().$this->getNameDecoded());
X 	}
X 
X 	function getName()
X@@ -924,6 +1229,11 @@
X 		return urlencode($this->name);
X 	}
X 
X+	function getNameDecoded()
X+	{
X+		return htmlspecialchars_decode($this->name);
X+	}
X+
X 	function getSize()
X 	{
X 		return $this->size;
X@@ -944,7 +1254,7 @@
X 	// 
X 	function findSize($file)
X 	{
X-		$sizeInBytes = filesize($file);
X+		$sizeInBytes = filesize("$file");
X 
X 		// If filesize() fails (with larger files), try to get the size from unix command line.
X 		if (!$sizeInBytes) {
X@@ -1006,13 +1316,14 @@
X 			$dir .= "./";
X 		for($i = 0; $i < ((count($this->path) >= $up && $up > 0)?count($this->path)-$up:count($this->path)); $i++)
X 		{
X-			$dir .= ($encoded?rawurlencode($this->path[$i]):$this->path[$i])."/";
X+			$dir .= ($encoded?rawurlencode($this->path[$i]):htmlspecialchars_decode($this->path[$i]))."/";
X 		}
X 		return $dir;
X 	}
X 
X 	function getFullPath()
X 	{
X+		global $_CONFIG;
X 		return ($_CONFIG['basedir']?$_CONFIG['basedir']:dirname($_SERVER['SCRIPT_FILENAME']))."/".$this->getDir(true, false, 0);
X 	}
X 
X@@ -1059,6 +1370,8 @@
X 	// 
X 	function init()
X 	{
X+		global $_CONFIG;
X+
X 		$this->sort_by = "";
X 		$this->sort_as = "";
X 		if(isset($_GET["sort_by"]) && isset($_GET["sort_as"]))
X@@ -1076,7 +1389,10 @@
X 			$this->sort_as = "desc";
X 		}
X 
X-		$this->calculateSpace();
X+		if ($_CONFIG['status_enable'] == 1)
X+		{
X+			$this->calculateSpace();
X+		}
X 	}
X 
X 	//
X@@ -1098,7 +1414,7 @@
X 			{
X 				if($object != "." && $object != "..") 
X 				{
X-					if(is_dir($this->location->getDir(true, false, 0)."/".$object))
X+					if(is_dir($this->location->getFullPath(true, false, 0)."/".$object))
X 					{
X 						if(!in_array($object, $_CONFIG['hidden_dirs']))
X 							$this->dirs[] = new Dir($object, $this->location);
X@@ -1281,6 +1597,15 @@
X }
X ?>
X 
X+<?php
X+if($_CONFIG['delete_enable'] == 1 || $_CONFIG['upload_enable'] == 1)
X+{
X+?>
X+<form enctype="multipart/form-data" action="" method="post">
X+<?php
X+}
X+?>
X+
X <!-- START: List table -->
X <table class="table" border="0" cellpadding="3" cellspacing="0">
X <tr class="breadcrumbs">
X@@ -1299,11 +1624,13 @@
X </tr>
X <tr class="row one">
X 	<td class="icon"> </td>
X+	<td class="icon"> </td>
X 	<td class="name"><?php print $this->makeArrow("name");?></td>
X 	<td class="size"><?php print $this->makeArrow("size"); ?></td>
X 	<td class="changed"><?php print $this->makeArrow("mod"); ?></td>
X </tr>
X <tr class="row two">
X+	<td class="icon"> </td>
X 	<td class="icon"><img alt="dir" src="?img=directory" /></td>
X 	<td colspan="3" class="long"><a href="?dir=<?php print $this->location->getDir(false, true, 1); ?>">..</a></td>
X </tr>
X@@ -1323,6 +1650,7 @@
X 		$row_style = ($row ? "one" : "two");
X ?>
X <tr class="row <?php print $row_style; ?>">
X+	<td class="icon"><?php if($_CONFIG['delete_enable'] == 1) { ?><input type="checkbox" name="directorylist[]" value="<?php print $this->location->getFullPath().$dir->getNameEncoded(); ?>"><?php } ?></td>
X 	<td class="icon"><img alt="dir" src="?img=directory" /></td>
X 	<td colspan="3" class="long"><?php print "<a href=\"?dir=".$this->location->getDir(false, true, 0).$dir->getNameEncoded()."\">".$dir->getName()."</a>"; ?></td>
X </tr>
X@@ -1341,6 +1669,7 @@
X 		$row_style = ($row ? "one" : "two");
X ?>
X <tr class="row <?php echo $row_style; ?>">
X+	<td class="icon"><?php if($_CONFIG['delete_enable'] == 1) { ?><input type="checkbox" name="filelist[]" value="<?php print $this->location->getFullPath().$file->getNameEncoded(); ?>"><?php } ?></td>
X 	<td class="icon"><img alt="<?php print $file->getExtension(); ?>" src="<?php print $this->makeIcon($file->getExtension()); ?>" /></td>
X 	<td class="name">
X <?php
X@@ -1369,38 +1698,83 @@
X 
X </div>
X 
X+<!-- START: Action area -->
X+<div id="upload">
X+		<table cellspacing="0" cellpadding="0" border="0" width="100%">
X+			<tr>
X+				<td>
X+<!-- START: Delete area -->
X <?php
X-if(strlen($_CONFIG['upload_password']) > 0)
X+if($_CONFIG['delete_enable'] == 1)
X {
X ?>
X+					<div class="delete">
X+						<input type="submit" value="<?php print $_LANG["delete"]; ?>" />
X+					</div>
X+<?php
X+}
X+?>
X+<!-- END: Delete area -->
X <!-- START: Upload area -->
X-<div id="upload">
X-	<form enctype="multipart/form-data" action="" method="post">
X-		<table cellspacing="0" cellpadding="0" border="0" width="100%">
X+<?php
X+if($_CONFIG['upload_enable'] == 1)
X+{
X+?>
X+					<div class="upload">
X+						<input name="userdir" type="text" class="text" />
X+						<input type="submit" value="<?php print $_LANG["make_directory"]; ?>" />
X+					</div>
X+<?php
X+}
X+?>
X+<!-- END: Upload area -->
X+				</td>
X+			</tr>
X 			<tr>
X 				<td>
X+<!-- START: Password area -->
X+<?php
X+if(strlen($_CONFIG['upload_password']) > 0 && ($_CONFIG['upload_enable'] == 1 || $_CONFIG['delete_enable'] == 1))
X+{
X+?>
X 					<div class="password">
X 						<?php print $_LANG["password"]; ?>: <input type="password" name="password" class="text" />
X 					</div>
X+<?php
X+}
X+?>
X+<!-- END: Password area -->
X+<!-- START: Upload area -->
X+<?php
X+if($_CONFIG['upload_enable'] == 1)
X+{
X+?>
X 					<div class="upload">
X-						<input name="userdir" type="text" class="text" />
X-						<input type="submit" value="<?php print $_LANG["make_directory"]; ?>" />
X 						<input name="userfile" type="file" />
X 						<input type="submit" value="<?php print $_LANG["upload"]; ?>" />
X 					</div>
X+<?php
X+}
X+?>
X+<!-- END: Upload area -->
X 				</td>
X 			</tr>
X 		</table>
X-	</form>
X </div>
X-<!-- END: Upload area -->
X-<?php
X-}
X-?>
X+</form>
X+<!-- END: Action area -->
X 
X <!-- START: Info area -->
X <div id="info">
X-<?php print $_LANG["total_used_space"]; ?>: <?php print $this->spaceUsed; ?> MB | <?php print $_LANG["free_space"]; ?>: <?php print $this->spaceLeft; ?> MB | <a href="http://encode-explorer.siineiolekala.net">encode explorer</a>
X+<?php
X+if($_CONFIG['status_enable'] == 1)
X+{
X+?>
X+<?php print $_LANG["total_used_space"]; ?>: <?php print $this->spaceUsed; ?> MB | <?php print $_LANG["free_space"]; ?>: <?php print $this->spaceLeft; ?> MB | 
X+<?php
X+}
X+?>
X+<a href="http://encode-explorer.siineiolekala.net">encode explorer</a>
X </div>
X <!-- END: Info area -->
X <!-- Encode Explorer v5.0 -->
X@@ -1419,6 +1793,32 @@
X $imageServer = new ImageServer();
X if(!$imageServer->showImage())
X {
X+	// check if dynamic configuration is active
X+	if($_CONFIG['enable_dynamic_config'] == 1)
X+	{
X+		foreach(array_keys($_CONFIG) as $key)
X+		{
X+			if(strlen($_SERVER['EEXPLORER_' . $key]) > 0)
X+			{
X+				// overwrite static with dynamic configuration
X+				if($key == 'notify_addresses' || $key == 'hidden_files' || $key == 'hidden_dirs')
X+				{
X+					// clear array, removing old data
X+					$_CONFIG[$key] = array();
X+
X+					foreach(explode(' ',$_SERVER['EEXPLORER_' . $key]) as $data)
X+					{
X+						array_push($_CONFIG[$key],$data);
X+					}
X+				}
X+				else
X+				{
X+					$_CONFIG[$key] = $_SERVER['EEXPLORER_' . $key];
X+				}
X+			}
X+		}
X+	}
X+
X 	$_LANG = $_TRANSLATIONS[$_CONFIG['lang']];
X 	$location = new Location();
X 	$location->init();
X@@ -1427,4 +1827,4 @@
X 	$encodeExplorer = new Encode_Explorer();
X 	$encodeExplorer->run($location);
X }
X-?>
X\ No newline at end of file
X+?>
388c27257a613e93d3488c6ce8e4e700
echo x - encode-explorer/pkg-descr
sed 's/^X//' >encode-explorer/pkg-descr << '09b08bf1985e463e7f6d891e2e0a1483'
XEncode Explorer is an easy-to-use php script to use as an index file.
XIt shows files in the server and lets you browse through folders,
Xupload files etc. It is kept small and neat so that the source can be
Xused for learning.
X
XWWW:	http://sourceforge.net/projects/encode-explorer/
09b08bf1985e463e7f6d891e2e0a1483
echo x - encode-explorer/distinfo
sed 's/^X//' >encode-explorer/distinfo << '37cf2119ab317e3e297a78f0aa6033e3'
XSHA256 (encode-explorer_5.0.tar) = 4da27fe79077c3a3a89093c5038a1a75b6d5b8ec7f6f78ebc5b8bafdeb76caa7
XSIZE (encode-explorer_5.0.tar) = 51200
37cf2119ab317e3e297a78f0aa6033e3
echo x - encode-explorer/Makefile
sed 's/^X//' >encode-explorer/Makefile << '6f9e52f9df75d9110acf458d59036a82'
X# New ports collection makefile for:	encode-explorer
X# Date created:			Thu Apr 22 11:24:23 CEST 2010
X# Whom:				Frank Wall <fw at moov.de>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	encode
XPORTVERSION=	5.0
XCATEGORIES=	www
XMASTER_SITES=	SF/${PORTNAME}${PKGNAMESUFFIX}/${PORTNAME}${PKGNAMESUFFIX}/${PORTNAME}${PKGNAMESUFFIX}_${PORTVERSION}
XPKGNAMESUFFIX=	-explorer
XDISTNAME=	${PORTNAME}${PKGNAMESUFFIX}_${PORTVERSION}
XEXTRACT_SUFX=	.tar
X
XMAINTAINER=	fw at moov.de
XCOMMENT=	A PHP script to browse, create folders, upload files etc
X
XUSE_PHP=	yes
XWANT_PHP_WEB=	yes
X
XUSE_TAR=	yes
XNO_BUILD=	yes
X
XOPTIONS=	EXPERIMENTAL "Enable experimental features" off
X
XWRKSRC=		${WRKDIR}/${DISTNAME}
XWWWDIR=		${PREFIX}/www/${PORTNAME}${PKGNAMESUFFIX}
XDOCSDIR=	${PREFIX}/share/doc/${PORTNAME}${PKGNAMESUFFIX}
X
X.include <bsd.port.pre.mk>
X
X.if defined(WITH_EXPERIMENTAL)
XEXTRA_PATCHES+=	${PATCHDIR}/extra-patch-index-php-experimental
X.endif
X
Xdo-install:
X	${MKDIR} ${WWWDIR}
X	${INSTALL} ${WRKSRC}/index.php ${WWWDIR}
X
Xpost-install:
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${DOCSDIR}
X	${CP} ${WRKSRC}/README.txt ${DOCSDIR}
X.endif
X
X.include <bsd.port.post.mk>
6f9e52f9df75d9110acf458d59036a82
echo x - encode-explorer/pkg-plist
sed 's/^X//' >encode-explorer/pkg-plist << '5d5a7c9d43292cdd67ead13817ee5286'
X%%WWWDIR%%/index.php
X%%PORTDOCS%%%%DOCSDIR%%/README.txt
X at dirrm %%WWWDIR%%
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
5d5a7c9d43292cdd67ead13817ee5286
exit
--- encode-explorer-5.0.shar ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list