A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.5KB

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