Vergleich admin/modules/forum/announcements.php - 1.8.9 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 53Zeile 53

if($mybb->request_method == "post")
{


if($mybb->request_method == "post")
{

		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;
}

if(!trim($mybb->input['message']))
{
$errors[] = $lang->error_missing_message;
}

if(!trim($mybb->input['fid']))
{
$errors[] = $lang->error_missing_forum;
}

if(!checkdate($mybb->get_input('starttime_month', MyBB::INPUT_INT), $mybb->get_input('starttime_day', MyBB::INPUT_INT), $mybb->get_input('starttime_year', MyBB::INPUT_INT)))
{
$errors[] = $lang->error_invalid_start_date;
}

// End before startdate?
$startdate = @explode(" ", $mybb->input['starttime_time']);
$startdate = @explode(":", $startdate[0]);
$enddate = @explode(" ", $mybb->input['endtime_time']);
$enddate = @explode(":", $enddate[0]);

if(stristr($mybb->input['starttime_time'], "pm"))
{
$startdate[0] = 12+$startdate[0];
if($startdate[0] >= 24)
{
$startdate[0] = "00";
}
}

if(stristr($mybb->input['endtime_time'], "pm"))
{
$enddate[0] = 12+$enddate[0];
if($enddate[0] >= 24)
{
$enddate[0] = "00";
}
}

$startdate = gmmktime((int)$startdate[0], (int)$startdate[1], 0, $mybb->get_input('starttime_month', MyBB::INPUT_INT), $mybb->get_input('starttime_day', MyBB::INPUT_INT), $mybb->get_input('starttime_year', MyBB::INPUT_INT));

if($mybb->input['endtime_type'] != "2")
{
$enddate = gmmktime((int)$enddate[0], (int)$enddate[1], 0, $mybb->get_input('endtime_month', MyBB::INPUT_INT), $mybb->get_input('endtime_day', MyBB::INPUT_INT), $mybb->get_input('endtime_year', MyBB::INPUT_INT));
if(!checkdate($mybb->get_input('endtime_month', MyBB::INPUT_INT), $mybb->get_input('endtime_day', MyBB::INPUT_INT), $mybb->get_input('endtime_year', MyBB::INPUT_INT)))
{
$errors[] = $lang->error_invalid_end_date;
}
if($enddate <= $startdate)
{
$errors[] = $lang->error_end_before_start;
}
}

if(!$errors)
{
if(isset($mybb->input['preview']))
{
$parser_options = array();
$parser_options['allow_html'] = $mybb->get_input('allowhtml', MyBB::INPUT_INT);
$parser_options['allow_mycode'] = $mybb->get_input('allowmycode', MyBB::INPUT_INT);
$parser_options['allow_smilies'] = $mybb->get_input('allowsmilies', MyBB::INPUT_INT);
$parser_options['allow_imgcode'] = 1;
$parser_options['allow_videocode'] = 1;
$parser_options['me_username'] = htmlspecialchars_uni($mybb->user['username']);
$parser_options['filter_badwords'] = 1;

// Set up the message parser if it doesn't already exist.
if(!is_object($parser))
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
}

$preview['message'] = $parser->parse_message($mybb->input['message'], $parser_options);
$preview['subject'] = htmlspecialchars_uni($mybb->input['title']);
}
else
{
$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');



		if(!trim($mybb->get_input('title')))
{
$errors[] = $lang->error_missing_title;
}

if(!trim($mybb->get_input('message')))
{
$errors[] = $lang->error_missing_message;
}

if(!trim($mybb->get_input('fid')))
{
$errors[] = $lang->error_missing_forum;
}

if(!checkdate($mybb->get_input('starttime_month', MyBB::INPUT_INT), $mybb->get_input('starttime_day', MyBB::INPUT_INT), $mybb->get_input('starttime_year', MyBB::INPUT_INT)))
{
$errors[] = $lang->error_invalid_start_date;
}

// End before startdate?
$startdate = @explode(" ", $mybb->input['starttime_time']);
$startdate = @explode(":", $startdate[0]);
$enddate = @explode(" ", $mybb->input['endtime_time']);
$enddate = @explode(":", $enddate[0]);

if(stristr($mybb->input['starttime_time'], "pm"))
{
$startdate[0] = 12+$startdate[0];
if($startdate[0] >= 24)
{
$startdate[0] = "00";
}
}

if(stristr($mybb->input['endtime_time'], "pm"))
{
$enddate[0] = 12+$enddate[0];
if($enddate[0] >= 24)
{
$enddate[0] = "00";
}
}

$startdate = gmmktime((int)$startdate[0], (int)$startdate[1], 0, $mybb->get_input('starttime_month', MyBB::INPUT_INT), $mybb->get_input('starttime_day', MyBB::INPUT_INT), $mybb->get_input('starttime_year', MyBB::INPUT_INT));

if($mybb->input['endtime_type'] != "2")
{
$enddate = gmmktime((int)$enddate[0], (int)$enddate[1], 0, $mybb->get_input('endtime_month', MyBB::INPUT_INT), $mybb->get_input('endtime_day', MyBB::INPUT_INT), $mybb->get_input('endtime_year', MyBB::INPUT_INT));
if(!checkdate($mybb->get_input('endtime_month', MyBB::INPUT_INT), $mybb->get_input('endtime_day', MyBB::INPUT_INT), $mybb->get_input('endtime_year', MyBB::INPUT_INT)))
{
$errors[] = $lang->error_invalid_end_date;
}
if($enddate <= $startdate)
{
$errors[] = $lang->error_end_before_start;
}
}

if(!$errors)
{
if(isset($mybb->input['preview']))
{
$lang->load('global', true);

$parser_options = array();
$parser_options['allow_html'] = $mybb->settings['announcementshtml'] && $mybb->get_input('allowhtml', MyBB::INPUT_INT);
$parser_options['allow_mycode'] = $mybb->get_input('allowmycode', MyBB::INPUT_INT);
$parser_options['allow_smilies'] = $mybb->get_input('allowsmilies', MyBB::INPUT_INT);
$parser_options['allow_imgcode'] = 1;
$parser_options['allow_videocode'] = 1;
$parser_options['me_username'] = htmlspecialchars_uni($mybb->user['username']);
$parser_options['filter_badwords'] = 1;

// Set up the message parser if it doesn't already exist.
if(!isset($parser) || !is_object($parser))
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
}

$preview['message'] = $parser->parse_message($mybb->input['message'], $parser_options);
$preview['subject'] = htmlspecialchars_uni($mybb->input['title']);
}
else
{
$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');

				if(!in_array($mybb->input['starttime_month'], $months))
{
$mybb->input['starttime_month'] = 1;

				if(!in_array($mybb->input['starttime_month'], $months))
{
$mybb->input['starttime_month'] = 1;

Zeile 162Zeile 164
					"message" => $db->escape_string($mybb->input['message']),
"startdate" => $startdate,
"enddate" => $enddate,

					"message" => $db->escape_string($mybb->input['message']),
"startdate" => $startdate,
"enddate" => $enddate,

					"allowhtml" => $mybb->get_input('allowhtml', MyBB::INPUT_INT),

					"allowhtml" => (int)($mybb->settings['announcementshtml'] && $mybb->get_input('allowhtml', MyBB::INPUT_INT)),

					"allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT),
"allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT)
);

					"allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT),
"allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT)
);

Zeile 170Zeile 172
				$aid = $db->insert_query("announcements", $insert_announcement);

$plugins->run_hooks("admin_forum_announcements_add_commit");

				$aid = $db->insert_query("announcements", $insert_announcement);

$plugins->run_hooks("admin_forum_announcements_add_commit");





				// Log admin action
log_admin_action($aid, $mybb->input['title']);
$cache->update_forumsdisplay();

				// Log admin action
log_admin_action($aid, $mybb->input['title']);
$cache->update_forumsdisplay();





				flash_message($lang->success_added_announcement, 'success');
admin_redirect("index.php?module=forum-announcements");
}

				flash_message($lang->success_added_announcement, 'success');
admin_redirect("index.php?module=forum-announcements");
}

		}
}


		}
}


	$page->add_breadcrumb_item($lang->add_an_announcement);
