registerFunction("getEKM"); session_start(); $user = $_SESSION['user']; $in_xAjax = false; $xAjax_objResponse; include('IOB_inc.htm'); include('common_admin_inc.htm'); class EKMdata { var $primaryIP; var $primaryPort; // default is 3801 (decimal) var $secondaryIP; var $secondaryPort; // default is 3801 (decimal) function EKMdata( $primaryIP, $primaryPort, $secondaryIP, $secondaryPort ) { $this->primaryIP = $primaryIP; $this->primaryPort = $primaryPort; $this->secondaryIP = $secondaryIP; $this->secondaryPort = $secondaryPort; } }; function getEKM() { // !?! NOTE: Not using this function - but I left it in case I wanted to switch to using it in the future. global $in_xAjax; // global $xAjax_objResponse; $user = $_SESSION['user']; $xAjax_objResponse = new xajaxResponse(); /// $in_xAjax = true; error_log("Calling get_ekm($user);"); $ekm_data = get_ekm( $user ); error_log("ekm_data = ". print_r($ekm_data, true) ); $xAjax_objResponse->assign("primIP", "value", $ekm_data->primaryIP ); $xAjax_objResponse->assign("primPort", "value", $ekm_data->primaryPort ); $xAjax_objResponse->assign("secIP", "value", $ekm_data->secondaryIP ); $xAjax_objResponse->assign("secPort", "value", $ekm_data->secondaryPort ); // Some Debug examples //$xAjax_objResponse->script('alert(xajax.$("testlevel[1]").value);'); //$xAjax_objResponse->script('alert(xajax.viewSource());'); /// $in_xAjax = false; return $xAjax_objResponse; } $xajax->processRequest(); /*******************************************************************************************/ // Handle the progress screen if opened and set the NEW data if ($_SERVER[REQUEST_METHOD] == "POST") { $operationInProgress = true; $status = new ReturnStatus(); // By calling this here on all the QKM pages during the post the will all get the same error. if( ! isset($_POST['sslCerts']) ) { $iAkmReady = akm_servers_available($user, true); // $iAkmReady = (akm_servers_available($user) == 1); error_log("akm_servers_available returned: ". print_r($iAkmReady, true)); } else { if( $_SERVER['CONTENT_LENGTH'] > 20480 ) { error_log("TLSC file is too big:" . $_SERVER['CONTENT_LENGTH'] ); $status->setErrorCode("10752"); print $status->out(); return; } } error_log($_SERVER['PHP_SELF']." POST = ". print_r($_POST, true) ); $tmp_name = $_FILES['keyCert']['tmp_name']; error_log("_FILES = ". print_r($_FILES, true) ); error_log("The File has been uploaded - we will now verify it."); if(is_uploaded_file($_FILES['keyCert']['tmp_name'])) { /* CMIResult::FirmwareUpdateInProgress = 4125 */ //set_single_user_mode($user, true, 4125); error_log("The file was uploaded - processing now."); $fileName = "/tmp/".$_FILES['keyCert']['name']; error_log("The file has been uploaded. We are now going to move it to ". $fileName ); if(!move_uploaded_file($_FILES['keyCert']['tmp_name'], $fileName)) { error_log("Failed to moved the uploaded file ". $fileName); $status->setErrorCode("4108"); } $iRet = akm_cert_import($user, $fileName, isset($_POST['sslCerts'])); if( $iRet == 0 ) { error_log("Closing the progress window."); /*########################################################### # Note: The code in $status->out() calls returnStatus( 1 ) # Which closes the popup and reloads the homepage in the # main Window. ###########################################################*/ // Close the progress Window. //print $status->closeOut(1); print $status->out(); } else { error_log("Problem Importing Certificate"); $status->setErrorCode(4112); //Force corrupt file } } else { if (is_null($_FILES["keyCert"])) { error_log("The file is too big. key certificate was NULL"); $status->setErrorCode("4109"); } else { switch ($HTTP_POST_FILES['keyCert']['error']) { case 1 : //uploaded file exceeds the upload_max_filesize directive in php.ini case 2 : //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form error_log("The file you are trying to upload is too big."); $status->setErrorCode("4109"); break; case 3 : //uploaded file was only partially uploaded error_log("The file you are trying upload was only partially uploaded."); $status->setErrorCode("4110"); break; case 4 : //no file was uploaded error_log("You must select an image for upload."); $status->setErrorCode("4111"); break; default : //a default error, just in case! :) error_log("There was a problem with your upload."); $status->setErrorCode("4108"); break; } } } print $status->out(); return; } else { $akmServAvail = akm_servers_available($user);; if( $akmServAvail == 1 ) { // Load the data up on the get of the page. // $ver = akm_get_software_version($user); //!?! This has Code that checks for the new Townsedn code over the OLD // error_log("akm_get_software_version returned ". print_r($ver,true) ); // error_log("\n\n\n**********************************************************************************\n\n\n"); // $certList = akm_get_cert_list($user); // error_log("akm_get_cert_list returned ". print_r($certList, true) ); } $bTLS = akm_comm_certs_loaded($user); } ?>
$xajax->printJavascript(); ?>