Ignore:
Timestamp:
Dec 12, 2013, 2:41:53 PM (10 years ago)
Author:
mistic100
Message:

update for Piwigo 2.6 + code cleaning + fix unable to cancel set during generation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/admin/sets.php

    r23383 r25932  
    11<?php
    2 if (!defined('BATCH_DOWNLOAD_PATH')) die('Hacking attempt!');
     2defined('BATCH_DOWNLOAD_PATH') or die('Hacking attempt!');
    33
    44// actions
     
    1111if (isset($_GET['cancel']))
    1212{
    13   $set = new BatchDownloader($_GET['cancel']); 
     13  $set = new BatchDownloader($_GET['cancel']);
    1414  $set->updateParam('total_size', $set->getEstimatedTotalSize());
    1515  $set->updateParam('nb_zip', $set->getEstimatedArchiveNumber());
     
    2828    date_creation < DATE_SUB(NOW(), INTERVAL 1 HOUR)
    2929;';
    30  
     30
    3131  $sets = array_from_query($query, 'id');
    32  
     32
    3333  foreach ($sets as $set_id)
    3434  {
     
    4848  if (!empty($_POST['username']))
    4949  {
    50     array_push($where_clauses, 'username LIKE "%'.$_POST['username'].'%"');
     50    $where_clauses[] = 'username LIKE "%'.$_POST['username'].'%"';
    5151  }
    52  
     52
    5353  if ($_POST['type'] != -1)
    5454  {
    55     array_push($where_clauses, 'type = "'.$_POST['type'].'"');
     55    $where_clauses[] = 'type = "'.$_POST['type'].'"';
    5656  }
    57  
     57
    5858  if ($_POST['status'] != -1)
    5959  {
    6060    if ($_POST['status'] == 'new')
    61       array_push($where_clauses, '(status = "new" OR status = "ready")');
     61      $where_clauses[] = '(status = "new" OR status = "ready")';
    6262    else
    63       array_push($where_clauses, 'status = "'.$_POST['status'].'"');
     63      $where_clauses[] = 'status = "'.$_POST['status'].'"';
    6464  }
    65  
     65
    6666  if ($_POST['size'] != -1)
    6767  {
    68     array_push($where_clauses, 'size = "'.$_POST['size'].'"');
     68    $where_clauses[] = 'size = "'.$_POST['size'].'"';
    6969  }
    70  
     70
    7171  if ($_POST['order_by'] == 'size')
    7272  {
     
    8282// get sets
    8383$query = '
    84 SELECT 
     84SELECT
    8585    s.id,
    8686    u.'.$conf['user_fields']['username'].' AS username
     
    9797{
    9898  $set = new BatchDownloader($set_id);
    99  
     99
    100100  $template->append('sets', array_merge(
    101101    $set->getSetInfo(),
     
    106106    )
    107107    ));
    108  
     108
    109109  unset($set);
    110110}
     
    173173
    174174
    175 $template->set_filename('batch_download', dirname(__FILE__) . '/template/sets.tpl');
    176 
    177 ?>
     175$template->set_filename('batch_download', realpath(BATCH_DOWNLOAD_PATH . 'admin/template/sets.tpl'));
Note: See TracChangeset for help on using the changeset viewer.