diff -uNr gallery2/Makefile gallery2-php7/Makefile --- gallery2/Makefile 2019-01-20 09:31:59.000000000 +1300 +++ gallery2-php7/Makefile 2020-04-18 11:11:39.522806000 +1200 @@ -3,7 +3,7 @@ PORTNAME= gallery2 PORTVERSION= 2.3.2 -PORTREVISION= 10 +PORTREVISION= 11 CATEGORIES= www MASTER_SITES= SF/gallery/${PORTNAME}/${PORTVERSION} DISTNAME= gallery-${PORTVERSION}-full diff -uNr gallery2/files/patch-gregstoll-046cf868 gallery2-php7/files/patch-gregstoll-046cf868 --- gallery2/files/patch-gregstoll-046cf868 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-046cf868 2019-05-20 11:48:56.000000000 +1200 @@ -0,0 +1,161 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/046cf868770c79156d9dd8af070ac894a0eca0e6 + +--- modules/core/classes/GalleryCoreApi.class ++++ 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; +--- modules/core/classes/GalleryUtilities.class ++++ 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) { +--- modules/core/classes/helpers/GalleryPluginHelper_simple.class ++++ 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__, diff -uNr gallery2/files/patch-gregstoll-4d7f661d gallery2-php7/files/patch-gregstoll-4d7f661d --- gallery2/files/patch-gregstoll-4d7f661d 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-4d7f661d 2019-05-20 13:50:59.899954000 +1200 @@ -0,0 +1,637 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/4d7f661d0f9aaef6a4a9bab464b961ec413a0bc7 + +--- lib/support/chmod.php ++++ lib/support/chmod.php +@@ -312,7 +312,7 @@ class PermissionBits { + * @return PermissionBits object + * @static + */ +- function fromString($bitsAsString) { ++ static function fromString($bitsAsString) { + $bitsAsString = (string)$bitsAsString; + if (strlen($bitsAsString) && $bitsAsString{0} != '0') { + $bitsAsString = '0' . $bitsAsString; +--- modules/captcha/CaptchaSiteAdmin.inc ++++ modules/captcha/CaptchaSiteAdmin.inc +@@ -172,7 +172,7 @@ class CaptchaAdminOption { + * array of string optionId => CaptchaAdminOption instance + * @static + */ +- function getAllOptions() { ++ static function getAllOptions() { + $testOptions = CaptchaAdminOption::testOptions(); + if (isset($testOptions)) { + return array(null, $testOptions); +@@ -203,7 +203,7 @@ class CaptchaAdminOption { + * @return null or array of string optionId => CaptchaAdminOption test instance + * @static + */ +- function testOptions($options=null) { ++ static function testOptions($options=null) { + static $testOptions = null; + if (isset($options)) { + $testOptions = $options; +--- modules/comment/classes/GalleryCommentHelper.class ++++ modules/comment/classes/GalleryCommentHelper.class +@@ -492,7 +492,7 @@ class GalleryCommentHelper /* implements GalleryEventListener */ { + * @param $enabled bool true to enable the listener, false to disable it + * @static + */ +- function setAkismetSaveListenerSwitch($enabled) { ++ static function setAkismetSaveListenerSwitch($enabled) { + $switch =& GalleryCommentHelper::getAkismetSaveListenerSwitch(); + $switch = $enabled; + } +@@ -502,7 +502,7 @@ class GalleryCommentHelper /* implements GalleryEventListener */ { + * @return bool the current status + * @static + */ +- function &getAkismetSaveListenerSwitch() { ++ static function &getAkismetSaveListenerSwitch() { + static $enabled = true; + return $enabled; + } +--- modules/core/CoreModuleExtras.inc ++++ modules/core/CoreModuleExtras.inc +@@ -2605,7 +2605,7 @@ class CoreModuleExtras { + * 'add' => array of string additions) + * @access private + */ +- function _prepareConfigUpgrade($currentVersion) { ++ static function _prepareConfigUpgrade($currentVersion) { + global $gallery; + $configChanges = array(); + +@@ -2941,7 +2941,7 @@ if (!isset($gallery) || !method_exists($gallery, \'setConfig\')) { + * @param string $currentVersion current core version + * @return boolean true if change is required + */ +- function isConfigUpgradeRequired($currentVersion) { ++ static function isConfigUpgradeRequired($currentVersion) { + $configChanges = CoreModuleExtras::_prepareConfigUpgrade($currentVersion); + return !empty($configChanges); + } +--- modules/core/ErrorPage.inc ++++ modules/core/ErrorPage.inc +@@ -129,7 +129,7 @@ class ErrorPageView extends GalleryView { + * not be considered an error. + * @static + */ +- function errorHandler($error, $g2Data=null, $initOk=null) { ++ static function errorHandler($error, $g2Data=null, $initOk=null) { + global $gallery; + $failsafe = false; + +--- modules/core/ItemAdd.inc ++++ modules/core/ItemAdd.inc +@@ -789,7 +789,7 @@ class ItemAddOption { + * array ItemAddOption instances + * @static + */ +- function getAllAddOptions() { ++ static function getAllAddOptions() { + /* Get all the option plugins */ + list ($ret, $allOptionIds) = + GalleryCoreApi::getAllFactoryImplementationIds('ItemAddOption'); +--- modules/core/ItemEdit.inc ++++ modules/core/ItemEdit.inc +@@ -471,7 +471,7 @@ class ItemEditOption { + * array ItemEditOption instances + * @static + */ +- function getAllOptions($editPlugin, $item, $thumbnail) { ++ static function getAllOptions($editPlugin, $item, $thumbnail) { + list ($ret, $allOptionIds) = + GalleryCoreApi::getAllFactoryImplementationIdsWithHint('ItemEditOption', $editPlugin); + if ($ret) { +--- modules/core/PluginCallback.inc ++++ modules/core/PluginCallback.inc +@@ -112,7 +112,7 @@ class PluginCallbackView extends GalleryView { + * @return array changed states (moduleId => state, ...) + * @static + */ +- function calculateStateChanges($beforeStates, $afterStates) { ++ static function calculateStateChanges($beforeStates, $afterStates) { + $states = array(); + $deleted = array(); + foreach (array('module', 'theme') as $type) { +@@ -135,7 +135,7 @@ class PluginCallbackView extends GalleryView { + * @return GalleryStatus a status code + * @static + */ +- function handleCallback($command, &$result) { ++ static function handleCallback($command, &$result) { + global $gallery; + $platform =& $gallery->getPlatform(); + +@@ -344,7 +344,7 @@ class PluginCallbackView extends GalleryView { + * array(moduleId => state, ...) + * @static + */ +- function getPluginStates() { ++ static function getPluginStates() { + $states = array(); + + foreach (array('module', 'theme') as $type) { +@@ -379,7 +379,7 @@ class PluginCallbackView extends GalleryView { + * string a state + * @static + */ +- function getPluginState($type, $plugin, $status) { ++ static function getPluginState($type, $plugin, $status) { + if ($type == 'module' && $plugin->getId() == 'core') { + return array(null, 'active'); + } +--- modules/core/classes/GalleryController.class ++++ modules/core/classes/GalleryController.class +@@ -116,7 +116,7 @@ class GalleryController { + * GalleryController a controller + * @static + */ +- function loadController($controllerName) { ++ static function loadController($controllerName) { + global $gallery; + + /* Continue to support old style : separator for a while */ +@@ -216,7 +216,7 @@ class GalleryController { + * @return GalleryStatus a status code null on success, ERROR_REQUEST_FORGED on failure + * @static + */ +- function assertIsGenuineRequest() { ++ static function assertIsGenuineRequest() { + global $gallery; + $session =& $gallery->getSession(); + +--- modules/core/classes/GalleryCoreApi.class ++++ modules/core/classes/GalleryCoreApi.class +@@ -475,7 +475,7 @@ class GalleryCoreApi { + * @param string $itemId (optional) + * @return GalleryStatus a status code + */ +- function setPluginParameter($pluginType, $pluginId, $parameterName, ++ static function setPluginParameter($pluginType, $pluginId, $parameterName, + $parameterValue, $itemId=0) { + GalleryCoreApi::requireOnce( + 'modules/core/classes/helpers/GalleryPluginHelper_medium.class'); +@@ -2874,7 +2874,7 @@ class GalleryCoreApi { + * non transactional database connection for this operation. Default is false. + * @return GalleryStatus a status code + */ +- function updateMapEntry($mapName, $match, $change, $useNonTransactionalConnection=false) { ++ static function updateMapEntry($mapName, $match, $change, $useNonTransactionalConnection=false) { + global $gallery; + + if (sizeof($match) == 0 || sizeof($change) == 0) { +--- modules/core/classes/GalleryDataCache.class ++++ modules/core/classes/GalleryDataCache.class +@@ -103,7 +103,7 @@ class GalleryDataCache { + * Remove data from the cache + * @param string $key + */ +- function remove($key) { ++ static function remove($key) { + $cache =& GalleryDataCache::_getCache(); + if (!$cache['memoryCacheEnabled']) { + return; +@@ -224,7 +224,7 @@ class GalleryDataCache { + * Empty the cache of all but protected entries + * @param boolean $purgeProtected (optional) purge protected also? + */ +- function reset($purgeProtected=false) { ++ static function reset($purgeProtected=false) { + $cache =& GalleryDataCache::_getCache(); + if (!$cache['memoryCacheEnabled']) { + return; +@@ -299,7 +299,7 @@ class GalleryDataCache { + * @see GalleryDataCache::getCachePath + * @param array $pathInfo the path info + */ +- function removeFromDisk($pathInfo) { ++ static function removeFromDisk($pathInfo) { + $cache =& GalleryDataCache::_getCache(); + if (!$cache['fileCacheEnabled']) { + return null; +--- modules/core/classes/GalleryRepository.class ++++ modules/core/classes/GalleryRepository.class +@@ -66,7 +66,7 @@ class GalleryRepository { + * int error count (repositories that failed to load for some reason) + * @static + */ +- function getRepositories($sources=array(), $repositoryClassName='GalleryRepository') { ++ static function getRepositories($sources=array(), $repositoryClassName='GalleryRepository') { + $cacheKey = 'GalleryRepository::getRepositories(' . join('|', $sources) . + ",$repositoryClassName)"; + if (!GalleryDataCache::containsKey($cacheKey)) { +@@ -106,7 +106,7 @@ class GalleryRepository { + * + * @static + */ +- function clearRepositoryCache($sources=array(), $repositoryClassName='GalleryRepository') { ++ static function clearRepositoryCache($sources=array(), $repositoryClassName='GalleryRepository') { + $cacheKey = 'GalleryRepository::getRepositories(' . join('|', $sources) . + ",$repositoryClassName)"; + GalleryDataCache::remove($cacheKey); +--- modules/core/classes/GallerySession.class ++++ modules/core/classes/GallerySession.class +@@ -1262,7 +1262,7 @@ class GallerySession { + * @return array + * @static + */ +- function getRemoteIdentifier() { ++ static function getRemoteIdentifier() { + $httpUserAgent = GalleryUtilities::getServerVar('HTTP_USER_AGENT'); + return array(GalleryUtilities::getRemoteHostAddress(), + isset($httpUserAgent) ? md5($httpUserAgent) : null); +--- modules/core/classes/GallerySortInterface_1_2.class ++++ modules/core/classes/GallerySortInterface_1_2.class +@@ -68,7 +68,7 @@ class GallerySortInterface_1_2 { + * array of orderDirection => localized name for direction + * @static + */ +- function getAllSortOrders($includeDefault=true) { ++ static function getAllSortOrders($includeDefault=true) { + list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'core'); + if ($ret) { + return array($ret, null, null, null); +--- modules/core/classes/GalleryStorage/GalleryStorageExtras.class ++++ modules/core/classes/GalleryStorage/GalleryStorageExtras.class +@@ -1185,7 +1185,7 @@ class GalleryStorageExtras /* the other half of GalleryStorage */ { + * @return array the parsed results + * @static + */ +- function parseSqlTemplate($sqlData, $dbType) { ++ static function parseSqlTemplate($sqlData, $dbType) { + $info = array('table' => array(), 'alter' => array(), + 'remove' => array(), 'test' => array()); + $dbname = $tablename = null; +--- modules/core/classes/GalleryTemplate.class ++++ modules/core/classes/GalleryTemplate.class +@@ -369,7 +369,7 @@ class GalleryTemplate { + * @return boolean false if the compiled templates should be used without any checking + * @static + */ +- function shouldDoCompileCheck() { ++ static function shouldDoCompileCheck() { + $cacheKey = 'GalleryTemplate::compileCheck'; + if (!GalleryDataCache::containsKey($cacheKey)) { + $compileCheck = (GalleryUtilities::getServerVar('HTTP_PRAGMA') == 'no-cache' +@@ -394,7 +394,7 @@ class GalleryTemplate { + * @return string processed tpl content ready for compilation + * @static + */ +- function preFilter($source, &$smarty) { ++ static function preFilter($source, &$smarty) { + return preg_replace('/^\s+/m', '', $source); + } + +--- modules/core/classes/GalleryToolkit.class ++++ modules/core/classes/GalleryToolkit.class +@@ -226,7 +226,7 @@ class GalleryToolkit { + * @param GalleryEntity $source (probably a GalleryPhotoItem or GalleryMovieItem) + * @static + */ +- function estimateDimensions(&$derivative, $source) { ++ static function estimateDimensions(&$derivative, $source) { + if (method_exists($source, 'getwidth') && method_exists($source, 'getheight')) { + $width = $source->getWidth(); + $height = $source->getHeight(); +--- modules/core/classes/GalleryTranslator.class ++++ modules/core/classes/GalleryTranslator.class +@@ -67,7 +67,7 @@ class GalleryTranslator { + * @return boolean + * @static + */ +- function canTranslate() { ++ static function canTranslate() { + return function_exists('dgettext'); + } + +@@ -76,7 +76,7 @@ class GalleryTranslator { + * @return boolean + * @static + */ +- function canTranslatePlural() { ++ static function canTranslatePlural() { + return function_exists('dngettext'); + } + +@@ -98,7 +98,7 @@ class GalleryTranslator { + * ...) + * @static + */ +- function getLanguageData() { ++ static function getLanguageData() { + static $supportedLanguages = array(); + static $defaultCountry = array(); + +@@ -277,7 +277,7 @@ class GalleryTranslator { + * array('description', 'right-to-left'?) + * @deprecated Remove on next major api bump. Use GalleryCoreApi::getSupportedLanguages + */ +- function getSupportedLanguages() { ++ static function getSupportedLanguages() { + return GalleryCoreApi::getSupportedLanguages(); + } + +@@ -365,7 +365,7 @@ class GalleryTranslator { + * string language code + * @static + */ +- function getDefaultLanguageCode() { ++ static function getDefaultLanguageCode() { + list ($ret, $useBrowserPref) = + GalleryCoreApi::getPluginParameter('module', 'core', 'language.useBrowserPref'); + if ($ret) { +@@ -407,7 +407,7 @@ class GalleryTranslator { + * array data about this language code (description,right-to-left?)) + * @static + */ +- function getSupportedLanguageCode($languageCode, $fallback=true) { ++ static function getSupportedLanguageCode($languageCode, $fallback=true) { + static $supportedLanguages; + static $defaultCountry; + if (!isset($supportedLanguages)) { +@@ -439,7 +439,7 @@ class GalleryTranslator { + * @return null or a language code in the _ format, eg: en_US + * @static + */ +- function getLanguageCodeFromRequest() { ++ static function getLanguageCodeFromRequest() { + /* Take the first thing the browser accepts that we can use */ + $httpAcceptLanguage = GalleryUtilities::getServerVar('HTTP_ACCEPT_LANGUAGE'); + if (!empty($httpAcceptLanguage)) { +--- modules/core/classes/GalleryUrlGenerator.class ++++ modules/core/classes/GalleryUrlGenerator.class +@@ -143,7 +143,7 @@ class GalleryUrlGenerator { + * @return string the current URL path component plus query parameters + * @static + */ +- function getCurrentRequestUri() { ++ static function getCurrentRequestUri() { + $cacheKey = 'GalleryUrlGenerator::currentRequestUri'; + if (GalleryDataCache::containsKey($cacheKey)) { + $path = GalleryDataCache::get($cacheKey); +@@ -182,7 +182,7 @@ class GalleryUrlGenerator { + * @return string the new URL (& separates added params) + * @static + */ +- function appendParamsToUrl($url, $params, $addPrefix=true, $htmlEntities=true, ++ static function appendParamsToUrl($url, $params, $addPrefix=true, $htmlEntities=true, + $urlEncode=true) { + if (empty($params)) { + return $url; +@@ -254,7 +254,7 @@ class GalleryUrlGenerator { + * @access private + * @static + */ +- function _parseUri($uri) { ++ static function _parseUri($uri) { + /* + * baseUri / g2Uri can have the following patterns: + * - Everything before the two last '/' is interpreted as path +@@ -975,7 +975,7 @@ class GalleryUrlGenerator { + * @access private + * @static + */ +- function _saveLocalUrlMap(&$urlGenerator) { ++ static function _saveLocalUrlMap(&$urlGenerator) { + if (!empty($urlGenerator->_localUrlMapDirty)) { + GalleryDataCache::putToDisk(array('type' => 'local-url-map'), + $urlGenerator->_localUrlMap); +--- modules/core/classes/GalleryUtilities.class ++++ modules/core/classes/GalleryUtilities.class +@@ -1197,7 +1197,7 @@ class GalleryUtilities { + * Get contents of MANIFEST files. + * @return array (file => array('checksum'=>..,'size'=>..,'viewable'=>..), ..) + */ +- function readManifest() { ++ static function readManifest() { + /* + * Be careful not to reference $gallery here; this method is called from the installer. + * Look in (modules|themes)/.../MANIFEST and top level MANIFEST. +@@ -1231,7 +1231,7 @@ class GalleryUtilities { + * @param string $filePath the path to the MANIFEST file + * @return array(file => array('checksum'=>..,'size'=>..,'viewable'=>..), ...) + */ +- function readIndividualManifest($filePath, &$manifest) { ++ static function readIndividualManifest($filePath, &$manifest) { + global $gallery; + + /* If the method getPlatform exists, then we are not installing and it is safe to use. */ +@@ -1356,7 +1356,7 @@ class GalleryUtilities { + * @param string $ini_string name of the php.ini value to be retrieved + * @return boolean value + */ +- function getPhpIniBool($ini_string) { ++ static function getPhpIniBool($ini_string) { + $value = ini_get($ini_string); + + if (!strcasecmp('on', $value) || $value == 1 || $value === true) { +--- modules/core/classes/GalleryView.class ++++ modules/core/classes/GalleryView.class +@@ -137,7 +137,7 @@ class GalleryView { + * GalleryView a view + * @static + */ +- function loadView($viewName) { ++ static function loadView($viewName) { + global $gallery; + + /* Continue to support old style : separator for a while */ +@@ -545,7 +545,7 @@ class GalleryView { + * @access private + * @static + */ +- function _loadTheme($themeId) { ++ static function _loadTheme($themeId) { + $validTheme = false; + list ($ret, $theme) = GalleryCoreApi::loadPlugin('theme', $themeId, false, true); + if ($ret) { +@@ -652,7 +652,7 @@ class GalleryView { + * @return GalleryStatus + * @static + */ +- function setStandardTemplateVariables(&$template) { ++ static function setStandardTemplateVariables(&$template) { + global $gallery; + $session =& $gallery->getSession(); + +--- modules/core/classes/helpers/GalleryCharsetHelper_simple.class ++++ modules/core/classes/helpers/GalleryCharsetHelper_simple.class +@@ -214,7 +214,7 @@ class GalleryCharsetHelper_simple { + /** + * @see GalleryCoreApi::utf8Substring + */ +- function utf8Substring($string, $start, $length) { ++ static function utf8Substring($string, $start, $length) { + static $hasMbSubstr; + if (!isset($hasMbSubstr)) { + if (!($hasMbSubstr = function_exists('mb_substr'))) { +--- modules/core/classes/helpers/GalleryPluginHelper_medium.class ++++ modules/core/classes/helpers/GalleryPluginHelper_medium.class +@@ -272,7 +272,7 @@ class GalleryPluginHelper_medium { + /** + * @see GalleryCoreApi::setPluginParameter + */ +- function setParameter($pluginType, $pluginId, $parameterName, $parameterValue, $itemId=0) { ++ static function setParameter($pluginType, $pluginId, $parameterName, $parameterValue, $itemId=0) { + global $gallery; + + if ($gallery->getDebug()) { +@@ -383,7 +383,7 @@ class GalleryPluginHelper_medium { + * @return GalleryStatus a status code + * @access private + */ +- function _updateParameter($pluginType, $pluginId, $parameterName, $parameterValue, $itemId=0) { ++ static function _updateParameter($pluginType, $pluginId, $parameterName, $parameterValue, $itemId=0) { + if (empty($pluginType) || empty($pluginId) || empty($parameterName)) { + return GalleryCoreApi::error(ERROR_BAD_PARAMETER); + } +--- modules/core/module.inc ++++ modules/core/module.inc +@@ -513,7 +513,7 @@ class CoreModule extends GalleryModule { + * @return array 'core' => core module version, 'gallery' => gallery version + * @static + */ +- function getInstalledVersions() { ++ static function getInstalledVersions() { + global $gallery; + + if (GalleryDataCache::containsKey('CoreModule::installedVersions')) { +--- modules/dynamicalbum/PopularAlbum.inc ++++ modules/dynamicalbum/PopularAlbum.inc +@@ -45,7 +45,7 @@ class PopularAlbumView extends UpdatesAlbumView { + * array of item ids + * @static + */ +- function getChildIds($userId) { ++ static function getChildIds($userId) { + return parent::getChildIds($userId, 'views', 'viewCount', ORDER_DESCENDING, + 'GalleryItemAttributesMap', 'itemId'); + } +--- modules/dynamicalbum/RandomAlbum.inc ++++ modules/dynamicalbum/RandomAlbum.inc +@@ -45,7 +45,7 @@ class RandomAlbumView extends UpdatesAlbumView { + * array of item ids + * @static + */ +- function getChildIds($userId) { ++ static function getChildIds($userId) { + return parent::getChildIds($userId, 'random', 'random', ORDER_ASCENDING, null, 'id'); + } + } +--- modules/dynamicalbum/UpdatesAlbum.inc ++++ modules/dynamicalbum/UpdatesAlbum.inc +@@ -161,7 +161,7 @@ class UpdatesAlbumView extends GalleryView { + * array of item ids + * @static + */ +- function getChildIds($userId, $param='date', $orderBy='creationTimestamp', ++ static function getChildIds($userId, $param='date', $orderBy='creationTimestamp', + $orderDirection=ORDER_DESCENDING, $table='GalleryEntity', $id='id') { + global $gallery; + $storage =& $gallery->getStorage(); +--- modules/jpegtran/classes/JpegtranToolkitHelper.class ++++ modules/jpegtran/classes/JpegtranToolkitHelper.class +@@ -36,7 +36,7 @@ class JpegtranToolkitHelper { + * array('operations' => ...) + * @static + */ +- function getOperations() { ++ static function getOperations() { + global $gallery; + + /* Detect and test the binary */ +@@ -90,7 +90,7 @@ class JpegtranToolkitHelper { + * + * @static + */ +- function testBinary($jpegtranPath) { ++ static function testBinary($jpegtranPath) { + global $gallery; + $platform =& $gallery->getPlatform(); + $slash = $platform->getDirectorySeparator(); +--- modules/keyalbum/Callbacks.inc ++++ modules/keyalbum/Callbacks.inc +@@ -89,7 +89,7 @@ class KeyAlbumCallbacks { + * @return GalleryStatus a status code + * @static + */ +- function _findAllKeywords($param, $onlyPublic, $sizeLimit, $maxWeight, $includeFrequency) { ++ static function _findAllKeywords($param, $onlyPublic, $sizeLimit, $maxWeight, $includeFrequency) { + global $gallery; + + $query = ' +--- modules/keyalbum/KeywordAlbum.inc ++++ modules/keyalbum/KeywordAlbum.inc +@@ -152,7 +152,7 @@ class KeywordAlbumView extends GalleryView { + * array of item ids + * @static + */ +- function getChildIds($userId, $keyword=null) { ++ static function getChildIds($userId, $keyword=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +--- modules/linkitem/classes/LinkItemToolkit.class ++++ modules/linkitem/classes/LinkItemToolkit.class +@@ -108,7 +108,7 @@ class LinkItemToolkit extends GalleryToolkit { + * @return string command line parameters with %URL% %WIDTH% %HEIGHT% %OUTFILE% tokens + * @static + */ +- function getSnapshotParams() { ++ static function getSnapshotParams() { + global $gallery; + $platform =& $gallery->getPlatform(); + $paramFile = dirname(dirname(__FILE__)) . $platform->getDirectorySeparator() . 'params.txt'; +--- modules/password/classes/PasswordHelper.class ++++ modules/password/classes/PasswordHelper.class +@@ -44,7 +44,7 @@ class PasswordHelper extends PasswordInterface_1_0 { + * @return GalleryStatus a status code + * @static + */ +- function setPassword(&$item, $password, $useProgressBar=false) { ++ static function setPassword(&$item, $password, $useProgressBar=false) { + global $gallery; + $gallery->guaranteeTimeLimit(60); + +@@ -328,7 +328,7 @@ class PasswordHelper extends PasswordInterface_1_0 { + * @return GalleryStatus a status code + * @static + */ +- function removePassword(&$item, $useProgressBar=false) { ++ static function removePassword(&$item, $useProgressBar=false) { + global $gallery; + $gallery->guaranteeTimeLimit(60); + +--- modules/rating/RatingAlbum.inc ++++ modules/rating/RatingAlbum.inc +@@ -158,7 +158,7 @@ class RatingAlbumView extends GalleryView { + * array of item ids + * @static + */ +- function getChildIds($userId, $limit=null) { ++ static function getChildIds($userId, $limit=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +--- modules/slideshow/classes/PicLensHelper.class ++++ modules/slideshow/classes/PicLensHelper.class +@@ -34,7 +34,7 @@ class PicLensHelper { + * string the version of PicLens we just installed + * @static + */ +- function install() { ++ static function install() { + global $gallery; + $platform =& $gallery->getPlatform(); + +@@ -77,7 +77,7 @@ class PicLensHelper { + * 'swfUrl' => url to the SWF file) + * @static + */ +- function getLatestPicLensInfo() { ++ static function getLatestPicLensInfo() { + $url = 'http://gallery.menalto.com/versioncheck/piclens/release'; + list ($success, $body) = GalleryCoreApi::fetchWebPage($url); + if (!$success) { diff -uNr gallery2/files/patch-gregstoll-84dec753 gallery2-php7/files/patch-gregstoll-84dec753 --- gallery2/files/patch-gregstoll-84dec753 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-84dec753 2019-05-20 14:00:26.000000000 +1200 @@ -0,0 +1,24 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/84dec753a49a885b8ab667927250aa3fae4d86c9 + +--- modules/captcha/CaptchaImage.inc ++++ modules/captcha/CaptchaImage.inc +@@ -88,7 +88,7 @@ class CaptchaImageView extends GalleryView { + + /* Output the image and reclaim the memory it used */ + /* Use low quality jpeg compression to make the image less OCR-able */ +- ImageJPEG($image, '', 50); ++ ImageJPEG($image, NULL, 50); + ImageDestroy($image); + + return null; +--- modules/gd/classes/GdToolkitHelper.class ++++ modules/gd/classes/GdToolkitHelper.class +@@ -283,7 +283,7 @@ class GdToolkitHelper { + return array($ret, false); + } + } +- if (preg_match('/^>?2\.0/', $gdVersion)) { ++ if (preg_match('/^>?2\.[01]/', $gdVersion)) { + return array(null, true); + } + /* 1.6, 1.8, ... is too old */ diff -uNr gallery2/files/patch-gregstoll-92188f3e gallery2-php7/files/patch-gregstoll-92188f3e --- gallery2/files/patch-gregstoll-92188f3e 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-92188f3e 2019-05-20 13:51:24.465346000 +1200 @@ -0,0 +1,137 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/92188f3e247213e6ddcadf02c2cc068b9a57ae03 + +--- lib/adodb/adodb.inc.php ++++ lib/adodb/adodb.inc.php +@@ -335,7 +335,7 @@ + /** + * Constructor + */ +- function ADOConnection() ++ function __construct() + { + die('Virtual Class -- cannot instantiate'); + } +@@ -2779,7 +2779,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 + * @param queryID this is the queryID returned by ADOConnection->_query() + * + */ +- function ADORecordSet($queryID) ++ function __construct($queryID) + { + $this->_queryID = $queryID; + } +@@ -3757,7 +3757,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 + * Constructor + * + */ +- function ADORecordSet_array($fakeid=1) ++ function __construct($fakeid=1) + { + global $ADODB_FETCH_MODE,$ADODB_COMPAT_FETCH; + +--- lib/adodb/drivers/adodb-mysqli.inc.php ++++ lib/adodb/drivers/adodb-mysqli.inc.php +@@ -788,7 +788,7 @@ class ADORecordSet_mysqli extends ADORecordSet{ + break; + } + $this->adodbFetchMode = $mode; +- $this->ADORecordSet($queryID); ++ parent::__construct($queryID); + } + + function _initrs() +--- modules/core/classes/Gallery.class ++++ modules/core/classes/Gallery.class +@@ -168,7 +168,7 @@ class Gallery { + var $_phpVm = null; + + +- function Gallery() { ++ function __construct() { + $this->_activeUser = null; + + /* Default config settings (can be overridden via config.php or embedded environment) */ +--- modules/core/classes/GalleryStatus.class ++++ modules/core/classes/GalleryStatus.class +@@ -54,7 +54,7 @@ class GalleryStatus { + * @param int $errorCode an error code + * @param string $errorMessage (optional) descriptive message of the error + */ +- function GalleryStatus($errorCode, $errorMessage=null) { ++ function __construct($errorCode, $errorMessage=null) { + $this->_errorCode = $errorCode; + $this->_errorMessage = $errorMessage; + } +--- modules/core/classes/GalleryStorage.class ++++ modules/core/classes/GalleryStorage.class +@@ -179,7 +179,7 @@ class GalleryStorage { + /** + * @param array $config database configuration values + */ +- function GalleryStorage($config) { ++ function __construct($config) { + $this->_type = $config['type']; + $this->_username = $config['username']; + $this->_password = $config['password']; +@@ -1517,7 +1517,7 @@ class GallerySearchResults { + */ + var $_mapInfo; + +- function GallerySearchResults($recordSet, $fieldNames=null, $mapInfo=null) { ++ function __construct($recordSet, $fieldNames=null, $mapInfo=null) { + $this->_recordSet = $recordSet; + $this->_fieldNames = $fieldNames; + $this->_mapInfo = $mapInfo; +@@ -1579,7 +1579,7 @@ class GallerySqlFragment { + * @param array $values values.. variable number of parameters must match + * number of ? markers in sql fragment + */ +- function GallerySqlFragment($fragment, $values) { ++ function __construct($fragment, $values) { + $this->_values = func_get_args(); + $this->_fragment = array_shift($this->_values); + } +@@ -1669,8 +1669,8 @@ function GalleryAdodbErrorHandler($dbms, $fn, $errno, $errmsg, $p1=false, $p2=fa + */ + class MySqlStorage extends GalleryStorage { + +- function MySqlStorage($config) { +- $this->GalleryStorage($config); ++ function __construct($config) { ++ parent::__construct($config); + if ($this->_type != 'mysql' /* mysqlt and mysqli are transactional */) { + $this->_isTransactional = true; + } +--- modules/core/classes/GalleryStorage/GalleryStorageExtras.class ++++ modules/core/classes/GalleryStorage/GalleryStorageExtras.class +@@ -30,7 +30,7 @@ class GalleryStorageExtras /* the other half of GalleryStorage */ { + /** + * @param GalleryStorage $galleryStorage the database storage instance + */ +- function GalleryStorageExtras(&$galleryStorage) { ++ function __construct(&$galleryStorage) { + $this->_gs =& $galleryStorage; + } + +--- modules/core/classes/GalleryTranslator.class ++++ modules/core/classes/GalleryTranslator.class +@@ -58,7 +58,7 @@ class GalleryTranslator { + var $_isRightToLeft; + + +- function GalleryTranslator() { ++ function __construct() { + $this->_boundDomains = array(); + } + +--- modules/core/module.inc ++++ modules/core/module.inc +@@ -26,7 +26,7 @@ + */ + class CoreModule extends GalleryModule { + +- function CoreModule() { ++ function __construct() { + global $gallery; + + $this->setId('core'); diff -uNr gallery2/files/patch-gregstoll-9e53f0fc gallery2-php7/files/patch-gregstoll-9e53f0fc --- gallery2/files/patch-gregstoll-9e53f0fc 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-9e53f0fc 2019-05-20 14:58:12.897994000 +1200 @@ -0,0 +1,14 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/9e53f0fc6e5d2e0761c70ccd051c280c9caf78cc + +--- modules/core/classes/GalleryEvent.class.orig 2008-04-13 12:38:13.000000000 +1200 ++++ modules/core/classes/GalleryEvent.class 2019-05-20 13:56:23.109728000 +1200 +@@ -51,7 +51,8 @@ + + function GalleryEvent() { + $this->setEventName(null); +- $this->setEntity($null=null); ++ $null = null; ++ $this->setEntity($null); + $this->setData(null); + } + diff -uNr gallery2/files/patch-gregstoll-a0af18a5 gallery2-php7/files/patch-gregstoll-a0af18a5 --- gallery2/files/patch-gregstoll-a0af18a5 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-a0af18a5 2020-04-18 09:02:30.000000000 +1200 @@ -0,0 +1,979 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/a0a5f18a5558e1ae101234249ea368471b45910e + +--- modules/albumselect/module.inc.orig +--- modules/albumselect/module.inc +@@ -58,7 +58,7 @@ class AlbumSelectModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'albumselect'); + if ($ret) { + return $ret; +--- modules/archiveupload/module.inc.orig +--- modules/archiveupload/module.inc +@@ -45,7 +45,7 @@ class ArchiveUploadModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'archiveupload'); + if ($ret) { + return $ret; +--- modules/captcha/module.inc.orig +--- modules/captcha/module.inc +@@ -65,7 +65,7 @@ class CaptchaModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + + switch ($currentVersion) { + case '': +--- modules/cart/module.inc.orig +--- modules/cart/module.inc +@@ -44,7 +44,7 @@ class CartModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (empty($currentVersion)) { +@@ -148,7 +148,7 @@ class CartModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + foreach ($items as $item) { + if (isset($permissions[$item->getId()]['cart.add'])) { +--- modules/comment/module.inc.orig +--- modules/comment/module.inc +@@ -52,7 +52,7 @@ class CommentModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +@@ -251,7 +251,7 @@ class CommentModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + list ($ret, $showAll) = $this->getParameter('comments.latest'); + if ($ret) { + return array($ret, null); +--- modules/core/CombinedJavascript.inc.orig +--- modules/core/CombinedJavascript.inc +@@ -37,7 +37,7 @@ class CombinedJavascriptView extends GalleryView { + /** + * @see GalleryView::renderImmediate + */ +- function renderImmediate() { ++ function renderImmediate($status, $error) { + global $gallery; + $platform =& $gallery->getPlatform(); + $phpVm = $gallery->getPhpVm(); +--- modules/core/ItemAddFromBrowser.inc.orig +--- modules/core/ItemAddFromBrowser.inc +@@ -30,7 +30,7 @@ class ItemAddFromBrowser extends ItemAddPlugin { + /** + * @see ItemAddPlugin::handleRequest + */ +- function handleRequest($form, &$item) { ++ function handleRequest($form, &$item, &$addController=null) { + global $gallery; + + $status = array(); +--- modules/core/classes/GalleryAlbumItem.class.orig +--- modules/core/classes/GalleryAlbumItem.class +@@ -84,7 +84,7 @@ class GalleryAlbumItem extends GalleryItem { + * @param int $parentId the id of the parent of this object + * @return GalleryStatus a status code + */ +- function create($parentId, $albumName) { ++ function create($parentId=false, $albumName=false, $canContainChildren = false) { + global $gallery; + + if (empty($albumName) || empty($parentId)) { +@@ -247,7 +247,7 @@ class GalleryAlbumItem extends GalleryItem { + /** + * @see GalleryItem::save() + */ +- function save($postEvent=true) { ++ function save($postEvent=true, $setAclId=null) { + global $gallery; + $session =& $gallery->getSession(); + +--- modules/core/classes/GalleryChildEntity.class.orig +--- modules/core/classes/GalleryChildEntity.class +@@ -59,7 +59,7 @@ class GalleryChildEntity extends GalleryEntity { + * @param int $parentId the id of the GalleryItem parent + * @return GalleryStatus a status code + */ +- function create($parentId) { ++ function create($parentId=false) { + global $gallery; + + if (empty($parentId)) { +--- modules/core/classes/GalleryDataCache.class.orig +--- modules/core/classes/GalleryDataCache.class +@@ -546,7 +546,7 @@ class GalleryDataCache { + return; + } + +- $permissions = $session->get('permissionCache'); ++ $permissions = (array)$session->get('permissionCache'); + /* + * Since we add all new data to the head of the list, the odds are good + * that we should find our answer in the first iteration of this loop. +--- modules/core/classes/GalleryDataItem.class.orig +--- modules/core/classes/GalleryDataItem.class +@@ -112,7 +112,7 @@ class GalleryDataItem extends GalleryItem { + * of copy (default is false). + * @return GalleryStatus a status code + */ +- function create($parentId, $inputFileName, $mimeType, $targetName=null, $symlink=false) { ++ function create($parentId=false, $inputFileName=false, $mimeType=false, $targetName=null, $symlink=false) { + global $gallery; + $platform =& $gallery->getPlatform(); + +--- modules/core/classes/GalleryDerivative.class.orig +--- modules/core/classes/GalleryDerivative.class +@@ -211,7 +211,7 @@ class GalleryDerivative extends GalleryChildEntity { + * @param int $parentId the id of the parent GalleryItem + * @return GalleryStatus a status code + */ +- function create($parentId) { ++ function create($parentId=null) { + $ret = parent::create($parentId); + if ($ret) { + return $ret; +--- modules/core/classes/GalleryDerivativeImage.class.orig +--- modules/core/classes/GalleryDerivativeImage.class +@@ -78,7 +78,7 @@ class GalleryDerivativeImage extends GalleryDerivative { + * @param int $derivativeType the type of derivative image + * @return GalleryStatus a status code + */ +- function create($parentId, $derivativeType) { ++ function create($parentId=null, $derivativeType=null) { + global $gallery; + $parentId = (int)$parentId; + +--- modules/core/classes/GalleryEntity.class.orig +--- modules/core/classes/GalleryEntity.class +@@ -214,7 +214,7 @@ class GalleryEntity extends GalleryPersistent { + * @return array GalleryStatus a status code + * GalleryItem the linked item + */ +- function createLink($entity) { ++ function createLink($entity, $parentId) { + global $gallery; + + if (get_class($this) != get_class($entity)) { +--- modules/core/classes/GalleryFileSystemEntity.class.orig +--- modules/core/classes/GalleryFileSystemEntity.class +@@ -70,8 +70,8 @@ class GalleryFileSystemEntity extends GalleryChildEntity { + * Defaults to false. + * @return GalleryStatus a status code + */ +- function create($parentId, $pathComponent, $isDirectory=false) { +- if (empty($pathComponent)) { ++ function create($parentId=false, $pathComponent=false, $isDirectory=false) { ++ if (empty($parentId) || empty($pathComponent)) { + return GalleryCoreApi::error(ERROR_BAD_PARAMETER); + } + +--- modules/core/classes/GalleryItem.class.orig +--- modules/core/classes/GalleryItem.class +@@ -173,7 +173,7 @@ class GalleryItem extends GalleryFileSystemEntity { + * Defaults to false. + * @return GalleryStatus a status code + */ +- function create($parentId, $path, $canContainChildren=false) { ++ function create($parentId=null, $path=null, $canContainChildren=false) { + global $gallery; + + if (!isset($path) || !isset($parentId)) { +@@ -393,7 +393,7 @@ class GalleryItem extends GalleryFileSystemEntity { + * + * @return GalleryStatus a status code + */ +- function save($postEvent=true) { ++ function save($postEvent=true, $setAclId=null) { + global $gallery; + $isNew = $this->testPersistentFlag(STORAGE_FLAG_NEWLY_CREATED); + +--- modules/core/classes/GalleryMovieItem.class.orig +--- modules/core/classes/GalleryMovieItem.class +@@ -108,7 +108,7 @@ class GalleryMovieItem extends GalleryDataItem { + * of copy (default is false). + * @return GalleryStatus a status code + */ +- function create($parentId, $videoFileName, $mimeType, $targetName=null, $symlink=false) { ++ function create($parentId=false, $videoFileName=false, $mimeType=false, $targetName=null, $symlink=false) { + global $gallery; + $platform =& $gallery->getPlatform(); + +--- modules/core/classes/GalleryPersistent.class.orig +--- modules/core/classes/GalleryPersistent.class +@@ -37,7 +37,7 @@ class GalleryPersistent { + var $_persistentStatus; + + +- function GalleryPersistent() { ++ function __construct() { + /* Initialize our persistent info tracker */ + $this->_persistentStatus['flags'] = 0; + $this->_persistentStatus['originalValue'] = array(); +--- modules/core/classes/GalleryPhotoItem.class.orig +--- modules/core/classes/GalleryPhotoItem.class +@@ -86,7 +86,7 @@ class GalleryPhotoItem extends GalleryDataItem { + * of copy (default is false). + * @return GalleryStatus a status code + */ +- function create($parentId, $imageFileName, $mimeType, $targetName=null, $symlink=false) { ++ function create($parentId=null, $imageFileName=false, $mimeType=false, $targetName=null, $symlink=false) { + global $gallery; + $platform =& $gallery->getPlatform(); + +--- modules/core/classes/GalleryPlugin.class.orig +--- modules/core/classes/GalleryPlugin.class +@@ -591,7 +591,7 @@ class GalleryPlugin { + * @return GalleryStatus a status code + * @access protected + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + return null; + } + +--- modules/core/classes/GalleryUser.class.orig +--- modules/core/classes/GalleryUser.class +@@ -123,7 +123,7 @@ class GalleryUser extends GalleryEntity { + * + * @return GalleryStatus a status code + */ +- function create($userName) { ++ function create($userName='') { + global $gallery; + + $query = ' +@@ -212,7 +212,7 @@ class GalleryUser extends GalleryEntity { + * + * @return GalleryStatus a status code + */ +- function save($postEvent=true) { ++ function save($postEvent=true, $setAclId=null) { + $isNew = $this->testPersistentFlag(STORAGE_FLAG_NEWLY_CREATED); + + $ret = parent::save($postEvent); +--- modules/core/module.inc.orig +--- modules/core/module.inc +@@ -481,7 +481,7 @@ class CoreModule extends GalleryModule { + * + * @see GalleryModule::install + */ +- function upgrade($currentVersion, $statusMonitor) { ++ function upgrade($currentVersion, $statusMonitor=null) { + GalleryCoreApi::requireOnce('modules/core/CoreModuleExtras.inc'); + $ret = CoreModuleExtras::upgrade($this, $currentVersion, $statusMonitor); + if ($ret) { +--- modules/customfield/module.inc.orig +--- modules/customfield/module.inc +@@ -46,7 +46,7 @@ class CustomFieldModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (!empty($currentVersion) && version_compare($currentVersion, '1.0.1', '<')) { +--- modules/digibug/module.inc.orig +--- modules/digibug/module.inc +@@ -44,7 +44,7 @@ class DigibugModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + if (!isset($currentVersion)) { + $currentVersion = '0'; +--- modules/dynamicalbum/module.inc.orig +--- modules/dynamicalbum/module.inc +@@ -44,7 +44,7 @@ class DynamicAlbumModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'dynamicalbum'); + if ($ret) { + return $ret; +@@ -99,7 +99,7 @@ class DynamicAlbumModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'dynamicalbum'); + if ($ret) { +--- modules/ecard/module.inc.orig +--- modules/ecard/module.inc +@@ -45,7 +45,7 @@ class EcardModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + if (!isset($currentVersion)) { + $currentVersion = '0'; +@@ -127,7 +127,7 @@ class EcardModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + foreach ($items as $item) { + $itemId = $item->getId(); +--- modules/exif/classes/ExifHelper.class.orig +--- modules/exif/classes/ExifHelper.class +@@ -333,7 +333,9 @@ class ExifHelper { + * decimal separator, but it does not accept '21,3725' as argument. Weird, but it's + * like that. + */ +- $value = preg_replace('/(\d*)[\.,](\d{3,})/e', 'sprintf(\'%.2f\', $1.$2)', $value); ++// $value = preg_replace('/(\d*)[\.,](\d{3,})/e', 'sprintf(\'%.2f\', $1.$2)', $value); ++ $value = preg_replace_callback('/(\d*)[\.,](\d{3,})/', ++ function($m) {return sprintf('%.2f', $m[0].$m[1]);}, $value); + break; + } + +--- modules/exif/module.inc.orig +--- modules/exif/module.inc +@@ -48,7 +48,7 @@ class ExifModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (!isset($currentVersion)) { +--- modules/ffmpeg/module.inc.orig +--- modules/ffmpeg/module.inc +@@ -46,7 +46,7 @@ class FfmpegModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $platform =& $gallery->getPlatform(); + +--- modules/fotokasten/module.inc.orig +--- modules/fotokasten/module.inc +@@ -47,7 +47,7 @@ class FotokastenModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + list ($ret, $params) = +@@ -119,7 +119,7 @@ class FotokastenModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + global $gallery; + $session =& $gallery->getSession(); + +--- modules/gd/classes/GdToolkit.class.orig +--- modules/gd/classes/GdToolkit.class +@@ -524,7 +524,7 @@ class GdToolkit extends GalleryToolkit { + if ($ret) { + return array($ret, null); + } +- $ret = $gd->imageJpeg($tmpRes, $tmpFile); ++ $ret = $gd->imageJpeg($tmpRes, $tmpFile, -1); + if ($ret) { + return array($ret, null); + } +--- modules/gd/module.inc.orig +--- modules/gd/module.inc +@@ -46,7 +46,7 @@ class GdModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + if (!isset($currentVersion)) { + /* Initial install */ + $ret = $this->setParameter('jpegQuality', '75'); +--- modules/getid3/module.inc.orig +--- modules/getid3/module.inc +@@ -46,7 +46,7 @@ class Getid3Module extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (!isset($currentVersion)) { +--- modules/hidden/module.inc.orig +--- modules/hidden/module.inc +@@ -48,7 +48,7 @@ class HiddenModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion, $statusMonitor) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +--- modules/httpauth/module.inc.orig +--- modules/httpauth/module.inc +@@ -116,7 +116,7 @@ class HttpAuthModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + switch ($currentVersion) { + case null: + /* Initial install */ +--- modules/icons/module.inc.orig +--- modules/icons/module.inc +@@ -43,7 +43,7 @@ class IconsModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'icons'); + if ($ret) { + return $ret; +--- modules/imageblock/module.inc.orig +--- modules/imageblock/module.inc +@@ -64,7 +64,7 @@ class ImageBlockModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +--- modules/imagemagick/module.inc.orig +--- modules/imagemagick/module.inc +@@ -47,7 +47,7 @@ class ImageMagickModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'imagemagick'); + if ($ret) { + return $ret; +--- modules/itemadd/module.inc.orig +--- modules/itemadd/module.inc +@@ -73,7 +73,7 @@ class ItemAddModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'itemadd'); + if ($ret) { + return $ret; +--- modules/keyalbum/module.inc.orig +--- modules/keyalbum/module.inc +@@ -43,7 +43,7 @@ class KeyAlbumModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'keyalbum'); + if ($ret) { + return $ret; +--- modules/linkitem/ItemAddLinkItem.inc.orig +--- modules/linkitem/ItemAddLinkItem.inc +@@ -30,7 +30,7 @@ class ItemAddLinkItem extends ItemAddPlugin { + /** + * @see ItemAddPlugin::handleRequest + */ +- function handleRequest($form, &$item) { ++ function handleRequest($form, &$item, &$addController=null) { + global $gallery; + + $status = $error = array(); +--- modules/linkitem/module.inc.orig +--- modules/linkitem/module.inc +@@ -41,7 +41,7 @@ class LinkItemModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $platform =& $gallery->getPlatform(); + $slash = $platform->getDirectorySeparator(); +--- modules/members/module.inc.orig +--- modules/members/module.inc +@@ -43,7 +43,7 @@ class MembersModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + if (!isset($currentVersion)) { + list ($ret, $viewSelectedGroupId) = + GalleryCoreApi::getPluginParameter('module', 'core', 'id.everybodyGroup'); +--- modules/migrate/module.inc.orig +--- modules/migrate/module.inc +@@ -48,7 +48,7 @@ class MigrateModule extends GalleryModule /* and GalleryEventListener */ { + * We pushed all this code into its own file since we need it very rarely so it doesn't + * make sense to load it every single time. + */ +- function upgrade($currentVersion, $statusMonitor) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +--- modules/mime/module.inc.orig +--- modules/mime/module.inc +@@ -68,7 +68,7 @@ class MimeModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'mime'); + if ($ret) { + return $ret; +--- modules/multilang/module.inc.orig +--- modules/multilang/module.inc +@@ -44,7 +44,7 @@ class MultiLangModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + if (!isset($currentVersion)) { + $ret = $this->setParameter('languages', ''); + if ($ret) { +--- modules/netpbm/module.inc.orig +--- modules/netpbm/module.inc +@@ -44,7 +44,7 @@ class NetPbmModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'netpbm'); + if ($ret) { + return $ret; +--- modules/newitems/module.inc.orig +--- modules/newitems/module.inc +@@ -46,7 +46,7 @@ class NewItemsModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + if (!isset($currentVersion)) { + foreach (array('days.new' => '7', + 'days.updated' => '7' ) +--- modules/notification/module.inc.orig +--- modules/notification/module.inc +@@ -219,7 +219,7 @@ class NotificationModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion, $statusMonitor) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $storage =& $gallery->getStorage(); + +--- modules/panorama/module.inc.orig +--- modules/panorama/module.inc +@@ -46,7 +46,7 @@ class PanoramaModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + if (!isset($currentVersion)) { + /* Initial install */ + foreach (array('itemType' => 1, +@@ -103,7 +103,7 @@ class PanoramaModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + + list ($ret, $param) = GalleryCoreApi::fetchAllPluginParameters('module', 'panorama'); +--- modules/password/module.inc.orig +--- modules/password/module.inc +@@ -48,7 +48,7 @@ class PasswordModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'password'); + if ($ret) { + return $ret; +--- modules/permalinks/module.inc.orig +--- modules/permalinks/module.inc +@@ -48,7 +48,7 @@ class PermalinksModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'permalinks'); + if ($ret) { + return $ret; +--- modules/photoaccess/module.inc.orig +--- modules/photoaccess/module.inc +@@ -44,7 +44,7 @@ class PhotoAccessModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + if (!isset($currentVersion)) { + $currentVersion = '0'; +@@ -135,7 +135,7 @@ class PhotoAccessModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + + foreach ($items as $item) { +--- modules/picasa/ItemAddFromPicasa.inc.orig +--- modules/picasa/ItemAddFromPicasa.inc +@@ -30,7 +30,7 @@ class ItemAddFromPicasa extends ItemAddPlugin { + /** + * @see ItemAddPlugin::handleRequest + */ +- function handleRequest($form, &$item) { ++ function handleRequest($form, &$item, &$addController=null) { + global $gallery; + GalleryCoreApi::requireOnce('modules/picasa/classes/Picasa2DataParser.class'); + GalleryCoreApi::requireOnce('modules/picasa/classes/PicasaImportHelper.class'); +--- modules/quotas/module.inc.orig +--- modules/quotas/module.inc +@@ -44,7 +44,7 @@ class QuotasModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (!empty($currentVersion) && version_compare($currentVersion, '1.0.1', '<')) { +--- modules/randomhighlight/module.inc.orig +--- modules/randomhighlight/module.inc +@@ -42,7 +42,7 @@ class RandomHighlightModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + list ($ret, $params) = +--- modules/rating/module.inc.orig +--- modules/rating/module.inc +@@ -168,7 +168,7 @@ class RatingModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (!isset($currentVersion)) { +--- modules/rearrange/module.inc.orig +--- modules/rearrange/module.inc +@@ -43,7 +43,7 @@ class RearrangeModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + + $itemIds = array(); +--- modules/register/module.inc.orig +--- modules/register/module.inc +@@ -44,7 +44,7 @@ class RegisterModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'register'); + if ($ret) { + return $ret; +--- modules/remote/module.inc.orig +--- modules/remote/module.inc +@@ -41,7 +41,7 @@ class RemoteModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'remote'); + if ($ret) { + return $ret; +--- modules/rewrite/module.inc.orig +--- modules/rewrite/module.inc +@@ -46,7 +46,7 @@ class RewriteModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + GalleryCoreApi::requireOnce('modules/rewrite/RewriteModuleExtras.inc'); + $ret = RewriteModuleExtras::upgrade($this, $currentVersion); + if ($ret) { +--- modules/rss/module.inc.orig +--- modules/rss/module.inc +@@ -192,7 +192,7 @@ class RssModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + + /** + * @todo add a default to this switch statement and include all historical versions, like +--- modules/shutterfly/module.inc.orig +--- modules/shutterfly/module.inc +@@ -44,7 +44,7 @@ class ShutterflyModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + if (!isset($currentVersion)) { + $currentVersion = '0'; +@@ -137,7 +137,7 @@ class ShutterflyModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + global $gallery; + $session =& $gallery->getSession(); + +--- modules/slideshow/classes/SlideshowHelper.class.orig +--- modules/slideshow/classes/SlideshowHelper.class +@@ -19,7 +19,7 @@ + */ + + /** MediaRSS paging items per page */ +-define('SLIDESHOW_MEDIARSS_ITEMS_PER_PAGE', 25); ++define('SLIDESHOW_MEDIARSS_ITEMS_PER_PAGE', 500); + + GalleryCoreApi::requireOnce('modules/slideshow/classes/SlideshowInterface_1_0.class'); + +--- modules/slideshow/module.inc.orig +--- modules/slideshow/module.inc +@@ -66,7 +66,7 @@ class SlideshowModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $platform =& $gallery->getPlatform(); + +@@ -116,7 +116,7 @@ class SlideshowModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + global $gallery; + $urlGenerator =& $gallery->getUrlGenerator(); + +--- modules/slideshowapplet/module.inc.orig +--- modules/slideshowapplet/module.inc +@@ -41,7 +41,7 @@ class SlideshowAppletModule extends GalleryModule { + /** + * @see GalleryPlugin::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + list ($ret, $params) = +@@ -90,7 +90,7 @@ class SlideshowAppletModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + global $gallery; + + $links = array(); +--- modules/snapgalaxy/module.inc.orig +--- modules/snapgalaxy/module.inc +@@ -46,7 +46,7 @@ class SnapGalaxyModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + if (!isset($currentVersion)) { +@@ -116,7 +116,7 @@ class SnapGalaxyModule extends GalleryModule { + /** + * @see GalleryModule::getItemLinks + */ +- function getItemLinks($items, $wantsDetailedLinks, $permissions) { ++ function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId=null) { + $links = array(); + + foreach ($items as $item) { +--- modules/squarethumb/module.inc.orig +--- modules/squarethumb/module.inc +@@ -47,7 +47,7 @@ class SquareThumbModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'squarethumb'); + if ($ret) { + return $ret; +--- modules/thumbnail/module.inc.orig +--- modules/thumbnail/module.inc +@@ -46,7 +46,7 @@ class ThumbnailModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + GalleryCoreApi::requireOnce('modules/thumbnail/ThumbnailModuleExtras.inc'); + $ret = ThumbnailModuleExtras::upgrade($this, $currentVersion); + if ($ret) { +--- modules/uploadapplet/module.inc.orig +--- modules/uploadapplet/module.inc +@@ -41,7 +41,7 @@ class UploadAppletModule extends GalleryModule { + /** + * @see GalleryPlugin::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + list ($ret, $params) = +--- modules/useralbum/module.inc.orig +--- modules/useralbum/module.inc +@@ -57,7 +57,7 @@ class UserAlbumModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'useralbum'); + if ($ret) { + return $ret; +--- modules/watermark/module.inc.orig +--- modules/watermark/module.inc +@@ -44,7 +44,7 @@ class WatermarkModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + $platform =& $gallery->getPlatform(); + $slash = $platform->getDirectorySeparator(); +--- modules/webcam/ItemAddWebCam.inc.orig +--- modules/webcam/ItemAddWebCam.inc +@@ -30,7 +30,7 @@ class ItemAddWebCam extends ItemAddPlugin { + /** + * @see ItemAddPlugin::handleRequest + */ +- function handleRequest($form, &$item) { ++ function handleRequest($form, &$item, &$addController=null) { + global $gallery; + + $status = $error = array(); +--- modules/webcam/module.inc.orig +--- modules/webcam/module.inc +@@ -41,7 +41,7 @@ class WebCamModule extends GalleryModule { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'webcam'); +--- modules/webdav/ItemAddWebDav.inc.orig +--- modules/webdav/ItemAddWebDav.inc +@@ -33,7 +33,7 @@ class ItemAddWebDav extends ItemAddPlugin { + /** + * @see ItemAddPlugin::handleRequest + */ +- function handleRequest($form, &$item) { ++ function handleRequest($form, &$item, &$addController=null) { + $requestMethod = strtolower(GalleryUtilities::getServerVar('REQUEST_METHOD')); + if ($requestMethod != 'put') { + return array(GalleryCoreApi::error(ERROR_REQUEST_FORGED), null, null); +--- modules/webdav/module.inc.orig +--- modules/webdav/module.inc +@@ -64,7 +64,7 @@ class WebDavModule extends GalleryModule /* and GalleryEventListener */ { + /** + * @see GalleryModule::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + global $gallery; + + switch ($currentVersion) { +--- themes/carbon/theme.inc.orig +--- themes/carbon/theme.inc +@@ -268,7 +268,7 @@ class CarbonTheme extends GalleryTheme { + /** + * @see GalleryPlugin::upgrade + */ +- function upgrade($currentVersion) { ++ function upgrade($currentVersion, $statusMonitor=null) { + if (isset($currentVersion) && version_compare($currentVersion, '1.1.2', '<')) { + /* Rename albumBlocks2 and photoBlocks2 */ + foreach (array('albumBlocks2' => 'albumUpperBlocks', diff -uNr gallery2/files/patch-gregstoll-b180528e gallery2-php7/files/patch-gregstoll-b180528e --- gallery2/files/patch-gregstoll-b180528e 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-b180528e 2020-04-18 11:04:43.947294000 +1200 @@ -0,0 +1,572 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/b180528e518ecd35c8f47e301db8d816f3ed480d +--- lib/adodb/adodb-time.inc.php.orig ++++ 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; + } + + +--- lib/adodb/adodb.inc.php.orig ++++ 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; + +--- lib/bbcode/stringparser.class.php.orig ++++ 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; + } +--- lib/smarty/Smarty_Compiler.class.php.orig ++++ 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); +--- lib/support/GallerySetupUtilities.class.orig ++++ 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(); +--- modules/core/classes/GalleryCoreApi.class.orig ++++ 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; +--- modules/core/classes/GalleryDataCache.class.orig ++++ 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'); +--- modules/core/classes/GalleryStorage/GalleryStorageExtras.class.orig ++++ 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; + } + +--- modules/core/classes/GalleryUtilities.class.orig ++++ 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'); + } + diff -uNr gallery2/files/patch-gregstoll-b4412ba7 gallery2-php7/files/patch-gregstoll-b4412ba7 --- gallery2/files/patch-gregstoll-b4412ba7 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-b4412ba7 2019-05-20 13:50:10.831010000 +1200 @@ -0,0 +1,13 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/b4412ba7098b1f87a40b64768a0184411f07d7e9 + +--- modules/core/classes/helpers/GalleryDerivativeHelper_advanced.class ++++ modules/core/classes/helpers/GalleryDerivativeHelper_advanced.class +@@ -612,7 +612,7 @@ class GalleryDerivativeHelper_advanced { + } + + /* Our merge is complete, so convert our operations back into a string */ +- $results = ''; ++ $results = array(); + for ($i = 0; $i < sizeof($operations1); $i++) { + $op = $operations1[$i]['op']; + if (!empty($operations1[$i]['args'])) { diff -uNr gallery2/files/patch-gregstoll-bc541824 gallery2-php7/files/patch-gregstoll-bc541824 --- gallery2/files/patch-gregstoll-bc541824 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-bc541824 2020-04-18 09:14:55.542226000 +1200 @@ -0,0 +1,16 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/bc54182496f8bf175a5c606f53cdfb9310402c1a + +--- modules/linkitem/classes/GalleryLinkItem.class.orig ++++ modules/linkitem/classes/GalleryLinkItem.class +@@ -60,9 +60,10 @@ class GalleryLinkItem extends GalleryItem { + * + * @param int $parentId the id of the parent object + * @param mixed $link the link target: either string url or int id of a GalleryAlbumItem ++ * @param boolean $canContainChildren ignored (for compatibility with base class) + * @return GalleryStatus a status code + */ +- function create($parentId, $link) { ++ function create($parentId=null, $link=null, $canContainChildren=false) { + if (!isset($parentId) || empty($link)) { + return GalleryCoreApi::error(ERROR_BAD_PARAMETER); + } diff -uNr gallery2/files/patch-gregstoll-c5de1c59 gallery2-php7/files/patch-gregstoll-c5de1c59 --- gallery2/files/patch-gregstoll-c5de1c59 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-c5de1c59 2020-04-18 08:52:44.235345000 +1200 @@ -0,0 +1,12 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/c5de1c59a4990b467a6917f766baab7c36c34c5f + +--- modules/core/classes/GallerySession.class ++++ modules/core/classes/GallerySession.class +@@ -777,6 +777,7 @@ class GallerySession { + unset($sessionDataCopy['embed.id.externalUser']); + unset($sessionDataCopy['core.authToken']); + unset($sessionDataCopy['secure']); ++ GalleryCoreApi::requireOnce('modules/core/classes/GalleryTranslator.class'); + list ($ret, $detectedLanguageCode) = GalleryTranslator::getDefaultLanguageCode(); + if ($ret) { + return array($ret, null); diff -uNr gallery2/files/patch-gregstoll-dbade2ca gallery2-php7/files/patch-gregstoll-dbade2ca --- gallery2/files/patch-gregstoll-dbade2ca 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-dbade2ca 2019-08-15 20:45:30.371812000 +1200 @@ -0,0 +1,116 @@ +Obtained from: 5aa23ddcbf1bfeeea2843d3ab957258bea5a2dff +Obtained from: https://github.com/gregstoll/gallery2/commit/dbade2ca15a2563343adc741277730eca7442a83 + +--- lib/adodb/drivers/adodb-mysql.inc.php ++++ lib/adodb/drivers/adodb-mysql.inc.php +@@ -620,7 +620,7 @@ class ADORecordSet_mysql extends ADORecordSet{ + $this->fetchMode = MYSQL_BOTH; break; + } + $this->adodbFetchMode = $mode; +- $this->ADORecordSet($queryID); ++ parent::__construct($queryID); + } + + function _initrs() +@@ -787,4 +787,4 @@ class ADORecordSet_ext_mysql extends ADORecordSet_mysql { + + + } +-?> +\ No newline at end of file ++?> +--- lib/adodb/drivers/adodb-mysqlt.inc.php ++++ lib/adodb/drivers/adodb-mysqlt.inc.php +@@ -107,7 +107,7 @@ class ADORecordSet_mysqlt extends ADORecordSet_mysql{ + } + + $this->adodbFetchMode = $mode; +- $this->ADORecordSet($queryID); ++ parent::__construct($queryID); + } + + function MoveNext() +--- lib/adodb/drivers/adodb-pdo.inc.php ++++ lib/adodb/drivers/adodb-pdo.inc.php +@@ -388,7 +388,7 @@ class ADORecordSet_pdo extends ADORecordSet { + $this->fetchMode = $mode; + + $this->_queryID = $id; +- $this->ADORecordSet($id); ++ parent::__construct($id); + } + + +@@ -481,4 +481,4 @@ class ADORecordSet_pdo extends ADORecordSet { + + } + +-?> +\ No newline at end of file ++?> +--- lib/adodb/drivers/adodb-postgres64.inc.php ++++ lib/adodb/drivers/adodb-postgres64.inc.php +@@ -883,7 +883,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{ + default: $this->fetchMode = PGSQL_BOTH; break; + } + $this->adodbFetchMode = $mode; +- $this->ADORecordSet($queryID); ++ parent::__construct($queryID); + } + + function &GetRowAssoc($upper=true) +--- modules/core/classes/GalleryStorage/Db2Storage.class ++++ modules/core/classes/GalleryStorage/Db2Storage.class +@@ -32,7 +32,7 @@ GalleryCoreApi::requireOnce('modules/core/classes/GalleryStorage.class'); + class Db2Storage extends GalleryStorage { + + function Db2Storage($config) { +- $this->GalleryStorage($config); ++ parent::__construct($config); + $this->_isTransactional = true; + } + +--- modules/core/classes/GalleryStorage/MSSqlStorage.class ++++ modules/core/classes/GalleryStorage/MSSqlStorage.class +@@ -40,7 +40,7 @@ class MSSqlStorage extends GalleryStorage { + var $_serverInfo; + + function MSSqlStorage($config) { +- $this->GalleryStorage($config); ++ parent::__construct($config); + $this->_isTransactional = true; + $this->_isEmptyAllowedForNotNullColumn = true; + +--- modules/core/classes/GalleryStorage/OracleStorage.class ++++ modules/core/classes/GalleryStorage/OracleStorage.class +@@ -32,7 +32,7 @@ GalleryCoreApi::requireOnce('modules/core/classes/GalleryStorage.class'); + class OracleStorage extends GalleryStorage { + + function OracleStorage($config) { +- $this->GalleryStorage($config); ++ parent::__construct($config); + $this->_isTransactional = true; + $this->_isEmptyAllowedForNotNullColumn = false; + } +--- modules/core/classes/GalleryStorage/PostgreSqlStorage.class ++++ modules/core/classes/GalleryStorage/PostgreSqlStorage.class +@@ -32,7 +32,7 @@ GalleryCoreApi::requireOnce('modules/core/classes/GalleryStorage.class'); + class PostgreSqlStorage extends GalleryStorage { + + function PostgreSqlStorage($config) { +- $this->GalleryStorage($config); ++ parent::__construct($config); + $this->_isTransactional = true; + } + +--- modules/core/classes/GalleryStorage/SQLiteStorage.class ++++ modules/core/classes/GalleryStorage/SQLiteStorage.class +@@ -32,7 +32,7 @@ GalleryCoreApi::requireOnce('modules/core/classes/GalleryStorage.class'); + class SQLiteStorage extends GalleryStorage { + + function SQLiteStorage($config) { +- $this->GalleryStorage($config); ++ parent::__construct($config); + /** + * SQLite supports transactions, but they seem to hang on some pages and some select + * statements seem to hang too. diff -uNr gallery2/files/patch-gregstoll-e2a63e64 gallery2-php7/files/patch-gregstoll-e2a63e64 --- gallery2/files/patch-gregstoll-e2a63e64 1970-01-01 12:00:00.000000000 +1200 +++ gallery2-php7/files/patch-gregstoll-e2a63e64 2020-04-18 09:13:19.861972000 +1200 @@ -0,0 +1,13 @@ +Obtained from: https://github.com/gregstoll/gallery2/commit/e2a63e64c992a2cff04701798f56f6304855189b + +--- modules/exif/SwitchDetailMode.inc.orig ++++ modules/exif/SwitchDetailMode.inc +@@ -31,7 +31,7 @@ class SwitchDetailModeController extends GalleryController { + /** + * @see GalleryController::handleRequest + */ +- function handleRequest() { ++ function handleRequest($form) { + global $gallery; + + $mode = GalleryUtilities::getRequestVariables('mode'); diff -uNr gallery2/files/patch-lib-adodb-adodb-time.inc.php gallery2-php7/files/patch-lib-adodb-adodb-time.inc.php --- gallery2/files/patch-lib-adodb-adodb-time.inc.php 2019-01-20 09:31:59.000000000 +1300 +++ gallery2-php7/files/patch-lib-adodb-adodb-time.inc.php 1970-01-01 12:00:00.000000000 +1200 @@ -1,12 +0,0 @@ -Obtained from: https://github.com/bobosch/gallery2/commit/4ddfafa416ffe5babd95f2a6532742c3ec903275 - ---- lib/adodb/adodb-time.inc.php.orig -+++ 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 -uNr gallery2/files/patch-modules-core-classes-GalleryStorage-GalleryStorageExtras.class gallery2-php7/files/patch-modules-core-classes-GalleryStorage-GalleryStorageExtras.class --- gallery2/files/patch-modules-core-classes-GalleryStorage-GalleryStorageExtras.class 2019-01-20 09:31:59.000000000 +1300 +++ gallery2-php7/files/patch-modules-core-classes-GalleryStorage-GalleryStorageExtras.class 1970-01-01 12:00:00.000000000 +1200 @@ -1,13 +0,0 @@ -Obtained from: https://github.com/bobosch/gallery2/commit/4fc50203a12b78217999df00759d70d283efce2f - ---- modules/core/classes/GalleryStorage/GalleryStorageExtras.class.orig -+++ 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; - } -