"OdenseTrack" is a school assignment/project from AspIT https://aspit.dfine.net/odensetrack
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. $setup = array();
  3. $setup['title'] = "Rediger Nyhed";
  4. $setup['headline'] = "Odense Track - Administration";
  5. $setup['keywords'] = "administration,admin";
  6. $setup['description'] = "Odense Track Administration";
  7. Design::header($setup, 100);
  8. // First we need to know if we are deleting something!
  9. if (isset($_GET['action'])) { // We are deleting this!
  10. if ($_GET['action'] == 'del') {
  11. Alter::deleteNews($_GET['id']);
  12. }
  13. die(); // Something went wrong. Dont execute rest of code!
  14. }
  15. // It did, yay! - Lets fetch it
  16. $result = Get::NewsArticle($_GET['id']);
  17. if (isset($_POST['title'])) {
  18. if (isset($_FILES['thumbnail'])) {
  19. $uploaded = Upload::handleUpload($_FILES['thumbnail']);
  20. if ($uploaded == false) {
  21. // Fail!
  22. }
  23. }
  24. Alter::editNews($_GET['id'], $_POST['title'], $_POST['textinput'], $uploaded, $_POST['type']);
  25. }
  26. ?>
  27. <div class="page">
  28. <h1>Rediger Nyhed</h1> <div class="pull_right"><a href="?page=newsadmin">Nyheder</a><span class="seperator"></span><a href="?page=eventadmin">Events</a></div>
  29. <div class="border"></div>
  30. <br />
  31. <div class='editorform'>
  32. <form method="POST" action="" enctype="multipart/form-data">
  33. <input type="text" class='editformtitle' required placeholder='Nyhedstitel' value="<?php echo $result['title']; ?>" name="title" />
  34. <br /><br />
  35. <p>Thumbnail</p>
  36. <input type="file" class='editformtitle' name="thumbnail" />
  37. <br /><br />
  38. <select class='editformtitle' name="type">
  39. <?php
  40. $i = 0;
  41. foreach (Config::$newscat as $key) {
  42. if ($i == $result['type']) {
  43. echo '<option selected value="'.$i.'">'.$key.'</option>';
  44. } else {
  45. echo '<option value="'.$i.'">'.$key.'</option>';
  46. }
  47. $i++;
  48. }
  49. ?>
  50. </select>
  51. <br /><br />
  52. <textarea name='textinput' class='editor'><?php echo strip_tags($result['content'], '<br><p><b><i><u><img><a><strong><pre><em><span><div><h1><h2><h3><h4><h5><h6><h7><sub><sup><blockquote><code>'); ?></textarea>
  53. <br />
  54. <input type="submit" class='button btn btn-success pull_right' value="Rediger" />
  55. </form>
  56. </div>
  57. <div class='clear'></div>
  58. </div>
  59. <?php
  60. Design::footer(true);