Просмотр файла forum/editforum.php

Размер файла: 2.63Kb
  1. <?php
  2. # Script by seg0ro http://mobilarts.ru
  3. # Not for sale!!!
  4.  
  5. # fixed
  6.  
  7. $set['title'] .= ' | Редактирование';
  8. include H . 'engine/includes/head.php';
  9.  
  10. if (!$forum){
  11. echo Core::msg_show('Отсутствует идентификатор форума!<br /><a href="index.php">Форум</a>');
  12. include H . 'engine/includes/foot.php';
  13. }
  14.  
  15. if (!$admin){
  16. echo Core::msg_show('У вас недостаточно прав для просмотра этой страницы!<br /><a href="index.php">Форум</a>');
  17. include H . 'engine/includes/foot.php';
  18. }
  19.  
  20.  
  21. echo '<div class="fmenu"><a href="index.php">Форум</a> / <a href="index.php?forum='.$forumRes['id'].'">'.text::output($forumRes['name']).'</a> ' .($forumRes['refid'] ? 'Редактировать подфорум' : 'Редактировать форум').'</div>';
  22.  
  23. $name = isset($_POST['name']) ? trim($_POST['name']) : $forumRes['name'];
  24. $text = isset($_POST['text']) ? trim($_POST['text']) : $forumRes['text'];
  25. $type = isset($_POST['type']) ? intval($_POST['type']) : $forumRes['type'];
  26.  
  27. if (isset($_POST['send'])){
  28.  
  29. if (empty($name))
  30. $error .= 'Не введено название!<br />';
  31.  
  32. if (mb_strlen($name) > 100)
  33. $error .= 'Слишком длинное название!<br />';
  34.  
  35. if (!isset($error)){
  36. $sql->query("UPDATE `forum_forums` SET
  37. `type` = '$type',
  38. `name` = '".my_esc($name)."',
  39. `text` = '".my_esc($text)."'
  40. WHERE `id` = '$forum'
  41. ");
  42.  
  43. if ($forumRes['type'] == 1){
  44. $sql->query("UPDATE `forum_topics` SET `forum` = '".my_esc(trim($name))."' WHERE `refid` = '$forum' ");
  45. }
  46.  
  47. header ('Refresh:1; URL=index.php?forum='.$forum);
  48. echo '<div class="msg">Форум изменен<br /><a href="index.php?forum='.$forum.'">Далее</a></div>';
  49. include H . 'engine/includes/foot.php';
  50. }
  51. }
  52.  
  53. if (isset($error))
  54. echo Core::msg_show($error);
  55.  
  56. echo '<form name="form" action="index.php?act=editforum&amp;forum='.$forum.'" method="post">';
  57. echo '<div class="rmenu">Название <img style="cursor: pointer;" onclick="alert(this.title);" src="images/question.png" alt="?" title="Максимально 100 символов" />:<br /><input type="text" name="name" value="'.text($name).'" /><br />
  58. <select name="type">'.($forum ? '<option value="0">Для форумов</option>' : '').'<option value="1"'.($type == 1 ? ' selected="selected"' : '').'>Для тем</option></select><br />';
  59. echo 'Описание:<br /><textarea name="text">'.text($text).'</textarea><br />';
  60. echo '<input type="submit" name="send" value="Сохранить" /></div></form>';