1
0

Merge remote branch 'upstream/master'

This commit is contained in:
danneh3826 2010-11-26 22:29:31 +00:00
commit bd1cf8a297
44 changed files with 719 additions and 253 deletions

View File

@ -0,0 +1,69 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_Albumpassword_Controller extends Admin_Controller {
public function index() {
// Generate a new admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_albumpassword.html");
// Generate a form for controlling the admin section.
$view->content->albumpassword_form = $this->_get_admin_form();
// Display the page.
print $view;
}
private function _get_admin_form() {
// Make a new form for changing admin settings for this module.
$form = new Forge("admin/albumpassword/saveprefs", "", "post",
array("id" => "g-album-password-admin-form"));
// Should protected items be hidden, or completely in-accessable?
$albumpassword_group = $form->group("album_password_group");
$albumpassword_group->checkbox("hideonly")
->label("Only hide protected albums?")
->checked(module::get_var("albumpassword", "hideonly"));
// Add a save button to the form.
$albumpassword_group->submit("save_settings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
public function saveprefs() {
// Save user specified preferences.
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Retrieve submitted form data.
if (Input::instance()->post("hideonly") == false) {
module::set_var("albumpassword", "hideonly", false);
} else {
module::set_var("albumpassword", "hideonly", true);
}
// Display a success message and redirect back to the TagsMap admin page.
message::success(t("Your settings have been saved."));
url::redirect("admin/albumpassword");
}
}

View File

@ -84,7 +84,7 @@ class albumpassword_Controller extends Controller {
// Display a success message and close the dialog.
message::success(t("Password saved."));
json::reply(array("result" => "success"));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
}
public function logout() {
@ -112,10 +112,10 @@ class albumpassword_Controller extends Controller {
// If not, close the dialog and display a rejected message.
cookie::set("g3_albumpassword", $album_password);
message::success(t("Password Accepted."));
json::reply(array("result" => "success"));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
} else {
message::error(t("Password Rejected."));
json::reply(array("result" => "success"));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
}
}
@ -129,7 +129,7 @@ class albumpassword_Controller extends Controller {
$assignpassword_group->input("assignpassword_password")
->id('assignpassword_password')
->label(t("Password:"));
$form->submit("save_password")->value(t("Save"));
$assignpassword_group->submit("save_password")->value(t("Save"));
// Return the newly generated form.
return $form;
@ -139,12 +139,14 @@ class albumpassword_Controller extends Controller {
// Generate a form for allowing visitors to enter in their passwords.
$form = new Forge("albumpassword/checkpassword", "", "post",
array("id" => "g-login-password-form"));
$assignpassword_group = $form->group("Enter Password")
->label(t("Enter Password:"));
$assignpassword_group->input("albumpassword_password")
$assignpassword_group->password("albumpassword_password")
->id('albumpassword_password')
->label(t("Password:"));
$form->submit("login_password")->value(t("Login"));
$assignpassword_group->submit("")->value(t("Login"));
// Return the newly generated form.
return $form;

View File

@ -0,0 +1,58 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class access extends access_Core {
static function required($perm_name, $item) {
// Original code from the required function in modules/gallery/helpers/access.php.
if (!self::can($perm_name, $item)) {
if ($perm_name == "view") {
// Treat as if the item didn't exist, don't leak any information.
throw new Kohana_404_Exception();
} else {
self::forbidden();
}
// Begin rWatcher modifications.
// Throw a 404 error when a user attempts to access a protected item,
// unless the password has been provided, or the user is the item's owner.
} elseif (module::get_var("albumpassword", "hideonly") == false) {
$album_item = "";
do {
if ($album_item == "") {
if ($item->is_album()) {
$album_item = $item;
} else {
$album_item = $item->parent();
}
} else {
$album_item = $album_item->parent();
}
$existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $album_item->id)->find();
if ($existing_password->loaded()) {
if ((cookie::get("g3_albumpassword") != $existing_password->password) &&
(identity::active_user()->id != $album_item->owner_id)) {
throw new Kohana_404_Exception();
}
}
} while ($album_item->parent_id > 0);
}
}
}

View File

@ -20,32 +20,19 @@
class item extends item_Core {
static function viewable($model) {
// Hide the contents of a password protected album,
// Unless the current user is an admin, or the albums owner.
// Hide password protected albums until the correct password is entered,
// unless the current user is an admin, or the albums owner.
$model = item_Core::viewable($model);
$album_item = ORM::factory("item")->where("id", "=", $model->id)->find();
// Figure out if the user can access this album.
$deny_access = false;
$existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $model->id)->find();
if ($existing_password->loaded()) {
if ((cookie::get("g3_albumpassword") != $existing_password->password) &&
(identity::active_user()->id != $album_item->owner_id))
$deny_access = true;
}
// set access::DENY if necessary.
if ($deny_access == true) {
$view_restrictions = array();
if (!identity::active_user()->admin) {
foreach (identity::group_ids_for_active_user() as $id) {
$view_restrictions[] = array("items.view_$id", "=", access::DENY);
}
}
}
if (count($view_restrictions)) {
$model->and_open()->merge_or_where($view_restrictions)->close();
// If the user is an admin, don't hide anything anything.
// If not, hide whatever is restricted by an album password
// that the current user is not the owner of.
if (!identity::active_user()->admin) {
$model->and_open()->join("items_albumpasswords", "items.id", "items_albumpasswords.album_id", "LEFT OUTER")
->and_where("items_albumpasswords.album_id", "IS", NULL)
->or_where("items_albumpasswords.password", "=", cookie::get("g3_albumpassword"))
->or_where("items.owner_id", "=", identity::active_user()->id)->close();
}
return $model;

View File

@ -80,7 +80,7 @@ class albumpassword_event_Core {
->label(t("Remove password"))
->css_id("g-album-password-remove")
->url(url::site("albumpassword/remove/" . $item->id)));
} else {
} elseif ($item->id != 1) {
$menu->get("options_menu")
->append(Menu::factory("dialog")
->id("albumpassword_assign")
@ -101,4 +101,13 @@ class albumpassword_event_Core {
db::build()->delete("items_albumpassword")->where("album_id", "=", $item->id)->execute();
}
}
static function admin_menu($menu, $theme) {
// Add a link to the Album Password admin page to the Content menu.
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("albumpassword")
->label(t("Album Password Settings"))
->url(url::site("admin/albumpassword")));
}
}

View File

@ -28,9 +28,19 @@ class albumpassword_installer {
PRIMARY KEY (`id`))
DEFAULT CHARSET=utf8;");
// Set the default value for this module's behavior.
module::set_var("albumpassword", "hideonly", true);
// Set the module's version number.
module::set_version("albumpassword", 1);
module::set_version("albumpassword", 2);
}
static function upgrade($version) {
// Set the default value for this module's behavior.
module::set_var("albumpassword", "hideonly", true);
// Set the module's version number.
module::set_version("albumpassword", 2);
}
static function uninstall() {

View File

@ -1,3 +1,3 @@
name = "Album Password"
description = "Restrict access to individual albums."
version = 1
version = 2

View File

@ -0,0 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<h2>
<?= t("Album Password Admin") ?>
</h2>
<br />
<div class="g-block">
<?= t("If this box is checked, protected albums will only be hidden. Anyone with the URL to either the album or it's contents will be able to access it without a password.") ?><br /><br />
<?= $albumpassword_form ?>
</div>

View File

@ -1,20 +1,3 @@
<script type="text/javascript">
function ajaxify_login_reset_form() {
$("#g-login form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#g-login form").replaceWith(data.form);
ajaxify_login_reset_form();
}
if (data.result == "success") {
$("#g-dialog").dialog("close");
window.location.reload();
}
}
});
};
</script>
<div id="g-assign-password">
<ul>
<li id="g-assign-password-form">

