Changeset 18973


Ignore:
Timestamp:
Nov 7, 2012, 10:05:44 PM (11 years ago)
Author:
mistic100
Message:

small code cleaning, use mkgetdir(), add missing language string

Location:
extensions/BatchDownloader
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/download.php

    r16948 r18973  
    2525  echo $e->getMessage();
    2626}
    27    
     27
    2828exit(0);
    2929
  • extensions/BatchDownloader/include/BatchDownloader.class.php

    r18291 r18973  
    322322      foreach ($images_to_add as $row)
    323323      {       
    324         $zip->addFile(PHPWG_ROOT_PATH . $row['path'], $row['id'].'_'.get_filename_wo_extension($row['file']).'.'.get_extension($row['path']));
     324        $zip->addFile(PHPWG_ROOT_PATH . $row['path'], $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file'])).'.'.get_extension($row['path']));
    325325       
    326326        array_push($images_added, $row['id']);
     
    437437      {
    438438          $out.= '<a href="'.add_url_params($url, array('set_id'=>$this->data['id'],'zip'=>$i)).'" rel="nofollow" style="font-weight:bold;"'
    439             .($i!=1 ? 'onClick="return confirm(\'Starting download Archive #'.$i.' will destroy Archive #'.($i-1).', be sure you finish the download. Continue ?\');"' : null).
     439            .($i!=1 ? ' onClick="return confirm(\''.addslashes(sprintf(l10n('Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'), $i, $i-1)).'\');"' : null).
    440440            '><img src="'.$root_url.BATCH_DOWNLOAD_PATH.'template/drive_go.png"> Archive #'.$i.' (ready)</a>';
    441441      }
     
    460460    if (!file_exists(BATCH_DOWNLOAD_LOCAL . 'u-' .$this->data['user_id']. '/'))
    461461    {
    462       mkdir(BATCH_DOWNLOAD_LOCAL . 'u-' .$this->data['user_id']. '/', 0755, true);
     462      mkgetdir(BATCH_DOWNLOAD_LOCAL . 'u-' .$this->data['user_id']. '/');
    463463    }
    464464   
  • extensions/BatchDownloader/include/install.inc.php

    r17660 r18973  
    2828
    2929  // archives directory
    30   if ( file_exists($conf['data_location']) and !file_exists($conf['data_location'] . 'download_archives/') )
     30  if ( file_exists($conf['data_location']) )
    3131  {
    32     mkdir($conf['data_location'] . 'download_archives/', 0755);
     32    mkgetdir($conf['data_location'] . 'download_archives/', MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
    3333  }
    3434
  • extensions/BatchDownloader/language/en_UK/plugin.lang.php

    r18373 r18973  
    4545$lang['Remove all finished downloads'] = 'Remove all finished downloads';
    4646$lang['hours'] = 'hours';
     47$lang['Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'] = 'Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?';
    4748
    4849?>
  • extensions/BatchDownloader/language/fr_FR/plugin.lang.php

    r18373 r18973  
    4545$lang['Remove all finished downloads'] = 'Supprimer tous les téléchargements terminés';
    4646$lang['hours'] = 'heures';
     47$lang['Starting download Archive #%d will destroy Archive #%d, be sure you finish the download. Continue ?'] = 'Le démarrage du téléchargement de l\'archive #%d détruira l\'archive #%d, soyez sûr de terminer le téléchargement avant de continuer.';
    4748
    4849?>
  • extensions/BatchDownloader/main.inc.php

    r18291 r18973  
    1313global $conf, $prefixeTable;
    1414
    15 define('BATCH_DOWNLOAD_PATH',    PHPWG_PLUGINS_PATH . 'BatchDownloader/');
     15defined('BATCH_DOWNLOAD_ID') or define('BATCH_DOWNLOAD_ID', basename(dirname(__FILE__)));
     16define('BATCH_DOWNLOAD_PATH',    PHPWG_PLUGINS_PATH . BATCH_DOWNLOAD_ID . '/');
    1617define('BATCH_DOWNLOAD_TSETS',   $prefixeTable . 'download_sets');
    1718define('BATCH_DOWNLOAD_TIMAGES', $prefixeTable . 'download_sets_images');
    1819define('BATCH_DOWNLOAD_LOCAL',   PHPWG_ROOT_PATH . $conf['data_location'] . 'download_archives/');
    19 define('BATCH_DOWNLOAD_ADMIN',   get_root_url() . 'admin.php?page=plugin-BatchDownloader');
     20define('BATCH_DOWNLOAD_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . BATCH_DOWNLOAD_ID);
    2021define('BATCH_DOWNLOAD_PUBLIC',  get_absolute_root_url() . make_index_url(array('section' => 'download')) . '/');
    2122define('BATCH_DOWNLOAD_VERSION', 'auto');
     
    2425add_event_handler('init', 'batch_download_init');
    2526
    26 add_event_handler('loc_end_section_init', 'batch_download_section_init');
    27 add_event_handler('loc_end_index', 'batch_download_page');
     27if (defined('IN_ADMIN'))
     28{
     29  add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu');
     30}
     31else
     32{
     33  add_event_handler('loc_end_section_init', 'batch_download_section_init');
     34  add_event_handler('loc_end_index', 'batch_download_page');
    2835
    29 add_event_handler('loc_end_index', 'batch_download_clean');
     36  add_event_handler('loc_end_index', 'batch_download_clean');
    3037
    31 add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
     38  add_event_handler('loc_end_index', 'batch_download_index_button', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
    3239
    33 add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock');
    34 add_event_handler('blockmanager_apply', 'batch_download_applymenu');
     40  add_event_handler('blockmanager_register_blocks', 'batch_download_add_menublock');
     41  add_event_handler('blockmanager_apply', 'batch_download_applymenu');
     42}
     43
    3544
    3645include_once(BATCH_DOWNLOAD_PATH . 'include/BatchDownloader.class.php');
    3746include_once(BATCH_DOWNLOAD_PATH . 'include/functions.inc.php');
    3847include_once(BATCH_DOWNLOAD_PATH . 'include/events.inc.php');
    39 
    40 if (defined('IN_ADMIN'))
    41 {
    42   add_event_handler('get_admin_plugin_menu_links', 'batch_download_admin_menu');
    43 }
    4448
    4549
     
    5357 
    5458  if (
    55     $pwg_loaded_plugins['BatchDownloader']['version'] == 'auto' or
    56     version_compare($pwg_loaded_plugins['BatchDownloader']['version'], BATCH_DOWNLOAD_VERSION, '<')
     59    BATCH_DOWNLOAD_VERSION == 'auto' or
     60    $pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'] == 'auto' or
     61    version_compare($pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'], BATCH_DOWNLOAD_VERSION, '<')
    5762  )
    5863  {
     
    6065    batch_download_install();
    6166   
    62     if ($pwg_loaded_plugins['BatchDownloader']['version'] != 'auto')
     67    if ( $pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'] != 'auto' and BATCH_DOWNLOAD_VERSION != 'auto' )
    6368    {
    6469      $query = '
    6570UPDATE '. PLUGINS_TABLE .'
    6671SET version = "'. BATCH_DOWNLOAD_VERSION .'"
    67 WHERE id = "BatchDownloader"';
     72WHERE id = "'. BATCH_DOWNLOAD_ID .'"';
    6873      pwg_query($query);
    6974     
    70       $pwg_loaded_plugins['BatchDownloader']['version'] = BATCH_DOWNLOAD_VERSION;
     75      $pwg_loaded_plugins[BATCH_DOWNLOAD_ID]['version'] = BATCH_DOWNLOAD_VERSION;
    7176     
    7277      if (defined('IN_ADMIN'))
  • extensions/BatchDownloader/maintain.inc.php

    r17656 r18973  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
    4 include_once(PHPWG_PLUGINS_PATH . 'BatchDownloader/include/install.inc.php');
     4defined('BATCH_DOWNLOAD_ID') or define('BATCH_DOWNLOAD_ID', basename(dirname(__FILE__)));
     5include_once(PHPWG_PLUGINS_PATH . BATCH_DOWNLOAD_ID . '/include/install.inc.php');
    56
    67function plugin_install()
Note: See TracChangeset for help on using the changeset viewer.