Просмотр файла modules/padmin/edit_link.php

Размер файла: 2.67Kb
  1. <?php
  2. /**********************************
  3. * @package: PerfCMS *
  4. * @year: 2012 *
  5. * @author: Artas *
  6. * @link: http://perfcms.ru *
  7. **********************************/
  8. if($user['level'] < 6 || !isset($user)) { header('Location: /'); exit;}
  9. $locate = 'in_padmin';
  10. if(isset($_GET['link_id'])) {
  11. if(isset($_GET['act']) && $_GET['act'] == 'edit') {
  12. $link_url = input($_POST['link_url']);
  13. $link_name = input($_POST['link_name']);
  14. $link_image = input($_POST['link_image']);
  15. $link_type = abs(intval($_POST['link_type']));
  16. if(isset($_POST['link_redirect'])) {
  17. $link_redirect = 1;
  18. }
  19. else
  20. {
  21. $link_redirect = 2;
  22. }
  23. $db->query("UPDATE `ads` SET `link` = '$link_url', `name` = '$link_name', `image` = '$link_image', `type` = '$link_type', `redirect` = '$link_redirect' WHERE `id` = '". abs(intval($_GET['link_id'])) ."'");
  24. header('location: /padmin/ads/');
  25. // echo $link_type;
  26. exit;
  27. }
  28. $linke = $db->query("SELECT * FROM `ads` WHERE `id` = '". abs(intval($_GET['link_id'])) ."'")->fetch();
  29. $title = $lang->word('edit_link');
  30. require_once(SYS.'/view/header.php');
  31. $tpl->div('title', $lang->word('edit_link'));
  32. if(isset($_GET['act']) && $_GET['act'] == 'error') {
  33. $tpl->div('error', 'Unsupported input data');
  34. }
  35. echo '<div class="menu">
  36. <form action="/padmin/ads/edit?act=edit&link_id='.abs(intval($_GET['link_id'])).'" method="post">
  37. '. $lang->word('link_url') .':<br/>
  38. <input type="text" name="link_url" value="'. $linke['link'] .'"/><br/>
  39. '. $lang->word('link_name') .':<br/>
  40. <input type="text" name="link_name" value="'. $linke['name'] .'"/><br/>
  41. '. $lang->word('link_image') .':<br/>
  42. <input type="text" name="link_image" value="'. $linke['image'] .'"/><br/>
  43. '. $lang->word('link_type') .':<br/>
  44. <select name="link_type">
  45. <option value="1" '.($linke['type'] == 1 ? 'selected="selected"' : NULL).'>'. $lang->word('header_link') .'</option>
  46. <option value="2" '.($linke['type'] == 2 ? 'selected="selected"' : NULL).'>'. $lang->word('footer_link') .'</option>
  47. <option value="3" '.($linke['type'] == 3 ? 'selected="selected"' : NULL).'>'. $lang->word('banner_link') .'</option>
  48. </select><br/>
  49. '. $lang->word('link_redirect') .': <input type="checkbox" name="link_redirect" '.($linke['redirect'] == 1 ? 'checked' : NULL).'/><br/>
  50. <input type="submit" value="'. $lang->word('save') .'" />
  51. </form>
  52. </div>';
  53. $tpl->div('block', img('ads.png') .'<a href="/padmin/ads/">'. $lang->word('padmin_ads') .'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
  54. require_once(SYS.'/view/footer.php');
  55. } else { header('location: /index.php'); exit;}
  56. ?>