summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/admin.php2
-rw-r--r--modules/gallery/helpers/block_manager.php10
-rw-r--r--modules/gallery/helpers/module.php18
-rw-r--r--modules/gallery/helpers/task.php2
-rw-r--r--modules/gallery/libraries/Admin_View.php2
-rw-r--r--modules/gallery/libraries/IdentityProvider.php3
-rw-r--r--modules/gallery/libraries/MY_Kohana.php45
-rw-r--r--modules/gallery/libraries/SafeString.php2
-rw-r--r--modules/gallery/libraries/Theme_View.php4
-rw-r--r--modules/gallery/tests/Html_Helper_Test.php2
-rw-r--r--modules/gallery/tests/SafeString_Test.php4
11 files changed, 25 insertions, 69 deletions
diff --git a/modules/gallery/controllers/admin.php b/modules/gallery/controllers/admin.php
index c9d944cc..b35a9299 100644
--- a/modules/gallery/controllers/admin.php
+++ b/modules/gallery/controllers/admin.php
@@ -55,7 +55,7 @@ class Admin_Controller extends Controller {
$method = "index";
}
- if (!method_exists($controller_name, $method)) {
+ if (!class_exists($controller_name) || !method_exists($controller_name, $method)) {
throw new Kohana_404_Exception();
}
diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php
index bd6ca1c8..a2279468 100644
--- a/modules/gallery/helpers/block_manager.php
+++ b/modules/gallery/helpers/block_manager.php
@@ -35,7 +35,7 @@ class block_manager_Core {
static function activate_blocks($module_name) {
$block_class = "{$module_name}_block";
- if (method_exists($block_class, "get_site_list")) {
+ if (class_exists($block_class) && method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
block_manager::add("site_sidebar", $module_name, $block_id);
@@ -61,14 +61,14 @@ class block_manager_Core {
static function deactivate_blocks($module_name) {
$block_class = "{$module_name}_block";
- if (method_exists($block_class, "get_site_list")) {
+ if (class_exists($block_class) && method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
block_manager::remove_blocks_for_module("site_sidebar", $module_name);
}
}
- if (method_exists($block_class, "get_admin_list")) {
+ if (class_exists($block_class) && method_exists($block_class, "get_admin_list")) {
$blocks = call_user_func(array($block_class, "get_admin_list"));
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
block_manager::remove_blocks_for_module($location, $module_name);
@@ -89,7 +89,7 @@ class block_manager_Core {
foreach (module::active() as $module) {
$class_name = "{$module->name}_block";
- if (method_exists($class_name, $function)) {
+ if (class_exists($class_name) && method_exists($class_name, $function)) {
foreach (call_user_func(array($class_name, $function)) as $id => $title) {
$blocks["{$module->name}:$id"] = $title;
}
@@ -102,7 +102,7 @@ class block_manager_Core {
$active = block_manager::get_active($location);
$result = "";
foreach ($active as $id => $desc) {
- if (method_exists("$desc[0]_block", "get")) {
+ if (class_exists("$desc[0]_block") && method_exists("$desc[0]_block", "get")) {
$block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $theme);
if (!empty($block)) {
$block->id = $id;
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index d7429121..da201d20 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -141,7 +141,7 @@ class module_Core {
$messages = array();
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "can_activate")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "can_activate")) {
$messages = call_user_func(array($installer_class, "can_activate"));
}
@@ -173,7 +173,7 @@ class module_Core {
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "install")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "install")) {
call_user_func_array(array($installer_class, "install"), array());
}
module::set_version($module_name, module::available()->$module_name->code_version);
@@ -226,7 +226,7 @@ class module_Core {
$version_before = module::get_version($module_name);
$installer_class = "{$module_name}_installer";
$available = module::available();
- if (method_exists($installer_class, "upgrade")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "upgrade")) {
call_user_func_array(array($installer_class, "upgrade"), array($version_before));
} else {
if (isset($available->$module_name->code_version)) {
@@ -261,7 +261,7 @@ class module_Core {
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "activate")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "activate")) {
call_user_func_array(array($installer_class, "activate"), array());
}
@@ -288,7 +288,7 @@ class module_Core {
*/
static function deactivate($module_name) {
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "deactivate")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "deactivate")) {
call_user_func_array(array($installer_class, "deactivate"), array());
}
@@ -314,7 +314,7 @@ class module_Core {
*/
static function uninstall($module_name) {
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "uninstall")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "uninstall")) {
call_user_func(array($installer_class, "uninstall"));
}
@@ -403,7 +403,7 @@ class module_Core {
continue;
}
$class = "{$module->name}_event";
- if (method_exists($class, $function)) {
+ if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@@ -411,7 +411,7 @@ class module_Core {
// Give the admin theme a chance to respond, if we're in admin mode.
if (theme::$is_admin) {
$class = theme::$admin_theme_name . "_event";
- if (method_exists($class, $function)) {
+ if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@@ -419,7 +419,7 @@ class module_Core {
// Give the site theme a chance to respond as well. It gets a chance even in admin mode, as
// long as the theme has an admin subdir.
$class = theme::$site_theme_name . "_event";
- if (method_exists($class, $function)) {
+ if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
diff --git a/modules/gallery/helpers/task.php b/modules/gallery/helpers/task.php
index 32fd9739..5638faf4 100644
--- a/modules/gallery/helpers/task.php
+++ b/modules/gallery/helpers/task.php
@@ -25,7 +25,7 @@ class task_Core {
$tasks = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_task";
- if (method_exists($class_name, "available_tasks")) {
+ if (class_exists($class_name) && method_exists($class_name, "available_tasks")) {
foreach (call_user_func(array($class_name, "available_tasks")) as $task) {
$tasks[$task->callback] = $task;
}
diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php
index 83163868..62645d18 100644
--- a/modules/gallery/libraries/Admin_View.php
+++ b/modules/gallery/libraries/Admin_View.php
@@ -95,7 +95,7 @@ class Admin_View_Core extends Gallery_View {
$blocks = array();
foreach (module::active() as $module) {
$helper_class = "{$module->name}_theme";
- if (method_exists($helper_class, $function)) {
+ if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php
index 23368a6a..525e1695 100644
--- a/modules/gallery/libraries/IdentityProvider.php
+++ b/modules/gallery/libraries/IdentityProvider.php
@@ -81,7 +81,8 @@ class IdentityProvider_Core {
module::set_var("gallery", "identity_provider", $new_provider);
- if (method_exists("{$new_provider}_installer", "initialize")) {
+ if (class_exists("{$new_provider}_installer") &&
+ method_exists("{$new_provider}_installer", "initialize")) {
call_user_func("{$new_provider}_installer::initialize");
}
diff --git a/modules/gallery/libraries/MY_Kohana.php b/modules/gallery/libraries/MY_Kohana.php
deleted file mode 100644
index d344c8ed..00000000
--- a/modules/gallery/libraries/MY_Kohana.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php defined("SYSPATH") or die("No direct script access.");
-/**
- * Gallery - a web based photo album viewer and editor
- * Copyright (C) 2000-2013 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.
- */
-final class Kohana extends Kohana_Core {
- /**
- * Wrapper function for Kohana::auto_load that provides compatibility with Zend Guard Loader's
- * code obfuscation. Zend Guard is enabled by default on many PHP 5.3+ installations and can
- * cause problems with Kohana 2.4. When a class is not found, Zend Guard Loader may continue to
- * try and load the class, eventually leading to a seg fault.
- *
- * Instead, if we can't find the class and we can see that code obfuscation is at level 3+, let's
- * load a dummy class. This does not change the return value, so Kohana still knows that
- * there is no class.
- *
- * This is based on the patch described here: http://blog.teatime.com.tw/1/post/403
- */
- public static function auto_load($class) {
- $found = parent::auto_load($class);
-
- if (!$found && function_exists("zend_current_obfuscation_level") &&
- (zend_current_obfuscation_level() >= 3)) {
- // Load a dummy class instead.
- eval("class $class {}");
- }
-
- // Return the same result.
- return $found;
- }
-} \ No newline at end of file
diff --git a/modules/gallery/libraries/SafeString.php b/modules/gallery/libraries/SafeString.php
index 31e9d31b..179cbd41 100644
--- a/modules/gallery/libraries/SafeString.php
+++ b/modules/gallery/libraries/SafeString.php
@@ -153,7 +153,7 @@ class SafeString_Core {
* Purify the string, removing any potentially malicious or unsafe HTML / JavaScript.
*/
private static function _purify_for_html($dirty_html) {
- if (method_exists("purifier", "purify")) {
+ if (class_exists("purifier") && method_exists("purifier", "purify")) {
return purifier::purify($dirty_html);
} else {
return self::_escape_for_html($dirty_html);
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 986fc8a2..0a4c96e1 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -239,7 +239,7 @@ class Theme_View_Core extends Gallery_View {
continue;
}
$helper_class = "{$module->name}_theme";
- if (method_exists($helper_class, $function)) {
+ if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
@@ -247,7 +247,7 @@ class Theme_View_Core extends Gallery_View {
}
$helper_class = theme::$site_theme_name . "_theme";
- if (method_exists($helper_class, $function)) {
+ if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
diff --git a/modules/gallery/tests/Html_Helper_Test.php b/modules/gallery/tests/Html_Helper_Test.php
index 476faa5a..4643e6fd 100644
--- a/modules/gallery/tests/Html_Helper_Test.php
+++ b/modules/gallery/tests/Html_Helper_Test.php
@@ -27,7 +27,7 @@ class Html_Helper_Test extends Gallery_Unit_Test_Case {
public function purify_test() {
$safe_string = html::purify("hello <p >world</p>");
- $expected = method_exists("purifier", "purify")
+ $expected = (class_exists("purifier") && method_exists("purifier", "purify"))
? "hello <p>world</p>"
: "hello &lt;p &gt;world&lt;/p&gt;";
$this->assert_equal($expected, $safe_string->unescaped());
diff --git a/modules/gallery/tests/SafeString_Test.php b/modules/gallery/tests/SafeString_Test.php
index 946410d4..dab7d7df 100644
--- a/modules/gallery/tests/SafeString_Test.php
+++ b/modules/gallery/tests/SafeString_Test.php
@@ -91,7 +91,7 @@ class SafeString_Test extends Gallery_Unit_Test_Case {
public function purify_test() {
$safe_string = SafeString::purify("hello <p >world</p>");
- $expected = method_exists("purifier", "purify")
+ $expected = (class_exists("purifier") && method_exists("purifier", "purify"))
? "hello <p>world</p>"
: "hello &lt;p &gt;world&lt;/p&gt;";
$this->assert_equal($expected, $safe_string);
@@ -100,7 +100,7 @@ class SafeString_Test extends Gallery_Unit_Test_Case {
public function purify_twice_test() {
$safe_string = SafeString::purify("hello <p >world</p>");
$safe_string_2 = SafeString::purify($safe_string);
- $expected = method_exists("purifier", "purify")
+ $expected = (class_exists("purifier") && method_exists("purifier", "purify"))
? "hello <p>world</p>"
: "hello &lt;p &gt;world&lt;/p&gt;";
$this->assert_equal($expected, $safe_string_2);