Exemple #1
0
function os_addto_iis()
{
    global $gbl, $sgbl, $login, $ghtml;
    $progname = $sgbl->__var_program_name;
    $obj = new lxCOM("winmgmts://./root/WebAdministration");
    $iiso = $obj->com_get("Site.Name='{$progname}'");
    try {
        $obj->Get("ApplicationPool")->Create("kloxo");
    } catch (exception $e) {
    }
    $uobj = new lxCOM("WinNT://.");
    try {
        $user = new lxCOM("WinNT://./lxlabs");
    } catch (exception $e) {
        $user = $uobj->create("user", "lxlabs");
    }
    $user->setPassword("hellfire");
    $user->setInfo();
    $app = $obj->com_get("ApplicationPool.Name='kloxo'");
    $app->object_set("ProcessModel", "IdentityType", 3);
    $app->object_set("ProcessModel", "UserName", "lxlabs");
    $app->object_set("ProcessModel", "Password", "hellfire");
    $app->Put_();
    if ($iiso->__notreal) {
        $iisdfn = $obj->get("Site");
        $homedir = convertTobackSlash($sgbl->__path_program_htmlbase);
        $oBinding = $obj->get("BindingElement")->SpawnInstance_();
        $oBinding->BindingInformation = "*:7778:";
        $oBinding->Protocol = "http";
        $sBinding = $obj->get("BindingElement")->SpawnInstance_();
        $sBinding->BindingInformation = "*:7777:";
        $sBinding->Protocol = "https";
        $iisdfn->Create($progname, array($oBinding, $sBinding), $homedir);
        $iiso = $obj->com_get("Site.Name='{$progname}'");
    }
    $iiso->object_set("ApplicationDefaults", "ApplicationPool", "kloxo");
    $iiso->Put_();
    $exec = "c:/Program Files/lxlabs/ext/php/php.exe";
    $exec = convertTobackSlash($exec);
    $oHandler = $obj->Get("HandlerAction")->SpawnInstance_();
    $oHandler->Name = "php";
    $oHandler->Path = "*.php";
    $oHandler->Verb = "GET,HEAD,POST,DEBUG";
    $oHandler->ScriptProcessor = "\"{$exec}\"";
    $oHandler->ResourceType = 0;
    $oHandler->Modules = "CgiModule";
    $oHandler->PreCondition = "*";
    $handle = $iiso->lxcom_getSection("HandlersSection");
    $handle->Add("Handlers", $oHandler);
    $handle->Refresh_();
    //$newmap = lx_array_merge(array($ScriptMaps, $list));
    dprint("\n");
    foreach ($handle->Handlers as $h) {
        dprint("{$h->Name} {$h->Path} {$h->PreCondition} {$h->Verb} {$h->Modules} type: {$h->Type} rtype: {$h->ResourceType} \n");
    }
}
Exemple #2
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");
 }