summaryrefslogtreecommitdiff
path: root/www-apps
diff options
context:
space:
mode:
authorMarcin Deranek <marcin.deranek@slonko.net>2017-06-11 09:39:59 +0200
committerMarcin Deranek <marcin.deranek@slonko.net>2017-06-11 09:40:05 +0200
commitb5ea462adfe66727c763543a677325909e29296b (patch)
treea887c14aed1f4009cc4c56e303284ce49f36f3bc /www-apps
parent2c867ff5f7b592f52d9f1a18292b6e5b2f4c1c99 (diff)
downloadportage-b5ea462adfe66727c763543a677325909e29296b.tar.gz
portage-b5ea462adfe66727c763543a677325909e29296b.tar.bz2
portage-b5ea462adfe66727c763543a677325909e29296b.zip
Support for PHP7 in gallery 2.3.2
Diffstat (limited to 'www-apps')
-rw-r--r--www-apps/gallery/Manifest4
-rw-r--r--www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch625
-rw-r--r--www-apps/gallery/files/0002-Adding-more-static-s-to-get-rid-of-PHP-7-warnings.patch179
-rw-r--r--www-apps/gallery/gallery-2.3.2.ebuild5
4 files changed, 812 insertions, 1 deletions
diff --git a/www-apps/gallery/Manifest b/www-apps/gallery/Manifest
index 3eeecff..f310ec2 100644
--- a/www-apps/gallery/Manifest
+++ b/www-apps/gallery/Manifest
@@ -1,3 +1,5 @@
+AUX 0001-Fixing-PHP-7-issues.patch 25316 SHA256 bb40eca032f6dfe55b5f044422d7856af12611415d2eb29f899877c3f9c05bb1 SHA512 309faa4a557961323f762d42167a4ae823ba4692364ae45c3c5f352fe3f20451f23e33f7ad390ae65dd2359ee3c6d47f5b025fd27120fed552700b1d2bb952d2 WHIRLPOOL 04f64fcc088b31877f19d82417937f94188093adb84770e5e0bbdb471506853d1993323b88f36fe7a8820eaa74a7ffabed6687ecc97b8a6c84e4b33f68e6006d
+AUX 0002-Adding-more-static-s-to-get-rid-of-PHP-7-warnings.patch 8226 SHA256 ebcf878926c4a0e2f590efdcc4f281492ebfa025362ca1122f6488b9f51995d4 SHA512 a7cd4ba4a4d12a0a9019b565e46878ab2081eb1fd7b4e3d78512cca9396888f7cce4e7e83a7094a22206b3712f247fe37592344b9db89c2f533c09bba37ae2c3 WHIRLPOOL 9c9df3f11ef2c901243b1d4d9f35976e9a3e68b504a3e0a4109352e9ec89c72c89c40ded300315cf057202d24f9a9e9d51a37626b174c65ea1d923fb7da50938
AUX postinstall-en2.txt 912 SHA256 ae1b0727e11518abf12616cd11cb82e6648a026769d9e4854ba6afb6d972c30b SHA512 fc66ccea1ef358b75ef0710a9a6b32e3b363d6588d70b69987041f46f5d04013d36113b3fca426f6a38d4d94e0ccfba637e56f91e41f62c492a8ad1fda64e408 WHIRLPOOL 8dfb2193c1ff6c500581950eb77afc1a41a1a5f1476fb0bb9a9180ea994119e20a5de1a1f7c9e1f5b89618ee130e4429ed1d02cb28acf7525dcd9155f5bec4fa
DIST gallery-2.3.2-full.tar.gz 14569436 SHA256 810ed73c456a3299ba50d9fcca6725d0654641c078c9d7c278d4875bad2af3fc SHA512 e4ee2007018ecdc6df2cb715798f57a94d2fcf5618a06812d704b45ba398cc9f52465d4ea1d830f2b99611c85d8853d7639059b3761f3b5d77ccc16d1e4ae0ad WHIRLPOOL 4591f8d69d173f01108fec5c21c7bde3f519c44177ef268866031e0c1cc021c452415b73950011e2f1cd46ee314d2741260bcd4ba80bdee56ca5b119a2452975
-EBUILD gallery-2.3.2.ebuild 1818 SHA256 9b485623a3510a09b696e1c5bc613e6054551f2fc1834fb3a4d749b0862a82e9 SHA512 73eb4c0b522e9cf71ef0e730c8759f7e221c9e7419ab2823ab62e95557bcd350485a0d60587a6adc18024bd6f46a2326e914e2ab7b96691fac9964ffa47928fb WHIRLPOOL f97d02129862955c11e7fcf992bb7436912d153bd137435d1c2bbfd4e6536a469a8d31ca751fda2c6151858a0f9a905a07f5b8c7778c499694eb87328c0c7a06
+EBUILD gallery-2.3.2.ebuild 1973 SHA256 ae7c7a134148456e0bef344e86ac4b228325ca147bf8afdc2d6d53350c2567bd SHA512 9cf0952ab9b74d2f868ef7774c6d9486df6ee1858f09f161d558b02bda3099e5ec862cab6218bf69ab8a0225b2e9ebcfbc54d88c94ee5747bacdd2891bd17d01 WHIRLPOOL 38f35975f31a215d5e97c8934c99ad1ee1daf30e016d24268937a0b296f390722d0cda9a1c2f53ec154748fba09b2e1e657e025771befd634b6c45b4dd8e4814
diff --git a/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch b/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch
new file mode 100644
index 0000000..43f047c
--- /dev/null
+++ b/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch
@@ -0,0 +1,625 @@
+From b180528e518ecd35c8f47e301db8d816f3ed480d Mon Sep 17 00:00:00 2001
+From: Greg Stoll <greg@gregstoll.com>
+Date: Tue, 28 Mar 2017 15:17:53 -0500
+Subject: [PATCH 1/2] Fixing PHP 7 issues
+
+The real fixes are replacing uses of preg_replace with the 'e' mode with
+preg_replace_callback and the change to
+modules/core/clases/GalleryStorage/GalleryStorageExtras to add {}. The
+rest is just declaring functions static to avoid noisy warning messages,
+but there are plenty more that could be added.
+---
+ .gitignore | 3 ++
+ lib/adodb/adodb-time.inc.php | 1 -
+ lib/adodb/adodb.inc.php | 2 +-
+ lib/bbcode/stringparser.class.php | 2 +-
+ lib/smarty/Smarty_Compiler.class.php | 12 ++++-
+ lib/support/GallerySetupUtilities.class | 26 +++++-----
+ modules/core/classes/GalleryCoreApi.class | 16 +++---
+ modules/core/classes/GalleryDataCache.class | 16 +++---
+ .../GalleryStorage/GalleryStorageExtras.class | 2 +-
+ modules/core/classes/GalleryUtilities.class | 59 ++++++++++++----------
+ 10 files changed, 77 insertions(+), 62 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..3503017
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,3 @@
++config.php
++login.txt
++*.swp
+diff --git a/lib/adodb/adodb-time.inc.php b/lib/adodb/adodb-time.inc.php
+index 575578c..eb6c415 100644
+--- a/lib/adodb/adodb-time.inc.php
++++ b/lib/adodb/adodb-time.inc.php
+@@ -1006,7 +1006,6 @@ function adodb_tz_offset($gmt,$isphp5)
+ return sprintf('%s%02d%02d',($gmt<=0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60);
+ else
+ return sprintf('%s%02d%02d',($gmt<0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60);
+- break;
+ }
+
+
+diff --git a/lib/adodb/adodb.inc.php b/lib/adodb/adodb.inc.php
+index 092e46e..2ff4486 100644
+--- a/lib/adodb/adodb.inc.php
++++ b/lib/adodb/adodb.inc.php
+@@ -373,7 +373,7 @@
+ * All error messages go through this bottleneck function.
+ * You can define your own handler by defining the function name in ADODB_OUTP.
+ */
+- function outp($msg,$newline=true)
++ static function outp($msg,$newline=true)
+ {
+ global $ADODB_FLUSH,$ADODB_OUTP;
+
+diff --git a/lib/bbcode/stringparser.class.php b/lib/bbcode/stringparser.class.php
+index 46f78f3..b0a0619 100644
+--- a/lib/bbcode/stringparser.class.php
++++ b/lib/bbcode/stringparser.class.php
+@@ -1248,7 +1248,7 @@ class StringParser_Node {
+ * @param object $node The node to destroy
+ * @return bool True on success, else false.
+ */
+- function destroyNode (&$node) {
++ static function destroyNode (&$node) {
+ if ($node === null) {
+ return false;
+ }
+diff --git a/lib/smarty/Smarty_Compiler.class.php b/lib/smarty/Smarty_Compiler.class.php
+index f09f8de..a62c624 100644
+--- a/lib/smarty/Smarty_Compiler.class.php
++++ b/lib/smarty/Smarty_Compiler.class.php
+@@ -262,12 +262,20 @@ class Smarty_Compiler extends Smarty {
+ reset($this->_folded_blocks);
+
+ /* replace special blocks by "{php}" */
+- $source_content = preg_replace($search.'e', "'"
++ $source_content = preg_replace_callback($search,
++ function($matches) {
++ return $this->_quote_replace($this->left_delimiter) . 'php'
++ . str_repeat("\n", substr_count($matches[0], "\n"))
++ . $this->_quote_replace($this->right_delimiter);
++ }
++ , $source_content);
++
++ /*$source_content = preg_replace($search.'e', "'"
+ . $this->_quote_replace($this->left_delimiter) . 'php'
+ . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
+ . $this->_quote_replace($this->right_delimiter)
+ . "'"
+- , $source_content);
++ , $source_content);*/
+
+ /* Gather all template tags. */
+ preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
+diff --git a/lib/support/GallerySetupUtilities.class b/lib/support/GallerySetupUtilities.class
+index 6a6da7b..4f8cc7e 100644
+--- a/lib/support/GallerySetupUtilities.class
++++ b/lib/support/GallerySetupUtilities.class
+@@ -54,7 +54,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function regenerateSession() {
++ static function regenerateSession() {
+ /* 1. Generate a new session id */
+ $newSessionId = md5(uniqid(substr(rand() . serialize($_REQUEST), 0, 114)));
+ $sessionData = array();
+@@ -84,7 +84,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function areCookiesSupported() {
++ static function areCookiesSupported() {
+ static $areCookiesSupported;
+
+ /* Remember the state since we might unset $_COOKIE */
+@@ -101,7 +101,7 @@ class GallerySetupUtilities {
+ * @return int the number of attempts or false if there was an error
+ * @static
+ */
+- function getLoginAttempts() {
++ static function getLoginAttempts() {
+ /* Init if needed (like from lib/support; upgrader already init'ed) */
+ global $gallery;
+ if (!isset($gallery)) {
+@@ -139,7 +139,7 @@ class GallerySetupUtilities {
+ * @return true on success, false on error
+ * @static
+ */
+- function setLoginAttempts($attempts) {
++ static function setLoginAttempts($attempts) {
+ /* Init if needed (like from lib/support; upgrader already init'ed) */
+ global $gallery;
+ if (!isset($gallery)) {
+@@ -182,7 +182,7 @@ class GallerySetupUtilities {
+ * @param bool $updateDatabase true if you want to also reset the login attempts (default: true)
+ * @static
+ */
+- function authenticateThisSession($resetLoginAttempts=true) {
++ static function authenticateThisSession($resetLoginAttempts=true) {
+ $_SESSION['authenticated'] = true;
+ if ($resetLoginAttempts) {
+ GallerySetupUtilities::setLoginAttempts(0);
+@@ -196,7 +196,7 @@ class GallerySetupUtilities {
+ * @return true if this session is authenticated
+ * @static
+ */
+- function isSessionAuthenticated() {
++ static function isSessionAuthenticated() {
+ return !empty($_SESSION['authenticated']);
+ }
+
+@@ -205,7 +205,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function redirectBackToSelf() {
++ static function redirectBackToSelf() {
+ require_once(dirname(__FILE__) . '/../../modules/core/classes/GalleryUrlGenerator.class');
+ $urlGenerator = new GalleryUrlGenerator();
+ $url = $urlGenerator->getCurrentUrl();
+@@ -224,7 +224,7 @@ class GallerySetupUtilities {
+ * @return string the path to the config dir
+ * @static
+ */
+- function getConfigDir() {
++ static function getConfigDir() {
+ if (defined('GALLERY_CONFIG_DIR')) {
+ return GALLERY_CONFIG_DIR;
+ }
+@@ -237,7 +237,7 @@ class GallerySetupUtilities {
+ * @return array the config values from config.php
+ * @static
+ */
+- function getGalleryConfig() {
++ static function getGalleryConfig() {
+ $gallery = new GallerySetupUtilitiesStub();
+
+ /* Load config.php */
+@@ -256,7 +256,7 @@ class GallerySetupUtilities {
+ * @return string the authentication key
+ * @static
+ */
+- function getAuthenticationKey() {
++ static function getAuthenticationKey() {
+ return isset($_SESSION['authKey']) ? $_SESSION['authKey'] : null;
+ }
+
+@@ -265,7 +265,7 @@ class GallerySetupUtilities {
+ * @param string $key the authentication key
+ * @static
+ */
+- function setAuthenticationKey($key) {
++ static function setAuthenticationKey($key) {
+ $_SESSION['authKey'] = $key;
+ }
+
+@@ -274,7 +274,7 @@ class GallerySetupUtilities {
+ * @param string a random value
+ * @static
+ */
+- function generateAuthenticationKey() {
++ static function generateAuthenticationKey() {
+ for ($len = 64, $rand='';
+ strlen($rand) < $len;
+ $rand .= chr(!mt_rand(0,2) ? mt_rand(48,57) :
+@@ -308,7 +308,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function startSession() {
++ static function startSession() {
+ /* Set our own session name */
+ if (@ini_get('session.auto_start')) {
+ session_unset();
+diff --git a/modules/core/classes/GalleryCoreApi.class b/modules/core/classes/GalleryCoreApi.class
+index 6edcdf4..27d5b20 100644
+--- a/modules/core/classes/GalleryCoreApi.class
++++ b/modules/core/classes/GalleryCoreApi.class
+@@ -295,7 +295,7 @@ class GalleryCoreApi {
+ * @return array GalleryStatus a status code
+ * string a value
+ */
+- function getPluginParameter($pluginType, $pluginId, $parameterName, $itemId=0) {
++ static function getPluginParameter($pluginType, $pluginId, $parameterName, $itemId=0) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+ return GalleryPluginHelper_simple::getParameter($pluginType, $pluginId,
+@@ -363,7 +363,7 @@ class GalleryCoreApi {
+ * 'requiredModuleApi' => array,
+ * 'version' => string)
+ */
+- function fetchPluginStatus($pluginType, $ignoreCache=false) {
++ static function fetchPluginStatus($pluginType, $ignoreCache=false) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+ return GalleryPluginHelper_simple::fetchPluginStatus($pluginType, $ignoreCache);
+@@ -376,7 +376,7 @@ class GalleryCoreApi {
+ * @return array GalleryStatus a status code
+ * array of (pluginId => ('active' => boolean))
+ */
+- function fetchPluginList($pluginType) {
++ static function fetchPluginList($pluginType) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+ return GalleryPluginHelper_simple::fetchPluginList($pluginType);
+@@ -2355,7 +2355,7 @@ class GalleryCoreApi {
+ * mixed one GalleryEntity or an array of GalleryEntities
+ * @deprecated $requiredEntityType will no longer be optional after the next major API change
+ */
+- function loadEntitiesById($ids, $requiredEntityType=null) {
++ static function loadEntitiesById($ids, $requiredEntityType=null) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryEntityHelper_simple.class');
+ return GalleryEntityHelper_simple::loadEntitiesById($ids, $requiredEntityType);
+@@ -2708,7 +2708,7 @@ class GalleryCoreApi {
+ * @param string $sourceEncoding source encoding (eg. 'ISO-8859-1'), defaults to system charset
+ * @return string the result
+ */
+- function convertToUtf8($inputString, $sourceEncoding=null) {
++ static function convertToUtf8($inputString, $sourceEncoding=null) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryCharsetHelper_simple.class');
+ return GalleryCharsetHelper_simple::convertToUtf8($inputString, $sourceEncoding);
+@@ -2734,7 +2734,7 @@ class GalleryCoreApi {
+ * @param int $length the length of the substring, not optional
+ * @return string a multibyte safe substring of input value
+ */
+- function utf8Substring($string, $start, $length) {
++ static function utf8Substring($string, $start, $length) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryCharsetHelper_simple.class');
+ return GalleryCharsetHelper_simple::utf8Substring($string, $start, $length);
+@@ -2747,7 +2747,7 @@ class GalleryCoreApi {
+ * @param int $length the length in bytes (not in characters), not optional
+ * @return string a multibyte safe substring of input value
+ */
+- function utf8Strcut($string, $start, $length) {
++ static function utf8Strcut($string, $start, $length) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryCharsetHelper_simple.class');
+ return GalleryCharsetHelper_simple::utf8Strcut($string, $start, $length);
+@@ -2817,7 +2817,7 @@ class GalleryCoreApi {
+ * @param string $file
+ * @param boolean $skipBaseDirectoryDetection deprecated
+ */
+- function requireOnce($file, $skipBaseDirectoryDetection=false) {
++ static function requireOnce($file, $skipBaseDirectoryDetection=false) {
+ static $loaded;
+ if (!isset($loaded[$file])) {
+ $loaded[$file] = 1;
+diff --git a/modules/core/classes/GalleryDataCache.class b/modules/core/classes/GalleryDataCache.class
+index 07f26f4..dd6d5ec 100644
+--- a/modules/core/classes/GalleryDataCache.class
++++ b/modules/core/classes/GalleryDataCache.class
+@@ -40,7 +40,7 @@ class GalleryDataCache {
+ * @staticvar cache the singleton cache
+ * @access private
+ */
+- function &_getCache() {
++ static function &_getCache() {
+ static $cache;
+ if (!isset($cache)) {
+ $cache['maxKeys'] = 800;
+@@ -81,7 +81,7 @@ class GalleryDataCache {
+ * @param mixed $data
+ * @param boolean $protected should this key survive a reset call?
+ */
+- function put($key, $data, $protected=false) {
++ static function put($key, $data, $protected=false) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['memoryCacheEnabled']) {
+ return;
+@@ -182,7 +182,7 @@ class GalleryDataCache {
+ * @param string $key
+ * @return mixed the cached data
+ */
+- function get($key) {
++ static function get($key) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['memoryCacheEnabled']) {
+ return null;
+@@ -199,7 +199,7 @@ class GalleryDataCache {
+ * @param string $key
+ * @return boolean true if the cache contains the key given
+ */
+- function containsKey($key) {
++ static function containsKey($key) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['memoryCacheEnabled']) {
+ return false;
+@@ -268,7 +268,7 @@ class GalleryDataCache {
+ * @param array $pathInfo the path info
+ * @return mixed object data
+ */
+- function &getFromDisk($pathInfo) {
++ static function &getFromDisk($pathInfo) {
+ $null = null;
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['fileCacheEnabled']) {
+@@ -341,7 +341,7 @@ class GalleryDataCache {
+ * @param array $requiredClasses classes that must be loaded in order to retrieve this data
+ * @see GalleryDataCache::getCachePath
+ */
+- function putToDisk($pathInfo, &$data, $requiredClasses=array()) {
++ static function putToDisk($pathInfo, &$data, $requiredClasses=array()) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['fileCacheEnabled']) {
+ return;
+@@ -373,7 +373,7 @@ class GalleryDataCache {
+ * @param int $id
+ * @return array the tuple
+ */
+- function getCacheTuple($id) {
++ static function getCacheTuple($id) {
+ $id = "$id";
+ if ($id > 100) {
+ return array($id[0], $id[1]);
+@@ -395,7 +395,7 @@ class GalleryDataCache {
+ *
+ * @return string the path
+ */
+- function getCachePath($pathInfo) {
++ static function getCachePath($pathInfo) {
+ global $gallery;
+
+ $base = $gallery->getConfig('data.gallery.cache');
+diff --git a/modules/core/classes/GalleryStorage/GalleryStorageExtras.class b/modules/core/classes/GalleryStorage/GalleryStorageExtras.class
+index 9a12ecd..9214b8c 100644
+--- a/modules/core/classes/GalleryStorage/GalleryStorageExtras.class
++++ b/modules/core/classes/GalleryStorage/GalleryStorageExtras.class
+@@ -190,7 +190,7 @@ class GalleryStorageExtras /* the other half of GalleryStorage */ {
+ $value = $this->_gs->_normalizeValue($row[$i], $memberData[$i], true);
+
+ /* Store the value in the object */
+- $entity->$callbacks[$i] = $value;
++ $entity->{$callbacks[$i]} = $value;
+ $entity->_persistentStatus['originalValue'][$callbacks[$i]] = $value;
+ }
+
+diff --git a/modules/core/classes/GalleryUtilities.class b/modules/core/classes/GalleryUtilities.class
+index 0e394fa..eeae67d 100644
+--- a/modules/core/classes/GalleryUtilities.class
++++ b/modules/core/classes/GalleryUtilities.class
+@@ -43,7 +43,7 @@ class GalleryUtilities {
+ * @param string $filename
+ * @return array the file basename, the file extension
+ */
+- function getFileNameComponents($filename) {
++ static function getFileNameComponents($filename) {
+
+ $pos = strrpos($filename, '.');
+
+@@ -69,7 +69,7 @@ class GalleryUtilities {
+ * @param string $filename
+ * @return array the file extension
+ */
+- function getFileExtension($filename) {
++ static function getFileExtension($filename) {
+ list ($base, $extension) = GalleryUtilities::getFileNameComponents($filename);
+ return $extension;
+ }
+@@ -81,7 +81,7 @@ class GalleryUtilities {
+ * @param string $filename
+ * @return array the file base
+ */
+- function getFileBase($filename) {
++ static function getFileBase($filename) {
+ list ($base, $extension) = GalleryUtilities::getFileNameComponents($filename);
+ return $base;
+ }
+@@ -92,7 +92,7 @@ class GalleryUtilities {
+ * @param boolean $prefix (optional) false to omit Gallery variable prefix (not recommended)
+ * @return array file data
+ */
+- function getFile($key, $prefix=true) {
++ static function getFile($key, $prefix=true) {
+ $file = array();
+ if ($prefix) {
+ $key = GALLERY_FORM_VARIABLE_PREFIX . $key;
+@@ -235,7 +235,7 @@ class GalleryUtilities {
+ * @param one or more string parameters
+ * @return mixed a single string value or many values
+ */
+- function getRequestVariables() {
++ static function getRequestVariables() {
+ $values = array();
+ foreach (func_get_args() as $argName) {
+ $values[] = GalleryUtilities::_getRequestVariable(
+@@ -255,7 +255,7 @@ class GalleryUtilities {
+ * Return all request variables with the Gallery variable prefix.
+ * @return array request variable name => value
+ */
+- function getAllRequestVariables() {
++ static function getAllRequestVariables() {
+ $values = array();
+ $prefixLength = strlen(GALLERY_FORM_VARIABLE_PREFIX);
+ foreach ($_POST as $key => $value) {
+@@ -283,7 +283,7 @@ class GalleryUtilities {
+ * @param one or more string parameters
+ * @return mixed a single string value or many values
+ */
+- function getRequestVariablesNoPrefix() {
++ static function getRequestVariablesNoPrefix() {
+ $values = array();
+ foreach (func_get_args() as $argName) {
+ $values[] = GalleryUtilities::_getRequestVariable($argName);
+@@ -304,7 +304,7 @@ class GalleryUtilities {
+ * @param string $value
+ * @param boolean $prefix (optional) false to omit Gallery variable prefix (not recommended)
+ */
+- function putRequestVariable($key, $value, $prefix=true) {
++ static function putRequestVariable($key, $value, $prefix=true) {
+ if ($prefix) {
+ $key = GALLERY_FORM_VARIABLE_PREFIX . $key;
+ }
+@@ -373,7 +373,7 @@ class GalleryUtilities {
+ * @param array $array the source
+ * @access private
+ */
+- function _internalRemoveRequestVariable($keyPath, &$array) {
++ static function _internalRemoveRequestVariable($keyPath, &$array) {
+ $key = array_shift($keyPath);
+ while (!empty($keyPath)) {
+ if (empty($array[$key])) {
+@@ -401,7 +401,7 @@ class GalleryUtilities {
+ * @param int $count the number of markers to return
+ * @return string
+ */
+- function makeMarkers($count, $markerFragment='?') {
++ static function makeMarkers($count, $markerFragment='?') {
+ if (is_array($count)) {
+ $count = count($count);
+ }
+@@ -427,7 +427,7 @@ class GalleryUtilities {
+ * @param array $options (optional) options to pass to UrlGenerator
+ * @return string a URL
+ */
+- function convertPathToUrl($path, $options=array()) {
++ static function convertPathToUrl($path, $options=array()) {
+ global $gallery;
+ $platform =& $gallery->getPlatform();
+ $dirbase = $platform->realpath(dirname(__FILE__) . '/../../..') . '/';
+@@ -458,7 +458,7 @@ class GalleryUtilities {
+ * @param int $targetHeight (optional) target height, defaults to same as width
+ * @return array(width, height)
+ */
+- function shrinkDimensionsToFit($width, $height, $targetWidth, $targetHeight=null) {
++ static function shrinkDimensionsToFit($width, $height, $targetWidth, $targetHeight=null) {
+ if (!isset($targetHeight)) {
+ $targetHeight = $targetWidth;
+ }
+@@ -499,7 +499,7 @@ class GalleryUtilities {
+ * @param int $precision defaults to zero
+ * @return string rounded value
+ */
+- function roundToString($floatValue, $precision=0) {
++ static function roundToString($floatValue, $precision=0) {
+ return str_replace(',', '.', round($floatValue, $precision));
+ }
+
+@@ -701,7 +701,7 @@ class GalleryUtilities {
+ * @param boolean $adaptForMagicQuotes (optional) false to skip undoing the damage caused
+ * by magic_quotes
+ */
+- function sanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
++ static function sanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
+ if (is_array($value)) {
+ foreach (array_keys($value) as $key) {
+ $newKey = $key;
+@@ -739,7 +739,7 @@ class GalleryUtilities {
+ * @param boolean $adaptForMagicQuotes (optional) false to skip redoing the damage caused
+ * by magic_quotes
+ */
+- function unsanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
++ static function unsanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
+ if (is_array($value)) {
+ foreach (array_keys($value) as $key) {
+ GalleryUtilities::unsanitizeInputValues($value[$key], $adaptForMagicQuotes);
+@@ -763,9 +763,14 @@ class GalleryUtilities {
+ * @param string $string the input string with UTF-8 entities
+ * @return string the UTF-8 string
+ */
+- function unicodeEntitiesToUtf8($string) {
+- $string = preg_replace('/&#([xa-f\d]+);/mei',
+- "GalleryUtilities::unicodeValueToUtf8Value('\\1')", $string);
++ static function unicodeEntitiesToUtf8($string) {
++ $string = preg_replace_callback('/&#([xa-f\d]+);/mi',
++ function($matches) {
++ return GalleryUtilities::unicodeValueToUtf8Value($matches[1]);
++ }
++ , $string);
++ /*$string = preg_replace('/&#([xa-f\d]+);/mei',
++ "GalleryUtilities::unicodeValueToUtf8Value('\\1')", $string);*/
+ return $string;
+ }
+
+@@ -777,7 +782,7 @@ class GalleryUtilities {
+ * @return string a multibyte safe substring of input value
+ * @deprecated Please use GalleryCoreApi::utf8Substring instead
+ */
+- function utf8Substring($string, $start, $length) {
++ static function utf8Substring($string, $start, $length) {
+ return GalleryCoreApi::utf8Substring($string, $start, $length);
+ }
+
+@@ -788,7 +793,7 @@ class GalleryUtilities {
+ * @param int $num the unicode value
+ * @return string the UTF-8 string
+ */
+- function unicodeValueToUtf8Value($num) {
++ static function unicodeValueToUtf8Value($num) {
+ if ($num[0] == 'x') {
+ /* Convert hex to decimal */
+ $num = hexdec(substr($num, 1));
+@@ -870,7 +875,7 @@ class GalleryUtilities {
+ * @return string a single value
+ * @access private
+ */
+- function _getRequestVariable($key) {
++ static function _getRequestVariable($key) {
+ $keyPath = preg_split('/[\[\]]/', $key, -1, PREG_SPLIT_NO_EMPTY);
+ $result = GalleryUtilities::_internalGetRequestVariable($keyPath, $_GET);
+ if (isset($result)) {
+@@ -889,7 +894,7 @@ class GalleryUtilities {
+ * @return the value or null if it does not exist
+ * @access private
+ */
+- function _internalGetRequestVariable($keyPath, $array) {
++ static function _internalGetRequestVariable($keyPath, $array) {
+ $key = array_shift($keyPath);
+ while (!empty($keyPath)) {
+ if (!isset($array[$key])) {
+@@ -1001,7 +1006,7 @@ class GalleryUtilities {
+ * Return the address of the remote host.
+ * @return string the remote host address (or null)
+ */
+- function getRemoteHostAddress() {
++ static function getRemoteHostAddress() {
+ $addr = null;
+ if (isset($_SERVER['REMOTE_ADDR'])) {
+ $addr = $_SERVER['REMOTE_ADDR'];
+@@ -1399,7 +1404,7 @@ class GalleryUtilities {
+ * @param string $key the key in the _SERVER superglobal
+ * @return string the value
+ */
+- function getServerVar($key) {
++ static function getServerVar($key) {
+ if (!isset($_SERVER[$key])) {
+ return null;
+ }
+@@ -1432,7 +1437,7 @@ class GalleryUtilities {
+ * @see Gallery::isEmbedded
+ * @deprecated
+ */
+- function isEmbedded() {
++ static function isEmbedded() {
+ global $gallery;
+ return $gallery->isEmbedded();
+ }
+@@ -1617,7 +1622,7 @@ class GalleryUtilities {
+ * @param string $string
+ * @return string lowercase version of the string
+ */
+- function strToLower($string) {
++ static function strToLower($string) {
+ return strtr($string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
+ }
+
+@@ -1626,7 +1631,7 @@ class GalleryUtilities {
+ * @param string $string
+ * @return string uppercase version of the string
+ */
+- function strToUpper($string) {
++ static function strToUpper($string) {
+ return strtr($string, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
+ }
+
+--
+2.13.1
+
diff --git a/www-apps/gallery/files/0002-Adding-more-static-s-to-get-rid-of-PHP-7-warnings.patch b/www-apps/gallery/files/0002-Adding-more-static-s-to-get-rid-of-PHP-7-warnings.patch
new file mode 100644
index 0000000..2c95ea1
--- /dev/null
+++ b/www-apps/gallery/files/0002-Adding-more-static-s-to-get-rid-of-PHP-7-warnings.patch
@@ -0,0 +1,179 @@
+From 046cf868770c79156d9dd8af070ac894a0eca0e6 Mon Sep 17 00:00:00 2001
+From: Greg Stoll <greg@gregstoll.com>
+Date: Sun, 2 Apr 2017 16:07:20 -0500
+Subject: [PATCH 2/2] Adding more "static"s to get rid of PHP 7 warnings
+
+---
+ modules/core/classes/GalleryCoreApi.class | 8 ++++----
+ modules/core/classes/GalleryUtilities.class | 20 ++++++++++----------
+ .../classes/helpers/GalleryPluginHelper_simple.class | 6 +++---
+ 3 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/modules/core/classes/GalleryCoreApi.class b/modules/core/classes/GalleryCoreApi.class
+index 27d5b20..f2d6e83 100644
+--- a/modules/core/classes/GalleryCoreApi.class
++++ b/modules/core/classes/GalleryCoreApi.class
+@@ -265,7 +265,7 @@ class GalleryCoreApi {
+ * @return array GalleryStatus a status code
+ * object the plugin
+ */
+- function loadPlugin($pluginType, $pluginId, $ignoreVersionMismatch=false,
++ static function loadPlugin($pluginType, $pluginId, $ignoreVersionMismatch=false,
+ $errorOnVersionMismatch=false) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+@@ -2857,7 +2857,7 @@ class GalleryCoreApi {
+ * @param string $errorMessage
+ * @return GalleryStatus an error status
+ */
+- function error($errorCode, $fileName='ignored', $lineNumber='ignored', $errorMessage=null) {
++ static function error($errorCode, $fileName='ignored', $lineNumber='ignored', $errorMessage=null) {
+ GalleryCoreApi::requireOnce('modules/core/classes/GalleryStatus.class');
+ $status = new GalleryStatus(GALLERY_ERROR | $errorCode, $errorMessage);
+ $status->setStackTrace(debug_backtrace());
+@@ -2901,7 +2901,7 @@ class GalleryCoreApi {
+ * @return array GalleryStatus a status code
+ * array the results
+ */
+- function getMapEntry($mapName, $select, $match=array(), $optional=array()) {
++ static function getMapEntry($mapName, $select, $match=array(), $optional=array()) {
+ global $gallery;
+
+ if (empty($mapName) || empty($select) || !is_array($match) || !is_array($optional)) {
+@@ -3268,7 +3268,7 @@ class GalleryCoreApi {
+ * @return string local path to the Gallery code base. If the optional parameter has not been
+ * supplied the return value will have the trailing slash appended.
+ */
+- function getCodeBasePath($relativePath=null) {
++ static function getCodeBasePath($relativePath=null) {
+ static $codeBaseDirectory;
+ if (!isset($codeBaseDirectory)) {
+ $codeBaseDirectory = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR;
+diff --git a/modules/core/classes/GalleryUtilities.class b/modules/core/classes/GalleryUtilities.class
+index eeae67d..486a160 100644
+--- a/modules/core/classes/GalleryUtilities.class
++++ b/modules/core/classes/GalleryUtilities.class
+@@ -392,7 +392,7 @@ class GalleryUtilities {
+ * @param string $key form variable name
+ * @return string prefixed form variable name
+ */
+- function prefixFormVariable($key) {
++ static function prefixFormVariable($key) {
+ return GALLERY_FORM_VARIABLE_PREFIX . $key;
+ }
+
+@@ -525,7 +525,7 @@ class GalleryUtilities {
+ * @param string $className
+ * @return boolean
+ */
+- function isA($instance, $className) {
++ static function isA($instance, $className) {
+ return is_a($instance, $className);
+ }
+
+@@ -554,7 +554,7 @@ class GalleryUtilities {
+ * @return array int the number of entities in the string
+ * string the output string
+ */
+- function entitySubstr($string, $start, $length=null, $countEntitiesAsOne=true) {
++ static function entitySubstr($string, $start, $length=null, $countEntitiesAsOne=true) {
+ $stringLength = strlen($string);
+ if ($stringLength < $start) {
+ return array(0, false);
+@@ -618,7 +618,7 @@ class GalleryUtilities {
+ * @param string $source encoded using UTF-8
+ * @return string of unicode entities
+ */
+- function utf8ToUnicodeEntities($source) {
++ static function utf8ToUnicodeEntities($source) {
+ /*
+ * Array used to figure what number to decrement from character order value according to
+ * number of characters used to map unicode to ASCII by UTF-8
+@@ -831,7 +831,7 @@ class GalleryUtilities {
+ * @deprecated
+ * @todo Remove at the next major version bump of core API
+ */
+- function htmlEntityDecode($string) {
++ static function htmlEntityDecode($string) {
+ return empty($string) ? $string : html_entity_decode($string, ENT_COMPAT);
+ }
+
+@@ -841,7 +841,7 @@ class GalleryUtilities {
+ * @param string $markupType (optional) markup type, defaults from core markup parameter
+ * @return string resulting text
+ */
+- function markup($text, $markupType=null) {
++ static function markup($text, $markupType=null) {
+ GalleryCoreApi::requireOnce('lib/smarty_plugins/modifier.markup.php');
+ return smarty_modifier_markup($text, $markupType);
+ }
+@@ -1141,7 +1141,7 @@ class GalleryUtilities {
+ * @return array GalleryStatus a status code
+ * string pseudoFileName a filename
+ */
+- function getPseudoFileName($entity) {
++ static function getPseudoFileName($entity) {
+ /*
+ * If our GalleryEntity is a GalleryFileSystemEntity, then we've got a path component so
+ * we're cool. If it's a derivative, then get the pseudo filename of its parent and use
+@@ -1314,7 +1314,7 @@ class GalleryUtilities {
+ * @param array $provided (major, minor)
+ * @return boolean true if compatible
+ */
+- function isCompatibleWithApi($required, $provided) {
++ static function isCompatibleWithApi($required, $provided) {
+ if (!is_array($required) || !is_array($provided)) {
+ return false;
+ }
+@@ -1475,7 +1475,7 @@ class GalleryUtilities {
+ * @param boolean $force force the reevaluation of the HTTP header string Cookie
+ * @param boolean $unset unset static variable for testability
+ */
+- function fixCookieVars($force=false, $unset=false) {
++ static function fixCookieVars($force=false, $unset=false) {
+ static $fixed;
+ if (!isset($fixed) || $force) {
+ $fixed = true;
+@@ -1568,7 +1568,7 @@ class GalleryUtilities {
+ * @param array $fixedCookies (string already registered cookie name, ...)
+ * @access private
+ */
+- function _registerCookieAttr($attr, &$fixedCookies) {
++ static function _registerCookieAttr($attr, &$fixedCookies) {
+ global $gallery;
+ /* Split NAME [=VALUE], value is optional for all attributes but the cookie name */
+ if (($pos = strpos($attr, '=')) !== false) {
+diff --git a/modules/core/classes/helpers/GalleryPluginHelper_simple.class b/modules/core/classes/helpers/GalleryPluginHelper_simple.class
+index f6654c6..e873921 100644
+--- a/modules/core/classes/helpers/GalleryPluginHelper_simple.class
++++ b/modules/core/classes/helpers/GalleryPluginHelper_simple.class
+@@ -32,7 +32,7 @@ class GalleryPluginHelper_simple {
+ * @see GalleryCoreApi::loadPlugin
+ * @param int $depth of recursion (don't set this; it's used internally)
+ */
+- function loadPlugin($pluginType, $pluginId, $ignoreVersionMismatch=false,
++ static function loadPlugin($pluginType, $pluginId, $ignoreVersionMismatch=false,
+ $errorOnVersionMismatch=false, $depth=0) {
+ global $gallery;
+
+@@ -205,7 +205,7 @@ class GalleryPluginHelper_simple {
+ /**
+ * @see GalleryCoreApi::getPluginParameter
+ */
+- function getParameter($pluginType, $pluginId, $parameterName, $itemId=0,
++ static function getParameter($pluginType, $pluginId, $parameterName, $itemId=0,
+ $ignoreDiskCache=false) {
+ global $gallery;
+
+@@ -259,7 +259,7 @@ class GalleryPluginHelper_simple {
+ * array (itemId/zero => array(parameterName => parameterValue), ..)
+ * @access protected
+ */
+- function _fetchAllParameters($pluginType, $pluginId, $itemId, $ignoreDiskCache=false) {
++ static function _fetchAllParameters($pluginType, $pluginId, $itemId, $ignoreDiskCache=false) {
+ global $gallery;
+ if (empty($pluginType) || empty($pluginId)) {
+ return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__,
+--
+2.13.1
+
diff --git a/www-apps/gallery/gallery-2.3.2.ebuild b/www-apps/gallery/gallery-2.3.2.ebuild
index 05c84a2..7d3a730 100644
--- a/www-apps/gallery/gallery-2.3.2.ebuild
+++ b/www-apps/gallery/gallery-2.3.2.ebuild
@@ -35,6 +35,11 @@ pkg_setup() {
confutils_require_any mysql postgres sqlite
}
+src_prepare() {
+ epatch "${FILESDIR}/0001-Fixing-PHP-7-issues.patch"
+ epatch "${FILESDIR}/0002-Adding-more-static-s-to-get-rid-of-PHP-7-warnings.patch"
+}
+
src_install() {
webapp_src_preinst