A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.0KB

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