Changeset 27268


Ignore:
Timestamp:
Feb 8, 2014, 6:48:13 PM (7 years ago)
Author:
mistic100
Message:

update for 2.6

Location:
extensions/dynareceperio
Files:
5 deleted
31 edited
2 moved

Legend:

Unmodified
Added
Removed
  • extensions/dynareceperio/admin.php

    r27267 r27268  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Dynamic Recent Period - a Piwigo Plugin                               |
    4 // | Copyright (C) 2007-2011 Ruben ARNAUD - rub@piwigo.org                 |
    5 // +-----------------------------------------------------------------------+
    6 // | This program is free software; you can redistribute it and/or modify  |
    7 // | it under the terms of the GNU General Public License as published by  |
    8 // | the Free Software Foundation                                          |
    9 // |                                                                       |
    10 // | This program is distributed in the hope that it will be useful, but   |
    11 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    12 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    13 // | General Public License for more details.                              |
    14 // |                                                                       |
    15 // | You should have received a copy of the GNU General Public License     |
    16 // | along with this program; if not, write to the Free Software           |
    17 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    18 // | USA.                                                                  |
    19 // +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
     2defined('DYNARECEPERIO_PATH') or die('Hacking attempt!');
    253
    264load_language('plugin.lang', DYNARECEPERIO_PATH);
    275
    28 if (isset($_POST['submit']) and !is_adviser())
     6if (isset($_POST['submit']))
    297{
    30   $conf['dynareceperio']['force'] = empty($_POST['dynareceperio_force']) ? false : true;
    31   if (isset($_POST['dynareceperio_day_number']))
    32   {
    33     $conf['dynareceperio']['day_number'] = $_POST['dynareceperio_day_number'];
    34   }
     8  $conf['dynareceperio'] = array(
     9    'force' => isset($_POST['dynareceperio_force']),
     10    'day_number' => intval($_POST['dynareceperio_day_number']),
     11    );
    3512
    36   $query = '
    37 update '.CONFIG_TABLE.'
    38 set
    39   value = \''.serialize($conf['dynareceperio']).'\'
    40 where
    41   param = \'dynareceperio\'
    42 ;';
    43   pwg_query($query);
     13  conf_update_param('dynareceperio', serialize($conf['dynareceperio']));
    4414}
    4515
    46 $template->assign(
    47   array(
    48     'DYNARECEPERIO_FORCE'=> ($conf['dynareceperio']['force'] ? 'checked="checked"' : ''),
    49     'DYNARECEPERIO_DAY_NUMBER'=> $conf['dynareceperio']['day_number'],
    50     ));
     16$template->assign('dynareceperio', $conf['dynareceperio']);
    5117
    52 $template->set_filename('plugin_admin_content', DYNARECEPERIO_PATH.'config.tpl');
     18$template->set_filename('plugin_admin_content', realpath(DYNARECEPERIO_PATH.'admin.tpl'));
    5319$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    54 
    55 
    56 ?>
  • extensions/dynareceperio/admin.tpl

    r27267 r27268  
    22  <h2>Dynamic Recent Period</h2>
    33</div>
    4 <br>
    54
    65<form method="post" class="properties">
     6  <fieldset>
     7    <legend>{'Configuration'|translate}</legend>
     8   
     9    <ul>
     10      <li>
     11        <label>
     12          <input type="checkbox" name="dynareceperio_force" {if $dynareceperio.force}checked{/if}>
     13          <b>{'Force usage for all users'|translate}</b>
     14        </label>
     15      </li>
    716
    8 <fieldset id="dynareceperioConf">
    9   <ul>
    10     <li>
    11       <label>
    12         <span class="property">{'dynareceperio_force'|@translate}</span>
    13         <input type="checkbox" name="dynareceperio_force" {$DYNARECEPERIO_FORCE} />
    14       </label>
    15     </li>
     17      <li>
     18        <label>
     19          <b>{'Number of days number with image upload'|translate}</b>
     20          <input type="text" size="3" maxlength="4" name="dynareceperio_day_number" value="{$dynareceperio.day_number}">
     21        </label>
     22      </li>
    1623
    17     <li>
    18       <span class="property">
    19         <label for="dynareceperio_day_number">{'dynareceperio_day_number'|@translate}</label>
    20       </span>
    21       <input type="text" size="3" maxlength="4" name="dynareceperio_day_number" id="dynareceperio_day_number" value="{$DYNARECEPERIO_DAY_NUMBER}" />
    22     </li>
     24    </ul>
     25  </fieldset>
    2326
    24   </ul>
    25 </fieldset>
    26 
    27   <p>
    28     <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}" {$TAG_INPUT_ENABLED}>
    29     <input class="submit" type="reset" name="reset" value="{'Reset'|@translate}">
     27  <p class="formButtons">
     28    <input class="submit" type="submit" name="submit" value="{'Submit'|translate}">
    3029  </p>
    31 
    3230</form>
  • extensions/dynareceperio/language/ar_SA/plugin.lang.php

    r21774 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'عدد ألأيام مع عدد تحميل الصور';
    24 $lang['dynareceperio_force'] = 'إجبار الأستخدم لجميع المستخدمين';
     23$lang['Number of days number with image upload'] = 'عدد ألأيام مع عدد تحميل الصور';
     24$lang['Force usage for all users'] = 'إجبار الأستخدم لجميع المستخدمين';
    2525?>
  • extensions/dynareceperio/language/bg_BG/plugin.lang.php

    r21740 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_force'] = 'Усилено използване за всички потребители';
    24 $lang['dynareceperio_day_number'] = 'Брой на дните с добавени снимки';
     23$lang['Force usage for all users'] = 'Усилено използване за всички потребители';
     24$lang['Number of days number with image upload'] = 'Брой на дните с добавени снимки';
    2525?>
  • extensions/dynareceperio/language/cs_CZ/plugin.lang.php

    r22014 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Počet dní s nahranými fotkami';
    24 $lang['dynareceperio_force'] = 'Vynutit použití pro všechny uživatele';
     23$lang['Number of days number with image upload'] = 'Počet dní s nahranými fotkami';
     24$lang['Force usage for all users'] = 'Vynutit použití pro všechny uživatele';
    2525?>
  • extensions/dynareceperio/language/da_DK/plugin.lang.php

    r21496 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Dagnummer med billedtilføjelser';
    24 $lang['dynareceperio_force'] = 'Gennemtving benyttelse hos alle brugere';
     23$lang['Number of days number with image upload'] = 'Dagnummer med billedtilføjelser';
     24$lang['Force usage for all users'] = 'Gennemtving benyttelse hos alle brugere';
    2525?>
  • extensions/dynareceperio/language/de_DE/plugin.lang.php

    r21571 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Anzahl der Tage mit hinzugefügten Bildern';
    24 $lang['dynareceperio_force'] = 'Erzwinge alle Benutzer zur Nutzung';
     23$lang['Number of days number with image upload'] = 'Anzahl der Tage mit hinzugefügten Bildern';
     24$lang['Force usage for all users'] = 'Erzwinge alle Benutzer zur Nutzung';
    2525?>
  • extensions/dynareceperio/language/el_GR/plugin.lang.php

    r21480 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_force'] = 'Επιβολή χρήσης σε όλους τους χρήστες';
    24 $lang['dynareceperio_day_number'] = 'Αριθμός ημερών με προσθήκη εικόνων';
     23$lang['Force usage for all users'] = 'Επιβολή χρήσης σε όλους τους χρήστες';
     24$lang['Number of days number with image upload'] = 'Αριθμός ημερών με προσθήκη εικόνων';
    2525?>
  • extensions/dynareceperio/language/en_UK/plugin.lang.php

    r21593 r27268  
    11<?php
    22// +-----------------------------------------------------------------------+
    3 // | Dynamic Recent Period - a Piwigo Plugin                               |
    4 // | Copyright (C) 2007-2011 Ruben ARNAUD - rub@piwigo.org                 |
     3// | Piwigo - a PHP based photo gallery                                    |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2008-2013 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 |
    58// +-----------------------------------------------------------------------+
    69// | This program is free software; you can redistribute it and/or modify  |
     
    1821// | USA.                                                                  |
    1922// +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
    25 
    26 $lang['dynareceperio_force'] = 'Force usage for all users';
    27 $lang['dynareceperio_day_number'] = 'Number of days number with image upload';
    28 
     23$lang['Force usage for all users'] = 'Force usage for all users';
     24$lang['Number of days number with image upload'] = 'Number of days number with image upload';
    2925?>
  • extensions/dynareceperio/language/eo_EO/plugin.lang.php

    r24358 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Nombro da tagoj kun bilda alŝuto';
    24 $lang['dynareceperio_force'] = 'Altrudi la uzon al ĉiuj uzantoj';
     23$lang['Number of days number with image upload'] = 'Nombro da tagoj kun bilda alŝuto';
     24$lang['Force usage for all users'] = 'Altrudi la uzon al ĉiuj uzantoj';
    2525?>
  • extensions/dynareceperio/language/es_ES/plugin.lang.php

    r8425 r27268  
    1818// | USA.                                                                  |
    1919// +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
    25 
    26 $lang['dynareceperio_force'] = 'Forzarles el uso a todos los usuarios';
    27 $lang['dynareceperio_day_number'] = 'Número de días con añadido de imágenes';
    28 
     20$lang['Force usage for all users'] = 'Forzarles el uso a todos los usuarios';
     21$lang['Number of days number with image upload'] = 'Número de días con añadido de imágenes';
    2922?>
  • extensions/dynareceperio/language/et_EE/plugin.lang.php

    r22262 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Päevade arv, mil pildid on üles laetud';
    24 $lang['dynareceperio_force'] = 'Kohustuslik kasutamine kõikidel kasutajatel';
     23$lang['Number of days number with image upload'] = 'Päevade arv, mil pildid on üles laetud';
     24$lang['Force usage for all users'] = 'Kohustuslik kasutamine kõikidel kasutajatel';
    2525?>
  • extensions/dynareceperio/language/fa_IR/plugin.lang.php

    r26451 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'تعداد  اپ لود برای تعدا روز ها ';
    24 $lang['dynareceperio_force'] = 'اجبار برای استفاده همه کاربران';
     23$lang['Number of days number with image upload'] = 'تعداد  اپ لود برای تعدا روز ها ';
     24$lang['Force usage for all users'] = 'اجبار برای استفاده همه کاربران';
    2525?>
  • extensions/dynareceperio/language/fi_FI/plugin.lang.php

    r25735 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_force'] = 'Tee pakolliseksi kaikille';
    24 $lang['dynareceperio_day_number'] = 'Laskee dynaamisen "äskettäin" aikajakson';
     23$lang['Force usage for all users'] = 'Tee pakolliseksi kaikille';
     24$lang['Number of days number with image upload'] = 'Laskee dynaamisen "äskettäin" aikajakson';
    2525?>
  • extensions/dynareceperio/language/fr_FR/plugin.lang.php

    r8425 r27268  
    1818// | USA.                                                                  |
    1919// +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
    25 
    26 $lang['dynareceperio_force'] = 'Forcer l\'usage à tous les utilisateurs';
    27 $lang['dynareceperio_day_number'] = 'Nombre de jours avec ajout d\'images';
    28 
     20$lang['Force usage for all users'] = 'Forcer l\'usage à tous les utilisateurs';
     21$lang['Number of days number with image upload'] = 'Nombre de jours avec ajout d\'images';
    2922?>
  • extensions/dynareceperio/language/gl_ES/plugin.lang.php

    r21473 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_force'] = 'Forzar a usalo a tódolos usuarios';
    24 $lang['dynareceperio_day_number'] = 'Número de días nos que se engadiron imaxes';
     23$lang['Force usage for all users'] = 'Forzar a usalo a tódolos usuarios';
     24$lang['Number of days number with image upload'] = 'Número de días nos que se engadiron imaxes';
    2525?>
  • extensions/dynareceperio/language/hu_HU/plugin.lang.php

    r21592 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Hány naposak az ÚJ képek?';
    24 $lang['dynareceperio_force'] = 'Minden felhasználóra érvényes legyen';
     23$lang['Number of days number with image upload'] = 'Hány naposak az ÚJ képek?';
     24$lang['Force usage for all users'] = 'Minden felhasználóra érvényes legyen';
    2525?>
  • extensions/dynareceperio/language/it_IT/plugin.lang.php

    r8425 r27268  
    1818// | USA.                                                                  |
    1919// +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
    25 
    26 $lang['dynareceperio_force'] = 'Forzare l\'uso a tutti gli utenti';
    27 $lang['dynareceperio_day_number'] = 'Numero di giorni definito per l\'aggiunta d\'immagini';
    28 
     20$lang['Force usage for all users'] = 'Forzare l\'uso a tutti gli utenti';
     21$lang['Number of days number with image upload'] = 'Numero di giorni definito per l\'aggiunta d\'immagini';
    2922?>
  • extensions/dynareceperio/language/lv_LV/plugin.lang.php

    r8476 r27268  
    1818// | USA.                                                                  |
    1919// +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
    25 
    26 $lang['dynareceperio_force'] = 'Piespiedu lietošana visiem lietotājiem';
    27 $lang['dynareceperio_day_number'] = 'Dienas numurus kopā ar attēlu pievienojumu';
    28 
     20$lang['Force usage for all users'] = 'Piespiedu lietošana visiem lietotājiem';
     21$lang['Number of days number with image upload'] = 'Dienas numurus kopā ar attēlu pievienojumu';
    2922?>
  • extensions/dynareceperio/language/nl_NL/plugin.lang.php

    r21815 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Aantal dagen met foto upload';
    24 $lang['dynareceperio_force'] = 'Verplicht gebruik voor alle gebruikers';
     23$lang['Number of days number with image upload'] = 'Aantal dagen met foto upload';
     24$lang['Force usage for all users'] = 'Verplicht gebruik voor alle gebruikers';
    2525?>
  • extensions/dynareceperio/language/pl_PL/plugin.lang.php

    r21443 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Liczba dni od dodania zdjęcia';
    24 $lang['dynareceperio_force'] = 'Wymuś używanie przez wszystkich użytkowników';
     23$lang['Number of days number with image upload'] = 'Liczba dni od dodania zdjęcia';
     24$lang['Force usage for all users'] = 'Wymuś używanie przez wszystkich użytkowników';
    2525?>
  • extensions/dynareceperio/language/pt_BR/plugin.lang.php

    r21456 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Número de dias com imagens à adicionar';
    24 $lang['dynareceperio_force'] = 'Forçar o uso para todos os usuários';
     23$lang['Number of days number with image upload'] = 'Número de dias com imagens à adicionar';
     24$lang['Force usage for all users'] = 'Forçar o uso para todos os usuários';
    2525?>
  • extensions/dynareceperio/language/pt_PT/plugin.lang.php

    r21503 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Número de dias com a adição de imagens';
    24 $lang['dynareceperio_force'] = 'Forçar para todos os utilizadores';
     23$lang['Number of days number with image upload'] = 'Número de dias com a adição de imagens';
     24$lang['Force usage for all users'] = 'Forçar para todos os utilizadores';
    2525?>
  • extensions/dynareceperio/language/ru_RU/plugin.lang.php

    r21466 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Количество дней с добавлением изображений';
    24 $lang['dynareceperio_force'] = 'Принудительное использование всеми пользователями';
     23$lang['Number of days number with image upload'] = 'Количество дней с добавлением изображений';
     24$lang['Force usage for all users'] = 'Принудительное использование всеми пользователями';
    2525?>
  • extensions/dynareceperio/language/sk_SK/plugin.lang.php

    r21764 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_force'] = 'Použiť pre všetkých používateľov';
    24 $lang['dynareceperio_day_number'] = 'Počet dní s nahranými fotkami';
     23$lang['Force usage for all users'] = 'Použiť pre všetkých používateľov';
     24$lang['Number of days number with image upload'] = 'Počet dní s nahranými fotkami';
    2525?>
  • extensions/dynareceperio/language/sv_SE/plugin.lang.php

    r24353 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Antal dagar med bilduppladdning';
    24 $lang['dynareceperio_force'] = 'Forcera användande för alla användare';
     23$lang['Number of days number with image upload'] = 'Antal dagar med bilduppladdning';
     24$lang['Force usage for all users'] = 'Forcera användande för alla användare';
    2525?>
  • extensions/dynareceperio/language/tr_TR/plugin.lang.php

    r21442 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Resimleri gün sayısı ile ekleyin';
    24 $lang['dynareceperio_force'] = 'Tüm kullanıcılar için zorunlu';
     23$lang['Number of days number with image upload'] = 'Resimleri gün sayısı ile ekleyin';
     24$lang['Force usage for all users'] = 'Tüm kullanıcılar için zorunlu';
    2525?>
  • extensions/dynareceperio/language/uk_UA/plugin.lang.php

    r21468 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = 'Кількість днів з додаванням зображень';
    24 $lang['dynareceperio_force'] = 'Примусове використання усіма користувачами';
     23$lang['Number of days number with image upload'] = 'Кількість днів з додаванням зображень';
     24$lang['Force usage for all users'] = 'Примусове використання усіма користувачами';
    2525?>
  • extensions/dynareceperio/language/zh_CN/plugin.lang.php

    r21475 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = '相片添加的天数';
    24 $lang['dynareceperio_force'] = '强制所有用户使用';
     23$lang['Number of days number with image upload'] = '相片添加的天数';
     24$lang['Force usage for all users'] = '强制所有用户使用';
    2525?>
  • extensions/dynareceperio/language/zh_HK/plugin.lang.php

    r24149 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = '上傳日子數字的圖像';
    24 $lang['dynareceperio_force'] = '強制使用於所有用戶';
     23$lang['Number of days number with image upload'] = '上傳日子數字的圖像';
     24$lang['Force usage for all users'] = '強制使用於所有用戶';
    2525?>
  • extensions/dynareceperio/language/zh_TW/plugin.lang.php

    r21547 r27268  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 $lang['dynareceperio_day_number'] = '天數具有圖片新增';
    24 $lang['dynareceperio_force'] = '強制所有用戶使用';
     23$lang['Number of days number with image upload'] = '天數具有圖片新增';
     24$lang['Force usage for all users'] = '強制所有用戶使用';
    2525?>
  • extensions/dynareceperio/main.inc.php

    r8426 r27268  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Dynamic Recent Period - a Piwigo Plugin                               |
    4 // | Copyright (C) 2007-2011 Ruben ARNAUD - rub@piwigo.org                 |
    5 // +-----------------------------------------------------------------------+
    6 // | This program is free software; you can redistribute it and/or modify  |
    7 // | it under the terms of the GNU General Public License as published by  |
    8 // | the Free Software Foundation                                          |
    9 // |                                                                       |
    10 // | This program is distributed in the hope that it will be useful, but   |
    11 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    12 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    13 // | General Public License for more details.                              |
    14 // |                                                                       |
    15 // | You should have received a copy of the GNU General Public License     |
    16 // | along with this program; if not, write to the Free Software           |
    17 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    18 // | USA.                                                                  |
    19 // +-----------------------------------------------------------------------+
    20 
    212/*
    223Plugin Name: Dynamic Recent Period
    234Version: auto
    245Description: Computes a dynamic recent period
    25 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=180
     6Plugin URI: auto
    267Author: Ruben ARNAUD
    27 Author URI: http://photograph.piwigo.net/
    288*/
    299
    30 if (!defined('PHPWG_ROOT_PATH'))
     10defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
     11
     12define('DYNARECEPERIO_ID',   basename(dirname(__FILE__)));
     13define('DYNARECEPERIO_PATH', PHPWG_PLUGINS_PATH . DYNARECEPERIO_ID . '/');
     14
     15
     16global $conf;
     17$conf['dynareceperio'] = unserialize($conf['dynareceperio']);
     18
     19
     20// ADMIN MENU LINK
     21if (defined('IN_ADMIN'))
    3122{
    32   die('Hacking attempt!');
     23  add_event_handler('get_admin_plugin_menu_links', 'dynareceperio_get_admin_plugin_menu_links');
     24
     25  function dynareceperio_get_admin_plugin_menu_links($menu)
     26  {
     27    $menu[] = array(
     28      'NAME' => 'Dynamic Recent Period',
     29      'URL' => get_root_url() . 'admin.php?page=plugin-' . DYNARECEPERIO_ID,
     30      );
     31
     32    return $menu;
     33  }
    3334}
    3435
    35 global $conf;
     36// REMOVE INPUT ON PROFILE AND USERS LIST
     37if (script_basename() == 'profile' || defined('IN_ADMIN'))
     38{
     39  if ($conf['dynareceperio']['force'])
     40  {
     41    add_event_handler('loc_end_page_tail', 'dynareceperio_hide_recent_period');
     42 
     43    function dynareceperio_hide_recent_period()
     44    {
     45      global $template, $page;
    3646
    37 $conf['dynareceperio'] = unserialize($conf['dynareceperio']);
    38 
    39 if (script_basename() == 'profile')
    40 {
    41   include_once(dirname(__FILE__).'/profile.inc.php');
    42 }
    43 else
    44 if (script_basename() == 'admin')
    45 {
    46   include_once(dirname(__FILE__).'/profile.inc.php');
    47   include_once(dirname(__FILE__).'/admin.inc.php');
    48 }
    49 else
    50 if (script_basename() != 'profile')
    51 {
    52   include_once(dirname(__FILE__).'/period.inc.php');
     47      if (@$page['page'] == 'user_list')
     48      {
     49        $template->set_prefilter('user_list', 'dynareceperio_user_list');
     50      }
     51      else if (@$page['body_id']=='theProfilePage' || (@$page['page'] == 'configuration' && @$_GET['section'] == 'default'))
     52      {
     53        $template->block_footer_script(array('require'=>'jquery'), 'jQuery("#recent_period").parent().hide();');
     54      }
     55    }
     56   
     57    function dynareceperio_user_list($content)
     58    {
     59      $search = '<div class="userProperty"><strong>{\'Recent period\'|translate}';
     60      $replace = '<div class="userProperty" style="display:none;"><strong>{\'Recent period\'|translate}';
     61      return str_replace($search, $replace, $content);
     62    }
     63  }
    5364}
    5465
     66// APPLY DYNAMIC PERIOD
     67else
     68{
     69  add_event_handler('init', 'dynareceperio_user_init');
    5570
    56 ?>
     71  function dynareceperio_user_init()
     72  {
     73    global $conf, $user;
     74
     75    $default_period = get_default_user_value('recent_period', $user['recent_period']);
     76
     77    if ($conf['dynareceperio']['force'] or $default_period == $user['recent_period'])
     78    {
     79      $query = '
     80SELECT MAX(D)
     81  FROM (
     82    SELECT D
     83    FROM (
     84      SELECT DATEDIFF(CURRENT_DATE, date_available) AS D
     85      FROM '.IMAGES_TABLE.' AS i
     86        INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
     87      '.get_sql_condition_FandF(
     88          array(
     89            'forbidden_categories' => 'ic.category_id',
     90            'visible_categories' => 'ic.category_id',
     91            'visible_images' => 'id'
     92            ),
     93          'WHERE',
     94          true
     95          ).'
     96      ) AS ListDate
     97    WHERE D >= 0
     98    GROUP BY D
     99    ORDER BY D ASC
     100    LIMIT '.$conf['dynareceperio']['day_number'].'
     101  ) AS MaxD
     102;';
     103      $result = pwg_query($query);
     104     
     105      if (list($period) = pwg_db_fetch_row($result))
     106      {
     107        $user['recent_period'] = max($period, $default_period);
     108      }
     109    }
     110  }
     111}
  • extensions/dynareceperio/maintain.inc.php

    r8425 r27268  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Dynamic Recent Period - a Piwigo Plugin                               |
    4 // | Copyright (C) 2007-2011 Ruben ARNAUD - rub@piwigo.org                 |
    5 // +-----------------------------------------------------------------------+
    6 // | This program is free software; you can redistribute it and/or modify  |
    7 // | it under the terms of the GNU General Public License as published by  |
    8 // | the Free Software Foundation                                          |
    9 // |                                                                       |
    10 // | This program is distributed in the hope that it will be useful, but   |
    11 // | WITHOUT ANY WARRANTY; without even the implied warranty of            |
    12 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
    13 // | General Public License for more details.                              |
    14 // |                                                                       |
    15 // | You should have received a copy of the GNU General Public License     |
    16 // | along with this program; if not, write to the Free Software           |
    17 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
    18 // | USA.                                                                  |
    19 // +-----------------------------------------------------------------------+
    20 
    21 if (!defined('PHPWG_ROOT_PATH'))
    22 {
    23   die('Hacking attempt!');
    24 }
     2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    253
    264function plugin_install()
    275{
    28   $query = '
    29 replace into '.CONFIG_TABLE.'
    30   (param, value, comment)
    31 values
    32   (
    33     \'dynareceperio\',
    34     \''.serialize(array('force' => true, 'day_number' => 1)).'\',
    35     \'Parameters of "Dynamic Recent Period" plugin\'
    36   )
    37 ;';
    38 
    39   pwg_query($query);
     6  conf_update_param('dynareceperio', serialize(array('force' => true, 'day_number' => 1)));
    407}
    418
    429function plugin_uninstall()
    4310{
    44   $query = '
    45 delete from '.CONFIG_TABLE.'
    46 where param = \'dynareceperio\'
    47 ;';
    48 
    49   pwg_query($query);
     11  conf_delete_param('dynareceperio');
    5012}
    51 
    52 ?>
Note: See TracChangeset for help on using the changeset viewer.