A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. if(!defined('entry') || !entry) die('Not a valid page');
  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. ?>
  11. <?php
  12. require_once("lang.functions.php");
  13. require_once('mysql_connection.class.php');
  14. class configuration extends Conexion_Mysql {
  15. var $urlGelato;
  16. var $tablePrefix;
  17. var $idUser;
  18. var $postLimit;
  19. var $title;
  20. var $description;
  21. var $lang;
  22. var $template;
  23. var $urlFriendly;
  24. var $richText;
  25. var $offset_city;
  26. var $offset_time;
  27. var $shorten_links;
  28. var $rssImportFrec;
  29. var $check_version;
  30. function configuration() {
  31. parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
  32. global $isFeed;
  33. if ($this->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
  34. $row=$this->obtenerRegistro();
  35. $this->tablePrefix = Table_prefix;
  36. $this->urlGelato = $row['url_installation'];
  37. $this->postLimit = $row['posts_limit'];
  38. $this->title = $row['title'];
  39. $this->description = $row['description'];
  40. $this->lang = $row['lang'];
  41. $this->template = $row['template'];
  42. initLang($this->lang);
  43. $this->urlFriendly = $this->get_option("url_friendly");
  44. $this->richText = $this->get_option("rich_text");
  45. $this->offsetCity = $this->get_option("offset_city");
  46. $this->offsetTime = $this->get_option("offset_time");
  47. $this->allowComments = $this->get_option("allow_comments");
  48. $this->shorten_links = $this->get_option("shorten_links");
  49. $this->rssImportFrec = $this->get_option("rss_import_frec");
  50. $this->check_version = $this->get_option("check_version");
  51. } else {
  52. if($isFeed) {
  53. header("HTTP/1.0 503 Service Unavailable");
  54. header("Retry-After: 60");
  55. exit();
  56. } else {
  57. $message = "
  58. <h3 class=\"important\">Error establishing a database connection</h3>
  59. <p>The configuration info is not available.</p>";
  60. die($message);
  61. }
  62. }
  63. }
  64. function get_option($name){
  65. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  66. $this->ejecutarConsulta($sql);
  67. if ($this->contarRegistros()>0) {
  68. $row=$this->obtenerRegistro();
  69. return $row['val'];
  70. } else {
  71. return "0";
  72. }
  73. }
  74. }
  75. ?>