function createExtraVariables()
 {
     $parent = $this->getParentO();
     $sq = new Sqlite(null, "lxguardwhitelist");
     $res = $sq->getRowsWhere("syncserver = '{$parent->syncserver}'", array('nname', 'ipaddress'));
     $this->__var_whitelist = $res;
 }
Example #2
0
function security_blanket_main()
{
    global $argv;
    //sleep(100);
    $rem = unserialize(lfile_get_contents($argv[1]));
    unlink($argv[1]);
    if (!$rem) {
        exit;
    }
    // Merged from 6.1.x/kloxo/bin/common/securityblanket.php	(revision 472)
    // workaround for the following php bug:
    //   http://bugs.php.net/bug.php?id=47948
    //   http://bugs.php.net/bug.php?id=51329
    if (is_array($rem->func) && count($rem->func) > 0) {
        $class = $rem->func[0];
        class_exists($class);
    }
    // ---
    call_user_func_array($rem->func, $rem->arglist);
    $sq = new Sqlite(null, $rem->table);
    $res = $sq->getRowsWhere("nname = '{$rem->nname}'", array($rem->flagvariable));
    if ($res[0][$rem->flagvariable] === 'doing') {
        $sq->rawQuery("update {$rem->table} set {$rem->flagvariable} = 'Program Got aborted in the midst. Please try again.' where nname = '{$rem->nname}'");
    }
}
Example #3
0
 function createExtraVariables()
 {
     // Not here. Two different extra variables are needed, so they are created in synctosystem.
     // Brought back here, since the secondary server concept has been abolished in favor of multiple primary servers.
     global $gbl, $sgbl, $login, $ghtml;
     if ($sgbl->isHyperVm()) {
         $this->createExtraVariablesHyperVM();
         return;
     }
     $db = new Sqlite($this->__masterserver, "dns");
     $gen = $login->getObject('general')->generalmisc_b;
     $serverlist = explode(",", $this->syncserver);
     $list = null;
     foreach ($serverlist as $server) {
         $string = "syncserver LIKE '%{$server}%'";
         $nlist = $db->getRowsWhere($string, array('nname'));
         $dlistv = "__var_domainlist_{$server}";
         $this->{$dlistv} = $nlist;
     }
     //FIXME: We should only get the addon domains for the domains configured on that particular server. IN the case of single server system, it is not a problem, since that means we will have to get all the domains. but in the case of distributed setup, we need to properly get only the add domains under the domains loaded above.
     $dbaddon = new Sqlite(null, "addondomain");
     $addr = $dbaddon->getTable(array('nname'));
     foreach ($serverlist as $server) {
         $dlistv = "__var_domainlist_{$server}";
         $this->{$dlistv} = lx_array_merge(array($this->{$dlistv}, $addr));
     }
     $this->fixDateSerial();
     $this->__var_addonlist = $this->getParentO()->getList('addondomain');
     $mydb = new Sqlite(null, "ipaddress");
     $string = "syncserver = '{$this->syncserver}'";
     $this->__var_ipssllist = $mydb->getRowsWhere($string, array('ipaddr', 'nname'));
 }
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $sq = new Sqlite(null, 'web');
     $list = $sq->getRowsWhere("syncserver = '{$this->syncserver}'", array('nname'));
     $dlist = get_namelist_from_arraylist($list, 'nname');
     if (!$login->isAdmin()) {
         $sq = new Sqlite(null, 'domain');
         $nlist = $sq->getRowsWhere("parent_clname = '{$login->getClName()}'", array('nname'));
         $ndlist = get_namelist_from_arraylist($nlist);
         foreach ($dlist as $k => $v) {
             if (!array_search_bool($v, $ndlist)) {
                 unset($dlist[$k]);
             }
         }
     }
     if ($dlist) {
         $dlist = add_disabled($dlist);
         $vlist['domain'] = array('s', $dlist);
     } else {
         $vlist['domain'] = array('M', "No Domain");
         $vlist['__v_button'] = array();
     }
     return $vlist;
 }
 function defaultValue($var)
 {
     if ($var === 'ipaddr') {
         $db = new Sqlite($this->__masterserver, 'ipaddress');
         $res = $db->getRowsWhere("nname = '{$this->nname}'");
         return $res[0]['ipaddr'];
     }
     return null;
 }
