A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 :: <?php echo __("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;"><?php echo __("Processing request...")?></div>
  52. <div id="cont">
  53. <div id="head">
  54. <h1><a href="<?php echo $conf->urlGelato;?>/" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
  55. <ul id="nav">
  56. <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("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><?php echo __("Tumblelog configuration")?></h3>
  63. <li><a href="index.php"><?php echo __("Post")?></a></li>
  64. <li><a href="admin.php"><?php echo __("Users")?></a></li>
  65. <li><a href="options.php"><?php echo __("Options")?></a></li>
  66. <li class="selected"><a><?php echo __("Settings")?></a></li>
  67. </ul>
  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"><?php echo __("Title:")?></label>
  85. <input type="text" name="title" id="title" value="<?php echo $conf->title;?>" class="txt"/></li>
  86. <li><label for="description"><?php echo __("Description:")?></label>
  87. <input type="text" name="description" id="description" value="<?php echo $conf->description;?>" class="txt"/></li>
  88. <li><label for="url_installation"><?php echo __("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"><?php echo __("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"><?php echo __("Language:")?></label>
  93. <select id="lang" name="lang">
  94. <?php
  95. $langs = getLangs();
  96. foreach ($langs as $lang) {
  97. $active = ($conf->lang==$lang) ? "selected" : "";
  98. echo "<option value=\"".$lang."\" ".$active.">".$lang."</option>\n";
  99. }
  100. ?>
  101. </select>
  102. </li>
  103. <li><label for="template"><?php echo __("Template:")?></label>
  104. <select id="template" name="template">
  105. <?php
  106. $themes = getThemes();
  107. foreach ($themes as $theme) {
  108. $active = ($conf->template==$theme) ? "selected" : "";
  109. echo "<option value=\"".$theme."\" ".$active.">".$theme."</option>\n";
  110. }
  111. ?>
  112. </select>
  113. </li>
  114. </ul>
  115. </fieldset>
  116. <p>
  117. <input type="submit" name="btnsubmit" id="btnsubmit" value="<?php echo __("Modify")?>" class="submit"/>
  118. </p>
  119. </form>
  120. </div>
  121. <div class="footer-box">&nbsp;</div>
  122. </div>
  123. </div>
  124. <div id="foot">
  125. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  126. </div>
  127. </div>
  128. </body>
  129. </html>
  130. <?php
  131. }
  132. } else {
  133. header("Location: ".$conf->urlGelato."/login.php");
  134. }
  135. ?>