A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. $this->active_plugins = $this->get_option("active_plugins");
  51. //TODO: Soporte de los plugins desde BD activar/desactivar
  52. //FIXME cambiar esto por el soporte por carpetas, mas organizado.
  53. // asi se pueden estandarizar documentacion y thumbnails,
  54. /*if ($handle = opendir(Absolute_Path."plugins")) {
  55. while (false !== ($file = readdir($handle))) {
  56. if (substr($file, strlen($file)-4, 4) == ".php") {
  57. require_once(Absolute_Path."plugins/{$file}");
  58. $this->plugins[] = substr($file, 0, strlen($file)-4);
  59. }
  60. }
  61. closedir($handle);
  62. }*/
  63. } else {
  64. if($isFeed) {
  65. header("HTTP/1.0 503 Service Unavailable");
  66. header("Retry-After: 60");
  67. exit();
  68. } else {
  69. $message = "
  70. <h3 class=\"important\">Error establishing a database connection</h3>
  71. <p>The configuration info is not available.</p>";
  72. die($message);
  73. }
  74. }
  75. }
  76. function get_option($name){
  77. global $db;
  78. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  79. $db->ejecutarConsulta($sql);
  80. if ($db->contarRegistros()>0) {
  81. $row=$db->obtenerRegistro();
  82. return $row['val'];
  83. } else {
  84. return "0";
  85. }
  86. }
  87. }
  88. ?>