A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 1.8KB

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