Example #1
0
 function syncToPort($port, $cust_log, $err_log)
 {
     global $gbl, $sgbl, $login, $ghtml;
     $base_root = "{$sgbl->__path_httpd_root}";
     $user_home = "{$this->main->getFullDocRoot()}/";
     $domname = $this->main->nname;
     $string = null;
     // issue #656 - When adding a subdomain, the Document Root field is not being validated
     // Adding quotations so that we can work with directories with spaces
     // MR -- also for other lines
     if ($this->main->isOn('force_www_redirect')) {
         $string .= "\tServerName www.{$domname}\n";
     } else {
         $string .= "\tServerName {$domname}\n";
     }
     $string .= "###serveralias###";
     $string .= "\t" . $this->getBlockIP();
     $string .= $this->getDocumentRoot('www');
     $string .= "\t" . $this->getIndexFileOrder();
     $string .= "\t" . $this->getAwstatsString();
     $string .= "\t" . $this->getSuexecString($this->main->username);
     foreach ((array) $this->main->redirect_a as $red) {
         $rednname = remove_extra_slash("/{$red->nname}");
         if ($red->ttype === 'local') {
             $string .= "\tAlias \"{$rednname}\" \"{$user_home}\"/{$red->redirect}\"\n";
         } else {
             if (!redirect_a::checkForPort($port, $red->httporssl)) {
                 continue;
             }
             $string .= "\tRedirect \"{$rednname}\" \"{$red->redirect}\"\n";
         }
     }
     if ($this->main->__var_statsprog === 'awstats') {
         $string .= "\tRedirect /stats \"http://{$domname}/awstats/awstats.pl?config={$domname}\"\n";
         $string .= "\tRedirect /stats/ \"http://{$domname}/awstats/awstats.pl?config={$domname}\"\n\n";
     } else {
         $string .= "\tAlias /stats {$base_root}/{$domname}/webstats/\n\n";
     }
     $string .= "\tAlias /__kloxo \"/home/{$this->main->customer_name}/kloxoscript/\"\n\n";
     $string .= "\tRedirect /kloxo \"https://cp.{$domname}:{$this->main->__var_sslport}\"\n";
     $string .= "\tRedirect /kloxononssl \"http://cp.{$domname}:{$this->main->__var_nonsslport}\"\n\n";
     $string .= "\tRedirect /webmail \"http://webmail.{$domname}\"\n\n";
     $string .= "\t<Directory \"/home/httpd/{$domname}/kloxoscript/\">\n";
     $string .= "\t\tAllowOverride All\n";
     $string .= "\t</Directory>\n\n";
     $string .= $this->addSendmail();
     if ($this->main->priv->isOn('cgi_flag')) {
         $string .= "\tScriptAlias /cgi-bin/ \"{$user_home}/cgi-bin/\"\n\n";
     }
     if ($port === '80') {
         $string .= "\tCustomLog \"{$cust_log}\" combined  \n";
         $string .= "\tErrorLog \"{$err_log}\"\n\n";
     }
     $string .= "\t<Directory \"{$user_home}/\">\n";
     $string .= "\t\tAllowOverride All\n";
     $string .= "\t</Directory>\n\n";
     $string .= "\t<Location />\n";
     $extrastring = null;
     if (isset($this->main->webmisc_b)) {
         if ($this->main->webmisc_b->isOn('execcgi')) {
             $extrastring .= "+ExecCgi";
         }
         if ($this->main->webmisc_b->isOn('dirindex')) {
             $extrastring .= " +Indexes";
         }
     }
     $string .= "\t\tOptions +Includes +FollowSymlinks {$extrastring}\n";
     if (isset($this->main->webmisc_b) && $this->main->webmisc_b->isOn('execcgi')) {
         $string .= "\t\tAddHandler cgi-script .cgi\n";
     }
     $string .= "\t</Location>\n\n";
     $string .= "\t<Directory \"{$base_root}/{$domname}/webstats/\">\n";
     $string .= "\t\tAllowOverride All\n";
     $string .= "\t</Directory>\n\n";
     if (isset($this->main->webindexdir_a)) {
         foreach ((array) $this->main->webindexdir_a as $webi) {
             $string .= "\t<Directory {$user_home}/{$webi->nname}>\n";
             $string .= "\t\tAllowOverride All\n";
             $string .= "\t\tOptions +Indexes\n";
             $string .= "\t</Directory>\n\n";
         }
     }
     if ($this->main->text_extra_tag) {
         $string .= "\n\n#Extra Tags\n{$this->main->text_extra_tag}\n#End Extra Tags\n\n";
     }
     if ($this->main->stats_password) {
         $string .= $this->getDirprotectCore("stats", "/stats", "__stats");
     }
     $string .= $this->getDirIndexCore("/stats");
     return $string;
 }
Example #2
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;
 }