A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. class configuration {
  13. var $urlGelato;
  14. var $tablePrefix;
  15. var $idUser;
  16. var $postLimit;
  17. var $title;
  18. var $description;
  19. var $lang;
  20. var $template;
  21. var $urlFriendly;
  22. var $richText;
  23. var $offset_city;
  24. var $offset_time;
  25. var $shorten_links;
  26. var $rssImportFrec;
  27. var $check_version;
  28. var $plugins = array();
  29. function configuration() {
  30. global $isFeed;
  31. global $db;
  32. if ($db->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
  33. $row=$db->obtenerRegistro();
  34. $this->tablePrefix = Table_prefix;
  35. $this->urlGelato = $row['url_installation'];
  36. $this->postLimit = $row['posts_limit'];
  37. $this->title = $row['title'];
  38. $this->description = $row['description'];
  39. $this->lang = $row['lang'];
  40. $this->template = $row['template'];
  41. initLang($this->lang);
  42. $this->urlFriendly = $this->get_option("url_friendly");
  43. $this->richText = $this->get_option("rich_text");
  44. $this->offsetCity = $this->get_option("offset_city");
  45. $this->offsetTime = $this->get_option("offset_time");
  46. $this->allowComments = $this->get_option("allow_comments");
  47. $this->shorten_links = $this->get_option("shorten_links");
  48. $this->rssImportFrec = $this->get_option("rss_import_frec");
  49. $this->check_version = $this->get_option("check_version");
  50. //TODO: Soporte de los plugins desde BD activar/desactivar
  51. if ($handle = opendir("plugins")) {
  52. while (false !== ($file = readdir($handle))) {
  53. if (substr($file, strlen($file)-3, 3) == "php") {
  54. require_once("plugins/{$file}");
  55. $this->plugins[] = substr($file, 0, strlen($file)-4);
  56. }
  57. }
  58. closedir($handle);
  59. }
  60. } else {
  61. if($isFeed) {
  62. header("HTTP/1.0 503 Service Unavailable");
  63. header("Retry-After: 60");
  64. exit();
  65. } else {
  66. $message = "
  67. <h3 class=\"important\">Error establishing a database connection</h3>
  68. <p>The configuration info is not available.</p>";
  69. die($message);
  70. }
  71. }
  72. }
  73. function get_option($name){
  74. global $db;
  75. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  76. $db->ejecutarConsulta($sql);
  77. if ($db->contarRegistros()>0) {
  78. $row=$db->obtenerRegistro();
  79. return $row['val'];
  80. } else {
  81. return "0";
  82. }
  83. }
  84. }
  85. ?>