[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 <?php 2 3 /* Reminder: always indent with 4 spaces (no tabs). */ 4 // +---------------------------------------------------------------------------+ 5 // | Geeklog 1.4 | 6 // +---------------------------------------------------------------------------+ 7 // | topic.php | 8 // | | 9 // | Geeklog topic administration page. | 10 // +---------------------------------------------------------------------------+ 11 // | Copyright (C) 2000-2006 by the following authors: | 12 // | | 13 // | Authors: Tony Bibbs - tony AT tonybibbs DOT com | 14 // | Mark Limburg - mlimburg AT users DOT sourceforge DOT net | 15 // | Jason Whittenburg - jwhitten AT securitygeeks DOT com | 16 // | Dirk Haun - dirk AT haun-online DOT de | 17 // +---------------------------------------------------------------------------+ 18 // | | 19 // | This program is free software; you can redistribute it and/or | 20 // | modify it under the terms of the GNU General Public License | 21 // | as published by the Free Software Foundation; either version 2 | 22 // | of the License, or (at your option) any later version. | 23 // | | 24 // | This program is distributed in the hope that it will be useful, | 25 // | but WITHOUT ANY WARRANTY; without even the implied warranty of | 26 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 27 // | GNU General Public License for more details. | 28 // | | 29 // | You should have received a copy of the GNU General Public License | 30 // | along with this program; if not, write to the Free Software Foundation, | 31 // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 32 // | | 33 // +---------------------------------------------------------------------------+ 34 // 35 // $Id: topic.php,v 1.72 2006/10/08 16:10:20 dhaun Exp $ 36 37 require_once ('../lib-common.php'); 38 require_once ('auth.inc.php'); 39 require_once ($_CONF['path_system'] . 'lib-story.php'); 40 41 if (!SEC_hasRights('topic.edit')) { 42 $display = COM_siteHeader ('menu', $MESSAGE[30]); 43 $display .= COM_startBlock ($MESSAGE[30], '', 44 COM_getBlockTemplate ('_msg_block', 'header')); 45 $display .= $MESSAGE[32]; 46 $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer')); 47 $display .= COM_siteFooter (); 48 COM_accessLog("User {$_USER['username']} tried to illegally access the topic administration screen."); 49 echo $display; 50 exit; 51 } 52 53 // Uncomment the line below if you need to debug the HTTP variables being passed 54 // to the script. This will sometimes cause errors but it will allow you to see 55 // the data being passed in a POST operation 56 // echo COM_debug($_POST); 57 58 /** 59 * Show topic administration form 60 * 61 * @param string tid ID of topic to edit 62 * @return string HTML for the topic editor 63 * 64 */ 65 function edittopic ($tid = '') 66 { 67 global $_CONF, $_GROUPS, $_TABLES, $_USER, $LANG27, $LANG_ACCESS, 68 $LANG_ADMIN, $MESSAGE; 69 70 $retval = ''; 71 72 if (!empty($tid)) { 73 $result = DB_query("SELECT * FROM {$_TABLES['topics']} WHERE tid ='$tid'"); 74 $A = DB_fetchArray($result); 75 $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']); 76 if ($access == 0 OR $access == 2) { 77 $retval .= COM_startBlock ($LANG27[12], '', 78 COM_getBlockTemplate ('_msg_block', 'header')); 79 $retval .= $LANG27[13]; 80 $retval .= COM_endBlock(COM_getBlockTemplate ('_msg_block', 'footer')); 81 COM_accessLog("User {$_USER['username']} tried to illegally create or edit topic $tid."); 82 return $retval; 83 } 84 } 85 86 $retval .= COM_startBlock ($LANG27[1], '', 87 COM_getBlockTemplate ('_admin_block', 'header')); 88 if (!is_array ($A) || empty ($A['owner_id'])) { 89 $A['owner_id'] = $_USER['uid']; 90 91 // this is the one instance where we default the group 92 // most topics should belong to the Topic Admin group 93 if (isset ($_GROUPS['Topic Admin'])) { 94 $A['group_id'] = $_GROUPS['Topic Admin']; 95 } else { 96 $A['group_id'] = SEC_getFeatureGroup ('topic.edit'); 97 } 98 SEC_setDefaultPermissions ($A, $_CONF['default_permissions_topic']); 99 $access = 3; 100 } 101 $topic_templates = new Template($_CONF['path_layout'] . 'admin/topic'); 102 $topic_templates->set_file('editor','topiceditor.thtml'); 103 $topic_templates->set_var('site_url', $_CONF['site_url']); 104 $topic_templates->set_var('site_admin_url', $_CONF['site_admin_url']); 105 $topic_templates->set_var('layout_url', $_CONF['layout_url']); 106 if (!empty($tid) && SEC_hasRights('topic.edit')) { 107 $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete'] 108 . '" name="mode"%s>'; 109 $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"'; 110 $topic_templates->set_var ('delete_option', 111 sprintf ($delbutton, $jsconfirm)); 112 $topic_templates->set_var ('delete_option_no_confirmation', 113 sprintf ($delbutton, '')); 114 } 115 $topic_templates->set_var('lang_topicid', $LANG27[2]); 116 $topic_templates->set_var('topic_id', $A['tid']); 117 $topic_templates->set_var('lang_donotusespaces', $LANG27[5]); 118 $topic_templates->set_var('lang_accessrights',$LANG_ACCESS['accessrights']); 119 $topic_templates->set_var('lang_owner', $LANG_ACCESS['owner']); 120 $ownername = COM_getDisplayName ($A['owner_id']); 121 $topic_templates->set_var('owner_username', DB_getItem ($_TABLES['users'], 122 'username', "uid = {$A['owner_id']}")); 123 $topic_templates->set_var('owner_name', $ownername); 124 $topic_templates->set_var('owner', $ownername); 125 $topic_templates->set_var('owner_id', $A['owner_id']); 126 $topic_templates->set_var('lang_group', $LANG_ACCESS['group']); 127 $topic_templates->set_var('lang_save', $LANG_ADMIN['save']); 128 $topic_templates->set_var('lang_cancel', $LANG_ADMIN['cancel']); 129 $topic_templates->set_var('group_dropdown', 130 SEC_getGroupDropdown ($A['group_id'], $access)); 131 $topic_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']); 132 $topic_templates->set_var('lang_permissions_key', $LANG_ACCESS['permissionskey']); 133 $topic_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon'])); 134 135 // show sort order only if they specified sortnum as the sort method 136 if ($_CONF['sortmethod'] <> 'alpha') { 137 $topic_templates->set_var('lang_sortorder', $LANG27[10]); 138 if ($A['sortnum'] == 0) { 139 $A['sortnum'] = ''; 140 } 141 $topic_templates->set_var('sort_order', '<input type="text" size="3" maxlength="3" name="sortnum" value="' . $A['sortnum'] . '">'); 142 } else { 143 $topic_templates->set_var('lang_sortorder', $LANG27[14]); 144 $topic_templates->set_var('sort_order', $LANG27[15]); 145 } 146 $topic_templates->set_var('lang_storiesperpage', $LANG27[11]); 147 if ($A['limitnews'] == 0) { 148 $topic_templates->set_var('story_limit', ''); 149 } else { 150 $topic_templates->set_var('story_limit', $A['limitnews']); 151 } 152 $topic_templates->set_var('default_limit', $_CONF['limitnews']); 153 $topic_templates->set_var('lang_defaultis', $LANG27[16]); 154 $topic_templates->set_var('lang_topicname', $LANG27[3]); 155 $topic_templates->set_var('topic_name', stripslashes ($A['topic'])); 156 if (empty($A['tid'])) { 157 $A['imageurl'] = '/images/topics/'; 158 } 159 $topic_templates->set_var('lang_topicimage', $LANG27[4]); 160 $topic_templates->set_var('lang_uploadimage', $LANG27[27]); 161 $topic_templates->set_var('icon_dimensions', $_CONF['max_topicicon_width'].' x '.$_CONF['max_topicicon_height']); 162 $topic_templates->set_var('lang_maxsize', $LANG27[28]); 163 $topic_templates->set_var('max_url_length', 255); 164 $topic_templates->set_var('image_url', $A['imageurl']); 165 $topic_templates->set_var('warning_msg', $LANG27[6]); 166 167 $topic_templates->set_var ('lang_defaulttopic', $LANG27[22]); 168 $topic_templates->set_var ('lang_defaulttext', $LANG27[23]); 169 if ($A['is_default'] == 1) { 170 $topic_templates->set_var ('default_checked', 'checked="checked"'); 171 } else { 172 $topic_templates->set_var ('default_checked', ''); 173 } 174 175 $topic_templates->set_var ('lang_archivetopic', $LANG27[25]); 176 $topic_templates->set_var ('lang_archivetext', $LANG27[26]); 177 $topic_templates->set_var ('archive_disabled', ''); 178 if ($A['archive_flag'] == 1) { 179 $topic_templates->set_var ('archive_checked', 'checked="checked"'); 180 } else { 181 $topic_templates->set_var ('archive_checked', ''); 182 // Only 1 topic can be the archive topic - so check if there already is one 183 if (DB_count($_TABLES['topics'], 'archive_flag', '1') > 0) { 184 $topic_templates->set_var ('archive_disabled', 'disabled'); 185 } 186 } 187 $topic_templates->parse('output', 'editor'); 188 $retval .= $topic_templates->finish($topic_templates->get_var('output')); 189 $retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer')); 190 191 return $retval; 192 } 193 194 /** 195 * Save topic to the database 196 * 197 * @param string $tid Topic ID 198 * @param string $topic Name of topic (what the user sees) 199 * @param string $imageurl (partial) URL to topic image 200 * @param int $sortnum number for sort order in "Topics" block 201 * @param int $limitnews number of stories per page for this topic 202 * @param int $owner_id ID of owner 203 * @param int $group_id ID of group topic belongs to 204 * @param int $perm_owner Permissions the owner has 205 * @param int $perm_group Permissions the group has 206 * @param int $perm_member Permissions members have 207 * @param int $perm_anon Permissions anonymous users have 208 * @param string $is_default 'on' if this is the default topic 209 * @param string $is_archive 'on' if this is the archive topic 210 * @return string HTML redirect or error message 211 */ 212 function savetopic($tid,$topic,$imageurl,$sortnum,$limitnews,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_default,$is_archive) 213 { 214 global $_CONF, $_TABLES, $LANG27, $MESSAGE; 215 216 $retval = ''; 217 218 // Convert array values to numeric permission values 219 list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon); 220 221 $tid = COM_sanitizeID ($tid); 222 223 $access = 0; 224 if (DB_count ($_TABLES['topics'], 'tid', $tid) > 0) { 225 $result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['topics']} WHERE tid = '{$tid}'"); 226 $A = DB_fetchArray ($result); 227 $access = SEC_hasAccess ($A['owner_id'], $A['group_id'], 228 $A['perm_owner'], $A['perm_group'], $A['perm_members'], 229 $A['perm_anon']); 230 } else { 231 $access = SEC_hasAccess ($owner_id, $group_id, $perm_owner, $perm_group, 232 $perm_members, $perm_anon); 233 } 234 if (($access < 3) || !SEC_inGroup ($group_id)) { 235 $retval .= COM_siteHeader ('menu', $MESSAGE[30]); 236 $retval .= COM_startBlock ($MESSAGE[30], '', 237 COM_getBlockTemplate ('_msg_block', 'header')); 238 $retval .= $MESSAGE[32]; 239 $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer')); 240 $retval .= COM_siteFooter (); 241 COM_accessLog("User {$_USER['username']} tried to illegally create or edit topic $tid."); 242 } elseif (!empty($tid) && !empty($topic)) { 243 if ($imageurl == '/images/topics/') { 244 $imageurl = ''; 245 } 246 $topic = addslashes ($topic); 247 248 if ($is_default == 'on') { 249 $is_default = 1; 250 DB_query ("UPDATE {$_TABLES['topics']} SET is_default = 0 WHERE is_default = 1"); 251 } else { 252 $is_default = 0; 253 } 254 255 $is_archive = ($is_archive == 'on') ? 1 : 0; 256 257 $archivetid = DB_getItem ($_TABLES['topics'], 'tid', "archive_flag=1"); 258 if ($is_archive) { 259 // $tid is the archive topic 260 // - if it wasn't already, mark all its stories "archived" now 261 if ($archivetid != $tid) { 262 DB_query ("UPDATE {$_TABLES['stories']} SET featured = 0, frontpage = 0, statuscode = " . STORY_ARCHIVE_ON_EXPIRE . " WHERE tid = '$tid'"); 263 DB_query ("UPDATE {$_TABLES['topics']} SET archive_flag = 0 WHERE archive_flag = 1"); 264 } 265 } else { 266 // $tid is not the archive topic 267 // - if it was until now, reset the "archived" status of its stories 268 if ($archivetid == $tid) { 269 DB_query ("UPDATE {$_TABLES['stories']} SET statuscode = 0 WHERE tid = '$tid'"); 270 DB_query ("UPDATE {$_TABLES['topics']} SET archive_flag = 0 WHERE archive_flag = 1"); 271 } 272 } 273 274 DB_save($_TABLES['topics'],'tid, topic, imageurl, sortnum, limitnews, is_default, archive_flag, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon',"'$tid', '$topic', '$imageurl','$sortnum','$limitnews',$is_default,'$is_archive',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon"); 275 276 // update feed(s) and Older Stories block 277 COM_rdfUpToDateCheck ('geeklog', $tid); 278 COM_olderStuff (); 279 280 $retval = COM_refresh ($_CONF['site_admin_url'] . '/topic.php?msg=13'); 281 } else { 282 $retval .= COM_siteHeader('menu', $LANG27[1]); 283 $retval .= COM_errorLog($LANG27[7], 2); 284 $retval .= edittopic($tid); 285 $retval .= COM_siteFooter(); 286 } 287 288 return $retval; 289 } 290 291 /** 292 * Displays a list of topics 293 * 294 * Lists all the topics and their icons. 295 * 296 * @return string HTML for the topic list 297 * 298 */ 299 function listtopics() 300 { 301 global $_CONF, $_TABLES, $LANG27, $LANG_ACCESS, $LANG_ADMIN; 302 303 require_once( $_CONF['path_system'] . 'lib-admin.php' ); 304 305 $retval = ''; 306 307 $retval .= COM_startBlock ($LANG27[8], '', 308 COM_getBlockTemplate ('_admin_block', 'header')); 309 310 $topic_templates = new Template($_CONF['path_layout'] . 'admin/topic'); 311 $topic_templates->set_file(array('list'=>'topiclist.thtml', 'item'=>'listitem.thtml')); 312 $topic_templates->set_var('site_url', $_CONF['site_url']); 313 $topic_templates->set_var('site_admin_url', $_CONF['site_admin_url']); 314 $topic_templates->set_var('layout_url', $_CONF['layout_url']); 315 $topic_templates->set_var('lang_newtopic', $LANG_ADMIN['create_new']); 316 $topic_templates->set_var('lang_adminhome', $LANG27[18]); 317 $topic_templates->set_var('lang_instructions', $LANG27[9]); 318 $topic_templates->set_var('begin_row', '<tr align="center" valign="bottom">'); 319 320 $result = DB_query("SELECT * FROM {$_TABLES['topics']}"); 321 $nrows = DB_numRows($result); 322 $counter = 1; 323 324 for ($i = 0; $i < $nrows; $i++) { 325 $A = DB_fetchArray($result); 326 327 $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']); 328 329 if ($access > 0) { 330 if ($access == 3) { 331 $access = $LANG_ACCESS['edit']; 332 } else { 333 $access = $LANG_ACCESS['readonly']; 334 } 335 336 $topic_templates->set_var('topic_id', $A['tid']); 337 $topic_templates->set_var('topic_name', stripslashes ($A['topic'])); 338 $topic_templates->set_var('topic_access', $access); 339 if ($A['is_default'] == 1) { 340 $topic_templates->set_var ('default_topic', $LANG27[24]); 341 } else { 342 $topic_templates->set_var ('default_topic', ''); 343 } 344 if (empty ($A['imageurl'])) { 345 $topic_templates->set_var ('image_tag', ''); 346 } else { 347 $imageurl = COM_getTopicImageUrl ($A['imageurl']); 348 $topic_templates->set_var ('image_tag', '<img src="' . $imageurl 349 . '" border="0" alt="">'); 350 } 351 if ($counter == 5) { 352 $counter = 1; 353 $topic_templates->set_var('end_row','</tr>'); 354 $topic_templates->parse('list_row','item',true); 355 $topic_templates->set_var('begin_row','<tr align="center" valign="bottom">'); 356 } else { 357 $topic_templates->set_var('end_row',''); 358 $topic_templates->parse('list_row','item',true); 359 $topic_templates->set_var('begin_row',''); 360 $counter = $counter + 1; 361 } 362 } 363 } 364 $topic_templates->set_var('end_row','</tr>'); 365 $topic_templates->parse('output', 'list'); 366 $retval .= $topic_templates->finish($topic_templates->get_var('output')); 367 $retval .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer')); 368 369 return $retval; 370 } 371 372 /** 373 * Delete a topic 374 * 375 * @param string $tid Topic ID 376 * @return string HTML redirect 377 * 378 */ 379 function deleteTopic ($tid) 380 { 381 global $_CONF, $_TABLES, $_USER; 382 383 $result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['topics']} WHERE tid ='$tid'"); 384 $A = DB_fetchArray ($result); 385 $access = SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'], 386 $A['perm_group'], $A['perm_members'], $A['perm_anon']); 387 if ($access < 3) { 388 COM_accessLog ("User {$_USER['username']} tried to illegally delete topic $tid."); 389 return COM_refresh ($_CONF['site_admin_url'] . '/topic.php'); 390 } 391 392 // don't delete topic blocks - assign them to 'all' and disable them 393 DB_query ("UPDATE {$_TABLES['blocks']} SET tid = 'all', is_enabled = 0 WHERE tid = '$tid'"); 394 395 // same with feeds 396 DB_query ("UPDATE {$_TABLES['syndication']} SET topic = '::all', is_enabled = 0 WHERE topic = '$tid'"); 397 398 // delete comments, trackbacks, images associated with stories in this topic 399 $result = DB_query ("SELECT sid FROM {$_TABLES['stories']} WHERE tid = '$tid'"); 400 $numStories = DB_numRows ($result); 401 for ($i = 0; $i < $numStories; $i++) { 402 $A = DB_fetchArray ($result); 403 STORY_deleteImages ($A['sid']); 404 DB_query("DELETE FROM {$_TABLES['comments']} WHERE sid = '{$A['sid']}' AND type = 'article'"); 405 DB_query("DELETE FROM {$_TABLES['trackback']} WHERE sid = '{$A['sid']}' AND type = 'article'"); 406 } 407 408 // delete these 409 DB_delete ($_TABLES['stories'], 'tid', $tid); 410 DB_delete ($_TABLES['storysubmission'], 'tid', $tid); 411 DB_delete ($_TABLES['topics'], 'tid', $tid); 412 413 // update feed(s) and Older Stories block 414 COM_rdfUpToDateCheck ('geeklog'); 415 COM_olderStuff (); 416 417 return COM_refresh ($_CONF['site_admin_url'] . '/topic.php?msg=14'); 418 } 419 420 /** 421 * Upload new topic icon, replaces previous icon if one exists 422 * 423 * @param string tid ID of topic to prepend to filename 424 * @return string filename of new photo (empty = no new photo) 425 * 426 */ 427 function handleIconUpload($tid) 428 { 429 global $_CONF, $_TABLES, $LANG27; 430 431 require_once ($_CONF['path_system'] . 'classes/upload.class.php'); 432 433 $upload = new upload(); 434 if (!empty ($_CONF['image_lib'])) { 435 if ($_CONF['image_lib'] == 'imagemagick') { 436 // Using imagemagick 437 $upload->setMogrifyPath ($_CONF['path_to_mogrify']); 438 } elseif ($_CONF['image_lib'] == 'netpbm') { 439 // using netPBM 440 $upload->setNetPBM ($_CONF['path_to_netpbm']); 441 } elseif ($_CONF['image_lib'] == 'gdlib') { 442 // using the GD library 443 $upload->setGDLib (); 444 } 445 $upload->setAutomaticResize (true); 446 if (isset ($_CONF['debug_image_upload']) && 447 $_CONF['debug_image_upload']) { 448 $upload->setLogFile ($_CONF['path'] . 'logs/error.log'); 449 $upload->setDebug (true); 450 } 451 } 452 $upload->setAllowedMimeTypes (array ('image/gif' => '.gif', 453 'image/jpeg' => '.jpg,.jpeg', 454 'image/pjpeg' => '.jpg,.jpeg', 455 'image/x-png' => '.png', 456 'image/png' => '.png' 457 ) ); 458 if (!$upload->setPath ($_CONF['path_images'] . 'topics')) { 459 $display = COM_siteHeader ('menu', $LANG27[29]); 460 $display .= COM_startBlock ($LANG27[29], '', 461 COM_getBlockTemplate ('_msg_block', 'header')); 462 $display .= $upload->printErrors (false); 463 $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 464 'footer')); 465 $display .= COM_siteFooter (); 466 echo $display; 467 exit; // don't return 468 } 469 470 $filename = ''; 471 472 // see if user wants to upload a (new) icon 473 $newicon = $_FILES['newicon']; 474 if (!empty ($newicon['name'])) { 475 $pos = strrpos ($newicon['name'], '.') + 1; 476 $fextension = substr ($newicon['name'], $pos); 477 $filename = 'topic_' . $tid . '.' . $fextension; 478 } 479 480 // do the upload 481 if (!empty ($filename)) { 482 $upload->setFileNames ($filename); 483 $upload->setPerms ('0644'); 484 if (($_CONF['max_topicicon_width'] > 0) && 485 ($_CONF['max_topicicon_height'] > 0)) { 486 $upload->setMaxDimensions ($_CONF['max_topicicon_width'], 487 $_CONF['max_topicicon_height']); 488 } else { 489 $upload->setMaxDimensions ($_CONF['max_image_width'], 490 $_CONF['max_image_height']); 491 } 492 if ($_CONF['max_topicicon_size'] > 0) { 493 $upload->setMaxFileSize($_CONF['max_topicicon_size']); 494 } else { 495 $upload->setMaxFileSize($_CONF['max_image_size']); 496 } 497 $upload->uploadFiles (); 498 499 if ($upload->areErrors ()) { 500 $display = COM_siteHeader ('menu', $LANG27[29]); 501 $display .= COM_startBlock ($LANG27[29], '', 502 COM_getBlockTemplate ('_msg_block', 'header')); 503 $display .= $upload->printErrors (false); 504 $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 505 'footer')); 506 $display .= COM_siteFooter (); 507 echo $display; 508 exit; // don't return 509 } 510 $filename = '/images/topics/' . $filename; 511 } 512 513 return $filename; 514 } 515 516 517 // MAIN 518 $display = ''; 519 520 $mode = ''; 521 if (isset ($_REQUEST['mode'])) { 522 $mode = $_REQUEST['mode']; 523 } 524 525 if (($mode == $LANG_ADMIN['delete']) && !empty ($LANG_ADMIN['delete'])) { 526 $tid = COM_applyFilter ($_POST['tid']); 527 if (!isset ($tid) || empty ($tid)) { 528 COM_errorLog ('Attempted to delete topic tid=' . $tid); 529 $display .= COM_refresh ($_CONF['site_admin_url'] . '/topic.php'); 530 } else { 531 $display .= deleteTopic ($tid); 532 } 533 } else if (($mode == $LANG_ADMIN['save']) && !empty ($LANG_ADMIN['save'])) { 534 if (empty ($_FILES['newicon']['name'])){ 535 $imageurl = COM_applyFilter ($_POST['imageurl']); 536 } else { 537 $imageurl = handleIconUpload($_POST['tid']); 538 $imageurl = COM_applyFilter ($imageurl); 539 } 540 $display .= savetopic (COM_applyFilter ($_POST['tid']), $_POST['topic'], 541 $imageurl, 542 COM_applyFilter ($_POST['sortnum'], true), 543 COM_applyFilter ($_POST['limitnews'], true), 544 COM_applyFilter ($_POST['owner_id'], true), 545 COM_applyFilter ($_POST['group_id'], true), 546 $_POST['perm_owner'], $_POST['perm_group'], 547 $_POST['perm_members'], $_POST['perm_anon'], 548 $_POST['is_default'], $_POST['is_archive']); 549 } else if ($mode == 'edit') { 550 $display .= COM_siteHeader('menu', $LANG27[1]); 551 $display .= edittopic (COM_applyFilter ($_GET['tid'])); 552 $display .= COM_siteFooter(); 553 } else { // 'cancel' or no mode at all 554 $display .= COM_siteHeader('menu', $LANG27[8]); 555 if (isset ($_GET['msg'])) { 556 $display .= COM_showMessage (COM_applyFilter ($_GET['msg'], true)); 557 } 558 $display .= listtopics(); 559 $display .= COM_siteFooter(); 560 } 561 562 echo $display; 563 564 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |