Example #1
0
 function updateLxupdateInfo()
 {
     if_demo_throw_exception();
     if (isUpdating()) {
         throw new lxException("program_is_already_updating");
     } else {
         rl_exec_get($this->__masterserver, 'localhost', array('lxupdate', 'execUpdate'), null);
         throw new lxException("update_scheduled");
     }
 }
Example #2
0
 function createShowAlist(&$alist, $subaction = null)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $revc = $login->getObject('general')->reversedns_b;
     $hackbutton = $login->getObject('general')->hackbuttonconfig_b;
     static $status;
     static $reason;
     if (isUpdating()) {
         $ghtml->print_redirect_back('system_is_updating_itself', '');
     }
     if ($ghtml->frm_action === 'show') {
     } else {
         $status = $this->status;
     }
     $this->setIId();
     if (!$status) {
         try {
             $status = $this->getStatusForThis();
             dprint($status);
         } catch (Exception $e) {
             if (if_demo()) {
                 $status = 'on';
             } else {
                 print "Could not get Status: Reason: {$e->getMessage()}";
                 exit;
             }
         }
     }
     if (csa($status, ":")) {
         $st = explode(":", $status);
         $status = array_shift($st);
         $reason = implode(" ", $st);
         $reason = str_replace("\n", " ", $reason);
     }
     if ($status !== $this->status) {
         dprint("Status in Db not the same as Status of the system, resetting db");
         $this->status = $status;
         $this->setUpdateSubaction();
     }
     if ($this->status === 'create') {
         $alist['__v_message'] = "<b> VM is being Created... Please Wait.. </b> \n";
         $alist['__v_refresh'] = true;
         return;
     }
     if ($this->status === 'createfailed') {
         $alist['__v_message'] = "<b> VM creation has failed. Reason: {$reason} </b>\n";
         $alist['__v_refresh'] = true;
         return;
     }
     if ($this->checkIfLockedForAction('restore')) {
         $alist['__v_message'] = 'The VM is getting restored, please wait...';
         $alist['__v_refresh'] = true;
         return $alist;
     }
     if ($this->checkIfLockedForAction('rebuild')) {
         $alist['__v_message'] = 'The VM is getting rebuilt, please wait...';
         $alist['__v_refresh'] = true;
         return $alist;
     }
     if ($this->checkIfLockedForAction('switchserver')) {
         $alist['__v_message'] = 'The VM is being migrated, please wait...';
         $alist['__v_refresh'] = true;
         return $alist;
     }
     if ($this->checkIfLockedForAction('livemigrate')) {
         $alist['__v_message'] = 'The VPS is being Migrated Live. The CP is inactive, but your VPS is running Normally.';
         $alist['__v_refresh'] = true;
         return $alist;
     }
     if ($this->status === 'deleted') {
         $alist['__v_message'] = "The VM {$this->getIid}() Doesn't Exist on {$this->syncserver}. If you have migrated the vps, you can manually change the server in the database using the below, Or restore from backup. </b>";
         $alist['__v_refresh'] = true;
         $alist['__title_main'] = $login->getKeywordUc('resource');
         $alist['__v_dialog_csync'] = "a=updateform&sa=changesyncserver";
         $alist['__var_backup_flag'] = "a=show&o=lxbackup";
         $alist[] = "a=updateform&sa=rebuild";
         return null;
     }
     /*
     	if ($this->getObject('lxbackup')->backupstage === 'doing') { 
     		$alist['__v_message'] = 'The VM is getting backed up, please wait...';
     		$alist['__v_refresh'] = true;
     		return $alist;
     	}
     */
     $this->makeSureTheUserExists();
     $this->makeSureTheMacAddressExists();
     $this->makeSureVifExists();
     if ($subaction === 'config') {
         return $this->createShowAlistConfig($alist);
     }
     if ($subaction === 'graph') {
         $alist['__title_graph'] = $login->getKeywordUc('graph');
         return $alist;
     }
     $alist['__title_administer'] = $login->getKeywordUc('administration');
     if ($this->getParentO()->isClass('client')) {
         if (!$this->isLogin()) {
             if ($login->priv->isOn('vps_limit_flag')) {
                 $alist['__v_dialog_limit'] = "a=updateForm&sa=limit";
                 $alist['__v_dialog_plan'] = "a=updateForm&sa=change_plan";
             }
         }
     }
     $alist['__v_dialog_info'] = "a=updateForm&sa=information";
     $alist['__v_dialog_pass'] = "******";
     if (!$this->isWindows()) {
         //$alist[] = "a=show&n=browsebackup&l[class]=ffile&l[nname]=/";
         $bslave = $this->getBackupServer();
         if (!is_disabled_or_null($bslave) && $this->priv->isOn('centralbackup_flag')) {
             $alist[] = "a=show&n=browsebackup";
         }
     }
     if (!$this->isLogin()) {
         $alist[] = "a=update&sa=dologin";
     }
     $alist['__title_console'] = $login->getKeywordUc('console');
     //$alist[] = "a=show&o=sshclient";
     if ($this->isWindows()) {
         $alist[] = "a=show&o=vncviewer";
     } else {
         $alist[] = "a=show&o=consolessh";
         $alist[] = "a=list&c=sshauthorizedkey";
     }
     if (!$this->isXen()) {
         $alist[] = "a=updateform&sa=commandcenter";
     }
     $alist[] = "a=list&c=blockedip";
     $alist['__v_dialog_netw'] = "a=updateform&sa=network";
     $alist[] = "a=list&c=traceroute";
     if (!$this->isWindows()) {
         $alist['__v_dialog_main'] = "a=updateform&sa=mainipaddress";
     }
     if (!$this->isXen()) {
         $alist['__v_dialog_fixdev'] = "a=updateform&sa=fixdev";
     }
     if ($hackbutton && $hackbutton->isOn('nobackup') && !$this->isWindows()) {
         vps::$__desc_backup_num = array("", "", "backup:number_of_backups", "number_of_backups");
     } else {
         if ($this->priv->isOn('backup_flag')) {
             $alist[] = "a=show&o=lxbackup";
         }
     }
     if ($login->isAdmin()) {
         $alist['__title_action'] = $login->getKeywordUc('action');
     }
     if ($login->priv->isOn("rebuildvps_flag")) {
         $alist['__v_dialog_rebuild'] = "a=updateform&sa=rebuild";
     }
     if (!$this->isWindows()) {
         $alist[] = "a=updateform&sa=recovervps";
     }
     if (!$this->isWindows()) {
         if ($login->isAdmin()) {
             $alist['__v_dialog_sw'] = "a=updateform&sa=switchserver";
         }
         if ($login->isAdmin() && !$this->isXen()) {
             $alist['__v_dialog_live'] = "a=updateform&sa=livemigrate";
         }
     }
     if ($login->isAdmin()) {
         $alist['__v_dialog_tem'] = "a=updateform&sa=createtemplate";
         $alist['__v_dialog_clone'] = "a=updateform&sa=clonevps";
     }
     if (!$this->isWindows()) {
         $alist['__title_resource'] = $login->getKeywordUc('resource');
     }
     if (!$this->isLogin() && $login->priv->isOn('ip_manage_flag')) {
         $alist[] = "a=list&c=vmipaddress_a";
     }
     if (!$this->isWindows()) {
         $alist['__v_dialog_root'] = "a=updateform&sa=rootpassword";
         $alist[] = "a=show&l[class]=ffile&l[nname]=/";
         $alist['__v_dialog_time'] = "a=updateform&sa=timezone";
         if ($this->isOn('kloxo_flag') && $login->priv->isOn('rebuildvps_flag')) {
             $alist['__v_dialog_inst'] = "a=updateform&sa=installkloxo";
         }
     }
     $alist['__title_power'] = $login->getKeywordUc('power');
     $alist[] = "a=update&sa=boot";
     $alist[] = "a=update&sa=poweroff";
     $alist[] = "a=update&sa=reboot";
     if ($this->isXen()) {
         $alist[] = "a=updateform&sa=mount";
     }
     if ($this->isXen()) {
         $alist[] = "a=updateform&sa=hardpoweroff";
     }
     $alist[] = "a=list&c=emailalert";
     if (!$this->isXen()) {
         $alist[] = "a=list&c=openvzqos";
     }
     //$this->getLxclientActions($alist);
     /*
     if ($this->priv->isOn('backup_flag')) {
     	$alist[] = "a=show&o=lxbackup";
     }
     */
     $alist['__title_misc'] = "Extra";
     $this->getListActions($alist, 'vpstraffichistory');
     $this->getListActions($alist, 'utmp');
     $this->getTicketMessageUrl($alist);
     if ($hackbutton && $hackbutton->isOn('nomonitor')) {
     } else {
         if (is_unlimited($this->priv->monitorport_num) || $this->priv->monitorport_num) {
             $alist[] = "a=list&c=monitorserver";
         }
     }
     if ($this->priv->isOn('managereversedns_flag')) {
         if ($revc && $revc->isOn('enableflag')) {
             $alist[] = "a=list&c=reversedns";
         }
     }
     if ($this->priv->isOn('managedns_flag')) {
         if ($revc && $revc->isOn('forwardenableflag')) {
             $alist[] = "a=list&c=dns";
         }
     }
     $alist['__title_advanced'] = "Advanced";
     if (!$this->isLogin()) {
         $alist[] = "a=updateform&sa=disable_per";
     }
     if ($login->isAdmin() && !$this->isXen()) {
         $alist[] = "a=updateForm&sa=changenname";
     }
     if (!$this->isLogin()) {
         $alist[] = "a=updateform&sa=resendwelcome";
     }
     if ($login->isAdmin()) {
         $alist[] = "a=updateForm&sa=changelocation";
         $alist[] = "a=updateform&sa=createuser";
     }
     if ($this->isXen() && !$this->isLogin()) {
         $alist[] = "a=updateform&sa=append_xen_config";
     }
     $alist[] = "a=updateform&sa=append_inittab";
     if ($login->isAdmin()) {
         $alist[] = "a=updateform&sa=ostemplatelist";
     }
     //if ($this->isXen() && $this->ostemplate === 'unknown') {
     if ($this->isXen() && $login->isAdmin()) {
         $alist[] = "a=updateForm&sa=changeosimagename";
     }
     if (!$this->isLogin()) {
         if ($login->isNotCustomer()) {
             // Disabling change owner for the present.
             $alist[] = "a=updateForm&sa=changeowner";
         }
     }
     if ($this->isXen()) {
         $alist[] = "a=updateform&sa=macaddress";
     }
     $alist[] = "a=show&o=notification";
     $alist[] = "a=updateform&sa=miscinfo";
     if ($this->isLogin()) {
         $alist[] = "o=sp_specialplay&a=updateform&sa=login_options";
     }
     $this->getCustomButton($alist);
     return $alist;
 }
