A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.2KB

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