plugins/gallery/upload.php
changeset 2 88c954d2846c
parent 0 7caf561c50ee
child 3 10d663f5ed88
equal deleted inserted replaced
1:94af07c8f2f3 2:88c954d2846c
    39   
    39   
    40   $errors = array();
    40   $errors = array();
    41   $template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/gallery/dropdown.css" />');
    41   $template->add_header('<link rel="stylesheet" type="text/css" href="' . scriptPath . '/plugins/gallery/dropdown.css" />');
    42   $template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/gallery/gallery-bits.js"></script>');
    42   $template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/gallery/gallery-bits.js"></script>');
    43   
    43   
       
    44   $max_size = @ini_get('upload_max_filesize');
       
    45   $max_size_field = '';
       
    46   if ( $max_size )
       
    47   {
       
    48     if ( preg_match('/M$/i', $max_size) )
       
    49     {
       
    50       $max_size = intval($max_size) * 1048576;
       
    51     }
       
    52     else if ( preg_match('/K$/i', $max_size) )
       
    53     {
       
    54       $max_size = intval($max_size) * 1024;
       
    55     }
       
    56     else if ( preg_match('/G$/i', $max_size) )
       
    57     {
       
    58       $max_size = intval($max_size) * 1048576 * 1024;
       
    59     }
       
    60     $max_size = intval($max_size);
       
    61     $max_size_field = "\n" . '<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_size . '" />' . "\n";
       
    62   }
       
    63   
    44   if ( isset($_GET['edit_img']) )
    64   if ( isset($_GET['edit_img']) )
    45   {
    65   {
    46     $edit_parms = $_GET['edit_img'];
    66     $edit_parms = $_GET['edit_img'];
    47     $regex = '/^((([0-9]+),)*)?([0-9]+?)$/';
    67     $regex = '/^((([0-9]+),)*)?([0-9]+?)$/';
    48     if ( !preg_match($regex, $edit_parms) )
    68     if ( !preg_match($regex, $edit_parms) )
   281     
   301     
   282     </script>
   302     </script>
   283     <?php
   303     <?php
   284     
   304     
   285     echo '<form action="' . makeUrlNS('Special', 'GalleryUpload', 'edit_img=' . $edit_parms, true) . '" method="post" enctype="multipart/form-data">';
   305     echo '<form action="' . makeUrlNS('Special', 'GalleryUpload', 'edit_img=' . $edit_parms, true) . '" method="post" enctype="multipart/form-data">';
       
   306     
       
   307     echo $max_size_field;
   286     
   308     
   287     if ( $row = $db->fetchrow($e) )
   309     if ( $row = $db->fetchrow($e) )
   288     {
   310     {
   289       
   311       
   290       echo '<div class="tblholder">
   312       echo '<div class="tblholder">
   484             <div class="body">
   506             <div class="body">
   485               <?php
   507               <?php
   486                 echo gallery_hier_formfield('override_folder', false);
   508                 echo gallery_hier_formfield('override_folder', false);
   487               ?>
   509               ?>
   488               <br />
   510               <br />
   489               <a href="#" onclick="gal_unset_radios('override_folder'); return false;">Unselect folder override field</a>
   511               <a href="#" onclick="gal_unset_radios('override_folder'); return false;">Unselect field</a>
   490             </div>
   512             </div>
   491           </div>
   513           </div>
   492         </td>
   514         </td>
   493       </tr>
   515       </tr>
   494       <?php
   516       <?php
   592     {
   614     {
   593       // Removal form
   615       // Removal form
   594       $template->header();
   616       $template->header();
   595       
   617       
   596       echo '<form action="' . makeUrlNS('Special', 'GalleryUpload', 'rm=' . $rm_id, true) . '" method="post" enctype="multipart/form-data">';
   618       echo '<form action="' . makeUrlNS('Special', 'GalleryUpload', 'rm=' . $rm_id, true) . '" method="post" enctype="multipart/form-data">';
       
   619       echo $max_size_field;
   597       
   620       
   598       echo '<h3>Are you sure you want to delete this item?</h3>';
   621       echo '<h3>Are you sure you want to delete this item?</h3>';
   599       echo '<p>If you continue, this item will be permanently deleted from the gallery &ndash; no rollbacks.</p>';
   622       echo '<p>If you continue, this item will be permanently deleted from the gallery &ndash; no rollbacks.</p>';
   600       echo '<p>If this is an image, the image files will be removed from the filesystem, and all comments associated with the image will be deleted, as well as the image\'s title, description, and location.</p>';
   623       echo '<p>If this is an image, the image files will be removed from the filesystem, and all comments associated with the image will be deleted, as well as the image\'s title, description, and location.</p>';
   601       echo '<p>If this is a folder, all of its contents will be removed. Any images will be removed from the filesystem and all comments and metadata associated with images in this folder or any folders in it will be permanently deleted.</p>';
   624       echo '<p>If this is a folder, all of its contents will be removed. Any images will be removed from the filesystem and all comments and metadata associated with images in this folder or any folders in it will be permanently deleted.</p>';
   952     }
   975     }
   953   </script>
   976   </script>
   954   <?php
   977   <?php
   955   
   978   
   956   echo '<form action="' . makeUrlNS('Special', 'GalleryUpload') . '" enctype="multipart/form-data" method="post">';
   979   echo '<form action="' . makeUrlNS('Special', 'GalleryUpload') . '" enctype="multipart/form-data" method="post">';
       
   980   echo $max_size_field;
   957   if ( count($errors) > 0 )
   981   if ( count($errors) > 0 )
   958   {
   982   {
   959     echo '<div class="error-box">
   983     echo '<div class="error-box">
   960             <b>The following errors were encountered during the upload:</b><br />
   984             <b>The following errors were encountered during the upload:</b><br />
   961             <ul>
   985             <ul>