diff options
-rw-r--r-- | core/controllers/admin_graphics.php | 4 | ||||
-rw-r--r-- | core/helpers/core_installer.php | 19 | ||||
-rw-r--r-- | core/helpers/graphics.php | 23 | ||||
-rw-r--r-- | core/views/admin_graphics_none.html.php | 7 | ||||
-rw-r--r-- | installer/install.sql | 4 | ||||
-rw-r--r-- | modules/user/controllers/login.php | 10 |
6 files changed, 44 insertions, 23 deletions
diff --git a/core/controllers/admin_graphics.php b/core/controllers/admin_graphics.php index 1624c896..6676a808 100644 --- a/core/controllers/admin_graphics.php +++ b/core/controllers/admin_graphics.php @@ -24,8 +24,8 @@ class Admin_Graphics_Controller extends Admin_Controller { $view->content->available = ""; $tk = new ArrayObject(graphics::detect_toolkits(), ArrayObject::ARRAY_AS_PROPS); - $active = module::get_var("core", "graphics_toolkit"); - foreach (array("gd", "imagemagick", "graphicsmagick") as $id) { + $active = module::get_var("core", "graphics_toolkit", "none"); + foreach (array("gd", "imagemagick", "graphicsmagick", "none") as $id) { if ($id == $active) { $view->content->active = new View("admin_graphics_$id.html"); $view->content->active->tk = $tk; diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php index 7bdcd376..8775cafe 100644 --- a/core/helpers/core_installer.php +++ b/core/helpers/core_installer.php @@ -224,24 +224,6 @@ class core_installer { array("width" => 640, "height" => 480, "master" => Image::AUTO), 100); - // Detect a graphics toolkit - $toolkits = graphics::detect_toolkits(); - foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) { - if ($toolkits[$tk]) { - module::set_var("core", "graphics_toolkit", $tk); - if ($tk != "gd") { - module::set_var("core", "graphics_toolkit_path", $toolkits[$tk]); - } - break; - } - } - if (!module::get_var("core", "graphics_toolkit")) { - site_status::warning( - t("Graphics toolkit missing! Please <a href=\"%url\">choose a toolkit</a>", - array("url" => url::site("admin/graphics"))), - "missing_graphics_toolkit"); - } - // Instantiate default themes (site and admin) foreach (array("default", "admin_default") as $theme_name) { $theme_info = new ArrayObject(parse_ini_file(THEMEPATH . $theme_name . "/theme.info"), @@ -262,6 +244,7 @@ class core_installer { module::set_version("core", 1); module::set_var("core", "version", "3.0 pre-beta svn"); + module::set_var("core", "choose_default_tookit", 1); } } diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php index 290d2677..1caebc44 100644 --- a/core/helpers/graphics.php +++ b/core/helpers/graphics.php @@ -275,6 +275,29 @@ class graphics_Core { } /** + * This needs to be run once, after the initial install, to choose a graphics toolkit. + */ + static function choose_default_toolkit() { + // Detect a graphics toolkit + $toolkits = graphics::detect_toolkits(); + foreach (array("imagemagick", "graphicsmagick", "gd") as $tk) { + if ($toolkits[$tk]) { + module::set_var("core", "graphics_toolkit", $tk); + if ($tk != "gd") { + module::set_var("core", "graphics_toolkit_path", $toolkits[$tk]); + } + break; + } + } + if (!module::get_var("core", "graphics_toolkit")) { + site_status::warning( + t("Graphics toolkit missing! Please <a href=\"%url\">choose a toolkit</a>", + array("url" => url::site("admin/graphics"))), + "missing_graphics_toolkit"); + } + } + + /** * Choose which driver the Kohana Image library uses. */ static function init_toolkit() { diff --git a/core/views/admin_graphics_none.html.php b/core/views/admin_graphics_none.html.php new file mode 100644 index 00000000..5306a70d --- /dev/null +++ b/core/views/admin_graphics_none.html.php @@ -0,0 +1,7 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div id="none" class="gBlock"> + <h3 class="gWarning"> <?= t("No Active Toolkit") ?> </h3> + <p> + <?= t("We were unable to detect a graphics program. You must install one of the toolkits below in order to many Gallery features.") ?> + </p> +</div> diff --git a/installer/install.sql b/installer/install.sql index a55aa8be..15a65f73 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -324,6 +324,6 @@ CREATE TABLE {vars} ( `value` text, PRIMARY KEY (`id`), UNIQUE KEY `module_name` (`module_name`,`name`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO {vars} VALUES (1,'core','active_site_theme','default'),(2,'core','active_admin_theme','admin_default'),(3,'core','page_size','9'),(4,'core','thumb_size','200'),(5,'core','resize_size','640'),(6,'core','default_locale','en_US'),(7,'core','graphics_toolkit','imagemagick'),(8,'core','graphics_toolkit_path','/usr/bin'),(9,'core','blocks_dashboard_sidebar','a:4:{i:1804289383;a:2:{i:0;s:4:\"core\";i:1;s:11:\"block_adder\";}i:846930886;a:2:{i:0;s:4:\"core\";i:1;s:5:\"stats\";}i:1681692777;a:2:{i:0;s:4:\"core\";i:1;s:13:\"platform_info\";}i:1714636915;a:2:{i:0;s:4:\"core\";i:1;s:12:\"project_news\";}}'),(10,'core','blocks_dashboard_center','a:4:{i:1957747793;a:2:{i:0;s:4:\"core\";i:1;s:7:\"welcome\";}i:424238335;a:2:{i:0;s:4:\"core\";i:1;s:12:\"photo_stream\";}i:719885386;a:2:{i:0;s:4:\"core\";i:1;s:11:\"log_entries\";}i:1649760492;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'),(11,'core','version','3.0 pre-beta svn'),(12,'comment','spam_caught','0'); +INSERT INTO {vars} VALUES (1,'core','active_site_theme','default'),(2,'core','active_admin_theme','admin_default'),(3,'core','page_size','9'),(4,'core','thumb_size','200'),(5,'core','resize_size','640'),(6,'core','default_locale','en_US'),(7,'core','blocks_dashboard_sidebar','a:4:{i:1804289383;a:2:{i:0;s:4:\"core\";i:1;s:11:\"block_adder\";}i:846930886;a:2:{i:0;s:4:\"core\";i:1;s:5:\"stats\";}i:1681692777;a:2:{i:0;s:4:\"core\";i:1;s:13:\"platform_info\";}i:1714636915;a:2:{i:0;s:4:\"core\";i:1;s:12:\"project_news\";}}'),(8,'core','blocks_dashboard_center','a:4:{i:1957747793;a:2:{i:0;s:4:\"core\";i:1;s:7:\"welcome\";}i:424238335;a:2:{i:0;s:4:\"core\";i:1;s:12:\"photo_stream\";}i:719885386;a:2:{i:0;s:4:\"core\";i:1;s:11:\"log_entries\";}i:1649760492;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'),(9,'core','version','3.0 pre-beta svn'),(10,'core','choose_default_tookit','1'),(11,'comment','spam_caught','0'); diff --git a/modules/user/controllers/login.php b/modules/user/controllers/login.php index 86842a9a..635d9997 100644 --- a/modules/user/controllers/login.php +++ b/modules/user/controllers/login.php @@ -58,7 +58,8 @@ class Login_Controller extends Controller { $user = ORM::factory("user")->where("name", $form->login->inputs["name"]->value)->find(); if (!$user->loaded || !user::is_correct_password($user, $form->login->password->value)) { log::warning( - "user", t("Failed login for %name", array("name" => $form->login->inputs["name"]->value))); + "user", + t("Failed login for %name", array("name" => $form->login->inputs["name"]->value))); $form->login->inputs["name"]->add_error("invalid_login", 1); $valid = false; } @@ -67,6 +68,13 @@ class Login_Controller extends Controller { if ($valid) { user::login($user); log::info("user", t("User %name logged in", array("name" => $user->name))); + + // If this user is an admin, check to see if there are any post-install tasks that we need + // to run and take care of those now. + if ($user->admin && module::get_var("core", "choose_default_tookit", null)) { + graphics::choose_default_toolkit(); + module::clear_var("core", "choose_default_tookit"); + } } return array($valid, $form); |