A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 1.8KB

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