Changeset 31460 for extensions/see_photos_by_user
- Timestamp:
- Mar 19, 2016, 6:33:31 AM (8 years ago)
- Location:
- extensions/see_photos_by_user
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/see_photos_by_user/admin.php
r30432 r31460 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 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 // +-----------------------------------------------------------------------+ 3 21 if (!defined('PHPWG_ROOT_PATH')) 4 22 die('Hacking attempt!'); 5 23 global $template, $conf, $user; 6 include_once(PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php');7 load_language('plugin.lang', SPBA_PATH);8 $my_base_url = get_admin_plugin_menu_link(__FILE__);9 24 10 25 // +-----------------------------------------------------------------------+ … … 16 31 17 32 $template->assign( 18 19 20 21 22 23 24 25 26 27 33 array( 34 'SPBU1' => $conf['see_photos_by_user_nbphotos'], 35 'SPBU2' => $conf['see_photos_by_user_limit'], 36 'SPBU3' => $conf['see_photos_by_user_order'], 37 'SPBU4' => $conf['see_photos_by_user_show'], 38 'SPBU5' => $conf['see_photos_by_user_color'], 39 'SPBU6' => $conf['see_photos_by_user_show_user_home'], 40 'SPBU7' => $conf['see_photos_by_user_shape'], 41 'SPBA_PATH2'=> get_root_url() . SPBA_PATH, 42 ) 28 43 ); 29 44 30 45 $SPBU3T = array( 31 32 33 34 46 l10n('users in alphabetical order'), 47 l10n('users by reverse alphabetical order'), 48 l10n('by increasing number of photos'), 49 l10n('by decreasing number of photos'), 35 50 ); 36 51 37 52 $SPBU3 = array( 38 39 40 41 53 'username ASC', 54 'username DESC', 55 'PBU ASC', 56 'PBU DESC', 42 57 ); 43 58 … … 46 61 47 62 $PAPAB = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'Photo_add_by';")); 48 if($PAPAB['state'] == 'active') 49 { 50 $SPBU3T2 = array( 63 if($PAPAB['state'] == 'active'){ 64 $SPBU3T2 = array( 51 65 l10n('nothing'), 52 66 l10n('link Specials menu'), 53 67 l10n('bloc menu users'), 54 55 68 ); 69 $SPBU32 = array( 56 70 '-1', 57 71 '1', … … 59 73 ); 60 74 }else{ 61 75 $SPBU3T2 = array( 62 76 l10n('link Specials menu'), 63 77 l10n('bloc menu users'), 64 65 66 67 68 78 ); 79 $SPBU32 = array( 80 '1', 81 '2', 82 ); 69 83 } 70 84 … … 73 87 74 88 $SPBU4T2 = array( 75 // l10n('nothing'), 76 l10n('users cloud'), 77 l10n('cumulus users cloud'), 78 l10n('select users box'), 89 l10n('users cloud'), 90 l10n('cumulus users cloud'), 91 l10n('select users box'), 79 92 ); 80 93 81 94 $SPBU42 = array( 82 // '-1', 83 '1', 84 '2', 85 '3' 95 '1', 96 '2', 97 '3' 86 98 ); 87 99 … … 90 102 91 103 $SPBU7 = array( 92 93 94 95 96 104 'sphere', 105 'vcylinder', 106 'hcylinder', 107 'vring', 108 'hring', 97 109 ); 98 110 99 111 $SPBUT7 = array( 100 101 102 103 104 112 l10n('sphere'), 113 l10n('vertical cylinder'), 114 l10n('horizontal cylinder'), 115 l10n('vertical ring'), 116 l10n('horizontal ring'), 105 117 ); 106 118 … … 109 121 110 122 if (isset($_POST['submitspbu'])) { 111 if (is_numeric($_POST['insspbu1'])) { 112 conf_update_param('see_photos_by_user_nbphotos', $_POST['insspbu1']); 113 } else { 114 array_push($page['errors'], l10n('Maximal number users is incorrect !')); 115 } 116 if (is_numeric($_POST['insspbu2'])) 117 conf_update_param('see_photos_by_user_limit', $_POST['insspbu2']); 118 else { 119 array_push($page['errors'], l10n('Minimal number photos for show users is incorrect !')); 120 } 121 conf_update_param('see_photos_by_user_order', $_POST['insspbu3']); 122 conf_update_param('see_photos_by_user_show', $_POST['insspbu4']); 123 conf_update_param('see_photos_by_user_color', $_POST['insspbu5']); 124 conf_update_param('see_photos_by_user_show_user_home', $_POST['insspbu6']); 125 conf_update_param('see_photos_by_user_shape', $_POST['insspbu7']); 126 if (!$page['errors']) { 127 array_push($page['infos'], l10n('Update Complete')); 128 } 129 130 $template->assign( 131 array( 132 'SPBU1' => stripslashes($_POST['insspbu1']), 133 'SPBU2' => stripslashes($_POST['insspbu2']), 134 'SPBU3' => stripslashes($_POST['insspbu3']), 135 'SPBU4' => stripslashes($_POST['insspbu4']), 136 'SPBU5' => stripslashes($_POST['insspbu5']), 137 'SPBU6' => stripslashes($_POST['insspbu6']), 138 'SPBU7' => stripslashes($_POST['insspbu7']), 139 ) 140 ); 123 if (is_numeric($_POST['insspbu1'])) { 124 conf_update_param('see_photos_by_user_nbphotos', $_POST['insspbu1']); 125 } else { 126 array_push($page['errors'], l10n('Maximal number users is incorrect !')); 127 } 128 if (is_numeric($_POST['insspbu2'])) 129 conf_update_param('see_photos_by_user_limit', $_POST['insspbu2']); 130 else { 131 array_push($page['errors'], l10n('Minimal number photos for show users is incorrect !')); 132 } 133 conf_update_param('see_photos_by_user_order', $_POST['insspbu3']); 134 conf_update_param('see_photos_by_user_show', $_POST['insspbu4']); 135 conf_update_param('see_photos_by_user_color', $_POST['insspbu5']); 136 conf_update_param('see_photos_by_user_show_user_home', $_POST['insspbu6']); 137 conf_update_param('see_photos_by_user_shape', $_POST['insspbu7']); 138 if (!$page['errors']) { 139 array_push($page['infos'], l10n('Update Complete')); 140 } 141 $template->assign( 142 array( 143 'SPBU1' => stripslashes($_POST['insspbu1']), 144 'SPBU2' => stripslashes($_POST['insspbu2']), 145 'SPBU3' => stripslashes($_POST['insspbu3']), 146 'SPBU4' => stripslashes($_POST['insspbu4']), 147 'SPBU5' => stripslashes($_POST['insspbu5']), 148 'SPBU6' => stripslashes($_POST['insspbu6']), 149 'SPBU7' => stripslashes($_POST['insspbu7']), 150 ) 151 ); 141 152 } 142 153 -
extensions/see_photos_by_user/include/function.see.inc.php
r30497 r31460 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 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 // +-----------------------------------------------------------------------+ 3 21 function see_username($id_user){ 4 $query = ' 5 SELECT id, username 6 FROM ' . USERS_TABLE . ' 7 WHERE id = \'' . $id_user . '\' 8 ;'; 9 $result = pwg_query($query); 10 $row = pwg_db_fetch_assoc($result); 11 $username = str_replace(' ','_',$row['username']); 12 $username = str_replace('.','_',$username); 13 return $username; 22 $query = 'SELECT id, username FROM ' . USERS_TABLE . ' WHERE id = \'' . $id_user . '\';'; 23 $result = pwg_query($query); 24 $row = pwg_db_fetch_assoc($result); 25 $username = str_replace(' ','_',$row['username']); 26 $username = str_replace('.','_',$username); 27 return $username; 14 28 } 15 29 16 30 function see_userlist_nb_photo(){ 17 global $conf; 18 $query = ' 19 SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU 20 FROM ' . USERS_TABLE . ' as UT 21 INNER JOIN ' . IMAGES_TABLE . ' AS IT ON IT.added_by = UT.id 22 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON IT.id = ic.image_id 23 ' . get_sql_condition_FandF 24 ( 25 array 26 ( 27 'forbidden_categories' => 'category_id', 28 'visible_categories' => 'category_id', 29 'visible_images' => 'id' 30 ), 'WHERE' 31 ) . ' 32 GROUP BY IT.added_by 33 HAVING PBU >' . $conf['see_photos_by_user_nbphotos'] . ' 34 ORDER BY ' . $conf['see_photos_by_user_order'] . ' 35 LIMIT ' . $conf['see_photos_by_user_limit'] . ';'; 31 global $conf; 32 $query = ' 33 SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU 34 FROM ' . USERS_TABLE . ' as UT 35 INNER JOIN ' . IMAGES_TABLE . ' AS IT ON IT.added_by = UT.id 36 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON IT.id = ic.image_id 37 ' . get_sql_condition_FandF( 38 array( 39 'forbidden_categories' => 'category_id', 40 'visible_categories' => 'category_id', 41 'visible_images' => 'id' 42 ), 'WHERE' 43 ) . ' 44 GROUP BY IT.added_by 45 HAVING PBU >' . $conf['see_photos_by_user_nbphotos'] . ' 46 ORDER BY ' . $conf['see_photos_by_user_order'] . ' 47 LIMIT ' . $conf['see_photos_by_user_limit'] . ';'; 36 48 37 $result = pwg_query($query); 38 39 return $result; 49 $result = pwg_query($query); 50 return $result; 40 51 } 41 52 42 53 function see_nb_photo(){ 43 $query = ' 44 SELECT COUNT(DISTINCT(id)) AS PBU 45 FROM ' . IMAGES_TABLE . ';'; 46 47 $result = pwg_query($query); 48 $row = pwg_db_fetch_assoc($result); 49 50 return $row['PBU']; 54 $query = 'SELECT COUNT(DISTINCT(id)) AS PBU FROM ' . IMAGES_TABLE . ';'; 55 $result = pwg_query($query); 56 $row = pwg_db_fetch_assoc($result); 57 return $row['PBU']; 51 58 } 52 59 53 54 60 ?> -
extensions/see_photos_by_user/index.php
r26643 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+3 // | Piwigo - a PHP based picture gallery |4 // +-----------------------------------------------------------------------+5 // | Copyright(C) 2008-2014 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 2 // Recursive call 25 3 $url = '../'; -
extensions/see_photos_by_user/language/en_UK/index.php
r26643 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+3 // | Piwigo - a PHP based picture gallery |4 // +-----------------------------------------------------------------------+5 // | Copyright(C) 2008-2014 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 2 // Recursive call 25 3 $url = '../'; -
extensions/see_photos_by_user/language/en_UK/plugin.lang.php
r30429 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 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 // +-----------------------------------------------------------------------+ 2 21 $lang['See photos by user'] = 'See photos by user'; 3 22 $lang['select user'] = 'select user'; -
extensions/see_photos_by_user/language/fr_FR/index.php
r26643 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+3 // | Piwigo - a PHP based picture gallery |4 // +-----------------------------------------------------------------------+5 // | Copyright(C) 2008-2014 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 2 // Recursive call 25 3 $url = '../'; -
extensions/see_photos_by_user/language/fr_FR/plugin.lang.php
r30721 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 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 // +-----------------------------------------------------------------------+ 2 21 $lang['See photos by user'] = 'Voir les photos par utilisateur'; 3 22 $lang['select user'] = 'selectionner un utilisateur'; -
extensions/see_photos_by_user/language/index.php
r26635 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+3 // | Piwigo - a PHP based picture gallery |4 // +-----------------------------------------------------------------------+5 // | Copyright(C) 2008-2014 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 2 // Recursive call 25 3 $url = '../'; -
extensions/see_photos_by_user/main.inc.php
r30497 r31460 1 1 <?php 2 3 2 /* 4 3 Plugin Name: See photos by user … … 7 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=723 8 7 Author: ddtddt 9 Author URI: 10 */ 8 Author URI: http://temmii.com/piwigo/ 9 */ 10 // +-----------------------------------------------------------------------+ 11 // | See photos by user plugin for piwigo | 12 // +-----------------------------------------------------------------------+ 13 // | Copyright(C) 2014 - 2016 ddtddt http://temmii.com/piwigo/ | 14 // +-----------------------------------------------------------------------+ 15 // | This program is free software; you can redistribute it and/or modify | 16 // | it under the terms of the GNU General Public License as published by | 17 // | the Free Software Foundation | 18 // | | 19 // | This program is distributed in the hope that it will be useful, but | 20 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 21 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 22 // | General Public License for more details. | 23 // | | 24 // | You should have received a copy of the GNU General Public License | 25 // | along with this program; if not, write to the Free Software | 26 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 27 // | USA. | 28 // +-----------------------------------------------------------------------+ 11 29 12 30 if (!defined('PHPWG_ROOT_PATH')) … … 16 34 define('SPBA_PATH', PHPWG_PLUGINS_PATH . SPBA_DIR . '/'); 17 35 define('SPBA_ADMIN',get_root_url().'admin.php?page=plugin-'.SPBA_DIR); 18 load_language('plugin.lang', SPBA_PATH);19 36 20 37 include_once(SPBA_PATH . 'include/function.see.inc.php'); 38 39 add_event_handler('loading_lang', 'see_photos_by_user_loading_lang'); 40 function see_photos_by_user_loading_lang(){ 41 load_language('plugin.lang', SPBA_PATH); 42 load_language('lang', PHPWG_ROOT_PATH . 'local/', array('no_fallback' => true, 'local' => true)); 43 } 44 45 21 46 global $conf; 22 47 23 48 /*init plugin - filter http*/ 24 49 add_event_handler('loc_end_section_init', 'section_init_SPBA'); 25 function section_init_SPBA() { 26 /*init plugin lang*/ 27 load_language('plugin.lang', SPBA_PATH); 28 load_language('lang', PHPWG_ROOT_PATH . 'local/', array('no_fallback' => true, 'local' => true)); 29 30 global $tokens, $conf, $template; 50 function section_init_SPBA(){ 51 global $tokens, $conf, $template; 31 52 if(strpbrk('user-', $_SERVER['REQUEST_URI'])!=false){ 32 53 $testa = explode('user-', $_SERVER['REQUEST_URI']); … … 58 79 } 59 80 } 60 61 //$template->assign('SPBA2', 'toto');62 81 $template->set_filename('SPBA', realpath(SPBA_PATH . 'pagespba.tpl')); 63 82 $template->assign_var_from_handle('CONTENT', 'SPBA'); //2.6 64 65 83 } 66 67 68 69 84 70 85 /*Schow link in menu*/ … … 73 88 } 74 89 75 function add_link_SPBA($menu_ref_arr) 90 function add_link_SPBA($menu_ref_arr){ 76 91 global $conf, $user; 77 92 $menu = & $menu_ref_arr[0]; 78 93 if (($block = $menu->get_block('mbSpecials')) != null) { 79 load_language('plugin.lang', SPBA_PATH);80 94 $position = (isset($conf['SPBA_position']) and is_numeric($conf['SPBA_position'])) ? $conf['SPBA_position'] : count($block->data) + 1; 81 95 array_splice … … 92 106 } 93 107 } 94 95 108 96 109 /*schow users menu*/ … … 137 150 138 151 function SPBA_admin_menu($menu) { 139 /*load_language('plugin.lang', SPBA_PATH); 140 array_push( 141 $menu, array( 142 'NAME' => l10n('Photos by user'), 143 'URL' => get_admin_plugin_menu_link(SPBA_PATH . 'admin.php') 144 ) 145 );*/ 146 load_language('plugin.lang', SPBA_PATH); 147 $menu[] = array( 152 $menu[] = array( 148 153 'NAME' => l10n('Photos by user'), 149 154 'URL' => SPBA_ADMIN, 150 155 ); 151 152 153 return $menu; 156 return $menu; 154 157 } 155 158 -
extensions/see_photos_by_user/maintain.class.php
r30768 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 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 // +-----------------------------------------------------------------------+ 2 21 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 22 -
extensions/see_photos_by_user/pagespba.php
r30430 r31460 1 1 <?php 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 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 2 22 global $page, $conf, $user, $template; 3 23 4 24 /*test URL*/ 5 6 25 $testa = explode('user-', $_SERVER['REQUEST_URI']); 7 26 if(!empty($testa[1])){ 8 $testd = explode('-', $testa[1]); 9 if(is_numeric($testd[0])){ 10 11 $username= see_username($testd[0]); 12 13 14 $me = 'user-' . $testd[0].'-'.$username; 15 16 $page['section'] = $me; 17 $page['section_title'] = '<a href="' . get_absolute_root_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/user-">' . l10n('Users').'</a>'. $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/' . $me . '">'.$username. '</a>'; 18 19 $template->assign( 20 'gestionB', array( 21 'USERUSBU' => $username, 22 )); 23 24 $query = ' 25 SELECT DISTINCT(id) 26 FROM ' . IMAGES_TABLE . ' 27 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON id = ic.image_id 28 ' . get_sql_condition_FandF 29 ( 30 array 31 ( 32 'forbidden_categories' => 'category_id', 33 'visible_categories' => 'category_id', 34 'visible_images' => 'id' 35 ), 'WHERE' 36 ) . ' 27 $testd = explode('-', $testa[1]); 28 if(is_numeric($testd[0])){ 29 $username= see_username($testd[0]); 30 $me = 'user-' . $testd[0].'-'.$username; 31 $page['section'] = $me; 32 $page['section_title'] = '<a href="' . get_absolute_root_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/user-">' . l10n('Users').'</a>'. $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/' . $me . '">'.$username. '</a>'; 33 $template->assign( 34 'gestionB', array( 35 'USERUSBU' => $username, 36 )); 37 $query = ' 38 SELECT DISTINCT(id) 39 FROM ' . IMAGES_TABLE . ' 40 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON id = ic.image_id 41 ' . get_sql_condition_FandF 42 ( 43 array 44 ( 45 'forbidden_categories' => 'category_id', 46 'visible_categories' => 'category_id', 47 'visible_images' => 'id' 48 ), 'WHERE' 49 ) . ' 37 50 AND added_by = \'' . $testd[0] . '\' 38 51 ' . $conf['order_by'] . ' 39 52 ;'; 40 41 42 43 53 $page = array_merge 54 ( 55 $page, array 56 ( 44 57 'title' => '<a href="' . duplicate_index_url(array('start' => 0)) . '">' . $me . '</a>', 45 58 'items' => array_from_query($query, 'id'), 46 47 48 49 50 59 ) 60 ); 61 }else{ 62 show_users_home(); 63 } 51 64 }else{ 52 65 show_users_home(); … … 56 69 57 70 function show_users_home(){ 58 59 /*users cloud*/ 60 // template vars 61 global $page, $conf, $user, $template; 62 63 $me = 'user-'; 64 $page['section'] = $me; 65 $page['section_title'] = '<a href="' . get_absolute_root_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/' . $me . '">' . l10n('Users') . '</a>'; 66 67 $userslistecloud1 = see_userlist_nb_photo(); 68 $level=see_nb_photo(); 69 70 if (pwg_db_num_rows($userslistecloud1)) { 71 while ($userslistecloud = pwg_db_fetch_assoc($userslistecloud1)) { 72 if($userslistecloud['PBU']>$level*4/5){$wheight=5;} 73 else if($userslistecloud['PBU']>$level*3/5){$wheight=4;} 74 else if($userslistecloud['PBU']>$level*2/5){$wheight=3;} 75 else if($userslistecloud['PBU']>$level*1/5){$wheight=2;} 76 else{$wheight=1;} 77 78 $items = array( 79 'USERSSPBYLID' => $userslistecloud['id'], 80 'USERSSPBYL' => $userslistecloud['username'], 81 'USERSSPBYLC' => $userslistecloud['PBU'], 82 'USERSSPBYWEIGHT' => $wheight, 83 ); 84 85 $template->append('userslistecloud1', $items); 86 } 71 /*users cloud*/ 72 // template vars 73 global $page, $conf, $user, $template; 74 $me = 'user-'; 75 $page['section'] = $me; 76 $page['section_title'] = '<a href="' . get_absolute_root_url() . '">' . l10n('Home') . '</a>' . $conf['level_separator'] . '<a href="' . get_absolute_root_url() . 'index.php?/' . $me . '">' . l10n('Users') . '</a>'; 77 $userslistecloud1 = see_userlist_nb_photo(); 78 $level=see_nb_photo(); 79 if (pwg_db_num_rows($userslistecloud1)) { 80 while ($userslistecloud = pwg_db_fetch_assoc($userslistecloud1)) { 81 if($userslistecloud['PBU']>$level*4/5){$wheight=5;} 82 else if($userslistecloud['PBU']>$level*3/5){$wheight=4;} 83 else if($userslistecloud['PBU']>$level*2/5){$wheight=3;} 84 else if($userslistecloud['PBU']>$level*1/5){$wheight=2;} 85 else{$wheight=1;} 86 $items = array( 87 'USERSSPBYLID' => $userslistecloud['id'], 88 'USERSSPBYL' => $userslistecloud['username'], 89 'USERSSPBYLC' => $userslistecloud['PBU'], 90 'USERSSPBYWEIGHT' => $wheight, 91 ); 92 $template->append('userslistecloud1', $items); 93 } 87 94 } 88 95 89 90 $linkusersliste = get_root_url() . 'index.php?/user-'; 91 $template->assign(array( 92 'USERSSPBY'=> $linkusersliste, 93 'USERSSPBYCOLOR' => $conf['see_photos_by_user_color'], 94 'USERSSPBYSHAPE' => $conf['see_photos_by_user_shape'], 95 )); 96 97 98 if($conf['see_photos_by_user_show_user_home']==1){ 99 $template->assign( 100 'gestionD', array( 101 'SPBA_PATH'=> get_root_url() . SPBA_PATH, 96 $linkusersliste = get_root_url() . 'index.php?/user-'; 97 $template->assign(array( 98 'USERSSPBY'=> $linkusersliste, 99 'USERSSPBYCOLOR' => $conf['see_photos_by_user_color'], 100 'USERSSPBYSHAPE' => $conf['see_photos_by_user_shape'], 102 101 )); 103 }else if($conf['see_photos_by_user_show_user_home']==2){ 104 $template->assign( 105 'gestionC', array( 106 'SPBA_PATH'=> get_root_url() . SPBA_PATH, 107 )); 108 109 }else if($conf['see_photos_by_user_show_user_home']==3){ 110 $groups = array(); 111 $result = see_userlist_nb_photo(); 112 while ($row = pwg_db_fetch_assoc($result)) { 113 $groups[$row['id']] = $row['username'] . ' (' . $row['PBU'] . ')'; 114 } 115 $selected = 0; 116 if (empty($testd[0])) { 117 $options['b'] = l10n('select user'); 118 } else { 119 $options['b'] = l10n('select other user'); 120 } 121 $options['a'] = '----------------------'; 102 103 if($conf['see_photos_by_user_show_user_home']==1){ 104 $template->assign( 105 'gestionD', array( 106 'SPBA_PATH'=> get_root_url() . SPBA_PATH, 107 )); 108 }else if($conf['see_photos_by_user_show_user_home']==2){ 109 $template->assign( 110 'gestionC', array( 111 'SPBA_PATH'=> get_root_url() . SPBA_PATH, 112 )); 113 }else if($conf['see_photos_by_user_show_user_home']==3){ 114 $groups = array(); 115 $result = see_userlist_nb_photo(); 116 while ($row = pwg_db_fetch_assoc($result)) { 117 $groups[$row['id']] = $row['username'] . ' (' . $row['PBU'] . ')'; 118 } 119 $selected = 0; 120 if (empty($testd[0])) { 121 $options['b'] = l10n('select user'); 122 } else { 123 $options['b'] = l10n('select other user'); 124 } 125 $options['a'] = '----------------------'; 122 126 123 foreach ($groups as $metalist => $metalist2) { 124 $options[$metalist] = $metalist2; 125 } 126 $template->assign( 127 'gestionA', array( 128 'OPTIONS' => $options, 129 'SELECTED' => $selected 130 )); 131 if (isset($_POST['submitchoixauteur'])) { 132 $redirect_url = get_root_url() . 'index.php?/user-'; 133 if(is_numeric($_POST['metalist'])){ 134 $query = ' 135 SELECT id, username 136 FROM ' . USERS_TABLE . ' 137 WHERE id = \'' . $_POST['metalist'] . '\' 138 ;'; 139 $result = pwg_query($query); 140 $row = pwg_db_fetch_assoc($result); 141 $username = $row['username']; 142 143 $redirect_url .=($_POST['metalist']).'-'.$username; 144 } 145 redirect($redirect_url); 146 } 147 }else{} 148 149 127 foreach ($groups as $metalist => $metalist2) { 128 $options[$metalist] = $metalist2; 129 } 130 $template->assign( 131 'gestionA', array( 132 'OPTIONS' => $options, 133 'SELECTED' => $selected 134 )); 135 if (isset($_POST['submitchoixauteur'])) { 136 $redirect_url = get_root_url() . 'index.php?/user-'; 137 if(is_numeric($_POST['metalist'])){ 138 $query = 'SELECT id, username FROM ' . USERS_TABLE . ' WHERE id = \'' . $_POST['metalist'] . '\';'; 139 $result = pwg_query($query); 140 $row = pwg_db_fetch_assoc($result); 141 $username = $row['username']; 142 $redirect_url .=($_POST['metalist']).'-'.$username; 143 } 144 redirect($redirect_url); 145 } 146 }else{} 150 147 } 151 148 152 153 149 ?>
Note: See TracChangeset
for help on using the changeset viewer.