$page->output_header($lang->add_an_announcement);
$page->output_nav_tabs($sub_tabs, "add_announcement");

	$page->add_breadcrumb_item($lang->add_an_announcement);
$page->output_header($lang->add_an_announcement);
$page->output_nav_tabs($sub_tabs, "add_announcement");

Zeile 189Zeile 191
	if($errors)
{
$page->output_inline_error($errors);

	if($errors)
{
$page->output_inline_error($errors);

	}


	}


	$default_options = array(
'starttime_time',
'starttime_day',

	$default_options = array(
'starttime_time',
'starttime_day',

Zeile 220Zeile 222
	if($mybb->input['endtime_type'] == "1")
{
$endtime_checked[1] = "checked=\"checked\"";

	if($mybb->input['endtime_type'] == "1")
{
$endtime_checked[1] = "checked=\"checked\"";

		$endtime_checked[2] = "";
}

		$endtime_checked[2] = "";
}

	else

	else

	{

	{

		$endtime_checked[1] = "";
$endtime_checked[2] = "checked=\"checked\"";
}

if(!$mybb->input['starttime_time'])

		$endtime_checked[1] = "";
$endtime_checked[2] = "checked=\"checked\"";
}

if(!$mybb->input['starttime_time'])

	{

	{

		$mybb->input['starttime_time'] = gmdate($mybb->settings['timeformat'], TIME_NOW);

		$mybb->input['starttime_time'] = gmdate($mybb->settings['timeformat'], TIME_NOW);

	}


	}


	if(!$mybb->input['endtime_time'])
{
$mybb->input['endtime_time'] = gmdate($mybb->settings['timeformat'], TIME_NOW);
}

if($mybb->input['starttime_day'])

	if(!$mybb->input['endtime_time'])
{
$mybb->input['endtime_time'] = gmdate($mybb->settings['timeformat'], TIME_NOW);
}

if($mybb->input['starttime_day'])

	{

	{

		$startday = $mybb->get_input('starttime_day', MyBB::INPUT_INT);
}
else

		$startday = $mybb->get_input('starttime_day', MyBB::INPUT_INT);
}
else

Zeile 268Zeile 270
		else
{
$startdateday .= "<option value=\"$i\">$i</option>\n";

		else
{
$startdateday .= "<option value=\"$i\">$i</option>\n";

		}


		}


		if($endday == $i)

		if($endday == $i)

		{

		{

			$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$enddateday .= "<option value=\"$i\">$i</option>\n";
}

			$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$enddateday .= "<option value=\"$i\">$i</option>\n";
}

	}


	}


	// Months
