A tumblelog CMS built on AJAX, PHP and MySQL.

configuration.class.php 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. function configuration() {
  28. parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
  29. global $isFeed;
  30. if ($this->ejecutarConsulta("SELECT * FROM ".Table_prefix."config")) {
  31. $row=$this->obtenerRegistro();
  32. $this->tablePrefix = Table_prefix;
  33. $this->urlGelato = $row['url_installation'];
  34. $this->postLimit = $row['posts_limit'];
  35. $this->title = $row['title'];
  36. $this->description = $row['description'];
  37. $this->lang = $row['lang'];
  38. $this->template = $row['template'];
  39. initLang($this->lang);
  40. $this->urlFriendly = $this->get_option("url_friendly");
  41. $this->richText = $this->get_option("rich_text");
  42. $this->offsetCity = $this->get_option("offset_city");
  43. $this->offsetTime = $this->get_option("offset_time");
  44. $this->allowComments = $this->get_option("allow_comments");
  45. } else {
  46. if($isFeed) {
  47. header("HTTP/1.0 503 Service Unavailable");
  48. header("Retry-After: 60");
  49. exit();
  50. } else {
  51. $message = "
  52. <h3 class=\"important\">Error establishing a database connection</h3>
  53. <p>The configuration info is not available.</p>";
  54. die($message);
  55. }
  56. }
  57. }
  58. function get_option($name){
  59. $sql = "SELECT * FROM ".Table_prefix."options WHERE name='".$name."' LIMIT 1";
  60. $this->ejecutarConsulta($sql);
  61. if ($this->contarRegistros()>0) {
  62. $row=$this->obtenerRegistro();
  63. return $row['val'];
  64. } else {
  65. return "0";
  66. }
  67. }
  68. }
  69. ?>