Example #6
0
 function createExtraVariables()
 {
     $pserver = $this->getParentO();
     $hdb = new Sqlite($this->__masterserver, 'hostdeny');
     $string = "syncserver = '{$pserver->nname}' ";
     $hlist = $hdb->getRowsWhere($string);
     $this->__var_hostlist = $hlist;
     dprintr($this->__var_hostlist);
 }
Example #7
0
 static function initThisList($parent, $class)
 {
     $db = new Sqlite($parent->__masterserver, "ipaddress");
     if ($parent->isAdmin()) {
         $result = $db->getTable();
     } else {
         $result = $db->getRowsWhere("clientname = '" . $parent->nname . "'");
     }
     return $result;
 }
Example #8
0
 function createExtraVariables()
 {
     $this->__var_system_username = $this->getParentO()->username;
     $sq = new Sqlite(null, 'davuser');
     $list = $sq->getRowsWhere("parent_clname = '{$this->parent_clname}'", array("username", "realpass"));
     $this->__var_davuser = $list;
     $sq = new Sqlite(null, 'web');
     $list = $sq->getRowsWhere("syncserver = '{$this->getParentO()->syncserver}'", array('nname'));
     $this->__var_domlist = get_namelist_from_arraylist($list);
 }
Example #9
0
 function createExtraVariables()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->__var_mailto = $this->getParentO()->cron_mailto;
     $mydb = new Sqlite($this->__masterserver, "cron");
     $parent = $this->getParentO();
     $this->__var_cron_list = $mydb->getRowsWhere("username = '******'");
     $mydb = new Sqlite($this->__masterserver, "uuser");
     $userlist = $mydb->getRowsWhere("nname = '{$parent->username}'");
     $this->__var_user_list = $userlist[0];
 }
Example #10
0
 function createExtraVariables()
 {
     $path = $this->getParentO()->getFullDocRoot();
     $this->__var_htp = "{$path}/.htaccess";
     $sq = new Sqlite(null, $this->get__table());
     $res = $sq->getRowsWhere("parent_clname = '{$this->parent_clname}'");
     $result = merge_array_object_not_deleted($res, $this);
     foreach ($result as $r) {
         $out[$r['mimehandler']] = $r['extension'];
     }
     $this->__var_mimehandler = $out;
 }
Example #11
0
 function getTotalPaid()
 {
     $sq = new Sqlite(null, "paymentdetail");
     $res = $sq->getRowsWhere("month = '{$this->month}' AND client = '{$this->client}'");
     $total = 0;
     if ($res) {
         foreach ($res as $r) {
             $total += $r['amount'];
         }
     }
     return $total;
 }
Example #12
0
 static function initThisOutOfBand($parent, $iclass, $mclass, $rclass)
 {
     $sq = new Sqlite(null, $iclass);
     $res = $sq->getRowsWhere("parent_clname = '{$parent->getClName()}'", array("nname"));
     $res = get_namelist_from_arraylist($res);
     $ret = null;
     foreach ($res as $r) {
         $ret[] = "or";
         $ret[] = array('parent_clname', '=', "'{$mclass}-{$r}'");
     }
     unset($ret[0]);
     return $ret;
 }
Example #13
0
 function createUsed()
 {
     if (isset($this->used_f)) {
         return $this->used_f;
     }
     $db = new Sqlite($this->__masterserver, 'domaintemplate');
     $res = $db->getRowsWhere("dnstemplate = '{$this->nname}'");
     if ($res) {
         $this->used_f = 'on';
     } else {
         $this->used_f = 'off';
     }
     return $this->used_f;
 }
Example #14
0
 function getUsed()
 {
     $vlist = array("mmail" => "mmail", "dns" => "dns", "web" => "web", "mysqldb" => 'mysqldb', 'mssqldb' => 'mssqldb');
     $ret = null;
     foreach ($vlist as $k => $v) {
         if (!is_array($v)) {
             $db = $v;
             $vname = "syncserver";
         } else {
             $db = $v[0];
             $vname = $v[1];
         }
         $db = new Sqlite($this->__masterserver, $db);
         $str = "{$vname} = '{$this->nname}'";
         $res = $db->getRowsWhere($str, array('nname'));
         if ($res) {
             $tmp = null;
             foreach ($res as $r) {
                 $tmp[] = $r['nname'];
             }
             $ret[$k] = implode(", ", $tmp);
         }
     }
     return $ret;
 }
