Exemple #1
0
 function createShowAlist(&$alist, $subaction = null)
 {
     global $gbl, $sgbl, $login, $ghtml;
     return $alist;
     if (checkIfLatest() && !if_demo()) {
         return null;
     }
 }
Exemple #2
0
 function isSelect()
 {
     if (if_demo()) {
         if (array_search_bool($this->nname, array('wholesale', 'reseller', 'customer'))) {
             return false;
         }
     }
     return true;
 }
 static function execCommand($iid, $command)
 {
     if (if_demo()) {
         throw new lxException("not_allowed_in_demo");
     }
     global $global_shell_error, $global_shell_ret;
     $global_shell_error = null;
     $out = shell_exec("{$command} 2>&1");
     return array('output' => $out, 'error' => $global_shell_error);
 }
 function dbactionAdd()
 {
     global $gbl, $sgbl, $login;
     if (if_demo()) {
         return;
     }
     $_filepath = "__path_home_root/lxguard/hostdeny.info";
     $result = $this->main->__var_hostlist;
     $result = merge_array_object_not_deleted($result, $this->main);
     $list = get_namelist_from_arraylist($result, 'hostname', 'hostname');
     dprintr($list);
     lfile_put_serialize($_filepath, $list);
     lxshell_return("__path_php_path", "../bin/common/lxguard.php");
 }
 function dosyncToSystem()
 {
     global $gbl, $sgbl, $login;
     if (if_demo()) {
         return;
     }
     $_filepath = "__path_real_etc_root/hosts.deny";
     $string = null;
     foreach ((array) $this->main->__var_hostlist as $v) {
         $string .= "ALL: {$v['hostname']}\n";
     }
     if ($this->isDeleted() != "delete") {
         $string .= "ALL: {$this->main->hostname}\n";
     }
     lfile_put_contents($_filepath, $string);
 }
 function dbactionUpdate($subaction)
 {
     if (if_demo()) {
         throw new lxException("demo", $v);
     }
     if ($this->main->ssh_port && !($this->main->ssh_port > 0)) {
         throw new lxException('invalid_ssh_port', 'ssh_port', '');
     }
     dprint($this->main->ssh_port);
     $this->main->ssh_port = trim($this->main->ssh_port);
     if (!$this->main->ssh_port) {
         $port = "22";
     } else {
         $port = $this->main->ssh_port;
     }
     if (lxfile_exists("/etc/fedora-release")) {
         $str = lfile_get_contents("../file/template/sshd_config-fedora-2");
     } else {
         $str = lfile_get_contents("../file/template/sshd_config");
     }
     $str = str_replace("%ssh_port%", $port, $str);
     if ($this->main->isOn('without_password_flag')) {
         $wt = 'without-password';
     } else {
         $wt = 'yes';
     }
     if ($this->main->isOn('disable_password_flag')) {
         $pwa = 'no';
     } else {
         $pwa = 'yes';
     }
     $str = str_replace("%permit_root_login%", $wt, $str);
     $str = str_replace("%permit_password%", $pwa, $str);
     $ret = lfile_put_contents("/etc/ssh/sshd_config", $str);
     if (!$ret) {
         throw new lxException('could_not_write_config_file', '', '');
     }
     exec_with_all_closed("/etc/init.d/sshd restart");
 }
Exemple #7
0
function if_demo_throw_exception($where = null)
{
    global $gbl, $sgbl, $login, $ghtml;
    if ($sgbl->dbg < 0) {
        $where = null;
    }
    if (if_demo()) {
        throw new lxException("{$where} not_allowed_in_demo_version");
    }
}
Exemple #8
0
 function updateMaintenance($param)
 {
     if (if_demo()) {
         throw new lxException("not_allowed_in_demo");
     }
     return $param;
 }
Exemple #9
0
function password_contact_check()
{
    global $gbl, $sgbl, $login, $ghtml;
    if (!$login->isAdmin()) {
        return;
    }
    if (csb($ghtml->frm_action, 'update') && $ghtml->frm_subaction === 'password') {
        return;
    }
    if (if_demo()) {
        return;
    }
    if (check_raw_password('client', 'admin', 'admin')) {
        print "<br> <br> <br> ";
        if (!isset($ghtml->__http_vars['frm_emessage'])) {
            $ghtml->__http_vars['frm_emessage'] = 'security_warning';
        }
        $ghtml->print_message();
        $gbl->frm_ev_list = "old_password_f";
        do_updateform($login, 'password');
        exit;
    }
}
Exemple #10
0
 function display($var)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($var === "logintime" || $var === "timeout" || $var === 'last_access') {
         return " " . lxgettime($this->{$var}) . " ";
     }
     if ($var === 'current_f') {
         if ($gbl->c_session->nname === $this->nname) {
             return 'on';
         }
         return 'dull';
     }
     if ($var === 'ip_address') {
         if (if_demo()) {
             return 'Masked in Demo';
         }
     }
     return parent::display($var);
 }
