source: extensions/see_photos_by_user/admin.php @ 31930

Revision 31460, 5.0 KB checked in by ddtddt, 4 years ago (diff)

[extensions] - see_photos_by_user - 2.8

Line 
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// +-----------------------------------------------------------------------+
21if (!defined('PHPWG_ROOT_PATH'))
22    die('Hacking attempt!');
23global $template, $conf, $user;
24
25// +-----------------------------------------------------------------------+
26// | Check Access and exit when user status is not ok                      |
27// +-----------------------------------------------------------------------+
28check_status(ACCESS_ADMINISTRATOR);
29
30global $conf, $page;
31
32$template->assign(
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  )
43);
44
45$SPBU3T = array(
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'),
50);
51
52$SPBU3 = array(
53  'username ASC',
54  'username DESC',
55  'PBU ASC',
56  'PBU DESC',
57);
58
59$template->assign('spbu', $SPBU3);
60$template->assign('spbuT', $SPBU3T);
61
62$PAPAB = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'Photo_add_by';"));
63if($PAPAB['state'] == 'active'){
64  $SPBU3T2 = array(
65    l10n('nothing'),
66    l10n('link Specials menu'),
67    l10n('bloc menu users'),
68  );
69  $SPBU32 = array(
70    '-1',
71    '1',
72    '2',
73    ); 
74}else{
75  $SPBU3T2 = array(
76    l10n('link Specials menu'),
77    l10n('bloc menu users'),
78  );
79  $SPBU32 = array(
80        '1',
81        '2',
82  );
83}
84
85$template->assign('spbu2', $SPBU32);
86$template->assign('spbuT2', $SPBU3T2);
87
88$SPBU4T2 = array(
89  l10n('users cloud'),
90  l10n('cumulus users cloud'),
91  l10n('select users box'),
92);
93
94$SPBU42 = array(
95  '1',
96  '2',
97  '3'
98);
99
100$template->assign('spbu6', $SPBU42);
101$template->assign('spbuT6', $SPBU4T2);
102
103$SPBU7 = array(
104  'sphere',
105  'vcylinder',
106  'hcylinder',
107  'vring',
108  'hring',
109);
110
111$SPBUT7 = array(
112  l10n('sphere'),
113  l10n('vertical cylinder'),
114  l10n('horizontal cylinder'),
115  l10n('vertical ring'),
116  l10n('horizontal ring'),
117);
118
119$template->assign('spbu7', $SPBU7);
120$template->assign('spbuT7', $SPBUT7);
121
122if (isset($_POST['submitspbu'])) {
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  );
152}
153
154$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/admin.tpl'));
155$template->assign_var_from_handle('ADMIN_CONTENT','plugin_admin_content');
156?>
Note: See TracBrowser for help on using the repository browser.