Example #15
0
 function checkMessageUnread()
 {
     $sql = new Sqlite($this->__masterserver, 'smessage');
     $res = $sql->getRowsWhere("text_sent_to_cmlist LIKE '%,{$this->getClName()},%' AND text_readby_cmlist NOT LIKE '%,{$this->getClName()},%'");
     return count($res);
 }
Example #16
0
 function getIpaddress($list = null)
 {
     $retlist = null;
     if ($list && !is_array($list)) {
         $list = null;
     }
     // If the list is null then return nothing. The list is supposed to be the quota of the web servers configured. So if it doesn't exist, then we need to return nothing. Make sure we don't call it without anything.
     if (!$list) {
         return null;
     }
     if ($this->isAdmin()) {
         $iplist = $this->getList('ipaddress');
         dprintoa($iplist);
         foreach ($iplist as $ip) {
             $ipaddr = trim($ip->ipaddr);
             if (!$ipaddr) {
                 continue;
             }
             if ($list) {
                 $syncserver = $ip->syncserver ? $ip->syncserver : 'localhost';
                 if (array_search_bool($syncserver, $list)) {
                     $retlist[] = $ipaddr;
                 }
             } else {
                 $retlist[] = $ipaddr;
             }
         }
         return $retlist;
     }
     $sql = new Sqlite($this->__masterserver, "ipaddress");
     if ($this->listpriv->ipaddress_list) {
         foreach ($this->listpriv->ipaddress_list as $ip) {
             $res = $sql->getRowsWhere("ipaddr = '{$ip}'", array('syncserver'));
             foreach ($res as $a) {
                 $serv[] = $a['syncserver'] ? $a['syncserver'] : 'localhost';
             }
             foreach ($serv as $s) {
                 if (array_search_bool($s, $list)) {
                     $retlist[] = $ip;
                 }
             }
         }
     }
     if ($retlist) {
         $retlist = array_unique($retlist);
     }
     return $retlist;
 }
Example #17
0
 function fix_syncserver_nname_problem()
 {
     $rewrite = get_class_variable($this->get__table(), "__rewrite_nname_const");
     if ($rewrite && array_search_bool("syncserver", $rewrite)) {
         $newthis = clone $this;
         $newthis->syncserver = $newserver;
         foreach ($rewrite as $n) {
             $nnamelist[] = $newthis->{$n};
         }
         $newthis->nname = implode($sgbl->__var_nname_impstr, $nnamelist);
         $sql = new Sqlite($this->__masterserver, $this->get__table());
         $res = $sql->getRowsWhere("nname = '{$newthis->nname}'");
         if ($res) {
             throw new lxException("changed_name_already_exists", $newthis->nname, "syncserver");
         }
         $this->__real_nname = $this->nname;
         $this->nname = $newthis->nname;
         $parent = $this->getParentO();
         $list = $this->get__table() . "_l";
         $parent->{$list}[$this->__real_nname] = null;
         unset($parent->{$list}[$this->__real_nname]);
         $parent->{$list}[$this->nname] = $this;
     }
 }
Example #18
0
<?php

include_once "htmllib/lib/displayinclude.php";
initProgram('admin');
$sq = new Sqlite(null, 'vps');
$list = parse_opt($argv);
$ip = $list['ipaddress'];
$res = $sq->getRowsWhere("coma_vmipaddress_a LIKE '%{$ip}%'");
if ($res) {
    foreach ($res as $r) {
        print $r['nname'];
        print "\n";
    }
} else {
}
Example #19
0
 static function initThisList($parent, $class)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $sql = new Sqlite($parent->__masterserver, "service");
     $driverapp = $gbl->getSyncClass($parent->__masterserver, $parent->__readserver, 'service');
     if (!$driverapp) {
         return;
     }
     $list = $sql->getRowsWhere("parent_clname = '{$parent->getClname()}'");
     foreach ($list as $l) {
         $nlist[$l['servicename']] = $l;
     }
     $res = rl_exec_get($parent->__masterserver, $parent->__readserver, array("service__{$driverapp}", 'getServiceDetails'), array($nlist));
     return $res;
 }
