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 | |
---|
22 | global $page, $conf, $user, $template; |
---|
23 | |
---|
24 | /*test URL*/ |
---|
25 | $testa = explode('user-', $_SERVER['REQUEST_URI']); |
---|
26 | if(!empty($testa[1])){ |
---|
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 | ) . ' |
---|
50 | AND added_by = \'' . $testd[0] . '\' |
---|
51 | ' . $conf['order_by'] . ' |
---|
52 | ;'; |
---|
53 | $page = array_merge |
---|
54 | ( |
---|
55 | $page, array |
---|
56 | ( |
---|
57 | 'title' => '<a href="' . duplicate_index_url(array('start' => 0)) . '">' . $me . '</a>', |
---|
58 | 'items' => array_from_query($query, 'id'), |
---|
59 | ) |
---|
60 | ); |
---|
61 | }else{ |
---|
62 | show_users_home(); |
---|
63 | } |
---|
64 | }else{ |
---|
65 | show_users_home(); |
---|
66 | } |
---|
67 | |
---|
68 | /*fin gestion URL*/ |
---|
69 | |
---|
70 | function show_users_home(){ |
---|
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 | } |
---|
94 | } |
---|
95 | |
---|
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'], |
---|
101 | )); |
---|
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'] = '----------------------'; |
---|
126 | |
---|
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{} |
---|
147 | } |
---|
148 | |
---|
149 | ?> |
---|