source: extensions/see_photos_by_user/admin.php @ 31930

Last change on this file since 31930 was 31460, checked in by ddtddt, 8 years ago

[extensions] - see_photos_by_user - 2.8

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