| <?php require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include("_projectCommon.php"); # All on the same line to unclutter the user's desktop' |
| |
| #***************************************************************************** |
| # |
| # index.php |
| # |
| # Author: Denis Roy |
| # Date: 2005-10-11 |
| # |
| # Description: display list of projects for downloads |
| # |
| #**************************************************************************** |
| |
| # |
| # Begin: page-specific settings. Change these. |
| $pageTitle = "Eclipse mirror sites"; |
| $pageKeywords = "eclipse,download,mirror"; |
| $pageAuthor = "Eclipse Foundation, Inc."; |
| |
| # Add page-specific Nav bars here |
| # Format is Link text, link URL (can be http://www.someothersite.com/), target (_self, _blank) |
| # $Nav->addCustomNav("My Link", "mypage.php", "_self"); |
| # $Nav->addCustomNav("Google", "http://www.google.com/", "_blank"); |
| |
| # End: page-specific settings |
| # |
| |
| require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_rw.class.php"; |
| require_once("classes/mirror.class.php"); |
| |
| $_status = $App->getHTTPParameter('status'); |
| |
| $error = 0; |
| |
| if($_status == "") { |
| $_status = "new"; |
| } |
| |
| $dbc = new DBConnectionRW(); |
| $dbh = $dbc->connect(); |
| |
| $App = new App(); |
| $Mirror = new Mirror(); |
| |
| if($_status == "save") { |
| |
| $MIR_REQ = $_COOKIE['MIR_REQ']; |
| if($MIR_REQ == "") { |
| |
| $valid = true; |
| $errorfield = ""; |
| $alnumspace = "^[][a-zA-Z0-9 .'&,_-]+$"; |
| |
| # validate incoming |
| if (!eregi($alnumspace, $_POST['organization'])) { |
| $errorfield .= " Organization"; |
| $valid = false; |
| } |
| if (!eregi('^[a-zA-Z]{2}$', $_POST['ccode'])) { |
| $errorfield .= " Country"; |
| $valid = false; |
| } |
| if (!eregi($alnumspace, $_POST['contact'])) { |
| $errorfield .= " Contact"; |
| $valid = false; |
| } |
| |
| if (!eregi("^(http|https):\/\/", $_POST['http_browserlink']) && $_POST['http_browserlink'] != "") { |
| $errorfield .= " HTTP URL"; |
| $valid = false; |
| } |
| if (!eregi("^ftp:\/\/", $_POST['ftp_browserlink']) && $_POST['ftp_browserlink'] != "") { |
| $errorfield .= " FTP URL"; |
| $valid = false; |
| } |
| if (!eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z.]{2,5}$', $_POST['email'])) { |
| $errorfield .= " E-mail address"; |
| $valid = false; |
| } |
| |
| if(!$Mirror->isValidPublicIP($_POST['update_ip_allow'])) { |
| $errorfield = " IP Address"; |
| $valid = false; |
| } |
| |
| |
| if($valid) { |
| $sql = " |
| INSERT INTO mirrors ( |
| organization, |
| ccode, |
| update_ip_allow, |
| email, |
| date_enabled, |
| create_status, |
| contact) |
| VALUES ( |
| " . $App->returnQuotedString($_POST['organization']) . ", |
| " . $App->returnQuotedString($_POST['ccode']) . ", |
| " . $App->returnQuotedString($_POST['update_ip_allow']) . ", |
| " . $App->returnQuotedString($_POST['email']) . ", |
| NOW(), |
| " . $App->returnQuotedString("approve") . ", |
| " . $App->returnQuotedString($_POST['contact']) . ") |
| "; |
| mysql_query($sql, $dbh); |
| $mirror_id = mysql_insert_id(); |
| |
| # add protocols. |
| if($_POST["http_browserlink"] != "") { |
| $sql = " |
| INSERT INTO mirror_protocols ( |
| mirror_id, |
| protocol, |
| base_path) |
| VALUES ( |
| " . $mirror_id . ", |
| " . $App->returnQuotedString("http") . ", |
| " . $App->returnQuotedString($_POST['http_browserlink']) . ") |
| "; |
| mysql_query($sql, $dbh); |
| |
| $drop_list = $_POST["drop_id"]; |
| foreach (split(",", $drop_list) as $drop) { |
| $sql = " |
| INSERT INTO mirror_drops ( |
| mirror_id, |
| drop_id, |
| protocol) |
| VALUES ( |
| " . $mirror_id . ", |
| " . $App->returnQuotedString($drop) . ", |
| " . $App->returnQuotedString("http") . ")"; |
| |
| mysql_query($sql,$dbh); |
| } |
| } |
| |
| if($_POST["ftp_browserlink"] != "") { |
| $sql = " |
| INSERT INTO mirror_protocols ( |
| mirror_id, |
| protocol, |
| base_path) |
| VALUES ( |
| " . $mirror_id . ", |
| " . $App->returnQuotedString("ftp") . ", |
| " . $App->returnQuotedString($_POST['ftp_browserlink']) . ") |
| "; |
| mysql_query($sql, $dbh); |
| |
| $drop_list = $_POST["drop_id"]; |
| foreach (split(",", $drop_list) as $drop) { |
| $sql = " |
| INSERT INTO mirror_drops ( |
| mirror_id, |
| drop_id, |
| protocol) |
| VALUES ( |
| " . $mirror_id . ", |
| " . $App->returnQuotedString($drop) . ", |
| " . $App->returnQuotedString("ftp") . ")"; |
| |
| mysql_query($sql,$dbh); |
| } |
| } |
| |
| # Place cookie on browser to avoid having multiple submissions |
| setcookie("MIR_REQ", "1"); |
| } |
| else { |
| $error = 2; |
| } |
| } |
| else { |
| $error = 1; |
| } |
| } |
| else { |
| $sql = "SELECT |
| DRP.drop_id, |
| DRP.project_id, |
| DRP.description, |
| IFNULL(( |
| SELECT |
| disk_space |
| FROM project_disk_space_usage AS DSK |
| WHERE DSK.project_id = DRP.project_id AND DSK.is_quota=1 |
| ) |
| ,DRP.size) AS size, |
| DRP.size_unit, |
| DRP.is_default_selection, |
| PRJ.level, |
| PRJ.sort_order |
| FROM drops AS DRP |
| LEFT JOIN projects as PRJ ON PRJ.project_id = DRP.project_ID |
| ORDER BY DRP.sort_order |
| "; |
| |
| $rs = mysql_query($sql, $dbh); |
| |
| $sql = "SELECT |
| ccode, |
| en_description |
| FROM SYS_countries |
| ORDER BY en_description |
| "; |
| |
| $rs_country = mysql_query($sql, $dbh); |
| } |
| |
| |
| # Place your html content in a file called content/en_pagename.php |
| include("content/en_" . $App->getScriptName()); |
| |
| $dbc->disconnect(); |
| $dbc = null; |
| |
| # Generate the web page |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| ?> |
| |