diff --git a/config_override.dev.php b/config_override.dev.php new file mode 100644 index 0000000000000000000000000000000000000000..72a8ae5f710660ec4f1daf26016d1d6af4496249 --- /dev/null +++ b/config_override.dev.php @@ -0,0 +1,5 @@ +<?php + +/** Logging configuration for Strict Development */ +require_once "vtlib/Vtiger/Utils/PhpLogHandler.php"; +Vtiger_PhpLogHandler::enableStrictLogging(__DIR__, "logs/phperr.log"); diff --git a/data/CRMEntity.php b/data/CRMEntity.php index b55f9180350c0045eaa1ce65f4d7394ebeadf5d8..469dae8ed1fd3737b7f81364e380934dd1415e1b 100644 --- a/data/CRMEntity.php +++ b/data/CRMEntity.php @@ -28,6 +28,7 @@ require_once('include/utils/UserInfoUtil.php'); require_once("include/Zend/Json.php"); require_once 'include/RelatedListView.php'; +#[\AllowDynamicProperties] class CRMEntity { var $ownedby; @@ -665,7 +666,7 @@ class CRMEntity { $skipUpdateForField = true; } } - if (($insertion_mode == 'edit' && $skipUpdateForField == false) || $_REQUEST['imgDeleted']) { + if (($insertion_mode == 'edit' && $skipUpdateForField == false) || (isset($_REQUEST['imgDeleted']) && $_REQUEST['imgDeleted'])) { $skipUpdateForField = false; $uploadedFileNames = array(); $getImageNamesSql = 'SELECT name FROM vtiger_seattachmentsrel INNER JOIN vtiger_attachments ON @@ -3116,6 +3117,7 @@ class CRMEntity { } } +#[\AllowDynamicProperties] class TrackableObject implements ArrayAccess, IteratorAggregate { private $storage; private $trackingEnabled = true; @@ -3125,10 +3127,12 @@ class TrackableObject implements ArrayAccess, IteratorAggregate { $this->storage = $value; } + #[\ReturnTypeWillChange] function offsetExists($key) { return isset($this->storage[$key]) || array_key_exists($key, $this->storage); } + #[\ReturnTypeWillChange] function offsetSet($key, $value) { if(is_array($value)) $value = empty($value) ? "" : $value[0]; if($this->tracking && $this->trackingEnabled) { @@ -3143,14 +3147,17 @@ class TrackableObject implements ArrayAccess, IteratorAggregate { $this->storage[$key] = $value; } + #[\ReturnTypeWillChange] public function offsetUnset($key) { unset($this->storage[$key]); } + #[\ReturnTypeWillChange] public function offsetGet($key) { return isset($this->storage[$key]) || array_key_exists($key, $this->storage) ? $this->storage[$key] : null; } + #[\ReturnTypeWillChange] public function getIterator() { $iterator = new ArrayObject($this->storage); return $iterator->getIterator(); 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/ListView/ListViewSession.php b/include/ListView/ListViewSession.php index f6a3d8fe40a3d9d9c972f3df16302456535173d8..7653e3ec63950907d09ca2a9b700342090aa47b7 100644 --- a/include/ListView/ListViewSession.php +++ b/include/ListView/ListViewSession.php @@ -166,7 +166,7 @@ class ListViewSession { $recordNavigationInfo = array(); if($searchKey !== false){ foreach ($navigationRecordList as $index => $recordId) { - if(!is_array($recordNavigationInfo[$current])){ + if(!isset($recordNavigationInfo[$current])){ $recordNavigationInfo[$current] = array(); } if($index == $firstPageRecordCount || $index == ($firstPageRecordCount+$pageCount * $list_max_entries_per_page)){ @@ -248,4 +248,4 @@ class ListViewSession { } } } -?> \ No newline at end of file +?> diff --git a/include/QueryGenerator/QueryGenerator.php b/include/QueryGenerator/QueryGenerator.php index 2e102314dbcb4192a96665d244ff913774df9f73..649312e74e04fbbced76bd544c26342447fd0885 100644 --- a/include/QueryGenerator/QueryGenerator.php +++ b/include/QueryGenerator/QueryGenerator.php @@ -19,6 +19,7 @@ require_once 'include/Webservices/RelatedModuleMeta.php'; * * @author MAK */ +#[\AllowDynamicProperties] class QueryGenerator { protected $module; protected $customViewColumnList; diff --git a/include/Webservices/DataTransform.php b/include/Webservices/DataTransform.php index 903c78f73c485fb0edee019b49612924694f2ca6..26460990fe7399a81dfad1a67e461e69de832076 100644 --- a/include/Webservices/DataTransform.php +++ b/include/Webservices/DataTransform.php @@ -198,7 +198,7 @@ } foreach ($row as $field => $value) { - $row[$field] = html_entity_decode($value, ENT_QUOTES, $default_charset); + $row[$field] = $value ? html_entity_decode($value, ENT_QUOTES, $default_charset) : $value; } return $row; } diff --git a/include/Webservices/Utils.php b/include/Webservices/Utils.php index 06c4665079f7ddf05cfce3c688ba15b9dc361a85..2b0a1f529b2fb7a7817e063f01b78b40a159adbd 100644 --- a/include/Webservices/Utils.php +++ b/include/Webservices/Utils.php @@ -57,7 +57,7 @@ function vtws_generateRandomAccessKey($length=10){ $accesskey = ""; $maxIndex = strlen($source); for($i=0;$i<$length;++$i){ - $accesskey = $accesskey.substr($source,rand(null,$maxIndex),1); + $accesskey = $accesskey.substr($source,rand(0,$maxIndex),1); } return $accesskey; } @@ -1316,4 +1316,4 @@ function vtws_getAttachmentRecordId($attachmentId) { } return $crmid; } -?> \ No newline at end of file +?> diff --git a/include/Webservices/VTQL_Parser.php b/include/Webservices/VTQL_Parser.php index 03d8d2b579709f372449fc585cc1a9a7a255d03f..e970ebccecc261f7f953a47a56a4e8bad7cdea6d 100644 --- a/include/Webservices/VTQL_Parser.php +++ b/include/Webservices/VTQL_Parser.php @@ -33,16 +33,19 @@ class VTQL_ParseryyToken implements ArrayAccess return $this->_string; } + #[\ReturnTypeWillChange] function offsetExists($offset) { return isset($this->metadata[$offset]); } + #[\ReturnTypeWillChange] function offsetGet($offset) { return $this->metadata[$offset]; } + #[\ReturnTypeWillChange] function offsetSet($offset, $value) { if ($offset === null) { @@ -66,6 +69,7 @@ class VTQL_ParseryyToken implements ArrayAccess } } + #[\ReturnTypeWillChange] function offsetUnset($offset) { unset($this->metadata[$offset]); diff --git a/include/Webservices/VtigerCRMObjectMeta.php b/include/Webservices/VtigerCRMObjectMeta.php index 017ce1e61bae55ad28b6fd075ceac8ec918e1888..b583b2876d71599d749595ace0da51c548e341b4 100644 --- a/include/Webservices/VtigerCRMObjectMeta.php +++ b/include/Webservices/VtigerCRMObjectMeta.php @@ -371,7 +371,7 @@ class VtigerCRMObjectMeta extends EntityMeta { require_once('modules/CustomView/CustomView.php'); $current_user = vtws_preserveGlobal('current_user',$this->user); - $theme = vtws_preserveGlobal('theme',$this->user->theme); + $theme = vtws_preserveGlobal('theme', isset($this->user->theme) ? $this->user->theme : ""); $default_language = VTWS_PreserveGlobal::getGlobal('default_language'); global $current_language; if(empty($current_language)) $current_language = $default_language; diff --git a/include/Webservices/WebserviceField.php b/include/Webservices/WebserviceField.php index 58018452be69871808dbcb971fc6de36f8952682..d7c4dc921a39d5521aac1129cd87f70fedf06e59 100644 --- a/include/Webservices/WebserviceField.php +++ b/include/Webservices/WebserviceField.php @@ -11,6 +11,7 @@ require_once 'includes/runtime/Cache.php'; require_once 'vtlib/Vtiger/Runtime.php'; +#[\AllowDynamicProperties] class WebserviceField{ private $fieldId; private $uitype; @@ -62,7 +63,7 @@ class WebserviceField{ $this->isunique = isset($row['isunique']) && $row['isunique'] ? true : false; $typeOfData = isset($row['typeofdata'])? $row['typeofdata'] : null; $this->typeOfData = $typeOfData; - $typeOfData = explode("~",$typeOfData); + $typeOfData = explode("~",$typeOfData ? $typeOfData : ""); $this->mandatory = (php7_count($typeOfData) > 1 && $typeOfData[1] == 'M')? true: false; if($this->uitype == 4){ $this->mandatory = false; @@ -429,4 +430,4 @@ class WebserviceField{ } -?> \ No newline at end of file +?> diff --git a/include/Zend/Json.php b/include/Zend/Json.php index df1dda76c8b07941e46cf1b3f0b9ce4556485aa1..cd2a54fd4b33ab8ed0738f4e4060edb48c646b6f 100644 --- a/include/Zend/Json.php +++ b/include/Zend/Json.php @@ -56,7 +56,7 @@ class Zend_Json public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE_ARRAY) { if (function_exists('json_decode') && self::$useBuiltinEncoderDecoder !== true) { - return json_decode($encodedValue, $objectDecodeType); + return $encodedValue != null ? json_decode($encodedValue, $objectDecodeType) : $encodedValue; } require_once 'include/Zend/Json/Decoder.php'; diff --git a/include/Zend/Json/Decoder.php b/include/Zend/Json/Decoder.php index cc7a1f834c4254ccd805b53bcf8de8abe41c4dd6..0597a568cb61bd0f80965788d67a4a9b92478e9d 100644 --- a/include/Zend/Json/Decoder.php +++ b/include/Zend/Json/Decoder.php @@ -37,6 +37,8 @@ require_once 'include/Zend/Json/Exception.php'; * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ + +#[\AllowDynamicProperties] class Zend_Json_Decoder { /** diff --git a/include/database/PearDatabase.php b/include/database/PearDatabase.php index f81d7911e4b5d5bfb7b66e508f7a4f9eae1717eb..dee0f71f797f8ab0029cc8eae040841c5a4215ea 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; @@ -950,7 +950,7 @@ class PearDatabase{ $schema = new adoSchema( $db ); //Debug Adodb XML Schema - $schema->XMLS_DEBUG = TRUE; + // $schema->XMLS_DEBUG = TRUE; // adoSchema does not support AllowDynamicProperties //Debug Adodb $schema->debug = true; $sql = $schema->ParseSchema( $schemaFile ); diff --git a/include/events/SqlResultIterator.inc b/include/events/SqlResultIterator.inc index bb9362ac2c1be43376766877e7eabcbb322d19c4..490b238011d670e922c16c89b8fc4bdbb02856bc 100644 --- a/include/events/SqlResultIterator.inc +++ b/include/events/SqlResultIterator.inc @@ -8,32 +8,42 @@ * All Rights Reserved. *************************************************************************************/ + #[\AllowDynamicProperties] class SqlResultIterator implements Iterator{ + var $result; + var $adb; + var $pos; + function __construct($adb, $result){ $this->result = $result; $this->adb = $adb; $this->pos = 0; } + #[\ReturnTypeWillChange] public function rewind(){ $this->pos = 0; } + #[\ReturnTypeWillChange] function valid(){ $adb = $this->adb; return $this->pos < $adb->num_rows($this->result); } + #[\ReturnTypeWillChange] public function next(){ $this->pos+=1; } + #[\ReturnTypeWillChange] public function current(){ $adb = $this->adb; $data = $adb->raw_query_result_rowdata($this->result, $this->pos); return new SqlResultIteratorRow($data); } + #[\ReturnTypeWillChange] public function key(){ return $this->pos; } @@ -74,6 +84,8 @@ } class SqlResultIteratorRow{ + var $data; + function __construct($data){ $this->data = $data; } diff --git a/include/events/VTEntityData.inc b/include/events/VTEntityData.inc index 853dbb7856fc86fc121a967cff9be072ecf10d41..8a87e4e0f0f1200c77550f3e57996229db00fe5e 100644 --- a/include/events/VTEntityData.inc +++ b/include/events/VTEntityData.inc @@ -11,6 +11,7 @@ /** * A wrapper around CRMEntity instances */ +#[\AllowDynamicProperties] class VTEntityData{ private $isNew = false; diff --git a/include/events/VTEventCondition.php b/include/events/VTEventCondition.php index e16766401549c48fe3b91bd38a6c8542c399fb07..40c8c74d2438253138615d23b6e8734837cba64b 100644 --- a/include/events/VTEventCondition.php +++ b/include/events/VTEventCondition.php @@ -8,6 +8,7 @@ * All Rights Reserved. *************************************************************************************/ + #[\AllowDynamicProperties] class VTEventCondition{ function __construct($expr){ if($expr!=''){ @@ -79,4 +80,4 @@ } } -?> \ No newline at end of file +?> diff --git a/include/events/VTEventHandler.inc b/include/events/VTEventHandler.inc index 874f64b9f9c5acdd50b5bb4e860eca96d4cf97b3..9caa0e50a7475dba9dcd3a2cafea1fbed2125051 100644 --- a/include/events/VTEventHandler.inc +++ b/include/events/VTEventHandler.inc @@ -8,7 +8,8 @@ * All Rights Reserved. *************************************************************************************/ + #[\AllowDynamicProperties] abstract class VTEventHandler{ public abstract function handleEvent($name, $data); } -?> \ No newline at end of file +?> diff --git a/include/events/VTEventTrigger.inc b/include/events/VTEventTrigger.inc index e5456154898e7fb8d3ca17bd645b97ae409cd5c4..09545ae1056118a0c3627eda48781411142aa7a5 100644 --- a/include/events/VTEventTrigger.inc +++ b/include/events/VTEventTrigger.inc @@ -9,6 +9,8 @@ *************************************************************************************/ require_once 'include/events/VTBatchEventTrigger.inc'; require_once("include/events/SqlResultIterator.inc"); + + #[\AllowDynamicProperties] class VTEventTrigger{ /* EventTrigger cache management */ @@ -168,4 +170,4 @@ return new self($adb, $triggerName); } } -?> \ No newline at end of file +?> diff --git a/include/events/VTEventsManager.inc b/include/events/VTEventsManager.inc index fc9a5a98c57f3d46c63555d1a08c6fbc69a9818a..719b1d767e5b91885f5a5346409753f71fa4eade 100644 --- a/include/events/VTEventsManager.inc +++ b/include/events/VTEventsManager.inc @@ -12,6 +12,8 @@ * Create and trigger events in vtiger */ class VTEventsManager{ + var $adb; + function __construct($adb){ $this->adb = $adb; } diff --git a/include/fields/CurrencyField.php b/include/fields/CurrencyField.php index 46114dc612142677eee91cb3c034f757778b3caf..294438a77efaaac85382768bacc8b5a88feb36f2 100644 --- a/include/fields/CurrencyField.php +++ b/include/fields/CurrencyField.php @@ -447,7 +447,7 @@ class CurrencyField { $decimalSeparator = $user->currency_decimal_separator; } - $fieldValue = explode(decode_html($decimalSeparator), $value); + $fieldValue = vtlib_array(explode(decode_html($decimalSeparator), $value)); if(strlen($fieldValue[1]) <= 1){ if(strlen($fieldValue[1]) == 1) { return $value = $fieldValue[0].$decimalSeparator.$fieldValue[1]; diff --git a/include/fields/DateTimeField.php b/include/fields/DateTimeField.php index a3d3678b9bf0faf3fb7cbfaca15131cb5ea33fd7..21f4d2de793e43b0c9b2a75911e16c9c27b9dbd3 100644 --- a/include/fields/DateTimeField.php +++ b/include/fields/DateTimeField.php @@ -13,6 +13,8 @@ class DateTimeField { static protected $databaseTimeZone = null; protected $datetime; + protected $date; + protected $time; private static $cache = array(); /** @@ -84,7 +86,7 @@ class DateTimeField { $user = $current_user; } - $format = $current_user->date_format; + $format = isset($current_user->date_format)? $current_user->date_format : ""; if (empty($format)) { if (false === strpos($date, '-')) { if(false === strpos($date, '.')){ @@ -173,7 +175,7 @@ class DateTimeField { if(empty($user)) { $user = $current_user; } - $format = $user->date_format; + $format = isset($user->date_format) ? $user->date_format : ""; if(empty($format)) { $format = 'dd-mm-yyyy'; } @@ -354,7 +356,7 @@ class DateTimeField { if(empty($user)) { $user = $current_user; } - return str_replace(array('yyyy', 'mm','dd'), array('Y', 'm', 'd'), $user->date_format); + return str_replace(array('yyyy', 'mm','dd'), array('Y', 'm', 'd'), isset($user->date_format)? $user->date_format : ""); } private static function sanitizeDate($value, $user) { @@ -369,7 +371,7 @@ class DateTimeField { $time = false; /* If date-value is other than yyyy-mm-dd */ - if(strpos($value, "-") < 4 && $user->date_format) { + if(strpos($value, "-") < 4 && isset($user->date_format) && $user->date_format) { list($date, $time) = explode(' ', $value); if(!empty($date)) { switch ($user->date_format) { diff --git a/include/utils/ConfigReader.php b/include/utils/ConfigReader.php index f97dcbdc97a078178924ca9c13412149debc76a9..efb99edc0512cf3224567c52d95c3b81fb6ecd53 100644 --- a/include/utils/ConfigReader.php +++ b/include/utils/ConfigReader.php @@ -24,7 +24,7 @@ class ConfigReader { function load($path, $name, $force = false) { $this->name = $path; - if(!$force && isset(self::$propertiesCache) && self::$propertiesCache[$path]) { + if(!$force && isset(self::$propertiesCache) && isset(self::$propertiesCache[$path]) && self::$propertiesCache[$path]) { $this->properties = self::$propertiesCache[$path]; return; } @@ -46,4 +46,4 @@ class ConfigReader { } } -?> \ No newline at end of file +?> diff --git a/include/utils/ListViewUtils.php b/include/utils/ListViewUtils.php index 027c71a0d9487391192fa1c2af49933c73dcba1a..3ea02a3d5e8f5fc61a4ef0885046b210a3719081 100755 --- a/include/utils/ListViewUtils.php +++ b/include/utils/ListViewUtils.php @@ -678,8 +678,10 @@ function decode_html($str) { // Direct Popup action or Ajax Popup action should be treated the same. if ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'Popup') || (isset($_REQUEST['file']) && $_REQUEST['file'] == 'Popup')) return html_entity_decode($str); - else + else if ($str) return html_entity_decode($str, ENT_QUOTES, $default_charset); + else + return $str; } function popup_decode_html($str) { diff --git a/include/utils/UserInfoUtil.php b/include/utils/UserInfoUtil.php index b66edb0a90df16a5f08f4ac752a37d907b48e830..09e84bbdf83b02e8be42f059caa88e7786a235db 100755 --- a/include/utils/UserInfoUtil.php +++ b/include/utils/UserInfoUtil.php @@ -1054,8 +1054,9 @@ function getRoleInformation($roleid) $rolename=$adb->query_result($result,0,'rolename'); $parentrole=$adb->query_result($result,0,'parentrole'); $roledepth=$adb->query_result($result,0,'depth'); - $parentRoleArr=explode('::',$parentrole); - $immediateParent=$parentRoleArr[php7_sizeof($parentRoleArr)-2]; + $parentRoleArr=explode('::',$parentrole ? $parentrole:''); + $parentRoleArrLen=php7_sizeof($parentRoleArr); + $immediateParent=$parentRoleArrLen>=2 ? $parentRoleArr[$parentRoleArrLen-2]:null; $roleDet=Array(); $roleDet[]=$rolename; $roleDet[]=$parentrole; @@ -1458,8 +1459,11 @@ function getCombinedUserGlobalPermissions($userId) $no_of_profiles=php7_sizeof($profArr); $userGlobalPerrArr=Array(); - $userGlobalPerrArr=getProfileGlobalPermission($profArr[0]); - if($no_of_profiles != 1) + if($no_of_profiles) { + $userGlobalPerrArr=getProfileGlobalPermission($profArr[0]); + } + + if($no_of_profiles > 1) { for($i=1;$i<$no_of_profiles;$i++) { @@ -1593,7 +1597,7 @@ function getParentRole($roleId) $log->debug("Entering getParentRole(".$roleId.") method ..."); $roleInfo=getRoleInformation($roleId); $parentRole=$roleInfo[$roleId][1]; - $tempParentRoleArr=explode('::',$parentRole); + $tempParentRoleArr=explode('::',$parentRole?$parentRole:''); $parentRoleArr=Array(); foreach($tempParentRoleArr as $role_id) { @@ -2319,4 +2323,4 @@ function appendFromClauseToQuery($query,$fromClause) { return $query; } -?> \ No newline at end of file +?> diff --git a/include/utils/VTCacheUtils.php b/include/utils/VTCacheUtils.php index 7974ec1a85f311b1dce02ddba61e041a8da78525..1134965ef0e07ccf5efc074a79b2eec284b09d77 100644 --- a/include/utils/VTCacheUtils.php +++ b/include/utils/VTCacheUtils.php @@ -131,6 +131,7 @@ class VTCacheUtils { if(!$modulefields){ $fieldInfo = Vtiger_Cache::get('ModuleFields',$tabid); if($fieldInfo){ + $modulefields = array(); foreach($fieldInfo as $block => $blockFields){ foreach ($blockFields as $field){ if(in_array($field->get('presence'), $presencein)) { @@ -461,4 +462,4 @@ class VTCacheUtils { } } -?> \ No newline at end of file +?> diff --git a/include/utils/VtlibUtils.php b/include/utils/VtlibUtils.php index cc65a9ba6a8a8e1053ce4eab376899cd5bba25a1..06e20bfd7f3cb323625a51db7dd988e76c295fc5 100644 --- a/include/utils/VtlibUtils.php +++ b/include/utils/VtlibUtils.php @@ -103,8 +103,8 @@ function vtlib_isModuleActive($module) { if(!isset($__cache_module_activeinfo[$module])) { include 'tabdata.php'; - $tabId = $tab_info_array[$module]; - $presence = $tab_seq_array[$tabId]; + $tabId = vtlib_array($tab_info_array)[$module]; + $presence = vtlib_array($tab_seq_array)[$tabId]; $__cache_module_activeinfo[$module] = $presence; } else { $presence = $__cache_module_activeinfo[$module]; @@ -672,7 +672,7 @@ function vtlib_purify($input, $ignore = false) { $value = $input; if (!is_array($input)) { - $md5OfInput = md5($input); + $md5OfInput = md5($input ? $input : ""); if (array_key_exists($md5OfInput, $purified_cache)) { $value = $purified_cache[$md5OfInput]; //to escape cleaning up again @@ -722,7 +722,9 @@ function vtlib_purify($input, $ignore = false) { $value = purifyHtmlEventAttributes($value, true); } } - $purified_cache[$md5OfInput] = $value; + if (isset($md5OfInput)) { + $purified_cache[$md5OfInput] = $value; + } } if(is_array($value)) { @@ -992,6 +994,14 @@ function vtlib_addSettingsLink($linkName, $linkURL, $blockName = false) { return $success; } +/** + * PHP Strict helpers. + */ +require_once "vtlib/Vtiger/Utils/GuardedArray.php"; +function vtlib_array($data = null) { + return new Vtiger_GuardedArray($data); +} + /** * PHP7 support for split function * split : Case sensitive. @@ -1033,4 +1043,12 @@ function php7_sizeof($value) { return php7_count($value); } -?> +function php7_trim($str) { + // PHP 8.x marks as deprecated + return $str == null ? $str : trim($str); +} + +function php7_htmlentities($str) { + // PHP 8.x marks as deprecated + return $str == null ? $str : htmlentities($str); +} diff --git a/include/utils/utils.php b/include/utils/utils.php index e3272830b6a573d6931f8eb479e517f3773c649e..c7e28588e12599457d08ee9ca672dcb68a2d6023 100755 --- a/include/utils/utils.php +++ b/include/utils/utils.php @@ -337,7 +337,7 @@ function decide_to_html() { global $doconvert, $inUTF8, $default_charset; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; - $inUTF8 = (strtoupper($default_charset) == 'UTF-8'); + $inUTF8 = (strtoupper($default_charset ? $default_charset : "") == 'UTF-8'); $doconvert = true; if ($action == 'ExportData') { @@ -1795,6 +1795,8 @@ function getValidDBInsertDateValue($value) { global $log; $log->debug("Entering getValidDBInsertDateValue(".$value.") method ..."); $value = trim($value); + if (empty($value)) return null; + $delim = array('/','.'); foreach ($delim as $delimiter){ $x = strpos($value, $delimiter); @@ -2022,9 +2024,9 @@ function getCurrencyDecimalPlaces($user = null) { global $current_user; $currency_decimal_places = 2; - if (!empty($user)) { + if (!empty($user) && isset($user->no_of_currency_decimals)) { $currency_decimal_places = $user->no_of_currency_decimals; - } else if ($current_user) { + } else if ($current_user && isset($current_user->no_of_currency_decimals)) { $currency_decimal_places = $current_user->no_of_currency_decimals; } return (int)$currency_decimal_places; diff --git a/includes/runtime/BaseModel.php b/includes/runtime/BaseModel.php index 8493b73d97ec9e9d17e738838c2725bd15bc982d..08f7b2e93407ed717aa82414df6293426cdba84a 100644 --- a/includes/runtime/BaseModel.php +++ b/includes/runtime/BaseModel.php @@ -11,6 +11,7 @@ /** * Base Model Class */ +#[\AllowDynamicProperties] class Vtiger_Base_Model { protected $valueMap; @@ -84,7 +85,7 @@ class Vtiger_Base_Model { * @param String $key */ public function has($key) { - return array_key_exists($key, $this->valueMap); + return array_key_exists($key, (array)$this->valueMap); // valueMap can be array or TrackableObject } /** @@ -95,4 +96,4 @@ class Vtiger_Base_Model { return (!isset($this->valueMap[$key]) || empty($this->valueMap[$key])); } -} \ No newline at end of file +} diff --git a/includes/runtime/Controller.php b/includes/runtime/Controller.php index 2b80dfa254004586c80c125a16b1fdc4aa1fecbc..760ca75ff24ac9f0638d6beb8d92502c5c8625c2 100644 --- a/includes/runtime/Controller.php +++ b/includes/runtime/Controller.php @@ -11,6 +11,7 @@ /** * Abstract Controller Class */ +#[\AllowDynamicProperties] abstract class Vtiger_Controller { function __construct() { } @@ -227,6 +228,11 @@ abstract class Vtiger_View_Controller extends Vtiger_Action_Controller { // Popupview $viewer->assign('IS_MODULE_DISABLED', false); + + // Widgets + $viewer->assign('SCRIPTS', array()); + $viewer->assign('STYLES', array()); + $viewer->assign('SETTING_EXIST', false); } return $this->viewer; } diff --git a/includes/runtime/Viewer.php b/includes/runtime/Viewer.php index 45b490ba1315a989ebc60e2a1a17e8d295f7adb3..9c64e39d349d56bad69888c7f81664271a341035 100644 --- a/includes/runtime/Viewer.php +++ b/includes/runtime/Viewer.php @@ -70,6 +70,30 @@ class Vtiger_Viewer extends Smarty { $this->log("URI: $debugViewerURI, TYPE: " . $_SERVER['REQUEST_METHOD']); } + + $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', + 'Vtiger_Theme', 'Users_Record_Model', 'Vtiger_Module_Model', 'Vtiger_Field_Model', + 'Settings_Picklist_Module_Model', 'CustomView_Record_Model', 'Vtiger_Extension_View', + 'Vtiger_Tag_Model', + 'Vtiger_Functions', 'Users', 'CurrencyField'); + foreach ($classes as $clazz) { + if (class_exists($clazz)) { + $this->registerClass($clazz, $clazz); + } + } + + $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', 'function_exists', 'php7_trim', 'php7_htmlentities', + 'strtolower', 'strtoupper', 'str_replace', 'urlencode', 'getTranslatedCurrencyString', 'getTranslatedString', 'is_object', 'is_numeric'); + foreach ($modifiers as $modifier) { + if (function_exists($modifier)) { + $this->registerPlugin('modifier', $modifier, $modifier); + } + } } // Backward compatible to SmartyBC diff --git a/includes/runtime/cache/Connectors.php b/includes/runtime/cache/Connectors.php index 98005e43181cfb2907c1d567e596478564496b09..683ff533fdada9a1c6b7a9f60af9f124d0b3f1b2 100644 --- a/includes/runtime/cache/Connectors.php +++ b/includes/runtime/cache/Connectors.php @@ -8,6 +8,7 @@ * All Rights Reserved. *************************************************************************************/ +#[\AllowDynamicProperties] class Vtiger_Cache_Connector_Memory { function set($key, $value) { $this->$key = $value; diff --git a/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl b/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl index 8ba31e8f28cd35375ba13b7fc8790695aec36c81..d53a45072ea6771f12db6ad5b29edd59fba86f6e 100644 --- a/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/OwnerFieldSearchView.tpl @@ -10,7 +10,7 @@ ********************************************************************************/ -->*} {strip} - {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()} + {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()|vtlib_array} <div class="select2_search_div"> {assign var=ASSIGNED_USER_ID value=$FIELD_MODEL->get('name')} {assign var=ALL_ACTIVEUSER_LIST value=$FIELD_INFO['picklistvalues'][vtranslate('LBL_USERS')]} @@ -49,4 +49,4 @@ {/if} </select> </div> -{/strip} \ No newline at end of file +{/strip} diff --git a/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl b/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl index e5a4898804d02b88764e3c7f88ec9686c22ca6a0..4a32603065f8238a958cafe6b5c9865651030979 100644 --- a/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/Picklist.tpl @@ -21,7 +21,7 @@ {if $FIELD_MODEL->isEmptyPicklistOptionAllowed()}<option value="">{vtranslate('LBL_SELECT_OPTION','Vtiger')}</option>{/if} {foreach item=PICKLIST_VALUE key=PICKLIST_NAME from=$PICKLIST_VALUES} {assign var=CLASS_NAME value="picklistColor_{$FIELD_MODEL->getFieldName()}_{$PICKLIST_NAME|replace:' ':'_'}"} - <option value="{Vtiger_Util_Helper::toSafeHTML($PICKLIST_NAME)}" {if isset($PICKLIST_COLORS[$PICKLIST_NAME]) && $PICKLIST_COLORS[$PICKLIST_NAME]}class="{$CLASS_NAME}"{/if} {if trim(decode_html($FIELD_MODEL->get('fieldvalue'))) eq trim($PICKLIST_NAME)} selected {/if}>{$PICKLIST_VALUE}</option> + <option value="{Vtiger_Util_Helper::toSafeHTML($PICKLIST_NAME)}" {if isset($PICKLIST_COLORS[$PICKLIST_NAME]) && $PICKLIST_COLORS[$PICKLIST_NAME]}class="{$CLASS_NAME}"{/if} {if php7_trim(decode_html($FIELD_MODEL->get('fieldvalue'))) eq php7_trim($PICKLIST_NAME)} selected {/if}>{$PICKLIST_VALUE}</option> {/foreach} </select> {if $PICKLIST_COLORS} diff --git a/layouts/v7/modules/Vtiger/uitypes/String.tpl b/layouts/v7/modules/Vtiger/uitypes/String.tpl index 0715088c31873131da5fdd3468be3f66c44fe27f..9ec1f6bea6865e942c03a9f0b8f7f2d158dac0b3 100644 --- a/layouts/v7/modules/Vtiger/uitypes/String.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/String.tpl @@ -16,7 +16,7 @@ {if (!$FIELD_NAME)} {assign var="FIELD_NAME" value=$FIELD_MODEL->getFieldName()} {/if} - <input id="{$MODULE}_editView_fieldName_{$FIELD_NAME}" type="text" data-fieldname="{$FIELD_NAME}" data-fieldtype="string" class="inputElement {if $FIELD_MODEL->isNameField()}nameField{/if}" name="{$FIELD_NAME}" value="{decode_html($FIELD_MODEL->get('fieldvalue'))|htmlentities}" + <input id="{$MODULE}_editView_fieldName_{$FIELD_NAME}" type="text" data-fieldname="{$FIELD_NAME}" data-fieldtype="string" class="inputElement {if $FIELD_MODEL->isNameField()}nameField{/if}" name="{$FIELD_NAME}" value="{decode_html($FIELD_MODEL->get('fieldvalue'))|php7_htmlentities}" {if $FIELD_MODEL->get('uitype') eq '3' || $FIELD_MODEL->get('uitype') eq '4'|| $FIELD_MODEL->isReadOnly()} {if $FIELD_MODEL->get('uitype') neq '106'} readonly diff --git a/libraries/adodb_vtigerfix/adodb-errorhandler.inc.php b/libraries/adodb_vtigerfix/adodb-errorhandler.inc.php index 0cd3f218b4ba37b216e124e035e1a69705357539..1d3b9e9e52122e5323ae3931ead4092bcec02c90 100644 --- a/libraries/adodb_vtigerfix/adodb-errorhandler.inc.php +++ b/libraries/adodb_vtigerfix/adodb-errorhandler.inc.php @@ -37,7 +37,14 @@ if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_H */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { - if (error_reporting() == 0) return; // obey @ protocol + // Do not throw if errors are suppressed by @ operator + // error_reporting() value for suppressed errors changed in PHP 8.0.0 + $suppressed = version_compare(PHP_VERSION, '8.0.0', '<') + ? 0 + : E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE; + if (error_reporting() == $suppressed) { + return; + } switch($fn) { case 'EXECUTE': $sql = $p1; diff --git a/libraries/adodb_vtigerfix/adodb-errorpear.inc.php b/libraries/adodb_vtigerfix/adodb-errorpear.inc.php index 2bb15947e89d03ca16e7e8a58a46f95707230050..7b173da84fd8133d7e31ffe76715406082fc7056 100644 --- a/libraries/adodb_vtigerfix/adodb-errorpear.inc.php +++ b/libraries/adodb_vtigerfix/adodb-errorpear.inc.php @@ -52,7 +52,15 @@ function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false) { global $ADODB_Last_PEAR_Error; - if (error_reporting() == 0) return; // obey @ protocol + // Do not throw if errors are suppressed by @ operator + // error_reporting() value for suppressed errors changed in PHP 8.0.0 + $suppressed = version_compare(PHP_VERSION, '8.0.0', '<') + ? 0 + : E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE; + if (error_reporting() == $suppressed) { + return; + } + switch($fn) { case 'EXECUTE': $sql = $p1; diff --git a/libraries/adodb_vtigerfix/adodb-exceptions.inc.php b/libraries/adodb_vtigerfix/adodb-exceptions.inc.php index 9f1176f0f6936470aa953979fc7754a2c4e362b5..e4fae817e73a26f1accd2f55ca0fe1c3d2ebe67f 100644 --- a/libraries/adodb_vtigerfix/adodb-exceptions.inc.php +++ b/libraries/adodb_vtigerfix/adodb-exceptions.inc.php @@ -30,6 +30,9 @@ var $params = ''; var $host = ''; var $database = ''; + /** @var string A message text. */ + var $msg = ''; + function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) { switch($fn) { @@ -45,6 +48,9 @@ var $database = ''; $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)"; break; default: + //Prevent PHP warning if $p1 or $p2 are arrays. + $p1 = ( is_array($p1) ) ? 'Array' : $p1; + $p2 = ( is_array($p2) ) ? 'Array' : $p2; $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)"; break; } @@ -75,10 +81,18 @@ var $database = ''; function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) { -global $ADODB_EXCEPTION; + global $ADODB_EXCEPTION; + + // Do not throw if errors are suppressed by @ operator + // error_reporting() value for suppressed errors changed in PHP 8.0.0 + $suppressed = version_compare(PHP_VERSION, '8.0.0', '<') + ? 0 + : E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE; + if (error_reporting() == $suppressed) { + return; + } + + $errfn = is_string($ADODB_EXCEPTION) ? $ADODB_EXCEPTION : 'ADODB_EXCEPTION'; - if (error_reporting() == 0) return; // obey @ protocol - if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; - else $errfn = 'ADODB_EXCEPTION'; throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); } diff --git a/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php index 824dcb960f97dba1c2d4b088159de4e4d879df70..84bf52f06563c515b0e9adf2c7297a67613dcf10 100644 --- a/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php +++ b/libraries/adodb_vtigerfix/adodb-xmlschema.inc.php @@ -111,6 +111,7 @@ if( !defined( '_ADODB_LAYER' ) ) { * @package axmls * @access private */ +#[\AllowDynamicProperties] class dbObject { /** @@ -135,7 +136,7 @@ class dbObject { * * @access private */ - function _tag_open( &$parser, $tag, $attributes ) { + function _tag_open( $parser, $tag, $attributes ) { } @@ -144,7 +145,7 @@ class dbObject { * * @access private */ - function _tag_cdata( &$parser, $cdata ) { + function _tag_cdata( $parser, $cdata ) { } @@ -153,7 +154,7 @@ class dbObject { * * @access private */ - function _tag_close( &$parser, $tag ) { + function _tag_close( $parser, $tag ) { } @@ -271,7 +272,7 @@ class dbTable extends dbObject { * * @access private */ - function _tag_open( &$parser, $tag, $attributes ) { + function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); switch( $this->currentElement ) { @@ -330,7 +331,7 @@ class dbTable extends dbObject { * * @access private */ - function _tag_cdata( &$parser, $cdata ) { + function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Table constraint case 'CONSTRAINT': @@ -354,7 +355,7 @@ class dbTable extends dbObject { * * @access private */ - function _tag_close( &$parser, $tag ) { + function _tag_close( $parser, $tag ) { $this->currentElement = ''; switch( strtoupper( $tag ) ) { @@ -556,7 +557,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; @@ -674,7 +685,7 @@ class dbIndex extends dbObject { * * @access private */ - function _tag_open( &$parser, $tag, $attributes ) { + function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); switch( $this->currentElement ) { @@ -701,7 +712,7 @@ class dbIndex extends dbObject { * * @access private */ - function _tag_cdata( &$parser, $cdata ) { + function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Index field name case 'COL': @@ -717,7 +728,7 @@ class dbIndex extends dbObject { * * @access private */ - function _tag_close( &$parser, $tag ) { + function _tag_close( $parser, $tag ) { $this->currentElement = ''; switch( strtoupper( $tag ) ) { @@ -816,7 +827,7 @@ class dbData extends dbObject { * * @access private */ - function _tag_open( &$parser, $tag, $attributes ) { + function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); switch( $this->currentElement ) { @@ -838,7 +849,7 @@ class dbData extends dbObject { * * @access private */ - function _tag_cdata( &$parser, $cdata ) { + function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Index field name case 'F': @@ -854,7 +865,7 @@ class dbData extends dbObject { * * @access private */ - function _tag_close( &$parser, $tag ) { + function _tag_close( $parser, $tag ) { $this->currentElement = ''; switch( strtoupper( $tag ) ) { @@ -918,7 +929,8 @@ class dbData extends dbObject { foreach( $row as $field_id => $field_data ) { if( !array_key_exists( $field_id, $table_fields ) ) { if( is_numeric( $field_id ) ) { - $field_id = reset( array_keys( $table_fields ) ); + $keys = array_keys($table_fields); + $field_id = reset($keys); } else { continue; } @@ -1033,7 +1045,7 @@ class dbQuerySet extends dbObject { * * @access private */ - function _tag_open( &$parser, $tag, $attributes ) { + function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); switch( $this->currentElement ) { @@ -1055,7 +1067,7 @@ class dbQuerySet extends dbObject { /** * XML Callback to process CDATA elements */ - function _tag_cdata( &$parser, $cdata ) { + function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Line of queryset SQL data case 'QUERY': @@ -1071,7 +1083,7 @@ class dbQuerySet extends dbObject { * * @access private */ - function _tag_close( &$parser, $tag ) { + function _tag_close( $parser, $tag ) { $this->currentElement = ''; switch( strtoupper( $tag ) ) { @@ -1271,6 +1283,14 @@ class adoSchema { */ var $objectPrefix = ''; + /** + * @var object + * @access private + * Property used during XML Parsing. + * Added by Vtiger + */ + var $obj = null; + /** * @var long System debug * @access private @@ -1654,7 +1674,7 @@ class adoSchema { * * @access private */ - function _tag_open( &$parser, $tag, $attributes ) { + function _tag_open( $parser, $tag, $attributes ) { switch( strtoupper( $tag ) ) { case 'TABLE': $this->obj = new dbTable( $this, $attributes ); @@ -1677,7 +1697,7 @@ class adoSchema { * * @access private */ - function _tag_cdata( &$parser, $cdata ) { + function _tag_cdata( $parser, $cdata ) { } /** @@ -1686,7 +1706,7 @@ class adoSchema { * @access private * @internal */ - function _tag_close( &$parser, $tag ) { + function _tag_close( $parser, $tag ) { } diff --git a/libraries/adodb_vtigerfix/adodb-xmlschema03.inc.php b/libraries/adodb_vtigerfix/adodb-xmlschema03.inc.php index de1ea26c7d6727298df1a58aa28bb33cf15b9b55..aadcaf1e8985c964f8a991cc66c144e2674b9d0c 100644 --- a/libraries/adodb_vtigerfix/adodb-xmlschema03.inc.php +++ b/libraries/adodb_vtigerfix/adodb-xmlschema03.inc.php @@ -976,7 +976,8 @@ class dbData extends dbObject { foreach( $row as $field_id => $field_data ) { if( !array_key_exists( $field_id, $table_fields ) ) { if( is_numeric( $field_id ) ) { - $field_id = reset( array_keys( $table_fields ) ); + $keys = array_keys($table_fields); + $field_id = reset($keys); } else { continue; } diff --git a/libraries/adodb_vtigerfix/adodb.inc.php b/libraries/adodb_vtigerfix/adodb.inc.php index f15158f94f3498e66659bbeded34e11758a4ff2e..e3ae2e056c83e746ec6de46324db726da1645bbe 100644 --- a/libraries/adodb_vtigerfix/adodb.inc.php +++ b/libraries/adodb_vtigerfix/adodb.inc.php @@ -221,22 +221,62 @@ if (!defined('_ADODB_LAYER')) { // CLASS ADOFieldObject //============================================================================================== /** - * Helper class for FetchFields -- holds info on a column + * Helper class for FetchFields -- holds info on a column. + * + * Note: Dynamic properties are required here, as some drivers may require + * the object to hold database-specific field metadata. */ + #[\AllowDynamicProperties] class ADOFieldObject { - var $name = ''; - var $max_length=0; - var $type=""; -/* - // additional fields by dannym... (danny_milo@yahoo.com) - var $not_null = false; - // actually, this has already been built-in in the postgres, fbsql AND mysql module? ^-^ - // so we can as well make not_null standard (leaving it at "false" does not harm anyways) - - var $has_default = false; // this one I have done only in mysql and postgres for now ... - // others to come (dannym) - var $default_value; // default, if any, and supported. Check has_default first. -*/ + /** + * @var string Field name + */ + public $name = ''; + + /** + * @var int Field size + */ + public $max_length = 0; + + /** + * @var string Field type. + */ + public $type = ''; + + /** + * @var int|null Numeric field scale. + */ + public $scale; + + /** + * @var bool True if field can be NULL + */ + public $not_null = false; + + /** + * @var bool True if field is a primary key + */ + public $primary_key = false; + + /** + * @var bool True if field is unique key + */ + public $unique = false; + + /** + * @var bool True if field is automatically incremented + */ + public $auto_increment = false; + + /** + * @var bool True if field has a default value + */ + public $has_default = false; + + /** + * @var mixed Default value, if any and supported; check {@see $has_default} first. + */ + public $default_value; } @@ -1672,17 +1712,19 @@ if (!defined('_ADODB_LAYER')) { // 0 to offset-1 which will be discarded anyway. So we disable $ADODB_COUNTRECS. global $ADODB_COUNTRECS; - $savec = $ADODB_COUNTRECS; - $ADODB_COUNTRECS = false; + try { + $savec = $ADODB_COUNTRECS; + $ADODB_COUNTRECS = false; - - if ($secs2cache != 0) { - $rs = $this->CacheExecute($secs2cache,$sql,$inputarr); - } else { - $rs = $this->Execute($sql,$inputarr); + if ($secs2cache != 0) { + $rs = $this->CacheExecute($secs2cache, $sql, $inputarr); + } else { + $rs = $this->Execute($sql, $inputarr); + } + } finally { + $ADODB_COUNTRECS = $savec; } - $ADODB_COUNTRECS = $savec; if ($rs && !$rs->EOF) { $rs = $this->_rs2rs($rs,$nrows,$offset); } @@ -1829,11 +1871,16 @@ if (!defined('_ADODB_LAYER')) { public function GetOne($sql, $inputarr=false) { global $ADODB_COUNTRECS,$ADODB_GETONE_EOF; - $crecs = $ADODB_COUNTRECS; - $ADODB_COUNTRECS = false; + $rs = null; + try { + $crecs = $ADODB_COUNTRECS; + $ADODB_COUNTRECS = false; + $rs = $this->Execute($sql, $inputarr); + } finally { + $ADODB_COUNTRECS = $crecs; + } $ret = false; - $rs = $this->Execute($sql,$inputarr); if ($rs) { if ($rs->EOF) { $ret = $ADODB_GETONE_EOF; @@ -1843,7 +1890,6 @@ if (!defined('_ADODB_LAYER')) { $rs->Close(); } - $ADODB_COUNTRECS = $crecs; return $ret; } @@ -1972,10 +2018,15 @@ if (!defined('_ADODB_LAYER')) { function GetArray($sql,$inputarr=false) { global $ADODB_COUNTRECS; - $savec = $ADODB_COUNTRECS; - $ADODB_COUNTRECS = false; - $rs = $this->Execute($sql,$inputarr); - $ADODB_COUNTRECS = $savec; + $rs = null; + try { + $savec = $ADODB_COUNTRECS; + $ADODB_COUNTRECS = false; + $rs = $this->Execute($sql, $inputarr); + } finally { + $ADODB_COUNTRECS = $savec; + } + if (!$rs) if (defined('ADODB_PEAR')) { return ADODB_PEAR_Error(); @@ -1994,10 +2045,14 @@ if (!defined('_ADODB_LAYER')) { function CacheGetArray($secs2cache,$sql=false,$inputarr=false) { global $ADODB_COUNTRECS; - $savec = $ADODB_COUNTRECS; - $ADODB_COUNTRECS = false; - $rs = $this->CacheExecute($secs2cache,$sql,$inputarr); - $ADODB_COUNTRECS = $savec; + $rs = null; + try { + $savec = $ADODB_COUNTRECS; + $ADODB_COUNTRECS = false; + $rs = $this->CacheExecute($secs2cache, $sql, $inputarr); + } finally { + $ADODB_COUNTRECS = $savec; + } if (!$rs) if (defined('ADODB_PEAR')) { @@ -2028,12 +2083,15 @@ if (!defined('_ADODB_LAYER')) { function GetRow($sql,$inputarr=false) { global $ADODB_COUNTRECS; - $crecs = $ADODB_COUNTRECS; - $ADODB_COUNTRECS = false; - - $rs = $this->Execute($sql,$inputarr); + $rs = null; + try { + $crecs = $ADODB_COUNTRECS; + $ADODB_COUNTRECS = false; + $rs = $this->Execute($sql, $inputarr); + } finally { + $ADODB_COUNTRECS = $crecs; + } - $ADODB_COUNTRECS = $crecs; if ($rs) { if (!$rs->EOF) { $arr = $rs->fields; @@ -3405,22 +3463,59 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 } // end class ADOConnection + /** + * RecordSet fields data as object. + * + * @see ADORecordSet::fetchObj(), ADORecordSet::fetchObject(), + * @see ADORecordSet::fetchNextObj(), ADORecordSet::fetchNextObject() + */ + class ADOFetchObj { + /** @var array The RecordSet's fields */ + protected $data; + /** + * Constructor. + * + * @param array $fields Associative array with RecordSet's fields (name => value) + */ + public function __construct(array $fields = []) + { + $this->data = $fields; + } - //============================================================================================== - // CLASS ADOFetchObj - //============================================================================================== + public function __set(string $name, $value) + { + $this->data[$name] = $value; + } - /** - * Internal placeholder for record objects. Used by ADORecordSet->FetchObj(). - */ - class ADOFetchObj { - }; + public function __get(string $name) + { + if (isset($this->data[$name])) { + return $this->data[$name]; + } + ADOConnection::outp("Unknown field: $name"); + return null; + } - //============================================================================================== - // CLASS ADORecordSet_empty - //============================================================================================== + public function __isset($name) + { + return isset($this->data[$name]); + } + public function __debugInfo() + { + return $this->data; + } + + public static function __set_state(array $data) + { + return new self($data['data']); + } + } + + /** + * Class ADODB_Iterator_empty + */ class ADODB_Iterator_empty implements Iterator { private $rs; @@ -3429,26 +3524,32 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 $this->rs = $rs; } + #[\ReturnTypeWillChange] function rewind() {} + #[\ReturnTypeWillChange] function valid() { return !$this->rs->EOF; } + #[\ReturnTypeWillChange] function key() { return false; } + #[\ReturnTypeWillChange] function current() { return false; } + #[\ReturnTypeWillChange] function next() {} function __call($func, $params) { return call_user_func_array(array($this->rs, $func), $params); } + #[\ReturnTypeWillChange] function hasMore() { return false; } @@ -3495,6 +3596,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 function Init() {} + #[\ReturnTypeWillChange] function getIterator() { return new ADODB_Iterator_empty($this); } @@ -3555,22 +3657,27 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 $this->rs = $rs; } + #[\ReturnTypeWillChange] function rewind() { $this->rs->MoveFirst(); } + #[\ReturnTypeWillChange] function valid() { return !$this->rs->EOF; } + #[\ReturnTypeWillChange] function key() { return $this->rs->_currentRow; } + #[\ReturnTypeWillChange] function current() { return $this->rs->fields; } + #[\ReturnTypeWillChange] function next() { $this->rs->MoveNext(); } @@ -3655,6 +3762,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 $this->Close(); } + #[\ReturnTypeWillChange] function getIterator() { return new ADODB_Iterator($this); } diff --git a/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php b/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php index a1ee950a6ba2ab267205e62ffc9faa0b955daffc..2edf20df4d56d7e592da5a091cdc6d2ec802d0d1 100644 --- a/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php +++ b/libraries/adodb_vtigerfix/datadict/datadict-mysql.inc.php @@ -22,6 +22,7 @@ // security - hide paths if (!defined('ADODB_DIR')) die(); +#[\AllowDynamicProperties] class ADODB2_mysql extends ADODB_DataDict { var $databaseType = 'mysql'; var $alterCol = ' MODIFY COLUMN'; diff --git a/libraries/adodb_vtigerfix/drivers/adodb-mysqli.inc.php b/libraries/adodb_vtigerfix/drivers/adodb-mysqli.inc.php index 352810cc0c26260b5fa54f0ba50a96e9350e293f..c50e2230daae030e1bd64165f39a26dce7e7dfb8 100644 --- a/libraries/adodb_vtigerfix/drivers/adodb-mysqli.inc.php +++ b/libraries/adodb_vtigerfix/drivers/adodb-mysqli.inc.php @@ -39,6 +39,7 @@ if (!defined('MYSQLI_READ_DEFAULT_GROUP')) define('MYSQLI_READ_DEFAULT_GROUP',1) /** * Class ADODB_mysqli */ +#[\AllowDynamicProperties] class ADODB_mysqli extends ADOConnection { var $databaseType = 'mysqli'; var $dataProvider = 'mysql'; @@ -1244,6 +1245,7 @@ class ADODB_mysqli extends ADOConnection { /** * Class ADORecordSet_mysqli */ +#[\AllowDynamicProperties] class ADORecordSet_mysqli extends ADORecordSet{ var $databaseType = "mysqli"; diff --git a/libraries/antlr/Set.php b/libraries/antlr/Set.php index e8f494ca0a8d6f49cebfb1124b96798a587cf6e7..493f5881b1d19d2f75e7a890cce84855169270b8 100644 --- a/libraries/antlr/Set.php +++ b/libraries/antlr/Set.php @@ -1,5 +1,6 @@ <?php //Todo: find a decent set implementation for php + #[\AllowDynamicProperties] class Set{ public function __construct($arr){ $this->store = array(); @@ -31,4 +32,4 @@ -?> \ No newline at end of file +?> diff --git a/libraries/antlr/Token.php b/libraries/antlr/Token.php index cbcedb8f91b3c1861bc510a2ee834fce458f4e0e..253a97e3c03ef4652e8d640805f8ae01ee58fdf7 100644 --- a/libraries/antlr/Token.php +++ b/libraries/antlr/Token.php @@ -37,7 +37,7 @@ interface Token{ } - + #[\AllowDynamicProperties] class CommonToken implements Token { @@ -219,4 +219,4 @@ -?> \ No newline at end of file +?> diff --git a/libraries/freetag/freetag.class.php b/libraries/freetag/freetag.class.php index 7af7d61939a520463751c37f6d4db076f83428f2..5cf4e07afdf14bc4f8a44334b96231dd841735d7 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)) { @@ -174,7 +174,7 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT DISTINCT object_id - FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id) + FROM {$prefix}freetagged_objects INNER JOIN {$prefix}freetags ON (tag_id = id) WHERE $where ORDER BY object_id ASC LIMIT $offset, $limit"; @@ -220,7 +220,7 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT DISTINCT object_id - FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id) + FROM {$prefix}freetagged_objects INNER JOIN {$prefix}freetags ON (tag_id = id) WHERE $where ORDER BY object_id ASC "; @@ -276,12 +276,12 @@ class freetag { // We must adjust for duplicate normalized tags appearing multiple times in the join by // counting only the distinct tags. It should also work for an individual user. - $sql = "SELECT ${prefix}freetagged_objects.object_id, tag, COUNT(DISTINCT tag) AS uniques - FROM ${prefix}freetagged_objects - INNER JOIN ${prefix}freetags ON (${prefix}freetagged_objects.tag_id = ${prefix}freetags.id) - WHERE ${prefix}freetags.tag IN (". generateQuestionMarks($tagArray) .") + $sql = "SELECT {$prefix}freetagged_objects.object_id, tag, COUNT(DISTINCT tag) AS uniques + FROM {$prefix}freetagged_objects + INNER JOIN {$prefix}freetags ON ({$prefix}freetagged_objects.tag_id = {$prefix}freetags.id) + WHERE {$prefix}freetags.tag IN (". generateQuestionMarks($tagArray) .") $tagger_sql - GROUP BY ${prefix}freetagged_objects.object_id + GROUP BY {$prefix}freetagged_objects.object_id HAVING uniques = $numTags LIMIT $offset, $limit"; $this->debug_text("Tag combo: " . join("+", $tagArray) . " SQL: $sql"); @@ -326,7 +326,7 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT DISTINCT object_id - FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id) + FROM {$prefix}freetagged_objects INNER JOIN {$prefix}freetags ON (tag_id = id) WHERE $where ORDER BY object_id ASC LIMIT $offset, $limit "; @@ -382,7 +382,7 @@ class freetag { global $adb; $sql = "SELECT DISTINCT tag, raw_tag, tagger_id, id - FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id) + FROM {$prefix}freetagged_objects INNER JOIN {$prefix}freetags ON (tag_id = id) WHERE $where ORDER BY id ASC $limit_sql @@ -437,7 +437,7 @@ class freetag { array_push($params, $tagger_id); } else $tagger_sql = ""; $sql = "SELECT COUNT(*) as count - FROM ${prefix}freetagged_objects INNER JOIN ${prefix}freetags ON (tag_id = id) + FROM {$prefix}freetagged_objects INNER JOIN {$prefix}freetags ON (tag_id = id) WHERE 1=1 $tagger_sql AND object_id = ? @@ -450,7 +450,7 @@ class freetag { } // Then see if a raw tag in this form exists. $sql = "SELECT id - FROM ${prefix}freetags + FROM {$prefix}freetags WHERE raw_tag = ? "; $rs = $adb->pquery($sql, array($tag)) or die("Syntax Error: $sql"); if(!$rs->EOF) { @@ -458,7 +458,7 @@ class freetag { } else { // Add new tag! $tag_id = $adb->getUniqueId('vtiger_freetags'); - $sql = "INSERT INTO ${prefix}freetags (id, tag, raw_tag, owner) VALUES (?,?,?,?)"; + $sql = "INSERT INTO {$prefix}freetags (id, tag, raw_tag, owner) VALUES (?,?,?,?)"; $params = array($tag_id, $normalized_tag, $tag, $tagger_id); $rs = $adb->pquery($sql, $params) or die("Syntax Error: $sql"); @@ -466,7 +466,7 @@ class freetag { if(!($tag_id > 0)) { return false; } - $sql = "INSERT INTO ${prefix}freetagged_objects + $sql = "INSERT INTO {$prefix}freetagged_objects (tag_id, tagger_id, object_id, tagged_on, module) VALUES (?,?,?, NOW(),?)"; $params = array($tag_id, $tagger_id, $object_id, $module); $rs = $adb->pquery($sql, $params) or die("Syntax error: $sql"); @@ -529,7 +529,7 @@ class freetag { $prefix = $this->_table_prefix; if($tag_id > 0) { - $sql = "DELETE FROM ${prefix}freetagged_objects + $sql = "DELETE FROM {$prefix}freetagged_objects WHERE tagger_id = ? AND object_id = ? AND tag_id = ? LIMIT 1"; $params = array($tagger_id, $object_id, $tag_id); $rs = $adb->pquery($sql, $params) or die("Syntax Error: $sql"); @@ -555,7 +555,7 @@ class freetag { global $adb; $prefix = $this->_table_prefix; if($object_id > 0) { - $sql = "DELETE FROM ${prefix}freetagged_objects + $sql = "DELETE FROM {$prefix}freetagged_objects WHERE object_id = ? "; $rs = $adb->pquery($sql, array($object_id)) or die("Syntax Error: $sql"); return true; @@ -589,7 +589,7 @@ class freetag { $prefix = $this->_table_prefix; if($object_id > 0) { - $sql = "DELETE FROM ${prefix}freetagged_objects + $sql = "DELETE FROM {$prefix}freetagged_objects WHERE tagger_id = ? AND object_id = ?"; $rs = $adb->pquery($sql, array($tagger_id, $object_id)) or die("Syntax Error: $sql"); return true; @@ -619,7 +619,7 @@ class freetag { $prefix = $this->_table_prefix; - $sql = "SELECT id FROM ${prefix}freetags + $sql = "SELECT id FROM {$prefix}freetags WHERE tag = ? LIMIT 1 "; $rs = $adb->pquery($sql, array($tag)) or die("Syntax Error: $sql"); return $rs->fields['id']; @@ -646,7 +646,7 @@ class freetag { global $adb; $prefix = $this->_table_prefix; - $sql = "SELECT id FROM ${prefix}freetags + $sql = "SELECT id FROM {$prefix}freetags WHERE raw_tag = ? LIMIT 1 "; $rs = $adb->pquery($sql, array($tag)) or die("Syntax Error: $sql"); return $rs->fields['id']; @@ -802,7 +802,7 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT tag, COUNT(*) as count - FROM ${prefix}freetags INNER JOIN ${prefix}freetagged_objects ON (id = tag_id) + FROM {$prefix}freetags INNER JOIN {$prefix}freetagged_objects ON (id = tag_id) WHERE 1 $tagger_sql GROUP BY tag @@ -846,7 +846,7 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT COUNT(*) as count - FROM ${prefix}freetags INNER JOIN ${prefix}freetagged_objects ON (id = tag_id) + FROM {$prefix}freetags INNER JOIN {$prefix}freetagged_objects ON (id = tag_id) WHERE 1 $tagger_sql "; @@ -971,9 +971,9 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT tag,tag_id,COUNT(object_id) AS quantity - FROM ${prefix}freetags INNER JOIN ${prefix}freetagged_objects - ON (${prefix}freetags.id = tag_id) INNER JOIN vtiger_tab - ON ${prefix}freetagged_objects.module = vtiger_tab.name + FROM {$prefix}freetags INNER JOIN {$prefix}freetagged_objects + ON ({$prefix}freetags.id = tag_id) INNER JOIN vtiger_tab + ON {$prefix}freetagged_objects.module = vtiger_tab.name WHERE vtiger_tab.presence != 1 $tagger_sql GROUP BY tag, tag_id @@ -1034,10 +1034,10 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT t1.tag, COUNT( o1.object_id ) AS quantity - FROM ${prefix}freetagged_objects o1 - INNER JOIN ${prefix}freetags t1 ON ( t1.id = o1.tag_id ) - INNER JOIN ${prefix}freetagged_objects o2 ON ( o1.object_id = o2.object_id ) - INNER JOIN ${prefix}freetags t2 ON ( t2.id = o2.tag_id ) + FROM {$prefix}freetagged_objects o1 + INNER JOIN {$prefix}freetags t1 ON ( t1.id = o1.tag_id ) + INNER JOIN {$prefix}freetagged_objects o2 ON ( o1.object_id = o2.object_id ) + INNER JOIN {$prefix}freetags t2 ON ( t2.id = o2.tag_id ) WHERE t2.tag = ? AND t1.tag != ? GROUP BY o1.tag_id ORDER BY quantity DESC @@ -1112,8 +1112,8 @@ class freetag { $prefix = $this->_table_prefix; $sql = "SELECT matches.object_id, COUNT( matches.object_id ) AS num_common_tags - FROM ${prefix}freetagged_objects as matches - INNER JOIN ${prefix}freetags as tags ON ( tags.id = matches.tag_id ) + FROM {$prefix}freetagged_objects as matches + INNER JOIN {$prefix}freetags as tags ON ( tags.id = matches.tag_id ) WHERE tags.tag IN (". generateQuestionMarks($tagArray) .") GROUP BY matches.object_id HAVING num_common_tags >= ? diff --git a/libraries/google-api-php-client/src/Google/Model.php b/libraries/google-api-php-client/src/Google/Model.php index 52e30d67c78563fd73c23910ef6613117c82e7e0..b0290d3151654e178125a72bfff591add0a04ac2 100644 --- a/libraries/google-api-php-client/src/Google/Model.php +++ b/libraries/google-api-php-client/src/Google/Model.php @@ -232,11 +232,13 @@ class Google_Model implements ArrayAccess } } + #[\ReturnTypeWillChange] public function offsetExists($offset) { return isset($this->$offset) || isset($this->modelData[$offset]); } + #[\ReturnTypeWillChange] public function offsetGet($offset) { return isset($this->$offset) ? @@ -244,6 +246,7 @@ class Google_Model implements ArrayAccess $this->__get($offset); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { if (property_exists($this, $offset)) { @@ -254,6 +257,7 @@ class Google_Model implements ArrayAccess } } + #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->modelData[$offset]); diff --git a/modules/Calendar/Activity.php b/modules/Calendar/Activity.php index 5e6eaf2e962eb8b54a0e06122f54ce23bedd2370..d92db4f65f1b9c58e185afb82a9375e1708efed2 100644 --- a/modules/Calendar/Activity.php +++ b/modules/Calendar/Activity.php @@ -730,7 +730,7 @@ function insertIntoRecurringTable(& $recurObj) * @param integer $recurid - recuring eventid * @param string $remindermode - string like 'edit' */ - function activity_reminder($activity_id,$reminder_time,$reminder_sent=0,$recurid,$remindermode='') + function activity_reminder($activity_id,$reminder_time,$reminder_sent=0,$recurid=0,$remindermode='') { global $log; $log->debug("Entering vtiger_activity_reminder(".$activity_id.",".$reminder_time.",".$reminder_sent.",".$recurid.",".$remindermode.") method ..."); diff --git a/modules/Calendar/models/Module.php b/modules/Calendar/models/Module.php index 9f34793c1ff430746769919caf522fce064d47e0..11fd4eb3c8dd2fc413e2cde5dafe403fd59deb1e 100644 --- a/modules/Calendar/models/Module.php +++ b/modules/Calendar/models/Module.php @@ -761,7 +761,7 @@ class Calendar_Module_Model extends Vtiger_Module_Model { return $recentRecords; } - public function getAllTasksbyPriority($conditions = false, $pagingModel) { + public function getAllTasksbyPriority($conditions = false, $pagingModel = false) { global $current_user; $currentUserModel = Users_Record_Model::getCurrentUserModel(); $db = PearDatabase::getInstance(); @@ -1009,7 +1009,7 @@ class Calendar_Module_Model extends Vtiger_Module_Model { } } - $activityType = strtolower($activityType); + $activityType = strtolower($activityType ? $activityType : ""); $moduleIcon = "<i class='vicon-$activityType' title='$title' ></i>"; if (!in_array($activityType, array('task', 'calendar'))) { diff --git a/modules/Calendar/models/Record.php b/modules/Calendar/models/Record.php index f19a72b9380ea282b6ddf7cd21f33310e094a402..d13c3c4ba7320c12ca4e9cd774b9d005efdb8937 100644 --- a/modules/Calendar/models/Record.php +++ b/modules/Calendar/models/Record.php @@ -142,6 +142,7 @@ class Calendar_Record_Model extends Vtiger_Record_Model { * @return <Array> - which contains Recurring Information */ public function getRecurringDetails() { + global $currentModule; $recurringObject = $this->getRecurringObject(); if ($recurringObject) { $recurringInfoDisplayData = $recurringObject->getDisplayRecurringInfo(); diff --git a/modules/Campaigns/Campaigns.php b/modules/Campaigns/Campaigns.php index 50ad738b0ad7f8b66fdeb886d7dc106d97fe7311..78e23e675838a9fc856078dd7062fca8c635390e 100644 --- a/modules/Campaigns/Campaigns.php +++ b/modules/Campaigns/Campaigns.php @@ -531,7 +531,7 @@ class Campaigns extends CRMEntity { * @param - $status_column index of the status column in the list. * returns true on success */ - function add_status_popup($related_list, $status_column = 7, $related_module) + function add_status_popup($related_list, $status_column = 7, $related_module = null) { global $adb; diff --git a/modules/CustomView/CustomView.php b/modules/CustomView/CustomView.php index da85eff7f38f6ce405b2d9598b47d145812776e4..0fc173362e6ff8ffaf96872de62d10c34920f6ff 100644 --- a/modules/CustomView/CustomView.php +++ b/modules/CustomView/CustomView.php @@ -433,6 +433,7 @@ class CustomView extends CRMEntity { $sSQL .= " inner join vtiger_customview on vtiger_customview.cvid = vtiger_cvcolumnlist.cvid"; $sSQL .= " where vtiger_customview.cvid =? order by vtiger_cvcolumnlist.columnindex"; $result = $adb->pquery($sSQL, array($cvid)); + $columnlist = array(); while ($columnrow = $adb->fetch_array($result)) { $columnlist[$columnrow['columnindex']] = $columnrow['columnname']; } diff --git a/modules/HelpDesk/models/Module.php b/modules/HelpDesk/models/Module.php index fc51270438801329b293812451fb887477dc5fda..52c5b95feebe6e6b01c1d94c140b9021defe3178 100644 --- a/modules/HelpDesk/models/Module.php +++ b/modules/HelpDesk/models/Module.php @@ -220,7 +220,7 @@ class HelpDesk_Module_Model extends Vtiger_Module_Model { if(php7_count($relatedListFields)>0) { $nameFields = $this->getNameFields(); foreach($nameFields as $fieldName){ - if(!$relatedListFields[$fieldName]) { + if(!isset($relatedListFields[$fieldName])) { $fieldModel = $this->getField($fieldName); $relatedListFields[$fieldModel->get('column')] = $fieldModel->get('name'); } diff --git a/modules/Install/views/Index.php b/modules/Install/views/Index.php index dc6157e49a119cffadce326d01525ebbde96b44d..8fb55655fe83a0de134e7785cdbd42cd3b43aef1 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']); @@ -221,7 +220,7 @@ class Install_Index_view extends Vtiger_View_Controller { // Helper function as configuration file is still not loaded. protected function retrieveConfiguredAppUniqueKey() { include 'config.inc.php'; - return $application_unique_key; + return isset($application_unique_key) ? $application_unique_key : ""; } public function getHeaderCss(Vtiger_Request $request) { diff --git a/modules/Leads/models/Module.php b/modules/Leads/models/Module.php index 08ba884402b00928f9b1247cd125a8eded5018f7..91754b926895cc27ed0b187d0cac9e210a3dc730 100644 --- a/modules/Leads/models/Module.php +++ b/modules/Leads/models/Module.php @@ -136,6 +136,7 @@ class Leads_Module_Model extends Vtiger_Module_Model { $ownerSql = ' AND '.$ownerSql; } + $dateFilterSql = ''; $params = array(); if(!empty($dateFilter)) { $dateFilterSql = ' AND createdtime BETWEEN ? AND ? '; diff --git a/modules/Migration/schema/600_to_610.php b/modules/Migration/schema/600_to_610.php index 72cc56cf0699ff1599d4d02610df4b0caa6cf14f..1456d03f308b0a403e4761194c9d5883189a6d10 100644 --- a/modules/Migration/schema/600_to_610.php +++ b/modules/Migration/schema/600_to_610.php @@ -116,7 +116,7 @@ $unWanted=array( "modules/FieldFormulas/functional.js" ); -for($i=0, $len=php7_count($unWanted);$i<=$len;$i++){ +for($i=0, $len=php7_count($unWanted);$i<$len;$i++){ if(file_exists($unWanted[$i])){ unlink($unWanted[$i]); } @@ -1551,4 +1551,4 @@ Migration_Index_View::ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_reporttype //Configuration Editor fix $sql = "UPDATE vtiger_settings_field SET name = ? WHERE name = ?"; -Migration_Index_View::ExecuteQuery($sql,array('LBL_CONFIG_EDITOR', 'Configuration Editor')); \ No newline at end of file +Migration_Index_View::ExecuteQuery($sql,array('LBL_CONFIG_EDITOR', 'Configuration Editor')); 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/Migration/views/Index.php b/modules/Migration/views/Index.php index dade9e2aca31622dbfd7a7dc2047c603fa28b00d..23d0e09036b55a637500a5ad7fb215042a6626ec 100644 --- a/modules/Migration/views/Index.php +++ b/modules/Migration/views/Index.php @@ -28,7 +28,7 @@ class Migration_Index_View extends Vtiger_View_Controller { public function process(Vtiger_Request $request) { // Override error reporting to production mode - version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); + // version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); // Migration could be heavy at-times. set_time_limit(0); @@ -233,7 +233,7 @@ class Migration_Index_View extends Vtiger_View_Controller { $fieldName = '('. $fieldName .')'; } - $groupId = $condition['groupid']; + $groupId = isset($condition['groupid']) ? $condition['groupid'] : null; if (!$groupId) { $groupId = 0; } diff --git a/modules/PickList/PickListUtils.php b/modules/PickList/PickListUtils.php index 944ab639309c96b7d0d815020b71a2807a99e2dc..f1bf78384e4eac8586d25b3692bfc80650a11c85 100644 --- a/modules/PickList/PickListUtils.php +++ b/modules/PickList/PickListUtils.php @@ -101,6 +101,8 @@ function get_available_module_picklist($picklist_details){ * @return array $arr - the array containing the picklist values */ function getAllPickListValues($fieldName,$lang = Array() ){ + $lang = vtlib_array($lang); + global $adb; if(Vtiger_Cache::get('AllPicklistValues',$fieldName)){ return Vtiger_Cache::get('AllPicklistValues',$fieldName); @@ -139,7 +141,8 @@ function getAllPickListValues($fieldName,$lang = Array() ){ * @param object $adb - the peardatabase object * @return array $pick - the editable picklist values */ -function getEditablePicklistValues($fieldName, $lang= array(), $adb){ +function getEditablePicklistValues($fieldName, $lang= array(), $adb = null){ + if ($adb == null) $adb = PearDatabase::getInstance(); $values = array(); $fieldName = $adb->sql_escape_string($fieldName); $sql="select $fieldName from vtiger_$fieldName where presence=1 and $fieldName <> '--None--'"; @@ -165,7 +168,8 @@ function getEditablePicklistValues($fieldName, $lang= array(), $adb){ * @param object $adb - the peardatabase object * @return array $pick - the no-editable picklist values */ -function getNonEditablePicklistValues($fieldName, $lang=array(), $adb){ +function getNonEditablePicklistValues($fieldName, $lang=array(), $adb = null){ + if ($adb == null) $adb = PearDatabase::getInstance(); $values = array(); $fieldName = $adb->sql_escape_string($fieldName); $sql = "select $fieldName from vtiger_$fieldName where presence=0"; diff --git a/modules/Reports/models/Folder.php b/modules/Reports/models/Folder.php index fd3b7b8f1b2ebe92206e0ae060da9b956ecd1937..896abdab5f8804bfb5df07179b98126cd295ec4d 100644 --- a/modules/Reports/models/Folder.php +++ b/modules/Reports/models/Folder.php @@ -366,7 +366,7 @@ class Reports_Folder_Model extends Vtiger_Base_Model { * @param <Boolean> $skipRecords - List of the RecordIds to be skipped * @return <Array> List of RecordsIds */ - public function getRecordIds($skipRecords=false, $module, $searchParams = array()) { + public function getRecordIds($skipRecords=false, $module=null, $searchParams = array()) { $db = PearDatabase::getInstance(); $baseTableName = "vtiger_report"; $baseTableId = "reportid"; diff --git a/modules/Settings/Vtiger/models/ConfigModule.php b/modules/Settings/Vtiger/models/ConfigModule.php index 47ea1dacef4b2e69944ca5b51190f5cd1717f2c3..26d3f2d22c31c9d206e62b247b077bf14b67aeac 100644 --- a/modules/Settings/Vtiger/models/ConfigModule.php +++ b/modules/Settings/Vtiger/models/ConfigModule.php @@ -75,6 +75,7 @@ class Settings_Vtiger_ConfigModule_Model extends Settings_Vtiger_Module_Model { $fieldValue = explode(' = ', $configContent); $fieldValue = $fieldValue[1]; if ($fieldName === 'upload_maxsize') { + $fieldValue = trim($fieldValue, ' ;'); $fieldValue = round(number_format($fieldValue / 1048576, 2)); } @@ -168,4 +169,4 @@ class Settings_Vtiger_ConfigModule_Model extends Settings_Vtiger_Module_Model { $moduleModel->getViewableData(); return $moduleModel; } -} \ No newline at end of file +} diff --git a/modules/Settings/Workflows/models/Record.php b/modules/Settings/Workflows/models/Record.php index 5f3fb4530b58b4fe7642e652c5ef5d505a95cbe0..3ba06e174e4805ab371f9bbf9246c9a517b235cc 100644 --- a/modules/Settings/Workflows/models/Record.php +++ b/modules/Settings/Workflows/models/Record.php @@ -203,7 +203,7 @@ class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model { return $arr[$executionCondition-1]; } - function getV7executionConditionAsLabel($executionCondition=null, $module_name) { + function getV7executionConditionAsLabel($executionCondition=null, $module_name=null) { if($executionCondition == null) { $executionCondition = $this->get('execution_condition'); } diff --git a/modules/Users/CreateUserPrivilegeFile.php b/modules/Users/CreateUserPrivilegeFile.php index ab133756c4108bce8ac28a7f6b4da9facfb9fe17..6e7f38d708f02a16a3467f7afe709301740573ee 100644 --- a/modules/Users/CreateUserPrivilegeFile.php +++ b/modules/Users/CreateUserPrivilegeFile.php @@ -149,7 +149,7 @@ if($handle) { $parTabId=$adb->query_result($result,$i,'tabid'); $relTabId=$adb->query_result($result,$i,'relatedto_tabid'); - if(is_array($relModSharArr[$relTabId])) + if(isset($relModSharArr[$relTabId]) && is_array($relModSharArr[$relTabId])) { $temArr=$relModSharArr[$relTabId]; $temArr[]=$parTabId; @@ -1838,4 +1838,4 @@ function populateRelatedSharingPrivileges($enttype,$userid,$module,$relmodule,$p } } -?> \ No newline at end of file +?> diff --git a/modules/Users/UserTimeZonesArray.php b/modules/Users/UserTimeZonesArray.php index 96392ab9ac68dc72a83c397182766d8ba622fbaf..f4166cbd5bae3eb305a7f594ae53669e3bf38d1d 100644 --- a/modules/Users/UserTimeZonesArray.php +++ b/modules/Users/UserTimeZonesArray.php @@ -13,7 +13,7 @@ * Contributor(s): ______________________________________. ********************************************************************************/ class UserTimeZones{ - function userTimeZones(){ + static function getAll(){ $arrayOfSupportedTimeZones = array( 'Pacific/Midway', 'Pacific/Samoa', @@ -116,4 +116,4 @@ class UserTimeZones{ } } -?> \ No newline at end of file +?> diff --git a/modules/Users/models/Record.php b/modules/Users/models/Record.php index f25bdf90982eedb637d19fd39edc5af94b9dc2d7..035e2b4990be62507b3a31fb8de01ca99ddab0d5 100644 --- a/modules/Users/models/Record.php +++ b/modules/Users/models/Record.php @@ -398,7 +398,8 @@ class Users_Record_Model extends Vtiger_Record_Model { $url = \Vtiger_Functions::getFilePublicURL($imageId, $imageName); //decode_html - added to handle UTF-8 characters in file names - $imageOriginalName = urlencode(decode_html($imageName)); + $imageNameDecoded =decode_html($imageName); + $imageOriginalName = urlencode($imageNameDecoded ? $imageNameDecoded : ""); if($url) { $url = $site_URL.$url; } @@ -598,7 +599,8 @@ class Users_Record_Model extends Vtiger_Record_Model { function getTagCloudStatus() { $db = PearDatabase::getInstance(); $query = "SELECT visible FROM vtiger_homestuff WHERE userid=? AND stufftype='Tag Cloud'"; - $visibility = $db->query_result($db->pquery($query, array($this->getId())), 0, 'visible'); + $rs = $db->pquery($query, array($this->getId())); + $visibility = $db->query_result($rs, 0, 'visible'); if($visibility == 0) { return true; } diff --git a/modules/Users/views/UserSetup.php b/modules/Users/views/UserSetup.php index a1b0421de56f30bf4fb7c5e4e99ec0ce09b3fe19..b27e876c3909afec072ae6d08d68a6de49194a46 100644 --- a/modules/Users/views/UserSetup.php +++ b/modules/Users/views/UserSetup.php @@ -36,6 +36,8 @@ class Users_UserSetup_View extends Vtiger_Index_View { $currenciesList = array_merge($defaultcurrency, $currencies); $viewer->assign('IS_FIRST_USER', $isFirstUser); $viewer->assign('CURRENCIES', $currenciesList); + } else { + $viewer->assign('IS_FIRST_USER', false); } $viewer->assign('CURRENT_USER_MODEL',$userModel); diff --git a/modules/Vtiger/actions/SaveWidgetPositions.php b/modules/Vtiger/actions/SaveWidgetPositions.php index 742d68ea75a710805aee2d93345f5e416a7d67d4..66c7a7b4675ed8f1674c6b9359d4a9972a7cc2cb 100644 --- a/modules/Vtiger/actions/SaveWidgetPositions.php +++ b/modules/Vtiger/actions/SaveWidgetPositions.php @@ -24,7 +24,7 @@ class Vtiger_SaveWidgetPositions_Action extends Vtiger_IndexAjax_View { public function process(Vtiger_Request $request) { $currentUser = Users_Record_Model::getCurrentUserModel(); - $positionsMap = $request->get('positionsmap'); + $positionsMap = vtlib_array($request->get('positionsmap')); if ($positionsMap) { foreach ($positionsMap as $id => $position) { diff --git a/modules/Vtiger/helpers/Util.php b/modules/Vtiger/helpers/Util.php index a6174dfa577d75d195a593d0e9565103eb0ecd7d..98207671bf02ded55deb76d23942c6adce25ae6f 100644 --- a/modules/Vtiger/helpers/Util.php +++ b/modules/Vtiger/helpers/Util.php @@ -97,7 +97,7 @@ class Vtiger_Util_Helper { * @return <String> */ public static function pluralize($count, $text) { - return $count ." ". (($count == 1) ? vtranslate("$text") : vtranslate("${text}S")); + return $count ." ". (($count == 1) ? vtranslate("$text") : vtranslate("{$text}S")); } /** diff --git a/modules/Vtiger/models/MenuStructure.php b/modules/Vtiger/models/MenuStructure.php index fb05add1a0d6b06c2ef145ce8ee8a51fe355b96a..7c1fb86390e901536eb1c535e322dedafd5ecd27 100644 --- a/modules/Vtiger/models/MenuStructure.php +++ b/modules/Vtiger/models/MenuStructure.php @@ -87,7 +87,7 @@ class Vtiger_MenuStructure_Model extends Vtiger_Base_Model { $currentTopMenuCount++; } - $parent = ucfirst(strtolower($menuModel->get('parent'))); + $parent = ucfirst(strtolower($menuModel->get('parent') ? $menuModel->get('parent') : "")); if($parent == 'Sales' || $parent == 'Marketing'){ $parent = 'MARKETING_AND_SALES'; } @@ -202,7 +202,7 @@ class Vtiger_MenuStructure_Model extends Vtiger_Base_Model { $regroupMenuByParent[$app][$moduleName] = $moduleModel; } } else { - if(!in_array($moduleName, $ignoredModules)) { + if(!in_array($moduleName, $ignoredModules) && isset($oldToNewAppMap[$appName])) { $app = $oldToNewAppMap[$appName]; $regroupMenuByParent[$app][$moduleName] = $moduleModel; } diff --git a/modules/Vtiger/models/Module.php b/modules/Vtiger/models/Module.php index 0c578baf6e5460c1658ede89049baa656dae4ce7..35d844b881a7deec5a3a96154992240093544e33 100644 --- a/modules/Vtiger/models/Module.php +++ b/modules/Vtiger/models/Module.php @@ -1229,6 +1229,7 @@ class Vtiger_Module_Model extends Vtiger_Module { public function getOwnerWhereConditionForDashBoards ($owner) { $currentUserModel = Users_Record_Model::getCurrentUserModel(); $sharingAccessModel = Settings_SharingAccess_Module_Model::getInstance($this->getName()); + $ownerSql = ''; $params = array(); if(!empty($owner) && $currentUserModel->isAdminUser()) {//If admin user, then allow users data $ownerSql = ' smownerid = '. $owner; diff --git a/modules/Vtiger/models/Record.php b/modules/Vtiger/models/Record.php index 47f3962ccca56ef3f01027b100c643fdef40af4d..9384788e96ab84d202269e300a052582a0b950c3 100644 --- a/modules/Vtiger/models/Record.php +++ b/modules/Vtiger/models/Record.php @@ -420,7 +420,8 @@ class Vtiger_Record_Model extends Vtiger_Base_Model { $imageName = $db->query_result($result, 0, 'name'); $url = \Vtiger_Functions::getFilePublicURL($imageId, $imageName); //decode_html - added to handle UTF-8 characters in file names - $imageOriginalName = urlencode(decode_html($imageName)); + $imageOriginalNameDecoded = decode_html($imageName); + $imageOriginalName = urlencode($imageOriginalNameDecoded ? $imageOriginalNameDecoded : ""); if($url) { $url = $site_URL.$url; } diff --git a/modules/Vtiger/uitypes/Date.php b/modules/Vtiger/uitypes/Date.php index 5b1b46126e37b540eab7c0be2a90a3ed85fc961a..357cf9cf95999b243da47e3c6bfde886512f315c 100644 --- a/modules/Vtiger/uitypes/Date.php +++ b/modules/Vtiger/uitypes/Date.php @@ -70,6 +70,7 @@ class Vtiger_Date_UIType extends Vtiger_Base_UIType { * @return converted value */ public function getEditViewDisplayValue($value) { + if ($value == null) return $value; if (empty($value) || $value === ' ') { $value = trim($value); $fieldInstance = $this->get('field')->getWebserviceFieldObject(); diff --git a/modules/Vtiger/uitypes/Time.php b/modules/Vtiger/uitypes/Time.php index 9c64034cfa01c3d3dd81a2c42f71e78d04d4fa28..4ee1b37e0efbef87245f4d8120cfc3b1349d872c 100644 --- a/modules/Vtiger/uitypes/Time.php +++ b/modules/Vtiger/uitypes/Time.php @@ -35,6 +35,7 @@ class Vtiger_Time_UIType extends Vtiger_Base_UIType { */ public static function getTimeValueInAMorPM($time) { if($time){ + if (substr_count($time, ':') < 2) $time .= ':'; /* to overcome notice of missing index 2 (seconds) below */ list($hours, $minutes, $seconds) = explode(':', $time); $format = vtranslate('PM'); diff --git a/modules/Vtiger/views/Detail.php b/modules/Vtiger/views/Detail.php index 421a79e5ade372180a1385708ce7db28635a5241..6248b3d4173c9d31359ea230a9a70e0f3ca0f265 100644 --- a/modules/Vtiger/views/Detail.php +++ b/modules/Vtiger/views/Detail.php @@ -128,6 +128,8 @@ class Vtiger_Detail_View extends Vtiger_Index_View { } } + $viewer->assign('NO_PAGINATION', true); + $moduleModel = Vtiger_Module_Model::getInstance($moduleName); if(!empty($prevRecordId)) { $viewer->assign('PREVIOUS_RECORD_URL', $moduleModel->getDetailViewUrl($prevRecordId)); @@ -524,6 +526,7 @@ class Vtiger_Detail_View extends Vtiger_Index_View { $viewer->assign('ROLLUPID', isset($rollupsettings['rollupid']) ? $rollupsettings['rollupid'] : 0); $viewer->assign('PARENT_RECORD', $parentId); + $viewer->assign('STARTINDEX', 0); return $viewer->view('RecentComments.tpl', $moduleName, 'true'); } diff --git a/modules/Vtiger/views/ShowWidget.php b/modules/Vtiger/views/ShowWidget.php index 44a71522fe75891ee3e9c5fa3b6bcaf4fc181772..a4fecce69f5787bd72fcf6b2c591e29606e45155 100644 --- a/modules/Vtiger/views/ShowWidget.php +++ b/modules/Vtiger/views/ShowWidget.php @@ -58,6 +58,7 @@ class Vtiger_ShowWidget_View extends Vtiger_IndexAjax_View { $createdTime = $request->get('createdtime'); //user format dates should be used in getSearchParams() api $request->set('dateFilter', $createdTime); + $dates = array(); if(!empty($createdTime)) { $startDate = Vtiger_Date_UIType::getDBInsertedValue($createdTime['start']); $dates['start'] = getValidDBInsertDateTimeValue($startDate . ' 00:00:00'); diff --git a/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc b/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc index 355cc6c8b836303177ac99c7d19e361865bb43af..61d1989c8dc6b03bc39f142ab030ad3fec778b4d 100644 --- a/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc +++ b/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc @@ -23,7 +23,7 @@ class VTEmailRecipientsTemplate extends VTSimpleTemplate { } protected function useValue($data, $fieldname) { - return $data['emailoptout'] == 0; + return array_key_exists('emailoptout', $data) && $data['emailoptout'] == 0; } } -?> \ No newline at end of file +?> diff --git a/modules/com_vtiger_workflow/VTEntityCache.inc b/modules/com_vtiger_workflow/VTEntityCache.inc index 2b5659852526586005dbc321247a4abc8b1f4aed..15d24c6e93aeae5caf4da88bfe5efa9f322d7dc5 100644 --- a/modules/com_vtiger_workflow/VTEntityCache.inc +++ b/modules/com_vtiger_workflow/VTEntityCache.inc @@ -10,6 +10,7 @@ require_once 'data/VTEntityDelta.php'; require_once 'includes/runtime/Cache.php'; +#[\AllowDynamicProperties] class VTWorkflowEntity{ function __construct($user, $id){ try { @@ -119,6 +120,9 @@ class VTWorkflowEntity{ } class VTEntityCache{ + var $user; + var $cache; + function __construct($user){ $this->user = $user; $this->cache = array(); diff --git a/modules/com_vtiger_workflow/VTEntityMethodManager.inc b/modules/com_vtiger_workflow/VTEntityMethodManager.inc index acede1790c8c4fffd127408fc0dbdfcc789c2e10..281c75d716cb457a594583c0c06f8906f3771f97 100644 --- a/modules/com_vtiger_workflow/VTEntityMethodManager.inc +++ b/modules/com_vtiger_workflow/VTEntityMethodManager.inc @@ -9,6 +9,7 @@ ******************************************************************************/ require_once("include/events/SqlResultIterator.inc"); class VTEntityMethodManager{ + var $adb; function __construct($adb){ $this->adb = $adb; diff --git a/modules/com_vtiger_workflow/VTEventHandler.inc b/modules/com_vtiger_workflow/VTEventHandler.inc index 4bcdbfa7f4c6ff8c460ac1a317e3fa89b4cd4bb0..4c251407abcc911457bf7def98f02cbdf7c992b8 100644 --- a/modules/com_vtiger_workflow/VTEventHandler.inc +++ b/modules/com_vtiger_workflow/VTEventHandler.inc @@ -31,6 +31,7 @@ require_once('VTWorkflowUtils.php'); */ class VTWorkflowEventHandler extends VTEventHandler { + var $workflows; /** * Push tasks to the task queue if the conditions are true diff --git a/modules/com_vtiger_workflow/VTJsonCondition.inc b/modules/com_vtiger_workflow/VTJsonCondition.inc index 210aa5e419b5f90921e8e0bd93a8288e15062abe..8da1bb117656c5119c95b1b843efb12b5dd89eb8 100644 --- a/modules/com_vtiger_workflow/VTJsonCondition.inc +++ b/modules/com_vtiger_workflow/VTJsonCondition.inc @@ -26,7 +26,7 @@ class VTJsonCondition { $expressionResults = array(); $i = 0; foreach ($expr as $cond) { - $conditionGroup = $cond['groupid']; + $conditionGroup = isset($cond['groupid']) ? $cond['groupid'] : null; if (empty($conditionGroup)) { $conditionGroup = 0; } @@ -85,9 +85,9 @@ class VTJsonCondition { foreach ($expressionResults as $groupId => $groupExprResultSet) { $groupResult = TRUE; foreach ($groupExprResultSet as $exprResult) { - $result = $exprResult['result']; - $logicalOperator = $exprResult['logicaloperator']; - if (isset($result)) { // Condition to skip last condition + if (isset($exprResult['result'])) { // Condition to skip last condition + $result = $exprResult['result']; + $logicalOperator = isset($exprResult['logicaloperator']) ? $exprResult['logicaloperator'] : null; if (!empty($logicalOperator)) { switch ($logicalOperator) { case 'and' : $groupResult = ($groupResult && $result); @@ -162,7 +162,7 @@ class VTJsonCondition { $fieldValue = $data[$cond['fieldname']]; } $value = trim(html_entity_decode($cond['value'])); - $expressionType = $cond['valuetype']; + $expressionType = isset($cond['valuetype']) ? $cond['valuetype'] : null; if ($expressionType == 'fieldname') { if ($referredEntityData != null) { diff --git a/modules/com_vtiger_workflow/VTSimpleTemplate.inc b/modules/com_vtiger_workflow/VTSimpleTemplate.inc index 68c877e56e2bf068c5a82c737595ae24a6fb095c..f4731d9eb0d95cbfe328cedfe535e4616e22f17f 100644 --- a/modules/com_vtiger_workflow/VTSimpleTemplate.inc +++ b/modules/com_vtiger_workflow/VTSimpleTemplate.inc @@ -7,6 +7,7 @@ * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. ************************************************************************************/ +#[\AllowDynamicProperties] class VTSimpleTemplate{ function __construct($templateString){ @@ -132,7 +133,7 @@ class VTSimpleTemplate{ } function parseTemplate(){ - return preg_replace_callback('/\\$(\w+|\((\w+) : \(([_\w]+)\) (\w+)\))/', array($this,"matchHandler"), $this->template); + return preg_replace_callback('/\\$(\w+|\((\w+) : \(([_\w]+)\) (\w+)\))/', array($this,"matchHandler"), $this->template ? $this->template : ""); } function getCompanySetting($fieldname) { diff --git a/modules/com_vtiger_workflow/VTTaskManager.inc b/modules/com_vtiger_workflow/VTTaskManager.inc index 11630a23caf76f560ffa518d9a890853dad97fc9..c1b2bc99822c1e51231b1e88001666377bc89725 100644 --- a/modules/com_vtiger_workflow/VTTaskManager.inc +++ b/modules/com_vtiger_workflow/VTTaskManager.inc @@ -11,6 +11,7 @@ /** * Functionality to save and retrieve Tasks from the database. */ + #[\AllowDynamicProperties] class VTTaskManager{ function __construct($adb){ $this->adb = $adb; @@ -28,7 +29,7 @@ */ public function saveTask($task){ $adb = $this->adb; - if(is_numeric($task->id)){//How do I check whether a member exists in php? + if(isset($task->id) && is_numeric($task->id)){ $taskId = $task->id; $adb->pquery("update com_vtiger_workflowtasks set summary=?, task=? where task_id=?", array($task->summary, serialize($task), $taskId)); @@ -153,10 +154,15 @@ } + #[\AllowDynamicProperties] abstract class VTTask{ public abstract function doTask($data); public abstract function getFieldNames(); + public function __get($name) { + return property_exists($this, $name) ? $this->$name : null; + } + public function getTimeFieldList() { return array(); } diff --git a/modules/com_vtiger_workflow/VTTaskQueue.inc b/modules/com_vtiger_workflow/VTTaskQueue.inc index 82839f27957ef6f9e87efd794c3044e8731c0be2..88a37b60860cbad982e1269400cb2d65c981bc1b 100644 --- a/modules/com_vtiger_workflow/VTTaskQueue.inc +++ b/modules/com_vtiger_workflow/VTTaskQueue.inc @@ -12,6 +12,7 @@ * Time based Queue of tasks ready for execution. * */ + #[\AllowDynamicProperties] class VTTaskQueue{ public function __construct($adb){ @@ -74,4 +75,4 @@ return false; } } -?> \ No newline at end of file +?> diff --git a/modules/com_vtiger_workflow/VTWorkflowManager.inc b/modules/com_vtiger_workflow/VTWorkflowManager.inc index 6766a56b322c78ba38552a5f720185604534c8c1..cb13e5105c9b5c71477b92187733747a729d8096 100644 --- a/modules/com_vtiger_workflow/VTWorkflowManager.inc +++ b/modules/com_vtiger_workflow/VTWorkflowManager.inc @@ -12,6 +12,7 @@ require_once("VTJsonCondition.inc"); require_once 'include/utils/ConfigReader.php'; require_once 'includes/runtime/Cache.php'; +#[\AllowDynamicProperties] class VTWorkflowManager{ static $ON_FIRST_SAVE = 1; @@ -341,6 +342,7 @@ class VTWorkflowManager{ } } +#[\AllowDynamicProperties] class Workflow{ static $SCHEDULED_HOURLY = 1; static $SCHEDULED_DAILY = 2; @@ -354,7 +356,13 @@ class Workflow{ $this->conditionStrategy = new VTJsonCondition(); } + function __get($name) { + return property_exists($this, $name) ? $this->$name : null; + } + function setup($row) { + $row = vtlib_array($row); + $this->id = $row['workflow_id']; $this->moduleName = $row['module_name']; $this->description = to_html($row['summary']); diff --git a/pkg/vtiger/extensions/Webservices/third-party/Lempar.php b/pkg/vtiger/extensions/Webservices/third-party/Lempar.php index ed603d446b05980b4ad7b3e03645843be5045a33..60ba7b8801ebae87c573bf387e4b1f53c7b8d1b2 100644 --- a/pkg/vtiger/extensions/Webservices/third-party/Lempar.php +++ b/pkg/vtiger/extensions/Webservices/third-party/Lempar.php @@ -33,16 +33,19 @@ class ParseyyToken implements ArrayAccess return $this->_string; } + #[\ReturnTypeWillChange] function offsetExists($offset) { return isset($this->metadata[$offset]); } + #[\ReturnTypeWillChange] function offsetGet($offset) { return $this->metadata[$offset]; } + #[\ReturnTypeWillChange] function offsetSet($offset, $value) { if ($offset === null) { @@ -66,6 +69,7 @@ class ParseyyToken implements ArrayAccess } } + #[\ReturnTypeWillChange] function offsetUnset($offset) { unset($this->metadata[$offset]); diff --git a/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Parser.php b/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Parser.php index 21bddfcd38e27bf7a3e38ec10d467aa3404cf6a2..da22ffac5eee098d99370ea71e86f77b59fa8aa3 100644 --- a/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Parser.php +++ b/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Parser.php @@ -33,16 +33,19 @@ class PHP_LexerGenerator_ParseryyToken implements ArrayAccess return $this->_string; } + #[\ReturnTypeWillChange] function offsetExists($offset) { return isset($this->metadata[$offset]); } + #[\ReturnTypeWillChange] function offsetGet($offset) { return $this->metadata[$offset]; } + #[\ReturnTypeWillChange] function offsetSet($offset, $value) { if ($offset === null) { @@ -66,6 +69,7 @@ class PHP_LexerGenerator_ParseryyToken implements ArrayAccess } } + #[\ReturnTypeWillChange] function offsetUnset($offset) { unset($this->metadata[$offset]); diff --git a/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Regex/Parser.php b/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Regex/Parser.php index 0b9d7f353c09feb9b28f83a0763b18bd2d2dfe8d..c621f5508ae74b2053fc684316534f6811f32c04 100644 --- a/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Regex/Parser.php +++ b/pkg/vtiger/extensions/Webservices/third-party/LexerGenerator/Regex/Parser.php @@ -33,16 +33,19 @@ class PHP_LexerGenerator_Regex_yyToken implements ArrayAccess return $this->_string; } + #[\ReturnTypeWillChange] function offsetExists($offset) { return isset($this->metadata[$offset]); } + #[\ReturnTypeWillChange] function offsetGet($offset) { return $this->metadata[$offset]; } + #[\ReturnTypeWillChange] function offsetSet($offset, $value) { if ($offset === null) { @@ -66,6 +69,7 @@ class PHP_LexerGenerator_Regex_yyToken implements ArrayAccess } } + #[\ReturnTypeWillChange] function offsetUnset($offset) { unset($this->metadata[$offset]); diff --git a/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator.php b/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator.php index 94fcecb87e364656ede0195fecde0c007c66af5e..490e8ebd249b8fe966c90c2dcf98fa67002b5d9e 100644 --- a/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator.php +++ b/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator.php @@ -665,7 +665,7 @@ class PHP_ParserGenerator while (isset($errmsg[$restart]) && $errmsg[$restart] == ' ') { $restart++; } - printf("%s%.${end}s\n", $prefix, $errmsg); + printf("%s%.{$end}s\n", $prefix, $errmsg); $errmsg = substr($errmsg, $restart); } } @@ -695,7 +695,7 @@ class PHP_ParserGenerator for ($j = $i; $j < $this->nsymbol; $j += $skip) { $sp = $this->symbols[$j]; //assert( sp->index==j ); - printf(" %3d %-${maxlen}.${maxlen}s", $j, $sp->name); + printf(" %3d %-{$maxlen}.{$maxlen}s", $j, $sp->name); } print "\n"; } diff --git a/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator/Action.php b/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator/Action.php index 9d53d96d99197cb37398530cc86a4c58b6d086b0..f1e9027d53e46d8c3ccacfd1ca5a1adea56449f1 100644 --- a/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator/Action.php +++ b/pkg/vtiger/extensions/Webservices/third-party/ParserGenerator/Action.php @@ -154,19 +154,19 @@ class PHP_ParserGenerator_Action { switch ($this->type) { case self::SHIFT: - fprintf($fp, "%${indent}s shift %d", $this->sp->name, $this->x->statenum); + fprintf($fp, "%{$indent}s shift %d", $this->sp->name, $this->x->statenum); break; case self::REDUCE: - fprintf($fp, "%${indent}s reduce %d", $this->sp->name, $this->x->index); + fprintf($fp, "%{$indent}s reduce %d", $this->sp->name, $this->x->index); break; case self::ACCEPT: - fprintf($fp, "%${indent}s accept", $this->sp->name); + fprintf($fp, "%{$indent}s accept", $this->sp->name); break; case self::ERROR: - fprintf($fp, "%${indent}s error", $this->sp->name); + fprintf($fp, "%{$indent}s error", $this->sp->name); break; case self::CONFLICT: - fprintf($fp, "%${indent}s reduce %-3d ** Parsing conflict **", $this->sp->name, $this->x->index); + fprintf($fp, "%{$indent}s reduce %-3d ** Parsing conflict **", $this->sp->name, $this->x->index); break; case self::SH_RESOLVED: case self::RD_RESOLVED: diff --git a/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php b/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php index 1fec60387d0d0abf284bc87d229f8b2c80179019..845e3bd51763b45815655930c7ad05426658eb66 100644 --- a/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php +++ b/pkg/vtiger/modules/CustomerPortal/modules/CustomerPortal/CustomerPortal.php @@ -8,6 +8,7 @@ * All Rights Reserved. *******************************************************************************/ + #[\AllowDynamicProperties] class CustomerPortal { /** diff --git a/pkg/vtiger/modules/CustomerPortal/settings/models/Module.php b/pkg/vtiger/modules/CustomerPortal/settings/models/Module.php index 45c422047a1ae2811ea73a08a7daf566c0d6f719..cf3d4f21c9fca990c68e95c59f27add26889f9ee 100644 --- a/pkg/vtiger/modules/CustomerPortal/settings/models/Module.php +++ b/pkg/vtiger/modules/CustomerPortal/settings/models/Module.php @@ -12,6 +12,7 @@ class Settings_CustomerPortal_Module_Model extends Settings_Vtiger_Module_Model var $name = 'CustomerPortal'; var $max_sequence = ''; + var $portalModules = null; /** * Function to get Current portal user diff --git a/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php b/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php index 890d4b4ede17840286a61a218eed520359713eba..761d64d5ebb0cd3169b1e2a345a7576f3088cf04 100644 --- a/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php +++ b/pkg/vtiger/modules/ExtensionStore/modules/ExtensionStore/ExtensionStore.php @@ -8,6 +8,7 @@ * All Rights Reserved. * ***********************************************************************************/ +#[\AllowDynamicProperties] class ExtensionStore { } diff --git a/pkg/vtiger/modules/ExtensionStore/settings/connectors/ExtnStore.php b/pkg/vtiger/modules/ExtensionStore/settings/connectors/ExtnStore.php index 4aa3ae89cb71dbd8c85debffc333908e7f99c0f8..11b2bc284ca109b73a7366c05754a3abcbf65a8c 100644 --- a/pkg/vtiger/modules/ExtensionStore/settings/connectors/ExtnStore.php +++ b/pkg/vtiger/modules/ExtensionStore/settings/connectors/ExtnStore.php @@ -163,7 +163,7 @@ class Settings_ExtensionStore_ExtnStore_Connector { /** * Function to get max created on for promotions */ - public function getMaxCreatedOn($type = 'Extension', $function, $field) { + public function getMaxCreatedOn($type = 'Extension', $function = null, $field = null) { $q = array('type' => $type); try { $response = $this->api('/app/listings', 'GET', $q ? array('q' => Zend_Json::encode($q), 'fn' => $function, 'max' => $field) : null, false); diff --git a/pkg/vtiger/modules/ExtensionStore/settings/models/Extension.php b/pkg/vtiger/modules/ExtensionStore/settings/models/Extension.php index b7ac2319dbdaa0a38beeaf0fe152b51f85cb9059..7b1e4dfec3c1b65fcc159e90238b18b2aa25e8d2 100644 --- a/pkg/vtiger/modules/ExtensionStore/settings/models/Extension.php +++ b/pkg/vtiger/modules/ExtensionStore/settings/models/Extension.php @@ -204,7 +204,7 @@ class Settings_ExtensionStore_Extension_Model extends Vtiger_Base_Model { /** * Function to get max created on promotion */ - public function getMaxCreatedOn($type = 'Extension', $function, $field) { + public function getMaxCreatedOn($type = 'Extension', $function = null, $field = null) { $connector = $this->getConnector(); if ($connector) { $listings = $connector->getMaxCreatedOn($type, $function, $field); @@ -297,7 +297,7 @@ class Settings_ExtensionStore_Extension_Model extends Vtiger_Base_Model { * @param <String> search term * @return <Array> list of extensions <Settings_ExtensionStore_Extension_Model> */ - public function findListings($searchTerm = null, $searchType) { + public function findListings($searchTerm = null, $searchType = null) { $extensionModelsList = array(); $connector = $this->getConnector(); if ($connector) { diff --git a/pkg/vtiger/modules/Google/modules/Google/Google.php b/pkg/vtiger/modules/Google/modules/Google/Google.php index ae2dc792519a62a8e0daff51fdcd47a4a41eae08..a783b4a3b10bb89639585c905ae3fc9729a0fcce 100644 --- a/pkg/vtiger/modules/Google/modules/Google/Google.php +++ b/pkg/vtiger/modules/Google/modules/Google/Google.php @@ -11,6 +11,7 @@ require_once 'vtlib/Vtiger/Module.php'; require_once('include/events/include.inc'); +#[\AllowDynamicProperties] class Google { const module = 'Google'; diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php b/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php index 857b0224fcf119e6673dd827539072c1cb86a814..fc17d0e3338b23434f4594da0af03f1bafa0657f 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php @@ -9,6 +9,7 @@ ************************************************************************************/ require_once 'include/Webservices/Query.php'; +#[\AllowDynamicProperties] class MailManager { static function updateMailAssociation($mailuid, $emailid, $crmid) { diff --git a/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php b/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php index f0940cf80e6717505ec61f5f57d2efea8c58e8fa..b6d3452754c0dfe6ae8a424ec7dad7acb38e0450 100644 --- a/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php +++ b/pkg/vtiger/modules/Mobile/modules/Mobile/Mobile.php @@ -10,6 +10,7 @@ include_once dirname(__FILE__) . '/Mobile.Config.php'; +#[\AllowDynamicProperties] class Mobile { /** diff --git a/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php b/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php index 49e4b647c92d2a62b2390dad06a5e058e53bfca2..6fe11a49f99554bd68aa55730e209f1481c1be43 100644 --- a/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php +++ b/pkg/vtiger/modules/ModTracker/modules/ModTracker/ModTracker.php @@ -10,6 +10,7 @@ include_once 'vtlib/Vtiger/Event.php'; include_once 'include/Webservices/GetUpdates.php'; +#[\AllowDynamicProperties] class ModTracker { @@ -82,7 +83,8 @@ class ModTracker { * function gives an array of module names for which modtracking is enabled */ function getModTrackerEnabledModules() { - global $adb; + global $adb; + $modules = array(); $moduleResult = $adb->pquery('SELECT * FROM vtiger_modtracker_tabs', array()); for($i=0; $i<$adb->num_rows($moduleResult); $i++) { $tabId = $adb->query_result($moduleResult, $i, 'tabid'); @@ -395,4 +397,4 @@ class ModTracker { self::trackRelation($sourceModule, $sourceId, $targetModule, $targetId, self::$UNLINK); } } -?> \ No newline at end of file +?> diff --git a/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php b/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php index 7146021a5cb5ffaf67e7d1e12a96e3e98e473287..a1c57dbee6c1c5e54295865685c6dd6bb5613af7 100644 --- a/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php +++ b/pkg/vtiger/modules/RecycleBin/modules/RecycleBin/RecycleBin.php @@ -8,7 +8,8 @@ * All Rights Reserved. *******************************************************************************/ -class RecycleBin { +#[\AllowDynamicProperties] + class RecycleBin { /** * Invoked when special actions are performed on the module. diff --git a/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php b/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php index 87719404b7f8c8c92885c7bf2bfb4adc2c36701b..e7a345810ddb70b66966260bf1bc28b09f8059d9 100644 --- a/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php +++ b/pkg/vtiger/modules/WSAPP/modules/WSAPP/WSAPP.php @@ -10,6 +10,7 @@ require_once('include/events/include.inc'); require_once 'modules/WSAPP/Utils.php'; +#[\AllowDynamicProperties] class WSAPP { /** diff --git a/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php b/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php index 18326c6936dec30f6448224bd95c14cfe1f2197b..feaab5c39e10faa6d436c988d3188ec19d23f183 100644 --- a/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php +++ b/pkg/vtiger/modules/Webforms/modules/Webforms/Webforms.php @@ -10,6 +10,7 @@ require_once 'modules/Webforms/model/WebformsModel.php'; require_once 'include/Webservices/DescribeObject.php'; +#[\AllowDynamicProperties] class Webforms { var $LBL_WEBFORMS='Webforms'; diff --git a/vtlib/Vtiger/Block.php b/vtlib/Vtiger/Block.php index 234e6b61f18fe3f3b2cddabb5a94bcb0476380a2..46712d3293522bf2347f17ee56490ead4d7e12ac 100644 --- a/vtlib/Vtiger/Block.php +++ b/vtlib/Vtiger/Block.php @@ -192,7 +192,7 @@ class Vtiger_Block { */ static function getAllForModule($moduleInstance) { global $adb; - $instances = false; + $instances = array(); $query = "SELECT * FROM vtiger_blocks WHERE tabid=? ORDER BY sequence"; $queryParams = Array($moduleInstance->id); diff --git a/vtlib/Vtiger/Deprecated.php b/vtlib/Vtiger/Deprecated.php index bf47d8517030ee024ec5010384edfebf1e4d1629..d6d45b187bcfa894c64c65ae53c647b2bb2c684b 100644 --- a/vtlib/Vtiger/Deprecated.php +++ b/vtlib/Vtiger/Deprecated.php @@ -42,7 +42,7 @@ class Vtiger_Deprecated { } else { $accessibleFieldNames = array(); foreach($fieldsName as $field) { - if($module == 'Users' || getColumnVisibilityPermission($current_user->id, $field, $module) == '0') { + if($module == 'Users' || getColumnVisibilityPermission($current_user->id, $field, $module) == '0' && isset($fieldValues[$field])) { $accessibleFieldNames[] = $fieldValues[$field]; } } @@ -624,4 +624,4 @@ class Vtiger_Deprecated { $strings = Vtiger_Language_Handler::getModuleStringsFromFile($language, $module); return isset($strings['languageStrings']) ? $strings['languageStrings'] : []; } -} \ No newline at end of file +} diff --git a/vtlib/Vtiger/Field.php b/vtlib/Vtiger/Field.php index c33b3e296cc58e2b144a195dc21a67850fa94f38..61dde1c0aa23d5c9533a94d177c18f108e2432ca 100644 --- a/vtlib/Vtiger/Field.php +++ b/vtlib/Vtiger/Field.php @@ -271,7 +271,7 @@ class Vtiger_Field extends Vtiger_FieldBasic { */ static function getAllForModule($moduleInstance) { global $adb; - $instances = false; + $instances = array(); $query = "SELECT * FROM vtiger_field WHERE tabid=? ORDER BY sequence"; $queryParams = Array($moduleInstance->id); diff --git a/vtlib/Vtiger/FieldBasic.php b/vtlib/Vtiger/FieldBasic.php index 4423a0445c1b0539589e4c741725733d3f84250c..3b8a68ede950fd012ba684c5cb2ad4f5f1b153e6 100644 --- a/vtlib/Vtiger/FieldBasic.php +++ b/vtlib/Vtiger/FieldBasic.php @@ -13,6 +13,7 @@ * Provides basic API to work with vtiger CRM Fields * @package vtlib */ +#[\AllowDynamicProperties] class Vtiger_FieldBasic { /** ID of this field instance */ @@ -56,6 +57,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..106558c75197775a5d833b834a983f05bb1f2b85 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -164,7 +164,13 @@ class Vtiger_Functions { self::$moduleNameIdCache[$row['name']] = $row; } } - return $id ? self::$moduleIdNameCache[$id] : self::$moduleNameIdCache[$name]; + if ($id && isset(self::$moduleIdNameCache[$id])) { + return self::$moduleIdNameCache[$id]; + } + if ($name && isset(self::$moduleNameIdCache[$name])) { + return self::$moduleNameIdCache[$name]; + } + return null; } static function getModuleData($mixed) { @@ -463,9 +469,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) { @@ -737,12 +745,19 @@ class Vtiger_Functions { $fields = Array(); for ($i = 1; $i < php7_count($token_data_pair); $i++) { $module = explode('-', $tokenDataPair[$i]); + if (count($module) < 2) { + // if not $module-fieldname$ + continue; + } + if (!isset($fields[$module[0]])) { + $fields[$module[0]] = array(); + } $fields[$module[0]][] = $module[1]; } - if (is_array($fields['custom']) && php7_count($fields['custom']) > 0) { + if (isset($fields['custom']) && is_array($fields['custom']) && php7_count($fields['custom']) > 0) { $description = self::getMergedDescriptionCustomVars($fields, $description,$id,$parent_type); } - if(is_array($fields['companydetails']) && php7_count($fields['companydetails']) > 0){ + if(isset($fields['companydetails']) && is_array($fields['companydetails']) && php7_count($fields['companydetails']) > 0){ $description = self::getMergedDescriptionCompanyDetails($fields,$description); } 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/Link.php b/vtlib/Vtiger/Link.php index 878f21a231c5f78fd5789ae2459a76c08e45e6bc..278b3dc7bc00b7f04eaa1ccecf16cf372ed349f8 100644 --- a/vtlib/Vtiger/Link.php +++ b/vtlib/Vtiger/Link.php @@ -15,7 +15,8 @@ include_once 'vtlib/Vtiger/LinkData.php'; * Provides API to handle custom links * @package vtlib */ -class Vtiger_Link { + #[\AllowDynamicProperties] + class Vtiger_Link { var $tabid; var $linkid; var $linktype; diff --git a/vtlib/Vtiger/ModuleBasic.php b/vtlib/Vtiger/ModuleBasic.php index 1db30f54b0effbda906b78e36ae08d69a940d54c..ecd3d5cab751701b7b10e91ac72f167e46db958e 100644 --- a/vtlib/Vtiger/ModuleBasic.php +++ b/vtlib/Vtiger/ModuleBasic.php @@ -23,6 +23,7 @@ require_once 'includes/runtime/Cache.php'; * Provides API to work with vtiger CRM Module * @package vtlib */ +#[\AllowDynamicProperties] class Vtiger_ModuleBasic { /** ID of this instance */ var $id = false; 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/PackageUpdate.php b/vtlib/Vtiger/PackageUpdate.php index a858705d13186cc6d55c1a357f2af9f0ee5c00eb..f03cda8ea690e0ba1754d92d0f153df2800674e2 100644 --- a/vtlib/Vtiger/PackageUpdate.php +++ b/vtlib/Vtiger/PackageUpdate.php @@ -16,6 +16,7 @@ include_once('vtlib/Vtiger/PackageImport.php'); class Vtiger_PackageUpdate extends Vtiger_PackageImport { var $_migrationinfo = false; + var $_migrations = false; /** * Constructor 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 new file mode 100644 index 0000000000000000000000000000000000000000..75865805b34ae2f22bef77e041ab60e5b481a032 --- /dev/null +++ b/vtlib/Vtiger/Utils/GuardedArray.php @@ -0,0 +1,40 @@ +<?php +/*+*********************************************************************************** + * The contents of this file are subject to the vtiger CRM Public License Version 1.0 + * ("License"); You may not use this file except in compliance with the License + * The Original Code is: vtiger CRM Open Source + * The Initial Developer of the Original Code is vtiger. + * Portions created by vtiger are Copyright (C) vtiger. + * All Rights Reserved. + *************************************************************************************/ + +class Vtiger_GuardedArray implements \ArrayAccess { + private $data; + + function __construct($data = null) { + $this->data = is_null($data) || $data === false ? array() : $data; + } + + #[\ReturnTypeWillChange] + function offsetExists($key) { + return isset($this->data[$key]) && array_key_exists($key, $this->data); + } + + #[\ReturnTypeWillChange] + function offsetGet($key) { + if ($this->offsetExists($key)) { + return $this->data[$key]; + } + return null; + } + + #[\ReturnTypeWillChange] + function offsetSet($key, $value) { + $this->data[$key] = $value; + } + + #[\ReturnTypeWillChange] + function offsetUnset($key) { + unset($this->data[$key]); + } +} diff --git a/vtlib/Vtiger/Utils/PhpLogHandler.php b/vtlib/Vtiger/Utils/PhpLogHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..5824bd74ae50bea3c2e73779d7079d26909ecf01 --- /dev/null +++ b/vtlib/Vtiger/Utils/PhpLogHandler.php @@ -0,0 +1,135 @@ +<?php +/*+*********************************************************************************** + * The contents of this file are subject to the vtiger CRM Public License Version 1.0 + * ("License"); You may not use this file except in compliance with the License + * The Original Code is: vtiger CRM Open Source + * The Initial Developer of the Original Code is vtiger. + * Portions created by vtiger are Copyright (C) vtiger. + * All Rights Reserved. + *************************************************************************************/ + +class Vtiger_PhpLogHandler { + + /** + * Enable strict mode. + */ + public static function enableStrictLogging($basedir, $logfile) { + ini_set("display_errors", "off"); + error_reporting(E_ALL); + ini_set("log_errors", "on"); + ini_set("error_log", $logfile); + set_error_handler(Vtiger_PhpLogHandler::getErrorHandler($basedir)); + set_exception_handler(Vtiger_PhpLogHandler::getExceptionHandler($basedir)); + } + + /** + * Capture context of request in Log to review later. + */ + public static function getRequestContextToLog() { + $ctx = ""; + if (isset($_SERVER)) { + $ctx = $_SERVER["REQUEST_METHOD"] . " " . str_replace("?" . $_SERVER["QUERY_STRING"], "", $_SERVER["REQUEST_URI"]); + $params = []; + foreach (["module", "view", "action", "mode", "record"] as $key) { + if (isset($_REQUEST[$key])) $params[$key] = $_REQUEST[$key]; + } + $ctx .= "?" . http_build_query($params); + } + return $ctx; + } + + /** + * Redacted PHP error handler. + * - Retains only relative reference to the source file. + * - Logs to file if provided always (or) displays to console only when display_errors is on. + */ + public static function getErrorHandler($basedir, $logfile = null) { + $display_errors = filter_var(ini_get('display_errors'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $log_errors = filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + if (!$logfile) $logfile = ini_get('error_log'); + + $logctx = Vtiger_PhpLogHandler::getRequestContextToLog(); + $reqtm = date("[Y-m-d H:i:s]"); + + return function($errno, $errstr, $errfile, $errline) use ($display_errors, $log_errors, $basedir, $logfile, $logctx, $reqtm) { + // nothing todo return early. + if (!$display_errors && !$log_errors && ($log_errors && !$logfile)) { + return; + } + + $errtype = $errno; + switch($errno){ + case E_DEPRECATED: $errtype = "Deprecated"; break; + case E_ERROR: $errtype = "Error"; break; + case E_WARNING: $errtype = "Warning"; break; + case E_PARSE: $errtype = "Parse Error"; break; + case E_NOTICE: $errtype = "Notice"; break; + case E_CORE_ERROR: $errtype = "Core Error"; break; + case E_CORE_WARNING: $errtype = "Core Warning"; break; + case E_COMPILE_ERROR: $errtype = "Compile Error"; break; + case E_COMPILE_WARNING: $errtype = "Compile Warning"; break; + case E_USER_ERROR: $errtype = "User Error"; break; + case E_USER_WARNING: $errtype = "User Warning"; break; + case E_USER_NOTICE: $errtype = "User Notice"; break; + case E_STRICT: $errtype = "Strict Notice"; break; + case E_RECOVERABLE_ERROR: $errtype = "Recoverable Error"; break; + default: $errtype = "Unknown error ($errno)"; break; + } + $errfilerel = str_replace(rtrim($basedir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, "", $errfile); + + // format message same as default PHP + $msg = sprintf("%s: %s in %s on line %s\n", $errtype, $errstr, $errfilerel, $errline); + if ($logfile) { + $tmstamp = $reqtm . "@". date("[H:i:s]"); + $fullmsg = $tmstamp . " ". $logctx . "\n" . $tmstamp . " " . $msg; + file_put_contents($logfile, $fullmsg, FILE_APPEND | LOCK_EX); + } + + // if errors are logged then don't display even when asked for security. + // php does not enforce this and when mis-configured leaks info to user/attacker. + if (!$log_errors && $display_errors) { + echo "\n$msg"; + } + }; + } + + /** + * Redacted PHP exception handler. + * - Retains only relative reference to the source file. + * - Logs to file if provided always (or) displays to console only when display_errors is on. + */ + public static function getExceptionHandler($basedir, $logfile = null) { + $display_errors = filter_var(ini_get('display_errors'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + $log_errors = filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + if (!$logfile) $logfile = ini_get('error_log'); + + $logctx = Vtiger_PhpLogHandler::getRequestContextToLog(); + $reqtm = date("[Y-m-d H:i:s]"); + + return function(Throwable $e) use ($display_errors, $log_errors, $basedir, $logfile, $logctx, $reqtm) { + // nothing todo return early. + if (!$display_errors && !$log_errors && ($log_errors && !$logfile)) { + return; + } + + $basedir = rtrim($basedir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + $errfile = str_replace($basedir, "", $e->getFile()); + $errstack= str_replace($basedir, "", $e->getTraceAsString()); + + // format message same as default PHP + $msg = sprintf("Fatal error: %s in %s:%d\nStack trace:\n%s\n thrown in %s on line %d\n", $e->getMessage(), $errfile, $e->getLine(), $errstack, $errfile, $e->getLine()); + if ($logfile) { + $tmstamp = $reqtm . "@" . date("[H:i:s]"); + $fullmsg = $tmstamp . " ". $logctx . "\n" . $tmstamp . " " . $msg; + file_put_contents($logfile, $fullmsg, FILE_APPEND | LOCK_EX); + } + + // if errors are logged then don't display even when asked for security. + // php does not enforce this and when mis-configured leaks info to user/attacker. + if (!$log_errors && $display_errors) { + echo "\n$msg"; + } + }; + } + +} diff --git a/vtlib/thirdparty/dUnzip2.inc.php b/vtlib/thirdparty/dUnzip2.inc.php index 893947dae0d7251c342599b0701a5274ff04836c..24b3ab1f66bef9e1119a167bb80578a900ad8407 100644 --- a/vtlib/thirdparty/dUnzip2.inc.php +++ b/vtlib/thirdparty/dUnzip2.inc.php @@ -224,8 +224,10 @@ class dUnzip2{ $fdetails['uncompressed_size'], $targetFileName ); - if($applyChmod && $targetFileName) + if($applyChmod && $targetFileName) { + // TODO: check if this warning supression if its not working. @chmod($targetFileName, $applyChmod == 0755? 0644 : $applyChmod); + } return $ret; } diff --git a/vtlib/thirdparty/network/Net/URL.php b/vtlib/thirdparty/network/Net/URL.php index ae97c0afa82dd524c48008b06ba9d0d9f3a3f1c4..e9382276128623778eefae45faf069c90f9160ad 100644 --- a/vtlib/thirdparty/network/Net/URL.php +++ b/vtlib/thirdparty/network/Net/URL.php @@ -37,6 +37,7 @@ // Net_URL Class +#[\AllowDynamicProperties] class Net_URL { var $options = array('encode_query_keys' => false); diff --git a/vtlib/thirdparty/network/Request.php b/vtlib/thirdparty/network/Request.php index 8d1ee22a41e4aaaa339ee725e7775ee1da5888f2..dbede7a080a047e1c47c15b1536dec233576e8eb 100644 --- a/vtlib/thirdparty/network/Request.php +++ b/vtlib/thirdparty/network/Request.php @@ -932,7 +932,7 @@ class HTTP_Request $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n"; if (in_array($this->_method, $this->_bodyDisallowed) || - (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method || + (0 == strlen($this->_body ? $this->_body : "") && (HTTP_REQUEST_METHOD_POST != $this->_method || (empty($this->_postData) && empty($this->_postFiles))))) { $this->removeHeader('Content-Type'); @@ -965,9 +965,7 @@ class HTTP_Request // "normal" POST request if (!isset($boundary)) { - $callback = function_exists('create_function')? - create_function('$a', 'return $a[0] . \'=\' . $a[1];') : - function ($a) { return $a[0] .'='. $a[1]; }; + $callback = function ($a) { return $a[0] .'='. $a[1]; }; $postdata = implode('&', array_map($callback, $this->_flattenArray('', $this->_postData)));