A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /* ===========================
  3. gelato CMS - A PHP based tumblelog CMS
  4. development version
  5. http://www.gelatocms.com/
  6. gelato CMS is a free software licensed under the GPL 2.0
  7. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  8. =========================== */
  9. ?>
  10. <?php
  11. require_once("lang.functions.php");
  12. class configuration extends Conexion_Mysql {
  13. var $urlGelato;
  14. var $tablePrefix;
  15. var $idUser;
  16. var $postLimit;
  17. var $title;
  18. var $description;
  19. var $lang;
  20. var $template;
  21. var $urlFriendly;
  22. var $richText;
  23. var $offset_city;
  24. var $offset_time;
  25. function configuration() {
  26. parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
  27. global $isFeed;
  28. if ($this->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
  29. $row=$this->obtenerRegistro();
  30. $this->tablePrefix = Table_prefix;
  31. $this->urlGelato = $row['url_installation'];
  32. $this->postLimit = $row['posts_limit'];
  33. $this->title = $row['title'];
  34. $this->description = $row['description'];
  35. $this->lang = $row['lang'];
  36. $this->template = $row['template'];
  37. initLang($this->lang);
  38. $this->urlFriendly = $this->get_option("url_friendly");
  39. $this->richText = $this->get_option("rich_text");
  40. $this->offsetCity = $this->get_option("offset_city");
  41. $this->offsetTime = $this->get_option("offset_time");
  42. $this->allowComments = $this->get_option("allow_comments");
  43. } else {
  44. if($isFeed) {
  45. header("HTTP/1.0 503 Service Unavailable");
  46. header("Retry-After: 60");
  47. exit();
  48. } else {
  49. $message = "
  50. <h3 class=\"important\">Error establishing a database connection</h3>
  51. <p>The configuration info is not available.</p>";
  52. die($message);
  53. }
  54. }
  55. }
  56. function get_option($name){
  57. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  58. $this->ejecutarConsulta($sql);
  59. if ($this->contarRegistros()>0) {
  60. $row=$this->obtenerRegistro();
  61. return $row['val'];
  62. } else {
  63. return "0";
  64. }
  65. }
  66. }
  67. ?>