[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> upload.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/upload.php,v $
  14  |     $Revision: 1.16 $
  15  |     $Date: 2006/10/22 22:57:54 $
  16  |     $Author: e107coders $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("class2.php");
  20  
  21  if (!$pref['upload_enabled'] || $pref['upload_class'] == 255) {
  22      header("location: ".e_BASE."index.php");
  23      exit;
  24  }
  25  
  26  require_once(HEADERF);
  27  
  28  if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
  29  
  30  if (!check_class($pref['upload_class'])) {
  31      $text = "<div style='text-align:center'>".LAN_403."</div>";
  32      $ns->tablerender(LAN_20, $text);
  33      require_once(FOOTERF);
  34      exit;
  35  }
  36  
  37  if (isset($_POST['upload'])) {
  38      if (($_POST['file_email'] || USER == TRUE) && $_POST['file_name'] && $_POST['file_description']) {
  39  
  40          require_once(e_HANDLER."upload_handler.php");
  41          $uploaded = file_upload(e_FILE."public/", "unique");
  42  
  43          $file = $uploaded[0]['name'];
  44          $filetype = $uploaded[0]['type'];
  45          $filesize = $uploaded[0]['size'];
  46          $image = $uploaded[1]['name'];
  47          $imagetype = $uploaded[1]['type'];
  48  
  49          if (!$pref['upload_maxfilesize']) {
  50              $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576;
  51          }
  52  
  53  
  54          if ($filesize > $pref['upload_maxfilesize']) {
  55              $message = LAN_405;
  56          } else {
  57              if (is_array($uploaded)) {
  58                  $poster = (USER ? USERID.".".USERNAME : "0".$_POST['file_poster']);
  59                  $_POST['file_email'] = ($_POST['file_email'] ? $_POST['file_email'] : USEREMAIL);
  60                  $_POST['file_description'] = $tp->toDB($_POST['file_description']);
  61                  $file_time = time();
  62                  $sql->db_Insert("upload", "0, '".$tp -> toDB($poster)."', '".$tp -> toDB(check_email($_POST['file_email']))."', '".$tp -> toDB($_POST['file_website'])."', '".$file_time."', '".$tp -> toDB($_POST['file_name'])."', '".$tp -> toDB($_POST['file_version'])."', '".$file."', '".$image."', '".$tp -> toDB($_POST['file_description'])."', '".$tp -> toDB($_POST['file_demo'])."', '".$filesize."', 0, '".$tp -> toDB($_POST['download_category'])."'");
  63                  $edata_fu = array("upload_user" => $poster, "upload_email" => $_POST['file_email'], "upload_name" => $tp -> toDB($_POST['file_name']),"upload_file" => $file, "upload_version" => $_POST['file_version'], "upload_description" => $tp -> toDB($_POST['file_description']), "upload_size" => $filesize, "upload_category" => $tp -> toDB($_POST['download_category']), "upload_website" => $tp -> toDB($_POST['file_website']), "upload_image" => $image, "upload_demo" => $tp -> toDB($_POST['file_demo']), "upload_time" => $file_time);
  64                  $e_event->trigger("fileupload", $edata_fu);
  65                  $message .= "<br />".LAN_404;
  66              }
  67          }
  68  
  69      } else {
  70          require_once(e_HANDLER."message_handler.php");
  71          message_handler("ALERT", 5);
  72      }
  73  }
  74  
  75  if (isset($message)) {
  76      $ns->tablerender("", "<div style=\"text-align:center\"><b>".$message."</b></div>");
  77      require_once(FOOTERF);
  78      exit;
  79  }
  80  
  81  $text = "<div style='text-align:center'>
  82      <form enctype='multipart/form-data' method='post' action='".e_SELF."'>
  83      <table style='".USER_WIDTH."' class='fborder'>
  84      <tr>
  85      <td style='width:20%' class='forumheader3'>".DOWLAN_11.":</td>
  86      <td style='width:80%' class='forumheader3'>";
  87  
  88      require_once(e_FILE."shortcode/batch/download_shortcodes.php");
  89      $dlparm = (isset($download_category)) ? $download_category : "";
  90      $text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}",true,$download_shortcodes);
  91  
  92  
  93  $text .= "
  94      </td>
  95      </tr>
  96  
  97      <tr>
  98      <td style='text-align:center' colspan='2' class='forumheader3'>";
  99  
 100  $text .= "<b>".LAN_406."</b><br />".LAN_419.":";
 101  
 102  if (is_readable(e_ADMIN.'filetypes.php')) {
 103      $a_filetypes = trim(file_get_contents(e_ADMIN.'filetypes.php'));
 104      $a_filetypes = explode(',', $a_filetypes);
 105      foreach ($a_filetypes as $ftype) {
 106          $sa_filetypes[] = '.'.trim(str_replace('.', '', $ftype));
 107      }
 108      $allowed_filetypes = implode(' | ', $sa_filetypes);
 109  }
 110  
 111  $text .= " ".$allowed_filetypes."<br />".LAN_407."<br />
 112      ".LAN_418.($pref['upload_maxfilesize'] ? $pref['upload_maxfilesize'] : ini_get('upload_max_filesize'))."<br />";
 113  
 114  $text .= "<span style='text-decoration:underline'>".LAN_408."</span> ".LAN_420."</td>
 115      </tr>";
 116  
 117  if (!USER) {
 118      $text .= "<tr>
 119          <td style='width:30%' class='forumheader3'>".LAN_61."</td>
 120          <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_poster' type='text' size='50' maxlength='100' /></td>
 121          </tr>
 122  
 123          <tr>
 124          <td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_112."</span></td>
 125          <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_email' type='text' size='50' maxlength='100' value='".USEREMAIL."' /></td>
 126          </tr>";
 127  }
 128  
 129  $text .= "
 130      <tr>
 131      <td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_409."</span></td>
 132      <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%'  name='file_name' type='text' size='50' maxlength='100' /></td>
 133      </tr>
 134  
 135      <tr>
 136      <td style='width:30%' class='forumheader3'>".LAN_410."</td>
 137      <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_version' type='text' size='10' maxlength='10' /></td>
 138      </tr>
 139  
 140  
 141      <tr>
 142      <td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_411."</span></td>
 143      <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%'  name='file_userfile[]' type='file' size='47' /></td>
 144      </tr>
 145  
 146      <tr>
 147      <td style='width:30%' class='forumheader3'>".LAN_412."</td>
 148      <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_userfile[]' type='file' size='47' /></td>
 149      </tr>
 150  
 151      <tr>
 152      <td style='width:30%' class='forumheader3'><span style='text-decoration:underline'>".LAN_413."</span></td>
 153      <td style='width:70%' class='forumheader3'><textarea class='tbox' style='width:90%' name='file_description' cols='59' rows='6'></textarea></td>
 154      </tr>
 155  
 156      <tr>
 157      <td style='width:30%' class='forumheader3'>".LAN_144."</td>
 158      <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_website' type='text' size='50' maxlength='100' value='".(defined(USERURL) ? USERURL : "")."' /></td>
 159      </tr>
 160  
 161      <tr>
 162      <td style='width:30%' class='forumheader3'>".LAN_414."<br /><span class='smalltext'>".LAN_415."</span></td>
 163      <td style='width:70%' class='forumheader3'><input class='tbox' style='width:90%' name='file_demo' type='text' size='50' maxlength='100' /></td>
 164      </tr>
 165  
 166      <tr>
 167      <td style='text-align:center' colspan='2' class='forumheader'><input class='button' type='submit' name='upload' value='".LAN_416."' /></td>
 168      </tr>
 169      </table>
 170      </form>
 171      </div>";
 172  
 173  $ns->tablerender(LAN_417, $text);
 174  
 175  require_once(FOOTERF);
 176  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7