View File

@ -1,20 +1,3 @@
<script type="text/javascript">
function ajaxify_login_reset_form() {
$("#g-login form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#g-login form").replaceWith(data.form);
ajaxify_login_reset_form();
}
if (data.result == "success") {
$("#g-dialog").dialog("close");
window.location.reload();
}
}
});
};
</script>
<div id="g-login-password">
<ul>
<li id="g-login-password-form">

View File

@ -287,9 +287,13 @@ class downloadalbum_Controller extends Controller {
* See http://bugs.php.net/bug.php?id=45028
*/
private function fixBug45028($hash) {
return (version_compare(PHP_VERSION, '5.2.7', '<'))
? (($hash & 0x000000ff) << 24) + (($hash & 0x0000ff00) << 8)
+ (($hash & 0x00ff0000) >> 8) + (($hash & 0xff000000) >> 24)
: $hash;
$output = $hash;
if( version_compare(PHP_VERSION, '5.2.7', '<') ) {
$str = str_pad(dechex($hash), 8, '0', STR_PAD_LEFT);
$output = hexdec($str{6}.$str{7}.$str{4}.$str{5}.$str{2}.$str{3}.$str{0}.$str{1});
}
return $output;
}
}

View File

@ -1,28 +1,20 @@
/* Grid ****************************** */
#g-selected-language-flag, #g-language-flag, #g-default-language-flag {
position: relative;
float: left;
margin: 2px 2px 2px 2px;
width: 50px;
height: 50px;
display: table-cell;
vertical-align: middle;
/* border:1px solid #fff; */
/* Flag container divs */
#g-selected-language-flag,
#g-language-flag,
#g-default-language-flag {
display: inline;
margin: 2px;
}
/* Resize ****************************** */
#g-language-flag img, #g-default-language-flag img {
width: 40px;
display: block;
margin-left: auto;
margin-right: auto;
/* Flags with standard size */
#g-language-flag img,
#g-default-language-flag img {
width: 40px;
margin: 5px;
}
/* Flag grows when selected */
#g-selected-language-flag img {
width: 48px;
display: block;
margin-left: auto;
margin-right: auto;
}
width: 48px;
margin: 1px;
}

