blob: 9c63dcb5dfd405d37c4d4d90d463ba84122f4ad1 [file] [log] [blame]
<?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($App->getProjectCommon()); # All on the same line to unclutter the user's desktop'
#*****************************************************************************
#
# template.php
#
# Author: Denis Roy
# Date: 2005-06-16
#
# Description: Type your page comments here - these are not sent to the browser
#
#
#****************************************************************************
#
# Begin: page-specific settings. Change these.
$pageTitle = "Eclipse Community Section Submit News";
$pageKeywords = "Submit News Community";
$pageAuthor = "Nathan Gervais";
# Add page-specific Nav bars here
# Format is Link text, link URL (can be http://www.someothersite.com/), target (_self, _blank), level (1, 2 or 3)
# $Nav->addNavSeparator("My Page Links", "downloads.php");
# $Nav->addCustomNav("My Link", "mypage.php", "_self", 1);
# $Nav->addCustomNav("Google", "http://www.google.com/", "_blank", 1);
# End: page-specific settings
#
# Paste your HTML content between the EOHTML markers!
if ($_POST['submit'])
{
$from = $_POST['from'];
$title = $_POST['title'];
$link = $_POST['link'];
$content = $_POST['content'];
$date = date('D, d M Y H:i:s \E\S\T');
$answer = $_POST['answer'];
$guess = $_POST['guess'];
ob_start();
if ($answer == md5($guess))
{
$header = "Return-Path: phoenix@eclipse.org\n";
$header .= "X-Sender: phoenix@eclipse.org\n";
$header .= "From: phoenix@eclipse.org\n";
$header .= "X-Mailer:PHP 4.3.4\n";
$header .= "MIME-Version: 1.0\n";
$rssFeedOutput = "<item>\r\n<title><![CDATA[$title]]></title>\r\n<link><![CDATA[$link]]></link>\r\n<description><![CDATA[$content]]></description>\r\n<pubDate>$date</pubDate>\r\n</item>\r\n\r\nSubmitted By $from";
$to = "news@eclipse.org";
$from = "phoenix@eclipse.org";
$subject = "community news submission";
ini_set("sendmail_from", $from);
ini_set("SMTP", "foundationhq.eclipse.org");
mail($to, $subject,$rssFeedOutput, $header);
ini_restore("sendmail_from");
?>
<center>
<p>Thank your for submitting news!</p>
<p><a href="index.php">Go back to the Community page</a></p>
</center>
<?
}
else
{
?>
<center>
<p>The answer you have provided to the mathematical question is incorrect</p>
<p><a href="submitnews.php">Try again</a></p>
</center>
<?
}
$html = ob_get_contents();
ob_end_clean();
}
else
{
$val1 = rand(0, 20);
$val2 = rand(15, 45);
$answer = $val1 + $val2;
$answer = md5($answer);
ob_start();
?>
<script language="javascript">
function form_validate()
{
var retval=true;
if (document.getElementById("from").value == "" || document.getElementById("from").value == " ")
{
document.getElementById("from").style.background = "#FFDDDD";
document.getElementById("from").style.color = "#000000";
retval = false;
}
else{
document.getElementById("from").style.background = "#FFFFFF";
document.getElementById("from").style.color = "#000000";
}
if (document.getElementById("title").value == "" || document.getElementById("title").value == " ")
{
document.getElementById("title").style.background = "#FFDDDD";
document.getElementById("title").style.color = "#000000";
retval = false;
}
else{
document.getElementById("title").style.background = "#FFFFFF";
document.getElementById("title").style.color = "#000000";
}
if (document.getElementById("link").value == "" || document.getElementById("link").value == " ")
{
document.getElementById("link").style.background = "#FFDDDD";
document.getElementById("link").style.color = "#000000";
retval = false;
}
else{
document.getElementById("link").style.background = "#FFFFFF";
document.getElementById("link").style.color = "#000000";
}
if (document.getElementById("content").value == "" || document.getElementById("content").value == " ")
{
document.getElementById("content").style.background = "#FFDDDD";
document.getElementById("content").style.color = "#000000";
retval = false;
}
else{
document.getElementById("content").style.background = "#FFFFFF";
document.getElementById("content").style.color = "#000000";
}
return retval;
}
</script>
<div id="midcolumn">
<h1><?=$pageTitle;?></h1>
<div class="homeitem3col">
<h3>Submit News</h3>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post" style="display:inline;" onSubmit="return form_validate();">
<table>
<tr>
<td colspan=2>
Got a new plugin or RCP app you want us to know about? Have some interesting Eclipse Related news? Fill out the form below and send it to us!<br/><br/>
</td>
</tr>
<tr>
<td valign="top">Your Email:</td>
<td><input type="text" name="from" size="40"></td>
</tr>
<tr>
<td valign="top">Title:</td>
<td><input type="text" name="title" size="40"></td>
</tr>
<tr>
<td valign="top">Link:</td>
<td><input type="text" name="link" size="40"></td>
</tr>
<tr>
<td valign="top">Content:</td>
<td><textarea name="content" rows="6" cols="40"></textarea></td>
</tr>
<tr>
<td><?=$val1;?> + <?=$val2;?> = </td>
<td><input type="hidden" name="answer" value="<?=$answer;?>"><input type="text" name="guess" size="40"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
</form>
</div>
</div>
<?
$html = ob_get_contents();
ob_end_clean();
}
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>