Example #3
0
function display_init()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    initLanguage();
    if ($sgbl->is_this_slave()) {
        print "This is a Slave Server. You control it at the Master Server.\n";
        exit;
    }
    // The only thing that gets modified when the dbaction is not a modify action, is the ssession table. Other tables should get modified only inside non-form actions.
    if (isModifyAction() && isUpdating()) {
        $ghtml->print_redirect_back('system_is_updating_itself', '');
        exit;
    }
    try {
        do_display_init();
        main_system_lock();
        print_navigation($gbl->__navig);
        if (if_demo()) {
            //$url = $ghtml->get_get_from_current_post(null);
            //log_clicks($url);
        }
        print_warning();
        password_contact_check();
    } catch (Exception $e) {
        log_log("redirect_error", "exception");
        $gbl->setSessionV('__tmp_redirect_var', $ghtml->__http_vars);
        $gbl->c_session->write();
        if (is_array($e->variable)) {
            $evlist = implode(",", $e->variable);
        } else {
            $evlist = $e->variable;
        }
        $ghtml->print_redirect_back($e->getMessage(), $evlist, $e->value);
        exit;
    }
    //license_check();
    if ($ghtml->frm_filter) {
        $filtername = $gbl->__c_object->getFilterVariableForThis($ghtml->frm_o_cname);
        $list[$filtername] = $ghtml->frm_filter;
        $login->setupHpFilter($list);
        $login->setUpdateSubaction();
    }
    if ($ghtml->frm_hpfilter) {
        //dprintr($ghtml->frm_hpfilter);
        $login->setupHpFilter($ghtml->frm_hpfilter);
        $login->setUpdateSubaction();
    }
}
Example #4
0
function display_init()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    init_language();
    if ($sgbl->is_this_slave()) {
        print _("This is a Slave Server. Operate it at the Master.") . "\n";
        exit;
    }
    if (isModifyAction() && isUpdating()) {
        $ghtml->print_redirect_back('system_is_updating_itself', '');
        exit;
    }
    try {
        do_display_init();
        print "<!-- Load Navigation -->\n";
        print_navigation($gbl->__navig);
        print "<!-- Load Warning -->\n";
        print_warning();
        print "<!-- Load Password Contact Check -->\n";
        password_contact_check();
    } catch (Exception $e) {
        log_log("redirect_error", "exception");
        $gbl->setSessionV('__tmp_redirect_var', $ghtml->__http_vars);
        $gbl->c_session->write();
        if (is_array($e->variable)) {
            $evlist = implode(",", $e->variable);
        } else {
            $evlist = $e->variable;
        }
        $ghtml->print_redirect_back($e->getMessage(), $evlist, $e->value);
        exit;
    }
    if ($ghtml->frm_filter) {
        $filtername = $gbl->__c_object->getFilterVariableForThis($ghtml->frm_o_cname);
        $list[$filtername] = $ghtml->frm_filter;
        $login->setupHpFilter($list);
        $login->setUpdateSubaction();
    }
    if ($ghtml->frm_hpfilter) {
        $login->setupHpFilter($ghtml->frm_hpfilter);
        $login->setUpdateSubaction();
    }
}