for($i = 1; $i <= 12; ++$i)

	// Months
for($i = 1; $i <= 12; ++$i)

	{

	{

		$endmonthsel[$i] = $startmonthsel[$i] = '';
}

if($mybb->input['starttime_month'])
{
$startmonth = $mybb->get_input('starttime_month', MyBB::INPUT_INT);

		$endmonthsel[$i] = $startmonthsel[$i] = '';
}

if($mybb->input['starttime_month'])
{
$startmonth = $mybb->get_input('starttime_month', MyBB::INPUT_INT);

		$startmonthsel[$startmonth] = "selected=\"selected\"";
}
else
{

		$startmonthsel[$startmonth] = "selected=\"selected\"";
}
else
{

		$startmonth = gmdate("m", TIME_NOW);
$startmonthsel[$startmonth] = "selected=\"selected\"";
}

if($mybb->input['endtime_month'])

		$startmonth = gmdate("m", TIME_NOW);
$startmonthsel[$startmonth] = "selected=\"selected\"";
}

if($mybb->input['endtime_month'])

	{

	{

		$endmonth = $mybb->get_input('endtime_month', MyBB::INPUT_INT);

		$endmonth = $mybb->get_input('endtime_month', MyBB::INPUT_INT);

		$endmonthsel[$endmonth] = "selected=\"selected\"";
}
else
{

		$endmonthsel[$endmonth] = "selected=\"selected\"";
}
else
{

		$endmonth = gmdate("m", TIME_NOW);
$endmonthsel[$endmonth] = "selected=\"selected\"";
}


		$endmonth = gmdate("m", TIME_NOW);
$endmonthsel[$endmonth] = "selected=\"selected\"";
}


	$startdatemonth .= "<option value=\"01\" {$startmonthsel['01']}>{$lang->january}</option>\n";
$enddatemonth .= "<option value=\"01\" {$endmonthsel['01']}>{$lang->january}</option>\n";
$startdatemonth .= "<option value=\"02\" {$startmonthsel['02']}>{$lang->february}</option>\n";
$enddatemonth .= "<option value=\"02\" {$endmonthsel['02']}>{$lang->february}</option>\n";
$startdatemonth .= "<option value=\"03\" {$startmonthsel['03']}>{$lang->march}</option>\n";
$enddatemonth .= "<option value=\"03\" {$endmonthsel['03']}>{$lang->march}</option>\n";
$startdatemonth .= "<option value=\"04\" {$startmonthsel['04']}>{$lang->april}</option>\n";
$enddatemonth .= "<option value=\"04\" {$endmonthsel['04']}>{$lang->april}</option>\n";
$startdatemonth .= "<option value=\"05\" {$startmonthsel['05']}>{$lang->may}</option>\n";
$enddatemonth .= "<option value=\"05\" {$endmonthsel['05']}>{$lang->may}</option>\n";
$startdatemonth .= "<option value=\"06\" {$startmonthsel['06']}>{$lang->june}</option>\n";
$enddatemonth .= "<option value=\"06\" {$endmonthsel['06']}>{$lang->june}</option>\n";
$startdatemonth .= "<option value=\"07\" {$startmonthsel['07']}>{$lang->july}</option>\n";
$enddatemonth .= "<option value=\"07\" {$endmonthsel['07']}>{$lang->july}</option>\n";
$startdatemonth .= "<option value=\"08\" {$startmonthsel['08']}>{$lang->august}</option>\n";
$enddatemonth .= "<option value=\"08\" {$endmonthsel['08']}>{$lang->august}</option>\n";
$startdatemonth .= "<option value=\"09\" {$startmonthsel['09']}>{$lang->september}</option>\n";
$enddatemonth .= "<option value=\"09\" {$endmonthsel['09']}>{$lang->september}</option>\n";

	$startdatemonth .= "<option value=\"01\" {$startmonthsel['1']}>{$lang->january}</option>\n";