View File

@ -45,10 +45,10 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
$view->content = new View("admin_moduleupdates.html");
$devDebug = false;
$refreshCache = false;
$refreshCache = false;
$cache = unserialize(Cache::instance()->get("moduleupdates_cache"));
$cache_updates = unserialize(Cache::instance()->get("moduleupdates_cache_updates"));
$cache_updates = unserialize(Cache::instance()->get("moduleupdates_cache_updates"));
//---------------------------------------------------------------------------------------------
//echo 'Message 01: ' .$cache_updates . '<br>';
@ -167,6 +167,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
$view->content->csrf = access::csrf_token();
$view->content->Google = $Google;
$view->content->GitHub = $GitHub;
$view->content->Gallery_Version = substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," "));
print $view;
@ -197,7 +198,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
if ($devDebug == true){
if ($file == null) {
try {
$file = fopen ("http://github.com/brentil/gallery3-contrib/raw/master/3.0/modules/".$module_name."/module.info", "r");
$file = fopen ("http://github.com/brentil/gallery3-contrib/raw/master/". substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$module_name."/module.info", "r");
if ($file != null) {
$server = '(brentil)';
}
@ -213,7 +214,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
try {
$file = fopen ("http://github.com/gallery/gallery3/raw/master/modules/".$module_name."/module.info", "r");
if ($file != null) {
$server = '(G3)';
$server = '(G)';
}
}
catch (Exception $e) {
@ -224,9 +225,9 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
//Check the Gallery3 Community Contributions GitHub
if ($file == null) {
try {
$file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/3.0/modules/".$module_name."/module.info", "r");
$file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/". substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$module_name."/module.info", "r");
if ($file != null) {
$server = '(G3CC)';
$server = '(GCC)';
}
}
catch (Exception $e) {

View File

@ -27,4 +27,4 @@ class moduleupdates_event_Core {
->label(t("Module Updates"))
->url(url::site("admin/moduleupdates")));
}
}
}

View File

@ -24,7 +24,7 @@ class moduleupdates_installer {
$version = module::get_version("moduleupdates");
if ($version == 0) {
module::set_version("moduleupdates", 2);
module::set_version("moduleupdates", 4);
//Remove the ModuleUpdates cache entry 'JIC'
Cache::instance()->delete("ModuleUpdates");
//create the blank ModuleUpdates cache entry with an expiration of 0 days
@ -34,7 +34,7 @@ class moduleupdates_installer {
}
static function upgrade($version) {
module::set_version("moduleupdates", 2);
module::set_version("moduleupdates", 4);
//Remove the ModuleUpdates cache entry 'JIC'
Cache::instance()->delete("ModuleUpdates");
//Empty the ModuleUpdates cache entry so our new version starts from scratch
@ -48,4 +48,4 @@ class moduleupdates_installer {
Cache::instance()->delete("ModuleUpdates");
module::delete("moduleupdates");
}
}
}

View File

@ -1,3 +1,3 @@
name = "Module Updates"
description = "Compares your installed module version against the ones stored in the GitHub."
version = 3
version = 4

View File

@ -2,7 +2,7 @@
<div id="g-admin-moduleupdates" class="g-block">
<h1> <?= t("Module Updates v2.0") ?> </h1>
<h1> <?= t("Module Updates v4.0") ?> </h1>
<?= t("Compares your installed module version against the ones stored in the GitHub.") ?>
<div class="g-block-content">
@ -25,7 +25,7 @@
<br>
<ul id="g-action-status" class="g-message-block">
<li class="g-warning"><?= t("Versions are compared from the official Gallery3 (G3) and official Gallery3 Community Contributions (G3CC). Versions downloaded from the forums will not be shown.") ?></li>
<li class="g-warning"><?= t("Versions are compared from the official Gallery " . $Gallery_Version . " (G) and official Gallery " . $Gallery_Version . " Community Contributions (GCC). Versions downloaded from the forums will not be shown.") ?></li>
</ul>
<table>
@ -45,4 +45,4 @@
<? endforeach ?>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,50 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class tagsinalbum_block_Core {
static function get_site_list() {
return array("tagsinalbum" => t("Tags In Album"));
}
static function get($block_id, $theme) {
$block = "";
switch ($block_id) {
case "tagsinalbum":
if (($theme->item) && ($theme->item->is_album())) {
$item = $theme->item;
$all_tags = ORM::factory("tag")
->join("items_tags", "items_tags.tag_id", "tags.id")
->join("items", "items.id", "items_tags.item_id", "LEFT")
->where("items.parent_id", "=", $item->id)
->order_by("tags.id", "ASC")
->find_all();
if (count($all_tags) > 0) {
$block = new Block();
$block->css_id = "g-tags-in-album-block";
$block->title = t("In this album");
$block->content = new View("tagsinalbum_sidebar.html");
$block->content->all_tags = $all_tags;
}
}
break;
}
return $block;
}
}

View File

@ -0,0 +1,3 @@
name = "Tags In Album"
description = "Creates a sidebar block to display tags used by photos and videos in the current album."
version = 1

View File

@ -0,0 +1,28 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
// Create an array to store the tag names and urls in.
$display_tags = array();
// Loop through all tags in the album, copying their
// names and urls into the array and skipping duplicates.
$last_tagid = "";
foreach ($all_tags as $one_tag) {
if ($last_tagid != $one_tag->id) {
$tag = ORM::factory("tag", $one_tag->id);
$display_tags[] = array(html::clean($tag->name), $tag->url());
$last_tagid = $one_tag->id;
}
}
// Sort the array.
asort($display_tags);
// Print out the list of tags as clickable links.
$not_first = 0;
foreach ($display_tags as $one_tag) {
if ($not_first++ > 0) {
print ", ";
}
print "<a href=\"" . $one_tag[1] . "\">" . $one_tag[0] . "</a>";
}
?>

View File

@ -19,6 +19,9 @@
provider: "pseudostreaming"
},
{
clip: {
scaling: 'fit'
},
plugins: {
pseudostreaming: {
url: "<?= url::abs_file("lib/flowplayer.pseudostreaming.swf") ?>"

View File

@ -27,6 +27,18 @@ body, html {
font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.ui-widget {
font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
#g-user-profile #g-comment-detail .g-author {
font-family: Cursive, Serif;
}
p {
margin-bottom: 1em;
text-shadow: 0px 1px 1px #F7F5F0;
@ -742,13 +754,16 @@ form .g-error {
.g-last {
}
/* ~browny~ */
.g-even {
background-color: #fff;
background-color: #BAAD8B;
text-align: right;
}
/* ~browny~ */
.g-odd {
background-color: #EDE4D5;
text-align: left;
}
/** *******************************************************************
@ -922,14 +937,6 @@ ul.sf-menu li li li.sfHover ul {
/* jQuery UI Dialog ~~~~~~~~~~~~~~~~~~~~~~ */
.ui-widget {
font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
font-family: 'Century gothic', Verdana, 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
.ui-widget-overlay {
background: #000;
opacity: .7;
@ -1433,6 +1440,16 @@ div#g-action-status {
padding-right: 0;
}
/* ~browny~ */
.rtl .g-even {
text-align: left;
}
/* ~browny~ */
.rtl .g-odd {
text-align: right;
}
/** *******************************************************************
* 11) More Browny (Extra overrides for better Browny look)
*********************************************************************/
@ -1497,10 +1514,6 @@ div#g-action-status {
margin-bottom: inherit;
}
#g-user-profile #g-comment-detail .g-author {
font-family: Cursive, Serif;
}
#g-user-profile #g-comment-detail .g-author a {
float: left;
position: relative;
@ -1582,12 +1595,6 @@ div#g-action-status {
#g-exif-data {
font-size: .85em !important;
}
.g-odd {
background: #BAAD8B !important;
}
.g-even {
background: #EDE4D5 !important;
}
/* 3rd Party Modules ~~~~~~~~~~~~~~~~~~~~~ */
@ -1620,3 +1627,10 @@ table.calendar td:hover {
#g-view-menu #g-download-album-link {
background-image: url('../images/ico-view-downloadalbum.png');
}
/* comment_block */
.g-odd .g-thumbnail,
.g-even .g-thumbnail {
margin-top: 3px;
margin-bottom: 3px;
}

View File

@ -60,10 +60,70 @@ div#g-header {
border-bottom: 3px solid #bba;
}
div#g-banner {
a#g-logo, form#g-quick-search-form, div#g-site-menu {
display: none;
}
#g-header-text{
color: #fff;
font: oblique small-caps bold 1em Georgia,serif;
position: absolute;
left: 15px;
height: 1.5em;
line-height: 1.5em;
}
ul#g-login-menu {
list-style-type: none;
position: absolute;
top: 0;
right: 0;
display: block;
margin: 0;
/*padding: 0.5em;*/
padding: 0;
width: 20em;
width: 2.5em;
height: 2.5em;
background: url('../images/icons/g-login-menu.png') no-repeat center center;
z-index: 2;
}
ul#g-login-menu > li {
display: none;
text-align: right;
padding: 2px 0;
width: 20em;
margin-left: -17.6em ; /* -(20-2.5) */
background-color: #fcfcfc;
color: #000;
}
ul#g-login-menu > li:first-child {
margin-top: 2.4em;
}
ul#g-login-menu > li > a {
margin-right: 0.5em;
}
ul#g-login-menu > li:hover, ul#g-login-menu > li:hover > a {
background-color: #5266f3;
color: #fff;
border-color: #fff; /* a:hover */
}
ul#g-login-menu:hover {
background-color: #5266f3;
}
ul#g-login-menu:hover > li {
display: block;
}
ul.g-breadcrumbs {
margin: 0;
padding: 0;
@ -443,15 +503,17 @@ span.ui-icon-key { background-position: -112px -128px; }
background: #b7b7a7;
}
#g-item #g-movie {
display: block;
}
#g-item #g-photo a {
border: none;
}
#g-item #g-photo a img {
#g-item #g-movie,
#g-item #g-movie a {
display: block;
}
#g-item #g-photo img,
#g-item #g-movie object {
border: 10px solid #fff;
-webkit-box-shadow: 3px 3px 0px #b7b7a7;
-moz-box-shadow: 3px 3px 0px #b7b7a7;
@ -590,21 +652,6 @@ span.ui-icon-key { background-position: -112px -128px; }
#g-login-menu {
position: absolute;
right: 0;
padding: 0;
margin: 0;
}
#g-login-menu li {
display: inline;
}
#g-login-menu li:first-child {
/*display: none;*/
}
#g-logo, #g-quick-search-form, #g-site-menu {
display: none;
}
@ -811,7 +858,7 @@ div#g-action-status {
height: 22px;
width: 0%;
background-image: url("../images/backgrounds/pbar-ani.gif");
background-repeat: x-repeat;
background-repeat: repeat-x;
}
#g-add-photos-progressbar.stop {
background-image: url("../images/backgrounds/pbar-ani-stop.gif");