Exemple #11
0
 function getMysqlDbAdmin(&$alist)
 {
     if (!$this->isLocalhost('mysqldbsyncserver')) {
         $fqdn = getFQDNforServer($this->mysqldbsyncserver);
         //$dbadminUrl =  "http://$fqdn:7778/thirdparty/phpMyAdmin/";
         if (http_is_self_ssl()) {
             $dbadminUrl = "https://{$fqdn}:7777/thirdparty/phpMyAdmin/";
         } else {
             $dbadminUrl = "http://{$fqdn}:7778/thirdparty/phpMyAdmin/";
         }
     } else {
         $dbadminUrl = "/thirdparty/phpMyAdmin/";
     }
     try {
         $dbad = $this->getPrimaryDb();
         if (!$dbad) {
             return;
         }
         $user = $dbad->nname;
         $pass = $dbad->dbpassword;
         if (if_demo()) {
             //$pass = "******";
         }
         $alist[] = create_simpleObject(array('url' => "{$dbadminUrl}?pma_username={$user}&pma_password={$pass}", 'purl' => "c=mysqldb&a=updateform&sa=phpmyadmin", 'target' => "target='_blank'"));
     } catch (Exception $e) {
     }
 }
Exemple #12
0
function create_servername()
{
    $pserver = new pserver(null, 'localhost', "localhost");
    $pserver->initThisDef();
    $pserver->rolelist = array("web", "dns");
    if (if_demo()) {
        $pserver->realpass = '******';
        $pserver->password = crypt("admin");
        $pserver->cpstatus = 'on';
    }
    $pserver->dbaction = "add";
    $pserver->postAdd();
    $pserver->superPostAdd();
    $pserver->was();
    //dprintr($pserver);
    return;
}
Exemple #13
0
 function isSelect()
 {
     if (if_demo()) {
         if ($this->nname === 'example.com') {
             return false;
         }
         if ($this->nname === 'customer.com') {
             return false;
         }
         if ($this->nname === 'lxlabs.com') {
             return false;
         }
         if ($this->nname === 'admind.com') {
             return false;
         }
     }
     return true;
 }
