function wizard7(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $WizardStatsAppliance=unserialize(base64_decode($sock->GET_INFO("WizardStatsAppliance"))); $t=$_GET["t"]; $tt=time()+rand(0,time()); $proto="http"; if($WizardStatsAppliance["SSL"]==1){$proto="https";} $uri="$proto://{$WizardStatsAppliance["SERVER"]}:{$WizardStatsAppliance["PORT"]}/nodes.listener.php?stats-perform-connection=yes"; $cnxlog="<strong>{$WizardStatsAppliance["SERVER"]}:{$WizardStatsAppliance["PORT"]} SSL:{$WizardStatsAppliance["SSL"]}</strong><hr>"; $curl=new ccurl($uri,true,null,true); $curl->NoHTTP_POST=true; if(!$curl->get()){ $deb=debug_curl($curl->CURL_ALL_INFOS); echo FATAL_WARNING_SHOW_128($curl->error."<hr><strong>{$WizardStatsAppliance["SERVER"]}:{$WizardStatsAppliance["PORT"]} SSL:{$WizardStatsAppliance["SSL"]}</strong>$deb<hr>".wizard_restart()); return; } if(!preg_match("#<RESULTS>(.+?)</RESULTS>#is", $curl->data,$re)){echo FATAL_WARNING_SHOW_128("<hr>$cnxlog{artica_protocol_error}$deb".wizard_restart());return;} $array=unserialize(base64_decode($re[1])); if(!is_array($array)){echo FATAL_WARNING_SHOW_128("<hr>$cnxlog{artica_protocol_error}$deb".wizard_restart());return;} if(isset($array["ERROR"])){ echo FATAL_WARNING_SHOW_128("<hr>$cnxlog{error}<hr>{$array["ERROR"]}<hr>$deb".wizard_restart()); return; } if(!isset($array["mysql"]["username"])){ echo FATAL_WARNING_SHOW_128("<hr>{error}<hr>username not retreived<hr>$deb".wizard_restart());return; } if(!isset($array["mysql"]["password"])){ echo FATAL_WARNING_SHOW_128("<hr>{error}<hr>Password not retreived<hr>$deb".wizard_restart());return; } $WizardStatsAppliance["username"]=$array["mysql"]["username"]; $WizardStatsAppliance["password"]=$array["mysql"]["password"]; $sock->SaveConfigFile(base64_encode(serialize($WizardStatsAppliance)), "WizardStatsAppliance"); echo $tpl->_ENGINE_parse_body(" <center style='font-size:18px'>{saving_parameters}</center> <div id='$tt'></div> <script> LoadAjax('$tt','$page?wizard8=yes&t=$t'); </script> "); }
function exunlink() { $unix = new unix(); $sock = new sockets(); $net = new networking(); $WgetBindIpAddress = $sock->GET_INFO("WgetBindIpAddress"); $MAIN = unserialize(base64_decode($sock->GET_INFO("HASettings"))); $eth = $MAIN["eth"]; $t = time(); if (!is_numeric($MAIN["SLAVE_SSL"])) { $MAIN["SLAVE_SSL"] = 1; } $proto = "http"; if ($MAIN["SLAVE_SSL"] == 1) { $proto = "https"; } $MAIN = unserialize(base64_decode($sock->GET_INFO("HASettings"))); $eth = $MAIN["eth"]; $nic = new system_nic($eth); $MAIN["BALANCE_IP"] = $MAIN["first_ipaddr"]; $SEND_SETTING = base64_encode(serialize($MAIN)); $uri = "{$proto}://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]}/nodes.listener.php?ucarp2-remove={$SEND_SETTING}&continue=true"; build_progress("Notify {$MAIN["SLAVE"]}", 20); $curl = new ccurl($uri, true, $WgetBindIpAddress, true); $curl->NoHTTP_POST = true; if (!$curl->get()) { echo "{$curl->error}\n"; debug_curl($curl->CURL_ALL_INFOS); build_progress("{reboot_networks} {$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} {failed}", 110); return; } if (!preg_match("#<RESULTS>(.+?)</RESULTS>#is", $curl->data, $re)) { echo "Please verify that both servers must have the same Artica version\n"; build_progress("{reboot_networks} {$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} {protocol_error}", 110); return; } $array = unserialize(base64_decode($re[1])); if ($array["ERROR"]) { echo "{$array["ERROR_SHOW"]}\n"; build_progress("{reboot_networks} {$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} {failed}", 110); return; } build_progress("{please_wait_reconfigure_network}", 80); $nic = new system_nic($eth); $nic->ucarp_enabled = 0; $nic->ucarp_vip = null; $nic->ucarp_vid = 0; $nic->ucarp_master = 0; $nic->NoReboot = true; if (isset($MAIN["first_ipaddr"])) { if ($MAIN["first_ipaddr"] != null) { $nic->IPADDR = $MAIN["first_ipaddr"]; } } if (!$nic->SaveNic()) { echo "Unable to save local settings\n"; build_progress("{saving_local_parameters} {failed}", 110); return; } //please_wait_reconfigure_network $sock->SET_INFO("HASettings", base64_encode(serialize(array()))); build_progress("{reboot_networks}", 75); $php = $unix->LOCATE_PHP5_BIN(); system("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php --build --force"); build_progress("{reboot_networks}", 80); squid_admin_mysql(0, "Rebooting Network", null, __FILE__, __LINE__); system("/etc/init.d/artica-ifup --script=exec.failover.php/" . __FUNCTION__); build_progress("{starting_service}", 90); system("/etc/init.d/artica-failover stop"); sleep(3); build_progress("{done}", 100); }
function step8(){ $tpl=new templates(); $sock=new sockets(); $net=new networking(); $page=CurrentPageName(); $MAIN=unserialize(base64_decode($sock->GET_INFO("HASettings"))); $eth=$MAIN["eth"]; $t=time(); if(!is_numeric($MAIN["SLAVE_SSL"])){$MAIN["SLAVE_SSL"]=1;} $proto="http"; if($MAIN["SLAVE_SSL"]==1){$proto="https";} $MAIN=unserialize(base64_decode($sock->GET_INFO("HASettings"))); $eth=$MAIN["eth"]; $nic=new system_nic($eth); $MAIN["BALANCE_IP"]=$nic->IPADDR; $SEND_SETTING=urlencode(base64_encode(serialize($MAIN))); $uri="$proto://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]}/nodes.listener.php?ucarp3=$SEND_SETTING"; $curl=new ccurl($uri); $curl->NoHTTP_POST=true; if(!$curl->get()){ $deb=debug_curl($curl->CURL_ALL_INFOS); echo FATAL_WARNING_SHOW_128($curl->error."<hr> <strong>$proto://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} SSL:{$MAIN["SLAVE_SSL"]}</strong> <hr> $deb<hr>".wizard_restart()); return; } if(!preg_match("#<RESULTS>(.+?)</RESULTS>#is", $curl->data,$re)){ echo FATAL_WARNING_SHOW_128("<hr> <strong>$proto://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} SSL:{$MAIN["SLAVE_SSL"]}</strong> <br> {protocol_error} <br> {check_same_version_artica}<br>$curl->data<br>$deb".wizard_restart()); return; } $sock=new sockets(); $sock->getFrameWork("network.php?reconfigure-restart=yes"); $reboot_remote_server_net=$tpl->javascript_parse_text("{success}"); echo "<script> function Start$t(){ document.getElementById('failover-title').innerHTML='$reboot_remote_server_net'; YahooWin6Hide(); CacheOff(); RefreshTab('main_failover_tabs'); } setTimeout('Start$t()',2000); </script> "; }