diff --git a/public_html/deployment/classes/actionlog.class.php b/public_html/deployment/classes/actionlog.class.php index 21e197f8b9c61223e360bb9ef0d706db7644e649..e2cdfa6e5f09a8352014d51393537cbea7b5fc1a 100644 --- a/public_html/deployment/classes/actionlog.class.php +++ b/public_html/deployment/classes/actionlog.class.php @@ -45,7 +45,7 @@ class Actionlog { */ public function __construct($sProject = false) { global $aConfig; - if (!is_array($aConfig) || !array_key_exists("appRootDir", $aConfig)) { + if (!isset($aConfig["appRootDir"])) { die(__CLASS__ . "::".__FUNCTION__." ERROR: configuration with \$aConfig was not loaded."); } $this->_dbfile = $aConfig['dataDir'] . '/database/logs.db'; @@ -164,24 +164,24 @@ class Actionlog { $sWhere = false; $aWhere=array(); - if (array_key_exists("project", $aFilter) && $aFilter["project"]) { + if (isset($aFilter["project"]) && $aFilter["project"]) { $aWhere[]='`project`="' . $this->_filterAllowedChars($aFilter["project"], '[a-z0-9\-\_]') . '"'; } - if (array_key_exists("from", $aFilter) && $aFilter["from"]) { + if (isset($aFilter["from"])) { $aWhere[]='`time`>="' . $this->_filterAllowedChars($aFilter["from"], '[0-9\-\ \:]') . '"'; } - if (array_key_exists("to", $aFilter) && $aFilter["to"]) { + if (isset($aFilter["to"])) { $aWhere[]='`time`<="' . $this->_filterAllowedChars($aFilter["to"], '[0-9\-\ \:]') . '"'; } $sSql.=(count($aWhere) ? 'WHERE '. implode(' AND ', $aWhere) : ''); - if (array_key_exists("order", $aFilter) && $aFilter["order"]) { + if (isset($aFilter["order"])) { $sSql.=' ORDER BY ' . $this->_filterAllowedChars($aFilter["order"], '[a-z\`0-9\,\ ]'); } else { $sSql.=' ORDER BY id DESC '; } - if (array_key_exists("limit", $aFilter) && $aFilter["limit"]) { + if (isset($aFilter["limit"])) { $sSql.=' LIMIT ' . $this->_filterAllowedChars($aFilter["limit"], '[0-9\,\ ]'); } @@ -293,13 +293,13 @@ class Actionlog { } else { // write filters as hidden fields - if (array_key_exists("project", $aFilter)){ + if (isset($aFilter["project"])){ $aForms["filter"]["form"]['selectproject'] = array( 'type' => 'hidden', 'value' => $aFilter["project"] ); } - if (array_key_exists("limit", $aFilter)){ + if (isset($aFilter["limit"])){ $aForms["filter"]["form"]['selectlimit'] = array( 'type' => 'hidden', 'value' => $aFilter["limit"] diff --git a/public_html/deployment/classes/config-replacement.class.php b/public_html/deployment/classes/config-replacement.class.php index 868967fb4813d2f3edf452fbdcf4b3b248f15d7a..93fb09a85b937b4526583168ff42687cdf247b2c 100644 --- a/public_html/deployment/classes/config-replacement.class.php +++ b/public_html/deployment/classes/config-replacement.class.php @@ -50,7 +50,7 @@ class configreplacement { $aBuildfiles=$this->_oProject->getBuildfilesByPlace($this->_sPhase, 'ready2install'); } - if (!$aBuildfiles || !array_key_exists('types', $aBuildfiles) || !array_key_exists('templates', $aBuildfiles['types'])){ + if (!isset($aBuildfiles['types']['templates'])){ return false; } foreach ($aBuildfiles['types']['templates'] as $sFile){ @@ -110,7 +110,7 @@ class configreplacement { } // abort if no foreman connection was configured - if (!array_key_exists('foreman', $aConfig)) { + if (!isset($aConfig['foreman'])) { return false; } @@ -147,7 +147,7 @@ class configreplacement { // HACK: phases are part of the hostname .. but not "live" ... and special handling for demo $aPrjConfig=$this->_oProject->getConfig(); - $bIsDemo=(array_key_exists('fileprefix', $aPrjConfig) + $bIsDemo=(isset($aPrjConfig['fileprefix']) && !strpos($aPrjConfig['fileprefix'], 'demo')===false); $sPhase=$bIsDemo ? 'demo' : $this->_sPhase; foreach($aHosts as $aName){ @@ -216,14 +216,14 @@ class configreplacement { $aReturn=array(); foreach ($aProject as $sFile=>$aParams){ $aReturn[$sFile]=array(); - if (array_key_exists('target', $aParams)){ + if (isset($aParams['target'])){ $aReturn[$sFile]['target']=$aParams['target']; } - if (array_key_exists('replace', $aParams)){ + if (isset($aParams['replace'])){ $aReplace=json_decode($aParams['replace'], 1); $aReturn[$sFile]['replace_source']=$aReplace; foreach ($aReplace as $sVarname=>$value){ - if (is_array($value) && array_key_exists('_'.$this->_sPhase.'_', $value)){ + if (isset($value['_'.$this->_sPhase.'_'])){ $value=$value['_'.$this->_sPhase.'_']; } $aReturn[$sFile]['replace'][$sVarname]=$value; @@ -252,13 +252,10 @@ class configreplacement { */ private function _getForemanBaseUrl(){ global $aConfig; - if (!array_key_exists('foreman', $aConfig) - || !array_key_exists('api', $aConfig['foreman']) - || !$aConfig['foreman']['api'] - ){ - return false; - } - return $aConfig['foreman']['api']; + return (isset($aConfig['foreman']['api'])) + ? $aConfig['foreman']['api'] + : false + ; } /** @@ -272,7 +269,7 @@ class configreplacement { return false; } $aTmp=$this->_getForemanReplacement(); - if (!array_key_exists('hostsphase', $aTmp)){ + if (!isset($aTmp['hostsphase'])){ return false; } require_once 'htmlguielements.class.php'; diff --git a/public_html/deployment/classes/deploy-foreman.class.php b/public_html/deployment/classes/deploy-foreman.class.php index b99127d115155e3d06941b29762f9786ca57f49d..6964963958790d985af20af850aead1d72d23323 100644 --- a/public_html/deployment/classes/deploy-foreman.class.php +++ b/public_html/deployment/classes/deploy-foreman.class.php @@ -123,7 +123,7 @@ class deployForeman { public function __construct($aCfg) { - if(!is_array($aCfg) || !count($aCfg) || !array_key_exists('api', $aCfg)){ + if(!isset($aCfg['api'])){ die("ERROR: class ".__CLASS__." must be initialized with an array containing api config for foreman."); return false; } @@ -173,7 +173,7 @@ class deployForeman { * @return string */ protected function _generateUrl(){ - if(!array_key_exists('request', $this->_aRequest)){ + if(!isset($this->_aRequest['request'])){ die('ERROR: missing key [request]'); } $sReturn=$this->_aCfg['api']; @@ -182,7 +182,7 @@ class deployForeman { $sReturn.=$sPrefix; foreach($this->_aRequest['request'] as $aReqItem){ - if (!array_key_exists($aReqItem[0], $this->_aAllowedUrls[$sPrefix])){ + if (!isset($this->_aAllowedUrls[$sPrefix][$aReqItem[0]])){ echo 'WARNING: wrong item: [' . $aReqItem[0]."]<br>\n"; } $sReturn.=$aReqItem[0] ? $aReqItem[0].'/' : ''; @@ -199,14 +199,14 @@ class deployForeman { * @return string */ protected function _generateParams(){ - if (!array_key_exists('filter', $this->_aRequest)){ + if (!isset($this->_aRequest['filter'])){ return ''; } $sReturn='?'; // TODO: "sort by" and "sort order" ... need to be added here ... somehow foreach(array('page', 'per_page', 'search') as $sParam){ - if (array_key_exists($sParam, $this->_aRequest['filter'])){ + if (isset($this->_aRequest['filter'][$sParam])){ $sReturn.='&'.$sParam.'='.urlencode($this->_aRequest['filter'][$sParam]); } } @@ -233,10 +233,11 @@ class deployForeman { die("ERROR: PHP CURL module is not installed."); } - $sApiUser=array_key_exists('user', $this->_aCfg) ? $this->_aCfg['user'] : false; - $sApiPassword=array_key_exists('password', $this->_aCfg) ? $this->_aCfg['password'] : false; + $sApiUser=isset($this->_aCfg['user']) ? $this->_aCfg['user'] : false; + $sApiPassword=isset($this->_aCfg['password']) ? $this->_aCfg['password'] : false; - $sFullUrl=$sApiUrl.$this->_aRequest['url']; + // $sFullUrl=$sApiUrl.$this->_aRequest['url']; + $sFullUrl=$this->_aRequest['url']; $this->log(__FUNCTION__ . " ".$this->_aRequest['method']." " . $this->_aRequest['url']); $ch = curl_init($this->_aRequest['url']); @@ -309,11 +310,16 @@ class deployForeman { // 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 - if ($this->_aRequest['method']==='POST' && (!array_key_exists('postdata',$this->_aRequest) || !count($this->_aRequest['postdata']))){ + if ($this->_aRequest['method']==='POST' && ( + !isset($this->_aRequest['postdata']) + || !is_array($this->_aRequest['postdata']) + || !count($this->_aRequest['postdata']) + ) + ){ die("ERROR in ".__CLASS__."::".__FUNCTION__.": missing data to make a POST request"); } @@ -344,7 +350,7 @@ class deployForeman { if($bOk){ $aJson=json_decode($aReturn['body'], 1); if (is_array($aJson)){ - if (array_key_exists('total', $aJson) && $aJson['total'] > $aJson['per_page']){ + if (isset($aJson['total']) && $aJson['total'] > $aJson['per_page']){ $bOk=false; $sStatus='Http OK, but incomplete results (paging)'; } @@ -367,10 +373,10 @@ class deployForeman { * @return array */ protected function _filterOutput($aData){ - if(!array_key_exists('response', $this->_aRequest)){ + if(!isset($this->_aRequest['response'])){ return $aData; } - $aTmp=array_key_exists('results', $aData['_json']) ? $aData['_json']['results'] : array($aData['_json']); + $aTmp=isset($aData['_json']['results']) ? $aData['_json']['results'] : array($aData['_json']); if(!count($aTmp)){ return array(); } diff --git a/public_html/deployment/classes/foremanapi.class.php b/public_html/deployment/classes/foremanapi.class.php index 75f5c50196de1883776709a2e321a941c6ac8cf6..d6d8fd0648390bdcc8980084ec7dfd01a2975a24 100644 --- a/public_html/deployment/classes/foremanapi.class.php +++ b/public_html/deployment/classes/foremanapi.class.php @@ -133,7 +133,7 @@ class ForemanApi { public function __construct($aCfg) { - if(!is_array($aCfg) || !count($aCfg) || !array_key_exists('api', $aCfg)){ + if(!isset($aCfg['api'])){ die("ERROR: class ".__CLASS__." must be initialized with an array containing api config for foreman."); return false; } @@ -154,9 +154,7 @@ class ForemanApi { */ protected function log($sMessage, $sLevel = "info") { global $oCLog; - if(is_object($oCLog) && method_exists($oCLog, 'add')){ - return $oCLog->add(basename(__FILE__) . " class " . __CLASS__ . " - " . $sMessage, $sLevel); - } + return $oCLog->add(basename(__FILE__) . " class " . __CLASS__ . " - " . $sMessage, $sLevel); } /** @@ -188,7 +186,7 @@ class ForemanApi { * @return string */ protected function _generateUrl(){ - if(!array_key_exists('request', $this->_aRequest)){ + if(!isset($this->_aRequest['request'])){ die('ERROR: missing key [request]'); } $sReturn=$this->_aCfg['api']; @@ -197,7 +195,7 @@ class ForemanApi { $sReturn.=$sPrefix.'/'; foreach($this->_aRequest['request'] as $aReqItem){ - if (!array_key_exists($aReqItem[0], $this->_aAllowedUrls[$sPrefix])){ + if (!isset($this->_aAllowedUrls[$sPrefix][$aReqItem[0]])){ echo 'WARNING: wrong item: [' . $aReqItem[0]."]<br>\n"; } $sReturn.=$aReqItem[0] ? $aReqItem[0].'/' : ''; @@ -214,7 +212,7 @@ class ForemanApi { * @return string */ protected function _generateParams(){ - if (!array_key_exists('filter', $this->_aRequest)){ + if (!isset($this->_aRequest['filter'])){ return ''; } $sReturn='?'; @@ -246,10 +244,11 @@ class ForemanApi { die("ERROR: PHP CURL module is not installed."); } - $sApiUser=array_key_exists('user', $this->_aCfg) ? $this->_aCfg['user'] : false; - $sApiPassword=array_key_exists('password', $this->_aCfg) ? $this->_aCfg['password'] : false; + $sApiUser=isset($this->_aCfg['user']) ? $this->_aCfg['user'] : false; + $sApiPassword=isset($this->_aCfg['password']) ? $this->_aCfg['password'] : false; - $sFullUrl=$sApiUrl.$this->_aRequest['url']; + // $sFullUrl=$sApiUrl.$this->_aRequest['url']; + $sFullUrl=$this->_aRequest['url']; $this->log(__FUNCTION__ . " ".$this->_aRequest['method']." " . $this->_aRequest['url']); $ch = curl_init($this->_aRequest['url']); @@ -330,12 +329,19 @@ class ForemanApi { $this->_aRequest['filter']['per_page']=1000; } // TODO check postdata - if ($this->_aRequest['method']==='POST' && (!array_key_exists('postdata',$this->_aRequest) || !count($this->_aRequest['postdata']))){ + if ($this->_aRequest['method']==='POST' && ( + !isset($this->_aRequest['postdata']) + || !is_array($this->_aRequest['postdata']) + || !count($this->_aRequest['postdata']) + ) + ){ die("ERROR in ".__CLASS__."::".__FUNCTION__.": missing data to make a POST request"); } - if (!array_key_exists('url', $this->_aRequest)){ - $this->_aRequest['url']=$this->_generateUrl().$this->_generateParams(); - } + + $this->_aRequest['url']=isset($this->_aRequest['url']) + ? $this->_aRequest['url'] + : $this->_generateUrl().$this->_generateParams() + ; // ----- request $this->_writeDebug(__FUNCTION__ . ' start request <pre>'.print_r($this->_aRequest,1).'</pre>'); @@ -362,7 +368,7 @@ class ForemanApi { if($bOk){ $aJson=json_decode($aReturn['body'], 1); if (is_array($aJson)){ - if (array_key_exists('total', $aJson) && $aJson['total'] > $aJson['per_page']){ + if (isset($aJson['total']) && $aJson['total'] > $aJson['per_page']){ $bOk=false; $sStatus='Http OK, but incomplete results (paging)'; } @@ -386,11 +392,10 @@ class ForemanApi { * @return array */ protected function _filterOutput($aData){ - if(!array_key_exists('response', $this->_aRequest)){ + if(!isset($this->_aRequest['response'])){ return $aData; } - $bIsList=array_key_exists('results', $aData['_json']); - $aTmp=$bIsList ? $aData['_json']['results'] : array($aData['_json']); + $aTmp=isset($aData['_json']['results']) ? $aData['_json']['results'] : array($aData['_json']); if(!count($aTmp)){ return array(); } @@ -404,9 +409,12 @@ class ForemanApi { } $aReturn[] = $aReturnitem; } + /* return ($bIsList==1) ? $aReturn : (count($aReturn) ? $aReturn[0] : array()); + */ + return $aReturn; } diff --git a/public_html/deployment/classes/formgen.class.php b/public_html/deployment/classes/formgen.class.php index f5ba5657824396166f65710aa4ce6c023911d5dd..0cd6f23de7f33a546c8284d8028e8ec889069ff9 100644 --- a/public_html/deployment/classes/formgen.class.php +++ b/public_html/deployment/classes/formgen.class.php @@ -48,14 +48,14 @@ class formgen { */ public function renderHtml($sFormId) { $sReturn = false; - if (!array_key_exists($sFormId, $this->aForm)) { + if (!isset($this->aForm[$sFormId])) { die("ERROR: " . __CLASS__ . ":" . __FUNCTION__ . " - form id " . $sFormId . " does not exist."); } // FORM tag $sReturn.='<form '; - if (array_key_exists("meta", $this->aForm[$sFormId])) { + if (isset($this->aForm[$sFormId]["meta"])) { foreach (array("method", "action", "target", "accept-charset", "class", "id", "name") as $sAttr) { - if (array_key_exists($sAttr, $this->aForm[$sFormId]["meta"])) { + if (isset($this->aForm[$sFormId]["meta"][$sAttr])) { $sReturn.=$sAttr . '="' . $this->aForm[$sFormId]["meta"][$sAttr] . '" '; } } @@ -80,10 +80,10 @@ class formgen { private function _addHtmlAtrributes($aAttributes, $elementData) { $sReturn = false; foreach ($aAttributes as $sAtrr) { - if (array_key_exists($sAtrr, $elementData) && $elementData[$sAtrr]) { - if ($sReturn) - $sReturn.=' '; - $sReturn.=$sAtrr . '="' . $elementData[$sAtrr] . '"'; + if (isset($elementData[$sAtrr]) && $elementData[$sAtrr]) { + $sReturn.=($sReturn ? ' ' : '') + .$sAtrr . '="' . $elementData[$sAtrr] . '"' + ; } } return $sReturn; @@ -102,7 +102,7 @@ class formgen { private function _checkReqiredKeys($aArray, $aRequiredKeys, $sLabel = false) { $bReturn = true; foreach ($aRequiredKeys as $sKey) { - if (!array_key_exists($sKey, $aArray)) { + if (!isset($aArray[$sKey])) { die("ERROR: $sLabel<br>Missing key \"$sKey\" in the array of a form element:<pre>" . print_r($aArray, true) . "</pre>"); $bReturn = false; } @@ -130,7 +130,7 @@ class formgen { . "title" ; - if (!array_key_exists("type", $elementData)) { + if (!isset($elementData["type"])) { print_r($elementData); die("ERROR: " . __CLASS__ . ":" . __FUNCTION__ . " - key "type" does not exist."); } @@ -142,9 +142,9 @@ class formgen { $sHtmlDefault = ''; $sHtmlTable = ''; - if (array_key_exists("label", $elementData)) { + if (isset($elementData["label"])) { $sLabelText = $elementData["label"]; - $sLabelText.=(array_key_exists("required", $elementData) && $elementData["required"]) ? $this->sRequired : ''; + $sLabelText.=(isset($elementData["required"]) && $elementData["required"]) ? $this->sRequired : ''; } switch ($elementData["type"]) { @@ -190,7 +190,7 @@ class formgen { break; case "markup": - if (array_key_exists("value", $elementData)) + if (isset($elementData["value"])) $sHtmlDefault = $elementData["value"] . "\n"; break; @@ -224,7 +224,7 @@ class formgen { case "select": // HINWEIS optgroups werden nicht unterstuezt - nur einfache Listen $this->_checkReqiredKeys($elementData, array("name")); - $sDivClass=(array_key_exists("inline", $elementData) && $elementData["inline"])?"form-group":"col-sm-10"; + $sDivClass=(isset($elementData["inline"]) && $elementData["inline"])?"form-group":"col-sm-10"; $sFormElement.='<div class="'.$sDivClass.'"><select id="' . $sId . '" class="form-control" '; $sFormElement.=$this->_addHtmlAtrributes(explode(",", "$sDefaultAttributes,name,onchange"), $elementData); $sFormElement.=">\n"; @@ -239,7 +239,7 @@ class formgen { if ($sLabelText) { // $sLabelElement.='<span class="help-block">' . $sLabelText . '</span>' . "\n"; - $sLabelClass=(array_key_exists("inline", $elementData) && $elementData["inline"])?"":"col-sm-2"; + $sLabelClass=(isset($elementData["inline"]) && $elementData["inline"])?"":"col-sm-2"; $sLabelElement = $this->_addLabel($sLabelText, $sId, $sLabelClass); } @@ -252,7 +252,7 @@ class formgen { case "submit": $this->_checkReqiredKeys($elementData, array("value")); $sClass="btn btn-primary "; - if (array_key_exists("class", $elementData)){ + if (isset($elementData["class"])){ $sClass.=$elementData["class"]; } $elementData["class"]=$sClass; @@ -276,7 +276,7 @@ class formgen { $sFormElement.=' />'; $sFormElement.="\n"; - if (array_key_exists("inline", $elementData) && $elementData["inline"]){ + if (isset($elementData["class"]) && $elementData["inline"]){ $sLabelElement = $this->_addLabel($sLabelText, $sId, "col-sm-2"); // $sHtmlDefault = $sLabelElement . "\n" . $sFormElement . "\n"; $sHtmlDefault = $sLabelElement . '<div class="col-sm-3">' . "\n" . $sFormElement . '</div>' . "\n"; @@ -313,11 +313,11 @@ class formgen { } // Default or table mode? - if (array_key_exists("mode", $elementData) && $elementData["mode"] == 'table' && $sHtmlTable) { + if (isset($elementData["mode"]) && $elementData["mode"] == 'table' && $sHtmlTable) { $sHtmlDefault = $sHtmlTable; } else { if ($elementData["type"] != "button" && $elementData["type"] != "fieldset" && $elementData["type"] != "markup") { - if (!array_key_exists("inline", $elementData) || !$elementData["inline"]){ + if (!isset($elementData["inline"]) || !$elementData["inline"]){ // $sHtmlDefault = "<fieldset>" . $sHtmlDefault . "</fieldset>\n"; $sHtmlDefault = '<div class="form-group">' . $sHtmlDefault . '</div>'."\n"; } diff --git a/public_html/deployment/classes/htmlguielements.class.php b/public_html/deployment/classes/htmlguielements.class.php index 7efad72e9dacde729c80dc8250176d80785aa913..4ebc040673ee3e1c0ff1848716f0b8ec34963939 100644 --- a/public_html/deployment/classes/htmlguielements.class.php +++ b/public_html/deployment/classes/htmlguielements.class.php @@ -220,7 +220,7 @@ class htmlguielements{ * @return string */ public function addAttributeFromKey($sAttribute, $aData, $sDefault=''){ - return (array_key_exists($sAttribute, $aData) + return (isset($aData[$sAttribute]) ? $this->addAttribute($sAttribute, $aData[$sAttribute]) : $this->addAttribute($sAttribute, $sDefault) ); @@ -281,7 +281,7 @@ class htmlguielements{ * @return array */ public function getIconByType($sType){ - return (array_key_exists($sType, $this->aCfg['icons']) + return (isset($this->aCfg['icons'][$sType]) ? $this->getIcon($this->aCfg['icons'][$sType]) : '' ); @@ -296,11 +296,11 @@ class htmlguielements{ public function getLink($aItem){ $sHref=$this->addAttributeFromKey('href', $aItem, '#'); - $sLabel=(array_key_exists('icon', $aItem) ? $this->getIcon($aItem['icon']): '') - .(array_key_exists('label', $aItem) ? $aItem['label'] : ''); + $sLabel=(isset($aItem['icon']) ? $this->getIcon($aItem['icon']): '') + .(isset($aItem['label']) ? $aItem['label'] : ''); foreach(array('href', 'icon', 'label') as $sKey){ - if (array_key_exists($sKey, $aItem)){ + if (isset($aItem[$sKey])){ unset($aItem[$sKey]); } } @@ -322,7 +322,7 @@ class htmlguielements{ */ protected function _getButtonattributesByType($aItem){ $aReturn=$aItem; - if (array_key_exists($aItem['type'], $this->aCfg['buttons'])){ + if (isset($this->aCfg['buttons'][$aItem['type']])){ $sClass=$this->aCfg['buttons'][$aItem['type']]['class']; $aReturn['class'].=$sClass ? ' '.$sClass : ''; @@ -331,7 +331,11 @@ class htmlguielements{ $aReturn['icon']=$aReturn['icon'] ? $aReturn['icon'] : ( $this->aCfg['buttons'][$aItem['type']]['icon'] ? $this->aCfg['buttons'][$aItem['type']]['icon'] - : ( array_key_exists($aItem['type'], $this->aCfg['icons']) ? $this->aCfg['icons'][$aItem['type']] : '') + : ( + isset($this->aCfg['icons'][$aItem['type']]) + ? $this->aCfg['icons'][$aItem['type']] + : '' + ) ); } return $aReturn; @@ -346,13 +350,13 @@ class htmlguielements{ */ public function getLinkButton($aItem){ foreach(array('class', 'icon') as $sKey){ - if (!array_key_exists($sKey, $aItem)){ + if (!isset($aItem[$sKey])){ $aItem[$sKey]=''; } } $aItem['class'].='btn btn-default'; - if (array_key_exists('type', $aItem)){ + if (isset($aItem['type'])){ $aItem=$this->_getButtonattributesByType($aItem); unset($aItem['type']); } @@ -379,7 +383,7 @@ class htmlguielements{ ); $sClass = ""; $sPrefix = ""; - if (array_key_exists($sWarnlevel, $aCfg)) { + if (isset($aCfg[$sWarnlevel])) { $sClass = $aCfg[$sWarnlevel]["class"]; $sPrefix = $aCfg[$sWarnlevel]["prefix"]; $sMessage = '<strong>' . $aCfg[$sWarnlevel]["prefix"] . '</strong> ' . $sMessage; @@ -406,10 +410,10 @@ class htmlguielements{ } $sNavType=$aTabData['options']['type']; // "tabs" or "pills" $sNavCss='nav nav-'.$sNavType; - if (array_key_exists('stacked', $aTabData['options']) && $aTabData['options']['stacked']){ + if (isset($aTabData['options']['stacked']) && $aTabData['options']['stacked']){ $sNavCss.=' nav-stacked'; } - if (array_key_exists('justified', $aTabData['options']) && $aTabData['options']['justified']){ + if (isset($aTabData['options']['justified']) && $aTabData['options']['justified']){ $sNavCss.=' nav-justified'; } $sNavType=$aTabData['options']['justified']; @@ -443,7 +447,7 @@ class htmlguielements{ public function getTable($aTabledata) { $sTHead=''; $sTBody=''; - if (array_key_exists('body', $aTabledata)){ + if (isset($aTabledata['body'])){ foreach ($aTabledata['body'] as $aRow){ $sTBody.='<tr>'; foreach ($aRow as $sItem){ @@ -452,7 +456,7 @@ class htmlguielements{ $sTBody.='</tr>'; } } - if (array_key_exists('header', $aTabledata)){ + if (isset($aTabledata['header'])){ foreach ($aTabledata['header'] as $sItem){ $sTHead.='<th>'.$sItem.'</th>'; } diff --git a/public_html/deployment/classes/user.class.php b/public_html/deployment/classes/user.class.php index 285834040774a04fd38d294710f4128400e4c4b3..d1959659e51682639dae73aa236152b0891b1923 100644 --- a/public_html/deployment/classes/user.class.php +++ b/public_html/deployment/classes/user.class.php @@ -138,11 +138,11 @@ class user { public function authenticate(){ global $aConfig, $aParams; //print_r($aConfig); - if(!array_key_exists('auth', $aConfig) || !count($aConfig['auth']) || !array_key_exists('user', $aParams)){ + if(!isset($aConfig['auth']) || !is_array($aConfig['auth']) || !count($aConfig['auth']) || !isset($aParams['user'])){ return false; } $sUser=$aParams['user']; - $sPassword=array_key_exists('password', $aParams)?$aParams['password']:false; + $sPassword=isset($aParams['password']) ? $aParams['password'] : false; foreach (array_keys($aConfig['auth']) as $sAuthMethod){ $oUserAuth=false; diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php index d8d50f9872181d3faea4f85c93711d97f332ca85..a7b35edb5cd0b915c43e61adf8e29bfb9bfa175f 100644 --- a/public_html/deployment/classes/vcs.git.class.php +++ b/public_html/deployment/classes/vcs.git.class.php @@ -46,7 +46,7 @@ class vcs implements iVcs { /** * name of the default remote branch to access - * @var type + * @var string */ private $_sCurrentBranch = "origin/master"; @@ -80,7 +80,7 @@ class vcs implements iVcs { // checks // foreach (array("type", "url") as $key) { foreach (array("type") as $key) { - if (!array_key_exists($key, $aRepoConfig)) { + if (!isset($aRepoConfig[$key])) { die("ERROR: key $key does not exist in config <pre>" . print_r($aRepoConfig, true) . "</pre>"); } if (!$aRepoConfig[$key]) { @@ -346,9 +346,9 @@ class vcs implements iVcs { if ( is_array($this->_aRemoteBranches) && ( - array_key_exists($sBranch, $this->_aRemoteBranches) && $sVerifyRevision && $this->_aRemoteBranches[$sBranch]['revision'] == $sVerifyRevision + isset($this->_aRemoteBranches[$sBranch]) && $sVerifyRevision && $this->_aRemoteBranches[$sBranch]['revision'] == $sVerifyRevision || - array_key_exists($sBranch, $this->_aRemoteBranches) && !$sVerifyRevision + isset($this->_aRemoteBranches[$sBranch]) && !$sVerifyRevision ) ) { // it is up to date - doing nothing