A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. <?php
  96. $langs = getLangs();
  97. foreach ($langs as $lang) {
  98. $active = ($conf->lang==$lang) ? "selected" : "";
  99. echo "<option value=\"".$lang."\" ".$active.">".$lang."</option>\n";
  100. }
  101. ?>
  102. </select>
  103. </li>
  104. <li><label for="template"><?=__("Template:")?></label>
  105. <select id="template" name="template">
  106. <?php
  107. $themes = getThemes();
  108. foreach ($themes as $theme) {
  109. $active = ($conf->template==$theme) ? "selected" : "";
  110. echo "<option value=\"".$theme."\" ".$active.">".$theme."</option>\n";
  111. }
  112. ?>
  113. </select>
  114. </li>
  115. </ul>
  116. </fieldset>
  117. <p>
  118. <input type="submit" name="btnsubmit" id="btnsubmit" value="<?=__("Modify")?>" class="submit"/>
  119. </p>
  120. </form>
  121. </div>
  122. <div class="footer-box">&nbsp;</div>
  123. </div>
  124. </div>
  125. <div id="foot">
  126. <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
  127. </div>
  128. </div>
  129. </body>
  130. </html>
  131. <?php
  132. }
  133. } else {
  134. header("Location: ".$conf->urlGelato."/login.php");
  135. }
  136. ?>