<?php

/**
 * DHC: batw forum: based on:
 * -----------------------------------------------------------
 * Copyright (C) 2008-2012 FluxBB
 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
 */

/*********************************************************************************
	categories table:
+----+------------------------+---------------+
| id | cat_name               | disp_position |
+----+------------------------+---------------+
|  4 | Bonds Across the Water |             3 |
+----+------------------------+---------------+

	forums table:
+----+----------------------------------------+--------+
| id | forum_name                             | cat_id |
+----+----------------------------------------+--------+
| 20 | Student Discussion                     |      4 |
+----+----------------------------------------+--------+
*********************************************************************************/

define('applied',1);
define('IN_BATW',1);
define('PUN_ROOT', dirname(__FILE__).'/');
require PUN_ROOT.'include/common.php';

if ($pun_user['g_read_board'] == '0')
	message($lang_common['No view'], false, '403 Forbidden');

// Load the index.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';

//DHC: remove bnew posts info
// Get list of forums and topics with new posts since last visit

if ($pun_config['o_feed_type'] == '1')
	$page_head = array('feed' => '<link rel="alternate" type="application/rss+xml" href="extern.php?action=feed&amp;type=rss" title="'.$lang_common['RSS active topics feed'].'" />');
else if ($pun_config['o_feed_type'] == '2')
	$page_head = array('feed' => '<link rel="alternate" type="application/atom+xml" href="extern.php?action=feed&amp;type=atom" title="'.$lang_common['Atom active topics feed'].'" />');

//DHC: remove mark as read (['Mark all as read'])

//DHC: set required fields for immediate post form
$required_fields = array('req_message' => $lang_common['Message'], 'req_subject' => $lang_common['Subject'], 'fid' => $lang_common['Forum']);

$page_title = 'Bonds Across the Water Forum';//also in viewtopic!
define('PUN_ALLOW_INDEX', 1);
define('PUN_ACTIVE_PAGE', 'batw');
require PUN_ROOT.'header.php';

$recents_div = recentsDiv('batw',0);	// may die on bad input (post_count)

$quickpost = false;
if ($pun_config['o_quickpost'] == '1' && !$pun_user['is_guest']) { $quickpost = true; }
if (!$quickpost) {
	echo must_login_div();
} else {
	//--------------------------------------- immediate post form ---------------------------------------
//BATW: input hidden fid=BATW_FORUM added

$bb_links = get_bblinks();
echo <<<INDEX_POST
			<div id="cz_qpost_div" style="margin:10px 20px">
				<div id="cz_post_div">
					<div id="cz_quickpost" class="clickable">{$lang_cz['Share thoughts']}</div>
					<div id="cz_index_post">
						<form id="cz_qpost_form" method="post" action="post.php" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
							<div class="inform">
								<fieldset>
									<legend>Write your message and submit</legend>
									<div class="infldset">
										<input type="hidden" name="form_sent" value="1">
										<input type="hidden" name="batw" value="1">
										<label class="required">
											<div>{$lang_common['Subject']} <span>{$lang_common['Required']}</span></div>
											<input class="longinput" type="text" name="req_subject" value="" maxlength="70" tabindex="1">
										</label>
										<label class="required">
											<div>{$lang_common['Message']} <span>{$lang_common['Required']}</span></div>
											<textarea name="req_message" tabindex="2"></textarea>
										</label>
$bb_links
									</div>
								</fieldset>
							</div>
							<p class="buttons">
								<input type="submit" name="submit" value="Submit" tabindex="5" accesskey="s">&nbsp;
								<a class="cz_btnBack" href="javascript:history.go(-1)">Go back</a>
							</p>
						</form>
					</div>
				</div>
			</div>
INDEX_POST;
}

echo $recents_div;

$footer_style = 'batw';
require PUN_ROOT.'footer.php';
