Beispiel #1
0
function moveToClient()
{
    global $gbl, $sgbl, $login, $ghtml;
    $login->loadAllObjects('ftpuser');
    $l = $login->getList('ftpuser');
    foreach ($l as $b) {
        if (csb($b->parent_clname, 'web-')) {
            list($parentclass, $parentname) = getParentNameAndClass($b->parent_clname);
            $d = new Domain(null, null, $parentname);
            $d->get();
            $b->parent_clname = $d->parent_clname;
            $w = $d->getObject('web');
            $b->directory = "{$w->docroot}/{$b->directory}";
            $b->directory = remove_extra_slash($b->directory);
            $b->setUpdateSubaction();
            $b->write();
        }
    }
    $login->loadAllObjects('mysqldb');
    $l = $login->getList('mysqldb');
    foreach ($l as $b) {
        if (csb($b->parent_clname, 'domain-')) {
            list($parentclass, $parentname) = getParentNameAndClass($b->parent_clname);
            $d = new Domain(null, null, $parentname);
            $d->get();
            $b->parent_clname = $d->parent_clname;
            $b->setUpdateSubaction();
            $b->write();
        }
    }
}
Beispiel #2
0
function lxfile_rm_rec($file)
{
    $obj = new COM("Scripting.FilesystemObject");
    $file = expand_real_root($file);
    $file = remove_extra_slash($file);
    $list = explode("/", $file);
    if (count($list) <= 2) {
        throw new lxException('recursive_removal_low_level_directories_not_allowed', '');
    }
    if (lxfile_exists($file)) {
        if (is_dir($file)) {
            $obj->deleteFolder($file);
        } else {
            $obj->deleteFile($file);
        }
    }
}
Beispiel #3
0
 function createdom()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $chDomain = true;
     $base = "c:/webroot";
     $obj = new lxCOM("winmgmts://./root/WebAdministration");
     $iiso = $obj->com_get("Site.Name='{$progname}'");
     if (!$iiso) {
         $iisdfn = $obj->get("Site");
         $iisdfn->Create($progname, $serverbind, $homedir);
         $iiso = $obj->com_get("Site.Name='{$progname}'");
     }
     try {
         $obj->Get("ApplicationPool")->Create($this->main->username);
     } catch (exception $e) {
     }
     $app = $obj->get("ApplicationPool.Name='{$this->main->username}'");
     $app->ProcessModel->IdentityType = 3;
     $app->ProcessModel->UserName = "******";
     $app->ProcessModel->Password = "******";
     $app->Put_();
     $this->main->createDir();
     //$this->main->username;
     $homedir = $this->main->getFullDocRoot();
     $name = $this->main->nname;
     $homedir = remove_extra_slash($homedir);
     $homedir = convertTobackSlash($homedir);
     $serverbind = $this->getServerBindings("80");
     //$securebind = $this->getServerBindings("443");
     $iiso->ApplicationDefaults->ApplicationPool = $this->main->username;
     $exec = "c:/Program Files/lxlabs/ext/php/php.exe";
     $oHandler = $obj->Get("HandlerAction")->SpawnInstance_();
     $oHandler->Name = "php";
     $oHandler->Path = "*.php";
     $oHandler->Verb = "GET,POST";
     $oHandler->ScriptProcessor = "\"{$exec}\"";
     $handle = new Variant(NULL);
     $iiso->getSection("HandlersSection", $handle);
     try {
         $handle->Add("Handlers", $oHandler);
     } catch (exception $e) {
     }
     $handle->Refresh_();
     $iiso->LogFile->Directory = "c:/webdata/{$this->main->nname}/stats/";
     try {
         $iiso->Put_();
     } catch (exception $e) {
     }
     $site->Put("KeyType", "IIsWebServer");
     //$site->Put("logfile", "$base/{$this->main->nname}/stats/access.log");
     $site->Put("ServerState", 2);
     $site->Put("FrontPageWeb", 1);
     $site->DefaultDoc = implode(",", array("index.htm", "index.html", "Default.aspx", "Default.asp"));
     $site->Put("SecureBindings", $securebind);
     $site->Put("ServerAutoStart", 1);
     $site->Put("ServerSize", 1);
     $site->SetInfo();
     //setting Log Files
     // Create application virtual directory
     $siteVDir = new lxCOM("IIS://localhost/w3svc/{$id}/Root");
     $siteVDir->AppIsolated = array(2);
     $siteVDir->Path = array($homedir);
     $siteVDir->AccessFlags = array(513);
     $siteVDir->FrontPageWeb = array(1);
     $siteVDir->AppRoot = array("/LM/W3SVC/{$id}/Root");
     $siteVDir->AppFriendlyName = array("Root");
 }
