A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.7KB

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