"OdenseTrack" is a school assignment/project from AspIT https://aspit.dfine.net/odensetrack
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

editnews.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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);
  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. <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>
  39. <br />
  40. <input type="submit" class='button btn btn-success pull_right' value="Rediger" />
  41. </form>
  42. </div>
  43. <div class='clear'></div>
  44. </div>
  45. <?php
  46. Design::footer(true);