summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/admin_modules.php1
-rw-r--r--modules/gallery/controllers/combined.php2
-rw-r--r--modules/gallery/controllers/file_proxy.php2
-rw-r--r--modules/gallery/helpers/gallery_block.php2
-rw-r--r--modules/gallery/helpers/gallery_rss.php1
-rw-r--r--modules/gallery/helpers/gallery_task.php11
-rw-r--r--modules/gallery/helpers/graphics.php3
-rw-r--r--modules/gallery/helpers/l10n_client.php1
-rw-r--r--modules/gallery/helpers/module.php3
-rw-r--r--modules/gallery/libraries/Form_Script.php4
-rw-r--r--modules/gallery/libraries/MY_Database.php2
-rw-r--r--modules/gallery/libraries/MY_View.php2
-rw-r--r--modules/gallery/libraries/ORM_MPTT.php2
-rw-r--r--modules/gallery/models/item.php2
-rw-r--r--modules/gallery/models/task.php4
-rw-r--r--modules/gallery/tests/Database_Test.php8
-rw-r--r--modules/gallery/tests/Item_Rest_Helper_Test.php17
17 files changed, 48 insertions, 19 deletions
diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php
index 84fee25d..081b3f12 100644
--- a/modules/gallery/controllers/admin_modules.php
+++ b/modules/gallery/controllers/admin_modules.php
@@ -67,6 +67,7 @@ class Admin_Modules_Controller extends Admin_Controller {
}
private function _do_save() {
+ $changes = new stdClass();
$changes->activate = array();
$changes->deactivate = array();
$activated_names = array();
diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php
index e90a2f1a..7f3a3c7d 100644
--- a/modules/gallery/controllers/combined.php
+++ b/modules/gallery/controllers/combined.php
@@ -41,7 +41,7 @@ class Combined_Controller extends Controller {
$input = Input::instance();
// We don't need to save the session for this request
- Session::abort_save();
+ Session::instance()->abort_save();
// Our data is immutable, so if they already have a copy then it needs no updating.
if ($input->server("HTTP_IF_MODIFIED_SINCE")) {
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index 646edf17..33952366 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -121,7 +121,7 @@ class File_Proxy_Controller extends Controller {
expires::check(2592000, $item->updated);
// We don't need to save the session for this request
- Session::abort_save();
+ Session::instance()->abort_save();
expires::set(2592000, $item->updated); // 30 days
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index 9d4e81b6..be0f11b8 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -72,7 +72,7 @@ class gallery_block_Core {
$block->content = new View("admin_block_platform.html");
if (is_readable("/proc/loadavg")) {
$block->content->load_average =
- join(" ", array_slice(explode(" ", array_shift(file("/proc/loadavg"))), 0, 3));
+ join(" ", array_slice(explode(" ", current(file("/proc/loadavg"))), 0, 3));
} else {
$block->content->load_average = t("Unavailable");
}
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
index d422636f..c1790d28 100644
--- a/modules/gallery/helpers/gallery_rss.php
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -25,6 +25,7 @@ class gallery_rss_Core {
}
static function feed($feed_id, $offset, $limit, $id) {
+ $feed = new stdClass();
switch ($feed_id) {
case "latest":
$feed->children = ORM::factory("item")
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index c75e050a..b2f18d7c 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -111,6 +111,7 @@ class gallery_task_Core {
site_status::clear("graphics_dirty");
}
} catch (Exception $e) {
+ Kohana_Log::add("error",(string)$e);
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
@@ -214,6 +215,7 @@ class gallery_task_Core {
Cache::instance()->delete("update_l10n_cache:{$task->id}");
}
} catch (Exception $e) {
+ Kohana_Log::add("error",(string)$e);
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
@@ -233,10 +235,10 @@ class gallery_task_Core {
try {
$start = microtime(true);
$data = Cache::instance()->get("file_cleanup_cache:{$task->id}");
- if ($data) {
- $files = unserialize($data);
- }
+ $files = $data ? unserialize($data) : array();
$i = 0;
+ $current = 0;
+ $total = 0;
switch ($task->get("mode", "init")) {
case "init": // 0%
@@ -262,6 +264,7 @@ class gallery_task_Core {
if (count($files) == 0) {
break;
}
+
case "delete_files":
$current = $task->get("current");
$total = $task->get("total");
@@ -279,8 +282,10 @@ class gallery_task_Core {
if ($total == $current) {
$task->done = true;
$task->state = "success";
+ $task->percent_complete = 100;
}
} catch (Exception $e) {
+ Kohana_Log::add("error",(string)$e);
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 5a290905..c85c7750 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -262,6 +262,9 @@ class graphics_Core {
*/
static function detect_toolkits() {
$toolkits = new stdClass();
+ $toolkits->gd = new stdClass();
+ $toolkits->imagemagick = new stdClass();
+ $toolkits->graphicsmagick = new stdClass();
// GD is special, it doesn't use exec()
$gd = function_exists("gd_info") ? gd_info() : array();
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index 086245e8..c27e4e5b 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -77,6 +77,7 @@ class l10n_client_Core {
* translations for.
*/
static function fetch_updates(&$num_fetched) {
+ $request = new stdClass();
$request->locales = array();
$request->messages = new stdClass();
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 95e426c4..9523d1d2 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -430,7 +430,8 @@ class module_Core {
// This could happen if there's a race condition
continue;
}
- self::$var_cache->{$row->module_name}->{$row->name} = $row->value;
+ // Mute the "Creating default object from empty value" warning below
+ @self::$var_cache->{$row->module_name}->{$row->name} = $row->value;
}
$cache = ORM::factory("var");
$cache->module_name = "gallery";
diff --git a/modules/gallery/libraries/Form_Script.php b/modules/gallery/libraries/Form_Script.php
index e841408d..1f965767 100644
--- a/modules/gallery/libraries/Form_Script.php
+++ b/modules/gallery/libraries/Form_Script.php
@@ -50,7 +50,7 @@ class Form_Script_Core extends Forge {
return $this;
}
- public function render() {
+ public function render($template="forge_template", $custom=false) {
$script = array();
if (!empty($this->data["url"])) {
$script[] = html::script($this->data["url"]);
@@ -63,4 +63,4 @@ class Form_Script_Core extends Forge {
return implode("\n", $script);
}
-} // End Form Script \ No newline at end of file
+} \ No newline at end of file
diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php
index 61f23fb0..e2ef68cd 100644
--- a/modules/gallery/libraries/MY_Database.php
+++ b/modules/gallery/libraries/MY_Database.php
@@ -38,7 +38,7 @@ abstract class Database extends Database_Core {
* Parse the query string and convert any strings of the form `\([a-zA-Z0-9_]*?)\]
* table prefix . $1
*/
- public function query($sql = '') {
+ public function query($sql) {
if (!empty($sql)) {
$sql = $this->add_table_prefixes($sql);
}
diff --git a/modules/gallery/libraries/MY_View.php b/modules/gallery/libraries/MY_View.php
index cec59ec1..83e0d0be 100644
--- a/modules/gallery/libraries/MY_View.php
+++ b/modules/gallery/libraries/MY_View.php
@@ -27,7 +27,7 @@ class View extends View_Core {
View::$global_data[$key] = $value;
}
- public function is_set($key) {
+ public function is_set($key=null) {
return parent::is_set($key) ? true : array_key_exists($key, View::$global_data);
}
diff --git a/modules/gallery/libraries/ORM_MPTT.php b/modules/gallery/libraries/ORM_MPTT.php
index 83f9b51e..3668d42d 100644
--- a/modules/gallery/libraries/ORM_MPTT.php
+++ b/modules/gallery/libraries/ORM_MPTT.php
@@ -85,7 +85,7 @@ class ORM_MPTT_Core extends ORM {
/**
* Delete this node and all of its children.
*/
- public function delete() {
+ public function delete($ignored_id=null) {
$children = $this->children();
if ($children) {
foreach ($this->children() as $item) {
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 083fd06b..dbd56fa2 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -70,7 +70,7 @@ class Item_Model extends ORM_MPTT {
return $this->type == 'movie';
}
- public function delete() {
+ public function delete($ignored_id=null) {
if ($this->id == 1) {
$v = new Validation(array("id"));
$v->add_error("id", "cant_delete_root_album");
diff --git a/modules/gallery/models/task.php b/modules/gallery/models/task.php
index f40be492..24d909cb 100644
--- a/modules/gallery/models/task.php
+++ b/modules/gallery/models/task.php
@@ -27,7 +27,7 @@ class Task_Model extends ORM {
}
}
- public function set($key, $value) {
+ public function set($key, $value=null) {
$context = unserialize($this->context);
$context[$key] = $value;
$this->context = serialize($context);
@@ -40,7 +40,7 @@ class Task_Model extends ORM {
return parent::save();
}
- public function delete() {
+ public function delete($ignored_id=null) {
Cache::instance()->delete($this->_cache_key());
return parent::delete();
}
diff --git a/modules/gallery/tests/Database_Test.php b/modules/gallery/tests/Database_Test.php
index e58f73eb..861f7bba 100644
--- a/modules/gallery/tests/Database_Test.php
+++ b/modules/gallery/tests/Database_Test.php
@@ -168,12 +168,12 @@ class Database_Mock extends Database {
return array("test");
}
- public function quote_column($val) {
- return "[$val]";
+ public function quote_column($val, $alias=null) {
+ return $alias ? "[$val,$alias]" : "[$val]";
}
- public function quote_table($val) {
- return "[$val]";
+ public function quote_table($val, $alias=null) {
+ return $alias ? "[$val,$alias]" : "[$val]";
}
public function quote($val) {
diff --git a/modules/gallery/tests/Item_Rest_Helper_Test.php b/modules/gallery/tests/Item_Rest_Helper_Test.php
index 088b1cbd..6d1dd864 100644
--- a/modules/gallery/tests/Item_Rest_Helper_Test.php
+++ b/modules/gallery/tests/Item_Rest_Helper_Test.php
@@ -32,6 +32,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1->reload();
// No scope is the same as "direct"
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
$request->params = new stdClass();
$this->assert_equal_array(
@@ -84,7 +85,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$photo2->save();
$album1->reload();
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->name = "foo";
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
@@ -104,7 +107,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album2 = test::random_album($album1);
$album1->reload();
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->type = "album";
$this->assert_equal_array(
array("url" => rest::url("item", $album1),
@@ -122,7 +127,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album();
access::allow(identity::everybody(), "edit", $album1);
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->title = "my new title";
item_rest::put($request);
@@ -133,7 +140,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album();
access::allow(identity::everybody(), "edit", $album1);
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->title = "my new title";
$request->params->slug = "not url safe";
@@ -150,7 +159,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album();
access::allow(identity::everybody(), "edit", $album1);
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->type = "album";
$request->params->name = "my album";
$request->params->title = "my album";
@@ -165,7 +176,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album();
access::allow(identity::everybody(), "edit", $album1);
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->type = "album";
$request->params->name = "my album";
$request->params->title = "my album";
@@ -185,7 +198,9 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album();
access::allow(identity::everybody(), "edit", $album1);
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
+ $request->params = new stdClass();
$request->params->type = "photo";
$request->params->name = "my photo.jpg";
$request->file = MODPATH . "gallery/tests/test.jpg";
@@ -200,6 +215,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
$album1 = test::random_album();
access::allow(identity::everybody(), "edit", $album1);
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
item_rest::delete($request);
@@ -212,6 +228,7 @@ class Item_Rest_Helper_Test extends Gallery_Unit_Test_Case {
access::deny(identity::everybody(), "edit", $album1);
identity::set_active_user(identity::guest());
+ $request = new stdClass();
$request->url = rest::url("item", $album1);
try {
item_rest::delete($request);