Changeset 31465


Ignore:
Timestamp:
Mar 19, 2016, 9:01:52 PM (8 years ago)
Author:
ddtddt
Message:

[extensions] - Photo_add_by - 2.8

Location:
extensions/Photo_add_by
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/Photo_add_by/admin.php

    r30514 r31465  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Photo added by plugin for Piwigo                                      |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2012-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
     21
    222if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    323global $template, $conf, $user;
     
    2040
    2141$tabsheet = new tabsheet();
    22 $tabsheet->add('gestion',
    23                l10n('Configuration'),
    24                PAB_ADMIN.'-gestion');
     42  $tabsheet->add('gestion',l10n('Configuration'),PAB_ADMIN.'-gestion');
    2543$tabsheet->select($page['tab']);
    2644$tabsheet->assign();
  • extensions/Photo_add_by/index.php

    r16859 r31465  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 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 
    242// Recursive call
    253$url = '../';
  • extensions/Photo_add_by/initpicture.php

    r30404 r31465  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Photo added by plugin for Piwigo                                      |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2012-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221
    322//Ajout du prefiltre
     
    3251add_event_handler('loc_begin_picture', 'pab');
    3352
    34 function pab()
    35 {
     53function pab(){
    3654global $conf, $page, $template;
    3755load_language('plugin.lang', PAB_PATH);
    3856load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
    3957
    40   if ( !empty($page['image_id']) )   
    41   {
    42  
    43   $query = '
    44 select added_by
    45   FROM ' . IMAGES_TABLE . '
    46   WHERE id = \''.$page['image_id'].'\'
    47   ;';
    48 $result = pwg_query($query);
    49 $row = pwg_db_fetch_assoc($result);
    50 $userab=$row['added_by'];
    51 
    52   $query = '
    53 select '.$conf['user_fields']['username'].' AS username
    54   FROM ' . USERS_TABLE . '
    55   WHERE '.$conf['user_fields']['id'].' = \''.$userab.'\'
    56   ;';
    57 $result = pwg_query($query);
    58 $row = pwg_db_fetch_assoc($result);
    59 $pab=$row['username'];
    60 
    61 $PASPBY = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'see_photos_by_user';"));
    62 $showpab = $conf['Photo_add_by_show'];
    63 if($showpab == 1 and $PASPBY['state'] == 'active')
    64 {
    65 $query2 = '
    66 SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU
    67  FROM ' . USERS_TABLE . ' as UT
    68  INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id
    69  INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id
    70   '.get_sql_condition_FandF
    71   (
    72     array
    73       (
    74         'forbidden_categories' => 'category_id',
    75         'visible_categories' => 'category_id',
    76         'visible_images' => 'id'
    77       ),
    78     'WHERE'
    79   ).'
    80  GROUP BY IT.added_by
    81  HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].'
    82  ORDER BY '.$conf['see_photos_by_user_order'].'
    83  LIMIT '.$conf['see_photos_by_user_limit'].';';
    84 
    85 $result2 = pwg_query($query2);
    86 
    87 $userok = array();
    88 while ($row2 = pwg_db_fetch_assoc($result2))
    89  {
    90   $userok[] = $row2['username'];
    91 }
    92 if(in_array($pab, $userok) and $showpab == 1 and $PASPBY['state'] == 'active')
    93 {
    94 $urlpab = get_root_url().'index.php?/user-'.$userab.'-'.$pab;
    95 $pab2 ='<a href="'.$urlpab.'">'.$pab.'</a>';
    96 }
    97 else
    98 {
    99 $pab2=$pab;
    100 }
    101 }
    102 else
    103 {
    104 $pab2=$pab;
    105 }
    106 $template->assign(array('PAB' => $pab2,));
    107 
     58  if ( !empty($page['image_id']) ){
     59    $query = 'select added_by FROM ' . IMAGES_TABLE . ' WHERE id = \''.$page['image_id'].'\';';
     60        $result = pwg_query($query);
     61        $row = pwg_db_fetch_assoc($result);
     62        $userab=$row['added_by'];
     63       
     64        $query = 'select '.$conf['user_fields']['username'].' AS username FROM ' . USERS_TABLE . ' WHERE '.$conf['user_fields']['id'].' = \''.$userab.'\';';
     65        $result = pwg_query($query);
     66        $row = pwg_db_fetch_assoc($result);
     67        $pab=$row['username'];
     68       
     69        $PASPBY = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'see_photos_by_user';"));
     70        $showpab = $conf['Photo_add_by_show'];
     71          if($showpab == 1 and $PASPBY['state'] == 'active'){
     72                $query2 = 'SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU
     73                  FROM ' . USERS_TABLE . ' as UT
     74                  INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id
     75                  INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id
     76                    '.get_sql_condition_FandF
     77                        (
     78                        array
     79           (
     80                   'forbidden_categories' => 'category_id',
     81                   'visible_categories' => 'category_id',
     82                   'visible_images' => 'id'
     83                   ),
     84                   'WHERE'
     85                   ).'
     86                   GROUP BY IT.added_by
     87           HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].'
     88                   ORDER BY '.$conf['see_photos_by_user_order'].'
     89                   LIMIT '.$conf['see_photos_by_user_limit'].';';
     90                $result2 = pwg_query($query2);
     91                $userok = array();
     92                while ($row2 = pwg_db_fetch_assoc($result2)){
     93                  $userok[] = $row2['username'];
     94                }
     95                if(in_array($pab, $userok) and $showpab == 1 and $PASPBY['state'] == 'active'){
     96                  $urlpab = get_root_url().'index.php?/user-'.$userab.'-'.$pab;
     97                  $pab2 ='<a href="'.$urlpab.'">'.$pab.'</a>';
     98                }else{
     99                  $pab2=$pab;
     100                }
     101          }else{
     102            $pab2=$pab;
     103          }
     104        $template->assign(array('PAB' => $pab2,));
    108105  }
    109106}
  • extensions/Photo_add_by/language/en_UK/index.php

    r16859 r31465  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 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 
    242// Recursive call
    253$url = '../';
  • extensions/Photo_add_by/language/en_UK/plugin.lang.php

    r27458 r31465  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Photo added by plugin for Piwigo                                      |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2012-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221$lang['Photo added by'] = 'Photo added by';
    322$lang['Add information before'] = 'Add information before';
  • extensions/Photo_add_by/language/fr_FR/index.php

    r16859 r31465  
    11<?php
    2 // +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based picture gallery                                  |
    4 // +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2009 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 
    242// Recursive call
    253$url = '../';
  • extensions/Photo_add_by/language/fr_FR/plugin.lang.php

    r27458 r31465  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Photo added by plugin for Piwigo                                      |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2012-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221$lang['Photo added by'] = 'Photo Ajoutée par';
    322$lang['Add information before'] = 'Ajouter l\'information avant';
  • extensions/Photo_add_by/main.inc.php

    r30431 r31465  
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=621
    77Author: ddtddt
    8 Author URI:
     8Author URI: http://temmii.com/piwigo/
    99*/
     10
     11// +-----------------------------------------------------------------------+
     12// | Photo added by plugin for Piwigo                                      |
     13// +-----------------------------------------------------------------------+
     14// | Copyright(C) 2012-2016 ddtddt               http://temmii.com/piwigo/ |
     15// +-----------------------------------------------------------------------+
     16// | This program is free software; you can redistribute it and/or modify  |
     17// | it under the terms of the GNU General Public License as published by  |
     18// | the Free Software Foundation                                          |
     19// |                                                                       |
     20// | This program is distributed in the hope that it will be useful, but   |
     21// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     22// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     23// | General Public License for more details.                              |
     24// |                                                                       |
     25// | You should have received a copy of the GNU General Public License     |
     26// | along with this program; if not, write to the Free Software           |
     27// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     28// | USA.                                                                  |
     29// +-----------------------------------------------------------------------+
    1030
    1131if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     
    1737define('PAB_ADMIN',get_root_url().'admin.php?page=plugin-'.PAB_DIR);
    1838
     39add_event_handler('loading_lang', 'Photo_added_by_loading_lang');         
     40function Photo_added_by_loading_lang(){
     41  load_language('plugin.lang', PAB_ADMIN);
     42}
     43
    1944 // Plugin on picture page
    20 if (script_basename() == 'picture') 
    21 
     45if (script_basename() == 'picture'){ 
    2246  include_once(dirname(__FILE__).'/initpicture.php');
    2347}
     
    2549// menu admin
    2650add_event_handler('get_admin_plugin_menu_links', 'PAB_admin_menu');
    27 function PAB_admin_menu($menu)
    28 {
    29 load_language('plugin.lang', PAB_PATH);
    30      
    31     $menu[] = array(
     51function PAB_admin_menu($menu){
     52  $menu[] = array(
    3253    'NAME' => l10n('Photo added by'),
    3354    'URL' => PAB_ADMIN,
    34      );
     55  );
    3556  return $menu;
    3657}
  • extensions/Photo_add_by/maintain.class.php

    r30431 r31465  
    11<?php
     2// +-----------------------------------------------------------------------+
     3// | Photo added by plugin for Piwigo                                      |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2012-2016 ddtddt               http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    221defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    322
Note: See TracChangeset for help on using the changeset viewer.