View File

@ -90,9 +90,18 @@ $(document).ready(function() {
$(this).css("top", 0).css("left", 0);
// Remove the placeholder and hover class from the item
$(this).removeClass("g-hover-item");
$(this).gallery_valign();
$("#g-place-holder").remove();
}
);
// Realign any thumbnails that change so that when we rotate a thumb it stays centered.
$(".g-item").bind("gallery.change", function() {
$(".g-item").each(function() {
$(this).height($(this).find("img").height() + 2);
});
$(".g-item").equal_heights().gallery_valign();
});
}*/
// Photo/Item item view

View File

@ -4,5 +4,5 @@ version = 1
author = "Romain LE DISEZ"
site = 1
admin = 0
;wind commit = 3b05db2685d92ca538d7993c960b06ea32f3a8df
;wind date = Wed Jun 23 11:16:56 2010 -0700
;wind commit = 3a9bdebafda1807bb2294c041e655f6464841bf0
;wind date = Tue Sep 21 21:38:32 2010 -0700

View File

@ -16,7 +16,9 @@
<li id="g-item-id-<?= $child->id ?>" class="g-item <?= $item_class ?>">
<?= $theme->thumb_top($child) ?>
<a href="<?= $child->url() ?>">
<? if ($child->has_thumb()): ?>
<?= $child->thumb_img(array("class" => "g-thumbnail")) ?>
<? endif ?>
</a>
<?= $theme->thumb_bottom($child) ?>
<?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?>
@ -29,7 +31,7 @@
<? endforeach ?>
<? else: ?>
<? if ($user->admin || access::can("add", $item)): ?>
<? $addurl = url::site("flash_uploader/app/$item->id") ?>
<? $addurl = url::site("uploader/index/$item->id") ?>
<li><?= t("There aren't any photos here yet! <a %attrs>Add some</a>.",
array("attrs" => html::mark_clean("href=\"$addurl\" class=\"g-dialog-link\""))) ?></li>
<? else: ?>

