Location: PHPKode > projects > ProjectPress > projectpress/projects/forum/add_ptopic.php
<?php 
/**
 * ProjectPress project reply forum topic
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(dirname(dirname(__FILE__))) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');

if($current_user->hasPermission('access_site') != true) { pm_redirect(PM_URI . '/index.php'); }

// Enable for error checking and troubleshooting.
# display_errors();

if($_POST) {
$pft_topic = pmdb::connect()->escape($_POST['pft_topic']);
$pft_detail = pmdb::connect()->escape($_POST['pft_detail']);

pmdb::connect()->query("INSERT INTO " . DB . "project_forum_topics(pt_id, pft_topic, pft_detail, pft_user, pft_datetime)VALUES('".$_GET['p_id']."', '$pft_topic', '$pft_detail', '".$_SESSION['username']."', NOW())");

}

?>

<script type="text/javascript">
$(function() {
$(".newptopic").click(function() {
var pft_topic = $("#pft_topic").val();
var pft_detail = $("#pft_detail").val();
var dataString = 'pft_topic='+ pft_topic + '&pft_detail=' + pft_detail;

if(pft_topic=='' || pft_detail=='')
{
$('.success').fadeOut(200).hide();
$('.error').fadeOut(200).show();
}
else
{
$.ajax({
type: "POST",
url: "add_ptopic.php?p_id=<?php _e($_GET['p_id']); ?>",
data: dataString,
success: function(){
$('.success').fadeIn(200).show();
$('.error').fadeOut(200).hide();
$('#pft_topic').val('');
$('#pft_detail').val('');
}
});
}
return false;
});
});
</script>


				<div id="page-title">
					<img src="<?php _e(PM_URI); ?>/images/comment.png" alt="" /><h1>Group Forum</h1>
				</div>
				
				<div id="tabs">
					<ul>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "project.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/project.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Project</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "discussions.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>
							<?php if (basename($_SERVER["REQUEST_URI"]) == "add_ptopic.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/forum/discussions.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Forum</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "contact.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/contact.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Email</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "project_members.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/project_members.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Members</span></a>
						</li>
					</ul>
				</div>
				
<div class="success" style="display:none">Your topic has been added. <a href="<?php _e(PM_URI); ?>/projects/forum/discussions.php?p_id=<?php echo $_GET['p_id']; ?>">Click here</a> to go back to the main project forum.</div>
<div class="error" style="display:none">Sorry, but you cannot submit blank fields.</div>


<div id="middle">
<a href="<?php echo PM_URI ?>/projects/forum/discussions.php?p_id=<?php echo $_GET['p_id']; ?>">Go Back Project Forum Homepage</a><br /><br />
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="">
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#E6E6E6"><strong>Create New Topic</strong></td>
</tr>
<tr>
<td vAlign="top"><strong>Topic:</strong><br />
<input class="forminput" name="pft_topic" type="text" id="pft_topic" size="50" style="width:500px;" /></td>
</tr>
<tr>
<td vAlign="top"><strong>Detail:</strong><br />
<textarea class="forminput" name="pft_detail" cols="52" rows="15" id="pft_detail" style="width:500px;"></textarea></td>
</tr>
<tr>
<td><br />
<input id="sub_button" class="newptopic" type="submit" name="Submit" value="Submit" /> <input id="sub_button" type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</div>


<?php

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress