A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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->offsetCity = $this->get_option("offset_city");
  40. $this->offsetTime = $this->get_option("offset_time");
  41. $this->allowComments = $this->get_option("allow_comments");
  42. } else {
  43. if($isFeed) {
  44. header("HTTP/1.0 503 Service Unavailable");
  45. header("Retry-After: 60");
  46. exit();
  47. } else {
  48. $message = "
  49. <h3 class=\"important\">Error establishing a database connection</h3>
  50. <p>The configuration info is not available.</p>";
  51. die($message);
  52. }
  53. }
  54. }
  55. function get_option($name){
  56. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  57. $this->ejecutarConsulta($sql);
  58. if ($this->contarRegistros()>0) {
  59. $row=$this->obtenerRegistro();
  60. return $row['val'];
  61. } else {
  62. return "0";
  63. }
  64. }
  65. }
  66. ?>