diff options
-rw-r--r-- | modules/gallery/controllers/albums.php | 4 | ||||
-rw-r--r-- | modules/gallery/controllers/quick.php | 5 | ||||
-rw-r--r-- | modules/gallery/helpers/MY_url.php | 21 | ||||
-rw-r--r-- | modules/gallery/views/simple_uploader.html.php | 2 | ||||
-rw-r--r-- | modules/server_add/controllers/server_add.php | 15 | ||||
-rw-r--r-- | modules/user/controllers/logout.php | 7 | ||||
-rw-r--r-- | themes/default/views/login_page.html.php | 48 |
7 files changed, 82 insertions, 20 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index efde4f09..f37609e6 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -23,16 +23,16 @@ class Albums_Controller extends Items_Controller { * @see REST_Controller::_show($resource) */ public function _show($album) { + $page_size = module::get_var("gallery", "page_size", 9); if (!access::can("view", $album)) { if ($album->id == 1) { - print new Theme_View("login_page.html", "album"); + print new Theme_View("login_page.html"); return; } else { access::forbidden(); } } - $page_size = module::get_var("gallery", "page_size", 9); $show = $this->input->get("show"); if ($show) { diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index 6efcb9de..d6f5213f 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -87,9 +87,12 @@ class Quick_Controller extends Controller { access::required("view", $item->parent()); access::required("edit", $item->parent()); + $msg = t("Made <b>%title</b> this album's cover", array("title" => $item->title)); + item::make_album_cover($item); + message::success($msg); - print json_encode(array("result" => "success")); + print json_encode(array("result" => "success", "reload" => 1)); } public function delete($id) { diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php index c8645c4d..7bee70ca 100644 --- a/modules/gallery/helpers/MY_url.php +++ b/modules/gallery/helpers/MY_url.php @@ -46,7 +46,19 @@ class url extends url_Core { return; } - $current_uri = html_entity_decode(Router::$current_uri, ENT_QUOTES); + $item = self::get_item_from_uri(Router::$current_uri); + if ($item && $item->loaded) { + Router::$controller = "{$item->type}s"; + Router::$controller_path = MODPATH . "gallery/controllers/{$item->type}s.php"; + Router::$method = $item->id; + } + } + + /** + * Return the item that the uri is referencing + */ + static function get_item_from_uri($uri) { + $current_uri = html_entity_decode($uri); $item = ORM::factory("item")->where("relative_path_cache", $current_uri)->find(); if (!$item->loaded) { // It's possible that the relative path cache for the item we're looking for is out of date, @@ -61,12 +73,7 @@ class url extends url_Core { } } } - - if ($item && $item->loaded) { - Router::$controller = "{$item->type}s"; - Router::$controller_path = MODPATH . "gallery/controllers/{$item->type}s.php"; - Router::$method = $item->id; - } + return $item; } /** diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index 79919d50..f10d764c 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -93,7 +93,7 @@ button_width: "202", button_height: "45", button_placeholder_id: "gChooseFilesButtonPlaceholder", - button_text: '<span class="swfUploadFont">Select photos...</span>', + button_text: '<span class="swfUploadFont"><?= t("Select photos...") ?></span>', button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }", button_text_left_padding: 30, button_text_top_padding: 10, diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php index 2c6eb5e0..c92b4f7e 100644 --- a/modules/server_add/controllers/server_add.php +++ b/modules/server_add/controllers/server_add.php @@ -87,17 +87,20 @@ class Server_Add_Controller extends Controller { foreach (array_keys($paths) as $valid_path) { $path_length = strlen($valid_path); foreach ($input_files as $key => $path) { - if (!empty($path) && $valid_path != $path && strpos($path, $valid_path) === 0) { - $relative_path = substr(dirname($path), $path_length); - $name = basename($path); - $files[$valid_path][] = array("path" => $relative_path, - "parent_id" => $id, "name" => basename($path), + if (!empty($path)) { + if ($valid_path != $path && strpos($path, $valid_path) === 0) { + $relative_path = substr(dirname($path), $path_length); + $name = basename($path); + $files[$valid_path][] = array("path" => $relative_path, + "parent_id" => $id, "name" => basename($path), "type" => is_dir($path) ? "album" : "file"); - $total_count++; + $total_count++; + } if ($collapsed[$key] === "true") { $total_count += $this->_select_children($id, $valid_path, $path, $files[$valid_path]); } unset($input_files[$key]); + unset($collapsed[$key]); } } } diff --git a/modules/user/controllers/logout.php b/modules/user/controllers/logout.php index 6ceb7192..a541ed9b 100644 --- a/modules/user/controllers/logout.php +++ b/modules/user/controllers/logout.php @@ -26,7 +26,12 @@ class Logout_Controller extends Controller { log::info("user", t("User %name logged out", array("name" => $user->name)), html::anchor("user/$user->id", $user->name)); if ($this->input->get("continue")) { - url::redirect($this->input->get("continue")); + $item = url::get_item_from_uri($this->input->get("continue")); + if (access::can("view", $item)) { + url::redirect($this->input->get("continue")); + } else { + url::redirect(""); + } } } }
\ No newline at end of file diff --git a/themes/default/views/login_page.html.php b/themes/default/views/login_page.html.php index 27f8571e..c4880727 100644 --- a/themes/default/views/login_page.html.php +++ b/themes/default/views/login_page.html.php @@ -7,11 +7,55 @@ <title> <?= t("Please Login to Gallery") ?> </title> + <link rel="shortcut icon" href="<?= $theme->url("images/favicon.ico") ?>" type="image/x-icon" /> + <link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>" + media="screen,print,projection" /> + <link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>" + media="screen" /> + <link rel="stylesheet" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>" + media="screen,print,projection" /> <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/screen.css") ?>" media="screen,print,projection" /> + <!--[if lt IE 8]> + <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>" + media="screen,print,projection" /> + <![endif]--> + <script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script> + <script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script> + <script src="<?= url::file("lib/jquery-ui.js") ?>" type="text/javascript"></script> + <script src="<?= url::file("lib/gallery.common.js") ?>" type="text/javascript"></script> + <script src="<?= url::file("lib/gallery.dialog.js") ?>" type="text/javascript"></script> + <script src="<?= url::file("lib/gallery.form.js") ?>" type="text/javascript"></script> + <script src="<?= url::file("lib/superfish/js/superfish.js") ?>" type="text/javascript"></script> + <script src="<?= $theme->url("js/jquery.scrollTo.js") ?>" type="text/javascript"></script> + <script src="<?= $theme->url("js/jquery.localscroll.js") ?>" type="text/javascript"></script> + <script src="<?= $theme->url("js/ui.init.js") ?>" type="text/javascript"></script> + <?= $theme->head() ?> </head> - <body> - <?= user::get_login_form("login/auth_html") ?> + <body <?= $theme->main_element_attributes() ?>> + <?= $theme->page_top() ?> + <div id="doc4" class="yui-t5 gView"> + <?= $theme->site_status() ?> + <div id="gHeader"> + <?= $theme->display("header.html") ?> + </div> + <div id="bd"> + <div id="yui-main"> + <div class="yui-b"> + <div id="gContent" class="yui-g"> + <?= $theme->messages() ?> + <?= user::get_login_form("login/auth_html") ?> + </div> + </div> + </div> + <div id="gSidebar" class="yui-b"> + </div> + </div> + <div id="gFooter"> + <?= $theme->display("footer.html") ?> + </div> + </div> + <?= $theme->page_bottom() ?> </body> </html> |