$enddatemonth .= "<option value=\"01\" {$endmonthsel['1']}>{$lang->january}</option>\n";
$startdatemonth .= "<option value=\"02\" {$startmonthsel['2']}>{$lang->february}</option>\n";
$enddatemonth .= "<option value=\"02\" {$endmonthsel['2']}>{$lang->february}</option>\n";
$startdatemonth .= "<option value=\"03\" {$startmonthsel['3']}>{$lang->march}</option>\n";
$enddatemonth .= "<option value=\"03\" {$endmonthsel['3']}>{$lang->march}</option>\n";
$startdatemonth .= "<option value=\"04\" {$startmonthsel['4']}>{$lang->april}</option>\n";
$enddatemonth .= "<option value=\"04\" {$endmonthsel['4']}>{$lang->april}</option>\n";
$startdatemonth .= "<option value=\"05\" {$startmonthsel['5']}>{$lang->may}</option>\n";
$enddatemonth .= "<option value=\"05\" {$endmonthsel['5']}>{$lang->may}</option>\n";
$startdatemonth .= "<option value=\"06\" {$startmonthsel['6']}>{$lang->june}</option>\n";
$enddatemonth .= "<option value=\"06\" {$endmonthsel['6']}>{$lang->june}</option>\n";
$startdatemonth .= "<option value=\"07\" {$startmonthsel['7']}>{$lang->july}</option>\n";
$enddatemonth .= "<option value=\"07\" {$endmonthsel['7']}>{$lang->july}</option>\n";
$startdatemonth .= "<option value=\"08\" {$startmonthsel['8']}>{$lang->august}</option>\n";
$enddatemonth .= "<option value=\"08\" {$endmonthsel['8']}>{$lang->august}</option>\n";
$startdatemonth .= "<option value=\"09\" {$startmonthsel['9']}>{$lang->september}</option>\n";
$enddatemonth .= "<option value=\"09\" {$endmonthsel['9']}>{$lang->september}</option>\n";

	$startdatemonth .= "<option value=\"10\" {$startmonthsel['10']}>{$lang->october}</option>\n";
$enddatemonth .= "<option value=\"10\" {$endmonthsel['10']}>{$lang->october}</option>\n";
$startdatemonth .= "<option value=\"11\" {$startmonthsel['11']}>{$lang->november}</option>\n";

	$startdatemonth .= "<option value=\"10\" {$startmonthsel['10']}>{$lang->october}</option>\n";
$enddatemonth .= "<option value=\"10\" {$endmonthsel['10']}>{$lang->october}</option>\n";
$startdatemonth .= "<option value=\"11\" {$startmonthsel['11']}>{$lang->november}</option>\n";

Zeile 390Zeile 392
			<table cellpadding=\"4\">
<tr>
<td><select name=\"endtime_day\">\n{$enddateday}</select>\n &nbsp; \n<select name=\"endtime_month\">\n{$enddatemonth}</select>\n &nbsp; \n<input type=\"text\" name=\"endtime_year\" value=\"{$enddateyear}\" class=\"text_input\" size=\"4\" maxlength=\"4\" />\n - {$lang->time} ".$form->generate_text_box('endtime_time', $mybb->input['endtime_time'], array('id' => 'endtime_time', 'style' => 'width: 50px;'))."</td>

			<table cellpadding=\"4\">
<tr>
<td><select name=\"endtime_day\">\n{$enddateday}</select>\n &nbsp; \n<select name=\"endtime_month\">\n{$enddatemonth}</select>\n &nbsp; \n<input type=\"text\" name=\"endtime_year\" value=\"{$enddateyear}\" class=\"text_input\" size=\"4\" maxlength=\"4\" />\n - {$lang->time} ".$form->generate_text_box('endtime_time', $mybb->input['endtime_time'], array('id' => 'endtime_time', 'style' => 'width: 50px;'))."</td>

				</tr>
</table>
</dd>
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"endtime_type\" value=\"2\" {$endtime_checked[2]} class=\"endtimes_check\" onclick=\"checkAction('endtime');\" style=\"vertical-align: middle;\" /> <strong>{$lang->never}</strong></label></dt>
</dl>
<script type=\"text/javascript\">
checkAction('endtime');
</script>";
$form_container->output_row($lang->end_date." <em>*</em>", $lang->end_date_desc, $actions);

