A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. function configuration() {
  30. parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
  31. global $isFeed;
  32. if ($this->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
  33. $row=$this->obtenerRegistro();
  34. $this->tablePrefix = Table_prefix;
  35. $this->urlGelato = $row['url_installation'];
  36. $this->postLimit = $row['posts_limit'];
  37. $this->title = $row['title'];
  38. $this->description = $row['description'];
  39. $this->lang = $row['lang'];
  40. $this->template = $row['template'];
  41. initLang($this->lang);
  42. $this->urlFriendly = $this->get_option("url_friendly");
  43. $this->richText = $this->get_option("rich_text");
  44. $this->offsetCity = $this->get_option("offset_city");
  45. $this->offsetTime = $this->get_option("offset_time");
  46. $this->allowComments = $this->get_option("allow_comments");
  47. $this->shorten_links = $this->get_option("shorten_links");
  48. $this->rssImportFrec = $this->get_option("rss_import_frec");
  49. } else {
  50. if($isFeed) {
  51. header("HTTP/1.0 503 Service Unavailable");
  52. header("Retry-After: 60");
  53. exit();
  54. } else {
  55. $message = "
  56. <h3 class=\"important\">Error establishing a database connection</h3>
  57. <p>The configuration info is not available.</p>";
  58. die($message);
  59. }
  60. }
  61. }
  62. function get_option($name){
  63. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  64. $this->ejecutarConsulta($sql);
  65. if ($this->contarRegistros()>0) {
  66. $row=$this->obtenerRegistro();
  67. return $row['val'];
  68. } else {
  69. return "0";
  70. }
  71. }
  72. }
  73. ?>