A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. if(!defined('entry') || !entry) die('Not a valid page');
  3. /* ===========================
  4. gelato CMS - A PHP based tumblelog CMS
  5. development version
  6. http://www.gelatocms.com/
  7. gelato CMS is a free software licensed under the GPL 2.0
  8. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  9. =========================== */
  10. ?>
  11. <?php
  12. require_once("lang.functions.php");
  13. require_once('mysql_connection.class.php');
  14. class configuration extends Conexion_Mysql {
  15. var $urlGelato;
  16. var $tablePrefix;
  17. var $idUser;
  18. var $postLimit;
  19. var $title;
  20. var $description;
  21. var $lang;
  22. var $template;
  23. var $urlFriendly;
  24. var $richText;
  25. var $offset_city;
  26. var $offset_time;
  27. var $shorten_links;
  28. function configuration() {
  29. parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
  30. global $isFeed;
  31. if ($this->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
  32. $row=$this->obtenerRegistro();
  33. $this->tablePrefix = Table_prefix;
  34. $this->urlGelato = $row['url_installation'];
  35. $this->postLimit = $row['posts_limit'];
  36. $this->title = $row['title'];
  37. $this->description = $row['description'];
  38. $this->lang = $row['lang'];
  39. $this->template = $row['template'];
  40. initLang($this->lang);
  41. $this->urlFriendly = $this->get_option("url_friendly");
  42. $this->richText = $this->get_option("rich_text");
  43. $this->offsetCity = $this->get_option("offset_city");
  44. $this->offsetTime = $this->get_option("offset_time");
  45. $this->allowComments = $this->get_option("allow_comments");
  46. $this->shorten_links = $this->get_option("shorten_links");
  47. } else {
  48. if($isFeed) {
  49. header("HTTP/1.0 503 Service Unavailable");
  50. header("Retry-After: 60");
  51. exit();
  52. } else {
  53. $message = "
  54. <h3 class=\"important\">Error establishing a database connection</h3>
  55. <p>The configuration info is not available.</p>";
  56. die($message);
  57. }
  58. }
  59. }
  60. function get_option($name){
  61. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  62. $this->ejecutarConsulta($sql);
  63. if ($this->contarRegistros()>0) {
  64. $row=$this->obtenerRegistro();
  65. return $row['val'];
  66. } else {
  67. return "0";
  68. }
  69. }
  70. }
  71. ?>