Example #20
0
 function updatesaveVPSData($param)
 {
     $sq = new Sqlite(null, "vps");
     $list = $sq->getRowsWhere("syncserver = '{$this->nname}'", array("nname"));
     $list = get_namelist_from_arraylist($list);
     foreach ($list as $l) {
         $vps = new VPS(null, $this->nname, $l);
         $vps->get();
         $data[$l] = $vps;
     }
     $this->__var_vpsdata = $data;
     $param['some_f'] = 'a';
     return $param;
 }
Example #21
0
 static function checkIfAlreadyAssigned($class, $ipaddr)
 {
     $sq = new Sqlite(null, 'ipaddress');
     $res = $sq->getRowsWhere("ipaddr = '{$ipaddr}'", array('nname'));
     if ($res) {
         return $res[0]['nname'];
     }
     $sq = new Sqlite(null, 'vps');
     $res = $sq->getRowsWhere("coma_vmipaddress_a LIKE '%,{$ipaddr},%'", array('nname'));
     if ($res) {
         return $res[0]['nname'];
     }
     return false;
 }
Example #22
0
 function getDomainAlist(&$alist)
 {
     $rd = null;
     if ($this->default_domain && !$this->isDisabled('default_domain')) {
         $d = new Domain(null, null, $this->default_domain);
         $d->get();
         if ($d->dbaction === 'clean' && $d->parent_clname === $this->getClName()) {
             $rd = $d;
         }
     }
     if (!$rd) {
         $sq = new Sqlite(null, 'domain');
         $list = $sq->getRowsWhere("parent_clname = '{$this->getClName()}'", array('nname'));
         if ($list) {
             $list = get_namelist_from_arraylist($list);
             $dname = getFirstFromList($list);
             $d = new Domain(null, null, $dname);
             $d->get();
             $rd = $d;
         }
     }
     if (!$rd) {
         return;
     }
     $this->getAlistFromChild($rd, $alist);
     try {
         $m = $this->getFromList('mailaccount', "postmaster@{$rd->nname}");
     } catch (exception $e) {
         return;
     }
     $alist['__title_mailaccount'] = "Mailaccount {$m->nname}";
     //$alist[] =   "a=addform&c=mailaccount";
     $malist = $m->createShowAlist($rslist);
     foreach ($malist as $k => $a) {
         if (csb($k, "__title")) {
             //$alist[$k] = $a;
         } else {
             if (is_string($a)) {
                 $alist[] = "j[class]=mailaccount&j[nname]={$m->nname}&{$a}";
             } else {
                 if (!csb($a->url, "http")) {
                     $a->url = "j[class]=mailaccount&j[nname]={$m->nname}&{$a->url}";
                 }
                 $alist[] = $a;
             }
         }
     }
 }
Example #23
0
function findServerTraffic()
{
    global $gbl, $sgbl, $login, $ghtml;
    $sq = new Sqlite(null, 'vps');
    $list = $login->getList('pserver');
    foreach ($list as $l) {
        $res = $sq->getRowsWhere("syncserver = '{$l->nname}'", array('used_q_traffic_usage', 'used_q_traffic_last_usage'));
        $tusage = 0;
        $tlastusage = 0;
        foreach ($res as $r) {
            $tusage += $r['used_q_traffic_usage'];
            $tlastusage += $r['used_q_traffic_last_usage'];
        }
        $l->used->server_traffic_usage = $tusage;
        $l->used->server_traffic_last_usage = $tlastusage;
        $l->setUpdateSubaction();
        $l->write();
    }
}
Example #24
0
 function updateWall($param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $clname = $this->getClName();
     $db = new Sqlite($this->__masterserver, "client");
     $clist = $db->getRowsWhere("parent_clname = '{$clname}'", array("nname", "contactemail"));
     $db = new Sqlite($this->__masterserver, "domain");
     $dlist = $db->getRowsWhere("parent_clname = '{$clname}'", array("nname", "contactemail"));
     $nlist = lx_merge_good($clist, $dlist);
     foreach ($nlist as $client) {
         if ($client['contactemail']) {
             if ($sgbl->dbg > 0) {
                 $subject = $param['wall_subject_f'] . " ({$client['nname']})";
             }
             $contactemail = $client['contactemail'];
             lx_mail(null, $contactemail, $subject, $param['wall_message_f']);
         }
     }
     throw new lxException("success_message_successfully_sent", '');
 }
