source: trunk/admin/cat_move.php @ 1072

Revision 1072, 4.2 KB checked in by rub, 14 years ago (diff)

Step 2 improvement issue 0000301:

o Add and use Functions Check of status
o Restricted Access for user generic

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date$
10// | last modifier : $Author$
11// | revision      : $Revision$
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28if (!defined('PHPWG_ROOT_PATH'))
29{
30  die('Hacking attempt!');
31}
32
33include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
34
35// +-----------------------------------------------------------------------+
36// | Check Access and exit when user status is not ok                      |
37// +-----------------------------------------------------------------------+
38check_status(ACCESS_ADMINISTRATOR);
39
40// +-----------------------------------------------------------------------+
41// |                               functions                               |
42// +-----------------------------------------------------------------------+
43
44
45// +-----------------------------------------------------------------------+
46// |                          categories movement                          |
47// +-----------------------------------------------------------------------+
48
49if (isset($_POST['submit']))
50{
51  if (count($_POST['selection']) > 0)
52  {
53    // TODO: tests
54    move_categories($_POST['selection'], $_POST['parent']);
55  }
56  else
57  {
58    array_push(
59      $page['errors'],
60      l10n('Select at least one category')
61      );
62  }
63}
64
65// +-----------------------------------------------------------------------+
66// |                       template initialization                         |
67// +-----------------------------------------------------------------------+
68
69$template->set_filenames(
70  array(
71    'cat_move' => 'admin/cat_move.tpl'
72    )
73  );
74
75$template->assign_vars(
76  array(
77    'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=cat_move',
78    )
79  );
80 
81// +-----------------------------------------------------------------------+
82// |                          Categories display                           |
83// +-----------------------------------------------------------------------+
84
85$query = '
86SELECT id,name,uppercats,global_rank
87  FROM '.CATEGORIES_TABLE.'
88  WHERE dir IS NULL
89;';
90
91display_select_cat_wrapper(
92  $query,
93  array(),
94  'category_option_selection'
95  );
96
97$blockname = 'category_option_parent';
98
99$template->assign_block_vars(
100  $blockname,
101  array(
102    'VALUE'=> 0,
103    'OPTION' => '------------'
104    )
105  );
106
107$query = '
108SELECT id,name,uppercats,global_rank
109  FROM '.CATEGORIES_TABLE.'
110;';
111
112display_select_cat_wrapper(
113  $query,
114  array(),
115  $blockname
116  );
117
118// +-----------------------------------------------------------------------+
119// |                          sending html code                            |
120// +-----------------------------------------------------------------------+
121
122$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_move');
123?>
Note: See TracBrowser for help on using the repository browser.