diff --git a/include/ComboStrings.php b/include/ComboStrings.php index a88f30444f7158d59e2290d21a319f8b2ea00fb0..dcf07af5f2e4d225e67b2d752780e20ade656e97 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 254fe9abc2974f6cef876173743c847296b63beb..06a705b891fbbba34c333c95bf7ba701084df4b3 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 c2271e765c6aa0c92341b7a3e4da3a8174cea630..59876ddfd84e4a5fdb64324aef93041bdbb07aad 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 824dcb960f97dba1c2d4b088159de4e4d879df70..c01212aebd4cf26b9fe10ef6a4aae47124c2038b 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 7af7d61939a520463751c37f6d4db076f83428f2..ed1e014492dc88186c74193a7a165606468b8f3f 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 dc6157e49a119cffadce326d01525ebbde96b44d..4ff2d1472c9a98634a3dabf0a370f5e548175a14 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 252ff82ddffea3c904d7aa8d9510adad8a0d603f..8462a16928a4ca8170a0177db77c669f25e597c6 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 d048909f4299812fc2e5a43129018382b39c96cf..7c18c3760c83993e8c9d3d09a3b0210f5d8bc4cd 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 f39629134b5dce62b06b60b1372d1f991f2e127c..f4166cbd5bae3eb305a7f594ae53669e3bf38d1d 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 6766a56b322c78ba38552a5f720185604534c8c1..276150c4c46bb74e7f32317e0b570d4ab2fb52d7 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 4423a0445c1b0539589e4c741725733d3f84250c..ab6c4425f63867fe68926c7d1940926c5ca89e82 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 e937992e728caa33639cc27f967819c748eb2743..e8690dce77e425793f928dd4be9d224106466d48 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 447995c02e0c112e9c7e51039a9c11a6537e66ea..90b7b52752e625eaf7ad38777d56b69e82a1f2d9 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 51a2aa9b54d04d620dab8c5f1b9da361fc1d1c9e..3ab7b0c40d7dbaebec0c6985dcb5361ceeb18039 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 e2b212077c084e3060c907225064678de762ac6c..a11a93afe6fd10752c29854730b95740a5455cb7 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 f522a01418bf56084dbde5f5b762c6710e08fbd8..d32b0bcf2656d6133b31aa264a10437577274e31 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 +}