Example #25
0
 function updateform($subaction, $param)
 {
     global $gbl, $sgbl, $login, $ghtml;
     switch ($subaction) {
         case "centralbackupconfig":
             $list = $login->getList('centralbackupserver');
             $list = get_namelist_from_objectlist($list);
             $vlist['centralbackupserver'] = array('s', add_disabled($list));
             $vlist['internalnetworkip'] = null;
             $vlist['tmpdir'] = null;
             //$vlist['__v_updateall_button'] = array();
             return $vlist;
         case "commandcenter":
             return $this->commandCenter($param);
             break;
         case "timezone":
             $vlist['timezone'] = array('s', pserver::getTimeZoneList());
             return $vlist;
         case "ssl_key":
             $this->createPublicPrivate();
             $this->setUpdateSubaction();
             $vlist['text_public_key'] = array('t', null);
             return $vlist;
         case "switchprogram":
             $this->web_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'web');
             $this->dns_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'dns');
             $this->spam_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'spam');
             $vlist['web_driver'] = array('s', array('apache', 'lighttpd'));
             $vlist['dns_driver'] = array('s', array('bind', 'djbdns'));
             $vlist['spam_driver'] = array('s', array('spamassassin', 'bogofilter'));
             return $vlist;
         case "mysqlpasswordreset":
             $vlist['newpassword_f'] = null;
             return $vlist;
         case "importvps":
             $vlist['importvps'] = array('M', 'Import Vpses on this server?');
             $vlist['__v_button'] = "Import";
             return $vlist;
         case "importhypervmvps":
             $vlist['importvps'] = array('M', 'Import HyperVM Vpses on this server?');
             $vlist['__v_button'] = "Import";
             return $vlist;
         case "savevpsdata":
             $vlist['__v_button'] = "Save";
             return $vlist;
         case "information":
             $sq = new Sqlite(null, 'client');
             $res = $sq->getRowsWhere("cttype = 'wholesale'", null, array('nname'));
             $clientlist = get_namelist_from_arraylist($res);
             $vlist['description'] = null;
             $vlist['realhostname'] = null;
             if ($sgbl->isHyperVm()) {
                 $list = get_namelist_from_objectlist($login->getList('datacenter'));
                 if (!$list) {
                     $list[] = '--no-dc--';
                     $this->datacenter = '--no-dc--';
                 }
                 $vlist['datacenter'] = array('s', $list);
                 $newclientlist = lx_array_merge(array(array('--unassigned--'), $clientlist));
                 if ($this->nname === 'localhost') {
                     $vlist['clientname'] = array('M', $login->getKeyword('master_cannot_be_assigned'));
                 } else {
                     $vlist['clientname'] = array('s', $newclientlist);
                 }
             }
             if ($sgbl->isHyperVm()) {
                 $vlist['max_vps_num'] = null;
             }
             $this->setDefaultValue("load_threshold", "20");
             $vlist['load_threshold'] = null;
             return $vlist;
         case "backupconfig":
             return $vlist;
         case "phpsmtp":
             $vlist['pserverconf_b_s_usesmtp'] = null;
             $vlist['pserverconf_b_s_smtpserver'] = null;
             $vlist['pserverconf_b_s_smtpport'] = null;
             $vlist['pserverconf_b_s_smtpuseauth'] = null;
             $vlist['pserverconf_b_s_smtpuser'] = null;
             $vlist['pserverconf_b_s_smtppass'] = null;
             return $vlist;
         case "cron_mailto":
             $vlist['cron_mailto'] = null;
             return $vlist;
         case "vpslist":
             $vlist['used_vpslist_f'] = array('M', $this->getUsed());
             $vlist['__v_button'] = array();
             return $vlist;
         case "showused":
             $res = $this->createUsedDomainList();
             foreach ($res as $k => $v) {
                 $var = "used_domainlist_{$k}_f";
                 $vlist[$var] = array('M', $this->{$var});
             }
             $vlist['__v_button'] = array();
             return $vlist;
         case "update":
             $vlist['nname'] = array('M', null);
             $vlist['password'] = null;
             return $vlist;
         case "poweroff":
             // --- issue 612 - Hide password in reboot / shutdown server
             //	$vlist['retype_admin_p_f'] = null;
             $vlist['__v_button'] = 'Poweroff';
             return $vlist;
         case "reboot":
             // --- issue 612 - Hide password in reboot / shutdown server
             //	$vlist['retype_admin_p_f'] = null;
             $vlist['__v_button'] = 'Reboot';
             return $vlist;
         case "dbpassword":
             $vlist['dbadmin'] = null;
             $vlist['dbpassword'] = null;
             return $vlist;
     }
     return parent::updateform($subaction, $param);
 }
