Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3036 → Rev 3037

/web/acc/phpsysinfo/includes/ups/class.apcupsd.inc.php
39,27 → 39,54
public function __construct()
{
parent::__construct();
if (defined('PSI_UPS_APCUPSD_LIST') && is_string(PSI_UPS_APCUPSD_LIST)) {
if (preg_match(ARRAY_EXP, PSI_UPS_APCUPSD_LIST)) {
$upses = eval(PSI_UPS_APCUPSD_LIST);
if (!defined('PSI_UPS_APCUPSD_ACCESS')) {
define('PSI_UPS_APCUPSD_ACCESS', false);
}
switch (strtolower(PSI_UPS_APCUPSD_ACCESS)) {
case 'data':
if (defined('PSI_UPS_APCUPSD_LIST') && is_string(PSI_UPS_APCUPSD_LIST)) {
if (preg_match(ARRAY_EXP, PSI_UPS_APCUPSD_LIST)) {
$upss = eval(PSI_UPS_APCUPSD_LIST);
} else {
$upss = array(PSI_UPS_APCUPSD_LIST);
}
} else {
$upses = array(PSI_UPS_APCUPSD_LIST);
$upss = array('UPS');
}
foreach ($upses as $ups) {
CommonFunctions::executeProgram('apcaccess', 'status '.trim($ups), $temp);
$un = 0;
foreach ($upss as $ups) {
$temp = "";
CommonFunctions::rftsdata("upsapcupsd{$un}.tmp", $temp);
if (! empty($temp)) {
$this->_output[] = $temp;
}
$un++;
}
} else { //use default if address and port not defined
if (!defined('PSI_EMU_HOSTNAME')) {
CommonFunctions::executeProgram('apcaccess', 'status', $temp);
} else {
CommonFunctions::executeProgram('apcaccess', 'status '.PSI_EMU_HOSTNAME, $temp);
break;
default:
if (defined('PSI_UPS_APCUPSD_LIST') && is_string(PSI_UPS_APCUPSD_LIST)) {
if (preg_match(ARRAY_EXP, PSI_UPS_APCUPSD_LIST)) {
$upses = eval(PSI_UPS_APCUPSD_LIST);
} else {
$upses = array(PSI_UPS_APCUPSD_LIST);
}
foreach ($upses as $ups) {
$temp = "";
CommonFunctions::executeProgram('apcaccess', 'status '.trim($ups), $temp);
if (! empty($temp)) {
$this->_output[] = $temp;
}
}
} else { //use default if address and port not defined
if (!defined('PSI_EMU_HOSTNAME')) {
CommonFunctions::executeProgram('apcaccess', 'status', $temp);
} else {
CommonFunctions::executeProgram('apcaccess', 'status '.PSI_EMU_HOSTNAME, $temp);
}
if (! empty($temp)) {
$this->_output[] = $temp;
}
}
if (! empty($temp)) {
$this->_output[] = $temp;
}
}
}
 
66,7 → 93,7
/**
* parse the input and store data in resultset for xml generation
*
* @return Void
* @return void
*/
private function _info()
{
143,7 → 170,7
*
* @see PSI_Interface_UPS::build()
*
* @return Void
* @return void
*/
public function build()
{