Vergleich admin/modules/forum/announcements.php - 1.6.10 - 1.6.17

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 38Zeile 38
		'link' => "index.php?module=forum-announcements",
'description' => $lang->forum_announcements_desc
);

		'link' => "index.php?module=forum-announcements",
'description' => $lang->forum_announcements_desc
);

	



	$sub_tabs['update_announcement'] = array(
'title' => $lang->update_announcement,
'link' => "index.php?module=forum-announcements&action=add",

	$sub_tabs['update_announcement'] = array(
'title' => $lang->update_announcement,
'link' => "index.php?module=forum-announcements&action=add",

Zeile 51Zeile 51
if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_forum_announcements_add");

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_forum_announcements_add");

	



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

	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['message']))
{
$errors[] = $lang->error_missing_message;
}

		



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

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

		{

		{

			$errors[] = $lang->error_missing_forum;
}

			$errors[] = $lang->error_missing_forum;
}

		



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

		$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)

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

			{

			{

				$startdate[0] = "00";

				$startdate[0] = "00";

			}
}


			}
}


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

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

Zeile 91Zeile 91
				$enddate[0] = "00";
}
}

				$enddate[0] = "00";
}
}

		
$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');


$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;
}

		



		$startdate = gmmktime(intval($startdate[0]), intval($startdate[1]), 0, (int)$mybb->input['starttime_month'], intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year']));
if(!checkdate(intval($mybb->input['starttime_month']), intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year'])) || $startdate < 0 || $startdate == false)

		$startdate = gmmktime(intval($startdate[0]), intval($startdate[1]), 0, (int)$mybb->input['starttime_month'], intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year']));
if(!checkdate(intval($mybb->input['starttime_month']), intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year'])) || $startdate < 0 || $startdate == false)

		{

		{

			$errors[] = $lang->error_invalid_start_date;
}

			$errors[] = $lang->error_invalid_start_date;
}

		



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

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

		}

		}

		else
{
if(!in_array($mybb->input['endtime_month'], $months))

		else
{
if(!in_array($mybb->input['endtime_month'], $months))

Zeile 118Zeile 118
			if(!checkdate(intval($mybb->input['endtime_month']), intval($mybb->input['endtime_day']), intval($mybb->input['endtime_year'])) || $enddate < 0 || $enddate == false)
{
$errors[] = $lang->error_invalid_end_date;

			if(!checkdate(intval($mybb->input['endtime_month']), intval($mybb->input['endtime_day']), intval($mybb->input['endtime_year'])) || $enddate < 0 || $enddate == false)
{
$errors[] = $lang->error_invalid_end_date;

			}

			}

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

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

		



		if(!$errors)
{
$insert_announcement = array(

		if(!$errors)
{
$insert_announcement = array(

Zeile 138Zeile 138
				"allowmycode" => $db->escape_string($mybb->input['allowmycode']),
"allowsmilies" => $db->escape_string($mybb->input['allowsmilies']),
);

				"allowmycode" => $db->escape_string($mybb->input['allowmycode']),
"allowsmilies" => $db->escape_string($mybb->input['allowsmilies']),
);

	



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

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

			



			$plugins->run_hooks("admin_forum_announcements_add_commit");

			$plugins->run_hooks("admin_forum_announcements_add_commit");

	



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

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

			$cache->update_forumsdisplay();


			$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");

		}

		}

		else
{
$mybb->input['action'] = 'add';
}
}

		else
{
$mybb->input['action'] = 'add';
}
}

	



	$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 189
		if(!isset($mybb->input[$option]))
{
$mybb->input[$option] = '';

		if(!isset($mybb->input[$option]))
{
$mybb->input[$option] = '';

		}
}

		}
}


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


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

	{

	{

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

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

	{		

	{

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

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

	}


	}


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

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

	{

	{

		$start_time = explode("-", gmdate("g-i-a", TIME_NOW));
$mybb->input['starttime_time'] = $start_time[0].":".$start_time[1]." ".$start_time[2];
}

		$start_time = explode("-", gmdate("g-i-a", TIME_NOW));
$mybb->input['starttime_time'] = $start_time[0].":".$start_time[1]." ".$start_time[2];
}

	



	if(!$mybb->input['endtime_time'])
{
$end_time = explode("-", gmdate("g-i-a", TIME_NOW));
$mybb->input['endtime_time'] = $end_time[0].":".$end_time[1]." ".$end_time[2];

	if(!$mybb->input['endtime_time'])
{
$end_time = explode("-", gmdate("g-i-a", TIME_NOW));
$mybb->input['endtime_time'] = $end_time[0].":".$end_time[1]." ".$end_time[2];

	}


	}


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

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

	{

	{

		$startday = intval($mybb->input['starttime_day']);

		$startday = intval($mybb->input['starttime_day']);

	}

	}

	else
{
$startday = gmdate("j", TIME_NOW);
}

	else
{
$startday = gmdate("j", TIME_NOW);
}

	



	if($mybb->input['endtime_day'])
{
$endday = intval($mybb->input['endtime_day']);

	if($mybb->input['endtime_day'])
{
$endday = intval($mybb->input['endtime_day']);

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

// Days

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

// Days

	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";

	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";

		}

		}

		



		if($endday == $i)
{
$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";

		if($endday == $i)
{
$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";

Zeile 266Zeile 266
	if($mybb->input['starttime_month'])
{
$startmonth = intval($mybb->input['starttime_month']);

	if($mybb->input['starttime_month'])
{
$startmonth = intval($mybb->input['starttime_month']);

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

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

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

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

	



	if($mybb->input['endtime_month'])
{
$endmonth = intval($mybb->input['endtime_month']);

	if($mybb->input['endtime_month'])
{
$endmonth = intval($mybb->input['endtime_month']);

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

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

	



	$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";

	$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";

Zeile 309Zeile 309
	$enddatemonth .= "<option value=\"11\" {$endmonthsel[11]}>{$lang->november}</option>\n";
$startdatemonth .= "<option value=\"12\" {$startmonthsel[12]}>{$lang->december}</option>\n";
$enddatemonth .= "<option value=\"12\" {$endmonthsel[12]}>{$lang->december}</option>\n";

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

	



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

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

	{

	{

		$startdateyear = intval($mybb->input['starttime_year']);
}
else
{
$startdateyear = gmdate("Y", TIME_NOW);

		$startdateyear = intval($mybb->input['starttime_year']);
}
else
{
$startdateyear = gmdate("Y", TIME_NOW);

	}


	}


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

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

	{

	{

		$enddateyear = intval($mybb->input['endtime_year']);
}
else
{
$enddateyear = gmdate("Y", TIME_NOW) + 1;
}

		$enddateyear = intval($mybb->input['endtime_year']);
}
else
{
$enddateyear = gmdate("Y", TIME_NOW) + 1;
}

	



	$form_container = new FormContainer($lang->add_an_announcement);
$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->start_date." <em>*</em>", $lang->start_date_desc, "<select name=\"starttime_day\">\n{$startdateday}</select>\n &nbsp; \n<select name=\"starttime_month\">\n{$startdatemonth}</select>\n &nbsp; \n<input type=\"text\" name=\"starttime_year\" value=\"{$startdateyear}\" size=\"4\" maxlength=\"4\" />\n - {$lang->time} ".$form->generate_text_box('starttime_time', $mybb->input['starttime_time'], array('id' => 'starttime_time', 'style' => 'width: 50px;')));

	$form_container = new FormContainer($lang->add_an_announcement);
$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->start_date." <em>*</em>", $lang->start_date_desc, "<select name=\"starttime_day\">\n{$startdateday}</select>\n &nbsp; \n<select name=\"starttime_month\">\n{$startdatemonth}</select>\n &nbsp; \n<input type=\"text\" name=\"starttime_year\" value=\"{$startdateyear}\" size=\"4\" maxlength=\"4\" />\n - {$lang->time} ".$form->generate_text_box('starttime_time', $mybb->input['starttime_time'], array('id' => 'starttime_time', 'style' => 'width: 50px;')));


$actions = "<script type=\"text/javascript\">
function checkAction(id)
{
var checked = '';

$$('.'+id+'s_check').each(function(e)
{
if(e.checked == true)
{
checked = e.value;
}
});


$actions = "<script type=\"text/javascript\">
function checkAction(id)
{
var checked = '';

$$('.'+id+'s_check').each(function(e)
{
if(e.checked == true)
{
checked = e.value;
}
});

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

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

Zeile 352Zeile 352
        {
Element.show(id+'_'+checked);
}

        {
Element.show(id+'_'+checked);
}

    }    

    }

</script>
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"endtime_type\" value=\"1\" {$endtime_checked[1]} class=\"endtimes_check\" onclick=\"checkAction('endtime');\" style=\"vertical-align: middle;\" /> <strong>{$lang->set_time}</strong></label></dt>

</script>
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"endtime_type\" value=\"1\" {$endtime_checked[1]} class=\"endtimes_check\" onclick=\"checkAction('endtime');\" style=\"vertical-align: middle;\" /> <strong>{$lang->set_time}</strong></label></dt>

Zeile 371Zeile 371
	$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->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->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_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;')));

	



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

$form_container->end();

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

$form_container->end();





	$buttons[] = $form->generate_submit_button($lang->save_announcement);
$form->output_submit_wrapper($buttons);
$form->end();

	$buttons[] = $form->generate_submit_button($lang->save_announcement);
$form->output_submit_wrapper($buttons);
$form->end();





	$page->output_footer();
}

	$page->output_footer();
}





if($mybb->input['action'] == "edit")
{
$plugins->run_hooks("admin_forum_announcements_edit");

if($mybb->input['action'] == "edit")
{
$plugins->run_hooks("admin_forum_announcements_edit");

	



	if(!trim($mybb->input['aid']))
{
flash_message($lang->error_invalid_announcement, 'error');
admin_redirect("index.php?module=forum-announcements");
}

	if(!trim($mybb->input['aid']))
{
flash_message($lang->error_invalid_announcement, 'error');
admin_redirect("index.php?module=forum-announcements");
}

			



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

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

	{		

	{

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

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

		



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

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

		



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

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

		



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

		$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"))

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

		{

		{

			$startdate[0] = 12+$startdate[0];
if($startdate[0] >= 24)
{
$startdate[0] = "00";
}
}

			$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(stristr($mybb->input['endtime_time'], "pm"))
{
$enddate[0] = 12+$enddate[0];

Zeile 438Zeile 438
				$enddate[0] = "00";
}
}

				$enddate[0] = "00";
}
}

		
$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');


$months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');

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

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

		{

		{

			$mybb->input['starttime_month'] = 1;

			$mybb->input['starttime_month'] = 1;

		}


		}


		$startdate = gmmktime(intval($startdate[0]), intval($startdate[1]), 0, (int)$mybb->input['starttime_month'], intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year']));
if(!checkdate(intval($mybb->input['starttime_month']), intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year'])) || $startdate < 0 || $startdate == false)

		$startdate = gmmktime(intval($startdate[0]), intval($startdate[1]), 0, (int)$mybb->input['starttime_month'], intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year']));
if(!checkdate(intval($mybb->input['starttime_month']), intval($mybb->input['starttime_day']), intval($mybb->input['starttime_year'])) || $startdate < 0 || $startdate == false)

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


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


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

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

Zeile 466Zeile 466
			{
$errors[] = $lang->error_invalid_end_date;
}

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

			



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

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

		



		if(!$errors)
{
$update_announcement = array(

		if(!$errors)
{
$update_announcement = array(

Zeile 485Zeile 485
				"allowmycode" => $db->escape_string($mybb->input['allowmycode']),
"allowsmilies" => $db->escape_string($mybb->input['allowsmilies']),
);

				"allowmycode" => $db->escape_string($mybb->input['allowmycode']),
"allowsmilies" => $db->escape_string($mybb->input['allowsmilies']),
);

	



			$db->update_query("announcements", $update_announcement, "aid='{$mybb->input['aid']}'");

			$db->update_query("announcements", $update_announcement, "aid='{$mybb->input['aid']}'");

			



			$plugins->run_hooks("admin_forum_announcements_edit_commit");

			$plugins->run_hooks("admin_forum_announcements_edit_commit");

	



			// 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");

		}

		}

		else
{
$mybb->input['action'] = 'edit';
}
}

		else
{
$mybb->input['action'] = 'edit';
}
}

	



	$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']);

	$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']);

	



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

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

Zeile 549Zeile 549
	{
$query = $db->simple_select("announcements", "*", "aid='{$mybb->input['aid']}'");
$announcement = $db->fetch_array($query);

	{
$query = $db->simple_select("announcements", "*", "aid='{$mybb->input['aid']}'");
$announcement = $db->fetch_array($query);

		



		if(!$announcement)

		if(!$announcement)

		{

		{

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

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

		



		$start_time = explode("-", gmdate("g-i-a", $announcement['startdate']));
$mybb->input['starttime_time'] = $start_time[0].":".$start_time[1]." ".$start_time[2];

		$start_time = explode("-", gmdate("g-i-a", $announcement['startdate']));
$mybb->input['starttime_time'] = $start_time[0].":".$start_time[1]." ".$start_time[2];

		



		$startday = gmdate("j", $announcement['startdate']);

		$startday = gmdate("j", $announcement['startdate']);

		



		$startmonth = gmdate("m", $announcement['startdate']);
$startmonthsel[$startmonth] = "selected=\"selected\"";

		$startmonth = gmdate("m", $announcement['startdate']);
$startmonthsel[$startmonth] = "selected=\"selected\"";

		



		$startdateyear = gmdate("Y", $announcement['startdate']);

		$startdateyear = gmdate("Y", $announcement['startdate']);

		



		$mybb->input['title'] = $announcement['subject'];
$mybb->input['message'] = $announcement['message'];
$mybb->input['allowhtml'] = $announcement['allowhtml'];
$mybb->input['allowsmilies'] = $announcement['allowsmilies'];
$mybb->input['allowmycode'] = $announcement['allowmycode'];
$mybb->input['fid'] = $announcement['fid'];

		$mybb->input['title'] = $announcement['subject'];
$mybb->input['message'] = $announcement['message'];
$mybb->input['allowhtml'] = $announcement['allowhtml'];
$mybb->input['allowsmilies'] = $announcement['allowsmilies'];
$mybb->input['allowmycode'] = $announcement['allowmycode'];
$mybb->input['fid'] = $announcement['fid'];

		



		if($announcement['enddate'])
{
$endtime_checked[1] = "checked=\"checked\"";
$endtime_checked[2] = "";

		if($announcement['enddate'])
{
$endtime_checked[1] = "checked=\"checked\"";
$endtime_checked[2] = "";

			



			$end_time = explode("-", gmdate("g-i-a", $announcement['enddate']));
$mybb->input['endtime_time'] = $end_time[0].":".$end_time[1]." ".$end_time[2];

			$end_time = explode("-", gmdate("g-i-a", $announcement['enddate']));
$mybb->input['endtime_time'] = $end_time[0].":".$end_time[1]." ".$end_time[2];

			



			$endday = gmdate("j", $announcement['enddate']);

			$endday = gmdate("j", $announcement['enddate']);

			



			$endmonth = gmdate("m", $announcement['enddate']);
$endmonthsel[$endmonth] = "selected";

			$endmonth = gmdate("m", $announcement['enddate']);
$endmonthsel[$endmonth] = "selected";

			



			$enddateyear = gmdate("Y", $announcement['enddate']);
}
else

			$enddateyear = gmdate("Y", $announcement['enddate']);
}
else

		{		

		{

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

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

			



			$mybb->input['endtime_time'] = $mybb->input['starttime_time'];
$endday = $startday;
$endmonth = $startmonth;
$enddateyear = $startdateyear+1;
}
}

			$mybb->input['endtime_time'] = $mybb->input['starttime_time'];
$endday = $startday;
$endmonth = $startmonth;
$enddateyear = $startdateyear+1;
}
}

	



	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";

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

		}
else
{

		}
else
{

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

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

		



		if($endday == $i)
{
$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";

		if($endday == $i)
{
$enddateday .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";

Zeile 620Zeile 620
			$enddateday .= "<option value=\"$i\">$i</option>\n";
}
}

			$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";

	$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";

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

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

	



	$form_container = new FormContainer($lang->add_an_announcement);
$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->start_date." <em>*</em>", $lang->start_date_desc, "<select name=\"starttime_day\">\n{$startdateday}</select>\n &nbsp; \n<select name=\"starttime_month\">\n{$startdatemonth}</select>\n &nbsp; \n<input type=\"text\" name=\"starttime_year\" value=\"{$startdateyear}\" size=\"4\" maxlength=\"4\" class=\"text_input\" />\n - {$lang->time} ".$form->generate_text_box('starttime_time', $mybb->input['starttime_time'], array('id' => 'starttime_time', 'style' => 'width: 50px;')));

	$form_container = new FormContainer($lang->add_an_announcement);
$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->start_date." <em>*</em>", $lang->start_date_desc, "<select name=\"starttime_day\">\n{$startdateday}</select>\n &nbsp; \n<select name=\"starttime_month\">\n{$startdatemonth}</select>\n &nbsp; \n<input type=\"text\" name=\"starttime_year\" value=\"{$startdateyear}\" size=\"4\" maxlength=\"4\" class=\"text_input\" />\n - {$lang->time} ".$form->generate_text_box('starttime_time', $mybb->input['starttime_time'], array('id' => 'starttime_time', 'style' => 'width: 50px;')));





	$actions = "<script type=\"text/javascript\">
function checkAction(id)
{
var checked = '';

	$actions = "<script type=\"text/javascript\">
function checkAction(id)
{
var checked = '';

        



        $$('.'+id+'s_check').each(function(e)
{
if(e.checked == true)

        $$('.'+id+'s_check').each(function(e)
{
if(e.checked == true)

Zeile 670Zeile 670
        {
Element.show(id+'_'+checked);
}

        {
Element.show(id+'_'+checked);
}

    }    

    }

</script>
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"endtime_type\" value=\"1\" {$endtime_checked[1]} class=\"endtimes_check\" onclick=\"checkAction('endtime');\" style=\"vertical-align: middle;\" /> <strong>{$lang->set_time}</strong></label></dt>

</script>
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"endtime_type\" value=\"1\" {$endtime_checked[1]} class=\"endtimes_check\" onclick=\"checkAction('endtime');\" style=\"vertical-align: middle;\" /> <strong>{$lang->set_time}</strong></label></dt>

Zeile 689Zeile 689
	$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->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->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_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;')));

	



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

$form_container->end();

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

$form_container->end();

Zeile 705Zeile 705
	$form->end();

$page->output_footer();

	$form->end();

$page->output_footer();

}


}


if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_forum_announcements_delete");

if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_forum_announcements_delete");

	



	$query = $db->simple_select("announcements", "*", "aid='{$mybb->input['aid']}'");
$announcement = $db->fetch_array($query);

	$query = $db->simple_select("announcements", "*", "aid='{$mybb->input['aid']}'");
$announcement = $db->fetch_array($query);

	



	// Does the announcement not exist?
if(!$announcement['aid'])

	// Does the announcement not exist?
if(!$announcement['aid'])

	{

	{

		flash_message($lang->error_invalid_announcement, 'error');

		flash_message($lang->error_invalid_announcement, 'error');

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

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

	}

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

	}

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

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

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

	}

	}





	if($mybb->request_method == "post")
{
$db->delete_query("announcements", "aid='{$announcement['aid']}'");

	if($mybb->request_method == "post")
{
$db->delete_query("announcements", "aid='{$announcement['aid']}'");

		



		$plugins->run_hooks("admin_forum_announcements_delete_commit");

		$plugins->run_hooks("admin_forum_announcements_delete_commit");

		



		// Log admin action

		// Log admin action

		log_admin_action($announcement['aid'], $announcement['title']);

		log_admin_action($announcement['aid'], $announcement['subject']);

		$cache->update_forumsdisplay();

flash_message($lang->success_announcement_deleted, 'success');

		$cache->update_forumsdisplay();

flash_message($lang->success_announcement_deleted, 'success');

Zeile 749Zeile 749
if(!$mybb->input['action'])
{
$plugins->run_hooks("admin_forum_announcements_start");

if(!$mybb->input['action'])
{
$plugins->run_hooks("admin_forum_announcements_start");

	



	$page->add_breadcrumb_item($lang->forum_announcements, "index.php?module=forum-announcements");

	$page->add_breadcrumb_item($lang->forum_announcements, "index.php?module=forum-announcements");

	



	$page->output_header($lang->forum_announcements);

	$page->output_header($lang->forum_announcements);

	



	$page->output_nav_tabs($sub_tabs, "forum_announcements");

// Fetch announcements into their proper arrays

	$page->output_nav_tabs($sub_tabs, "forum_announcements");

// Fetch announcements into their proper arrays

Zeile 762Zeile 762
	while($announcement = $db->fetch_array($query))
{
if($announcement['fid'] == -1)

	while($announcement = $db->fetch_array($query))
{
if($announcement['fid'] == -1)

		{			

		{

			$global_announcements[$announcement['aid']] = $announcement;
continue;
}

			$global_announcements[$announcement['aid']] = $announcement;
continue;
}

Zeile 774Zeile 774
		$table = new Table;
$table->construct_header($lang->announcement);
$table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 150));

		$table = new Table;
$table->construct_header($lang->announcement);
$table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 150));

		



		// Get the global announcements
foreach($global_announcements as $aid => $announcement)
{
if($announcement['enddate'] < TIME_NOW && $announcement['enddate'] != 0)

		// Get the global announcements
foreach($global_announcements as $aid => $announcement)
{
if($announcement['enddate'] < TIME_NOW && $announcement['enddate'] != 0)

			{

			{

				$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_off.gif\" alt=\"(Expired)\" title=\"Expired Announcement\"  style=\"vertical-align: middle;\" /> ";
}
else
{
$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_on.gif\" alt=\"(Active)\" title=\"Active Announcement\" style=\"vertical-align: middle;\" /> ";

				$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_off.gif\" alt=\"(Expired)\" title=\"Expired Announcement\"  style=\"vertical-align: middle;\" /> ";
}
else
{
$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_on.gif\" alt=\"(Active)\" title=\"Active Announcement\" style=\"vertical-align: middle;\" /> ";

			}


			}


			$table->construct_cell($icon."<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">".htmlspecialchars_uni($announcement['subject'])."</a>");
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">{$lang->edit}</a>", array("class" => "align_center", "width" => 75));
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=delete&amp;aid={$aid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_announcement_deletion}')\">{$lang->delete}</a>", array("class" => "align_center", "width" => 75));

			$table->construct_cell($icon."<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">".htmlspecialchars_uni($announcement['subject'])."</a>");
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">{$lang->edit}</a>", array("class" => "align_center", "width" => 75));
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=delete&amp;aid={$aid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_announcement_deletion}')\">{$lang->delete}</a>", array("class" => "align_center", "width" => 75));

Zeile 794Zeile 794
		}
$table->output($lang->global_announcements);
}

		}
$table->output($lang->global_announcements);
}

	





	$table = new Table;
$table->construct_header($lang->announcement);
$table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));

	$table = new Table;
$table->construct_header($lang->announcement);
$table->construct_header($lang->controls, array("class" => "align_center", "colspan" => 2, "width" => 200));

	



	fetch_forum_announcements($table);

	fetch_forum_announcements($table);

	



	if($table->num_rows() == 0)
{
$table->construct_cell($lang->no_forums, array("colspan" => "3"));
$table->construct_row();
}

	if($table->num_rows() == 0)
{
$table->construct_cell($lang->no_forums, array("colspan" => "3"));
$table->construct_row();
}

	



	$table->output($lang->forum_announcements);

$page->output_footer();
}

	$table->output($lang->forum_announcements);

$page->output_footer();
}





function fetch_forum_announcements(&$table, $pid=0, $depth=1)
{
global $mybb, $db, $lang, $announcements, $page;

function fetch_forum_announcements(&$table, $pid=0, $depth=1)
{
global $mybb, $db, $lang, $announcements, $page;

Zeile 832Zeile 832
	{
return;
}

	{
return;
}





	foreach($forums_by_parent[$pid] as $children)
{
foreach($children as $forum)

	foreach($forums_by_parent[$pid] as $children)
{
foreach($children as $forum)

Zeile 864Zeile 864
					{
$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_on.gif\" alt=\"(Active)\" title=\"Active Announcement\" style=\"vertical-align: middle;\" /> ";
}

					{
$icon = "<img src=\"styles/{$page->style}/images/icons/bullet_on.gif\" alt=\"(Active)\" title=\"Active Announcement\" style=\"vertical-align: middle;\" /> ";
}

							



					$table->construct_cell("<div style=\"padding-left: ".(40*$depth)."px;\">{$icon}<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">".htmlspecialchars_uni($announcement['subject'])."</a></div>");
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">{$lang->edit}</a>", array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=delete&amp;aid={$aid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_announcement_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));

					$table->construct_cell("<div style=\"padding-left: ".(40*$depth)."px;\">{$icon}<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">".htmlspecialchars_uni($announcement['subject'])."</a></div>");
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=edit&amp;aid={$aid}\">{$lang->edit}</a>", array("class" => "align_center"));
$table->construct_cell("<a href=\"index.php?module=forum-announcements&amp;action=delete&amp;aid={$aid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_announcement_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));