Example #26
0
function do_master_get_data($var)
{
    switch ($var) {
        case "contactemail":
            $sq = new Sqlite(null, 'client', true);
            $vv = $sq->getRowsWhere("nname = 'admin'", array("contactemail"));
            return $vv[0]['contactemail'];
    }
    return null;
}
Example #27
0
 function createExtraVariables()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $gen = $login->getObject('general')->generalmisc_b;
     $port = $login->getObject('general')->portconfig_b;
     $webstatsprog = $gen->webstatisticsprogram;
     if (!$webstatsprog) {
         $webstatsprog = "awstats";
     }
     $this->__var_statsprog = $webstatsprog;
     $ol = array("index.php", "index.html", "index.shtml", "index.htm", "default.htm", "Default.aspx", "Default.asp", "index.pl");
     if (!isset($login->getObject('genlist')->dirindexlist_a)) {
         $this->__var_index_list = $ol;
     } else {
         $dirin = $login->getObject('genlist')->dirindexlist_a;
         $list = get_namelist_from_objectlist($dirin);
         $this->__var_index_list = lx_array_merge(array($list, $ol));
     }
     //	$this->__var_sslport = $port->sslport;
     //	if (!$this->__var_sslport) $this->__var_sslport = "7777";
     $this->__var_sslport = isset($port->sslport) ? $port->sslport : "7777";
     //	$this->__var_nonsslport = $port->nonsslport;
     //	if (!$this->__var_nonsslport) $this->__var_nonsslport = "7778";
     $this->__var_nonsslport = isset($port->nonsslport) ? $port->nonsslport : "7778";
     //	if (!$this->docroot) { $this->docroot = $this->nname; }
     //	if (!$this->corelocation) { $this->corelocation = "__path_customer_root"; }
     if (!isset($this->docroot)) {
         $this->docroot = $this->nname;
     }
     if (!isset($this->corelocation)) {
         $this->corelocation = "__path_customer_root";
     }
     $this->__var_extrabasedir = $gen->extrabasedir;
     $this->__var_dirprotect = $this->getList("dirprotect");
     if (!$this->isDeleted()) {
         if ($this->getParentO()) {
             $parent = $this->getParentO()->getParentO();
         }
         if ($parent) {
             $this->__var_disable_url = $parent->disable_url;
         }
     }
     //$dvlist = $this->getList('davuser');
     $dvlist = null;
     foreach ((array) $dvlist as $v) {
         $ndvlist[$v->directory][] = null;
     }
     //$this->__var_davuser = $ndvlist;
     $this->__var_davuser = null;
     if (!$this->customer_name) {
         if ($this->getRealClientParentO()) {
             $this->customer_name = $this->getRealClientParentO()->getPathFromName();
         }
     }
     $this->__var_railspp = $this->getList('rubyrails');
     $mydb = new Sqlite($this->__masterserver, 'ipaddress');
     $syncserver = $this->syncserver ? $this->syncserver : 'localhost';
     $string = "syncserver = '{$syncserver}'";
     $this->__var_ipssllist = $mydb->getRowsWhere($string, array('ipaddr', 'nname'));
     $this->__var_addonlist = $this->getTrueParentO()->getList('addondomain');
     if (!isset($this->__var_sysuserpassword)) {
         $this->__var_sysuserpassword['realpass'] = $this->getParentO()->realpass;
     }
     $dipdb = new Sqlite(null, "domainipaddress");
     $string = "syncserver = '{$syncserver}' ";
     $domainip = $dipdb->getRowsWhere($string, array('domain', 'ipaddr'));
     $this->__var_domainipaddress = get_namelist_from_arraylist($domainip, 'ipaddr', 'domain');
     $ipdb = new Sqlite($this->__masterserver, 'ipaddress');
     $string = "syncserver = '{$syncserver}' ";
     $iplist = $ipdb->getRowsWhere($string, array('ipaddr'));
     $this->__var_ipaddress = $iplist;
     $mydb = new Sqlite($this->__masterserver, "web");
     /* This is to ensure that the excess domainipaddress entries are filtered out.
     	$siplist = get_namelist_from_arraylist($iplist, 'ipaddr');
     	foreach($this->__var_domainipaddress as $k) {
     		if (!isset($siplist[$k])) {
     			unset($this->__var_domainipaddress[$k]);
     		}
     	}
     */
     if ($this->dbaction === 'update' && $this->subaction !== 'full_update' && $this->subaction !== 'fixipdomain') {
         return;
     }
     if ($this->dbaction === 'add') {
         $this->__var_parent_contactemail = $this->getTrueParentO()->getTrueParentO()->contactemail;
         $this->__var_clientname = $this->getTrueParentO()->getTrueParentO()->nname;
     }
     $string = "syncserver = '{$syncserver}'";
     $this->__var_vdomain_list = $mydb->getRowsWhere($string, array('nname', 'ipaddress'));
     /*
     $string = "ttype='forward' AND syncserver = '$syncserver'" ;
     $this->__var_fdomain_list = $mydb->getRowsWhere($string, array('nname'));
     */
     // new -- related to apache/lighttpd new structure
     $mmaildb = new Sqlite($this->__masterserver, 'mmail');
     $syncserver = $this->syncserver ? $this->syncserver : 'localhost';
     $string = "syncserver = '{$syncserver}'";
     $this->__var_mmaillist = $mmaildb->getRowsWhere($string, array('nname', 'parent_clname', 'webmailprog', 'webmail_url', 'remotelocalflag'));
 }
