[Aminet-commit] r141 - trunk/phpinclude

aminet-discuss at aminet.net aminet-discuss at aminet.net
Sun Nov 9 22:54:48 CET 2008


Author: mendoza
Date: 2008-11-09 13:54:48 -0800 (Sun, 09 Nov 2008)
New Revision: 141

Modified:
   trunk/phpinclude/upload.php
Log:
Add 40 char notice on description, and avoid some warnings on undefined values

Modified: trunk/phpinclude/upload.php
===================================================================
--- trunk/phpinclude/upload.php	2008-11-09 21:49:33 UTC (rev 140)
+++ trunk/phpinclude/upload.php	2008-11-09 21:54:48 UTC (rev 141)
@@ -7,7 +7,9 @@
 include "include/main.php";
 aminet_log("Upload page");
 gui_header();
+aminet_log("Upload page 2");
 print font_start();
+aminet_log("Upload page 3");
 
 global $errors;
 $tmp_dir = "$amirepo_root/$subdir"."new/priv/temp/";
@@ -15,6 +17,8 @@
 
 $errors = array();
 
+aminet_log("Upload page 4");
+
 $def_archs = array(
 		   "m68k-amigaos >= 1.3.0" => "AmigaOS 1.3",
 		   "m68k-amigaos >= 2.0.4" => "AmigaOS 2.0.4",
@@ -32,6 +36,7 @@
 		   "ppc-amigaos >= 4.0.3"  => "AmigaOS 4.0 pre update 3",
 		   "ppc-amigaos >= 4.0.4"  => "AmigaOS 4.0 pre update 4",
 		   "ppc-amigaos >= 4.0.5"  => "AmigaOS 4.0 final",
+		   "ppc-amigaos >= 4.1.0"  => "AmigaOS 4.1",
 		   "generic"               => "Generic",
 		   "ppc-morphos >= 1.4.0"  => "MorphOS 1.4",
 		   "ppc-morphos >= 1.4.2"  => "MorphOS 1.4.2",
@@ -40,14 +45,22 @@
 		   "i386-amithlon"         => "Amithlon",
 		   );
 
+aminet_log("Upload page 6");
+
+
 $paths = array();
+aminet_log("Upload page 7");
+
 foreach($tree as $branch) {
   if (preg_match("/\//",$branch)) {
     $paths[$branch] = $branch . " - " . $tree_desc[$branch];
   }
 }
 
+aminet_log("starting switch on action");
+
 if (isset($_GET['action'])) {
+aminet_log("action " . $_GET['action']);
 switch($_GET['action']) {
  case "upload":
    upload();
@@ -58,8 +71,11 @@
    print_readme_form();
    break;
  case "upload_form_both":
+   aminet_log("starting print_form_start()");
    print_form_start();
+   aminet_log("starting print_package_upload_form()");
    print_package_upload_form();
+   aminet_log("starting print_readme_upload_form()");
    print_readme_upload_form();
    break;
  default:
@@ -67,16 +83,21 @@
 }
 
 } elseif (isset($_POST['action'])) {
+  aminet_log("post action" . $_POST['action']);
   switch($_POST['action']) {
   case "upload_check":
   case "upload_check_both":
     if (upload_check()) {
+      aminet_log("upload check SUCCESS");
+    } else {
+      aminet_log("upload check FAILURE");
     }
     break;
   default:
     break;
   }
 } else {
+    aminet_log("no action?");
     print_upload_menu();
 }    
 println(font_end());
