A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 1.9KB

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