Просмотр файла modules/share/edit_folder.php

Размер файла: 1.89Kb
  1. <?php
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.ru *
  7. **********************************/
  8. $locate = 'in_share';
  9. if($user['level'] < '6' || !isset($_GET['cat_id'])) { go('/'); }
  10. if($db->query("SELECT * FROM `share_c` WHERE `id` = '". abs(intval($_GET['cat_id'])) ."'")->rowCount() == 0) {
  11. go('/share/');
  12. }
  13. $edit_folder = $db->query("SELECT * FROM `share_c` WHERE `id` = '". abs(intval($_GET['cat_id'])) ."'")->fetch();
  14. if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
  15. $name = substr(input($_POST['name']), 0, 55);
  16. $who_upload = substr(abs(intval($_POST['who_upload'])), 0, 1);
  17. $db->query("UPDATE `share_c` SET `name` = '". $name ."', `who_upload` = '$who_upload' WHERE `id` = '". abs(intval($_GET['cat_id'])) ."'");
  18. go('/share/folder/'. abs(intval($_GET['cat_id'])) .'/');
  19. // print_r($db->errorInfo());
  20. }
  21. $title = $lang->word('edit');
  22. require_once(SYS.'/view/header.php');
  23. $tpl->div('title', $lang->word('edit'));
  24. echo '<form action="/share/edit_folder/'. abs(intval($_GET['cat_id'])) .'/?act=edit" method="post">
  25. <div class="menu">
  26. <b>'. $lang->word('name') .'</b>:<br/>
  27. <input typr="text" name="name" value="'. $edit_folder['name'] .'" /><br/>
  28. <b>'.$lang->word('who_upload').'</b>:<br/>
  29. <select name="who_upload">
  30. <option value="1" '.($edit_folder['who_upload'] == 1 ? 'selected="selected"' : NULL).'>'.$lang->word('administration').'</option>
  31. <option value="2" '.($edit_folder['who_upload'] == 2 ? 'selected="selected"' : NULL).'>'.$lang->word('alls').' '.$lang->word('regs').'</option>
  32. </select><br/>
  33. <input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
  34. </div>
  35. </form>';
  36. $tpl->div('block', NAV .'<a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
  37. require_once(SYS.'/view/footer.php');
  38. ?>