Advertisement
Smokeman

Edit button

Jan 29th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.70 KB | None | 0 0
  1. <?php
  2. /*-------------------------------------------------------+
  3. | PHP-Fusion Content Management System
  4. | Copyright (C) 2002 - 2011 Nick Jones
  5. | http://www.php-fusion.co.uk/
  6. +--------------------------------------------------------+
  7. | Filename: viewpage.php
  8. | Author: Nick Jones (Digitanium)
  9. +--------------------------------------------------------+
  10. | This program is released as free software under the
  11. | Affero GPL license. You can redistribute it and/or
  12. | modify it under the terms of this license which you
  13. | can read by viewing the included agpl.txt or online
  14. | at www.gnu.org/licenses/agpl.html. Removal of this
  15. | copyright header is strictly prohibited without
  16. | written permission from the original author(s).
  17. +--------------------------------------------------------*/
  18. require_once "maincore.php";
  19. require_once THEMES."templates/header.php";
  20. require_once INCLUDES."comments_include.php";
  21. require_once INCLUDES."ratings_include.php";
  22. include LOCALE.LOCALESET."custom_pages.php";
  23.  
  24. if (!isset($_GET['page_id']) || !isnum($_GET['page_id'])) { redirect("index.php"); }
  25. if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
  26.  
  27. $cp_result = dbquery("SELECT * FROM ".DB_CUSTOM_PAGES." WHERE page_id='".$_GET['page_id']."'");
  28. if (dbrows($cp_result)) {
  29.     $cp_data = dbarray($cp_result);
  30.     add_to_title($locale['global_200'].$cp_data['page_title']);
  31.     echo "<!--custompages-pre-content-->\n";
  32.     opentable($cp_data['page_title']);
  33.     if (checkgroup($cp_data['page_access'])) {
  34.         ob_start();
  35.         eval("?>".stripslashes($cp_data['page_content'])."<?php ");
  36.         $custompage = ob_get_contents();
  37.         ob_end_clean();
  38.         if ($settings['tinymce_enabled']) {
  39.             $custompage = explode("<!-- pagebreak -->", $custompage);
  40.             $pagecount = count($custompage);
  41.             echo $custompage[$_GET['rowstart']];
  42.             if ($pagecount > 1) {
  43.                 echo "<div align='center' style='margin-top:5px;'>\n".makepagenav($_GET['rowstart'], 1, $pagecount, 3, FUSION_SELF."?page_id=".$_GET['page_id']."&amp;")."\n</div>\n";
  44.             }
  45.         } else {       
  46.             echo $custompage;
  47.         }
  48.     } else {
  49.         echo "<div class='admin-message' style='text-align:center'><br /><img style='border:0px; vertical-align:middle;' src ='".BASEDIR."images/warn.png' alt=''/><br /> ".$locale['400']."<br /><a href='index.php' onclick='javascript:history.back();return false;'>".$locale['403']."</a>\n<br /><br /></div>\n";
  50.     }
  51. } else {
  52.     add_to_title($locale['global_200'].$locale['401']);
  53.     echo "<!--custompages-pre-content-->\n";
  54.     opentable($locale['401']);
  55.     echo "<div style='text-align:center'><br />\n".$locale['402']."\n<br /><br /></div>\n";
  56. }
  57. // Edit Custom Pages MOD start
  58. if (iADMIN) {
  59.    $result = dbquery("SELECT page_id FROM ".DB_CUSTOM_PAGES);
  60.    if (dbrows($result) != 0) {
  61.       while ($data = dbarray($result)) {
  62.          if (isset($_GET['page_id'])) { $sel = $_GET['page_id']; }
  63.       }
  64.       echo "<div style='text-align:center'>\n<form name='selectform' method='post' action='".ADMIN."custom_pages.php".$aidlink."'>\n";
  65.       echo "<input type='hidden' name='page_id' value='$sel'>\n";
  66.       //echo "<input type='submit' name='edit' value='".$locale['404']."' class='button' />\n";
  67.       echo "<input type='image' src='".IMAGES."edit.png' />\n";
  68.       echo "</form>\n</div>\n";
  69.    }
  70. }
  71. // Edit Custom Pages MOD end
  72.  
  73. closetable();
  74. echo "<!--custompages-after-content-->\n";
  75. if (dbrows($cp_result) && checkgroup($cp_data['page_access'])) {
  76.     if ($cp_data['page_allow_comments']) { showcomments("C", DB_CUSTOM_PAGES, "page_id", $_GET['page_id'],FUSION_SELF."?page_id=".$_GET['page_id']); }
  77.     if ($cp_data['page_allow_ratings']) { showratings("C", $_GET['page_id'], FUSION_SELF."?page_id=".$_GET['page_id']); }
  78. }
  79.  
  80. require_once THEMES."templates/footer.php";
  81. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement