diff options
Diffstat (limited to 'modules/gallery')
-rw-r--r-- | modules/gallery/controllers/admin.php | 12 | ||||
-rw-r--r-- | modules/gallery/controllers/admin_maintenance.php | 9 | ||||
-rw-r--r-- | modules/gallery/controllers/reauthenticate.php | 3 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_block.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/locales.php | 2 | ||||
-rw-r--r-- | modules/gallery/views/admin_maintenance.html.php | 10 |
6 files changed, 17 insertions, 21 deletions
diff --git a/modules/gallery/controllers/admin.php b/modules/gallery/controllers/admin.php index b5f3db39..5467e88a 100644 --- a/modules/gallery/controllers/admin.php +++ b/modules/gallery/controllers/admin.php @@ -30,7 +30,7 @@ class Admin_Controller extends Controller { public function __call($controller_name, $args) { if (auth::must_reauth_for_admin_area()) { - return url::redirect("reauthenticate"); + return self::_prompt_for_reauth($controller_name, $args); } if (request::method() == "post") { @@ -53,5 +53,15 @@ class Admin_Controller extends Controller { call_user_func_array(array(new $controller_name, $method), $args); } + + private static function _prompt_for_reauth($controller_name, $args) { + if (request::method() == "get" && !request::is_ajax()) { + $url_args = array("admin", $controller_name) + $args; + $continue_url = join("/", $url_args); + // Avoid anti-phishing protection by passing the url as session variable. + Session::instance()->set("continue_url", $continue_url); + } + url::redirect("reauthenticate"); + } } diff --git a/modules/gallery/controllers/admin_maintenance.php b/modules/gallery/controllers/admin_maintenance.php index 8e4845a9..d90fe0ea 100644 --- a/modules/gallery/controllers/admin_maintenance.php +++ b/modules/gallery/controllers/admin_maintenance.php @@ -46,15 +46,6 @@ class Admin_Maintenance_Controller extends Admin_Controller { ->where("done", "=", 0)->order_by("updated", "DESC")->find_all(); $view->content->finished_tasks = ORM::factory("task") ->where("done", "=", 1)->order_by("updated", "DESC")->find_all(); - $task_buttons = - new ArrayObject(array((object)array("text" => t("run"), - "url" =>url::site("admin/maintenance/start")))); - module::event("admin_maintenance_task_buttons", $task_buttons); - $view->content->task_buttons = $task_buttons; - - $maintenance_content = new ArrayObject(); - module::event("admin_maintenance_content", $maintenance_content); - $view->content->task_maintenance_content = $maintenance_content; print $view; } diff --git a/modules/gallery/controllers/reauthenticate.php b/modules/gallery/controllers/reauthenticate.php index 4b88a9cc..dbd1cd21 100644 --- a/modules/gallery/controllers/reauthenticate.php +++ b/modules/gallery/controllers/reauthenticate.php @@ -37,7 +37,8 @@ class Reauthenticate_Controller extends Controller { if ($valid) { message::success(t("Successfully re-authenticated!")); module::event("user_auth", $user); - url::redirect("admin"); + $continue_url = Session::instance()->get_once("continue_url", "admin"); + url::redirect($continue_url); } else { $name = $user->name; log::warning("user", t("Failed re-authentication for %name", array("name" => $name))); diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index be0f11b8..46742743 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -70,7 +70,7 @@ class gallery_block_Core { $block->css_id = "g-platform"; $block->title = t("Platform information"); $block->content = new View("admin_block_platform.html"); - if (is_readable("/proc/loadavg")) { + if (@is_readable("/proc/loadavg")) { $block->content->load_average = join(" ", array_slice(explode(" ", current(file("/proc/loadavg"))), 0, 3)); } else { diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index 4af750a3..883d2f9a 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -64,7 +64,7 @@ class locales_Core { // @todo Might want to add a localizable language name as well. private static function _init_language_data() { $l["af_ZA"] = "Afrikaans"; // Afrikaans - $l["ar_SA"] = "العربي"; // Arabic + $l["ar_SA"] = "العربية"; // Arabic $l["be_BY"] = "Беларускі"; // Belarusian $l["bg_BG"] = "български"; // Bulgarian $l["ca_ES"] = "Catalan"; // Catalan diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index 19375670..ac597715 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -29,22 +29,16 @@ <?= $task->description ?> </td> <td> - <? foreach ($task_buttons as $button): ?> - <a href="<?= "{$button->url}/$task->callback?csrf=$csrf" ?>" + <a href="<?= url::site("admin/maintenance/start/$task->callback?csrf=$csrf") ?>" class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all"> - <?= html::clean($button->text) ?> + <?= t("run") ?> </a> - <? endforeach ?> </td> </tr> <? endforeach ?> </table> </div> - <? foreach ($task_maintenance_content as $content): ?> - <?= html::purify($content) ?> - <? endforeach ?> - <? if ($running_tasks->count()): ?> <div id="g-running-tasks"> <h2> <?= t("Running tasks") ?> </h2> |