A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.0KB

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