summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/comment/controllers/admin_manage_comments.php6
-rw-r--r--modules/comment/controllers/comments.php4
-rw-r--r--modules/comment/views/comments.html.php6
-rw-r--r--modules/comment/views/user_profile_comments.html.php4
-rw-r--r--modules/g2_import/helpers/g2_import.php16
-rw-r--r--modules/gallery/helpers/data_rest.php16
-rw-r--r--modules/gallery/helpers/gallery.php4
-rw-r--r--modules/gallery/helpers/identity.php7
-rw-r--r--modules/gallery/helpers/json.php4
-rw-r--r--modules/gallery/libraries/MY_Kohana_Exception.php14
-rw-r--r--modules/gallery/tests/Kohana_Exception_Test.php24
-rw-r--r--modules/gallery/tests/controller_auth_data.txt1
-rw-r--r--modules/gallery/tests/xss_data.txt125
-rw-r--r--modules/gallery/views/error_admin.html.php11
-rw-r--r--modules/gallery_unit_test/views/kohana_unit_test_cli.php4
-rw-r--r--modules/info/views/info_block.html.php2
-rw-r--r--modules/rest/helpers/registry_rest.php30
-rw-r--r--modules/rest/helpers/rest.php28
-rw-r--r--modules/user/controllers/users.php8
19 files changed, 191 insertions, 123 deletions
diff --git a/modules/comment/controllers/admin_manage_comments.php b/modules/comment/controllers/admin_manage_comments.php
index e451791f..0ba3d6b0 100644
--- a/modules/comment/controllers/admin_manage_comments.php
+++ b/modules/comment/controllers/admin_manage_comments.php
@@ -35,9 +35,9 @@ class Admin_Manage_Comments_Controller extends Admin_Controller {
public function menu_labels() {
$menu = $this->_menu($this->_counts());
json::reply(array((string) $menu->get("unpublished")->label,
- (string) $menu->get("published")->label,
- (string) $menu->get("spam")->label,
- (string) $menu->get("deleted")->label));
+ (string) $menu->get("published")->label,
+ (string) $menu->get("spam")->label,
+ (string) $menu->get("deleted")->label));
}
public function queue($state) {
diff --git a/modules/comment/controllers/comments.php b/modules/comment/controllers/comments.php
index 6ec4132b..ff0e9ce1 100644
--- a/modules/comment/controllers/comments.php
+++ b/modules/comment/controllers/comments.php
@@ -57,8 +57,8 @@ class Comments_Controller extends Controller {
$view->comment = $comment;
json::reply(array("result" => "success",
- "view" => (string)$view,
- "form" => (string)comment::get_add_form($item)));
+ "view" => (string)$view,
+ "form" => (string)comment::get_add_form($item)));
} else {
$form = comment::prefill_add_form($form);
json::reply(array("result" => "error", "form" => (string)$form));
diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php
index da45f57b..b524f5da 100644
--- a/modules/comment/views/comments.html.php
+++ b/modules/comment/views/comments.html.php
@@ -36,11 +36,11 @@
</a>
<? if ($comment->author()->guest): ?>
<?= t('on %date %name said',
- array("date" => date("Y-M-d H:i:s", $comment->created),
- "name" => html::clean($comment->author_name()))); ?>
+ array("date" => gallery::date_time($comment->created),
+ "name" => html::clean($comment->author_name()))); ?>
<? else: ?>
<?= t('on %date <a href="%url">%name</a> said',
- array("date" => date("Y-M-d H:i:s", $comment->created),
+ array("date" => gallery::date_time($comment->created),
"url" => user_profile::url($comment->author_id),
"name" => html::clean($comment->author_name()))); ?>
<? endif ?>
diff --git a/modules/comment/views/user_profile_comments.html.php b/modules/comment/views/user_profile_comments.html.php
index a2a641ba..377b2d95 100644
--- a/modules/comment/views/user_profile_comments.html.php
+++ b/modules/comment/views/user_profile_comments.html.php
@@ -4,8 +4,8 @@
<? foreach ($comments as $comment): ?>
<li id="g-comment-<?= $comment->id ?>">
<p class="g-author">
- <?= t('on %date for %title ',
- array("date" => date("Y-M-d H:i:s", $comment->created),
+ <?= t("on %date for %title ",
+ array("date" => gallery::date_time($comment->created),
"title" => $comment->item()->title)); ?>
<a href="<?= $comment->item()->url() ?>">
<?= $comment->item()->thumb_img(array(), 50) ?>
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 4aa9e642..306a0c50 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -442,6 +442,7 @@ class g2_import_Core {
"title" => "title",
"viewCount" => "view_count");
$direction_map = array(
+ 1 => "asc",
ORDER_ASCENDING => "asc",
ORDER_DESCENDING => "desc");
// Only consider G2's first sort order
@@ -837,11 +838,7 @@ class g2_import_Core {
return;
}
- $text = $g2_comment->getSubject();
- if ($text) {
- $text .= " ";
- }
- $text .= $g2_comment->getComment();
+ $text = join("\n", array($g2_comment->getSubject(), $g2_comment->getComment()));
$text = html_entity_decode($text);
// Just import the fields we know about. Do this outside of the comment API for now so that
@@ -858,7 +855,6 @@ class g2_import_Core {
$comment->text = self::_transform_bbcode($text);
$comment->state = "published";
$comment->server_http_host = $g2_comment->getHost();
- $comment->created = $g2_comment->getDate();
try {
$comment->save();
} catch (Exception $e) {
@@ -867,6 +863,14 @@ class g2_import_Core {
array("id" => $g2_comment_id)),
$e);
}
+
+ // Backdate the creation date. We can't do this at creation time because
+ // Comment_Model::save() will override it.
+ db::update("comments")
+ ->set("created", $g2_comment->getDate())
+ ->set("updated", $g2_comment->getDate())
+ ->where("id", "=", $comment->id)
+ ->execute();
}
/**
diff --git a/modules/gallery/helpers/data_rest.php b/modules/gallery/helpers/data_rest.php
index e45a4645..48de2a3a 100644
--- a/modules/gallery/helpers/data_rest.php
+++ b/modules/gallery/helpers/data_rest.php
@@ -23,7 +23,11 @@ class data_rest_Core {
access::required("view", $item);
$p = $request->params;
- switch (isset($p->size) ? $p->size : "full") {
+ if (!isset($p->size) || !in_array($p->size, array("thumb", "resize", "full"))) {
+ throw new Rest_Exception("Bad Request", 400, array("errors" => array("size" => "invalid")));
+ }
+
+ switch ($p->size) {
case "thumb":
$entity = array(
"width" => $item->thumb_width,
@@ -38,7 +42,6 @@ class data_rest_Core {
"path" => $item->resize_path());
break;
- default:
case "full":
$entity = array(
"width" => $item->width,
@@ -47,8 +50,13 @@ class data_rest_Core {
break;
}
- $entity["size"] = filesize($entity["path"]);
- $entity["contents"] = file_get_contents($entity["path"]);
+ if (file_exists($entity["path"]) && is_file($entity["path"])) {
+ $entity["size"] = filesize($entity["path"]);
+ $entity["contents"] = file_get_contents($entity["path"]);
+ } else {
+ $entity["size"] = null;
+ $entity["contents"] = null;
+ }
unset($entity["path"]);
$result = array(
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 54d16322..3f83b23d 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -60,7 +60,7 @@ class gallery_Core {
* @return string
*/
static function date_time($timestamp) {
- return date(module::get_var("gallery", "date_time_format", "Y-M-d H:i:s"), $timestamp);
+ return date(module::get_var("gallery", "date_time_format"), $timestamp);
}
/**
@@ -69,7 +69,7 @@ class gallery_Core {
* @return string
*/
static function date($timestamp) {
- return date(module::get_var("gallery", "date_format", "Y-M-d"), $timestamp);
+ return date(module::get_var("gallery", "date_format"), $timestamp);
}
/**
diff --git a/modules/gallery/helpers/identity.php b/modules/gallery/helpers/identity.php
index 5f1664ec..5de05948 100644
--- a/modules/gallery/helpers/identity.php
+++ b/modules/gallery/helpers/identity.php
@@ -66,17 +66,20 @@ class identity_Core {
// The installer cannot set a user into the session, so it just sets an id which we should
// upconvert into a user.
- // @todo set the user name into the session instead of 2 and then use it to get the user object
+ // @todo set the user name into the session instead of 2 and then use it to get the
+ // user object
if ($user === 2) {
auth::login(IdentityProvider::instance()->admin_user());
}
- if (!$session->get("group_ids")) {
+ // Cache the group ids for a day to trade off performance for security updates.
+ if (!$session->get("group_ids") || $session->get("group_ids_timeout", 0) < time()) {
$ids = array();
foreach ($user->groups() as $group) {
$ids[] = $group->id;
}
$session->set("group_ids", $ids);
+ $session->set("group_ids_timeout", time() + 86400);
}
} catch (Exception $e) {
// Log it, so we at least have so notification that we swallowed the exception.
diff --git a/modules/gallery/helpers/json.php b/modules/gallery/helpers/json.php
index a39db27a..a88608aa 100644
--- a/modules/gallery/helpers/json.php
+++ b/modules/gallery/helpers/json.php
@@ -25,9 +25,7 @@ class json_Core {
* @param mixed $message string or object to json encode and print
*/
static function reply($message) {
- if (!headers_sent()) {
- header("Content-Type: application/json; charset=" . Kohana::CHARSET);
- }
+ header("Content-Type: application/json; charset=" . Kohana::CHARSET);
print json_encode($message);
}
} \ No newline at end of file
diff --git a/modules/gallery/libraries/MY_Kohana_Exception.php b/modules/gallery/libraries/MY_Kohana_Exception.php
index 27d1afc1..82899d7e 100644
--- a/modules/gallery/libraries/MY_Kohana_Exception.php
+++ b/modules/gallery/libraries/MY_Kohana_Exception.php
@@ -22,11 +22,15 @@ class Kohana_Exception extends Kohana_Exception_Core {
* Dump out the full stack trace as part of the text representation of the exception.
*/
public static function text($e) {
- return sprintf(
- "%s [ %s ]: %s\n%s [ %s ]\n%s",
- get_class($e), $e->getCode(), strip_tags($e->getMessage()),
- $e->getFile(), $e->getLine(),
- $e->getTraceAsString());
+ if ($e instanceof Kohana_404_Exception) {
+ return "File not found: " . Router::$complete_uri;
+ } else {
+ return sprintf(
+ "%s [ %s ]: %s\n%s [ %s ]\n%s",
+ get_class($e), $e->getCode(), strip_tags($e->getMessage()),
+ $e->getFile(), $e->getLine(),
+ $e->getTraceAsString());
+ }
}
/**
diff --git a/modules/gallery/tests/Kohana_Exception_Test.php b/modules/gallery/tests/Kohana_Exception_Test.php
index 48bc5184..df7cf9ff 100644
--- a/modules/gallery/tests/Kohana_Exception_Test.php
+++ b/modules/gallery/tests/Kohana_Exception_Test.php
@@ -37,22 +37,22 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
public function sanitize_for_dump_match_key_test() {
$this->assert_equal("removed for display",
- Kohana_Exception::_sanitize_for_dump("original value", "password"));
+ Kohana_Exception::_sanitize_for_dump("original value", "password", 5));
$this->assert_equal("original value",
- Kohana_Exception::_sanitize_for_dump("original value", "meow"));
+ Kohana_Exception::_sanitize_for_dump("original value", "meow", 5));
}
public function sanitize_for_dump_match_key_loosely_test() {
$this->assert_equal("removed for display",
- Kohana_Exception::_sanitize_for_dump("original value", "this secret key"));
+ Kohana_Exception::_sanitize_for_dump("original value", "this secret key", 5));
}
public function sanitize_for_dump_match_value_test() {
// Looks like a hash / secret value.
$this->assert_equal("removed for display",
- Kohana_Exception::_sanitize_for_dump("p$2a178b841c6391d6368f131", "meow"));
+ Kohana_Exception::_sanitize_for_dump("p$2a178b841c6391d6368f131", "meow", 5));
$this->assert_equal("original value",
- Kohana_Exception::_sanitize_for_dump("original value", "meow"));
+ Kohana_Exception::_sanitize_for_dump("original value", "meow", 5));
}
public function sanitize_for_dump_array_test() {
@@ -64,7 +64,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
"three" => "removed for display");
$this->assert_equal($expected,
- Kohana_Exception::_sanitize_for_dump($var, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($var, "ignored", 5));
}
public function sanitize_for_dump_nested_array_test() {
@@ -73,7 +73,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
$expected = array("safe" => "original value 1",
"safe 2" => array("some hash" => "removed for display"));
$this->assert_equal($expected,
- Kohana_Exception::_sanitize_for_dump($var, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($var, "ignored", 5));
}
public function sanitize_for_dump_user_test() {
@@ -83,7 +83,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
$user->email = "value 2";
$user->full_name = "value 3";
$this->assert_equal('User_Model object for "john" - details omitted for display',
- Kohana_Exception::_sanitize_for_dump($user, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($user, "ignored", 5));
}
public function sanitize_for_dump_database_test() {
@@ -91,7 +91,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
array("connection" => array("user" => "john", "name" => "gallery_3"),
"cache" => array()));
$this->assert_equal("Kohana_Exception_Test_Database object - details omitted for display",
- Kohana_Exception::_sanitize_for_dump($db, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($db, "ignored", 5));
}
public function sanitize_for_dump_nested_database_test() {
@@ -104,7 +104,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
array("some" => "foo",
"bar (type: Kohana_Exception_Test_Database)" =>
"Kohana_Exception_Test_Database object - details omitted for display"),
- Kohana_Exception::_sanitize_for_dump($var, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($var, "ignored", 5));
}
public function sanitize_for_dump_object_test() {
@@ -117,7 +117,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
"private: email_address" => "removed for display",
"password" => "removed for display");
$this->assert_equal($expected,
- Kohana_Exception::_sanitize_for_dump($obj, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($obj, "ignored", 5));
}
public function sanitize_for_dump_nested_object_test() {
@@ -142,7 +142,7 @@ class Kohana_Exception_Test extends Gallery_Unit_Test_Case {
"foo" => array("bar (type: User_Model)" =>
'User_Model object for "john" - details omitted for display'));
$this->assert_equal($expected,
- Kohana_Exception::_sanitize_for_dump($obj, "ignored"));
+ Kohana_Exception::_sanitize_for_dump($obj, "ignored", 5));
}
}
diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt
index 3c9b3afc..0864a928 100644
--- a/modules/gallery/tests/controller_auth_data.txt
+++ b/modules/gallery/tests/controller_auth_data.txt
@@ -14,7 +14,6 @@ modules/gallery/controllers/login.php auth_ajax
modules/gallery/controllers/login.php html DIRTY_AUTH
modules/gallery/controllers/login.php auth_html DIRTY_AUTH
modules/gallery/controllers/logout.php index DIRTY_AUTH
-modules/gallery/controllers/maintenance.php index DIRTY_AUTH
modules/gallery/controllers/quick.php form_edit DIRTY_CSRF
modules/gallery/controllers/upgrader.php index DIRTY_AUTH
modules/gallery/controllers/uploader.php start DIRTY_AUTH
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index 02483865..ef92970b 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -77,23 +77,23 @@ modules/gallery/views/admin_languages.html.php 62 DIRTY form::
modules/gallery/views/admin_languages.html.php 63 DIRTY $display_name
modules/gallery/views/admin_languages.html.php 65 DIRTY form::radio("default_locale",$code,($default_locale==$code),((isset($installed_locales[$code]))?'':'disabled="disabled"'))
modules/gallery/views/admin_languages.html.php 113 DIRTY $share_translations_form
-modules/gallery/views/admin_maintenance.html.php 24 DIRTY_ATTR text::alternate("g-odd","g-even")
-modules/gallery/views/admin_maintenance.html.php 24 DIRTY_ATTR log::severity_class($task->severity)
-modules/gallery/views/admin_maintenance.html.php 25 DIRTY_ATTR log::severity_class($task->severity)
-modules/gallery/views/admin_maintenance.html.php 26 DIRTY $task->name
-modules/gallery/views/admin_maintenance.html.php 29 DIRTY $task->description
-modules/gallery/views/admin_maintenance.html.php 70 DIRTY_ATTR text::alternate("g-odd","g-even")
-modules/gallery/views/admin_maintenance.html.php 70 DIRTY_ATTR $task->state=="stalled"?"g-warning":""
-modules/gallery/views/admin_maintenance.html.php 71 DIRTY_ATTR $task->state=="stalled"?"g-warning":""
-modules/gallery/views/admin_maintenance.html.php 72 DIRTY gallery::date_time($task->updated)
-modules/gallery/views/admin_maintenance.html.php 75 DIRTY $task->name
-modules/gallery/views/admin_maintenance.html.php 90 DIRTY $task->status
-modules/gallery/views/admin_maintenance.html.php 141 DIRTY_ATTR text::alternate("g-odd","g-even")
-modules/gallery/views/admin_maintenance.html.php 141 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
-modules/gallery/views/admin_maintenance.html.php 142 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
-modules/gallery/views/admin_maintenance.html.php 143 DIRTY gallery::date_time($task->updated)
-modules/gallery/views/admin_maintenance.html.php 146 DIRTY $task->name
-modules/gallery/views/admin_maintenance.html.php 158 DIRTY $task->status
+modules/gallery/views/admin_maintenance.html.php 40 DIRTY_ATTR text::alternate("g-odd","g-even")
+modules/gallery/views/admin_maintenance.html.php 40 DIRTY_ATTR log::severity_class($task->severity)
+modules/gallery/views/admin_maintenance.html.php 41 DIRTY_ATTR log::severity_class($task->severity)
+modules/gallery/views/admin_maintenance.html.php 42 DIRTY $task->name
+modules/gallery/views/admin_maintenance.html.php 45 DIRTY $task->description
+modules/gallery/views/admin_maintenance.html.php 86 DIRTY_ATTR text::alternate("g-odd","g-even")
+modules/gallery/views/admin_maintenance.html.php 86 DIRTY_ATTR $task->state=="stalled"?"g-warning":""
+modules/gallery/views/admin_maintenance.html.php 87 DIRTY_ATTR $task->state=="stalled"?"g-warning":""
+modules/gallery/views/admin_maintenance.html.php 88 DIRTY gallery::date_time($task->updated)
+modules/gallery/views/admin_maintenance.html.php 91 DIRTY $task->name
+modules/gallery/views/admin_maintenance.html.php 106 DIRTY $task->status
+modules/gallery/views/admin_maintenance.html.php 157 DIRTY_ATTR text::alternate("g-odd","g-even")
+modules/gallery/views/admin_maintenance.html.php 157 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
+modules/gallery/views/admin_maintenance.html.php 158 DIRTY_ATTR $task->state=="success"?"g-success":"g-error"
+modules/gallery/views/admin_maintenance.html.php 159 DIRTY gallery::date_time($task->updated)
+modules/gallery/views/admin_maintenance.html.php 162 DIRTY $task->name
+modules/gallery/views/admin_maintenance.html.php 174 DIRTY $task->status
modules/gallery/views/admin_maintenance_show_log.html.php 8 DIRTY_JS url::site("admin/maintenance/save_log/$task->id?csrf=$csrf")
modules/gallery/views/admin_maintenance_show_log.html.php 13 DIRTY $task->name
modules/gallery/views/admin_maintenance_task.html.php 55 DIRTY $task->name
@@ -122,50 +122,50 @@ modules/gallery/views/admin_themes.html.php 76 DIRTY $info-
modules/gallery/views/admin_themes.html.php 78 DIRTY $info->description
modules/gallery/views/admin_themes_preview.html.php 8 DIRTY_ATTR $url
modules/gallery/views/error_404.html.php 14 DIRTY $login_form
-modules/gallery/views/error_admin.html.php 150 DIRTY $type
-modules/gallery/views/error_admin.html.php 150 DIRTY $code
-modules/gallery/views/error_admin.html.php 153 DIRTY $message
-modules/gallery/views/error_admin.html.php 156 DIRTY_ATTR $error_id
-modules/gallery/views/error_admin.html.php 161 DIRTY Kohana_Exception::debug_path($file)
-modules/gallery/views/error_admin.html.php 161 DIRTY $line
-modules/gallery/views/error_admin.html.php 166 DIRTY_ATTR ($num==$line)?"highlight":""
-modules/gallery/views/error_admin.html.php 166 DIRTY $num
-modules/gallery/views/error_admin.html.php 166 DIRTY htmlspecialchars($row,ENT_NOQUOTES,Kohana::CHARSET)
-modules/gallery/views/error_admin.html.php 178 DIRTY_ATTR $source_id
-modules/gallery/views/error_admin.html.php 178 DIRTY_JS $source_id
-modules/gallery/views/error_admin.html.php 178 DIRTY Kohana_Exception::debug_path($step["file"])
-modules/gallery/views/error_admin.html.php 178 DIRTY $step["line"]
-modules/gallery/views/error_admin.html.php 180 DIRTY Kohana_Exception::debug_path($step["file"])
-modules/gallery/views/error_admin.html.php 180 DIRTY $step["line"]
-modules/gallery/views/error_admin.html.php 187 DIRTY $step["function"]
-modules/gallery/views/error_admin.html.php 188 DIRTY_ATTR $args_id
-modules/gallery/views/error_admin.html.php 188 DIRTY_JS $args_id
-modules/gallery/views/error_admin.html.php 192 DIRTY_ATTR $args_id
-modules/gallery/views/error_admin.html.php 197 DIRTY $name
-modules/gallery/views/error_admin.html.php 200 DIRTY Kohana_Exception::safe_dump($arg,$name)
-modules/gallery/views/error_admin.html.php 208 DIRTY_ATTR $source_id
-modules/gallery/views/error_admin.html.php 208 DIRTY_ATTR ($num==$step["line"])?"highlight":""
-modules/gallery/views/error_admin.html.php 208 DIRTY $num
-modules/gallery/views/error_admin.html.php 208 DIRTY htmlspecialchars($row,ENT_NOQUOTES,Kohana::CHARSET)
-modules/gallery/views/error_admin.html.php 218 DIRTY_ATTR $env_id=$error_id."environment"
-modules/gallery/views/error_admin.html.php 218 DIRTY_JS $env_id
-modules/gallery/views/error_admin.html.php 220 DIRTY_ATTR $env_id
-modules/gallery/views/error_admin.html.php 222 DIRTY_ATTR $env_id=$error_id."environment_included"
-modules/gallery/views/error_admin.html.php 222 DIRTY_JS $env_id
-modules/gallery/views/error_admin.html.php 222 DIRTY count($included)
-modules/gallery/views/error_admin.html.php 223 DIRTY_ATTR $env_id
-modules/gallery/views/error_admin.html.php 228 DIRTY Kohana_Exception::debug_path($file)
-modules/gallery/views/error_admin.html.php 235 DIRTY_ATTR $env_id=$error_id."environment_loaded"
-modules/gallery/views/error_admin.html.php 235 DIRTY_JS $env_id
-modules/gallery/views/error_admin.html.php 235 DIRTY count($included)
-modules/gallery/views/error_admin.html.php 236 DIRTY_ATTR $env_id
-modules/gallery/views/error_admin.html.php 241 DIRTY Kohana_Exception::debug_path($file)
-modules/gallery/views/error_admin.html.php 249 DIRTY_ATTR $env_id="$error_id.environment".strtolower($var)
-modules/gallery/views/error_admin.html.php 250 DIRTY_JS $env_id
-modules/gallery/views/error_admin.html.php 250 DIRTY $var
-modules/gallery/views/error_admin.html.php 251 DIRTY_ATTR $env_id
-modules/gallery/views/error_admin.html.php 257 DIRTY $key
-modules/gallery/views/error_admin.html.php 261 DIRTY Kohana_Exception::safe_dump($value,$key)
+modules/gallery/views/error_admin.html.php 183 DIRTY $type
+modules/gallery/views/error_admin.html.php 183 DIRTY $code
+modules/gallery/views/error_admin.html.php 186 DIRTY $message
+modules/gallery/views/error_admin.html.php 189 DIRTY_ATTR $error_id
+modules/gallery/views/error_admin.html.php 194 DIRTY Kohana_Exception::debug_path($file)
+modules/gallery/views/error_admin.html.php 194 DIRTY $line
+modules/gallery/views/error_admin.html.php 199 DIRTY_ATTR ($num==$line)?"highlight":""
+modules/gallery/views/error_admin.html.php 199 DIRTY $num
+modules/gallery/views/error_admin.html.php 199 DIRTY htmlspecialchars($row,ENT_NOQUOTES,Kohana::CHARSET)
+modules/gallery/views/error_admin.html.php 211 DIRTY_ATTR $source_id
+modules/gallery/views/error_admin.html.php 211 DIRTY_JS $source_id
+modules/gallery/views/error_admin.html.php 211 DIRTY Kohana_Exception::debug_path($step["file"])
+modules/gallery/views/error_admin.html.php 211 DIRTY $step["line"]
+modules/gallery/views/error_admin.html.php 213 DIRTY Kohana_Exception::debug_path($step["file"])
+modules/gallery/views/error_admin.html.php 213 DIRTY $step["line"]
+modules/gallery/views/error_admin.html.php 220 DIRTY $step["function"]
+modules/gallery/views/error_admin.html.php 221 DIRTY_ATTR $args_id
+modules/gallery/views/error_admin.html.php 221 DIRTY_JS $args_id
+modules/gallery/views/error_admin.html.php 225 DIRTY_ATTR $args_id
+modules/gallery/views/error_admin.html.php 230 DIRTY $name
+modules/gallery/views/error_admin.html.php 233 DIRTY Kohana_Exception::safe_dump($arg,$name)
+modules/gallery/views/error_admin.html.php 241 DIRTY_ATTR $source_id
+modules/gallery/views/error_admin.html.php 241 DIRTY_ATTR ($num==$step["line"])?"highlight":""
+modules/gallery/views/error_admin.html.php 241 DIRTY $num
+modules/gallery/views/error_admin.html.php 241 DIRTY htmlspecialchars($row,ENT_NOQUOTES,Kohana::CHARSET)
+modules/gallery/views/error_admin.html.php 251 DIRTY_ATTR $env_id=$error_id."environment"
+modules/gallery/views/error_admin.html.php 251 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 253 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 255 DIRTY_ATTR $env_id=$error_id."environment_included"
+modules/gallery/views/error_admin.html.php 255 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 255 DIRTY count($included)
+modules/gallery/views/error_admin.html.php 256 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 261 DIRTY Kohana_Exception::debug_path($file)
+modules/gallery/views/error_admin.html.php 268 DIRTY_ATTR $env_id=$error_id."environment_loaded"
+modules/gallery/views/error_admin.html.php 268 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 268 DIRTY count($included)
+modules/gallery/views/error_admin.html.php 269 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 274 DIRTY Kohana_Exception::debug_path($file)
+modules/gallery/views/error_admin.html.php 282 DIRTY_ATTR $env_id="$error_id.environment".strtolower($var)
+modules/gallery/views/error_admin.html.php 283 DIRTY_JS $env_id
+modules/gallery/views/error_admin.html.php 283 DIRTY $var
+modules/gallery/views/error_admin.html.php 284 DIRTY_ATTR $env_id
+modules/gallery/views/error_admin.html.php 290 DIRTY $key
+modules/gallery/views/error_admin.html.php 294 DIRTY Kohana_Exception::safe_dump($value,$key)
modules/gallery/views/form_uploadify.html.php 9 DIRTY_JS url::file("lib/uploadify/uploadify.swf")
modules/gallery/views/form_uploadify.html.php 10 DIRTY_JS url::site("uploader/add_photo/{$album->id}")
modules/gallery/views/form_uploadify.html.php 14 DIRTY_JS url::file("lib/uploadify/cancel.png")
@@ -191,7 +191,6 @@ modules/gallery/views/l10n_client.html.php 62 DIRTY form::
modules/gallery/views/l10n_client.html.php 67 DIRTY form::textarea("l10n-edit-plural-translation-other","",' rows="2"')
modules/gallery/views/login_ajax.html.php 6 DIRTY_JS url::site("password/reset")
modules/gallery/views/login_ajax.html.php 44 DIRTY $form
-modules/gallery/views/maintenance.html.php 46 DIRTY auth::get_login_form("login/auth_html")
modules/gallery/views/menu.html.php 4 DIRTY $menu->css_id?"id='$menu->css_id'":""
modules/gallery/views/menu.html.php 4 DIRTY_ATTR $menu->css_class
modules/gallery/views/menu.html.php 6 DIRTY $element->render()
@@ -268,7 +267,7 @@ modules/gallery/views/user_profile.html.php 34 DIRTY_ATTR $use
modules/gallery/views/user_profile.html.php 43 DIRTY $info->view
modules/image_block/views/image_block_block.html.php 3 DIRTY_JS $item->url()
modules/image_block/views/image_block_block.html.php 4 DIRTY $item->thumb_img(array("class"=>"g-thumbnail"))
-modules/info/views/info_block.html.php 22 DIRTY date("M j, Y H:i:s",$item->captured)
+modules/info/views/info_block.html.php 22 DIRTY gallery::date_time($item->captured)
modules/info/views/info_block.html.php 29 DIRTY_JS $item->owner->url
modules/notification/views/comment_published.html.php 28 DIRTY_JS $comment->item()->abs_url()
modules/notification/views/comment_published.html.php 29 DIRTY $comment->item()->abs_url()
diff --git a/modules/gallery/views/error_admin.html.php b/modules/gallery/views/error_admin.html.php
index 512a0d88..f5004eae 100644
--- a/modules/gallery/views/error_admin.html.php
+++ b/modules/gallery/views/error_admin.html.php
@@ -32,9 +32,9 @@
#framework_error .title {
position: relative;
- top: -3em;
+ top: -2.5em;
+ padding: 0px;
text-align: center;
- margin: 0 auto;
}
div#error_details {
@@ -116,7 +116,7 @@
padding-right: 1em;
}
- #g-platform h2 {
+ #g-platform h2, #g-stats h2 {
font-size: 1.1em;
}
</style>
@@ -174,8 +174,9 @@
of <a href="http://sourceforge.net/apps/trac/gallery/roadmap">open
tickets</a> to see if the problem you're seeing has been
reported. If you post a request, here's some useful
- information to include: <? @$block =
- gallery_block::get("platform_info"); @print $block; ?>
+ information to include:
+ <?= @gallery_block::get("platform_info") ?>
+ <?= @gallery_block::get("stats") ?>
</p>
<div id="kohana_error">
<h3>
diff --git a/modules/gallery_unit_test/views/kohana_unit_test_cli.php b/modules/gallery_unit_test/views/kohana_unit_test_cli.php
index a0de0f52..61dae7dd 100644
--- a/modules/gallery_unit_test/views/kohana_unit_test_cli.php
+++ b/modules/gallery_unit_test/views/kohana_unit_test_cli.php
@@ -71,7 +71,7 @@ foreach ($results as $class => $methods) {
}
echo "+", str_repeat("=", 87), "+", str_repeat("=", 10), "+\n";
- printf("| %-40.40s %-13.13s %-13.13s %-13.13s %-13.13s |\n",
+ printf("| %-40.40s %-10.10s %-10.10s %-10.10s %-10.10s %-10.10s |\n",
$class,
"Score: {$stats[$class]['score']}",
"Total: {$stats[$class]['total']}",
@@ -81,7 +81,7 @@ foreach ($results as $class => $methods) {
echo "+", str_repeat("=", 98), "+\n\n\n";
}
-printf(" %-40.40s %-13.13s %-13.13s %-13.13s %-13.13s\n",
+printf(" %-40.40s %-10.10s %-10.10s %-10.10s %-10.10s %-10.10s\n",
"TOTAL",
"Score: " . ($totals["total"] ? 100 * ($totals["passed"] / $totals["total"]) : 0),
"Total: {$totals['total']}",
diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php
index ac177ee7..ebe9bd28 100644
--- a/modules/info/views/info_block.html.php
+++ b/modules/info/views/info_block.html.php
@@ -19,7 +19,7 @@
<? if ($item->captured): ?>
<li>
<strong class="caption"><?= t("Captured:") ?></strong>
- <?= date("M j, Y H:i:s", $item->captured)?>
+ <?= gallery::date_time($item->captured)?>
</li>
<? endif ?>
<? if ($item->owner): ?>
diff --git a/modules/rest/helpers/registry_rest.php b/modules/rest/helpers/registry_rest.php
new file mode 100644
index 00000000..e9c8b955
--- /dev/null
+++ b/modules/rest/helpers/registry_rest.php
@@ -0,0 +1,30 @@
+<?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 registry_rest_Core {
+ static function get($request) {
+ $results = array();
+ foreach (module::active() as $module) {
+ foreach (glob(MODPATH . "{$module->name}/helpers/*_rest.php") as $filename) {
+ $results[] = str_replace("_rest.php", "", basename($filename));
+ }
+ }
+ return array_unique($results);
+ }
+}
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index 644779da..73d09c64 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -24,7 +24,27 @@ class rest_Core {
Session::instance()->abort_save();
header("X-Gallery-API-Version: " . rest::API_VERSION);
- if (Input::instance()->get("output") == "html") {
+ switch (Input::instance()->get("output", "json")) {
+ case "json":
+ json::reply($data);
+ break;
+
+ case "jsonp":
+ if (!($callback = Input::instance()->get("callback", ""))) {
+ throw new Rest_Exception(
+ "Bad Request", 400, array("errors" => array("callback" => "missing")));
+ }
+
+ if (preg_match('/^[$A-Za-z_][0-9A-Za-z_]*$/', $callback) == 1) {
+ header("Content-type: application/javascript");
+ print "$callback(" . json_encode($data) . ")";
+ } else {
+ throw new Rest_Exception(
+ "Bad Request", 400, array("errors" => array("callback" => "invalid")));
+ }
+ break;
+
+ case "html":
header("Content-type: text/html");
if ($data) {
$html = preg_replace(
@@ -34,8 +54,10 @@ class rest_Core {
$html = t("Empty response");
}
print "<pre>$html</pre>";
- } else {
- json::reply($data);
+ break;
+
+ default:
+ throw new Rest_Exception("Bad Request", 400);
}
}
diff --git a/modules/user/controllers/users.php b/modules/user/controllers/users.php
index 5e6239d8..6bb4967f 100644
--- a/modules/user/controllers/users.php
+++ b/modules/user/controllers/users.php
@@ -41,7 +41,7 @@ class Users_Controller extends Controller {
// Translate ORM validation errors into form error messages
foreach ($e->validation->errors() as $key => $error) {
$form->edit_user->inputs[$key]->add_error($error, 1);
- }
+ }
$valid = false;
}
@@ -55,7 +55,7 @@ class Users_Controller extends Controller {
module::event("user_edit_form_completed", $user, $form);
message::success(t("User information updated"));
json::reply(array("result" => "success",
- "resource" => url::site("users/{$user->id}")));
+ "resource" => url::site("users/{$user->id}")));
} else {
json::reply(array("result" => "error", "html" => (string)$form));
}
@@ -87,7 +87,7 @@ class Users_Controller extends Controller {
module::event("user_auth", $user);
module::event("user_password_change", $user);
json::reply(array("result" => "success",
- "resource" => url::site("users/{$user->id}")));
+ "resource" => url::site("users/{$user->id}")));
} else {
log::warning("user", t("Failed password change for %name", array("name" => $user->name)));
$name = $user->name;
@@ -121,7 +121,7 @@ class Users_Controller extends Controller {
message::success(t("Email address changed"));
module::event("user_auth", $user);
json::reply(array("result" => "success",
- "resource" => url::site("users/{$user->id}")));
+ "resource" => url::site("users/{$user->id}")));
} else {
log::warning("user", t("Failed email change for %name", array("name" => $user->name)));
$name = $user->name;