Beispiel #4
0
 function getDirIndexCore($dir)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $string = null;
     $dir = remove_extra_slash("/{$dir}");
     $string .= "\t<Location {$dir}>\n";
     $string .= "\t\tOptions +Indexes\n";
     $string .= "\t</Location>\n\n";
     return $string;
 }
Beispiel #5
0
function appvault_dbfilter($inputfile, $outputfile, $cont)
{
    global $gbl, $sgbl, $login, $ghtml;
    $val = lfile_get_contents($inputfile);
    $fullurl = "{$cont['domain']}/{$cont['installdir']}";
    $fullurl = trim($fullurl, "/");
    $full_install_path = "{$cont['full_document_root']}/{$cont['installdir']}";
    $full_install_path = remove_extra_slash($full_install_path);
    $full_install_path = trim($full_install_path, "/");
    $full_install_path = "/{$full_install_path}";
    $install_dir = $cont['installdir'];
    $install_dir = trim($install_dir, "/");
    $full_doc_root = $cont['full_document_root'];
    $full_doc_root = trim($full_doc_root, "/");
    $full_doc_root = "/{$full_doc_root}";
    if (isset($cont['relative_script_path'])) {
        $relative_script_path = $cont['relative_script_path'];
        $relative_script_path = remove_extra_slash("/{$relative_script_path}");
    } else {
        if (isset($cont['executable_file_path'])) {
            $execpath = $cont['executable_file_path'];
            $relative_script_path = remove_extra_slash("/{$install_dir}/{$execpath}");
        } else {
            $relative_script_path = $install_dir;
        }
    }
    $val = str_replace("__lx_full_url", $fullurl, $val);
    $val = str_replace("__lx_full_installdir", $full_install_path, $val);
    $val = str_replace("__lx_full_script_path", $full_install_path, $val);
    $val = str_replace("__lx_document_root", $full_doc_root, $val);
    $val = str_replace("__lx_installdir", $install_dir, $val);
    $val = str_replace("__lx_relative_script_path", $relative_script_path, $val);
    $val = str_replace("__lx_title", $cont['title'], $val);
    $val = str_replace("__lx_admin_email", $cont['email'], $val);
    $val = str_replace("__lx_admin_company", $cont['company'], $val);
    $val = str_replace("__lx_real_name", $cont['realname'], $val);
    $val = str_replace("__lx_install_flag", $cont['install_flag'], $val);
    $val = str_replace("__lx_admin_name", $cont['adminname'], $val);
    $val = str_replace("__lx_submit_value", $cont['submit_value'], $val);
    $val = str_replace("__lx_client_path", "/home/{$cont['customer_name']}", $val);
    $val = str_replace("__lx_adminemail_login", $cont['admin_email_login'], $val);
    $val = str_replace("__lx_admin_pass", $cont['adminpass'], $val);
    $val = str_replace("__lx_md5_adminpass", md5($cont['adminpass']), $val);
    $val = str_replace("__lx_db_host", $cont['realhost'], $val);
    $val = str_replace("__lx_db_name", $cont['dbname'], $val);
    $val = str_replace("__lx_db_pass", $cont['dbpass'], $val);
    $val = str_replace("__lx_db_user", $cont['dbuser'], $val);
    $val = str_replace("__lx_db_type", $cont['dbtype'], $val);
    $val = str_replace("__lx_url", $cont['domain'], $val);
    $val = str_replace("__lx_domain_name", $cont['domain'], $val);
    $val = str_replace("__lx_action", $cont['action'], $val);
    //dprint("Writing to file {$cont['output']}\n");
    //dprint("{$cont['output']} : $val\n");
    lfile_put_contents($outputfile, $val);
}
Beispiel #6
0
function lxfile_rm_rec($file)
{
    $file = expand_real_root($file);
    $file = remove_extra_slash($file);
    $list = explode("/", $file);
    if (count($list) <= 2) {
        return;
        //throw new lxException("recursive_removal_low_level_directories_not_allowed$file", '', $file);
    }
    if (preg_match("/\\*/", $file)) {
        throw new lxException('no_stars_allowed', '');
    }
    lxshell_return("rm", "-r", $file);
}
Beispiel #7
0
/**
 * @return void
 * @param unknown
 * @param unknown
 * @desc This function is the core of the the path abstraction. It converts the paths of the form '__path.../dir' to '$sgbl->__path.../dir'. This is used in all the redefined functions to convert their arguments.
 */
