From 167ad11e7535a9be56c34f6c12ec5001d19a5a63 Mon Sep 17 00:00:00 2001 From: Preexo <tim.niklas@web.de> Date: Tue, 16 Feb 2016 18:53:16 +0800 Subject: [PATCH] fixed more notices, warnings, stricts and deprecations --- config.template.php | 1 + include/utils/UserInfoUtil.php | 5 +-- include/utils/VTCacheUtils.php | 4 +-- include/utils/utils.php | 12 ++++--- includes/main/WebUI.php | 8 +++-- includes/runtime/Controller.php | 2 ++ modules/Users/Users.php | 2 +- modules/Users/models/Field.php | 2 +- modules/Users/models/Privileges.php | 32 +++++++++---------- modules/Users/models/Record.php | 8 +++-- modules/Users/views/SystemSetup.php | 2 +- modules/Vtiger/models/DashBoard.php | 8 ++--- modules/Vtiger/models/Field.php | 2 ++ modules/Vtiger/models/Menu.php | 2 +- modules/Vtiger/uitypes/Boolean.php | 2 +- modules/Vtiger/uitypes/Picklist.php | 2 +- modules/Vtiger/views/Header.php | 2 +- .../modules/PBXManager/PBXManager.php | 2 +- vtlib/Vtiger/Block.php | 13 ++++---- vtlib/Vtiger/Functions.php | 3 +- vtlib/Vtiger/Link.php | 22 ++++++------- 21 files changed, 76 insertions(+), 60 deletions(-) diff --git a/config.template.php b/config.template.php index 73ad086e5..3935f38e7 100644 --- a/config.template.php +++ b/config.template.php @@ -16,6 +16,7 @@ // Adjust error_reporting favourable to deployment. version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & E_ERROR) : error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED & E_ERROR & ~E_STRICT); // PRODUCTION //ini_set('display_errors','on'); version_compare(PHP_VERSION, '5.5.0') <= 0 ? error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED) : error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); // DEBUGGING +ini_set('display_errors','on'); error_reporting(E_ALL); include('vtigerversion.php'); diff --git a/include/utils/UserInfoUtil.php b/include/utils/UserInfoUtil.php index 949e64130..dc32bafef 100755 --- a/include/utils/UserInfoUtil.php +++ b/include/utils/UserInfoUtil.php @@ -268,7 +268,8 @@ function isPermitted($module,$actionname,$record_id='') require('user_privileges/user_privileges_'.$current_user->id.'.php'); require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); $permission = "no"; - if(($module == 'Users' || $module == 'Home' || $module == 'uploads') && $_REQUEST['parenttab'] != 'Settings') + $parenttab = isset($_REQUEST['parenttab']) ? $_REQUEST['parenttab'] : null; + if(($module == 'Users' || $module == 'Home' || $module == 'uploads') && $parenttab != 'Settings') { //These modules dont have security right now $permission = "yes"; @@ -278,7 +279,7 @@ function isPermitted($module,$actionname,$record_id='') } //Checking the Access for the Settings Module - if($module == 'Settings' || $module == 'Administration' || $module == 'System' || $_REQUEST['parenttab'] == 'Settings') + if($module == 'Settings' || $module == 'Administration' || $module == 'System' || $parenttab == 'Settings') { if(! $is_admin) { diff --git a/include/utils/VTCacheUtils.php b/include/utils/VTCacheUtils.php index 26a23d566..289b3fbf1 100644 --- a/include/utils/VTCacheUtils.php +++ b/include/utils/VTCacheUtils.php @@ -103,7 +103,7 @@ class VTCacheUtils { return false; } static function lookupFieldInfo_Module($module, $presencein = array('0', '2')) { - $tabid = getTabid($module); + $tabid = getTabid($module); $modulefields = false; $fieldInfo = Vtiger_Cache::get('fieldInfo', $tabid); if($fieldInfo){ @@ -112,7 +112,7 @@ class VTCacheUtils { $fldcache = self::$_fieldinfo_cache[$tabid]; } - if($fldcache){ + if(isset($fldcache) && $fldcache){ $modulefields = array(); foreach($fldcache as $fieldname=>$fieldinfo) { diff --git a/include/utils/utils.php b/include/utils/utils.php index b30dd3a3a..1fc5cb04f 100755 --- a/include/utils/utils.php +++ b/include/utils/utils.php @@ -348,8 +348,8 @@ function to_html($string, $encode=true) global $log,$default_charset; //$log->debug("Entering to_html(".$string.",".$encode.") method ..."); global $toHtml; - $action = $_REQUEST['action']; - $search = $_REQUEST['search']; + $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; + $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : null; $doconvert = false; @@ -359,12 +359,14 @@ function to_html($string, $encode=true) $inUTF8 = (strtoupper($default_charset) == 'UTF-8'); } - if($_REQUEST['module'] != 'Settings' && $_REQUEST['file'] != 'ListView' && $_REQUEST['module'] != 'Portal' && $_REQUEST['module'] != "Reports")// && $_REQUEST['module'] != 'Emails') - $ajax_action = $_REQUEST['module'].'Ajax'; + $module = isset($_REQUEST['module']) ? $_REQUEST['module'] : null; + $file = isset($_REQUEST['file']) ? $_REQUEST['file'] : null; + if($module != 'Settings' && $file != 'ListView' && $module != 'Portal' && $module != "Reports")// && $module != 'Emails') + $ajax_action = $module.'Ajax'; if(is_string($string)) { - if($action != 'CustomView' && $action != 'Export' && $action != $ajax_action && $action != 'LeadConvertToEntities' && $action != 'CreatePDF' && $action != 'ConvertAsFAQ' && $_REQUEST['module'] != 'Dashboard' && $action != 'CreateSOPDF' && $action != 'SendPDFMail' && (!isset($_REQUEST['submode'])) ) + if($action != 'CustomView' && $action != 'Export' && $action != $ajax_action && $action != 'LeadConvertToEntities' && $action != 'CreatePDF' && $action != 'ConvertAsFAQ' && $module != 'Dashboard' && $action != 'CreateSOPDF' && $action != 'SendPDFMail' && (!isset($_REQUEST['submode'])) ) { $doconvert = true; } diff --git a/includes/main/WebUI.php b/includes/main/WebUI.php index 034f0e081..e01feea80 100644 --- a/includes/main/WebUI.php +++ b/includes/main/WebUI.php @@ -121,12 +121,16 @@ class Vtiger_WebUI extends Vtiger_EntryPoint { if ($currentUser && $qualifiedModuleName) { $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage,$qualifiedModuleName); - vglobal('mod_strings', $moduleLanguageStrings['languageStrings']); + if(isset($moduleLanguageStrings['languageStrings'])){ + vglobal('mod_strings', $moduleLanguageStrings['languageStrings']); + } } if ($currentUser) { $moduleLanguageStrings = Vtiger_Language_Handler::getModuleStringsFromFile($currentLanguage); - vglobal('app_strings', $moduleLanguageStrings['languageStrings']); + if(isset($moduleLanguageStrings['languageStrings'])){ + vglobal('app_strings', $moduleLanguageStrings['languageStrings']); + } } $view = $request->get('view'); diff --git a/includes/runtime/Controller.php b/includes/runtime/Controller.php index d0f9f9f78..c22079161 100644 --- a/includes/runtime/Controller.php +++ b/includes/runtime/Controller.php @@ -109,6 +109,8 @@ abstract class Vtiger_Action_Controller extends Vtiger_Controller { */ abstract class Vtiger_View_Controller extends Vtiger_Action_Controller { + protected $viewer; + function __construct() { parent::__construct(); } diff --git a/modules/Users/Users.php b/modules/Users/Users.php index e36ae8df0..f41230ba7 100755 --- a/modules/Users/Users.php +++ b/modules/Users/Users.php @@ -1370,7 +1370,7 @@ class Users extends CRMEntity { { for($i = 0;$i < count($this->homeorder_array);$i++) { - if($_REQUEST[$this->homeorder_array[$i]] != '') + if(isset($_REQUEST[$this->homeorder_array[$i]]) && $_REQUEST[$this->homeorder_array[$i]] != '') { $save_array[] = $this->homeorder_array[$i]; $qry=" update vtiger_homestuff,vtiger_homedefault set vtiger_homestuff.visible=0 where vtiger_homestuff.stuffid=vtiger_homedefault.stuffid and vtiger_homestuff.userid=".$id." and vtiger_homedefault.hometype='".$this->homeorder_array[$i]."'";//To show the default Homestuff on the the Home Page diff --git a/modules/Users/models/Field.php b/modules/Users/models/Field.php index e8f35a88b..018823ac7 100644 --- a/modules/Users/models/Field.php +++ b/modules/Users/models/Field.php @@ -106,7 +106,7 @@ class Users_Field_Model extends Vtiger_Field_Model { * @param <String> $value - value which need to be converted to display value * @return <String> - converted display value */ - public function getDisplayValue($value, $recordId = false) { + public function getDisplayValue($value, $recordId = false, $recordInstance = false) { if($this->get('uitype') == 32){ return Vtiger_Language_Handler::getLanguageLabel($value); diff --git a/modules/Users/models/Privileges.php b/modules/Users/models/Privileges.php index 5fdcd1386..e73fee973 100644 --- a/modules/Users/models/Privileges.php +++ b/modules/Users/models/Privileges.php @@ -106,7 +106,7 @@ class Users_Privileges_Model extends Users_Record_Model { * @param <Number> $userId * @return Users_Privilege_Model object */ - public static function getInstanceById($userId) { + public static function getInstanceById($userId, $module=null) { if (empty($userId)) return null; @@ -115,21 +115,21 @@ class Users_Privileges_Model extends Users_Record_Model { $valueMap = array(); $valueMap['id'] = $userId; - $valueMap['is_admin'] = (bool) $is_admin; - $valueMap['roleid'] = $current_user_roles; - $valueMap['parent_role_seq'] = $current_user_parent_role_seq; - $valueMap['profiles'] = $current_user_profiles; - $valueMap['profile_global_permission'] = $profileGlobalPermission; - $valueMap['profile_tabs_permission'] = $profileTabsPermission; - $valueMap['profile_action_permission'] = $profileActionPermission; - $valueMap['groups'] = $current_user_groups; - $valueMap['subordinate_roles'] = $subordinate_roles; - $valueMap['parent_roles'] = $parent_roles; - $valueMap['subordinate_roles_users'] = $subordinate_roles_users; - $valueMap['defaultOrgSharingPermission'] = $defaultOrgSharingPermission; - $valueMap['related_module_share'] = $related_module_share; - - if(is_array($user_info)) { + $valueMap['is_admin'] = isset($is_admin) ? (bool) $is_admin : null; + $valueMap['roleid'] = isset($current_user_roles) ? $current_user_roles : null; + $valueMap['parent_role_seq'] = isset($current_user_parent_role_seq) ? $current_user_parent_role_seq : null; + $valueMap['profiles'] = isset($current_user_profiles) ? $current_user_profiles : null; + $valueMap['profile_global_permission'] = isset($profileGlobalPermission) ? $profileGlobalPermission : null; + $valueMap['profile_tabs_permission'] = isset($profileTabsPermission) ? $profileTabsPermission : null; + $valueMap['profile_action_permission'] = isset($profileActionPermission) ? $profileActionPermission : null; + $valueMap['groups'] = isset($current_user_groups) ? $current_user_groups : null; + $valueMap['subordinate_roles'] = isset($subordinate_roles) ? $subordinate_roles : null; + $valueMap['parent_roles'] = isset($parent_roles) ? $parent_roles : null; + $valueMap['subordinate_roles_users'] = isset($subordinate_roles_users) ? $subordinate_roles_users : null; + $valueMap['defaultOrgSharingPermission'] = isset($defaultOrgSharingPermission) ? $defaultOrgSharingPermission : null; + $valueMap['related_module_share'] = isset($related_module_share) ? $related_module_share : null; + + if(isset($user_info) && is_array($user_info)) { $valueMap = array_merge($valueMap, $user_info); } diff --git a/modules/Users/models/Record.php b/modules/Users/models/Record.php index d48fd6806..e45c90ec6 100644 --- a/modules/Users/models/Record.php +++ b/modules/Users/models/Record.php @@ -151,9 +151,10 @@ class Users_Record_Model extends Vtiger_Record_Model { $currentUserModel = NULL; if (isset(self::$currentUserModels[$currentUser->id])) { $currentUserModel = self::$currentUserModels[$currentUser->id]; - if ($currentUser->column_fields['modifiedtime'] != $currentUserModel->get('modifiedtime')) { + if (isset($currentUser->column_fields['modifiedtime']) && + $currentUser->column_fields['modifiedtime'] != $currentUserModel->get('modifiedtime')) { $currentUserModel = NULL; - } + } } if (!$currentUserModel) { $currentUserModel = self::getInstanceFromUserObject($currentUser); @@ -638,7 +639,8 @@ class Users_Record_Model extends Vtiger_Record_Model { public function isAccountOwner() { $db = PearDatabase::getInstance(); $query = 'SELECT is_owner FROM vtiger_users WHERE id = ?'; - $isOwner = $db->query_result($db->pquery($query, array($this->getId())), 0, 'is_owner'); + $res = $db->pquery($query, array($this->getId())); + $isOwner = $db->query_result($res, 0, 'is_owner'); if($isOwner == 1) { return true; } diff --git a/modules/Users/views/SystemSetup.php b/modules/Users/views/SystemSetup.php index a67d5cae0..23781a3dd 100644 --- a/modules/Users/views/SystemSetup.php +++ b/modules/Users/views/SystemSetup.php @@ -10,7 +10,7 @@ class Users_SystemSetup_View extends Vtiger_Index_View { - public function preProcess(Vtiger_Request $request) { + public function preProcess(Vtiger_Request $request, $display=true) { return true; } diff --git a/modules/Vtiger/models/DashBoard.php b/modules/Vtiger/models/DashBoard.php index 53488f569..fc1f1ce7a 100644 --- a/modules/Vtiger/models/DashBoard.php +++ b/modules/Vtiger/models/DashBoard.php @@ -145,10 +145,10 @@ class Vtiger_DashBoard_Model extends Vtiger_Base_Model { */ public function checkModulePermission($resultData) { $currentUserPrivilegeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); - $linkUrl = $resultData['linkurl']; - $linkLabel = $resultData['linklabel']; - $filterId = $resultData['filterid']; - $data = decode_html($resultData['data']); + $linkUrl = isset($resultData['linkurl']) ? $resultData['linkurl'] : null; + $linkLabel = isset($resultData['linklabel']) ? $resultData['linklabel'] : null; + $filterId = isset($resultData['filterid']) ? $resultData['filterid'] : null; + $data = isset($resultData['data']) ? decode_html($resultData['data']) : null; $module = $this->getModuleNameFromLink($linkUrl, $linkLabel); if($module == 'Home' && !empty($filterId) && !empty($data)) { diff --git a/modules/Vtiger/models/Field.php b/modules/Vtiger/models/Field.php index 4a76e6696..4b1817348 100644 --- a/modules/Vtiger/models/Field.php +++ b/modules/Vtiger/models/Field.php @@ -14,6 +14,8 @@ include_once 'vtlib/Vtiger/Field.php'; */ class Vtiger_Field_Model extends Vtiger_Field { + protected $fieldDataType; + protected $uitype_instance; var $webserviceField = false; const REFERENCE_TYPE = 'reference'; diff --git a/modules/Vtiger/models/Menu.php b/modules/Vtiger/models/Menu.php index 6fc253df3..b01866a86 100644 --- a/modules/Vtiger/models/Menu.php +++ b/modules/Vtiger/models/Menu.php @@ -18,7 +18,7 @@ class Vtiger_Menu_Model extends Vtiger_Module_Model { * @param <Boolean> $sequenced - true/false * @return <Array> - List of Vtiger_Menu_Model instances */ - public static function getAll($sequenced = false) { + public static function getAll($sequenced = false, $restrictedModulesList = array()) { $currentUser = Users_Record_Model::getCurrentUserModel(); $userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); $restrictedModulesList = array('Emails', 'ProjectMilestone', 'ProjectTask', 'ModComments', 'ExtensionStore', 'ExtensionStorePro', diff --git a/modules/Vtiger/uitypes/Boolean.php b/modules/Vtiger/uitypes/Boolean.php index bcd6e5d9b..1694117eb 100644 --- a/modules/Vtiger/uitypes/Boolean.php +++ b/modules/Vtiger/uitypes/Boolean.php @@ -23,7 +23,7 @@ class Vtiger_Boolean_UIType extends Vtiger_Base_UIType { * @param <Object> $value * @return <Object> */ - public function getDisplayValue($value) { + public function getDisplayValue($value, $record = false, $recordInstance = false) { if($value == 1 || $value == '1' || strtolower($value) == 'on') { return Vtiger_Language_Handler::getTranslatedString('LBL_YES', $this->get('field')->getModuleName()); } diff --git a/modules/Vtiger/uitypes/Picklist.php b/modules/Vtiger/uitypes/Picklist.php index 14eaa9847..90528daaf 100644 --- a/modules/Vtiger/uitypes/Picklist.php +++ b/modules/Vtiger/uitypes/Picklist.php @@ -23,7 +23,7 @@ class Vtiger_Picklist_UIType extends Vtiger_Base_UIType { * @param <Object> $value * @return <Object> */ - public function getDisplayValue($value) { + public function getDisplayValue($value, $record = false, $recordInstance = false) { return Vtiger_Language_Handler::getTranslatedString($value, $this->get('field')->getModuleName()); } diff --git a/modules/Vtiger/views/Header.php b/modules/Vtiger/views/Header.php index 1051ed4de..683e0558d 100644 --- a/modules/Vtiger/views/Header.php +++ b/modules/Vtiger/views/Header.php @@ -29,7 +29,7 @@ abstract class Vtiger_Header_View extends Vtiger_View_Controller { * which are registered for 5.x modules (and now provided for 6.x as well). */ protected function checkFileUriInRelocatedMouldesFolder($fileuri) { - list ($filename, $query) = explode('?', $fileuri); + list ($filename, $query) = array_pad(explode('?', $fileuri, 2), 2, null); // prefix the base lookup folder (relocated file). if (strpos($filename, 'modules') === 0) { diff --git a/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php b/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php index abf112fdc..d59955d2f 100644 --- a/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php +++ b/pkg/vtiger/modules/PBXManager/modules/PBXManager/PBXManager.php @@ -319,7 +319,7 @@ class PBXManager extends CRMEntity { $log->fatal('MakeOutgoingCalls ActionName Removed'); } - function checkLinkPermission($linkData){ + static function checkLinkPermission($linkData){ $module = new Vtiger_Module(); $moduleInstance = $module->getInstance('PBXManager'); diff --git a/vtlib/Vtiger/Block.php b/vtlib/Vtiger/Block.php index 6ffe571c2..3d78e0474 100644 --- a/vtlib/Vtiger/Block.php +++ b/vtlib/Vtiger/Block.php @@ -71,12 +71,13 @@ class Vtiger_Block { * @access private */ function initialize($valuemap, $moduleInstance=false) { - $this->id = $valuemap[blockid]; - $this->label= $valuemap[blocklabel]; - $this->display_status = $valuemap[display_status]; - $this->sequence = $valuemap[sequence]; - $this->iscustom = $valuemap[iscustom]; - $this->module=$moduleInstance? $moduleInstance: Vtiger_Module::getInstance($valuemap[tabid]); + $this->id = isset($valuemap['blockid']) ? $valuemap['blockid'] : null; + $this->label= isset($valuemap['blocklabel']) ? $valuemap['blocklabel'] : null; + $this->display_status = isset($valuemap['display_status']) ? $valuemap['display_status'] : null; + $this->sequence = isset($valuemap['sequence']) ? $valuemap['sequence'] : null; + $this->iscustom = isset($valuemap['iscustom']) ? $valuemap['iscustom'] : null; + $tabid = isset($valuemap['tabid']) ? $valuemap['tabid'] : null; + $this->module= $moduleInstance ? $moduleInstance : Vtiger_Module::getInstance($tabid); } /** diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index e0c3aaced..a3e5f8eb2 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -765,7 +765,8 @@ class Vtiger_Functions { $tag_cloud_status = 1; } else { $query = "select visible from vtiger_homestuff where userid=? and stufftype='Tag Cloud'"; - $tag_cloud_status = $adb->query_result($adb->pquery($query, array($id)), 0, 'visible'); + $res = $adb->pquery($query, array($id)); + $tag_cloud_status = $adb->query_result($res, 0, 'visible'); } if ($tag_cloud_status == 0) { diff --git a/vtlib/Vtiger/Link.php b/vtlib/Vtiger/Link.php index 6898baa54..813de688d 100644 --- a/vtlib/Vtiger/Link.php +++ b/vtlib/Vtiger/Link.php @@ -41,17 +41,17 @@ class Vtiger_Link { * Initialize this instance. */ function initialize($valuemap) { - $this->tabid = $valuemap['tabid']; - $this->linkid = $valuemap['linkid']; - $this->linktype=$valuemap['linktype']; - $this->linklabel=$valuemap['linklabel']; - $this->linkurl =decode_html($valuemap['linkurl']); - $this->linkicon =decode_html($valuemap['linkicon']); - $this->sequence =$valuemap['sequence']; - $this->status =$valuemap['status']; - $this->handler_path =$valuemap['handler_path']; - $this->handler_class=$valuemap['handler_class']; - $this->handler =$valuemap['handler']; + $this->tabid = isset($valuemap['tabid']) ? $valuemap['tabid'] : null; + $this->linkid = isset($valuemap['linkid']) ? $valuemap['linkid'] : null; + $this->linktype=isset($valuemap['linktype']) ? $valuemap['linktype'] : null; + $this->linklabel=isset($valuemap['linklabel']) ? $valuemap['linklabel'] : null; + $this->linkurl =isset($valuemap['linkurl']) ? decode_html($valuemap['linkurl']) : null; + $this->linkicon =isset($valuemap['linkicon']) ? decode_html($valuemap['linkicon']) : null; + $this->sequence =isset($valuemap['sequence']) ? $valuemap['sequence'] : null; + $this->status =isset($valuemap['status']) ? $valuemap['status'] : null; + $this->handler_path =isset($valuemap['handler_path']) ? $valuemap['handler_path'] : null; + $this->handler_class=isset($valuemap['handler_class']) ? $valuemap['handler_class'] : null; + $this->handler =isset($valuemap['handler']) ? $valuemap['handler'] : null; } /** -- GitLab