View File

@ -23,13 +23,12 @@
<? endif ?>
<? endif ?>
</title>
<link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>" type="image/x-icon" />
<?= $theme->css("_DISABLED_yui/reset-fonts-grids.css") ?>
<?= $theme->css("_DISABLED_superfish/css/superfish.css") ?>
<?= $theme->css("_DISABLED_themeroller/ui.base.css") ?>
<?= $theme->css("_DISABLED_gallery.common.css") ?>
<?= $theme->css("screen.css") ?>
<!--[if lt IE 8]>
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
@ -51,7 +50,7 @@
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
<? if ($theme->page_subtype == "photo"): ?>
<?= $theme->script("_DISABLED_jquery.scrollTo.js") ?>
<?= $theme->script("_DISABLED_gallery.show_full_size.js") ?>
<?= $theme->script("gallery.show_full_size.js") ?>
<? elseif ($theme->page_subtype == "movie"): ?>
<?= $theme->script("flowplayer.js") ?>
<? endif ?>
@ -90,17 +89,22 @@
<? $i = 0 ?>
<? foreach ($parents as $parent): ?>
<li<? if ($i == 0) print " class=\"g-first\"" ?>>
<!-- Adding ?show=<id> causes Gallery3 to display the page
containing that photo. For now, we just do it for
the immediate parent so that when you go back up a
level you're on the right page. -->
<a href="<?= $parent->url($parent == $theme->item()->parent() ?
"show={$theme->item()->id}" : null) ?>"><?= text::limit_chars(html::purify($parent->title), 15) ?></a>
<? // Adding ?show=<id> causes Gallery3 to display the page
// containing that photo. For now, we just do it for
// the immediate parent so that when you go back up a
// level you're on the right page. ?>
<a href="<?= $parent->url($parent->id == $theme->item()->parent_id ?
"show={$theme->item()->id}" : null) ?>">
<? // limit the title length to something reasonable (defaults to 15) ?>
<?= html::purify(text::limit_chars($parent->title,
module::get_var("gallery", "visible_title_length"))) ?>
</a>
</li>
<? $i++ ?>
<? endforeach ?>
<li class="g-active<? if ($i == 0) print " g-first" ?>">
<?= text::limit_chars(html::purify($theme->item()->title), 15) ?>
<?= html::purify(text::limit_chars($theme->item()->title,
module::get_var("gallery", "visible_title_length"))) ?>
</li>
</ul>
<? endif ?>

