source: extensions/community/admin_config.php @ 27781

Last change on this file since 27781 was 23085, checked in by plg, 11 years ago

New feature: user album. Only for registered users, no recursivity. Piwigo
will automatically create an upload album for each user with appropriate
community permissions, at first connection.

Bug fixed: on activation, do not create a new "Community" album if it already
exists.

Bug fixed: remove debug for quota

Bug fixed: round corners for number of pending pictures in admin menu.

File size: 4.5 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2011 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
24if( !defined("PHPWG_ROOT_PATH") )
25{
26  die ("Hacking attempt!");
27}
28
29include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
30include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
31load_language('plugin.lang', COMMUNITY_PATH);
32
33$admin_base_url = get_root_url().'admin.php?page=plugin-community-config';
34
35// +-----------------------------------------------------------------------+
36// | Check Access and exit when user status is not ok                      |
37// +-----------------------------------------------------------------------+
38
39check_status(ACCESS_ADMINISTRATOR);
40
41// +-----------------------------------------------------------------------+
42// |                                actions                                |
43// +-----------------------------------------------------------------------+
44
45if (!empty($_POST))
46{
47  check_input_parameter('user_albums_parent', $_POST, false, PATTERN_ID);
48
49  $conf['community'] = array(
50    'user_albums' => !empty($_POST['user_albums']),
51    'user_albums_parent' => $_POST['user_albums_parent'],
52    );
53
54  conf_update_param('community', serialize($conf['community']));
55 
56  array_push($page['infos'], l10n('Information data registered in database'));
57}
58
59// +-----------------------------------------------------------------------+
60// | template init                                                         |
61// +-----------------------------------------------------------------------+
62
63$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin_config.tpl');
64
65// +-----------------------------------------------------------------------+
66// | form options                                                          |
67// +-----------------------------------------------------------------------+
68
69$template->assign('user_albums', $conf['community']['user_albums']);
70
71if (isset($conf['community']['user_albums_parent']))
72{
73  $category_options_selected = $conf['community']['user_albums_parent'];
74}
75else
76{
77  // is there a "Community" album?
78  $query = '
79SELECT
80    id
81  FROM '.CATEGORIES_TABLE.'
82  WHERE name = \'Community\'
83;';
84  $result = pwg_query($query);
85  while ($row = pwg_db_fetch_assoc($result))
86  {
87    $category_options_selected = $row['id'];
88    break;
89  }
90}
91
92// list of albums
93$query = '
94SELECT id,name,uppercats,global_rank
95  FROM '.CATEGORIES_TABLE.'
96;';
97
98display_select_cat_wrapper(
99  $query,
100  isset($category_options_selected) ? $category_options_selected : array(),
101  'category_options'
102  );
103
104// image level options
105$selected_level = isset($_POST['level']) ? $_POST['level'] : 0;
106$template->assign(
107    array(
108      'level_options'=> get_privacy_level_options(),
109      'level_options_selected' => array($selected_level)
110    )
111  );
112
113
114// +-----------------------------------------------------------------------+
115// | sending html code                                                     |
116// +-----------------------------------------------------------------------+
117
118$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
119?>
Note: See TracBrowser for help on using the repository browser.