source: trunk/admin/admin_upload.php @ 587

Last change on this file since 587 was 587, checked in by z0rglub, 19 years ago
  • function mysql_query replaced by pwg_query : the same with debugging features
  • by default, DEBUG is set to 0 (off)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// |                              admin_upload.php                               |
4// +-----------------------------------------------------------------------+
5// | application   : PhpWebGallery <http://phpwebgallery.net>              |
6// | branch        : BSF (Best So Far)                                     |
7// +-----------------------------------------------------------------------+
8// | file          : $RCSfile$
9// | last update   : $Date: 2004-10-30 15:42:29 +0000 (Sat, 30 Oct 2004) $
10// | last modifier : $Author: z0rglub $
11// | revision      : $Revision: 587 $
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/isadmin.inc.php' );
34$uploadable = '';
35$categories = '';
36
37if (isset($_POST['submit']) || isset($_POST['delete']))
38{
39  $query = 'UPDATE '.CATEGORIES_TABLE;
40  $query.= ' SET uploadable = ';
41  if (isset($_POST['submit'])) 
42    $query.="'true'";
43  else 
44    $query.="'false'";
45  $query.= ' WHERE id IN (';
46  $nb=count($cat_data);
47  foreach($cat_data as $i=>$id)
48 {
49   $query.= $id;
50   if ($i+1<$nb) $query.=',';
51 } 
52 $query.=');';
53 pwg_query ($query);
54}
55
56// Cache management
57$query = 'SELECT id, name, uploadable FROM '.CATEGORIES_TABLE;
58$query.= ' WHERE dir IS NOT NULL';
59$query.= ' ORDER BY name ASC';
60$query.= ';';
61$result = pwg_query( $query );
62while ( $row = mysql_fetch_assoc( $result ) )
63{
64  if ($row['uploadable'] == 'false')
65  {
66    $categories.='<option value="'.$row['id'].'">'.$row['name'].'</option>';
67  }
68  else 
69  {
70    $uploadable.='<option value="'.$row['id'].'">'.$row['name'].'</option>';
71  }
72}
73
74//----------------------------------------------------- template initialization
75$template->set_filenames( array('upload'=>'admin/admin_upload.tpl') );
76
77$template->assign_vars(array(
78  'PRIVATE_CATEGORIES'=>$categories,
79  'UPLOADABLE_CATEGORIES'=>$uploadable,
80 
81  'L_UPLOAD_TITLE'=>$lang['cat_upload'],
82  'L_SUBMIT'=>$lang['submit'],
83  'L_DELETE'=>$lang['delete'],
84  'L_RESET'=>$lang['reset'],
85  'L_UPLOAD_INFO'=>$lang['cat_upload_info'],
86  'L_AUTHORIZED'=>$lang['authorized'],
87  'L_FORBIDDEN'=>$lang['forbidden']
88  ));
89
90//----------------------------------------------------------- sending html code
91$template->assign_var_from_handle('ADMIN_CONTENT', 'upload');
92
93?>
Note: See TracBrowser for help on using the repository browser.