diff --git a/3.0/modules/albumpassword/controllers/admin_albumpassword.php b/3.0/modules/albumpassword/controllers/admin_albumpassword.php
new file mode 100644
index 00000000..425f9ed9
--- /dev/null
+++ b/3.0/modules/albumpassword/controllers/admin_albumpassword.php
@@ -0,0 +1,69 @@
+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");
+ }
+}
diff --git a/3.0/modules/albumpassword/controllers/albumpassword.php b/3.0/modules/albumpassword/controllers/albumpassword.php
index b014b749..01080fc2 100644
--- a/3.0/modules/albumpassword/controllers/albumpassword.php
+++ b/3.0/modules/albumpassword/controllers/albumpassword.php
@@ -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 "\n
\n\n\n\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 "\n\n\n\n\n";
} else {
message::error(t("Password Rejected."));
- json::reply(array("result" => "success"));
+ print "\n\n\n\n\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;
diff --git a/3.0/modules/albumpassword/helpers/MY_access.php b/3.0/modules/albumpassword/helpers/MY_access.php
new file mode 100644
index 00000000..faf6c1c0
--- /dev/null
+++ b/3.0/modules/albumpassword/helpers/MY_access.php
@@ -0,0 +1,58 @@
+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);
+ }
+ }
+}
diff --git a/3.0/modules/albumpassword/helpers/MY_item.php b/3.0/modules/albumpassword/helpers/MY_item.php
index 3e09a64d..79dd3afc 100644
--- a/3.0/modules/albumpassword/helpers/MY_item.php
+++ b/3.0/modules/albumpassword/helpers/MY_item.php
@@ -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;
diff --git a/3.0/modules/albumpassword/helpers/albumpassword_event.php b/3.0/modules/albumpassword/helpers/albumpassword_event.php
index dd83c4d9..c5ead56a 100644
--- a/3.0/modules/albumpassword/helpers/albumpassword_event.php
+++ b/3.0/modules/albumpassword/helpers/albumpassword_event.php
@@ -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")));
+ }
}
diff --git a/3.0/modules/albumpassword/helpers/albumpassword_installer.php b/3.0/modules/albumpassword/helpers/albumpassword_installer.php
index e59faffb..1fd20d89 100644
--- a/3.0/modules/albumpassword/helpers/albumpassword_installer.php
+++ b/3.0/modules/albumpassword/helpers/albumpassword_installer.php
@@ -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() {
diff --git a/3.0/modules/albumpassword/module.info b/3.0/modules/albumpassword/module.info
index 6acdc1dd..cd1262f4 100644
--- a/3.0/modules/albumpassword/module.info
+++ b/3.0/modules/albumpassword/module.info
@@ -1,3 +1,3 @@
name = "Album Password"
description = "Restrict access to individual albums."
-version = 1
+version = 2
diff --git a/3.0/modules/albumpassword/views/admin_albumpassword.html.php b/3.0/modules/albumpassword/views/admin_albumpassword.html.php
new file mode 100644
index 00000000..05e46454
--- /dev/null
+++ b/3.0/modules/albumpassword/views/admin_albumpassword.html.php
@@ -0,0 +1,9 @@
+
+
+ = t("Album Password Admin") ?>
+
+
+
+ = 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.") ?>
diff --git a/3.0/modules/language_flags/css/language_flags_sidebar.css b/3.0/modules/language_flags/css/language_flags_sidebar.css
index 3e6d776b..705dad2d 100644
--- a/3.0/modules/language_flags/css/language_flags_sidebar.css
+++ b/3.0/modules/language_flags/css/language_flags_sidebar.css
@@ -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;
+}
\ No newline at end of file
diff --git a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php
index 921cf535..b1274111 100755
--- a/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php
+++ b/3.0/modules/moduleupdates/controllers/admin_moduleupdates.php
@@ -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 . ' ';
@@ -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) {
diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_event.php b/3.0/modules/moduleupdates/helpers/moduleupdates_event.php
index dd6efc9c..8dbed46c 100644
--- a/3.0/modules/moduleupdates/helpers/moduleupdates_event.php
+++ b/3.0/modules/moduleupdates/helpers/moduleupdates_event.php
@@ -27,4 +27,4 @@ class moduleupdates_event_Core {
->label(t("Module Updates"))
->url(url::site("admin/moduleupdates")));
}
-}
\ No newline at end of file
+}
diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php
index dd0dddb8..39d1dcc0 100644
--- a/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php
+++ b/3.0/modules/moduleupdates/helpers/moduleupdates_installer.php
@@ -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");
}
-}
+}
\ No newline at end of file
diff --git a/3.0/modules/moduleupdates/module.info b/3.0/modules/moduleupdates/module.info
index cf43770b..722abecc 100755
--- a/3.0/modules/moduleupdates/module.info
+++ b/3.0/modules/moduleupdates/module.info
@@ -1,3 +1,3 @@
name = "Module Updates"
description = "Compares your installed module version against the ones stored in the GitHub."
-version = 3
+version = 4
\ No newline at end of file
diff --git a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php
index 3fdc06a7..3d7d5453 100644
--- a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php
+++ b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php
@@ -2,7 +2,7 @@
-
= t("Module Updates v2.0") ?>
+
= t("Module Updates v4.0") ?>
= t("Compares your installed module version against the ones stored in the GitHub.") ?>
@@ -25,7 +25,7 @@
-
= t("Versions are compared from the official Gallery3 (G3) and official Gallery3 Community Contributions (G3CC). Versions downloaded from the forums will not be shown.") ?>
+
= 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.") ?>
@@ -45,4 +45,4 @@
endforeach ?>
-
\ No newline at end of file
+
diff --git a/3.0/modules/tagsinalbum/helpers/tagsinalbum_block.php b/3.0/modules/tagsinalbum/helpers/tagsinalbum_block.php
new file mode 100644
index 00000000..d923bc15
--- /dev/null
+++ b/3.0/modules/tagsinalbum/helpers/tagsinalbum_block.php
@@ -0,0 +1,50 @@
+ 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;
+ }
+}
diff --git a/3.0/modules/tagsinalbum/module.info b/3.0/modules/tagsinalbum/module.info
new file mode 100644
index 00000000..94b7699b
--- /dev/null
+++ b/3.0/modules/tagsinalbum/module.info
@@ -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
diff --git a/3.0/modules/tagsinalbum/views/tagsinalbum_sidebar.html.php b/3.0/modules/tagsinalbum/views/tagsinalbum_sidebar.html.php
new file mode 100644
index 00000000..803e46ee
--- /dev/null
+++ b/3.0/modules/tagsinalbum/views/tagsinalbum_sidebar.html.php
@@ -0,0 +1,28 @@
+
+
+ // 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 "" . $one_tag[0] . "";
+ }
+?>
diff --git a/3.0/modules/transcode/controllers/admin_transcode.php b/3.0/modules/transcode/controllers/admin_transcode.php
new file mode 100644
index 00000000..b91b1284
--- /dev/null
+++ b/3.0/modules/transcode/controllers/admin_transcode.php
@@ -0,0 +1,166 @@
+ 0) {
+ module::set_var("transcode", "ffmpeg_path", $_REQUEST['ffmpeg_path']);
+ $data['success'] = true;
+ $data['codecs'] = self::_get_supported_audio_codecs($_REQUEST['ffmpeg_path']);
+ }
+ else {
+ $error = "";
+ switch ($val) {
+ case 0: $error = "Empty file path provided"; break;
+ case -1: $error = "File does not exist"; break;
+ case -2: $error = "Path is a directory"; break;
+ default: $error = "Unspecified error";
+ }
+ $data['error'] = $error;
+ }
+ echo json_encode($data);
+ }
+
+ public function index() {
+ $form = $this->_get_form();
+
+ if (request::method() == "post") {
+ access::verify_csrf();
+
+ if ($form->validate()) {
+ module::set_var("transcode", "ffmpeg_path", $_POST['ffmpeg_path']);
+ module::set_var("transcode", "ffmpeg_flags", $_POST['ffmpeg_flags']);
+ module::set_var("transcode", "audio_codec", $_POST['audio_codec']);
+ module::set_var("transcode", "ffmpeg_audio_kbits", (isset($_POST['ffmpeg_audio_kbits']) ? $_POST['ffmpeg_audio_kbits'] : false));
+
+ module::set_var("transcode", "resolution_240p", (isset($_POST['resolution_240p']) ? $_POST['resolution_240p'] : false));
+ module::set_var("transcode", "resolution_360p", (isset($_POST['resolution_360p']) ? $_POST['resolution_360p'] : false));
+ module::set_var("transcode", "resolution_480p", (isset($_POST['resolution_480p']) ? $_POST['resolution_480p'] : false));
+ module::set_var("transcode", "resolution_576p", (isset($_POST['resolution_576p']) ? $_POST['resolution_576p'] : false));
+ module::set_var("transcode", "resolution_720p", (isset($_POST['resolution_720p']) ? $_POST['resolution_720p'] : false));
+ module::set_var("transcode", "resolution_1080p", (isset($_POST['resolution_1080p']) ? $_POST['resolution_1080p'] : false));
+
+ message::success(t("Settings have been saved"));
+ url::redirect("admin/transcode");
+ }
+ else {
+ message::error(t("There was a problem with the submitted form. Please check your values and try again."));
+ }
+ }
+
+ print $this->_get_view();
+ }
+
+ private function _get_view($form = null) {
+ $v = new Admin_View("admin.html");
+ $v->page_title = t("Gallery 3 :: Manage Transcoding Settings");
+
+ $v->content = new View("admin_transcode.html");
+ $v->content->form = empty($form) ? $this->_get_form() : $form;
+
+ return $v;
+ }
+
+ private function _get_supported_audio_codecs($given_path = null) {
+
+ $flv_compatible_codecs = array("aac" => "aac", "adpcm_swf" => "adpcm_swf", "mp3" => "libmp3lame");
+
+ if ($given_path)
+ $ffmpegPath = $given_path;
+ else
+ $ffmpegPath = module::get_var("transcode", "ffmpeg_path", transcode::whereis("ffmpeg"));
+
+ $legacy = false;
+ exec($ffmpegPath . " -codecs", $codecs);
+ if (count($codecs) == 0) {
+ $legacy = true;
+ exec($ffmpegPath . " -formats 2>&1", $codecs);
+ }
+
+ $search = true;
+ if ($legacy) $search = false;
+
+ $found = array();
+ foreach ($codecs as $line) {
+ if ($search) {
+ if (strpos($line, "DEA")) {
+ $bits = preg_split("/[\s]+/", $line);
+ if (in_array($bits[2], $flv_compatible_codecs)) {
+ $key = array_search($bits[2], $flv_compatible_codecs);
+ $found[$key] = $flv_compatible_codecs[$key];
+ }
+ }
+ }
+
+ if ($legacy && strpos($line, "Codecs:") !== false) {
+ $search = true;
+ continue;
+ }
+ if ($legacy && $search && strpos($line, "Bitstream filters:")) {
+ $search = false;
+ continue;
+ }
+ }
+ return $found;
+ }
+
+ private function _get_form() {
+ $form = new Forge("admin/transcode", "", "post", array("id" => "g-admin-transcode-form"));
+
+ $group = $form->group("system")->label(t("System"));
+
+ $ffmpegPath = transcode::whereis("ffmpeg");
+ $codecs = $this->_get_supported_audio_codecs();
+
+ $group ->input("ffmpeg_path")
+ ->id("ffmpeg_path")
+ ->label(t("Path to ffmpeg binary:"))
+ ->value(module::get_var("transcode", "ffmpeg_path", $ffmpegPath))
+ ->callback("transcode::verify_ffmpeg_path")
+ ->error_messages("required", t("You must enter the path to ffmpeg"))
+ ->error_messages("invalid", t("File does not exist"))
+ ->error_messages("is_dir", t("File is a directory"))
+ ->message("Auto detected ffmpeg here: " . $ffmpegPath . " Click here to verify ffmpeg path and continue.");
+
+ $group ->input("ffmpeg_flags")
+ ->id("ffmpeg_flags")
+ ->label(t("Extra ffmpeg flags:"))
+ ->value(module::get_var("transcode", "ffmpeg_flags"));
+
+ $group ->dropdown("audio_codec")
+ ->id("audio_codec")
+ ->label(t("Audio codec to use:"))
+ ->options($codecs)
+ ->selected(module::get_var("transcode", "audio_codec"));
+
+ $group ->checkbox("ffmpeg_audio_kbits")
+ ->label(t("Send audio bitrate as kbits instead of bits/s"))
+ ->checked(module::get_var("transcode", "ffmpeg_audio_kbits"));
+
+ $group = $form->group("resolutions")->label(t("Resolutions"));
+
+ $group ->checkbox("resolution_240p")
+ ->label("240p")
+ ->checked(module::get_var("transcode", "resolution_240p"));
+ $group ->checkbox("resolution_360p")
+ ->label("360p")
+ ->checked(module::get_var("transcode", "resolution_360p"));
+ $group ->checkbox("resolution_480p")
+ ->label("480p")
+ ->checked(module::get_var("transcode", "resolution_480p"));
+ $group ->checkbox("resolution_576p")
+ ->label("576p")
+ ->checked(module::get_var("transcode", "resolution_576p"));
+ $group ->checkbox("resolution_720p")
+ ->label("720p")
+ ->checked(module::get_var("transcode", "resolution_720p"));
+ $group ->checkbox("resolution_1080p")
+ ->label("1080p")
+ ->checked(module::get_var("transcode", "resolution_1080p"));
+
+ $form->submit("submit")->value(t("Save"));
+ return $form;
+ }
+}
diff --git a/3.0/modules/transcode/debug.php b/3.0/modules/transcode/debug.php
new file mode 100644
index 00000000..7e9d31a9
--- /dev/null
+++ b/3.0/modules/transcode/debug.php
@@ -0,0 +1,50 @@
+ffmpeg info";
+ $ffmpegPath = whereis("ffmpeg");
+ echo "path: " . $ffmpegPath . " ";
+ $version = @shell_exec($ffmpegPath . " -version"); $version = explode("\n", $version); $version = $version[0]; $version = explode(" ", $version); $version = $version[1];
+ echo "version: " . $version . " ";
+ echo "codecs:
+
+
diff --git a/3.0/modules/videos/views/movieplayer.html.php b/3.0/modules/videos/views/movieplayer.html.php
index b960e1d7..1cf46cda 100644
--- a/3.0/modules/videos/views/movieplayer.html.php
+++ b/3.0/modules/videos/views/movieplayer.html.php
@@ -19,6 +19,9 @@
provider: "pseudostreaming"
},
{
+ clip: {
+ scaling: 'fit'
+ },
plugins: {
pseudostreaming: {
url: "= url::abs_file("lib/flowplayer.pseudostreaming.swf") ?>"
diff --git a/3.0/themes/browny_wind/css/screen.css b/3.0/themes/browny_wind/css/screen.css
index 01576252..ddd593a6 100644
--- a/3.0/themes/browny_wind/css/screen.css
+++ b/3.0/themes/browny_wind/css/screen.css
@@ -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;
+}
\ No newline at end of file
diff --git a/3.1/modules/albumpassword/controllers/admin_albumpassword.php b/3.1/modules/albumpassword/controllers/admin_albumpassword.php
new file mode 100644
index 00000000..425f9ed9
--- /dev/null
+++ b/3.1/modules/albumpassword/controllers/admin_albumpassword.php
@@ -0,0 +1,69 @@
+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");
+ }
+}
diff --git a/3.1/modules/albumpassword/controllers/albumpassword.php b/3.1/modules/albumpassword/controllers/albumpassword.php
index b014b749..01080fc2 100644
--- a/3.1/modules/albumpassword/controllers/albumpassword.php
+++ b/3.1/modules/albumpassword/controllers/albumpassword.php
@@ -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 "\n\n\n\n\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 "\n\n\n\n\n";
} else {
message::error(t("Password Rejected."));
- json::reply(array("result" => "success"));
+ print "\n\n\n\n\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;
diff --git a/3.1/modules/albumpassword/helpers/MY_access.php b/3.1/modules/albumpassword/helpers/MY_access.php
new file mode 100644
index 00000000..faf6c1c0
--- /dev/null
+++ b/3.1/modules/albumpassword/helpers/MY_access.php
@@ -0,0 +1,58 @@
+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);
+ }
+ }
+}
diff --git a/3.1/modules/albumpassword/helpers/MY_item.php b/3.1/modules/albumpassword/helpers/MY_item.php
index 3e09a64d..79dd3afc 100644
--- a/3.1/modules/albumpassword/helpers/MY_item.php
+++ b/3.1/modules/albumpassword/helpers/MY_item.php
@@ -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;
diff --git a/3.1/modules/albumpassword/helpers/albumpassword_event.php b/3.1/modules/albumpassword/helpers/albumpassword_event.php
index dd83c4d9..c5ead56a 100644
--- a/3.1/modules/albumpassword/helpers/albumpassword_event.php
+++ b/3.1/modules/albumpassword/helpers/albumpassword_event.php
@@ -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")));
+ }
}
diff --git a/3.1/modules/albumpassword/helpers/albumpassword_installer.php b/3.1/modules/albumpassword/helpers/albumpassword_installer.php
index e59faffb..1fd20d89 100644
--- a/3.1/modules/albumpassword/helpers/albumpassword_installer.php
+++ b/3.1/modules/albumpassword/helpers/albumpassword_installer.php
@@ -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() {
diff --git a/3.1/modules/albumpassword/module.info b/3.1/modules/albumpassword/module.info
index 6acdc1dd..cd1262f4 100644
--- a/3.1/modules/albumpassword/module.info
+++ b/3.1/modules/albumpassword/module.info
@@ -1,3 +1,3 @@
name = "Album Password"
description = "Restrict access to individual albums."
-version = 1
+version = 2
diff --git a/3.1/modules/albumpassword/views/admin_albumpassword.html.php b/3.1/modules/albumpassword/views/admin_albumpassword.html.php
new file mode 100644
index 00000000..05e46454
--- /dev/null
+++ b/3.1/modules/albumpassword/views/admin_albumpassword.html.php
@@ -0,0 +1,9 @@
+
+
+ = t("Album Password Admin") ?>
+
+
+
+ = 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.") ?>