From 88149a5afaa48711ccecda67036ec9a6755b9050 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 27 Aug 2009 11:41:19 -0700 Subject: Convert tabs to spaces. --- modules/gallery/libraries/I18n.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/I18n.php b/modules/gallery/libraries/I18n.php index b1b4298a..d0531b9a 100644 --- a/modules/gallery/libraries/I18n.php +++ b/modules/gallery/libraries/I18n.php @@ -79,9 +79,9 @@ class I18n_Core { $locale_prefs[] = 'en_US'; $new_locale = setlocale(LC_ALL, $locale_prefs); if (is_string($new_locale) && strpos($new_locale, 'tr') === 0) { - // Make PHP 5 work with Turkish (the localization results are mixed though). - // Hack for http://bugs.php.net/18556 - setlocale(LC_CTYPE, 'C'); + // Make PHP 5 work with Turkish (the localization results are mixed though). + // Hack for http://bugs.php.net/18556 + setlocale(LC_CTYPE, 'C'); } } return $this->_config['default_locale']; @@ -183,7 +183,7 @@ class I18n_Core { static function is_plural_message($message) { return is_array($message); } - + private function interpolate($locale, $string, $values) { // TODO: Handle locale specific number formatting. -- cgit v1.2.3 From 9c79afcff53807f649cbcfaa0fc06e78799e43ec Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 28 Aug 2009 10:24:16 -0700 Subject: Add logging to sendmail library when exception encountered --- modules/gallery/libraries/Sendmail.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php index 90998457..d6229e07 100644 --- a/modules/gallery/libraries/Sendmail.php +++ b/modules/gallery/libraries/Sendmail.php @@ -52,6 +52,7 @@ class Sendmail_Core { break; case "header": if (count($value) != 2) { + Kohana::log("error", wordwrap("Invalid header parameters\n" . Kohana::debug($value))); throw new Exception("@todo INVALID_HEADER_PARAMETERS"); } $this->headers[$value[0]] = $value[1]; @@ -70,6 +71,7 @@ class Sendmail_Core { public function send() { if (empty($this->to)) { + Kohana::log("error", wordwrap("Sending mail failed:\nNo to address specified")); throw new Exception("@todo TO_IS_REQUIRED_FOR_MAIL"); } $to = implode(", ", $this->to); -- cgit v1.2.3 From 5133f93290e3ab0052909c27dcec05983c819ebe Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 28 Aug 2009 11:51:41 -0700 Subject: Don't record mail failures when we throw the exception, record them when we catch the exception instead. --- modules/gallery/libraries/Sendmail.php | 2 - .../notification/helpers/notification_event.php | 54 +++++++++++++--------- 2 files changed, 33 insertions(+), 23 deletions(-) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php index d6229e07..7bc21a67 100644 --- a/modules/gallery/libraries/Sendmail.php +++ b/modules/gallery/libraries/Sendmail.php @@ -86,8 +86,6 @@ class Sendmail_Core { $headers = implode($this->header_separator, $headers); $message = wordwrap($this->message, $this->line_length, "\n"); if (!$this->mail($to, $this->subject, $message, $headers)) { - Kohana::log("error", wordwrap("Sending mail failed:\nTo: $to\n $this->subject\n" . - "Headers: $headers\n $this->message")); throw new Exception("@todo SEND_MAIL_FAILED"); } return $this; diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index fd667ae8..8fbeda92 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -24,13 +24,17 @@ class notification_event_Core { static function item_updated($original, $new) { try { notification::send_item_updated($new); - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::item_updated() failed"); + } } static function item_created($item) { try { notification::send_item_add($item); - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::item_created() failed"); + } } static function item_deleted($item) { @@ -40,7 +44,9 @@ class notification_event_Core { if (notification::is_watching($item)) { notification::remove_watch($item); } - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::item_deleted() failed"); + } } static function comment_created($comment) { @@ -48,7 +54,9 @@ class notification_event_Core { if ($comment->state == "published") { notification::send_comment_published($comment); } - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::comment_created() failed"); + } } static function comment_updated($original, $new) { @@ -56,7 +64,9 @@ class notification_event_Core { if ($new->state == "published" && $original->state != "published") { notification::send_comment_published($new); } - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::comment_updated() failed"); + } } static function user_before_delete($user) { @@ -64,33 +74,35 @@ class notification_event_Core { ORM::factory("subscription") ->where("user_id", $user->id) ->delete_all(); - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::user_before_delete() failed"); + } } static function batch_complete() { try { notification::send_pending_notifications(); - } catch (Exception $e) {} + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::batch_complete() failed"); + } } static function site_menu($menu, $theme) { - try { - if (!user::active()->guest) { - $item = $theme->item(); + if (!user::active()->guest) { + $item = $theme->item(); - if ($item && $item->is_album() && access::can("view", $item)) { - $watching = notification::is_watching($item); + if ($item && $item->is_album() && access::can("view", $item)) { + $watching = notification::is_watching($item); - $label = $watching ? t("Remove notifications") : t("Enable notifications"); + $label = $watching ? t("Remove notifications") : t("Enable notifications"); - $menu->get("options_menu") - ->append(Menu::factory("link") - ->id("watch") - ->label($label) - ->css_id("gNotifyLink") - ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token()))); - } + $menu->get("options_menu") + ->append(Menu::factory("link") + ->id("watch") + ->label($label) + ->css_id("gNotifyLink") + ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token()))); } - } catch (Exception $e) {} + } } } \ No newline at end of file -- cgit v1.2.3