View File

@ -4,10 +4,23 @@
<!-- Use javascript to show the full size as an overlay on the current page -->
<script type="text/javascript">
$(document).ready(function() {
full_dims = [<?= $theme->item()->width ?>, <?= $theme->item()->height ?>];
$(".g-fullsize-link").click(function() {
$.gallery_show_full_size(<?= html::js_string($theme->item()->file_url()) ?>, "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
$.gallery_show_full_size(<?= html::js_string($theme->item()->file_url()) ?>, full_dims[0], full_dims[1]);
return false;
});
// After the image is rotated or replaced we have to reload the image dimensions
// so that the full size view isn't distorted.
$("#g-photo").bind("gallery.change", function() {
$.ajax({
url: "<?= url::site("items/dimensions/" . $theme->item()->id) ?>",
dataType: "json",
success: function(data, textStatus) {
full_dims = data.full;
}
});
});
});
</script>
<? endif ?>

View File

@ -5,7 +5,7 @@
module::event("site_menu", $menu, $this->theme, "");
?>
<? if( isset($menu->elements['add_menu']->elements) || isset($menu->elements['options_menu']->elements) ): ?>
<? if( !empty($menu->elements['add_menu']->elements) || !empty($menu->elements['options_menu']->elements) ): ?>
<div id="g-metadata" class="g-block">
<h2><?= t("Actions") ?></h2>
<div class="g-block-content">

View File

@ -0,0 +1,69 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_Albumpassword_Controller extends Admin_Controller {
public function index() {
// Generate a new admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_albumpassword.html");
// Generate a form for controlling the admin section.
$view->content->albumpassword_form = $this->_get_admin_form();
// Display the page.
print $view;
}
private function _get_admin_form() {
// Make a new form for changing admin settings for this module.
$form = new Forge("admin/albumpassword/saveprefs", "", "post",
array("id" => "g-album-password-admin-form"));
// Should protected items be hidden, or completely in-accessable?
$albumpassword_group = $form->group("album_password_group");
$albumpassword_group->checkbox("hideonly")
->label("Only hide protected albums?")
->checked(module::get_var("albumpassword", "hideonly"));
// Add a save button to the form.
$albumpassword_group->submit("save_settings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
public function saveprefs() {
// Save user specified preferences.
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Retrieve submitted form data.
if (Input::instance()->post("hideonly") == false) {
module::set_var("albumpassword", "hideonly", false);
} else {
module::set_var("albumpassword", "hideonly", true);
}
// Display a success message and redirect back to the TagsMap admin page.
message::success(t("Your settings have been saved."));
url::redirect("admin/albumpassword");
}
}

View File

@ -84,7 +84,7 @@ class albumpassword_Controller extends Controller {
// Display a success message and close the dialog.
message::success(t("Password saved."));
json::reply(array("result" => "success"));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
}
public function logout() {
@ -112,10 +112,10 @@ class albumpassword_Controller extends Controller {
// If not, close the dialog and display a rejected message.
cookie::set("g3_albumpassword", $album_password);
message::success(t("Password Accepted."));
json::reply(array("result" => "success"));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
} else {
message::error(t("Password Rejected."));
json::reply(array("result" => "success"));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
}
}
@ -129,7 +129,7 @@ class albumpassword_Controller extends Controller {
$assignpassword_group->input("assignpassword_password")
->id('assignpassword_password')
->label(t("Password:"));
$form->submit("save_password")->value(t("Save"));
$assignpassword_group->submit("save_password")->value(t("Save"));
// Return the newly generated form.
return $form;
@ -139,12 +139,14 @@ class albumpassword_Controller extends Controller {
// Generate a form for allowing visitors to enter in their passwords.
$form = new Forge("albumpassword/checkpassword", "", "post",
array("id" => "g-login-password-form"));
$assignpassword_group = $form->group("Enter Password")
->label(t("Enter Password:"));
$assignpassword_group->input("albumpassword_password")
$assignpassword_group->password("albumpassword_password")
->id('albumpassword_password')
->label(t("Password:"));
$form->submit("login_password")->value(t("Login"));
$assignpassword_group->submit("")->value(t("Login"));
// Return the newly generated form.
return $form;

View File

@ -0,0 +1,58 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class access extends access_Core {
static function required($perm_name, $item) {
// Original code from the required function in modules/gallery/helpers/access.php.
if (!self::can($perm_name, $item)) {
if ($perm_name == "view") {
// Treat as if the item didn't exist, don't leak any information.
throw new Kohana_404_Exception();
} else {
self::forbidden();
}
// Begin rWatcher modifications.
// Throw a 404 error when a user attempts to access a protected item,
// unless the password has been provided, or the user is the item's owner.
} elseif (module::get_var("albumpassword", "hideonly") == false) {
$album_item = "";
do {
if ($album_item == "") {
if ($item->is_album()) {
$album_item = $item;
} else {
$album_item = $item->parent();
}
} else {
$album_item = $album_item->parent();
}
$existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $album_item->id)->find();
if ($existing_password->loaded()) {
if ((cookie::get("g3_albumpassword") != $existing_password->password) &&
(identity::active_user()->id != $album_item->owner_id)) {
throw new Kohana_404_Exception();
}
}
} while ($album_item->parent_id > 0);
}
}
}

View File

@ -20,32 +20,19 @@
class item extends item_Core {
static function viewable($model) {
// Hide the contents of a password protected album,
// Unless the current user is an admin, or the albums owner.
// Hide password protected albums until the correct password is entered,
// unless the current user is an admin, or the albums owner.
$model = item_Core::viewable($model);
$album_item = ORM::factory("item")->where("id", "=", $model->id)->find();
// Figure out if the user can access this album.
$deny_access = false;
$existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $model->id)->find();
if ($existing_password->loaded()) {
if ((cookie::get("g3_albumpassword") != $existing_password->password) &&
(identity::active_user()->id != $album_item->owner_id))
$deny_access = true;
}
// set access::DENY if necessary.
if ($deny_access == true) {
$view_restrictions = array();
if (!identity::active_user()->admin) {
foreach (identity::group_ids_for_active_user() as $id) {
$view_restrictions[] = array("items.view_$id", "=", access::DENY);
}
}
}
if (count($view_restrictions)) {
$model->and_open()->merge_or_where($view_restrictions)->close();
// If the user is an admin, don't hide anything anything.
// If not, hide whatever is restricted by an album password
// that the current user is not the owner of.
if (!identity::active_user()->admin) {
$model->and_open()->join("items_albumpasswords", "items.id", "items_albumpasswords.album_id", "LEFT OUTER")
->and_where("items_albumpasswords.album_id", "IS", NULL)
->or_where("items_albumpasswords.password", "=", cookie::get("g3_albumpassword"))
->or_where("items.owner_id", "=", identity::active_user()->id)->close();
}
return $model;

View File

@ -80,7 +80,7 @@ class albumpassword_event_Core {
->label(t("Remove password"))
->css_id("g-album-password-remove")
->url(url::site("albumpassword/remove/" . $item->id)));
} else {
} elseif ($item->id != 1) {
$menu->get("options_menu")
->append(Menu::factory("dialog")
->id("albumpassword_assign")
@ -101,4 +101,13 @@ class albumpassword_event_Core {
db::build()->delete("items_albumpassword")->where("album_id", "=", $item->id)->execute();
}
}
static function admin_menu($menu, $theme) {
// Add a link to the Album Password admin page to the Content menu.
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("albumpassword")
->label(t("Album Password Settings"))
->url(url::site("admin/albumpassword")));
}
}

View File

@ -28,9 +28,19 @@ class albumpassword_installer {
PRIMARY KEY (`id`))
DEFAULT CHARSET=utf8;");
// Set the default value for this module's behavior.
module::set_var("albumpassword", "hideonly", true);
// Set the module's version number.
module::set_version("albumpassword", 1);
module::set_version("albumpassword", 2);
}
static function upgrade($version) {
// Set the default value for this module's behavior.
module::set_var("albumpassword", "hideonly", true);
// Set the module's version number.
module::set_version("albumpassword", 2);
}
static function uninstall() {

View File

@ -1,3 +1,3 @@
name = "Album Password"
description = "Restrict access to individual albums."
version = 1
version = 2

View File

@ -0,0 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<h2>
<?= t("Album Password Admin") ?>
</h2>
<br />
<div class="g-block">
<?= t("If this box is checked, protected albums will only be hidden. Anyone with the URL to either the album or it's contents will be able to access it without a password.") ?><br /><br />
<?= $albumpassword_form ?>
</div>

View File

@ -1,20 +1,3 @@
<script type="text/javascript">
function ajaxify_login_reset_form() {
$("#g-login form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#g-login form").replaceWith(data.form);
ajaxify_login_reset_form();
}
if (data.result == "success") {
$("#g-dialog").dialog("close");
window.location.reload();
}
}
});
};
</script>
<div id="g-assign-password">
<ul>
<li id="g-assign-password-form">

