plugins/gallery/upload.php
changeset 40 2607b83e986d
parent 32 9803dde5df5f
child 42 7c6e2e97aa08
equal deleted inserted replaced
39:e9a7e37bdadd 40:2607b83e986d
    14 
    14 
    15 ##
    15 ##
    16 ## UPLOAD INTERFACE
    16 ## UPLOAD INTERFACE
    17 ##
    17 ##
    18 
    18 
    19 $plugins->attachHook('base_classes_initted', '
    19 $plugins->attachHook('session_started', 'register_special_page("GalleryUpload", "Image gallery upload");');
    20   global $paths;
       
    21     $paths->add_page(Array(
       
    22       \'name\'=>\'Image gallery upload\',
       
    23       \'urlname\'=>\'GalleryUpload\',
       
    24       \'namespace\'=>\'Special\',
       
    25       \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
       
    26       ));
       
    27   ');
       
    28 
    20 
    29 function page_Special_GalleryUpload()
    21 function page_Special_GalleryUpload()
    30 {
    22 {
    31   global $db, $session, $paths, $template, $plugins; // Common objects
    23   global $db, $session, $paths, $template, $plugins; // Common objects
    32   
    24   
   804             {
   796             {
   805               $errors[] = 'Could not move file ' . $file . ' to permanent storage location ' . $store . '.';
   797               $errors[] = 'Could not move file ' . $file . ' to permanent storage location ' . $store . '.';
   806               break 3;
   798               break 3;
   807             }
   799             }
   808             
   800             
   809             $autotitle = capitalize_first_letter(basename($file));
   801             $autotitle = ucwords(basename($file));
   810             $autotitle = substr($autotitle, 0, ( strrpos($autotitle, '.') ));
   802             $autotitle = substr($autotitle, 0, ( strrpos($autotitle, '.') ));
   811             $autotitle = str_replace('_', ' ', $autotitle);
   803             $autotitle = str_replace('_', ' ', $autotitle);
   812             
   804             
   813             $title->assign_vars(array('id' => ( $j + 1 ), 'autotitle' => $autotitle));
   805             $title->assign_vars(array('id' => ( $j + 1 ), 'autotitle' => $autotitle));
   814             $desc->assign_vars(array('id' => ( $j + 1 ), 'autotitle' => $autotitle));
   806             $desc->assign_vars(array('id' => ( $j + 1 ), 'autotitle' => $autotitle));
   892         {
   884         {
   893           $errors[] = "[Internal] Couldn't move temporary file {$file['tmp_name']} to permanently stored file $store";
   885           $errors[] = "[Internal] Couldn't move temporary file {$file['tmp_name']} to permanently stored file $store";
   894           break 2;
   886           break 2;
   895         }
   887         }
   896         
   888         
   897         $autotitle = capitalize_first_letter(basename($file['name']));
   889         $autotitle = ucwords(basename($file['name']));
   898         $autotitle = substr($autotitle, 0, ( strrpos($autotitle, '.') ));
   890         $autotitle = substr($autotitle, 0, ( strrpos($autotitle, '.') ));
   899         $autotitle = str_replace('_', ' ', $autotitle);
   891         $autotitle = str_replace('_', ' ', $autotitle);
   900         
   892         
   901         $title->assign_vars(array('id' => ( $i + 1 ), 'autotitle' => $autotitle));
   893         $title->assign_vars(array('id' => ( $i + 1 ), 'autotitle' => $autotitle));
   902         $desc->assign_vars (array('id' => ( $i + 1 ), 'autotitle' => $autotitle));
   894         $desc->assign_vars (array('id' => ( $i + 1 ), 'autotitle' => $autotitle));