Exemple #14
0
 function createShowRlist($subaction)
 {
     //$l = $this->pserverInfo();
     global $gbl, $sgbl, $login, $ghtml;
     static $rlist;
     //print("hello\n");
     if ($subaction) {
         return null;
     }
     if ($rlist) {
         return $rlist;
     }
     $master_server = $this->__masterserver;
     $slave_server = $this->syncserver;
     $driverapp = $gbl->getSyncClass($master_server, $slave_server, 'vps');
     if ($this->isXen()) {
         if (if_demo()) {
             $disk['used'] = '300';
             $disk['total'] = '6000';
         } else {
             // Build the params
             $maindisk = $this->getXenMaindiskName();
             $is_windows = $this->isWindows();
             $root_path = $this->corerootdir;
             $parameters = array($maindisk, $is_windows, $root_path);
             $disk = rl_exec_get($master_server, $slave_server, array("vps__{$driverapp}", "getDiskUsage"), $parameters);
         }
         if (!$this->priv->disk_usage) {
             $this->priv->disk_usage = $disk['total'];
             $this->setUpdateSubaction();
             $this->write();
         }
         $rlist[] = array('disk_usage', "Disk:Disk Usage", $disk['used'], $disk['total']);
         $rlist[] = array('realmem_usage', "Mem:Memory Usage", 'NA', $this->priv->realmem_usage);
     } else {
         $l = rl_exec_get($this->__masterserver, $this->syncserver, array("vps__{$driverapp}", "vpsInfo"), array($this->getIid(), $this->corerootdir));
         $rlist[] = array('disk_usage', "Disk:Disk Usage", $l['used_s_disk'], $l['priv_s_disk']);
         $rlist[] = array('disk_inode', "Inode:Disk Inodes", $l['used_s_inode'], $l['priv_s_inode']);
         /// Rlist takes an array...
         $rlist[] = array('memory_usage', "Memory:Memory Usage (MB)", $l['used_s_memory'], $l['priv_s_memory']);
         if (isset($l['used_s_swap'])) {
             $rlist[] = array('swap_usage', "Swap:Swap Usage (MB)", $l['used_s_swap'], $l['priv_s_swap']);
         }
         if (isset($l['used_s_virtual'])) {
             $rlist[] = array('Virtual Memory', "Virtual Memory Usage (MB)", $l['used_s_virtual'], $l['priv_s_virtual']);
         }
     }
     $rlist['priv'] = null;
     if (!$this->isXen()) {
         $cpu = $l['cpu'];
         foreach ($cpu as $k => $c) {
             $rlist[] = array('cpu', "CPU{$k} speed", "{$c['used_s_cpuspeed']}", '-');
             //$rlist[] = array('cpu', "CPU$k Speed", $c['used_s_cpuspeed'], '-');
             //$rlist[] = array('cpu', "CPU$k Cache", $c['used_s_cpucache'], '-');
         }
     }
     return $rlist;
 }
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();
    }
}
Exemple #16
0
function checkRestart()
{
    if (if_demo()) {
        return;
    }
    log_log("cron_exec", "Check service restarts...\n");
    $res = lscandir_without_dot("__path_program_etc/.restart");
    if ($res === false) {
        dprint(".restart does not exist... Creating\n");
        lxfile_mkdir("__path_program_etc/.restart");
        lxfile_generic_chown("__path_program_etc/.restart", "lxlabs");
    }
    foreach ((array) $res as $r) {
        if (csb($r, "._restart_")) {
            $cmd = strfrom($r, "._restart_");
        }
        lunlink("__path_program_etc/.restart/{$r}");
        dprint("Restarting {$cmd}\n");
        switch ($cmd) {
            case 'lxcollectquota':
                log_log("cron_exec", "Start collecting Quota's\n");
                exec_justdb_collectquota();
                break;
            case 'openvz_tc':
                log_log("cron_exec", "Start openvz_tc script\n");
                exec_openvz_tc();
                break;
            default:
                log_log("cron_exec", "Restarting {$cmd}\n");
                exec_with_all_closed("/etc/init.d/{$cmd} restart");
                break;
        }
    }
}
Exemple #17
0
 function updateSwitchHelp($param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     if ($gbl->isOn('show_help')) {
         $this->getSpecialObject('sp_specialplay')->show_help = 'off';
         $gbl->setSessionV('show_help', 'off');
     } else {
         if (!if_demo()) {
             $this->getSpecialObject('sp_specialplay')->show_help = 'on';
         }
         $gbl->setSessionV('show_help', 'on');
     }
     $special = $this->sp_specialplay_o;
     $special->setUpdateSubaction('switchhelp');
     $login->was();
     save_login();
     $ghtml->print_redirect_left_panel("/htmllib/mibin/lpanel.php");
     return null;
 }
Exemple #18
0
 function getMysqlDbAdmin(&$alist)
 {
     if (!$this->isLocalhost('nname')) {
         $fqdn = getFQDNforServer($this->nname);
         //$dbadminUrl =  "http://$fqdn:7778/thirdparty/phpMyAdmin/";
         if (http_is_self_ssl()) {
             $dbadminUrl = "https://{$fqdn}:7777/thirdparty/phpMyAdmin/";
         } else {
             $dbadminUrl = "http://{$fqdn}:7778/thirdparty/phpMyAdmin/";
         }
     } else {
         $dbadminUrl = "/thirdparty/phpMyAdmin/";
     }
     //$pass = urlencode($pass);
     $server = $_SERVER['SERVER_NAME'];
     if (csa($server, ":")) {
         list($server, $port) = explode(":", $server);
     }
     try {
         $dbad = $this->getFromList('dbadmin', "mysql___{$this->syncserver}");
         $user = $dbad->dbadmin_name;
         $pass = $dbad->dbpassword;
         if (if_demo()) {
             $pass = "******";
         }
         $alist[] = create_simpleObject(array('url' => "{$dbadminUrl}?pma_username={$user}&pma_password={$pass}", 'purl' => "c=mysqldb&a=updateform&sa=phpmyadmin", 'target' => "target='_blank'"));
     } catch (Exception $e) {
     }
 }
Exemple #19
0
/*
 * This file is used by the /login/ page.
 * Refactoring is needed. Wrong place, wrong name
 */
