Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezforum/admin/categoryedit.php
Go to the documentation of this file.
1 <?php
3 // $Id: categoryedit.php 7370 2001-09-21 11:12:52Z jhe $
4 //
5 // Created on: Created on: <14-Jul-2000 13:41:35 lw>
6 //
7 // This source file is part of Exponential Basic, publishing software.
8 //
9 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
10 //
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
24 //
25
26 // include_once( "classes/INIFile.php" );
27 // include_once( "classes/ezhttptool.php" );
28
29 $ini =& eZINI::instance( 'site.ini' );
30
31 $Language = $ini->variable( "eZForumMain", "Language" );
32 $error = new eZINI( "kernel/ezforum/admin/intl/" . $Language . "/categoryedit.php.ini", false );
33
34 // include_once( "classes/ezdb.php" );
35 // include_once( "classes/eztemplate.php" );
36 // include_once( "classes/ezlog.php" );
37 // include_once( "classes/ezcachefile.php" );
38
39 // include_once( "ezforum/classes/ezforumcategory.php" );
40 // include_once( "ezsitemanager/classes/ezsection.php" );
41
42 require( "kernel/ezuser/admin/admincheck.php" );
43
44 if ( isset( $DeleteCategories ) )
45 {
46 $Action = "DeleteCategories";
47 }
48
49 $cat = new eZForumCategory();
50
51
52 if ( $Action == "insert" )
53 {
54
55 if ( eZPermission::checkPermission( $user, "eZForum", "CategoryAdd" ) )
56 {
57 // clear the menu cache
58 $files =& eZCacheFile::files( "kernel/ezforum/cache/",
59 array( "menubox",
60 NULL ),
61 "cache", "," );
62 foreach ( $files as $file )
63 {
64 $file->delete();
65 }
66
67 if ( $Name != "" && $Description != "" )
68 {
69 $cat = new eZForumCategory();
70 $cat->setName( $Name );
71 $cat->setDescription( $Description );
72 $cat->setSectionID( $SectionID );
73
74 $cat->store();
75 eZPBLog::writeNotice( "Forum category created: $Name from IP: $REMOTE_ADDR" );
76 eZHTTPTool::header( "Location: /forum/categorylist/" );
77 }
78 else
79 {
80 eZPBLog::writeWarning( "Forum category not created: missing data from IP: $REMOTE_ADDR" );
81 $error_msg = $error->variable( "strings", "error_missingdata" );
82 }
83 }
84 else
85 {
86 eZHTTPTool::header( "Location: /forum/norights" );
87 exit();
88 }
89 }
90
91 if ( $Action == "delete" )
92 {
93 if ( eZPermission::checkPermission( $user, "eZForum", "CategoryDelete" ) )
94 {
95 // clear the menu cache
96 $files =& eZCacheFile::files( "kernel/ezforum/cache/",
97 array( "menubox",
98 NULL ),
99 "cache", "," );
100 foreach ( $files as $file )
101 {
102 $file->delete();
103 }
104
105 if ( $CategoryID != "" )
106 {
107 $cat = new eZForumCategory();
108 $cat->get( $CategoryID );
109 $categoryName = $cat->name();
110 $cat->delete( );
111 eZPBLog::writeNotice( "Forum category deleted: $categoryName from IP: $REMOTE_ADDR" );
112 eZHTTPTool::header( "Location: /forum/categorylist/" );
113 }
114 else
115 {
116 eZPBLog::writeWarning( "Forum category not deleted: id not found from IP: $REMOTE_ADDR" );
117 $error_msg = $error->variable( "strings", "error_missingdata" );
118 }
119 }
120 else
121 {
122 eZHTTPTool::header( "Location: /forum/norights" );
123 exit();
124 }
125 }
126
127 if ( $Action == "DeleteCategories" )
128 {
129 // clear the menu cache
130 $files =& eZCacheFile::files( "kernel/ezforum/cache/",
131 array( "menubox",
132 NULL ),
133 "cache", "," );
134 foreach ( $files as $file )
135 {
136 $file->delete();
137 }
138
139 if ( eZPermission::checkPermission( $user, "eZForum", "CategoryDelete" ) )
140 {
141 if ( count( $CategoryArrayID ) != 0 )
142 {
143 foreach ( $CategoryArrayID as $CategoryID )
144 {
145 $cat = new eZForumCategory( $CategoryID );
146 $categoryName = $cat->name();
147 $cat->delete( );
148 eZPBLog::writeNotice( "Forum category deleted: $categoryName from IP: $REMOTE_ADDR" );
149 }
150 eZHTTPTool::header( "Location: /forum/categorylist/" );
151 exit();
152 }
153 }
154 else
155 {
156 eZHTTPTool::header( "Location: /forum/norights" );
157 exit();
158 }
159 }
160
161
162 if ( $Action == "update" )
163 {
164 if ( eZPermission::checkPermission( $user, "eZForum", "CategoryModify" ) )
165 {
166 // clear the menu cache
167 $files =& eZCacheFile::files( "kernel/ezforum/cache/",
168 array( "menubox",
169 NULL ),
170 "cache", "," );
171 foreach ( $files as $file )
172 {
173 $file->delete();
174 }
175
176 if ( $Name != "" &&
177 $Description != "" )
178 {
179 $cat = new eZForumCategory();
180 $cat->get( $CategoryID );
181 $cat->setName( $Name );
182 $cat->setDescription( $Description );
183 $cat->setSectionID( $SectionID );
184 $cat->store();
185 eZPBLog::writeNotice( "Forum category updated: $Name from IP: $REMOTE_ADDR" );
186 eZHTTPTool::header( "Location: /forum/categorylist/" );
187 }
188 else
189 {
190 eZPBLog::writeWarning( "Forum category not updated: missing data from IP: $REMOTE_ADDR" );
191 $error_msg = $error->variable( "strings", "error_missingdata" );
192 }
193 }
194 else
195 {
196 eZHTTPTool::header( "Location: /forum/norights" );
197 exit();
198 }
199 }
200
201 $t = new eZTemplate( "kernel/ezforum/admin/" . $ini->variable( "eZForumMain", "AdminTemplateDir" ),
202 "kernel/ezforum/admin/" . "/intl", $Language, "categoryedit.php" );
203 $t->setAllStrings();
204
205 $t->set_file( "category_page", "categoryedit.tpl" );
206
207 $t->set_block( "category_page", "section_item_tpl", "section_item" );
208
209 $t->set_var( "category_name", "" );
210 $t->set_var( "category_description", "" );
211 $t->set_var( "category_id", $CategoryID );
212 $action_value = "update";
213
214 if ( $Action == "new" )
215 {
216 if ( !eZPermission::checkPermission( $user, "eZForum", "CategoryAdd" ) )
217 {
218 eZHTTPTool::header( "Location: /forum/norights" );
219 exit();
220 }
221 $action_value = "insert";
222 }
223
224 $languageIni = new eZINI( "kernel/ezforum/admin/" . "intl/" . $Language . "/categoryedit.php.ini", false );
225 $headline = $languageIni->variable( "strings", "head_line_insert" );
226
227 if ( $Action == "edit" )
228 {
229 $languageIni = new eZINI( "kernel/ezforum/admin/" . "intl/" . $Language . "/categoryedit.php.ini", false );
230 $headline = $languageIni->variable( "strings", "head_line_edit" );
231
232 if ( !eZPermission::checkPermission( $user, "eZForum", "CategoryAdd" ) )
233 {
234 eZHTTPTool::header( "Location: /forum/norights" );
235 exit();
236 }
237 else
238 {
239 $cat = new eZForumCategory();
240 $cat->get( $CategoryID );
241 $t->set_var( "category_name", $cat->name() );
242 $t->set_var( "category_description", $cat->description() );
243 $action_value = "update";
244 $sectionID = $cat->sectionID();
245 }
246 }
247
248
249 $sectionList =& eZSection::getAll();
250
251 if ( count( $sectionList ) > 0 )
252 {
253 foreach ( $sectionList as $section )
254 {
255 $t->set_var( "section_id", $section->id() );
256 $t->set_var( "section_name", $section->name() );
257
258 if ( $sectionID == $section->id() )
259 $t->set_var( "section_is_selected", "selected" );
260 else
261 $t->set_var( "section_is_selected", "" );
262
263 $t->parse( "section_item", "section_item_tpl", true );
264 }
265 }
266 else
267 $t->set_var( "section_item", "" );
268
269 $t->set_var( "action_value", $action_value );
270 $t->set_var( "error_msg", isset( $error_msg ) ? $error_msg : false );
271 $t->set_var( "headline", $headline );
272
273 $t->pparse( "output", "category_page" );
274
275 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$Description
$Description
Definition: articlelistrss.php:38
$files
$files
Definition: articlepreview.php:91
eZForumCategory
Definition: ezforumcategory.php:44
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZPBLog\writeNotice
static writeNotice( $notice)
Definition: ezpblog.php:166
eZPBLog\writeWarning
static writeWarning( $warning)
Definition: ezpblog.php:177
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZSection\getAll
static getAll( $offset=0, $limit=40)
Definition: ezsection.php:177
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$SectionID
$SectionID
Definition: ezfilemanager/user/filelist.php:46
$t
if( $Action=="insert") if( $Action=="delete") if( $Action=="DeleteCategories") if( $Action=="update") $t
Definition: ezforum/admin/categoryedit.php:201
$headline
$headline
Definition: ezforum/admin/categoryedit.php:225
$sectionList
if( $Action=="edit") $sectionList
Definition: ezforum/admin/categoryedit.php:249
$Language
$Language
Definition: ezforum/admin/categoryedit.php:31
$ini
$ini
Definition: ezforum/admin/categoryedit.php:29
$action_value
$action_value
Definition: ezforum/admin/categoryedit.php:212
$error
$error
Definition: ezforum/admin/categoryedit.php:32
$languageIni
if( $Action=="new") $languageIni
Definition: ezforum/admin/categoryedit.php:224
$cat
if(isset( $DeleteCategories)) $cat
Definition: ezforum/admin/categoryedit.php:49
$section
$section
Definition: ezimagecatalogue/user/categoryedit.php:393
$error_msg
$error_msg
Definition: ezlink/admin/categoryedit.php:33
exit
exit
Definition: folder.php:81
$Name
$Name
Definition: polledit.php:250
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.