From add8687ed328d44b423d92ac9082cc07ef0105b3 Mon Sep 17 00:00:00 2001 From: prasad <prasad@vtiger.com> Date: Sat, 4 May 2024 21:10:03 +0530 Subject: [PATCH] Making install compatible to E_ALL --- include/ComboStrings.php | 3 +-- include/database/PearDatabase.php | 2 +- includes/runtime/Viewer.php | 6 +++--- libraries/adodb_vtigerfix/adodb-xmlschema.inc.php | 12 +++++++++++- libraries/freetag/freetag.class.php | 2 +- modules/Install/views/Index.php | 7 +++---- modules/Migration/schema/701_to_710.php | 3 ++- modules/Migration/schema/720_to_730.php | 4 ++-- modules/Users/UserTimeZonesArray.php | 2 +- modules/com_vtiger_workflow/VTWorkflowManager.inc | 4 ++++ vtlib/Vtiger/FieldBasic.php | 2 ++ vtlib/Vtiger/Functions.php | 6 ++++-- vtlib/Vtiger/LanguageImport.php | 6 ++++-- vtlib/Vtiger/PackageImport.php | 1 + vtlib/Vtiger/Unzip.php | 2 +- vtlib/Vtiger/Utils/GuardedArray.php | 4 ++-- 16 files changed, 43 insertions(+), 23 deletions(-) diff --git a/include/ComboStrings.php b/include/ComboStrings.php index a88f30444..dcf07af5f 100644 --- a/include/ComboStrings.php +++ b/include/ComboStrings.php @@ -355,8 +355,7 @@ $combo_strings = Array( ); require_once('modules/Users/UserTimeZonesArray.php'); -$usertimezonesClass = new UserTimeZones(); -$arrayOfSupportedTimeZones = $usertimezonesClass->userTimeZones(); +$arrayOfSupportedTimeZones = UserTimeZones::getAll(); $combo_strings['time_zone_dom'] = array_combine($arrayOfSupportedTimeZones,$arrayOfSupportedTimeZones); ?> diff --git a/include/database/PearDatabase.php b/include/database/PearDatabase.php index 254fe9abc..06a705b89 100644 --- a/include/database/PearDatabase.php +++ b/include/database/PearDatabase.php @@ -306,7 +306,7 @@ class PearDatabase{ $this->executeSetNamesUTF8SQL(); $sql_start_time = microtime(true); - $result = & $this->database->Execute($sql); + $result = $this->database->Execute($sql); $this->logSqlTiming($sql_start_time, microtime(true), $sql); $this->lastmysqlrow = -1; diff --git a/includes/runtime/Viewer.php b/includes/runtime/Viewer.php index c2271e765..59876ddfd 100644 --- a/includes/runtime/Viewer.php +++ b/includes/runtime/Viewer.php @@ -73,7 +73,7 @@ class Vtiger_Viewer extends Smarty { $classes = array('Vtiger_MenuStructure_Model', 'Users_Privileges_Model', 'Vtiger_Module_Model', 'Settings_MenuEditor_Module_Model', 'Vtiger_Util_Helper', - 'ZEND_JSON', 'Zend_Json', 'Zend_JSON', + 'ZEND_JSON', 'Zend_Json', 'Zend_JSON', 'ZEND_json', 'Vtiger_Theme', 'Users_Record_Model', 'Vtiger_Module_Model', 'Vtiger_Field_Model', 'Settings_Picklist_Module_Model', 'CustomView_Record_Model', 'Vtiger_Extension_View', 'Vtiger_Tag_Model', @@ -87,8 +87,8 @@ class Vtiger_Viewer extends Smarty { $modifiers = array('vtranslate', 'vtlib_isModuleActive', 'vimage_path', 'strstr', 'stripos', 'strpos', 'date', 'vtemplate_path', 'vresource_url', 'decode_html', 'vtlib_purify', 'php7_count', 'getUserFullName', 'array_flip', 'explode', 'trim', 'array_push', 'array_map', 'array_key_exists', 'get_class', 'vtlib_array', 'getDuplicatesPreventionMessage', 'htmlentities', - 'getCurrencySymbolandCRate', 'mb_substr', 'isPermitted', 'getEntityName', - 'strtolower', 'strtoupper'); + 'getCurrencySymbolandCRate', 'mb_substr', 'isPermitted', 'getEntityName', 'function_exists', + 'strtolower', 'strtoupper', 'str_replace', 'urlencode', 'getTranslatedCurrencyString', 'getTranslatedString', 'is_object', 'is_numeric'); foreach ($modifiers as $modifier) { if (function_exists($modifier)) { $this->registerPlugin('modifier', $modifier, $modifier); diff --git a/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php index 824dcb960..c01212aeb 100644 --- a/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php +++ b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php @@ -556,7 +556,17 @@ class dbTable extends dbObject { if( is_array( $opt ) ) { $key = key( $opt ); $value = $opt[key( $opt )]; - @$fldarray[$field_id][$key] .= $value; + + // ensure fldarray[field_id] init. + if (!isset($fldarray[$field_id])) { + $fldarray[$field_id] = array(); + } + // ensure fldarray[field_id][$key] init. + if (!isset($fldarray[$field_id][$key])) { + $fldarray[$field_id][$key] = ""; + } + + $fldarray[$field_id][$key] .= $value; // Option doesn't have arguments } else { $fldarray[$field_id][$opt] = $opt; diff --git a/libraries/freetag/freetag.class.php b/libraries/freetag/freetag.class.php index 7af7d6193..ed1e01449 100644 --- a/libraries/freetag/freetag.class.php +++ b/libraries/freetag/freetag.class.php @@ -104,7 +104,7 @@ class freetag { * - PCONNECT: Whether to use ADODB persistent connections. [default: FALSE] * */ - function freetag($options = NULL) { + function __construct($options = NULL) { /* $available_options = array('debug', 'db', 'db_user', 'db_pass', 'db_host', 'db_name', 'table_prefix', 'normalize_tags', 'normalized_valid_chars', 'block_multiuser_tag_on_object', 'MAX_TAG_LENGTH', 'ADODB_DIR', 'PCONNECT'); if (is_array($options)) { diff --git a/modules/Install/views/Index.php b/modules/Install/views/Index.php index dc6157e49..4ff2d1472 100644 --- a/modules/Install/views/Index.php +++ b/modules/Install/views/Index.php @@ -29,8 +29,8 @@ class Install_Index_view extends Vtiger_View_Controller { protected function applyInstallFriendlyEnv() { // config.inc.php - will not be ready to control this yet. - version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); // Production - //version_compare(PHP_VERSION, '7.0.0') >= 0 ? error_reporting(E_WARNING & ~E_NOTICE) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & E_ERROR & ~E_STRICT); // Debug + // version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_ERROR & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); // Production + // version_compare(PHP_VERSION, '7.0.0') >= 0 ? error_reporting(E_WARNING & ~E_NOTICE) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & E_ERROR & ~E_STRICT); // Debug set_time_limit(0); // override limits on execution time to allow install to finish } @@ -99,8 +99,7 @@ class Install_Index_view extends Vtiger_View_Controller { $viewer->assign('CURRENCIES', Install_Utils_Model::getCurrencyList()); require_once 'modules/Users/UserTimeZonesArray.php'; - $timeZone = new UserTimeZones(); - $viewer->assign('TIMEZONES', $timeZone->userTimeZones()); + $viewer->assign('TIMEZONES', UserTimeZones::getAll()); $defaultParameters = Install_Utils_Model::getDefaultPreInstallParameters(); $viewer->assign('DB_HOSTNAME', $defaultParameters['db_hostname']); diff --git a/modules/Migration/schema/701_to_710.php b/modules/Migration/schema/701_to_710.php index 252ff82dd..8462a1692 100644 --- a/modules/Migration/schema/701_to_710.php +++ b/modules/Migration/schema/701_to_710.php @@ -156,7 +156,8 @@ if (defined('VTIGER_UPGRADE')) { $packageModules = array('Project', 'ProjectTask', 'ProjectMilestone'); /* Projects zip is bundle */ $packageZips = glob("packages/vtiger/*/*.zip"); foreach ($packageZips as $zipfile) { - $packageModules[] = str_replace('.zip', '', array_pop(explode("/", $zipfile))); + $parts = explode("/", $zipfile); + $packageModules[] = str_replace('.zip', '', array_pop($parts)); } $db->pquery('UPDATE vtiger_tab SET source="custom" WHERE version IS NOT NULL AND name NOT IN ('.generateQuestionMarks($packageModules).')', $packageModules); diff --git a/modules/Migration/schema/720_to_730.php b/modules/Migration/schema/720_to_730.php index d048909f4..7c18c3760 100644 --- a/modules/Migration/schema/720_to_730.php +++ b/modules/Migration/schema/720_to_730.php @@ -96,7 +96,7 @@ if (defined('VTIGER_UPGRADE')) { //Migrate default module data from config editor to database $moduleModel = Settings_Vtiger_ConfigModule_Model::getInstance(); $configFieldData = $moduleModel->getViewableData(); - $defaultModule = $configFieldData['default_module']; + $defaultModule = isset($configFieldData['default_module']) ? $configFieldData['default_module'] : ""; if(empty($defaultModule)){ $defaultModule = 'Home'; } @@ -297,4 +297,4 @@ if (defined('VTIGER_UPGRADE')) { $db->pquery('ALTER TABLE vtiger_calendar_default_activitytypes ADD COLUMN conditions VARCHAR(255) DEFAULT ""', array()); echo 'Conditions column in vtiger_calendar_default_activitytypes updated'; -} \ No newline at end of file +} diff --git a/modules/Users/UserTimeZonesArray.php b/modules/Users/UserTimeZonesArray.php index f39629134..f4166cbd5 100644 --- a/modules/Users/UserTimeZonesArray.php +++ b/modules/Users/UserTimeZonesArray.php @@ -13,7 +13,7 @@ * Contributor(s): ______________________________________. ********************************************************************************/ class UserTimeZones{ - function __construct(){ + static function getAll(){ $arrayOfSupportedTimeZones = array( 'Pacific/Midway', 'Pacific/Samoa', diff --git a/modules/com_vtiger_workflow/VTWorkflowManager.inc b/modules/com_vtiger_workflow/VTWorkflowManager.inc index 6766a56b3..276150c4c 100644 --- a/modules/com_vtiger_workflow/VTWorkflowManager.inc +++ b/modules/com_vtiger_workflow/VTWorkflowManager.inc @@ -354,6 +354,10 @@ class Workflow{ $this->conditionStrategy = new VTJsonCondition(); } + function __get($name) { + return property_exists($this, $name) ? $this->$name : null; + } + function setup($row) { $this->id = $row['workflow_id']; $this->moduleName = $row['module_name']; diff --git a/vtlib/Vtiger/FieldBasic.php b/vtlib/Vtiger/FieldBasic.php index 4423a0445..ab6c4425f 100644 --- a/vtlib/Vtiger/FieldBasic.php +++ b/vtlib/Vtiger/FieldBasic.php @@ -56,6 +56,8 @@ class Vtiger_FieldBasic { * @access private */ function initialize($valuemap, $moduleInstance=false, $blockInstance=false) { + $valuemap = vtlib_array($valuemap); + $this->id = $valuemap['fieldid']; $this->name = $valuemap['fieldname']; $this->label= $valuemap['fieldlabel']; diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index e937992e7..e8690dce7 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -463,9 +463,11 @@ class Vtiger_Functions { while ($row = $adb->fetch_array($result)) { $moduleFieldInfo[$module][$row['fieldname']] = $row; } - Vtiger_Cache::set('ModuleFieldInfo',$module,$moduleFieldInfo[$module]); + if (isset($moduleFieldInfo[$module])) { + Vtiger_Cache::set('ModuleFieldInfo',$module,$moduleFieldInfo[$module]); + } } - return $moduleFieldInfo[$module] ? $moduleFieldInfo[$module] : NULL; + return isset($moduleFieldInfo[$module]) ? $moduleFieldInfo[$module] : NULL; } static function getModuleFieldInfoWithId($fieldid) { diff --git a/vtlib/Vtiger/LanguageImport.php b/vtlib/Vtiger/LanguageImport.php index 447995c02..90b7b5275 100644 --- a/vtlib/Vtiger/LanguageImport.php +++ b/vtlib/Vtiger/LanguageImport.php @@ -127,7 +127,9 @@ class Vtiger_LanguageImport extends Vtiger_LanguageExport { // vtiger6 format if ($vtiger6format) { $targetdir = "languages/$prefix/" . str_replace("modules", "", $targetdir); - @mkdir($targetdir, 0777, true); + if (!file_exists($targetdir)) { + mkdir($targetdir, 0777, true); + } } if($unzip->unzip($filename, "$targetdir/$targetfile") !== false) { @@ -148,4 +150,4 @@ class Vtiger_LanguageImport extends Vtiger_LanguageExport { return; } -} \ No newline at end of file +} diff --git a/vtlib/Vtiger/PackageImport.php b/vtlib/Vtiger/PackageImport.php index 51a2aa9b5..3ab7b0c40 100644 --- a/vtlib/Vtiger/PackageImport.php +++ b/vtlib/Vtiger/PackageImport.php @@ -186,6 +186,7 @@ class Vtiger_PackageImport extends Vtiger_PackageExport { $languagefile_found = false; $layoutfile_found = false; $vtigerversion_found = false; + $extensionfile_found = false; $modulename = null; $language_modulename = null; diff --git a/vtlib/Vtiger/Unzip.php b/vtlib/Vtiger/Unzip.php index e2b212077..a11a93afe 100644 --- a/vtlib/Vtiger/Unzip.php +++ b/vtlib/Vtiger/Unzip.php @@ -63,7 +63,7 @@ class Vtiger_Unzip extends dUnzip2 { * DEFAULT: If include is specified only files under the specified path will be included. * If exclude is specified folders or files will be excluded. */ - if($includeExclude === false) $includeExclude = Array(); + $includeExclude = vtlib_array($includeExclude); $lista = $this->getList(); if(sizeof($lista)) foreach($lista as $fileName=>$trash){ diff --git a/vtlib/Vtiger/Utils/GuardedArray.php b/vtlib/Vtiger/Utils/GuardedArray.php index f522a0141..d32b0bcf2 100644 --- a/vtlib/Vtiger/Utils/GuardedArray.php +++ b/vtlib/Vtiger/Utils/GuardedArray.php @@ -12,7 +12,7 @@ class Vtiger_GuardedArray implements \ArrayAccess { private $data; function __construct($data = null) { - $this->data = is_null($data) ? array() : $data; + $this->data = is_null($data) || $data === false ? array() : $data; } function offsetExists($key) { @@ -33,4 +33,4 @@ class Vtiger_GuardedArray implements \ArrayAccess { function offsetUnset($key) { unset($this->data[$key]); } -} \ No newline at end of file +} -- GitLab