Changeset 16104


Ignore:
Timestamp:
Jun 27, 2012, 9:19:07 PM (8 years ago)
Author:
mistic100
Message:

updated for Piwigo 2.4
new filters : name, author, level, hits

Location:
extensions/SmartAlbums
Files:
10 added
2 deleted
22 edited
5 moved

Legend:

Unmodified
Added
Removed
  • extensions/SmartAlbums/admin.php

    r11392 r16104  
    44global $conf, $template, $page;
    55
    6 load_language('plugin.lang', SMART_PATH);
    7 if (!is_array($conf['SmartAlbums'])) $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
     6$page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'cat_list';
    87
    9 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    10 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'albums';
    11  
    12 $tabsheet = new tabsheet();
    13 $tabsheet->add('albums', l10n('All SmartAlbums'), SMART_ADMIN.'-albums');
    14 $tabsheet->add('config', l10n('Configuration'),   SMART_ADMIN.'-config');
    15 $tabsheet->select($page['tab']);
    16 $tabsheet->assign();
     8if ($page['tab'] == 'album')
     9{
     10  include(SMART_PATH . 'admin/album.php');
     11}
     12else
     13{
     14  include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     15  $tabsheet = new tabsheet();
     16  $tabsheet->add('cat_list', l10n('All SmartAlbums'), SMART_ADMIN.'-cat_list');
     17  $tabsheet->add('config', l10n('Configuration'), SMART_ADMIN.'-config');
     18  $tabsheet->select($page['tab']);
     19  $tabsheet->assign();
    1720
    18 $template->assign(array(
    19   'SMART_PATH' => SMART_PATH,
    20 ));
     21  $template->assign(array(
     22    'SMART_PATH' => SMART_PATH,
     23  ));
    2124
    22 include(SMART_PATH.'admin/'.$page['tab'].'.inc.php');
    23 $template->set_filename('SmartAlbums_content', dirname(__FILE__).'/admin/template/'.$page['tab'].'.tpl');
     25  include(SMART_PATH . 'admin/'.$page['tab'].'.php');
     26}
     27
     28$template->assign('SMART_PATH', SMART_PATH);
     29
    2430$template->assign_var_from_handle('ADMIN_CONTENT', 'SmartAlbums_content');
    2531
  • extensions/SmartAlbums/admin/cat_list.php

    r12863 r16104  
    1111// |                            initialization                             |
    1212// +-----------------------------------------------------------------------+
    13 $base_url = get_root_url().'admin.php?page=';
    14 $self_url = SMART_ADMIN.'-albums';
     13$base_url = get_root_url() . 'admin.php?page=';
     14$self_url = SMART_ADMIN . '-cat_list';
    1515
    1616$categories = array();
    1717$query = '
    18 SELECT id, name, permalink, dir, rank, status
     18SELECT
     19    id,
     20    name,
     21    permalink,
     22    dir,
     23    rank,
     24    status
    1925  FROM '.CATEGORIES_TABLE.' AS cat
    2026  INNER JOIN '.CATEGORY_FILTERS_TABLE.' AS cf
     
    5056  {
    5157    $_SESSION['page_infos'] = array(l10n('SmartAlbum added'));
    52     $redirect_url = $base_url.'cat_modify&cat_id='.$output_create['id'].'&new_smart';
     58    $redirect_url = SMART_ADMIN . '-album&cat_id='.$output_create['id'].'&new_smart';
    5359    redirect($redirect_url);
    5460  }
     
    5763else if (isset($_GET['smart_generate']))
    5864{
    59   /* regenerate photo list | all (sub) categories */
     65  /* regenerate photo list | all categories */
    6066  if ($_GET['smart_generate'] == 'all')
    6167  {
     
    6369    {
    6470      $associated_images = smart_make_associations($category['id']);
    65       array_push(
    66         $page['infos'],
    67         sprintf(
    68           l10n('%d photos associated to album %s'),
     71      array_push($page['infos'],
     72        sprintf(l10n('%d photos associated to album %s'),
    6973          count($associated_images),
    70           '«'.trigger_event(
    71             'render_category_name',
    72             $category['name'],
    73             'admin_cat_list'
    74             ).'»'
     74          '«'.trigger_event('render_category_name', $category['name'], 'admin_cat_list').'»'
    7575          )
    7676        );
     
    8181  {
    8282    $associated_images = smart_make_associations($_GET['smart_generate']);   
    83     array_push(
    84       $page['infos'],
    85       sprintf(
    86         l10n('%d photos associated to album %s'),
     83    array_push($page['infos'],
     84      sprintf(l10n('%d photos associated to album %s'),
    8785        count($associated_images),
    88         '«'.trigger_event(
    89           'render_category_name',
    90           $categories[$_GET['smart_generate']]['name'],
    91           'admin_cat_list'
    92           ).'»'
     86        '«'.trigger_event('render_category_name', $categories[ $_GET['smart_generate'] ]['name'], 'admin_cat_list').'»'
    9387        )
    9488      );
     
    122116{
    123117  array_push($page['warnings'], l10n('Only SmartAlbums are displayed on this page'));
    124   array_push($page['warnings'], l10n('To order albums please go the main albums management page'));
     118  array_push($page['warnings'], sprintf(l10n('To order albums please go the main albums <a href="%s">management page</a>'), $base_url.'cat_list'));
    125119  array_push($page['warnings'], '<a href="'.$self_url.'&hide_messages">['.l10n('Don\'t show this message again').']</a>');
    126120}
     
    147141  $tpl_cat =
    148142    array(
    149       'NAME'       => get_cat_display_name_from_id($category['id'], $base_url.'cat_modify&amp;cat_id='),
     143      'NAME'       => get_cat_display_name_from_id($category['id'], $base_url.'album-'),
    150144      'ID'         => $category['id'],
    151145      'RANK'       => $category['rank']*10,
     
    157151        ),
    158152
    159       'U_EDIT'     => $base_url.'cat_modify&amp;cat_id='.$category['id'],
     153      'U_EDIT'     => $base_url.'album-'.$category['id'],
    160154      'U_DELETE'   => $self_url.'&amp;delete='.$category['id'].'&amp;pwg_token='.get_pwg_token(),
    161155      'U_SMART'    => $self_url.'&amp;smart_generate='.$category['id'],
     
    167161      $base_url.'batch_manager&amp;cat='.$category['id'];
    168162  }
    169 
    170   if ('private' == $category['status'])
    171   {
    172     $tpl_cat['U_MANAGE_PERMISSIONS'] =
    173       $base_url.'cat_perm&amp;cat='.$category['id'];
    174   }
    175163 
    176164  $template->append('categories', $tpl_cat);
    177165}
    178166
     167$template->set_filename('SmartAlbums_content', dirname(__FILE__).'/template/cat_list.tpl');
     168
    179169?>
  • extensions/SmartAlbums/admin/config.php

    r12863 r16104  
    1515));
    1616
     17$template->set_filename('SmartAlbums_content', dirname(__FILE__).'/template/config.tpl');
     18
    1719?>
  • extensions/SmartAlbums/admin/index.php

    r11392 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/admin/template/cat_list.tpl

    r12863 r16104  
     1{footer_script require='jquery.ui.sortable'}{literal}
     2jQuery(document).ready(function(){
     3  jQuery("#addAlbumOpen").click(function(){
     4    jQuery("#createAlbum").toggle();
     5    jQuery("input[name=virtual_name]").focus();
     6    jQuery("#autoOrder").hide();
     7  });
     8
     9  jQuery("#addAlbumClose").click(function(){
     10    jQuery("#createAlbum").hide();
     11  });
     12});
     13{/literal}{/footer_script}
     14
     15{* è *}
     16
    117<div class="titrePage">
    218        <h2>SmartAlbums</h2>
    319</div>
    420
    5 <h3>
    6   <a href="{$F_ACTION}">{'All SmartAlbums'|@translate}</a>
    7   {if count($categories)>9 }
    8   <a href="#EoP" class="button" style="border:0;">
    9   <img src="{$themeconf.admin_icon_dir}/page_end.png" title="{'Page end'|@translate}" class="button" alt="page_end" style="margin-bottom:-0.6em;"></a>
    10   {/if}
    11 </h3>
     21<form id="categoryOrdering" action="{$F_ACTION}" method="post">
     22<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
    1223
    13 <form id="addVirtual" action="{$F_ACTION}" method="post">
    14   <fieldset>
    15     <legend>{'Add a SmartAlbum'|@translate}</legend>
    16  
    17     <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
    18     {'Album name'|@translate} : <input type="text" name="virtual_name">
    19     {'Parent album'|@translate} :
     24<p class="showCreateAlbum">
     25  <span id="notManualOrder">
     26    <a href="#" id="addAlbumOpen">{'create a new SmartAlbum'|@translate}</a>
     27    | <a href="{$F_ACTION}&amp;smart_generate=all">{'Regenerate photos list of all SmartAlbums'|@translate}</a>
     28  </span>
     29</p>
     30
     31<fieldset id="createAlbum" style="display:none;">
     32  <legend>{'create a new SmartAlbum'|@translate}</legend>
     33  <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
     34
     35  <p>
     36    <strong>{'Album name'|@translate}</strong> :
     37    <input type="text" name="virtual_name">
     38  </p>
     39  <p>
     40    <strong>{'Parent album'|@translate}</strong>  :
    2041    <select class="categoryDropDown" name="parent_id">
    2142      <option value="0">------------</option>
    2243      {html_options options=$category_options}
    2344    </select>
    24     <input class="submit" type="submit" value="{'Submit'|@translate}" name="submitAdd">
    25  
    26   </fieldset>
    27 </form>
     45  </p>
     46  <p class="actionButtons">
     47    <input class="submit" type="submit" value="{'Create'|@translate}" name="submitAdd">
     48    <a href="#" id="addAlbumClose">{'Cancel'|@translate}</a>
     49  </p>
     50</fieldset>
    2851
    2952{if count($categories) }
    30 <form id="categoryOrdering" action="{$F_ACTION}" method="post">
    31   <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
    3253
    3354  <ul class="categoryUl">
     
    3657    <li class="categoryLi virtual_cat" id="cat_{$category.ID}">
    3758      <!-- category {$category.ID} -->
    38       <ul class="categoryActions">
    39         {if cat_admin_access($category.ID)}
    40         <li><a href="{$category.U_JUMPTO}" title="{'jump to album'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_jump-to.png" class="button" alt="{'jump to album'|@translate}"></a></li>
    41         {/if}
    42         <li><a href="{$category.U_EDIT}" title="{'edit album'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_edit.png" class="button" alt="{'edit'|@translate}"></a></li>
    43         {if isset($category.U_MANAGE_ELEMENTS) }
    44         <li><a href="{$category.U_MANAGE_ELEMENTS}" title="{'manage album photos'|@translate}"><img src="{$themeconf.admin_icon_dir}/category_elements.png" class="button" alt="{'Photos'|@translate}"></a></li>
    45         {/if}
    46         {if isset($category.U_MANAGE_PERMISSIONS) }
    47         <li><a href="{$category.U_MANAGE_PERMISSIONS}" title="{'edit album permissions'|@translate}" ><img src="{$themeconf.admin_icon_dir}/category_permissions.png" class="button" alt="{'Permissions'|@translate}"></a></li>
    48         {/if}
    49         <li><a href="{$category.U_SMART}" title="{'Regenerate photos list of this SmartAlbum'|@translate}"><img src="{$themeconf.admin_icon_dir}/synchronize.png" class="button" alt="{'Regenerate photos list of this SmartAlbum'|@translate}"></a></li>
    50         {if isset($category.U_DELETE) }
    51         <li><a href="{$category.U_DELETE}" title="{'delete album'|@translate}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');"><img src="{$themeconf.admin_icon_dir}/category_delete.png" class="button" alt="{'delete album'|@translate}"></a></li>
    52         {/if}
    53       </ul>
    54 
    55       <p>
    56         <strong>{$category.NAME}</strong>
     59      <p class="albumTitle">
     60        <strong><a href="{$category.U_CHILDREN}" title="{'manage sub-albums'|@translate}">{$category.NAME}</a></strong>
     61        <img src="{$SMART_PATH}admin/template/lightning.png">
    5762      </p>
    5863
     64      <p class="albumActions">
     65        <a href="{$category.U_EDIT}">{'Edit'|@translate}</a>
     66        | <a href="{$category.U_SMART}">{'Regenerate photos list of this SmartAlbum'|@translate}</a>
     67        {if isset($category.U_MANAGE_ELEMENTS) }
     68        | <a href="{$category.U_MANAGE_ELEMENTS}">{'manage album photos'|@translate}</a>
     69        {/if}
     70        {if isset($category.U_DELETE) }
     71        | <a href="{$category.U_DELETE}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');">{'delete album'|@translate}</a>
     72        {/if}
     73        {if cat_admin_access($category.ID)}
     74        | <a href="{$category.U_JUMPTO}">{'jump to album'|@translate} ?</a>
     75        {/if}
     76      </p>
    5977    </li>
    6078    {/foreach}
    6179  </ul>
     80{/if}
    6281</form>
    63 {/if}
    64 
    65 <form method="post" action="{$F_ACTION}&amp;smart_generate=all">
    66   <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
    67   <p><input class="submit" type="submit" value="{'Regenerate photos list of all SmartAlbums'|@translate}"></p>
    68 </form>
    69 
    70 <a name="EoP"></a>
  • extensions/SmartAlbums/admin/template/config.tpl

    r11451 r16104  
    1111          <span class="property">{'Update albums on file upload'|@translate}</span>
    1212          <input type="checkbox" name="update_on_upload" value="true" {if $update_on_upload}checked="checked"{/if}/>
    13           {'(can cause slowdowns on admin pages)'|@translate}
     13          {'(can cause slowdowns)'|@translate}
    1414        </label>
    1515                        </li>
  • extensions/SmartAlbums/admin/template/index.php

    r11392 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/include/cat_list.php

    r12863 r16104  
    4242      {
    4343        $associated_images = smart_make_associations($category['id']);
    44         array_push(
    45           $page['infos'],
    46           sprintf(
    47             l10n('%d photos associated to album %s'),
     44        array_push($page['infos'],
     45          sprintf(l10n('%d photos associated to album %s'),
    4846            count($associated_images),
    49             '&laquo;'.trigger_event(
    50               'render_category_name',
    51               $category['name'],
    52               'admin_cat_list'
    53               ).'&raquo;'
     47            '&laquo;'.trigger_event('render_category_name', $category['name'], 'admin_cat_list').'&raquo;'
    5448            )
    5549          );
     
    6054    {
    6155      $associated_images = smart_make_associations($_GET['smart_generate']);   
    62       array_push(
    63         $page['infos'],
    64         sprintf(
    65           l10n('%d photos associated to album %s'),
     56      array_push($page['infos'],
     57        sprintf(l10n('%d photos associated to album %s'),
    6658          count($associated_images),
    67           '&laquo;'.trigger_event(
    68             'render_category_name',
    69             $smart_cats[$_GET['smart_generate']]['name'],
    70             'admin_cat_list'
    71             ).'&raquo;'
     59          '&laquo;'.trigger_event('render_category_name', $smart_cats[ $_GET['smart_generate'] ]['name'], 'admin_cat_list').'&raquo;'
    7260          )
    7361        );
     
    9987  global $smart_count;
    10088 
    101   $search[0] = '{if isset($category.U_SYNC) }';
    102   $replacement[0] = '
     89  $search[0] = '{if isset($category.U_MANAGE_ELEMENTS) }';
     90  $replacement[0] = $search[0].'
    10391{if isset($SMART_URL[$category.ID])}
    104         <li><a href="{$SMART_URL[$category.ID]}" title="{\'Regenerate photos list of this SmartAlbum\'|@translate}"><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/synchronize.png" class="button" alt="{\'Regenerate photos list of this SmartAlbum\'|@translate}"></a></li>
    105 {/if}'
    106 .$search[0];
     92| <a href="{$SMART_URL[$category.ID]}">{\'Regenerate photos list of this SmartAlbum\'|@translate}</a>
     93{/if}';
    10794
    10895  if ($smart_count > 0)
    10996  {
    110     $search[1] = '</ul>
    111 </form>';
     97    $search[1] = '<a href="#" id="autoOrderOpen">{\'apply automatic sort order\'|@translate}</a>';
    11298    $replacement[1] = $search[1].'
    113 <form method="post" action="{$SMART_URL.all}">
    114   <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
    115   <p><input class="submit" type="submit" value="{\'Regenerate photos list of all SmartAlbums\'|@translate}"></p>
    116 </form>';
     99| <a href="{$SMART_URL.all}">{\'Regenerate photos list of all SmartAlbums\'|@translate}</a>';
    117100  }
     101 
     102  $search[2] = '{$category.NAME}</a></strong>';
     103  $replacement[2] = $search[2].'
     104{if isset($SMART_URL[$category.ID])}
     105<img src="'.SMART_PATH.'admin/template/lightning.png">
     106{/if}';
    118107
    119108  return str_replace($search, $replacement, $content);
  • extensions/SmartAlbums/include/count_images.php

    r11334 r16104  
    66define('PHPWG_ROOT_PATH','./../../../');
    77define('IN_ADMIN', true);
     8
    89include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     10
     11if (!is_admin()) die('Hacking attempt!');
     12
    913include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    1014include_once(SMART_PATH.'include/functions.inc.php');
     15
     16load_language('plugin.lang', SMART_PATH);
     17$conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
    1118
    1219if (isset($_POST['filters']))
     
    2229      array_push($filters, $filter);
    2330    }
     31    else
     32    {
     33      echo '<span class="filter_error">'.$page['errors'][ count($page['errors'])-1 ].'</span>';
     34      exit;
     35    }
    2436  }
    2537
     
    3143}
    3244
    33 echo l10n_dec('%d photo', '%d photos', count($associated_images));
     45echo '<span class="count_image">'.l10n_dec('%d photo', '%d photos', count($associated_images)).'</span>';
    3446
    3547?>
  • extensions/SmartAlbums/include/functions.inc.php

    r12864 r16104  
    3636  }
    3737 
    38   // represantant, try to not overwrite if still in images list
     38  // representant, try to not overwrite if still in images list
    3939  $query = '
    4040SELECT representative_picture_id
     
    4646  if ( !in_array($rep_id, $images) )
    4747  {
    48     if (!function_exists('set_random_representant'))
    49     {
    50       include(PHPWG_ROOT_PATH.'admin/include/functions.php');
    51     }
     48    include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    5249    set_random_representant(array($cat_id));
    5350  }
     
    6461{
    6562  global $conf;
    66    
    67   if (!is_array($conf['SmartAlbums'])) $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
    6863 
    6964  if ( defined('SMART_NOT_UPDATE') OR !$conf['SmartAlbums']['update_on_upload'] ) return;
     
    9489
    9590  /* get filters */
    96   if ($filters == null)
    97   {
    98     $filters = array();
    99    
     91  if ($filters === null)
     92  {
    10093    $query = '
    10194SELECT *
     
    10699    $result = pwg_query($query);
    107100   
    108     if (!pwg_db_num_rows($result)) return $filters;
     101    if (!pwg_db_num_rows($result)) return array();
    109102   
     103    $filters = array();
    110104    while ($row = pwg_db_fetch_assoc($result))
    111105    {
     
    117111    }
    118112  }
     113  else if (!count($filters))
     114  {
     115    return array();
     116  }
    119117   
    120118  /* build constrains */
    121119  ## generate 'join', 'where' arrays and 'limit' string to create the SQL query
    122   ## inspired by PicsEngine by Michael Villar
     120  ## inspired by PicsEngine 3 by Michael Villar
    123121  $i_tags = 1;
    124122  foreach ($filters as $filter)
    125123  {
    126     // tags
    127     if ($filter['type'] == 'tags')
    128     {
    129       if($filter['cond'] == "all")
    130       {
    131         $tags_arr = explode(',', $filter['value']);
     124    switch ($filter['type'])
     125    {
     126      // tags
     127      case 'tags':
     128      {
     129        switch ($filter['cond'])
     130        {
     131          // search images which have all tags
     132          case 'all':
     133          {
     134            $tags_arr = explode(',', $filter['value']);
     135            foreach($tags_arr as $value)
     136            {
     137              $join[] = IMAGE_TAG_TABLE.' AS it'.$i_tags.' ON i.id = it'.$i_tags.'.image_id';
     138              $where[] = 'it'.$i_tags.'.tag_id = '.$value;
     139              $i_tags++;
     140            }
     141           
     142            break;
     143          }
     144          // search images which tags are in the list
     145          case 'one':
     146          {
     147            $join[] = IMAGE_TAG_TABLE.' AS it'.$i_tags.' ON i.id = it'.$i_tags.'.image_id';
     148            $where[] = 'it'.$i_tags.'.tag_id IN ('.$filter['value'].')';
     149            $i_tags++;
     150           
     151            break;
     152          }
     153          // exclude images which tags are in the list
     154          case 'none':
     155          {
     156            $sub_query = '
     157      SELECT it'.$i_tags.'.image_id
     158        FROM '.IMAGE_TAG_TABLE.' AS it'.$i_tags.'
     159        WHERE
     160          it'.$i_tags.'.image_id = i.id AND
     161          it'.$i_tags.'.tag_id IN ('.$filter['value'].')
     162        GROUP BY it'.$i_tags.'.image_id
     163      ';
     164            $join[] = IMAGE_TAG_TABLE.' AS it'.$i_tags.' ON i.id = it'.$i_tags.'.image_id';
     165            $where[] = 'NOT EXISTS ('.$sub_query.')';
     166            $i_tags++;
     167           
     168            break;
     169          }
     170          // exclude images which tags are not in the list and search images which have all tags
     171          case 'only':
     172          {
     173            $sub_query = '
     174      SELECT it'.$i_tags.'.image_id
     175        FROM '.IMAGE_TAG_TABLE.' AS it'.$i_tags.'
     176        WHERE
     177          it'.$i_tags.'.image_id = i.id AND
     178          it'.$i_tags.'.tag_id NOT IN ('.$filter['value'].')
     179        GROUP BY it'.$i_tags.'.image_id
     180      ';
     181            $join[] = IMAGE_TAG_TABLE.' AS it'.$i_tags.' ON i.id = it'.$i_tags.'.image_id';
     182            $where[] = 'NOT EXISTS ('.$sub_query.')';
     183            $i_tags++;
     184           
     185            $tags_arr = explode(',', $filter['value']);
     186            foreach($tags_arr as $value)
     187            {
     188              $join[] = IMAGE_TAG_TABLE.' AS it'.$i_tags.' ON i.id = it'.$i_tags.'.image_id';
     189              $where[] = 'it'.$i_tags.'.tag_id = '.$value;
     190              $i_tags++;
     191            }
     192           
     193            break;
     194          }
     195        }
    132196       
    133         foreach($tags_arr as $value)
    134         {
    135           $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id';
    136           $where[] = 'it_'.$i_tags.'.tag_id = '.$value;
    137           $i_tags++;
    138         }
    139       }
    140       else if ($filter['cond'] == 'one')
    141       {
    142         $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id';
    143         $where[] = 'it_'.$i_tags.'.tag_id IN ('.$filter['value'].')';
    144         $i_tags++;
    145       }
    146       else if ($filter['cond'] == 'none')
    147       {
    148         $sub_query = '
    149       SELECT it_'.$i_tags.'.image_id
    150         FROM '.IMAGE_TAG_TABLE.' AS it_'.$i_tags.'
    151         WHERE
    152           it_'.$i_tags.'.image_id = i.id AND
    153           it_'.$i_tags.'.tag_id IN ('.$filter['value'].')
    154         GROUP BY it_'.$i_tags.'.image_id
    155     ';
    156         $where[] = 'NOT EXISTS ('.$sub_query.')';
    157         $i_tags++;
    158       }
    159       else if ($filter['cond'] == 'only')
    160       {
    161         $sub_query = '
    162       SELECT it_'.$i_tags.'.image_id
    163         FROM '.IMAGE_TAG_TABLE.' AS it_'.$i_tags.'
    164         WHERE
    165           it_'.$i_tags.'.image_id = i.id AND
    166           it_'.$i_tags.'.tag_id NOT IN ('.$filter['value'].')
    167         GROUP BY it_'.$i_tags.'.image_id
    168     ';
    169         $where[] = 'NOT EXISTS ('.$sub_query.')';
     197        break;
     198      }
     199   
     200      // date
     201      case 'date':
     202      {
     203        switch ($filter['cond'])
     204        {
     205          case 'the_post':
     206            $where[] = 'date_available BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
     207            break;
     208          case 'before_post':
     209            $where[] = 'date_available < "'.$filter['value'].' 00:00:00"';
     210            break;
     211          case 'after_post':
     212            $where[] = 'date_available > "'.$filter['value'].' 23:59:59"';
     213            break;
     214          case 'the_taken':
     215            $where[] = 'date_creation BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
     216            break;
     217          case 'before_taken':
     218            $where[] = 'date_creation < "'.$filter['value'].' 00:00:00"';
     219            break;
     220          case 'after_taken':
     221            $where[] = 'date_creation > "'.$filter['value'].' 23:59:59"';
     222            break;
     223        }
     224       
     225        break;
     226      }
    170227     
    171         $i_tags++;
    172         $tags_arr = explode(',', $filter['value']);
     228      // name
     229      case 'name':
     230      {
     231        switch ($filter['cond'])
     232        {
     233          case 'contain':
     234            $where[] = 'name LIKE "%'.$filter['value'].'%"';
     235            break;
     236          case 'begin':
     237            $where[] = 'name LIKE "'.$filter['value'].'%"';
     238            break;
     239          case 'end':
     240            $where[] = 'name LIKE "%'.$filter['value'].'"';
     241            break;
     242          case 'not_contain':
     243            $where[] = 'name NOT LIKE "%'.$filter['value'].'%"';
     244            break;
     245          case 'not_begin':
     246            $where[] = 'name NOT LIKE "'.$filter['value'].'%"';
     247            break;
     248          case 'not_end':
     249            $where[] = 'name NOT LIKE "%'.$filter['value'].'"';
     250            break;
     251        }
    173252       
    174         foreach($tags_arr as $value)
    175         {
    176           $join[] = IMAGE_TAG_TABLE.' AS it_'.$i_tags.' ON i.id = it_'.$i_tags.'.image_id';
    177           $where[] = 'it_'.$i_tags.'.tag_id = '.$value;
    178           $i_tags++;
    179         }
    180       }       
    181     }
    182     // date
    183     else if ($filter['type'] == 'date')
    184     {
    185       switch ($filter['cond'])
    186       {
    187         case 'the':
    188           $where[] = 'date_available BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
    189           break;
    190         case 'before':
    191           $where[] = 'date_available < "'.$filter['value'].' 00:00:00"';
    192           break;
    193         case 'after':
    194           $where[] = 'date_available > "'.$filter['value'].' 23:59:59"';
    195           break;
    196         case 'the_crea':
    197           $where[] = 'date_creation BETWEEN "'.$filter['value'].' 00:00:00" AND "'.$filter['value'].' 23:59:59"';
    198           break;
    199         case 'before_crea':
    200           $where[] = 'date_creation < "'.$filter['value'].' 00:00:00"';
    201           break;
    202         case 'after_crea':
    203           $where[] = 'date_creation > "'.$filter['value'].' 23:59:59"';
    204           break;
    205       }
    206     }
    207     // limit
    208     else if ($filter['type'] == 'limit')
    209     {
    210       $limit = '0, '.$filter['value'];
     253        break;
     254      }
     255     
     256      // author
     257      case 'author':
     258      {
     259        switch ($filter['cond'])
     260        {
     261          case 'is':
     262            if ($filter['value'] != 'NULL') $filter['value'] = '"'.$filter['value'].'"';
     263            $where[] = 'author = '.$filter['value'].'';
     264            break;
     265          case 'not_is':
     266            if ($filter['value'] != 'NULL') $filter['value'] = '"'.$filter['value'].'"';
     267            $where[] = 'author != '.$filter['value'].'';
     268            break;
     269          case 'in':
     270            $filter['value'] = '"'.str_replace(',', '","', $filter['value']).'"';
     271            $where[] = 'author IN('.$filter['value'].')';
     272            break;
     273          case 'not_in':
     274            $filter['value'] = '"'.str_replace(',', '","', $filter['value']).'"';
     275            $where[] = 'author NOT IN('.$filter['value'].')';
     276            break;
     277        }
     278       
     279        break;
     280      }
     281     
     282      // hit
     283      case 'hit':
     284      {
     285        switch ($filter['cond'])
     286        {
     287          case 'less':
     288            $where[] = 'hit < '.$filter['value'].'';
     289            break;
     290          case 'more':
     291            $where[] = 'hit >= '.$filter['value'].'';
     292            break;
     293        }
     294       
     295        break;
     296      }
     297     
     298      // level
     299      case 'level':
     300      {
     301        $where[] = 'level = '.$filter['value'].'';
     302        break;
     303      }
     304     
     305      // limit
     306      case 'limit':
     307      {
     308        $limit = '0, '.$filter['value'];
     309        break;
     310      }
    211311    }
    212312  }
     
    219319    if (isset($join))
    220320    {
    221       foreach ($join as $query)
    222       {
    223         $MainQuery .= '
    224     LEFT JOIN '.$query;
    225       }
     321      $MainQuery.= '
     322    LEFT JOIN '.implode("\n    LEFT JOIN ", $join);
    226323    }
    227324    if (isset($where))
    228325    {
    229       $MainQuery .= '
    230   WHERE';
    231       $i = 0;
    232       foreach ($where as $query)
    233       {
    234         if ($i != 0) $MainQuery .= ' AND';
    235         $MainQuery .= '
    236     '.$query;
    237         $i++;
    238       }
    239     }
    240 
    241     $MainQuery .= '
     326      $MainQuery.= '
     327  WHERE
     328    '.implode("\n    AND ", $where);
     329    }
     330
     331  $MainQuery.= '
    242332  GROUP BY i.id
    243  '.$conf['order_by'].'
     333  '.$conf['order_by'].'
    244334  '.(isset($limit) ? "LIMIT ".$limit : null).'
    245335;';
    246336
     337  // file_put_contents(SMART_PATH.'query.sql', $MainQuery);
    247338  return array_from_query($MainQuery, 'id');
    248339}
     
    256347function smart_check_filter($filter)
    257348{
    258   global $limit_is_set, $page;
     349  global $page, $limit_is_set, $level_is_set;
    259350  $error = false;
     351 
     352  if (!isset($limit_is_set)) $limit_is_set = false;
     353  if (!isset($level_is_set)) $level_is_set = false;
    260354 
    261355  # tags
     
    281375    }
    282376  }
     377  # name
     378  else if ($filter['type'] == 'name')
     379  {
     380    if (empty($filter['value']))
     381    {
     382      $error = true;
     383      array_push($page['errors'], l10n('Name is empty'));
     384    }
     385  }
     386  # author
     387  else if ($filter['type'] == 'author')
     388  {
     389    if (empty($filter['value']))
     390    {
     391      $error = true;
     392      array_push($page['errors'], l10n('Author is empty'));
     393    }
     394    else
     395    {
     396      $filter['value'] = preg_replace('#([ ]?),([ ]?)#', ',', $filter['value']);
     397    }
     398  }
     399  # hit
     400  else if ($filter['type'] == 'hit')
     401  {
     402    if (!preg_match('#([0-9]{1,})#', $filter['value']))
     403    {
     404      $error = true;
     405      array_push($page['errors'], l10n('Hits must be an integer'));
     406    }
     407  }
     408  # level
     409  else if ($filter['type'] == 'level')
     410  {
     411    if ($level_is_set == true) // only one level is allowed, first is saved
     412    {
     413      $error = true;
     414      array_push($page['errors'], l10n('You can\'t use more than one level filter'));
     415    }
     416    else
     417    {
     418      $level_is_set = true;
     419    }
     420  }
    283421  # limit
    284422  else if ($filter['type'] == 'limit')
     
    292430    {
    293431      $error = true;
    294       array_push($page['errors'], l10n('You can\'t use more than one limit'));
     432      array_push($page['errors'], l10n('You can\'t use more than one limit filter'));
    295433    }
    296434    else
     
    374512  }
    375513}
     514
    376515?>
  • extensions/SmartAlbums/include/index.php

    r11380 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/include/page_items.php

    r12863 r16104  
    33
    44/**
    5  * Remove form $page['items'] picture that musn't be displayed
     5 * Remove picture that musn't be displayed from $page['items']
    66 *
    77 * here we get all pictures that current user could see
  • extensions/SmartAlbums/index.php

    r11380 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/cs_CZ/index.php

    r12982 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/de_DE/index.php

    r11690 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/en_UK/index.php

    r11290 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/en_UK/plugin.lang.php

    r11546 r16104  
    11<?php
    22
    3 $lang['%d photos associated to album %s'] = '%d photos associated to album %s';
    43$lang['No filter selected'] = 'No filter selected';
    5 $lang['No tag selected'] = 'No tag selected';
    6 $lang['Date string is malformed'] = 'Date string is malformed';
    7 $lang['Limit must be an integer'] = 'Limit must be an integer';
    8 $lang['You can\'t use more than one limit'] = 'You can\'t use more than one limit';
     4$lang['%d photo'] = '%d photo';
     5$lang['%d photos'] = '%d photos';
    96$lang['All these tags'] = 'All these tags';
    107$lang['One of these tags'] = 'One of these tags';
     
    1411$lang['Added before'] = 'Added before';
    1512$lang['Added after'] = 'Added after';
    16 $lang['Created on'] = 'Created on';
    1713$lang['Created before'] = 'Created before';
    1814$lang['Created after'] = 'Created after';
    19 $lang['%d photo'] = '%d photo';
    20 $lang['%d photos'] = '%d photos';
    21 $lang['tags filter'] = 'tags filter';
    22 $lang['date filter'] = 'date filter';
    23 $lang['limit filter'] = 'limit filter';
    24 $lang['Add filters here'] = 'Add filters here';
    25 $lang['This album is a SmartAlbum'] = 'This album is a SmartAlbum';
    26 $lang['Count'] = 'Count';
    27 $lang['Regenerate photos list of this SmartAlbum'] = 'Regenerate photos list of this SmartAlbum';
    28 $lang['Regenerate photos list of all SmartAlbums'] = 'Regenerate photos list of all SmartAlbums';
    29 $lang['Update albums on file upload'] = 'Update albums on file upload';
    30 $lang['(can cause slowdowns on admin pages)'] = '(can cause slowdowns on admin pages)';
    31 $lang['All SmartAlbums'] = 'All SmartAlbums';
    32 $lang['Add a SmartAlbum'] = 'Add a SmartAlbum';
     15$lang['Contains'] = 'Contains';
     16$lang['Begins with'] = 'Begins with';
     17$lang['Ends with'] = 'Ends with';
     18$lang['Doesn\'t contain'] = 'Doesn\'t contain';
     19$lang['Doesn\'t begin with'] = 'Doesn\'t begin with';
     20$lang['Doesn\'t end with'] = 'Doesn\'t end with';
     21$lang['Is'] = 'Is';
     22$lang['Is in'] = 'Is in';
     23$lang['Is not'] = 'Is not';
     24$lang['Is not in'] = 'Is not in';
     25$lang['Bellow'] = 'Bellow';
     26$lang['Above'] = 'Above';
    3327$lang['SmartAlbum deleted'] = 'SmartAlbum deleted';
    3428$lang['SmartAlbum added'] = 'SmartAlbum added';
     29$lang['%d photos associated to album %s'] = '%d photos associated to album %s';
    3530$lang['Only SmartAlbums are displayed on this page'] = 'Only SmartAlbums are displayed on this page';
    36 $lang['To order albums please go the main albums management page'] = 'To order albums please go the main albums <a href="admin.php?page=cat_list">management page</a>';
     31$lang['To order albums please go the main albums <a href="%s">management page</a>'] = 'To order albums please go the main albums <a href="%s">management page</a>';
    3732$lang['Don\'t show this message again'] = 'Don\'t show this message again';
     33$lang['All SmartAlbums'] = 'All SmartAlbums';
     34$lang['No tag selected'] = 'No tag selected';
     35$lang['Date string is malformed'] = 'Date string is malformed';
     36$lang['Name is empty'] = 'Name is empty';
     37$lang['Author is empty'] = 'Author is empty';
     38$lang['Hits must be an integer'] = 'Hits must be an integer';
     39$lang['Limit must be an integer'] = 'Limit must be an integer';
     40$lang['You can\'t use more than one limit filter'] = 'You can\'t use more than one limit filter';
     41$lang['You can\'t use more than one level filter'] = 'You can\'t use more than one level filter';
     42$lang['tags_filter'] = 'Tags';
     43$lang['date_filter'] = 'Date';
     44$lang['name_filter'] = 'Photo name';
     45$lang['author_filter'] = 'Author';
     46$lang['hit_filter'] = 'Hits';
     47$lang['level_filter'] = 'Level';
     48$lang['limit_filter'] = 'Max. number of photos';
     49$lang['For "Is (not) in", separate each author by a comma'] = 'For "Is (not) in", separate each author by a comma';
     50$lang['limit_filter'] = 'Max. number of photos';
     51$lang['This album is a SmartAlbum'] = 'This album is a SmartAlbum';
     52$lang['Add filters here'] = 'Add filters here';
     53$lang['Count'] = 'Count';
     54$lang['create a new SmartAlbum'] = 'create a new SmartAlbum';
     55$lang['Regenerate photos list of all SmartAlbums'] = 'Regenerate photos list of all SmartAlbums';
     56$lang['Regenerate photos list of this SmartAlbum'] = 'Regenerate photos list of this SmartAlbum';
     57$lang['Update albums on file upload'] = 'Update albums on file upload';
     58$lang['(can cause slowdowns)'] = '(can cause slowdowns)';
    3859
    3960?>
  • extensions/SmartAlbums/language/es_ES/index.php

    r13129 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/fr_FR/index.php

    r11290 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/fr_FR/plugin.lang.php

    r12523 r16104  
    11<?php
    22
    3 $lang['%d photos associated to album %s'] = '%d photos associées à l\'album %s';
    43$lang['No filter selected'] = 'Aucun filtre sélectionné';
    5 $lang['No tag selected'] = 'Aucun tag sélectionné';
    6 $lang['Date string is malformed'] = 'La date n\'est pas correcte';
    7 $lang['Limit must be an integer'] = 'La limite doit être un entier';
    8 $lang['You can\'t use more than one limit'] = 'Vous ne pouvez utiliser qu\'une seule limite';
     4$lang['%d photo'] = '%d photo';
     5$lang['%d photos'] = '%d photos';
    96$lang['All these tags'] = 'Tous les tags';
    107$lang['One of these tags'] = 'Un des tags';
     
    1411$lang['Added before'] = 'Ajouté avant le';
    1512$lang['Added after'] = 'Ajouté après le';
    16 $lang['Created on'] = 'Créé le';
    1713$lang['Created before'] = 'Créé avant le';
    1814$lang['Created after'] = 'Créé après le';
    19 $lang['%d photo'] = '%d photo';
    20 $lang['%d photos'] = '%d photos';
    21 $lang['tags filter'] = 'filtrer par tags';
    22 $lang['date filter'] = 'filtrer par date';
    23 $lang['limit filter'] = 'nombre max. d\'éléments';
    24 $lang['Add filters here'] = 'Ajoutez des filtres ici';
    25 $lang['This album is a SmartAlbum'] = 'Cet album est un SmartAlbum';
    26 $lang['Count'] = 'Compter';
    27 $lang['Regenerate photos list of this SmartAlbum'] = 'Régénérer les photos de ce SmartAlbum';
    28 $lang['Regenerate photos list of all SmartAlbums'] = 'Régénérer les photos de tous les SmartAlbums';
    29 $lang['Update albums on file upload'] = 'Mettre à jour les albums après la mise en ligne d\'un fichier';
    30 $lang['(can cause slowdowns on admin pages)'] = '(peut causer des ralentissements)';
    31 $lang['All SmartAlbums'] = 'Tous les SmartAlbums';
    32 $lang['Add a SmartAlbum'] = 'Ajouter un SmartAlbum';
     15$lang['Contains'] = 'Contient';
     16$lang['Begins with'] = 'Commence par';
     17$lang['Ends with'] = 'Fini par';
     18$lang['Doesn\'t contain'] = 'Ne contient pas';
     19$lang['Doesn\'t begin with'] = 'Ne commence pas par';
     20$lang['Doesn\'t end with'] = 'Ne fini pas par';
     21$lang['Is'] = 'Est';
     22$lang['Is in'] = 'Est dans';
     23$lang['Is not'] = 'N\'est pas';
     24$lang['Is not in'] = 'N\'est pas dans';
     25$lang['Bellow'] = 'Moins que';
     26$lang['Above'] = 'Plus que';
    3327$lang['SmartAlbum deleted'] = 'SmartAlbum supprimé';
    3428$lang['SmartAlbum added'] = 'SmartAlbum ajouté';
     29$lang['%d photos associated to album %s'] = '%d photos associées à l\'album %s';
    3530$lang['Only SmartAlbums are displayed on this page'] = 'Seuls les SmartAlbums sont affichés sur cette page';
    36 $lang['To order albums please go the main albums management page'] = 'Pour ordonner les albums veuillez vous rendre sur la page principale de <a href="admin.php?page=cat_list">gestion des albums</a>';
     31$lang['To order albums please go the main albums <a href="%s">management page</a>'] = 'Pour trier les SmartAlbums veuillez vous rendre sur la page principale de <a href="%s">gestion des albums</a>';
    3732$lang['Don\'t show this message again'] = 'Ne plus afficher ce message';
     33$lang['All SmartAlbums'] = 'AlTous les  SmartAlbums';
     34$lang['No tag selected'] = 'Aucun tag sélectionné';
     35$lang['Date string is malformed'] = 'Date incorrecte';
     36$lang['Name is empty'] = 'Le nom est vide';
     37$lang['Author is empty'] = 'L\'auteur est vide';
     38$lang['Hits must be an integer'] = 'Le nombre de vues doit être un entier';
     39$lang['Limit must be an integer'] = 'La nombre d\'éléments doit être un entier';
     40$lang['You can\'t use more than one limit filter'] = 'Vous ne pouvez choisir qu\'une seule limite de nombre d\'éléments';
     41$lang['You can\'t use more than one level filter'] = 'Vous ne pouvez choisir qu\'un seul niveau de confidentialité';
     42$lang['tags_filter'] = 'Tags';
     43$lang['date_filter'] = 'Date';
     44$lang['name_filter'] = 'Nom de la photo';
     45$lang['author_filter'] = 'Auteur';
     46$lang['hit_filter'] = 'Nombre de vues';
     47$lang['level_filter'] = 'Niveau de confidentialité';
     48$lang['limit_filter'] = 'Nombre max. d\'éléments';
     49$lang['For "Is (not) in", separate each author by a comma'] = 'Pour "Est/N\'est pas dans", séparez chaque auteur par une virgule';
     50$lang['This album is a SmartAlbum'] = 'Cet album est un SmartAlbum';
     51$lang['Add filters here'] = 'Ajoutez des filtres ici';
     52$lang['Count'] = 'Compter';
     53$lang['create a new SmartAlbum'] = 'créer un nouveau SmartAlbum';
     54$lang['Regenerate photos list of all SmartAlbums'] = 'Régénérer les photos de tous les SmartAlbums';
     55$lang['Regenerate photos list of this SmartAlbum'] = 'Régénérer les photos de ce SmartAlbum';
     56$lang['Update albums on file upload'] = 'Mettre à jour les albums après la mise en ligne d\'un fichier';
     57$lang['(can cause slowdowns)'] = '(peut causer des ralentissements)';
    3858
    3959?>
  • extensions/SmartAlbums/language/index.php

    r11290 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/it_IT/index.php

    r11529 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/lv_LV/index.php

    r11413 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/nl_NL/index.php

    r12965 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/language/vi_VN/index.php

    r13233 r16104  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2010 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
    8 // +-----------------------------------------------------------------------+
    9 // | This program is free software; you can redistribute it and/or modify  |
    10 // | it under the terms of the GNU General Public License as published by  |
    11 // | the Free Software Foundation                                          |
    12 // |                                                                       |
    13 // | This program is distributed in the hope that it will be useful, but   |
    14 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    16 // | General Public License for more details.                              |
    17 // |                                                                       |
    18 // | You should have received a copy of the GNU General Public License     |
    19 // | along with this program; if not, write to the Free Software           |
    20 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    21 // | USA.                                                                  |
    22 // +-----------------------------------------------------------------------+
    23 
    24 // Recursive call
    252$url = '../';
    263header( 'Request-URI: '.$url );
  • extensions/SmartAlbums/main.inc.php

    r11392 r16104  
    1212global $prefixeTable;
    1313
    14 define('SMART_DIR', basename(dirname(__FILE__)));
    15 define('SMART_PATH', PHPWG_PLUGINS_PATH.SMART_DIR.'/');
    16 define('CATEGORY_FILTERS_TABLE', $prefixeTable.'category_filters');
    17 define('SMART_ADMIN', get_root_url().'admin.php?page=plugin-' . SMART_DIR);
     14define('SMART_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
     15define('CATEGORY_FILTERS_TABLE', $prefixeTable . 'category_filters');
     16define('SMART_ADMIN', get_root_url() . 'admin.php?page=plugin-' . basename(dirname(__FILE__)));
    1817
    1918add_event_handler('invalidate_user_cache', 'smart_make_all_associations');
     
    2322{
    2423  add_event_handler('loc_end_section_init', 'smart_init_page_items');
    25   include_once(SMART_PATH.'include/init_page_items.php');
     24  include_once(SMART_PATH.'include/page_items.php');
    2625}
    2726else if (script_basename() == 'admin')
    2827{
     28  global $conf;
     29 
    2930  load_language('plugin.lang', SMART_PATH);
    30  
    31   add_event_handler('loc_begin_cat_modify', 'smart_cat_modify');
    32   include_once(SMART_PATH.'include/init_cat_modify.php');
    33  
     31  $conf['SmartAlbums'] = unserialize($conf['SmartAlbums']);
     32   
    3433  add_event_handler('loc_begin_cat_list', 'smart_cat_list');
    35   include_once(SMART_PATH.'include/init_cat_list.php');
     34  include_once(SMART_PATH.'include/cat_list.php');
    3635 
    3736  add_event_handler('get_admin_plugin_menu_links', 'smart_admin_menu');
    38         function smart_admin_menu($menu)
    39         {
    40                 array_push($menu, array(
    41                         'NAME' => 'SmartAlbums',
    42                         'URL' => SMART_ADMIN,
    43       )
    44     );
    45                 return $menu;
    46         }
     37  function smart_admin_menu($menu)
     38  {
     39    array_push($menu, array(
     40        'NAME' => 'SmartAlbums',
     41        'URL' => SMART_ADMIN,
     42      ));
     43    return $menu;
     44  }
     45   
     46  add_event_handler('loc_begin_admin_page', 'smart_add_admin_album_tab');
     47  function smart_add_admin_album_tab()
     48  {
     49    global $page, $template;
     50    if ($page['page'] != 'album') return;
     51   
     52    $template->set_prefilter('tabsheet', 'smart_add_admin_album_tab_prefilter');
     53  }
     54  function smart_add_admin_album_tab_prefilter($content)
     55  {
     56    $search = '{/foreach}';
     57    $add = '
     58  <li class="{if false}selected_tab{else}normal_tab{/if}">
     59    <a href="'.SMART_ADMIN.'-album&amp;cat_id='.$_GET['cat_id'].'"><span>SmartAlbum</span></a>
     60  </li>';
     61    return str_replace($search, $search.$add, $content);
     62  }
    4763}
    4864
  • extensions/SmartAlbums/maintain.inc.php

    r11451 r16104  
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    33
     4global $prefixeTable;
     5define('smart_table', $prefixeTable . 'category_filters');
     6
     7define('smart_default_config', serialize(array(
     8    'update_on_upload' => false,
     9    'show_list_messages' => true,
     10    )));
     11
    412function plugin_install()
    513{
    6         global $prefixeTable;
    7 
    814  /* create table to store filters */
    915        pwg_query(
    10 'CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'category_filters` (
     16'CREATE TABLE IF NOT EXISTS `' . smart_table . '` (
    1117  `category_id` smallint(5) unsigned NOT NULL,
    1218  `type` varchar(16) NOT NULL,
     
    2026     
    2127  /* config parameter */
    22   pwg_query('
    23 INSERT INTO `' . CONFIG_TABLE . '`
    24   VALUES (
    25     \'SmartAlbums\',
    26     \''.serialize(array(
    27         'update_on_upload' => false,
    28         'show_list_messages' => true,
    29         )
    30       ).'\',
    31     \'Configuration for SmartAlbums plugin\'
    32   )
    33 ;');
    34 
     28  conf_update_param('SmartAlbums', smart_default_config);
    3529}
    3630
     
    4135  if (!isset($conf['SmartAlbums']))
    4236  {
    43     pwg_query('
    44 INSERT INTO `' . CONFIG_TABLE . '`
    45   VALUES (
    46     \'SmartAlbums\',
    47     \''.serialize(array(
    48         'update_on_upload' => false,
    49         'show_list_messages' => true,
    50         )
    51       ).'\',
    52     \'Configuration for SmartAlbums plugin\'
    53   )
    54 ;');
     37    conf_update_param('SmartAlbums', smart_default_config);
     38  }
     39 
     40  /* some filters renamed in 1.2 */
     41  $name_changes = array(
     42    'the' => 'the_post',
     43    'before' => 'before_post',
     44    'after' => 'after_post',
     45    'the_crea' => 'the_taken',
     46    'before_crea' => 'before_taken',
     47    'after_crea' => 'after_taken',
     48    );
     49  foreach ($name_changes as $old => $new)
     50  {
     51    pwg_query('UPDATE TABLE ' . smart_table . ' SET cond = "'.$new.'" WHERE cond = "'.$old.'";');
    5552  }
    5653}
    5754
    5855function plugin_uninstall()
    59 {
    60         global $prefixeTable;
    61  
    62   pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;');
     56
     57  pwg_query('DROP TABLE `' . smart_table . '`;');
    6358  pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;');
    64   pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';');
     59  pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\' LIMIT 1;');
    6560}
     61
    6662?>
Note: See TracChangeset for help on using the changeset viewer.