| <?php |
| /******************************************************************************* |
| * Copyright (c) 2010, 2013 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Bjorn Freeman-Benson (Eclipse Foundation)- initial API and implementation |
| * Wayne Beaton (Eclipse Foundation)- Bug 240688, 418761 |
| *******************************************************************************/ |
| |
| /* 221934 - this page to remain on eclipse.org */ |
| |
| 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"); |
| require_once(dirname(__FILE__) . "/classes/common.php"); |
| |
| $App = new App(); |
| |
| /* |
| * WTB: Define some functions in a particular way depending on mode so that we |
| * don't have to keep checking the "debug" flag. |
| */ |
| if (!$App->devmode) { |
| function connect() { |
| } |
| |
| function execute($sql) { |
| global $App; |
| |
| $App->portal_sql($sql); |
| } |
| |
| function send_mail($CEMailDest, $CEMailSubject, $cmailstr, $EMailHeaders) { |
| mail($CEMailDest, $CEMailSubject, $cmailstr, $EMailHeaders); |
| } |
| } else { |
| // TODO Pull the style out of the tags. |
| function connect() { |
| echo "<div style=\"border-style:solid;border-width:1px\">Running in <em>DEBUG</em> mode. Nothing is written to the database.</div>"; |
| } |
| |
| function execute($sql) { |
| echo "<div style=\"border-style:solid;border-width:1px\">$sql</div>"; |
| return false; |
| } |
| |
| function send_mail($CEMailDest, $CEMailSubject, $cmailstr, $EMailHeaders) { |
| $content = str_replace("\n", "<br/>", $cmailstr); |
| echo "<div style=\"border-style:solid;border-width:1px\">The following email was <em>NOT</em> sent since we are in debug mode. |
| <p>Destination: $CEMailDest<br/> |
| Subject: $CEMailSubject<br/> |
| Headers: $EMailHeaders<p/> |
| <blockquote>$content</blockquote> |
| </div>"; |
| } |
| } |
| |
| $App = new App(); |
| $Nav = new Nav(); |
| $Menu = new Menu(); |
| |
| if($_POST['math'] != "2") { |
| ob_end_clean(); |
| echo "<font color='red'>The answer to the mathematical question you entered is not valid. Please go back and try again.</font>"; |
| end_early(); |
| } |
| |
| include($App->getProjectCommon()); |
| |
| $pageTitle = "New Project Provisioning Request Result"; |
| $pageKeywords = "projects"; |
| $pageAuthor = "Bjorn Freeman-Benson Jan 2006"; |
| |
| connect(); |
| |
| function end_early() { |
| global $App; |
| ?> |
| <?php |
| # Paste your HTML content between the EOHTML markers! |
| $html = ob_get_contents(); |
| ob_end_clean(); |
| |
| # Generate the web page |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| exit(1); |
| } |
| |
| function mysql_error_check($msg) { |
| if(mysql_errno() != 0) { |
| ob_end_clean(); |
| echo "<font color='red'>$msg</font>"; |
| return true; |
| } |
| return false; |
| } |
| |
| function person_exists_in_portal_record($email, $projectid) { |
| global $dbh; |
| |
| // WTB: Protect against SQL injection |
| global $App; |
| $email = $App->sqlSanitize($email); |
| $projectid = $App->sqlSanitize($projectid); |
| |
| $sql = "SELECT count(1) AS found |
| FROM committer_votes |
| WHERE candidateemail = '$email' |
| AND projectid = '$projectid'"; |
| |
| $result = execute($sql); |
| if (!$result) return false; |
| |
| $row = mysql_fetch_assoc($result); |
| return $row['found']; |
| |
| } |
| |
| function notify_portal_about_committer($number) { |
| global $dbh; |
| |
| $email = strtolower(addslashes($_POST["committerEmail".$number])); |
| // try very hard to get it right in case javascript validation fails |
| // this eventually gets referenced against the Foundation DB so it should be right |
| $projectid = strtolower(addslashes($_POST['yourProject'])); |
| if(!is_valid_project_name($projectid)) { |
| $projectid = strtolower($_POST['yourProject']); |
| $projectid = str_replace(' ', '', $projectid); |
| $projectid = str_replace('_', '-', $projectid); |
| } |
| |
| // Make sure we only make one record even if the form is re-submitted |
| if(!person_exists_in_portal_record($email, $projectid)) { |
| $name = ucwords(strtolower(addslashes($_POST["committerName".$number]))); |
| $parentproj = get_project_parent_id($projectid); |
| $cvspkgs = strtolower(addslashes($_POST['committerPackages'.$number])); |
| |
| // WTB: Protect against SQL injection |
| global $App; |
| $parentproj = $App->sqlSanitize($parentproj); |
| $projectid = $App->sqlSanitize($projectid); |
| $name = $App->sqlSanitize($name); |
| $email = $App->sqlSanitize($email); |
| $cvspkgs = $App->sqlSanitize($cvspkgs); |
| |
| $sql = "INSERT INTO committer_votes " . |
| "(nominator, status, topid, projectid, candidate, candidateemail, cvspkgs, startdate, enddate) " . |
| "VALUES('NPPR_FORM','need_candidate_paperwork'," . |
| "'$parentproj'," . |
| "'$projectid'," . |
| "'$name'," . |
| "'$email'," . |
| "'$cvspkgs', |
| now(), |
| now())"; |
| |
| execute($sql); |
| } |
| } |
| |
| ob_start(); |
| ?> |
| <div id="maincontent"> |
| <div id="midcolumn"> |
| <h1><?= $pageTitle ?></h1> |
| |
| <?php |
| $EMailHeaders = "From: \"Eclipse WebMaster (Automated)\"<webmaster@eclipse.org>\n"; |
| $EMailHeaders .= "X-Mailer: Eclipse.org automailer process\n"; |
| |
| function mail_string($committer_number){ |
| $committer_name = "committerName" . $committer_number; |
| $committer_email = "committerEmail" . $committer_number; |
| $committer_website = "committerWebsite" . $committer_number; |
| $committer_packages = "committerPackages" . $committer_number; |
| $committer_lead = "committerLead" . $committer_number; |
| $committer_download = "committerDownloadPrivileges" . $committer_number; |
| |
| $tmp_str = " |
| Name: " . $_POST[$committer_name] . " |
| Email: " . $_POST[$committer_email] . " |
| "; |
| if ($_POST[$committer_lead] != ""){ |
| $tmp_str .= "Project Lead: " . $_POST[$committer_lead] . " |
| "; |
| } |
| if ($_POST[$committer_website] != ""){ |
| $tmp_str .= "Website: " . $_POST[$committer_website] . " |
| "; |
| } |
| if ($_POST[$committer_download] != ""){ |
| $tmp_str .= "Download: " . $_POST[$committer_download] . " |
| "; |
| } |
| $tmp_str .= "Packages: " . $_POST[$committer_packages] . " |
| "; |
| |
| return $tmp_str; |
| } |
| |
| function mail_committers($committer_number){ |
| global $EMailHeaders; |
| $committer_name = "committerName" . $committer_number; |
| $committer_email = "committerEmail" . $committer_number; |
| $committer_packages = "committerPackages" . $committer_number; |
| $committer_website = "committerWebsite" . $committer_number; |
| |
| $cmailstr = " |
| Dear " . $_POST[$committer_name] . ", |
| |
| You have been nominated as a committer on the {$_POST['yourProject']} |
| Eclipse Project. Before we can grant you access, we need some |
| documentation from you. |
| |
| 1. If you have not already done so, create an |
| Eclipse Foundation account for yourself using this |
| email address: " . $_POST[$committer_email] . " |
| |
| https://accounts.eclipse.org/ |
| |
| If you do not use this email address, your commit |
| permissions will not be set correctly. |
| |
| If you already have an Eclipse Foundation Account with |
| a different email address, please contact webmaster@eclipse.org. |
| |
| 2. Login to the \"Developer Portal\" using your Eclipse Foundation |
| account and complete the \"Committer Questionnaire\" there. |
| |
| http://portal.eclipse.org |
| |
| Following that, you may be required to complete and send |
| a paper agreement. |
| |
| If you work for a member company that has provided the |
| Eclipse Foundation with a Member Committer Agreement, then |
| no further paperwork is required. |
| |
| Otherwise, you will need to send a signed copy of the |
| Individual Committer Agreement to emo-records@eclipse.org |
| |
| http://eclip.se/1v |
| |
| Your committer account cannot be processed until this |
| agreement is received. |
| |
| If you are currently an Eclipse committer, you need not do anything at |
| this time. If further paperwork is required to cover these subsequent |
| rights, you will be contacted shortly. |
| |
| Contact emo@eclipse.org if you have any questions regarding |
| this process. |
| |
| Thank you. |
| |
| ------------------------------------------------- |
| |
| New Committer Request |
| |
| New Committer Info: |
| =================== |
| initial project creation |
| |
| Name: " . $_POST[$committer_name] . " |
| Project: " . $_POST['yourProject'] . " |
| Email: " . $_POST[$committer_email] . " |
| |
| "; |
| $CEMailDest = "emo-records@eclipse.org"; |
| if ($_POST[$committer_email] != ""){ |
| $CEMailDest .= "," . $_POST[$committer_email]; |
| } |
| $CEMailSubject = $_POST[$committer_name] . " - New Committer Request Form"; |
| send_mail($CEMailDest, $CEMailSubject, $cmailstr, $EMailHeaders); |
| } |
| |
| function committers(){ |
| for($i=1;$i<=50;$i++){ |
| $committer_name = "committerName".$i; |
| if ($_POST[$committer_name] != ""){ |
| $tmp_str .= mail_string($i); |
| mail_committers($i); |
| notify_portal_about_committer($i); |
| }else |
| if (($_POST[$committer_name] == "") && ($i == 1)){ |
| $tmp_str .= "* ERROR: No committers listed * |
| "; |
| } |
| } |
| |
| return $tmp_str; |
| } |
| |
| function mailing_lists(){ |
| for($i=1;$i<=5;$i++){ |
| $mailing_list = "mailingList".$i; |
| $short_description = "shortDescription".$i; |
| |
| if ($_POST[$mailing_list] != ""){ |
| $tmp_str .= " |
| Name: " . $_POST[$mailing_list] . " |
| Short Description: " . $_POST[$short_description] . " |
| "; |
| }else |
| if (($_POST[$mailing_list] == "") && ($i == 1)){ |
| $tmp_str .= "* ERROR: No mailing lists specified * |
| "; |
| } |
| } |
| |
| return $tmp_str; |
| } |
| |
| function components(){ |
| for($i=1;$i<=6;$i++){ |
| $component = "component".$i; |
| $component_description = "componentDescription".$i; |
| $component_owner = "componentOwner".$i; |
| |
| if ($_POST[$component] != ""){ |
| $tmp_str .= " |
| Name: " . $_POST[$component] . " |
| Description: " . $_POST[$component_description] . " |
| Owner: " . $_POST[$component_owner] . " |
| "; |
| }else |
| if (($_POST[$component] == "") && ($i == 1)){ |
| $tmp_str .= "* ERROR: No Bugzilla components specified * |
| "; |
| } |
| } |
| |
| return $tmp_str; |
| } |
| |
| ############# |
| # Main Code # |
| ############# |
| |
| $EMailDest = "webmaster@eclipse.org,emo-records@eclipse.org"; |
| $EMailSubject = "New Project Validation Phase Provisioning Request Form"; |
| |
| $_STATE = $_POST['state']; |
| |
| if ($_STATE == "submit"){ |
| if( $_POST['yourName'] == "" ) { |
| echo "The form was blank. Please go back and try again."; |
| } else { |
| ob_start(); |
| echo " |
| Thank you for submitting this form. You have submitted the following. |
| There are TODO items in this email for: |
| 1. the webmaster |
| 2. EMO legal |
| 3. EMO process |
| 4. You, the submitter |
| Note that your project will not be completely provisioned until you |
| have finished your to do items. |
| "; |
| |
| $mailStr = " |
| New Project Validation Phase Provisioning Request |
| |
| Name: " . $_POST['yourName'] . " |
| Email: " . $_POST['yourEmail'] . " |
| Phone: " . $_POST['yourPhone'] . " |
| Process: " . $_POST['yourDevelopmentProcess'] . " |
| |
| New Project: " . $_POST['yourProject'] . " |
| |
| _____ Committers _____ |
| 1. This is the list of committers. They will be provisioned with |
| UNIX accounts after they have filled out the online and paper |
| forms and agreements. |
| 2. [webmaster] Use this list to create the unix groups. |
| 3. [EMO legal] Use this list to mark project leads. |
| "; |
| |
| $mailStr .= committers(); |
| |
| $mailStr .= " |
| _____ Initial SCM Components _____ |
| [Repository Type: " . $_POST['source_code_repository'] . "] |
| "; |
| |
| if ($_POST['source_code_repository'] == 'GitHub') { |
| if (!$github = trim($_POST['github_repositories'])) |
| $github = 'None specified'; |
| |
| $mailStr .= " |
| Existing repository locations: |
| $github |
| "; |
| } |
| |
| $mailStr .= " |
| 1. [webmaster] Create the repository. |
| 2. [webmaster] Grant access to all project committers. |
| "; |
| |
| #################### |
| # Project Websites # |
| #################### |
| |
| $mailStr .= " |
| _____ Project Database ______ |
| 1. [EMO process] Set the proposal database to 'creation review successful' |
| 2. [EMO process] Create the project entry in the Foundation database |
| |
| _____ Project Website ______ |
| 1. [webmaster] Create the website repository. |
| 2. [webmaster] Create the initial \"intentionally blank\" default index.php file in that component. |
| 3. [webmaster] Create the www.eclipse.org/[shortname] directory |
| 4. [webmaster] Set up the auto-update mechanism from the repository to the www.eclipse.org directory |
| 5. [webmaster] Grant access for the website to all project committers. |
| "; |
| |
| ############# |
| # Downloads # |
| ############# |
| |
| $mailStr .= " |
| _____ Downloads ______ |
| 1. [webmaster] Create a downloads area. |
| 2. [webmaster] Grant access to all project committers."; |
| |
| ################# |
| # Mailing Lists # |
| ################# |
| |
| $mailStr .= " |
| _____ Newsgroups ____ |
| 1. [webmaster] If the project-specific newsgroup has not been |
| created, please do so now. |
| |
| _____ Mailing Lists _____ |
| 1. [webmaster] Create these mailing lists."; |
| |
| $mailStr .= mailing_lists(); |
| |
| ####################### |
| # Bugzilla Components # |
| ####################### |
| |
| $mailStr .= " |
| _____ Bugzilla Components _____ |
| 1. [webmaster] Create these bugzilla components."; |
| |
| |
| $mailStr .= components(); |
| |
| $mailStr .= " |
| _____ Project Status Information _____ |
| 1. [" . $_POST['yourName'] . "] After the project website is provisioned, |
| configure the project data in the Eclipse Developer Portal. See |
| http://www.eclipse.org/projects/dev_process/project-status-infrastructure.php |
| These files are used to surface the newsgroups, mailing lists, and other |
| information on the eclipse.org website. |
| 2. [webmaster] Update the project's Archived/Active status in the Foundation Database records. |
| "; |
| |
| $EMailSubject = $EMailSubject . " (" . $_POST['yourProject'] . ")"; |
| |
| if ($_POST['yourEmail'] != ""){ |
| $EMailDest .= "," . $_POST['yourEmail']; |
| } |
| |
| send_mail($EMailDest, $EMailSubject, $mailStr, $EMailHeaders); |
| |
| echo "<pre> |
| " . $mailStr . " |
| </pre> |
| "; |
| ob_end_flush(); |
| } |
| } |
| |
| ?> |
| </div></div> |
| <?php |
| # Paste your HTML content between the EOHTML markers! |
| $html = ob_get_contents(); |
| ob_end_clean(); |
| |
| # Generate the web page |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); |
| ?> |