$form_container->output_row($lang->message." <em>*</em>", "", $form->generate_text_area('message', $mybb->input['message'], array('id' => 'message')), 'message');

$form_container->output_row($lang->forums_to_appear_in." <em>*</em>", $lang->forums_to_appear_in_desc, $form->generate_forum_select('fid', $mybb->input['fid'], array('size' => 5, 'main_option' => $lang->all_forums)));

$form_container->output_row($lang->allow_html." <em>*</em>", "", $form->generate_yes_no_radio('allowhtml', $mybb->input['allowhtml'], array('style' => 'width: 2em;')));

$form_container->output_row($lang->allow_mycode." <em>*</em>", "", $form->generate_yes_no_radio('allowmycode', $mybb->input['allowmycode'], array('style' => 'width: 2em;')));




				</tr>
</table>
</dd>
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"endtime_type\" value=\"2\" {$endtime_checked[2]} class=\"endtimes_check\" onclick=\"checkAction('endtime');\" style=\"vertical-align: middle;\" /> <strong>{$lang->never}</strong></label></dt>
</dl>
<script type=\"text/javascript\">
checkAction('endtime');
</script>";
$form_container->output_row($lang->end_date." <em>*</em>", $lang->end_date_desc, $actions);

$form_container->output_row($lang->message." <em>*</em>", "", $form->generate_text_area('message', $mybb->input['message'], array('id' => 'message')), 'message');

$form_container->output_row($lang->forums_to_appear_in." <em>*</em>", $lang->forums_to_appear_in_desc, $form->generate_forum_select('fid', $mybb->input['fid'], array('size' => 5, 'main_option' => $lang->all_forums)));

if ($mybb->settings['announcementshtml'])
{
$form_container->output_row($lang->allow_html." <em>*</em>", "", $form->generate_yes_no_radio('allowhtml', $mybb->input['allowhtml'], array('style' => 'width: 2em;')));
}

$form_container->output_row($lang->allow_mycode." <em>*</em>", "", $form->generate_yes_no_radio('allowmycode', $mybb->input['allowmycode'], array('style' => 'width: 2em;')));


$form_container->output_row($lang->allow_smilies." <em>*</em>", "", $form->generate_yes_no_radio('allowsmilies', $mybb->input['allowsmilies'], array('style' => 'width: 2em;')));



$form_container->output_row($lang->allow_smilies." <em>*</em>", "", $form->generate_yes_no_radio('allowsmilies', $mybb->input['allowsmilies'], array('style' => 'width: 2em;')));


Zeile 416Zeile 421
	$buttons[] = $form->generate_submit_button($lang->preview_announcement, array('name' => 'preview'));
$form->output_submit_wrapper($buttons);
$form->end();

	$buttons[] = $form->generate_submit_button($lang->preview_announcement, array('name' => 'preview'));
$form->output_submit_wrapper($buttons);
$form->end();





	$page->output_footer();
}


	$page->output_footer();
}


Zeile 457Zeile 462
		$startdate = @explode(":", $startdate[0]);
$enddate = @explode(" ", $mybb->input['endtime_time']);
$enddate = @explode(":", $enddate[0]);

		$startdate = @explode(":", $startdate[0]);
$enddate = @explode(" ", $mybb->input['endtime_time']);
$enddate = @explode(":", $enddate[0]);





		if(stristr($mybb->input['starttime_time'], "pm"))
{
$startdate[0] = 12+$startdate[0];

		if(stristr($mybb->input['starttime_time'], "pm"))
{
$startdate[0] = 12+$startdate[0];

Zeile 468Zeile 473
		}

if(stristr($mybb->input['endtime_time'], "pm"))

		}

