diff --git a/provisioning.phtml b/provisioning.phtml index 3e1eed1..46ea46c 100644 --- a/provisioning.phtml +++ b/provisioning.phtml @@ -1,159 +1,160 @@ "CDRTool_Session", "auth" => "CDRTool_Auth", "perm" => "CDRTool_Perm" ) ); $title = "Provisioning"; if (is_readable("/etc/cdrtool/local/header.phtml")) { include("/etc/cdrtool/local/header.phtml"); } else { include("header.phtml"); } $perm->check("provisioning"); if ($_REQUEST['action'] == 'PerformActions' && $_REQUEST['sub_action'] == 'export') { $export = true; } if ($export) { Header("Content-type: application/json"); Header("Content-Disposition: attachment; filename=ngnpro_export.json"); } else { $layout = new pageLayoutLocal(); $layout->showTopMenu($title); } global $CDRTool; $login_credentials=array(); $login_credentials['username']=$auth->auth["uname"]; if ($CDRTool['impersonate']) { if (preg_match("/^([0-9]*)\.([0-9]*)$/", $CDRTool['impersonate'], $m)) { - $_customer=$m[1]; - $_reseller=$m[2]; - + $_customer = $m[1]; + $_reseller = $m[2]; } else { page_close(); printf("Error: Invalid impersonate value %s", $CDRTool['impersonate']); exit; } - if ($_customer == "0" && $_reseller == "0" ) { - $login_credentials['login_type']= 'admin'; - $login_credentials['reseller']= '0'; + if ($_customer == "0" && $_reseller == "0") { + $login_credentials['login_type'] = 'admin'; + $login_credentials['reseller'] = '0'; } else if ($_customer == $_reseller) { - $login_credentials=array( + $login_credentials = array( 'soap_username' => $CDRTool['soap_username'], 'soap_password' => $CDRTool['soap_password'], 'customer' => $_customer, 'reseller' => $_reseller, 'login_type' => 'reseller' ); } else { - $login_credentials=array( + $login_credentials = array( 'soap_username' => $CDRTool['soap_username'], 'soap_password' => $CDRTool['soap_password'], 'customer' => $_customer, 'reseller' => $_reseller, 'login_type' => 'customer' ); } $login_credentials['username'] = $auth->auth["uname"]; } else { page_close(); printf("Please define impersonate field for login account %s", $auth->auth["uname"]); exit; } if (file_exists("/etc/cdrtool/ngnpro_engines.inc")) { require("/etc/cdrtool/ngnpro_engines.inc"); } else { page_close(); printf("Error: you must copy setup/ngnpro_engines.inc.sample to /etc/cdrtool/ngnpro_engines.inc and edit it before trying again"); exit; } if (array_key_exists($login_credentials['reseller'], $resellerFilters)) { $login_credentials['soap_filter'] = $resellerFilters[$login_credentials['reseller']]['soap_filter']; $login_credentials['record_generator'] = $resellerFilters[$login_credentials['reseller']]['record_generator']; $login_credentials['name_servers'] = $resellerFilters[$login_credentials['reseller']]['name_servers']; } else if ($resellerFilters['default']) { $login_credentials['soap_filter'] = $resellerFilters['default']['soap_filter']; $login_credentials['record_generator'] = isset($resellerFilters['default']['record_generator']) ? $resellerFilters['default']['record_generator'] : ''; $login_credentials['name_servers'] = isset($resellerFilters['default']['name_servers']) ? $resellerFilters['default']['name_servers'] : '' ; } $login_credentials['reseller_filters'] = $resellerFilters; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; if (isset($_REQUEST['generatorId'])) { $generator = new recordGenerator($_REQUEST['generatorId'], $recordGenerators, $soapEngines, $login_credentials); if ($action == 'Generate') { $generator->generateRecords(); $generator->showGeneratorForm(); } else { $generator->showGeneratorForm(); } } else { $service = isset($_REQUEST['service']) ? $_REQUEST['service'] : '' ; $SoapEngine = new SoapEngine($service, $soapEngines, $login_credentials); $_class = $SoapEngine->records_class; $RECORDS = new $_class($SoapEngine); $RECORDS->showWelcomeMessage(); - if ($action=='Add') { + if ($action =='Add') { $RECORDS->addRecord(); } - if ($action=='Copy') { + if ($action =='Copy') { $RECORDS->copyRecord(); } - if ($action=='Delete') { + if ($action =='Delete') { $RECORDS->deleteRecord(); } - if ($action=='Update') { + if ($action =='Update') { $RECORDS->updateRecord(); } if ($action == 'PerformActions') { $RECORDS->executeActions(); } else { $RECORDS->listRecords(); } } if (!$export) { $layout->showFooter(); echo " "; } page_close(); ?>