From 292d216f7c133152cb921db1cbc7a0c4843a977a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 24 Jun 2009 18:02:36 -0700 Subject: Implement printing support on the photo page. I've used an icon that doesn't quite match the theme temporarily. I'm hoping to have a matching icon soon. --- modules/digibug/helpers/digibug_menu.php | 18 +++++++----------- modules/digibug/js/digibug.js | 4 ++++ themes/default/css/screen.css | 4 ++++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/digibug/helpers/digibug_menu.php b/modules/digibug/helpers/digibug_menu.php index 1ff0f6bf..6c466031 100644 --- a/modules/digibug/helpers/digibug_menu.php +++ b/modules/digibug/helpers/digibug_menu.php @@ -27,17 +27,13 @@ class digibug_menu { } static function photo($menu, $theme) { - } - - static function site($menu, $theme) { $item = $theme->item(); - - if ($item && access::can("edit", $item)) { - $options_menu = $menu->get("options_menu") - ->append(Menu::factory("dialog") - ->id("digibug") - ->label(t("Peform Digibug Processing")) - ->url(url::site("digibug/index/$item->id"))); - } + $csrf = access::csrf_token(); + $menu + ->append(Menu::factory("link") + ->id("digibug") + ->label(t("Print with Digibug")) + ->url(url::site("digibug/print_photo/{$item->id}?csrf={$csrf}")) + ->css_id("gDigibugLink")); } } diff --git a/modules/digibug/js/digibug.js b/modules/digibug/js/digibug.js index e9e8933e..837c8f7f 100644 --- a/modules/digibug/js/digibug.js +++ b/modules/digibug/js/digibug.js @@ -3,6 +3,10 @@ $(document).ready(function() { e.preventDefault(); queue_print(e); }); + $("#gDigibugLink").click(function(e) { + e.preventDefault(); + return queue_print(e); + }); }); function popUp(url, options) { diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index a450356c..8967efdf 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -665,6 +665,10 @@ form .gError, background-image: url('../images/ico-view-comments.png'); } +#gViewMenu #gDigibugLink { + background-image: url('../images/ico-print.png'); +} + /* Breadcrumbs ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ .gBreadcrumbs { -- cgit v1.2.3 From 2d97a9a8b6b3b45b3cfdc426f8c476dd1ef104d4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 24 Jun 2009 18:04:02 -0700 Subject: The image didn't get picked up on the previous commit --- themes/default/images/ico-print.png | Bin 0 -> 4411 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 themes/default/images/ico-print.png diff --git a/themes/default/images/ico-print.png b/themes/default/images/ico-print.png new file mode 100644 index 00000000..087e6694 Binary files /dev/null and b/themes/default/images/ico-print.png differ -- cgit v1.2.3 From abbecb9e7e6e26d50cae0754d4c6320892b8def5 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 21:19:05 -0700 Subject: Look in /opt/local/bin for binaries, too. Fixes ticket #423. --- modules/gallery/helpers/graphics.php | 2 +- modules/gallery/helpers/movie.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 3f3317ae..71b8ddd8 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -331,7 +331,7 @@ class graphics_Core { if (!isset($gd["GD Version"])) { $gd["GD Version"] = false; } - putenv("PATH=" . getenv("PATH") . ":/usr/local/bin"); + putenv("PATH=" . getenv("PATH") . ":/usr/local/bin:/opt/local/bin"); return array("gd" => $gd, "imagemagick" => $exec ? dirname(exec("which convert")) : false, "graphicsmagick" => $exec ? dirname(exec("which gm")) : false); diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 28c15d81..fcf1cc54 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -145,7 +145,7 @@ class movie_Core { static function find_ffmpeg() { if (!$ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) { - putenv("PATH=" . getenv("PATH") . ":/usr/local/bin"); + putenv("PATH=" . getenv("PATH") . ":/usr/local/bin:/opt/local/bin"); if (function_exists("exec")) { $ffmpeg_path = exec("which ffmpeg"); } -- cgit v1.2.3 From 4384b67be1aedfbc71e3cb7e399df88fcb87ff9c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 21:30:48 -0700 Subject: Comment out [reply] and [edit] links because they're not implemented yet. This closes ticket #416, and I'll open a new ticket to implement these functions. --- modules/comment/views/admin_comments.html.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index e749fde0..86585c65 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -163,6 +163,7 @@ +
  • -- cgit v1.2.3 From 7347d1e50db102142f1c82bfeb70734475f58195 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 21:34:07 -0700 Subject: Use ENT_QUOTEs when decoding the $current_uri otherwise apostrophes are treated as ' which doesn't match in our relative_path_cache. --- modules/gallery/helpers/MY_url.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php index 7bee70ca..c4967c52 100644 --- a/modules/gallery/helpers/MY_url.php +++ b/modules/gallery/helpers/MY_url.php @@ -58,7 +58,7 @@ class url extends url_Core { * Return the item that the uri is referencing */ static function get_item_from_uri($uri) { - $current_uri = html_entity_decode($uri); + $current_uri = html_entity_decode($uri, ENT_QUOTES); $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, -- cgit v1.2.3 From a5f1ef48498937621cd0ce4d0344650af2c580ec Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 21:47:47 -0700 Subject: Add support for mod_rewrite in the .htaccess file. There are now instructions for how to tweak RewriteBase correctly. Once that's done, index.php will automagically disappear. \o/ --- .htaccess | 22 ++++++++++++++++++++++ application/config/config.php | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index 190ff745..e55165ff 100644 --- a/.htaccess +++ b/.htaccess @@ -6,3 +6,25 @@ php_value upload_max_filesize 20M php_value post_max_size 100M + +# You can use mod_rewrite to enable short urls in Gallery 3 (which +# gets rid of the "index.php" from your urls). To do this, you must +# properly configure the RewriteBase line in the block below. You +# just need to change RewriteBase line to match your installation. +# Here are some examples: +# +# Gallery3 URL RewriteBase line +# ============= ==================== +# http://example.com/gallery3 RewriteBase /gallery3 +# http://example.com/~bob/photos RewriteBase /~bob/photos +# http://gallery3.example.com/ RewriteBase / +# +# Then just use your Gallery 3 without the index.php in the url. + + RewriteEngine On + RewriteBase /~bharat/gallery3/ + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L] + RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L] + diff --git a/application/config/config.php b/application/config/config.php index 2d66d1c0..e88958ed 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -54,7 +54,7 @@ $config["site_protocol"] = ""; * * This can be removed by using URL rewriting. */ -$config["index_page"] = "index.php"; +$config["index_page"] = isset($_GET["kohana_uri"]) ? "" : "index.php"; /** * Fake file extension that will be added to all generated URLs. Example: .html -- cgit v1.2.3 From 60442e170ba73641ce5545ca87de794b9fe98132 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 21:50:35 -0700 Subject: Oops, remove my own custom RewriteBase. I can see that this is going to be a problem with this approach. --- .htaccess | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index e55165ff..0a9d6367 100644 --- a/.htaccess +++ b/.htaccess @@ -22,7 +22,7 @@ # Then just use your Gallery 3 without the index.php in the url. RewriteEngine On - RewriteBase /~bharat/gallery3/ + RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L] -- cgit v1.2.3 From a19dba9416516fffaa53b0c1955d625c60d7e557 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 22:01:08 -0700 Subject: Comment out the whole block; without proper configuration it breaks gallery3 if you don't specify index.php. --- .htaccess | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.htaccess b/.htaccess index 0a9d6367..3714aa64 100644 --- a/.htaccess +++ b/.htaccess @@ -9,22 +9,24 @@ # You can use mod_rewrite to enable short urls in Gallery 3 (which # gets rid of the "index.php" from your urls). To do this, you must -# properly configure the RewriteBase line in the block below. You -# just need to change RewriteBase line to match your installation. -# Here are some examples: +# uncomment the block below that starts with and ends with +# then properly configure the RewriteBase line in the +# block below. You just need to change RewriteBase line to match your +# Gallery 3 URL. Here are some examples: # -# Gallery3 URL RewriteBase line -# ============= ==================== -# http://example.com/gallery3 RewriteBase /gallery3 -# http://example.com/~bob/photos RewriteBase /~bob/photos -# http://gallery3.example.com/ RewriteBase / +# Gallery3 URL RewriteBase line +# ============= ==================== +# http://example.com/gallery3 RewriteBase /gallery3 +# http://example.com/~bob/photos RewriteBase /~bob/photos +# http://gallery3.example.com/ RewriteBase / # # Then just use your Gallery 3 without the index.php in the url. - - RewriteEngine On - RewriteBase / - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L] - RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L] - +# +# +# RewriteEngine On +# RewriteBase / +# RewriteCond %{REQUEST_FILENAME} !-f +# RewriteCond %{REQUEST_FILENAME} !-d +# RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L] +# RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L] +# -- cgit v1.2.3 From 766de009090cd1a49b6726e79bce7a69392491be Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 24 Jun 2009 22:25:38 -0700 Subject: Turn off magic_quotes_sybase and magic_quotes_runtime. Fixes ticket #394. --- .htaccess | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.htaccess b/.htaccess index 3714aa64..79ba4be2 100644 --- a/.htaccess +++ b/.htaccess @@ -1,10 +1,12 @@ - php_value short_open_tag 1 - php_value magic_quotes_gpc 0 - php_value register_globals 0 - php_value session.auto_start 0 - php_value upload_max_filesize 20M - php_value post_max_size 100M + php_value short_open_tag 1 + php_value magic_quotes_gpc 0 + php_value magic_quotes_sybase 0 + php_value magic_quotes_runtime 0 + php_value register_globals 0 + php_value session.auto_start 0 + php_value upload_max_filesize 20M + php_value post_max_size 100M # You can use mod_rewrite to enable short urls in Gallery 3 (which -- cgit v1.2.3