A tumblelog CMS built on AJAX, PHP and MySQL.

settings.php 5.5KB

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