Example #28
0
 static function VerifyString($parent, $param)
 {
     $ip = $param['ipaddr'];
     if (!self::isValidIpaddress($ip)) {
         throw new lxexception("ipaddress_invalid", 'ipaddr');
     }
     if ($param['gateway']) {
         if (!self::isValidIpaddress($param['gateway'])) {
             throw new lxexception("gateway_invalid", 'gateway');
         }
     }
     if (!self::isValidIpaddress($param['netmask'])) {
         throw new lxexception("netmask_invalid", 'netmask');
     }
     $sq = new Sqlite($parent->__masterserver, "ipaddress");
     $res = $sq->getRowsWhere("syncserver = '{$parent->nname}'");
     $list = get_namelist_from_arraylist($res, "ipaddr");
     if (array_search_bool($ip, $list)) {
         throw new lxexception("ipaddress_already_configured", 'ipaddr');
     }
     $ret = lxshell_return("ping", "-n", "-c", "1", "-w", "5", $ip);
     // If the return status is 1, the ping fail and nobody uses. But if return is 0, somebody is using the IP
     if (intval($ret) !== 1) {
         throw new lxexception($ret . 'Another host is using the IP ' . $ip . ' and it is responding to the IP ping. Please you will ensure to use an available IP to add.', 'ipaddr');
     }
 }
Example #29
0
 function isSelect()
 {
     return true;
     $db = new Sqlite($this->__masterserver, "sslipaddress");
     $res = $db->getRowsWhere("sslcert = '{$this->certname}'", array('nname'));
     return $res ? false : true;
 }
Example #30
0
<?php

include_once "htmllib/lib/include.php";
initProgram('admin');
$sq = new Sqlite(null, 'ftpuser');
$list = $sq->getRowsWhere("realpass = ''");
if (!$list) {
    exit;
}
foreach ($list as $l) {
    if ($l['realpass']) {
        continue;
    }
    print "setting pass for {$l['nname']}\n";
    $name = $l['nname'];
    $pass = randomString(8);
    $sq->rawQuery("update ftpuser set realpass = '******' where nname = '{$name}'");
    lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "passwd", $name, "-m");
}