View File

@ -1,20 +1,3 @@
<script type="text/javascript">
function ajaxify_login_reset_form() {
$("#g-login form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#g-login form").replaceWith(data.form);
ajaxify_login_reset_form();
}
if (data.result == "success") {
$("#g-dialog").dialog("close");
window.location.reload();
}
}
});
};
</script>
<div id="g-login-password">
<ul>
<li id="g-login-password-form">

View File

@ -1,28 +1,20 @@
/* Grid ****************************** */
#g-selected-language-flag, #g-language-flag, #g-default-language-flag {
position: relative;
float: left;
margin: 2px 2px 2px 2px;
width: 50px;
height: 50px;
display: table-cell;
vertical-align: middle;
/* border:1px solid #fff; */
/* Flag container divs */
#g-selected-language-flag,
#g-language-flag,
#g-default-language-flag {
display: inline;
margin: 2px;
}
/* Resize ****************************** */
#g-language-flag img, #g-default-language-flag img {
width: 40px;
display: block;
margin-left: auto;
margin-right: auto;
/* Flags with standard size */
#g-language-flag img,
#g-default-language-flag img {
width: 40px;
margin: 5px;
}
/* Flag grows when selected */
#g-selected-language-flag img {
width: 48px;
display: block;
margin-left: auto;
margin-right: auto;
}
width: 48px;
margin: 1px;
}

