function __construct($masterserver, $readserver, $rmuser, $rmpass, $rmdir, $name) { $this->rmuser = $rmuser; $this->rmpass = $rmpass; $this->rmdir = $rmdir; parent::__construct(null, null, $name); }
function display($var) { if ($var === 'size') { return getKBOrMB(round($this->{$var} / 1024)); } return parent::display($var); }
function updateDirindex($param) { $param['indexfile_list'] = lxclass::fixListVariable($param['indexfile_list']); return $param; }
function updateDnstemplatelist($param) { $param['dnstemplate_list'] = lxclass::fixListVariable($param['dnstemplate_list']); return $param; }
function get_classvar_description_after_overload($class, $property) { global $gbl, $sgbl, $login; lxclass::resolve_class_differences($class, $property, $dclass, $dproperty); $classdesc = get_classvar_description($dclass); $prop_descr = get_classvar_description($dclass, $dproperty); $this->fix_variable_overload($prop_descr, $classdesc[2]); $prop_descr[2] = getNthToken($prop_descr[2], 1); return $prop_descr; }
/** * @return void * @param * @param * @desc Remote or local exec. Either exectues it locally or calles remote exec depending on whether $syncserver is localhost or not. */ function rl_exec($masterserver, $slaveserver, $cmd) { global $gbl, $sgbl, $login, $ghtml; // Convert to driverapp here. Only here do we have the full information (masterserver/syncserver) to to get the syntosystem class properly. if ($cmd->action === "set" || $cmd->action === 'dowas') { $robject = $cmd->robject; $clo = myclone($robject); //dprint("Just before $robject {$robject->nname} " . $robject->domain_l . "<br> "); lxclass::clearChildrenAndParent($clo); $clo->syncserver = $slaveserver; $clo->createSyncClass(); //dprint("Just after $robject {$robject->nname} " . $robject->domain_l . "<br> "); $cmd->robject = $clo; } if (!$masterserver || $masterserver === "localhost") { $cmd->slaveserver = null; if (!isset($gbl->pserver_password) && isset($cmd->slave_password)) { $gbl->pserver_password = $cmd->slave_password; } $result = remote_exec($slaveserver, $cmd); } else { $cmd->slaveserver = $slaveserver; $result = remote_exec($masterserver, $cmd); } return $result; }
function dprintr($var, $type = 0) { global $sgbl; if ($type > $sgbl->dbg) { return; } if (is_object($var) && method_exists($var, "clearChildrenAndParent")) { $newvar = myclone($var); lxclass::clearChildrenAndParent($newvar); $newvar->driverApp = 'unset for printing'; $newvar->__parent_o = 'unset for printing'; $class = $newvar->get__table(); if (csb($class, "sp_")) { $bclass = strfrom($class, "sp_") . "_b"; $newvar->{$bclass}->__parent_o = 'unset for printing'; } } else { $newvar = $var; } if ($sgbl->isBlackBackground()) { print "<font color=gray>"; } print_r($newvar); if ($sgbl->isBlackBackground()) { print "</font> "; } }
function doSimpleBackup($bfile, $param) { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; $cprogname = ucfirst($progname); // Load the entire Backup $this->loadBackupAll(); $fullrem = new Remote(); $ver = $sgbl->__ver_major_minor; $fullrem->version = $ver; $fullrem->ddate = time(); $cleanobject = clone $this; lxclass::clearChildrenAndParent($cleanobject); $singlerem = clone $fullrem; $singlerem->_clean_object = $cleanobject; $fullrem->bobject = $this; /// Do a was on the login would take a huge amount of time. Let us not do it. $this->__var_bc_metafile = serialize($fullrem); $this->__var_bc_metadata = serialize($singlerem); $this->__var_bc_filename = $bfile; foreach ($param as $k => $v) { if (csb($k, "backupextra_")) { $kk = "__var_bc_{$k}"; $this->{$kk} = $v; } } $this->simpleBackMeupThere(); }
function updateOstemplateList($param) { $param['xenostemplate_list'] = lxclass::fixlistvariable($param['xenostemplate_list']); $param['openvzostemplate_list'] = lxclass::fixlistvariable($param['openvzostemplate_list']); return $param; }
static function addCommand($parent, $class, $p) { return lxclass::addCommand($parent, $class, $p); }
function create_xml($object, $stuff, $ret) { global $gbl, $sgbl, $login, $ghtml; if (is_object($stuff)) { $class = lget_class($stuff); } else { $class = $stuff; } $vlist = $ret['variable']; $action = $ret['action']; $string = null; if (!empty($vlist)) { foreach ($vlist as $k => $v) { if (csb($k, "__c_")) { $cmd = substr($k, 4); $cmd = substr($cmd, 0, strpos($cmd, '_')); $string[] = $ghtml->object_variable_command($cmd, $v); continue; } if (csb($k, "__v_") || csb($k, "__m_")) { continue; } // Hack hack:: used_s is handled separately.. There is no other way, since without any other way to recognize it, quota variables defaults to priv... if (!csb($k, "used_s")) { if ($v && $ghtml->is_special_variable($v[1])) { } else { $descr = $ghtml->get_classvar_description_after_overload($class, $k); //dprintr($descr); if (count($descr) < 3) { dprint("Variable {$k} in {$class} Not Defined... <br> \n"); $descr = array($class, $k, "Not Defined"); } } lxclass::resolve_class_differences($class, $k, $dclass, $dk); } if ($k === "old_password_f") { $string[] = $ghtml->object_variable_oldpassword($dclass, "old_password_f", $descr); continue; } if ($k === "password" || $k === "dbpassword") { $string[] = $ghtml->object_variable_password($class, $k); continue; } if ($v) { if (csa($v[0], 'I')) { if ($v[1] && is_array($v[1])) { $opt = $v[1]; } else { $opt['value'] = $v[1]; } $string[] = $ghtml->object_variable_image($stuff, $k, $opt); $opt = null; continue; } if (csa($v[0], 'L')) { if ($v[1] && is_array($v[1])) { $opt = $v[1]; } else { $opt['fvalue'] = $v[1]; } $string[] = $ghtml->object_variable_fileselect($stuff, $k, $opt); $opt = null; continue; } if (csa($v[0], 'm')) { if ($v[1] && is_array($v[1])) { $opt = $v[1]; } else { $opt['value'] = $v[1]; } $string[] = $ghtml->object_variable_modify($stuff, $k, $opt); $opt = null; continue; } if (csa($v[0], 'E')) { if (!$v[1]) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); } else { $list = $v[1]; } $string[] = $ghtml->object_variable_selectradio($class, $k, $list); $list = null; continue; } if (csa($v[0], 's')) { if (!$v[1]) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); } else { $list = $v[1]; } $string[] = $ghtml->object_variable_select($stuff, $k, $list); $list = null; continue; } if (csa($v[0], 'A')) { if (!$v[1]) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); } else { $list = $v[1]; } $string[] = $ghtml->object_variable_select($stuff, $k, $list, true); $list = null; continue; } if (csa($v[0], 'Q')) { $string[] = $ghtml->object_variable_listquota($object, $stuff, $k, $v[1]); continue; } if (csa($v[0], 'U')) { if (!$v[1]) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); } else { $list = $v[1]; } $string[] = $ghtml->object_variable_multiselect($stuff, $k, $list); $list = null; continue; } if (csa($v[0], 'V')) { $string[] = $ghtml->object_variable_htmltextarea($stuff, $k, $v[1]); continue; } if (csa($v[0], 't')) { $string[] = $ghtml->object_variable_textarea($stuff, $k, $v[1]); continue; } if (csa($v[0], 'T')) { $string[] = $ghtml->object_variable_textarea($stuff, $k, $v[1], true); continue; } if (csa($v[0], 'h')) { $string[] = $ghtml->object_variable_hidden("frm_" . $class . "_c_" . $k, $v[1]); continue; } if (csa($v[0], 'f')) { $string[] = $ghtml->object_variable_check($stuff, $k, $v[1]); continue; } if (csa($v[0], 'M')) { $string[] = $ghtml->object_variable_nomodify($stuff, $k, $v[1]); continue; } } if (csa($descr[0], 'F')) { $string[] = $ghtml->object_variable_file($stuff, $k); continue; } if (csa($descr[0], 'E')) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); $string[] = $ghtml->object_variable_selectradio($stuff, $k, $list); continue; } if (csa($descr[0], 'U')) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); $string[] = $ghtml->object_variable_multiselect($stuff, $k, $list); continue; } if (csa($descr[0], 'f')) { $string[] = $ghtml->object_variable_check($stuff, $k); continue; } if (csa($descr[0], 'e') || csa($descr[0], 's')) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); $string[] = $ghtml->object_variable_select($stuff, $k, $list, false); continue; } if (csa($descr[0], 'A')) { $list = exec_class_method($dclass, "getSelectList", $object, $dk); $string[] = $ghtml->object_variable_select($stuff, $k, $list, true); continue; } if (csa($descr[0], 't')) { $string[] = $ghtml->object_variable_textarea($stuff, $k); continue; } if (csa($descr[0], 'T')) { $string[] = $ghtml->object_variable_textarea($stuff, $k, null, true); continue; } if (csa($descr[0], 'q')) { $string[] = $ghtml->object_variable_quota($object, $stuff, $k); continue; } if (csa($descr[0], 'Q')) { $string[] = $ghtml->object_variable_listquota($object, $stuff, $k); continue; } $string[] = $ghtml->object_variable_modify($stuff, $k); } } $string[] = $ghtml->object_variable_hidden("frm_action", $action); if (isset($ret['subaction'])) { $string[] = $ghtml->object_variable_hidden("frm_subaction", $ret['subaction']); } if (isset($ret['continueaction'])) { $string[] = $ghtml->object_variable_hidden("frm_continueaction", $ret['continueaction']); } //dprintr($vlist); $button = null; if (isset($vlist['__v_button'])) { if ($vlist['__v_button']) { $button = $vlist['__v_button']; } } else { $button = $action; } if ($button) { $string[] = $ghtml->object_variable_button($button); } if (isset($vlist['__v_updateall_button'])) { $string[] = $ghtml->object_variable_button('updateall'); } return $string; }
<?php include_once "htmllib/lib/include.php"; initProgram('admin'); $gbl->loaddriverappInfo('localhost'); $opt = parse_opt($argv); if (!$opt['class']) { exit; } $class = $opt['class']; $login->loadAllObjects($class); $list = $login->getList($class); foreach ($list as $l) { $l->createSyncClass(); } $pserverlist = $login->getList('pserver'); foreach ($pserverlist as $ps) { $ps->createSyncClass(); } $lg = clone $login; lxclass::clearChildrenAndParent($lg); $outlist[$class] = $list; $outlist['pserver'] = $pserverlist; $outlist['login'] = $lg; $outlist['gbl'] = $gbl; print base64_encode(serialize($outlist)); exit;
function doupdateBackup($param) { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; $cprogname = ucfirst($progname); $parent = $this->getParentO(); $bpath = "__path_program_home/{$parent->get__table()}/{$parent->nname}/__backup"; $bfile = $bpath . "/" . $this->createBackupFileName($param['backup_to_file_f']) . "." . $parent->getZiptype(); if ($parent->isSimpleBackup()) { $parent->doSimpleBackup($bfile, $param); } else { $parent->doCoreBackup($bfile, $param); } $object = clone $this; lxclass::clearChildrenAndParent($object); if ($object->isOn('upload_to_ftp')) { try { if ($parent->isClient() || $parent->isLocalhost()) { self::upload_to_server($bfile, basename($bfile), $object); } else { rl_exec_get(null, $parent->syncserver, array('lxbackup', 'upload_to_server'), array($bfile, basename($bfile), $object)); } } catch (Exception $e) { lx_mail(null, $this->getParentO()->contactemail, "{$cprogname} Backup Upload Failed on " . date('Y-M-d') . " at " . date('H') . " Hours", "{$cprogname} Backup upload Failed due to {$e->getMessage()}\n"); } } if ($parent->isClient() || $parent->isLocalhost()) { self::clear_extra_backups($parent->get__table(), $parent->nname, $object); } else { rl_exec_get(null, $parent->syncserver, array('lxbackup', 'clear_extra_backups'), array($parent->get__table(), $parent->nname, $object)); } lx_mail(null, $this->getParentO()->contactemail, "{$cprogname} Backup on " . @date('Y-M-d') . " at " . @date('H') . " Hours", "{$cprogname} Backup Succeeded for {$this->getParentO()->nname}\n"); }