function expand_real_root($root)
{
    global $gbl, $sgbl, $login, $ghtml;
    if (char_search_beg($root, "__path")) {
        if (char_search_a($root, "/")) {
            $var = substr($root, 0, strpos($root, "/"));
            $root = $sgbl->{$var} . "/" . substr($root, strpos($root, "/") + 1);
        } else {
            $root = $sgbl->{$root};
        }
    }
    $root = remove_extra_slash($root);
    return $root;
}
Beispiel #8
0
 function syncToPort($port, $subweb)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $web_home = $sgbl->__path_httpd_root;
     $base_root = $sgbl->__path_httpd_root;
     $domainname = $this->main->nname;
     $user_home = "{$this->main->getFullDocRoot()}/";
     $log_path = "{$web_home}/{$this->main->nname}/stats";
     $cust_log = "{$log_path}/{$this->main->nname}-custom_log";
     $err_log = "{$log_path}/{$this->main->nname}-error_log";
     $string = null;
     $string .= $this->hotlink_protection();
     $string .= $this->getBlockIP();
     $string .= $this->main->text_lighty_rewrite;
     $string .= "\n";
     $domname = $this->main->nname;
     $string .= $this->getDocumentRoot($subweb);
     $string .= $this->getIndexFileOrder();
     // Hack.. This is done so that others can use '+' without any issue.
     $string .= "\talias.url += ( \"/awstatsicons\" => \"/home/kloxo/httpd/awstats/wwwroot/icon/\" )\n";
     $string .= "\talias.url += ( \"/awstatscss\" => \"/home/kloxo/httpd/awstats/wwwroot/css/\" )\n";
     $string .= $this->getAwstatsString();
     if ($this->main->priv->isOn('cgi_flag')) {
         $string .= $this->getCgiString();
     }
     foreach ((array) $this->main->redirect_a as $red) {
         $rednname = remove_extra_slash("/{$red->nname}");
         if ($red->ttype === 'local') {
             $string .= "\talias.url += ( \"{$rednname}\" => \"{$user_home}/{$red->redirect}\" )\n";
         } else {
             if (!redirect_a::checkForPort($port, $red->httporssl)) {
                 continue;
             }
             $string .= "\turl.redirect += ( \".*{$rednname}\" => \"{$red->redirect}\" )\n";
         }
     }
     $string .= "\taccesslog.filename = \"{$cust_log}\"\n";
     $string .= "\tserver.errorlog = \"{$err_log}\"\n\n";
     return $string;
 }