if(stristr($mybb->input['endtime_time'], "pm"))

		{

		{

			$enddate[0] = 12+$enddate[0];
if($enddate[0] >= 24)
{

			$enddate[0] = 12+$enddate[0];
if($enddate[0] >= 24)
{

Zeile 486Zeile 491
				$errors[] = $lang->error_invalid_end_date;
}
if($enddate <= $startdate)

				$errors[] = $lang->error_invalid_end_date;
}
if($enddate <= $startdate)

			{
$errors[] = $lang->error_end_before_start;
}

			{
$errors[] = $lang->error_end_before_start;
}

		}

		}





		if(!$errors)
{
if(isset($mybb->input['preview']))
{

		if(!$errors)
{
if(isset($mybb->input['preview']))
{

 
				$lang->load('global', true);


				$parser_options = array();

				$parser_options = array();

				$parser_options['allow_html'] = $mybb->get_input('allowhtml', MyBB::INPUT_INT);

				$parser_options['allow_html'] = $mybb->settings['announcementshtml'] && $mybb->get_input('allowhtml', MyBB::INPUT_INT);

				$parser_options['allow_mycode'] = $mybb->get_input('allowmycode', MyBB::INPUT_INT);
$parser_options['allow_smilies'] = $mybb->get_input('allowsmilies', MyBB::INPUT_INT);
$parser_options['allow_imgcode'] = 1;

				$parser_options['allow_mycode'] = $mybb->get_input('allowmycode', MyBB::INPUT_INT);
$parser_options['allow_smilies'] = $mybb->get_input('allowsmilies', MyBB::INPUT_INT);
$parser_options['allow_imgcode'] = 1;

Zeile 505Zeile 512
				$parser_options['filter_badwords'] = 1;

// Set up the message parser if it doesn't already exist.

				$parser_options['filter_badwords'] = 1;

// Set up the message parser if it doesn't already exist.

				if(!is_object($parser))

				if(!isset($parser) || !is_object($parser))

				{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

				{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

Zeile 521Zeile 528
				if(!in_array($mybb->input['starttime_month'], $months))
{
$mybb->input['starttime_month'] = 1;

				if(!in_array($mybb->input['starttime_month'], $months))
{
$mybb->input['starttime_month'] = 1;

				}

				}


if($mybb->input['endtime_type'] == "2")
{


if($mybb->input['endtime_type'] == "2")
{

Zeile 541Zeile 548
					"message" => $db->escape_string($mybb->input['message']),
"startdate" => $startdate,
"enddate" => $enddate,

					"message" => $db->escape_string($mybb->input['message']),
"startdate" => $startdate,
"enddate" => $enddate,

					"allowhtml" => $mybb->get_input('allowhtml', MyBB::INPUT_INT),

					"allowhtml" => (int)($mybb->settings['announcementshtml'] && $mybb->get_input('allowhtml', MyBB::INPUT_INT)),

					"allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT),
"allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT)
);

					"allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT),
"allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT)
);

Zeile 553Zeile 560
				// Log admin action
log_admin_action($mybb->input['aid'], $mybb->input['title']);
$cache->update_forumsdisplay();

				// Log admin action
log_admin_action($mybb->input['aid'], $mybb->input['title']);
$cache->update_forumsdisplay();





				flash_message($lang->success_updated_announcement, 'success');
admin_redirect("index.php?module=forum-announcements");
}

				flash_message($lang->success_updated_announcement, 'success');
admin_redirect("index.php?module=forum-announcements");
}

Zeile 563Zeile 570
	$page->add_breadcrumb_item($lang->update_an_announcement);
$page->output_header($lang->update_an_announcement);
$page->output_nav_tabs($sub_tabs, "update_announcement");

	$page->add_breadcrumb_item($lang->update_an_announcement);
$page->output_header($lang->update_an_announcement);
$page->output_nav_tabs($sub_tabs, "update_announcement");





	$form = new Form("index.php?module=forum-announcements&amp;action=edit", "post");
echo $form->generate_hidden_field("aid", $mybb->input['aid']);

	$form = new Form("index.php?module=forum-announcements&amp;action=edit", "post");
echo $form->generate_hidden_field("aid", $mybb->input['aid']);

 

// Months
for($i = 1; $i <= 12; ++$i)
{
$endmonthsel[$i] = $startmonthsel[$i] = '';
}


if($errors || isset($mybb->input['preview']))
{


if($errors || isset($mybb->input['preview']))
{

Zeile 573Zeile 586
		if($errors)
{
$page->output_inline_error($errors);

		if($errors)
{
$page->output_inline_error($errors);

		}

		}


// Gather start and end date data
$startday = $mybb->input['starttime_day'];


// Gather start and end date data
$startday = $mybb->input['starttime_day'];

Zeile 583Zeile 596
		$startdateyear = $mybb->input['starttime_year'];

if($mybb->input['endtime_type'] == 1)

		$startdateyear = $mybb->input['starttime_year'];

if($mybb->input['endtime_type'] == 1)

		{

		{

			// Set time
$endtime_checked[1] = 'checked="checked"';
$endtime_checked[2] = '';

			// Set time
$endtime_checked[1] = 'checked="checked"';
$endtime_checked[2] = '';

Zeile 593Zeile 606
			$endmonth = $mybb->input['endtime_month'];
$endmonthsel[$endmonth] = 'selected';
$enddateyear = $mybb->input['endtime_year'];

			$endmonth = $mybb->input['endtime_month'];
$endmonthsel[$endmonth] = 'selected';
$enddateyear = $mybb->input['endtime_year'];

		}

		}

		else
{
// Never

		else
{
// Never

Zeile 628Zeile 641

$mybb->input['title'] = $announcement['subject'];
$mybb->input['message'] = $announcement['message'];


$mybb->input['title'] = $announcement['subject'];
$mybb->input['message'] = $announcement['message'];

		$mybb->input['allowhtml'] = $announcement['allowhtml'];

		$mybb->input['allowhtml'] = $mybb->settings['announcementshtml'] && $announcement['allowhtml'];

		$mybb->input['allowsmilies'] = $announcement['allowsmilies'];
$mybb->input['allowmycode'] = $announcement['allowmycode'];
$mybb->input['fid'] = $announcement['fid'];

		$mybb->input['allowsmilies'] = $announcement['allowsmilies'];
$mybb->input['allowmycode'] = $announcement['allowmycode'];
$mybb->input['fid'] = $announcement['fid'];

Zeile 656Zeile 669
			$endday = $startday;
$endmonth = $startmonth;
$enddateyear = $startdateyear+1;

			$endday = $startday;
$endmonth = $startmonth;
$enddateyear = $startdateyear+1;

		}
}



		}
}

$startdateday = $enddateday = $startdatemonth = $enddatemonth = '';


for($i = 1; $i <= 31; ++$i)
{
if($startday == $i)


for($i = 1; $i <= 31; ++$i)
{
if($startday == $i)

		{

		{

			$startdateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$startdateday .= "<option value=\"$i\">$i</option>\n";

			$startdateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$startdateday .= "<option value=\"$i\">$i</option>\n";

		}

		}


if($endday == $i)


if($endday == $i)

		{

		{

			$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";

			$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";

		}

		}

		else
{
$enddateday .= "<option value=\"$i\">$i</option>\n";

		else
{
$enddateday .= "<option value=\"$i\">$i</option>\n";

		}
}

		}
}





	$startdatemonth .= "<option value=\"01\" {$startmonthsel['01']}>{$lang->january}</option>\n";
$enddatemonth .= "<option value=\"01\" {$endmonthsel['01']}>{$lang->january}</option>\n";
$startdatemonth .= "<option value=\"02\" {$startmonthsel['02']}>{$lang->february}</option>\n";
$enddatemonth .= "<option value=\"02\" {$endmonthsel['02']}>{$lang->february}</option>\n";
$startdatemonth .= "<option value=\"03\" {$startmonthsel['03']}>{$lang->march}</option>\n";
$enddatemonth .= "<option value=\"03\" {$endmonthsel['03']}>{$lang->march}</option>\n";
$startdatemonth .= "<option value=\"04\" {$startmonthsel['04']}>{$lang->april}</option>\n";
$enddatemonth .= "<option value=\"04\" {$endmonthsel['04']}>{$lang->april}</option>\n";
$startdatemonth .= "<option value=\"05\" {$startmonthsel['05']}>{$lang->may}</option>\n";
$enddatemonth .= "<option value=\"05\" {$endmonthsel['05']}>{$lang->may}</option>\n";
$startdatemonth .= "<option value=\"06\" {$startmonthsel['06']}>{$lang->june}</option>\n";
$enddatemonth .= "<option value=\"06\" {$endmonthsel['06']}>{$lang->june}</option>\n";
$startdatemonth .= "<option value=\"07\" {$startmonthsel['07']}>{$lang->july}</option>\n";
$enddatemonth .= "<option value=\"07\" {$endmonthsel['07']}>{$lang->july}</option>\n";
$startdatemonth .= "<option value=\"08\" {$startmonthsel['08']}>{$lang->august}</option>\n";
$enddatemonth .= "<option value=\"08\" {$endmonthsel['08']}>{$lang->august}</option>\n";
$startdatemonth .= "<option value=\"09\" {$startmonthsel['09']}>{$lang->september}</option>\n";
$enddatemonth .= "<option value=\"09\" {$endmonthsel['09']}>{$lang->september}</option>\n";

	$startdatemonth .= "<option value=\"01\" {$startmonthsel['1']}>{$lang->january}</option>\n";
$enddatemonth .= "<option value=\"01\" {$endmonthsel['1']}>{$lang->january}</option>\n";
$startdatemonth .= "<option value=\"02\" {$startmonthsel['2']}>{$lang->february}</option>\n";
$enddatemonth .= "<option value=\"02\" {$endmonthsel['2']}>{$lang->february}</option>\n";
$startdatemonth .= "<option value=\"03\" {$startmonthsel['3']}>{$lang->march}</option>\n";
$enddatemonth .= "<option value=\"03\" {$endmonthsel['3']}>{$lang->march}</option>\n";
$startdatemonth .= "<option value=\"04\" {$startmonthsel['4']}>{$lang->april}</option>\n";
$enddatemonth .= "<option value=\"04\" {$endmonthsel['4']}>{$lang->april}</option>\n";
$startdatemonth .= "<option value=\"05\" {$startmonthsel['5']}>{$lang->may}</option>\n";
$enddatemonth .= "<option value=\"05\" {$endmonthsel['5']}>{$lang->may}</option>\n";
$startdatemonth .= "<option value=\"06\" {$startmonthsel['6']}>{$lang->june}</option>\n";
$enddatemonth .= "<option value=\"06\" {$endmonthsel['6']}>{$lang->june}</option>\n";
$startdatemonth .= "<option value=\"07\" {$startmonthsel['7']}>{$lang->july}</option>\n";
$enddatemonth .= "<option value=\"07\" {$endmonthsel['7']}>{$lang->july}</option>\n";
$startdatemonth .= "<option value=\"08\" {$startmonthsel['8']}>{$lang->august}</option>\n";
$enddatemonth .= "<option value=\"08\" {$endmonthsel['8']}>{$lang->august}</option>\n";
$startdatemonth .= "<option value=\"09\" {$startmonthsel['9']}>{$lang->september}</option>\n";
$enddatemonth .= "<option value=\"09\" {$endmonthsel['9']}>{$lang->september}</option>\n";

	$startdatemonth .= "<option value=\"10\" {$startmonthsel['10']}>{$lang->october}</option>\n";
$enddatemonth .= "<option value=\"10\" {$endmonthsel['10']}>{$lang->october}</option>\n";
$startdatemonth .= "<option value=\"11\" {$startmonthsel['11']}>{$lang->november}</option>\n";

	$startdatemonth .= "<option value=\"10\" {$startmonthsel['10']}>{$lang->october}</option>\n";
$enddatemonth .= "<option value=\"10\" {$endmonthsel['10']}>{$lang->october}</option>\n";
$startdatemonth .= "<option value=\"11\" {$startmonthsel['11']}>{$lang->november}</option>\n";

Zeile 706Zeile 721
	$enddatemonth .= "<option value=\"12\" {$endmonthsel['12']}>{$lang->december}</option>\n";

if(isset($preview))

	$enddatemonth .= "<option value=\"12\" {$endmonthsel['12']}>{$lang->december}</option>\n";

if(isset($preview))

	{

	{

		$form_container = new FormContainer($lang->announcement_preview);
$form_container->output_row($preview['subject'], "", $preview['message'], 'preview');
$form_container->end();

		$form_container = new FormContainer($lang->announcement_preview);
$form_container->output_row($preview['subject'], "", $preview['message'], 'preview');
$form_container->end();

Zeile 727Zeile 742
			{
checked = $(this).val();
}

			{
checked = $(this).val();
}

		});

		});

		$('.'+id+'s').each(function(e)
{
$(this).hide();

		$('.'+id+'s').each(function(e)
{
$(this).hide();

Zeile 758Zeile 773

$form_container->output_row($lang->forums_to_appear_in." <em>*</em>", $lang->forums_to_appear_in_desc, $form->generate_forum_select('fid', $mybb->input['fid'], array('size' => 5, 'main_option' => $lang->all_forums)));



$form_container->output_row($lang->forums_to_appear_in." <em>*</em>", $lang->forums_to_appear_in_desc, $form->generate_forum_select('fid', $mybb->input['fid'], array('size' => 5, 'main_option' => $lang->all_forums)));


	$form_container->output_row($lang->allow_html." <em>*</em>", "", $form->generate_yes_no_radio('allowhtml', $mybb->input['allowhtml'], array('style' => 'width: 2em;')));




	if ($mybb->settings['announcementshtml'])
{
$form_container->output_row($lang->allow_html." <em>*</em>", "", $form->generate_yes_no_radio('allowhtml', $mybb->input['allowhtml'], array('style' => 'width: 2em;')));
}


$form_container->output_row($lang->allow_mycode." <em>*</em>", "", $form->generate_yes_no_radio('allowmycode', $mybb->input['allowmycode'], array('style' => 'width: 2em;')));



$form_container->output_row($lang->allow_mycode." <em>*</em>", "", $form->generate_yes_no_radio('allowmycode', $mybb->input['allowmycode'], array('style' => 'width: 2em;')));


Zeile 780Zeile 798
	$announcement = $db->fetch_array($query);

// Does the announcement not exist?

	$announcement = $db->fetch_array($query);

// Does the announcement not exist?

	if(!$announcement['aid'])

	if(!$announcement)

	{
flash_message($lang->error_invalid_announcement, 'error');
admin_redirect("index.php?module=forum-announcements");
}

// User clicked no

	{
flash_message($lang->error_invalid_announcement, 'error');
admin_redirect("index.php?module=forum-announcements");
}

// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

	{
admin_redirect("index.php?module=forum-announcements");
}

	{
admin_redirect("index.php?module=forum-announcements");
}