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"); } }
function setCustomError() { $iis = new lxCOM("IIS://localhost/W3SVC/{$this->main->iisid}"); print $this->main->iisid; // print($iis); $err = array("400", "401", "403", "404", "500"); $objlist = $iis->Get('HttpErrors'); $cm = $this->main->customerror_b; foreach ($objlist as $o) { $arr[] = "{$o}"; } foreach ($err as $e) { $v = "url_{$e}"; $match = false; foreach ($arr as &$_a) { if (preg_match("/{$e},([^,]*),/i", $_a, &$match)) { if ($cm->{$v}) { $_a = "{$e},{$match[1]},URL,{$cm->{$v}}"; } $match = true; } } if (!$match && $cm->{$v}) { $v = "url_{$e}"; $arr[] = "{$e},*,URL,{$cm->{$v}}"; } } dprintr($arr); //$iis->Put("HttpErrors", $arr); $iis->setInfo(); }
function createARecord($strDomain, $host, $strIPAddress) { $strContainer = $strDomain; if ($host === "__base__") { $strOwner = $strDomain; } else { $strOwner = "{$host}.{$strDomain}"; } $intRecordClass = 1; // $intTTL = 600; $intTTL = $this->main->ttl; $objWMIService = new lxCOM("winmgmts://./root/MicrosoftDNS"); $colItems = $objWMIService->ExecQuery("Select * from MicrosoftDNS_AType where ownername='{$strOwner}'"); if (mycount($colItems) > 0) { print "Already Exists/n"; throw new lxException("a_rec_already_exist", ''); } $objItem = $objWMIService->Get("MicrosoftDNS_AType"); $objServer = $objWMIService->Get("MicrosoftDNS_Server.name='.'"); print $strContainer; $objItem->CreateInstanceFromPropertyData(".", $strContainer, $strOwner, $intRecordClass, $intTTL, $strIPAddress); dprint("UPdateing zone files/n"); }