diff --git a/core/config.class.php b/core/config.class.php index a82e1bfc..4f0bfd62 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -1,13 +1,11 @@ '/thumbs/$id.jpg', - 'image_ilink' => '/images/$id.$ext', - ); + var $values = array(); var $defaults = array( 'title' => 'Shimmie', # setup - 'version' => 'Shimmie2-0.0.9', // internal + 'version' => 'Shimmie2-2.0.2', // internal 'db_version' => '2.0.0.9', // this should be managed by upgrade.php + 'front_page' => 'index', # setup 'base_href' => './index.php?q=', # setup 'data_href' => './', # setup 'theme' => 'default', # setup @@ -101,19 +99,19 @@ class Config { $this->save($name); } - public function get_int($name) { + public function get_int($name, $default=null) { // deprecated -- ints should be stored as ints now - return parse_shorthand_int($this->get($name)); + return parse_shorthand_int($this->get($name, $default)); } - public function get_string($name) { - return $this->get($name); + public function get_string($name, $default=null) { + return $this->get($name, $default); } - public function get_bool($name) { + public function get_bool($name, $default=null) { // deprecated -- bools should be stored as Y/N now - return ($this->get($name) == 'Y' || $this->get($name) == '1'); + return ($this->get($name, $default) == 'Y' || $this->get($name, $default) == '1'); } - public function get($name) { + public function get($name, $default=null) { if(isset($this->values[$name])) { return $this->values[$name]; } @@ -121,7 +119,7 @@ class Config { return $this->defaults[$name]; } else { - return null; + return $default; } } } diff --git a/core/ext/setup.ext.php b/core/ext/setup.ext.php index 38c3914c..42e4d229 100644 --- a/core/ext/setup.ext.php +++ b/core/ext/setup.ext.php @@ -124,6 +124,8 @@ class Setup extends Extension { $sb = new SetupBlock("General"); $sb->add_label("Site title: "); $sb->add_text_option("title"); + $sb->add_label("
Front page: "); + $sb->add_text_option("front_page"); $sb->add_label("
Base URL: "); $sb->add_text_option("base_href"); $sb->add_label("
Data URL: "); @@ -139,6 +141,7 @@ class Setup extends Extension { } if(is_a($event, 'ConfigSaveEvent')) { $event->config->set_string_from_post("title"); + $event->config->set_string_from_post("front_page"); $event->config->set_string_from_post("base_href"); $event->config->set_string_from_post("data_href"); $event->config->set_string_from_post("contact_link"); diff --git a/core/util.inc.php b/core/util.inc.php index ed059e1a..43904d96 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -246,6 +246,7 @@ function send_event($event) { \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ function _get_query_parts() { + global $config; if(isset($_GET["q"])) { $path = $_GET["q"]; } @@ -253,7 +254,7 @@ function _get_query_parts() { $path = $_SERVER["PATH_INFO"]; } else { - $path = "index/1"; + $path = $config->get_string('front_page', 'index'); } while(strlen($path) > 0 && $path[0] == '/') {