A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 1.7KB

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