From: <tr...@us...> - 2002-09-26 19:35:55
|
Update of /cvsroot/basedb/basedb/www In directory usw-pr-cvs1:/tmp/cvs-serv23731 Modified Files: upload.inc.php upload_list.phtml Added Files: upload_common.inc.php Log Message: Moved handleUpload and related things to upload_common.inc.php --- NEW FILE: upload_common.inc.php --- <? // $Id: upload_common.inc.php,v 1.1 2002/09/26 19:35:52 troein Exp $ // // BioArray Software Environment (BASE) - homepage http://base.thep.lu.se/ // Copyright (C) 2002 Lao Saal, Carl Troein, Johan Vallon-Christersson (LSCTJVC) // // Write to LSCTJVC, Dept. of Oncology, Lund University Hospital, // Klinikgatan 7, SE-22185, Lund, Sweden. // // This file is part of BASE. // // BASE 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 2 // of the License, or (at your option) any later version. // // BASE 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 [...108 lines suppressed...] "$f[tmp_name] to $fname"; } else @unlink($f["tmp_name"]); if($err != "") { error_log("Upload failed: $err"); @unlink($f["tmp_name"]); $upload->updateRemoved(true); } ignore_user_abort($iua); $GLOBALS["i_fileid"] = $upload->getId(); return $err; } ?> Index: upload.inc.php =================================================================== RCS file: /cvsroot/basedb/basedb/www/upload.inc.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** upload.inc.php 22 Sep 2002 23:37:35 -0000 1.22 --- upload.inc.php 26 Sep 2002 19:35:52 -0000 1.23 *************** *** 26,30 **** require_once("item.inc.php"); ! define("CLEN_UPLOAD_NAME", 60); define("CLEN_UPLOAD_MIMETYPE", 255); --- 26,30 ---- require_once("item.inc.php"); ! define("CLEN_UPLOAD_NAME", 255); define("CLEN_UPLOAD_MIMETYPE", 255); [...85 lines suppressed...] ! if(!file_exists($dir)) ! if(!$createDir || !mkdir($dir, 0700)) return false; ! return $dir."/".$this->id; } *************** *** 184,189 **** { // Add more fields and operators here ! $fields = array("up.name", "up.`fileSize`", "up.`addedDate`", "up.descr", ! "ug.name"); $search->makeWhere($fields); --- 127,132 ---- { // Add more fields and operators here ! $fields = array("up.name", "up.`fileSize`", "up.`addedDate`", ! "up.descr", "ug.name"); $search->makeWhere($fields); Index: upload_list.phtml =================================================================== RCS file: /cvsroot/basedb/basedb/www/upload_list.phtml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** upload_list.phtml 22 Sep 2002 23:37:35 -0000 1.4 --- upload_list.phtml 26 Sep 2002 19:35:52 -0000 1.5 *************** *** 29,32 **** --- 29,33 ---- require_once("searchhtml.inc.php"); require_once("item_common.inc.php"); + require_once("upload_common.inc.php"); verifyAccess(BUA_NONE); *************** *** 40,45 **** $up = new Upload(); ! $err = $up->handleUpload($curUser, "i_file", false, ! isset($i_descr) ? $i_descr : ""); $others = isset($i_others) && $i_others ? 1 : 0; --- 41,45 ---- $up = new Upload(); ! $err = handleUpload($up, $curUser); $others = isset($i_others) && $i_others ? 1 : 0; *************** *** 52,70 **** ?> <table <?= $cellpad ?>> ! <tr><th colspan=3 class=pagehead><?= $pageName ?> <?= webHelp(80, 1) ?></th></tr> <? ! if($err) ! echo "<tr><td colspan=3 class=red>Error: $err</td></tr>\n"; ?> ! <tr><td class=tiny colspan=3> </td></tr> <form method=post enctype="multipart/form-data" action="upload_list.phtml?i_others=<?= $others ?>"> ! <tr><th colspan=3>Upload new file</th></tr> ! <tr><th>Select a file</th><td><input type=file name=i_file></td> ! <td><input type=submit value="Upload it"></td></tr> ! <tr><th>Description</th><td colspan=2><input type=text ! name=i_descr size=30></td></tr> </form> --- 52,70 ---- ?> <table <?= $cellpad ?>> ! <tr><th colspan=2 class=pagehead><?= $pageName ?> <?= webHelp(80, 1) ?></th></tr> <? ! if($err != "") ! echo "<tr><td colspan=2 class=red>Error: $err</td></tr>\n"; ?> ! <tr><td class=tiny colspan=2> </td></tr> <form method=post enctype="multipart/form-data" action="upload_list.phtml?i_others=<?= $others ?>"> ! <tr><th colspan=2>Upload new file</th></tr> ! <tr><th>Select a file</th><td><input type=file name=i_file> ! <input type=submit value="Upload it"></td></tr> ! <tr><th>Description</th><td><input type=text ! name=i_filedescr size=30></td></tr> </form> |