summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-09-17 17:48:20 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-09-17 17:48:20 -0700
commit38be33ef35cd5e67bf37aa0101d1948b6dc27ed0 (patch)
tree875c02a2bf9d311546060c89baaf74098de96937 /modules
parent207d848989880edbbbbc852a366bf3bbaf505d2a (diff)
parent3e1743b21fd35b9d6d540e827292f1f4f006b531 (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/controllers/comments.php1
-rw-r--r--modules/comment/helpers/comment.php3
-rw-r--r--modules/gallery/controllers/quick.php3
-rw-r--r--modules/gallery/controllers/user_profile.php39
-rw-r--r--modules/gallery/helpers/album.php1
-rw-r--r--modules/gallery/helpers/gallery_installer.php16
-rw-r--r--modules/gallery/helpers/graphics.php3
-rw-r--r--modules/gallery/helpers/movie.php3
-rw-r--r--modules/gallery/module.info2
-rw-r--r--modules/gallery/views/admin_graphics.html.php1
10 files changed, 64 insertions, 8 deletions
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php
index ff0e9ce1..ded9743e 100644
--- a/modules/comment/controllers/comments.php
+++ b/modules/comment/controllers/comments.php
@@ -45,6 +45,7 @@ class Comments_Controller extends Controller {
switch ($key) {
case "guest_name": $key = "name"; break;
case "guest_email": $key = "email"; break;
+ case "guest_url": $key = "url"; break;
}
$form->add_comment->inputs[$key]->add_error($error, 1);
}
diff --git a/modules/comment/helpers/comment.php b/modules/comment/helpers/comment.php
index 7aa007cb..958f2f3d 100644
--- a/modules/comment/helpers/comment.php
+++ b/modules/comment/helpers/comment.php
@@ -38,7 +38,8 @@ class comment_Core {
->error_messages("invalid", t("You must enter a valid email address"));
$group->input("url")
->label(t("Website (hidden)"))
- ->id("g-url");
+ ->id("g-url")
+ ->error_messages("url", t("You must enter a valid url"));
$group->textarea("text")
->label(t("Comment"))
->id("g-text")
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index c34209da..3db4f5df 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -36,7 +36,8 @@ class Quick_Controller extends Controller {
}
if ($degrees) {
- $tmpfile = tempnam(TMPPATH, "rotate");
+ $tmpfile = tempnam(TMPPATH, "rotate") . "." .
+ pathinfo($item->file_path(), PATHINFO_EXTENSION);
gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees));
$item->set_data_file($tmpfile);
$item->save();
diff --git a/modules/gallery/controllers/user_profile.php b/modules/gallery/controllers/user_profile.php
index e992655b..4922416c 100644
--- a/modules/gallery/controllers/user_profile.php
+++ b/modules/gallery/controllers/user_profile.php
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class User_Profile_Controller extends Controller {
+
public function show($id) {
// If we get here, then we should have a user id other than guest.
$user = identity::lookup_user($id);
@@ -25,6 +26,10 @@ class User_Profile_Controller extends Controller {
throw new Kohana_404_Exception();
}
+ if (!$this->_can_view_profile_pages($user)) {
+ throw new Kohana_404_Exception();
+ }
+
$v = new Theme_View("page.html", "other", "profile");
$v->page_title = t("%name Profile", array("name" => $user->display_name()));
$v->content = new View("user_profile.html");
@@ -44,12 +49,20 @@ class User_Profile_Controller extends Controller {
public function contact($id) {
$user = identity::lookup_user($id);
+ if (!$this->_can_view_profile_pages($user)) {
+ throw new Kohana_404_Exception();
+ }
+
print user_profile::get_contact_form($user);
}
public function send($id) {
access::verify_csrf();
$user = identity::lookup_user($id);
+ if (!$this->_can_view_profile_pages($user)) {
+ throw new Kohana_404_Exception();
+ }
+
$form = user_profile::get_contact_form($user);
if ($form->validate()) {
Sendmail::factory()
@@ -66,4 +79,30 @@ class User_Profile_Controller extends Controller {
json::reply(array("result" => "error", "html" => (string)$form));
}
}
+
+ private function _can_view_profile_pages($user) {
+ if (!$user->loaded()) {
+ return false;
+ }
+
+ if ($user->id == identity::active_user()->id) {
+ // You can always view your own profile
+ return true;
+ }
+
+ switch (module::get_var("gallery", "show_user_profiles_to")) {
+ case "admin_users":
+ return identity::active_user()->admin;
+
+ case "registered_users":
+ return !identity::active_user()->guest;
+
+ case "everybody":
+ return true;
+
+ default:
+ // Fail in private mode on an invalid setting
+ return false;
+ }
+ }
}
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php
index 0ac5e8b0..89185e50 100644
--- a/modules/gallery/helpers/album.php
+++ b/modules/gallery/helpers/album.php
@@ -114,6 +114,7 @@ class album_Core {
"captured" => t("Date captured"),
"created" => t("Date uploaded"),
"title" => t("Title"),
+ "name" => t("File name"),
"updated" => t("Date modified"),
"view_count" => t("Number of views"),
"rand_key" => t("Random"));
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index c23bcca8..83961d6b 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -302,14 +302,14 @@ class gallery_installer {
module::set_var("gallery", "maintenance_mode", 0);
module::set_var("gallery", "visible_title_length", 15);
module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
-
- // Sendmail configuration
module::set_var("gallery", "email_from", "");
module::set_var("gallery", "email_reply_to", "");
module::set_var("gallery", "email_line_length", 70);
module::set_var("gallery", "email_header_separator", serialize("\n"));
+ module::set_var("gallery", "show_user_profiles_to", "registered_users");
+ module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");
- module::set_version("gallery", 38);
+ module::set_version("gallery", 40);
}
static function upgrade($version) {
@@ -627,6 +627,16 @@ class gallery_installer {
}
module::set_version("gallery", $version = 38);
}
+
+ if ($version == 38) {
+ module::set_var("gallery", "show_user_profiles_to", "registered_users");
+ module::set_version("gallery", $version = 39);
+ }
+
+ if ($version == 39) {
+ module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin");
+ module::set_version("gallery", $version = 40);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index bb085ea5..2868a28d 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -314,9 +314,10 @@ class graphics_Core {
$toolkits->graphicsmagick->error = t("GraphicsMagick requires the <b>exec</b> function");
} else {
$graphics_path = module::get_var("gallery", "graphics_toolkit_path", null);
+ $extra_binary_paths = module::get_var("gallery", "extra_binary_paths", null);
putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") .
- ":/usr/local/bin:/opt/local/bin:/opt/bin");
+ ":" . $extra_binary_paths);
// @todo: consider refactoring the two segments below into a loop since they are so
// similar.
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 3e55eefe..50339541 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -86,9 +86,10 @@ class movie_Core {
static function find_ffmpeg() {
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
$graphics_path = module::get_var("gallery", "graphics_toolkit_path", null);
+ $extra_binary_paths = module::get_var("gallery", "extra_binary_paths", null);
putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") .
- ":/usr/local/bin:/opt/local/bin:/opt/bin");
+ ":" . $extra_binary_paths);
if (function_exists("exec")) {
$ffmpeg_path = exec("which ffmpeg");
}
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index cc3b2723..1155ddf7 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 38
+version = 40
diff --git a/modules/gallery/views/admin_graphics.html.php b/modules/gallery/views/admin_graphics.html.php
index 3a48e087..ae76f1e1 100644
--- a/modules/gallery/views/admin_graphics.html.php
+++ b/modules/gallery/views/admin_graphics.html.php
@@ -16,6 +16,7 @@
<h1> <?= t("Graphics settings") ?> </h1>
<p>
<?= t("Gallery needs a graphics toolkit in order to manipulate your photos. Please choose one from the list below.") ?>
+ <?= t("Can't decide which toolkit to choose? <a href=\"%url\">We can help!</a>", array("url" => "http://codex.gallery2.org/Gallery3:Choosing_A_Graphics_Toolkit")) ?>
</p>
<div class="g-block-content">