@@ -157,7 +178,8 @@
 
   if (!isset($_POST['tmp_file'])) {
     $tmpname = tempnam($tmp_dir,"web");
-    if (preg_match("/^".preg_quote($tmp_dir,'/')."/",$tmpname)) {
+    aminet_log("tmpdir: $tmp_dir, tmpname: $tmpname");
+    #if (preg_match("/^".preg_quote($tmp_dir,'/')."/",$tmpname)) {
       aminet_log("creating $tmpname");
       if (!move_uploaded_file($_FILES['package']['tmp_name'],$tmpname)) {
         $errors[] = "Not able to move '".$_FILES['package']['tmp_name']."' to '$tmpname'";
@@ -166,11 +188,11 @@
       } else {
         aminet_log("moving '".$_FILES['package']['tmp_name']."' to '".$tmpname."'");
       }
-    } else {
-      $errors[] = "Not able to create temporary file";
-      print_errors($errors);
-      return false;
-    }
+    #} else {
+    #  $errors[] = "Not able to create temporary file";
+    #  print_errors($errors);
+    #  return false;
+    #}
   } else {
     aminet_log("tmp_file already set: ".$_POST['tmp_file']);
     $tmpname = $_POST['tmp_file'];
@@ -449,6 +471,18 @@
 function print_readme_form($readme=array(),$error=array(),$confirm=0,$uploaded_package=0) {
 
   global $tree,$def_archs,$paths,$readme_unknown;
+
+  if (!isset($readme['short']))        { $readme['short']        = ''; }
+  if (!isset($readme['uploader']))     { $readme['uploader']     = ''; }
+  if (!isset($readme['author']))       { $readme['author']       = ''; }
+  if (!isset($readme['type']))         { $readme['type']         = ''; }
+  if (!isset($readme['version']))      { $readme['version']      = ''; }
+  if (!isset($readme['replaces']))     { $readme['replaces']     = array(); }
+  if (!isset($readme['requires']))     { $readme['requires']     = ''; }
+  if (!isset($readme['architecture'])) { $readme['architecture'] = array(); }
+  if (!isset($readme['custom_arch']))  { $readme['custom_arch']  = ''; }
+  if (!isset($readme['distribution'])) { $readme['distribution'] = ''; }
+  if (!isset($readme['text']))         { $readme['text']         = ''; }
   
   if ($uploaded_package) {
     println('<h3>Step 2 out of 3: Correct errors and verify that the headers are correct</h3>');
@@ -464,7 +498,7 @@
     if (isset($error['filename'])) { println("<tr><td colspan=3><font color=\"red\">".$error['filename']."</font></td></tr>");}
   }
   
-  println('<tr><td bgcolor="#eeeeee" align="right">* Short:</td><td><input type="text" name="readme_short" size="40" value="'.$readme['short'].'"></td><td>Example: Shows JPEG & IFF pics. AGA support.</td></tr>');
+  println('<tr><td bgcolor="#eeeeee" align="right">* Short:</td><td><input type="text" name="readme_short" size="40" value="'.$readme['short'].'"></td><td>Example: Shows JPEG & IFF pics. AGA support. (Max 40 chars)</td></tr>');
   if (isset($error['short'])) { println("<tr><td colspan=3><font color=\"red\">".$error['short']."</font></td></tr>");}
   
   println('<tr><td bgcolor="#eeeeee" align="right">* Uploader:</td><td><input type="text" name="readme_uploader" size="40" value="'.htmlentities($readme['uploader']).'"></td><td>Example: "Urban Mueller" &lt;aminet at aminet.net&gt;</td></tr>');
@@ -479,7 +513,7 @@
   println('<tr><td bgcolor="#eeeeee" align="right">  Version:</td><td><input type="text" name="readme_version" size="10" value="'.$readme['version'].'"></td><td>Example: 1.2</td></tr>');
   if (isset($error['version'])) { println("<tr><td colspan=3><font color=\"red\">".$error['version']."</font></td></tr>");}
   
-  println('<tr><td bgcolor="#eeeeee" align="right">  Replaces:</td><td><input type="text" name="readme_replaces" size="40" value="'.join(";",$readme['replaces']).'"></td><td>Example: gfx/show/OldPicShow.lha</td></tr>');
+  println('<tr><td bgcolor="#eeeeee" align="right">  Replaces:</td><td><input type="text" name="readme_replaces" size="40" value="'.join(";",(isset($readme['replaces']) && is_array($readme['replaces']) ? $readme['replaces'] : array($readme['replaces']))).'"></td><td>Example: gfx/show/OldPicShow.lha</td></tr>');
   if (isset($error['replaces'])) { println("<tr><td colspan=3><font color=\"red\">".$error['replaces']."</font></td></tr>");}
   
   println('<tr><td bgcolor="#eeeeee" align="right">  Requires:</td><td><input type="text" name="readme_requires" size="40" value="'.$readme['requires'].'"></td><td>Example: gfx/show/PicShowHelper.lha</td></tr>');




More information about the Aminet-commit mailing list