$accountlist = array('client' => "Kloxo Account", 'domain' => 'Domain Owner', 'mailaccount' => "Mail Account");
$progname = $sgbl->__var_program_name;
$ghtml->print_jscript_source("/htmllib/js/lxa.js");
if ($sgbl->is_this_slave()) {
    print "Slave Server\n";
    exit;
}
$logfo = db_get_value("general", "admin", "login_pre");
$logfo = str_replace("<%programname%>", $sgbl->__var_program_name, $logfo);
if (!$cgi_forgotpwd) {
    $ghtml->print_message();
    if (if_demo()) {
        include_once "lib/demologins.php";
    } else {
        ?>

        <div id="ctr" align="center">
            <div class="login">
                <div class="login-form">
                    <div align="center"><font size="5" color="red"><b> Login </b></font></div>
                    <br />
                    <form name="loginform" action="/htmllib/phplib/" onsubmit="encode_url(loginform) ; return fieldcheck(this);" method="post">
                        <div class="form-block">
                            <div class="inputlabel">Username</div>
                            <input name="frm_clientname" type="text" class="inputbox" size="30" />
                            <div class="inputlabel">Password</div>
                            <input name="frm_password" type="password" class="passbox" size="30" />
Exemple #20
0
 function postUpdate()
 {
     // Hack Hack Hack... Redirecting the whole frame thing after a skin change...
     // It is supposed to be handled by the display.php, but since this is a single case, i am doing it here...
     global $gbl, $sgbl, $login, $ghtml;
     $gbl->setSessionV('show_lpanel', $login->getSpecialObject('sp_specialplay')->show_lpanel);
     $gbl->setSessionV('show_help', $login->getSpecialObject('sp_specialplay')->show_help);
     if (if_demo()) {
         throw new lxexception('not_allowed_in_demo', '');
     }
     if ($this->subaction === 'skin' && !$this->isClass('sp_childspecialplay')) {
         if ($sgbl->dbg < 0 && $this->getParentO()->isLogin()) {
             $login->was();
             if ($ghtml->frm_consumedlogin !== 'true') {
                 $ghtml->print_redirect_self("/");
                 exit;
             }
         }
     }
 }
Exemple #21
0
function checkRestart()
{
    if (if_demo()) {
        return;
    }
    $res = lscandir_without_dot("__path_program_etc/.restart");
    if ($res === false) {
        dprint(".restart does not exist... Creating\n");
        lxfile_mkdir("__path_program_etc/.restart");
        lxfile_generic_chown("__path_program_etc/.restart", "lxlabs");
    }
    foreach ((array) $res as $r) {
        if (csb($r, "._restart_")) {
            $cmd = strfrom($r, "._restart_");
        }
        lunlink("__path_program_etc/.restart/{$r}");
        dprint("Restarting {$cmd}\n");
        // THe 3,4 etc are the tcp ports of this program, and it should be closed, else some programs will grab it.
        //exec("/etc/init.d/$cmd restart  </dev/null >/dev/null 2>&1 3</dev/null 4</dev/null 5</dev/null 6</dev/null &");
        switch ($cmd) {
            case 'lxcollectquota':
                exec_justdb_collectquota();
                break;
            case 'openvz_tc':
                exec_openvz_tc();
                break;
            default:
                exec_with_all_closed("/etc/init.d/{$cmd} restart");
                break;
        }
    }
}
Exemple #22
0
    function oldlpanel_help()
    {
        global $gbl, $sgbl, $login;
        $img_path = $login->getSkinDir();
        $tbg = $img_path . "/lp_bg.gif";
        $helpimg = $img_path . "/";
        ?>
<table cellpadding="0" width=100% cellspacing="0" border="0" align=center>

        <tr>
			<td align=center><br>
				<table cellpadding=0 cellspacing=0 border=0 align=center>
					<tr align=center>
						<td><img id=helppic name=namepic src="<?php 
        echo $helpimg;
        ?>
/help_head.gif" style="cursor:pointer"
								 onclick="javascript:window.open('<?php 
        echo $this->get_help_url();
        ?>
')"></td>
					</tr>
				</table>
			</td>
			</td></tr>

		<tr align=center>
			<td align=center>
				<table cellpadding=0 cellspacing=0 border=0 align=center>
					<tr>
						<td><img src="<?php 
        echo $helpimg;
        ?>
/help_edge.gif"></td>
						<td background="<?php 
        echo $helpimg;
        ?>
/help_bg.gif" width=170>
							<table cellpadding=0 cellspacing=0 border=0>
								<tr>
									<td width=10></td>
									<td>
										<div id=help class=helparea>
											<script> document.write(help_data['helparea']) </script>
										</div>
									</td>
								</tr>
							</table>
						</td>
						<td><img src="<?php 
        echo $helpimg;
        ?>
/help_edge.gif"></td>
					</tr>
				</table>
			</td>
		</tr>



		<?php 
        if (if_demo()) {
            ?>
		<tr>
			<td align=center>
				<table>
					<tr align=center>
						<td align=center nowrap><a href=/live target=_blank class=tableheadtext>Click Here for Live
							Support.</a></td>
					</tr>
				</table>
			</td>
		</tr>
        </table>
        <?php 
        }
        return;
    }