From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Apr 22 13:30:02 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF3911065675 for ; Thu, 22 Apr 2010 13:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id A205C8FC13 for ; Thu, 22 Apr 2010 13:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o3MDU2Ph032090 for ; Thu, 22 Apr 2010 13:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o3MDU2YT032087; Thu, 22 Apr 2010 13:30:02 GMT (envelope-from gnats) Resent-Date: Thu, 22 Apr 2010 13:30:02 GMT Resent-Message-Id: <201004221330.o3MDU2YT032087@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Frank Wall Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66A55106564A for ; Thu, 22 Apr 2010 13:23:53 +0000 (UTC) (envelope-from fw@inotronic.de) Received: from mail.inotronic.de (mail.inotronic.de [77.73.248.111]) by mx1.freebsd.org (Postfix) with ESMTP id 3837A8FC18 for ; Thu, 22 Apr 2010 13:23:51 +0000 (UTC) Received: from phosphorus (mail [77.73.248.111]) by mail.inotronic.de (8.14.4/8.14.3) with ESMTP id o3MDNnNB078917 for ; Thu, 22 Apr 2010 15:23:49 +0200 (CEST) (envelope-from fw@inotronic.de) Received: from boron.inotronic.de (boron.inotronic-intern.de [10.1.2.10]) by mail.inotronic.de (8.14.4/8.14.3) with ESMTP id o3MDNOsx078873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 22 Apr 2010 15:23:25 +0200 (CEST) (envelope-from fw@inotronic.de) Received: from boron.inotronic-intern.de (fw@localhost [127.0.0.1]) by boron.inotronic.de (8.14.3/8.14.3) with ESMTP id o3MDNOTw062518 for ; Thu, 22 Apr 2010 15:23:24 +0200 (CEST) (envelope-from fw@boron.inotronic-intern.de) Received: (from fw@localhost) by boron.inotronic-intern.de (8.14.3/8.14.3/Submit) id o3MDNOqT062517; Thu, 22 Apr 2010 15:23:24 +0200 (CEST) (envelope-from fw) Message-Id: <201004221323.o3MDNOqT062517@boron.inotronic-intern.de> Date: Thu, 22 Apr 2010 15:23:24 +0200 (CEST) From: Frank Wall To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/145945: [NEW PORT] www/encode-explorer: A PHP script to browse, create folders, upload files etc X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2010 13:30:02 -0000 >Number: 145945 >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: Thu Apr 22 13:30:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Frank Wall >Release: FreeBSD 7.1-RELEASE-p4 amd64 >Organization: >Environment: System: FreeBSD 7.1-RELEASE-p4 FreeBSD 7.1-RELEASE-p4 #0: Sun Mar 22 09:43:46 UTC 2009 >Description: 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-04-22 14:48:20.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'] = 1; 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@@ -128,17 +133,46 @@ X // X $_CONFIG['hidden_files'] = array(".ftpquota", "index.php", "index.php~", ".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@example.com X+// X+$_CONFIG['notify_sender'] = 'webmaster@example.com'; X+ X+// X+// E-Mail addresses that will be notified on file upload. X+// Default: nobody@example.com X+// X+$_CONFIG['notify_addresses'] = array("nobody@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 uploading 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'] = 1; 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@@ -185,16 +219,26 @@ 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_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+ "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 +270,21 @@ 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_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+ "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 +608,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 +628,7 @@ X width:680px; X position: relative; X margin: 0 auto; X+ margin-top: 4px; X text-align:center; X } X X@@ -750,6 +812,86 @@ 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+ $url = str_replace($_SERVER['DOCUMENT_ROOT'], "", $path); X+ $protocol = explode("/", $_SERVER['SERVER_PROTOCOL']); X+ $protocol = $protocol[0]; 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"] . ' ' . $protocol . "://" . $_SERVER['SERVER_NAME'] . $url . $file . "\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 +921,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@@ -813,12 +963,55 @@ 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+ X+ // check if it is a file X+ if (is_file($deleteitem)) X+ { X+ if(!unlink($deleteitem)) X+ $_ERROR = $_LANG["del_file_failed"]; X+ } X+ // it is a directory X+ else X+ { 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 function uploadFile($location, $userfile) X { X global $_CONFIG; 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@@ -836,6 +1029,12 @@ 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 X // X@@ -843,12 +1042,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@@ -1059,6 +1298,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 +1317,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@@ -1281,6 +1525,15 @@ X } X ?> X X+ X+
X+ X+ X X X X@@ -1289,7 +1542,7 @@ X for($i = 0; $i < count($this->location->path); $i++) X { X ?> X- / X+ X location->path[$i]; ?> X X X X X+ X X X X X X+ X X X X@@ -1323,6 +1578,7 @@ X $row_style = ($row ? "one" : "two"); X ?> X X+ X X X X@@ -1341,6 +1597,7 @@ X $row_style = ($row ? "one" : "two"); X ?> X X+ X X
  makeArrow("name");?>makeArrow("size"); ?>makeArrow("mod"); ?>
 dir..
dirlocation->getDir(false, true, 0).$dir->getNameEncoded()."\">".$dir->getName().""; ?>
<?php print $file->getExtension(); ?> X X X+ X+
X+ X+ X+
X+ X 0) X+if($_CONFIG['delete_enable'] == 1) X { X ?> X+
X+ " /> X+
X+ X+ X X-
X- X- X+ X+
X+ X+ " /> X+
X+ X+ X+ X+ X X X X
X+ X+ 0 && ($_CONFIG['upload_enable'] == 1 || $_CONFIG['delete_enable'] == 1)) X+{ X+?> X
X : X
X+ X+ X+ X+ X
X- X- " /> X X " /> X
X+ X+ X
X- X
X- X- X+ X+ X X X
X-: spaceUsed; ?> MB | : spaceLeft; ?> MB | encode explorer X+ X+: spaceUsed; ?> MB | : spaceLeft; ?> MB | X+ X+encode explorer X
X X X@@ -1427,4 +1729,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' XMD5 (encode-explorer_5.0.tar) = 60e8da0a1eee77c28e4b80382e0396dc 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 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@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 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 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@dirrm %%WWWDIR%% 5d5a7c9d43292cdd67ead13817ee5286 exit --- encode-explorer-5.0.shar ends here --- >Release-Note: >Audit-Trail: >Unformatted: