masterUrl = $masterUrl; } function detectMyUrl() { return 'http://' . ($_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']) . dirname($_SERVER['PHP_SELF']) . '/'; } function sendRequest($myUrl, $scheme, $redirect, $task, $keywords_per_page, $useModRewrite, $phpFilename, $mapLpp, $mapFilename, $mapTpl, $cmt) { global $useCurl; //global $scheme, $redirect, $task, $keywords_per_page; $reqUrl = $this->masterUrl . 'request.php'; $post = Array( 'scheme' => $scheme, 'url' => $myUrl, 'task' => $task, 'redirect' => $redirect, 'kwpp' => $keywords_per_page, 'use_mod_rewrite' => ($useModRewrite ? 1 : 0), 'php_filename' => $phpFilename, 'map_lpp' => $mapLpp, 'map_filename' => $mapFilename, 'map_tpl' => $mapTpl, 'cmt' => $cmt ); $req = new HttpRequest($useCurl ? 0 : 1); $res = $req->request($reqUrl, $post); if ($req->httpStatus < 200 || $req->httpStatus >= 300) { $res = "FAILED TO CONNECT TO MASTER SERVER: {$req->httpStatus}"; }; return $res; } }; print << Request Generation EOM; $req = new TaskRequest(); if ($_REQUEST['req'] == 'send_req') { if (get_magic_quotes_gpc()) { $_REQUEST = array_map('stripslashes', $_REQUEST); }; $res = htmlspecialchars($req->sendRequest( $_REQUEST['url'], $_REQUEST['scheme'], $_REQUEST['redirect'], $_REQUEST['task'], $_REQUEST['kwpp'], $_REQUEST['use_mod_rewrite'], $_REQUEST['php_filename'], $_REQUEST['map_allow'] ? $_REQUEST['map_lpp'] : 0, $_REQUEST['map_filename'], $_REQUEST['map_tpl'], $_REQUEST['cmt'] )); $url = htmlspecialchars($_REQUEST['url']); $width = strlen($url) + 15; $parts = parse_url($_REQUEST['url']); $base = htmlspecialchars($parts['path']); $color = preg_match('/^OK:/i', $res) ? 'blue' : 'red'; print <<Your request has been sent. Here follows the response from the server:

{$res}

If you see OK message, you should set:

var \$myUrl = "{$url}"
in index.php file EOM; if ($_REQUEST['use_mod_rewrite']) print <<RewriteBase {$base} in .htaccess file

Then upload these files to FTP, and do not forget to delete generate.php from the server. EOM; else print <<Then upload index.php to FTP, and do not forget to delete generate.php from the server. EOM; print <<
EOM; } else { $pattern = '/generate\.html$/'; $modRewriteSupported = (preg_match($pattern, $_SERVER['REQUEST_URI']) || preg_match($pattern, $_SERVER['REDIRECT_URL'])) ? ' checked' : ''; $url = htmlspecialchars($req->detectMyUrl()); print << function allowSiteMap(allow) { ctl = document.getElementById('map_filename'); ctl.disabled = !allow; ctl = document.getElementById('map_lpp'); ctl.disabled = !allow; ctl = document.getElementById('map_tpl'); ctl.disabled = !allow; };
URL:
Scheme:
Redirect:
kwpp:
Task:
Use mod_rewrite:
Generate site map:
Links per map page:
Map page filename:
Map template file:
PHP filename:
Comments:
EOM; }; print << EOM; ?>