A tumblelog CMS built on AJAX, PHP and MySQL.

options.php 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /* ===========================
  3. gelato CMS - A PHP based tumblelog CMS
  4. development version
  5. http://www.gelatocms.com/
  6. gelato CMS is a free software licensed under the GPL 2.0
  7. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  8. =========================== */
  9. ?>
  10. <?php
  11. require_once('../config.php');
  12. include("../classes/functions.php");
  13. include("../classes/user.class.php");
  14. include("../classes/gelato.class.php");
  15. require_once("../classes/configuration.class.php");
  16. $user = new user();
  17. $tumble = new gelato();
  18. $conf = new configuration();
  19. if ($user->isAdmin()) {
  20. if(isset($_POST["btnsubmit"])) {
  21. if (!$tumble->saveOption($_POST["rich_text"], "rich_text")) {
  22. header("Location: ".$conf->urlGelato."/admin/options.php?error=1&des=".$conf->merror);
  23. die();
  24. }
  25. if (!$tumble->saveOption($_POST["url_friendly"], "url_friendly")) {
  26. header("Location: ".$conf->urlGelato."/admin/options.php?error=1&des=".$conf->merror);
  27. die();
  28. }
  29. header("Location: ".$conf->urlGelato."/admin/options.php?modified=true");
  30. die();
  31. } else {
  32. ?>
  33. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  34. <html xmlns="http://www.w3.org/1999/xhtml">
  35. <head>
  36. <title>gelato :: <?=__("options")?></title>
  37. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  38. <meta name="generator" content="gelato cms <?php echo version();?>" />
  39. <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
  40. <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/mootools.js"></script>
  41. <script type="text/javascript">
  42. <!--
  43. window.onload = function() {
  44. contenedor = new Fx.Style('divMessages', 'opacity', {duration: 5000, onComplete:
  45. function() {
  46. document.getElementById('divMessages').style.display="none";
  47. }
  48. });
  49. contenedor.custom(1,0);
  50. }
  51. -->
  52. </script>
  53. <style type="text/css" media="screen">
  54. @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
  55. </style>
  56. </head>
  57. <body>
  58. <div id="div-process" style="display:none;"><?=__("Processing request...")?></div>
  59. <div id="cont">
  60. <div id="head">
  61. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?=__("home")?>">gelato cms</a></h1>
  62. <ul id="nav">
  63. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?=__("Take me to the tumblelog")?>"><?=__("Back to the Tumblelog")?></a></li>
  64. </ul>
  65. </div>
  66. <div id="main">
  67. <div class="box">
  68. <ul class="menu manage">
  69. <h3><?=__("Tumblelog options")?></h3>
  70. <li><a href="index.php"><?=__("Post")?></a></li>
  71. <li><a href="admin.php"><?=__("Users")?></a></li>
  72. <li><a href="settings.php"><?=__("Settings")?></a></li>
  73. <li class="selected"><a><?=__("Options")?></a></li>
  74. </ul>
  75. <p>&nbsp;</p>
  76. <?php
  77. if (isset($_GET["modified"])) {
  78. if ($_GET["modified"]=="true") {
  79. echo "<div class=\"exito\" id=\"divMessages\">".__("The configuration has been modified successfully.")."</div>";
  80. }
  81. }
  82. if (isset($_GET["error"])) {
  83. if ($_GET["error"]==1) {
  84. echo "<div class=\"error\" id=\"divMessages\"><strong>".__("Error on the database server: ")."</strong>".$_GET["des"]."</div>";
  85. }
  86. }
  87. ?>
  88. <div class="tabla">
  89. <form action="options.php" method="post" id="options_form" autocomplete="off" class="newpost">
  90. <fieldset>
  91. <ul>
  92. <li><label for="rich_text"><?=__("Rich text editor:")?></label>
  93. <select name="rich_text" id="rich_text">
  94. <option value="1" <?php if($conf->richText) echo "selected"; ?>><?=__("Active")?></option>
  95. <option value="0" <?php if(!$conf->richText) echo "selected"; ?>><?=__("Deactive")?></option>
  96. </select>
  97. </li>
  98. <li><label for="url_friendly">URL friendly:</label>
  99. <select name="url_friendly" id="url_friendly">
  100. <option value="1" <?php if($conf->urlFriendly) echo "selected"; ?>><?=__("Active")?></option>
  101. <option value="0" <?php if(!$conf->urlFriendly) echo "selected"; ?>><?=__("Deactive")?></option>
  102. </select>
  103. </li>
  104. </ul>
  105. </fieldset>
  106. <p>
  107. <input type="submit" name="btnsubmit" id="btnsubmit" value="<?=__("Modify")?>" class="submit"/>
  108. </p>
  109. </form>
  110. </div>
  111. <div class="footer-box">&nbsp;</div>
  112. </div>
  113. </div>
  114. <div id="foot">
  115. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  116. </div>
  117. </div>
  118. </body>
  119. </html>
  120. <?php
  121. }
  122. } else {
  123. header("Location: ".$conf->urlGelato."/login.php");
  124. }
  125. ?>