View File

@ -0,0 +1,50 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class tagsinalbum_block_Core {
static function get_site_list() {
return array("tagsinalbum" => t("Tags In Album"));
}
static function get($block_id, $theme) {
$block = "";
switch ($block_id) {
case "tagsinalbum":
if (($theme->item) && ($theme->item->is_album())) {
$item = $theme->item;
$all_tags = ORM::factory("tag")
->join("items_tags", "items_tags.tag_id", "tags.id")
->join("items", "items.id", "items_tags.item_id", "LEFT")
->where("items.parent_id", "=", $item->id)
->order_by("tags.id", "ASC")
->find_all();
if (count($all_tags) > 0) {
$block = new Block();
$block->css_id = "g-tags-in-album-block";
$block->title = t("In this album");
$block->content = new View("tagsinalbum_sidebar.html");
$block->content->all_tags = $all_tags;
}
}
break;
}
return $block;
}
}

View File

@ -0,0 +1,3 @@
name = "Tags In Album"
description = "Creates a sidebar block to display tags used by photos and videos in the current album."
version = 1

View File

@ -0,0 +1,28 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
// Create an array to store the tag names and urls in.
$display_tags = array();
// Loop through all tags in the album, copying their
// names and urls into the array and skipping duplicates.
$last_tagid = "";
foreach ($all_tags as $one_tag) {
if ($last_tagid != $one_tag->id) {
$tag = ORM::factory("tag", $one_tag->id);
$display_tags[] = array(html::clean($tag->name), $tag->url());
$last_tagid = $one_tag->id;
}
}
// Sort the array.
asort($display_tags);
// Print out the list of tags as clickable links.
$not_first = 0;
foreach ($display_tags as $one_tag) {
if ($not_first++ > 0) {
print ", ";
}
print "<a href=\"" . $one_tag[1] . "\">" . $one_tag[0] . "</a>";
}
?>

View File

@ -19,6 +19,9 @@
provider: "pseudostreaming"
},
{
clip: {
scaling: 'fit'
},
plugins: {
pseudostreaming: {
url: "<?= url::abs_file("lib/flowplayer.pseudostreaming.swf") ?>"