summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries
diff options
context:
space:
mode:
authorshadlaws <shad@shadlaws.com>2013-03-02 13:25:10 +0100
committershadlaws <shad@shadlaws.com>2013-03-02 13:25:10 +0100
commit9b9f1a7b07daecf2251770e4f49838f22cb58a2a (patch)
tree6d4306e8e9b4edbcba700a1910d6d0a03ce0edde /modules/gallery/libraries
parent0d05e91cd3c5050c25133c864f8b789f499d8e17 (diff)
#2031 - Add class_exists() before method_exists() if class existence is unknown.
- fixed all instances of this in core code - deleted previous Zend Guard Loader workaround in MY_Kohana.php - updated Bootstrap.php to reflect deleted MY_Kohana.php
Diffstat (limited to 'modules/gallery/libraries')
-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
5 files changed, 6 insertions, 50 deletions
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));