diff --git a/public_html/deployment/classes/cache.class.php b/public_html/deployment/classes/cache.class.php index 471c578bb180b8bddd50944c9d45a52425940c96..7077f416eda033b727634065f24cfd019df5bf09 100644 --- a/public_html/deployment/classes/cache.class.php +++ b/public_html/deployment/classes/cache.class.php @@ -491,5 +491,3 @@ class AhCache { } // ---------------------------------------------------------------------- -?> - diff --git a/public_html/deployment/classes/config-replacement.class.php b/public_html/deployment/classes/config-replacement.class.php index e8f9a675216d7f2c54f58520f519a0272feb6494..868967fb4813d2f3edf452fbdcf4b3b248f15d7a 100644 --- a/public_html/deployment/classes/config-replacement.class.php +++ b/public_html/deployment/classes/config-replacement.class.php @@ -115,7 +115,7 @@ class configreplacement { } // return already cached result - if (array_key_exists($sProject, $this->_aForemanReplacements)){ + if (isset($this->_aForemanReplacements[$sProject])){ return $this->_aForemanReplacements[$sProject]; } diff --git a/public_html/deployment/classes/foremanapi.class.php b/public_html/deployment/classes/foremanapi.class.php index e0e9851efb1eeb08f65c5b5dbabc01ee053ed24c..75f5c50196de1883776709a2e321a941c6ac8cf6 100644 --- a/public_html/deployment/classes/foremanapi.class.php +++ b/public_html/deployment/classes/foremanapi.class.php @@ -154,7 +154,7 @@ class ForemanApi { */ protected function log($sMessage, $sLevel = "info") { global $oCLog; - if($oCLog && method_exists($oLog, 'add')){ + if(is_object($oCLog) && method_exists($oCLog, 'add')){ return $oCLog->add(basename(__FILE__) . " class " . __CLASS__ . " - " . $sMessage, $sLevel); } } @@ -326,7 +326,7 @@ class ForemanApi { // prevent missing data because of paging - if ($this->_aRequest['method']==='GET' && !array_key_exists('per_page', $this->_aRequest['filter'])){ + if ($this->_aRequest['method']==='GET' && !isset($this->_aRequest['filter']['per_page'])){ $this->_aRequest['filter']['per_page']=1000; } // TODO check postdata diff --git a/public_html/deployment/classes/formgen.class.php b/public_html/deployment/classes/formgen.class.php index 0e1ea574d1ed829579ef5bc0d279687aab368dc9..f5ba5657824396166f65710aa4ce6c023911d5dd 100644 --- a/public_html/deployment/classes/formgen.class.php +++ b/public_html/deployment/classes/formgen.class.php @@ -23,7 +23,7 @@ class formgen { * @return boolean */ public function __construct($aNewFormData = array()) { - if (count($aNewFormData)){ + if (is_array($aNewFormData) && count($aNewFormData)){ return $this->setFormarray($aNewFormData); } return true; diff --git a/public_html/deployment/classes/ldap.class.php b/public_html/deployment/classes/ldap.class.php index d75e5971af70b0d0fae5d596a3cc3bba6f90c2a7..49297e3581e745122337762338b0dea3f1ae486a 100644 --- a/public_html/deployment/classes/ldap.class.php +++ b/public_html/deployment/classes/ldap.class.php @@ -4,6 +4,7 @@ * IML LDAP CONNECTOR FOR USER AUTHENTICATION * * @author axel.hahn@iml.unibe.ch + * 07-2017 */ class imlldap { diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index 941ddc370d4aa11fabdd364980a6f3e211b1937c..dab812e24ea55868802c434f82d119f02abf5be8 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -208,7 +208,7 @@ class project extends base { * @return boolean */ private function _verifyConfig() { - if (!count($this->_aPrjConfig)){ + if (!is_array($this->_aPrjConfig) || !count($this->_aPrjConfig)){ // die(t("class-project-error-no-config")); throw new Exception(t("class-project-error-no-config")); } @@ -1047,7 +1047,9 @@ class project extends base { */ public function isActivePhase($sPhase) { return ( - array_key_exists("active", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["active"][0] : false + $this->_aPrjConfig && isset($this->_aPrjConfig["phases"][$sPhase]["active"][0]) + ? $this->_aPrjConfig["phases"][$sPhase]["active"][0] + : false ); } @@ -3321,10 +3323,8 @@ class project extends base { 'value' => false, ); if ( - array_key_exists('messenger', $this->_aConfig) - && array_key_exists('slack', $this->_aConfig['messenger']) - && array_key_exists('presets', $this->_aConfig['messenger']['slack']) - && count(array_key_exists('presets', $this->_aConfig['messenger']['slack']['presets'])) + isset($this->_aConfig['messenger']['slack']['presets']) + && count($this->_aConfig['messenger']['slack']['presets']) ) { $aSelectSlack = array( 'type' => 'select', @@ -3942,7 +3942,7 @@ class project extends base { // 'required' => 'required', 'validate' => 'isastring', 'size' => 100, - 'placeholder' => implode(", ", $this->_aConfig["phases"][$sPhase]["deploytimes"]), + 'placeholder' => isset($this->_aConfig["phases"][$sPhase]["deploytimes"]) ? implode(", ", $this->_aConfig["phases"][$sPhase]["deploytimes"]) : '', ); $aForms["setup"]["form"]['input' . $i++] = array( 'type' => 'markup', diff --git a/public_html/deployment/inc_functions.php b/public_html/deployment/inc_functions.php index ec157dd376d936267b7f033abe171e510f4e959a..75b8ef4b36b9067960384ee2506ff4a6019e0a42 100644 --- a/public_html/deployment/inc_functions.php +++ b/public_html/deployment/inc_functions.php @@ -118,7 +118,10 @@ if (isset($_SERVER) && is_array($_SERVER) && array_key_exists("REQUEST_URI", $_S */ foreach (array_keys($aParams) as $sKey) { - $aParams[$sKey] = str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $aParams[$sKey]); + $aParams[$sKey] = is_string($aParams[$sKey]) + ? str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $aParams[$sKey]) + : $aParams[$sKey] + ; } } diff --git a/public_html/deployment/plugins/rollout/awx/rollout_awx.php b/public_html/deployment/plugins/rollout/awx/rollout_awx.php index c9b315e1d7c7178ad2bdd6f35fba38db75581a82..a0df104b00a8a4b422f6271472ca152b7349416b 100644 --- a/public_html/deployment/plugins/rollout/awx/rollout_awx.php +++ b/public_html/deployment/plugins/rollout/awx/rollout_awx.php @@ -87,7 +87,7 @@ class rollout_awx extends rollout_base { * [id] => array('value' => [ID], 'label' => [NAME] [ID]) * @return array */ - static public function getAwxInventories(){ + public function getAwxInventories(){ $aResponse=$this->_httpRequest(array( 'url'=>'/inventories/?order_by=name'.$this->_sAwxApiPaging, 'method'=>'GET', @@ -128,7 +128,7 @@ class rollout_awx extends rollout_base { * [id] => array('value' => [ID], 'label' => [PLAYBOOK] [ID]) * @return array */ - static public function getAwxJobTemplates(){ + public function getAwxJobTemplates(){ $aResponse=$this->_httpRequest(array( 'url'=>'/job_templates/?order_by=name'.$this->_sAwxApiPaging, 'method'=>'GET',