Vergleich admin/inc/functions_view_manager.php - 1.8.9 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 52Zeile 52
		admin_redirect($base_url."&action=views");
}


		admin_redirect($base_url."&action=views");
}


 
	$errors = array();

	if($mybb->input['do'] == "add")
{
if($mybb->request_method == "post")

	if($mybb->input['do'] == "add")
{
if($mybb->request_method == "post")

Zeile 64Zeile 65
			{
$mybb->input['fields'] = explode(",", $mybb->input['fields_js']);
}

			{
$mybb->input['fields'] = explode(",", $mybb->input['fields_js']);
}

			if(count($mybb->input['fields']) <= 0)

			if(!isset($mybb->input['fields']) || !is_array($mybb->input['fields']) || count($mybb->input['fields']) <= 0)

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

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

Zeile 89Zeile 90
				$mybb->input['visibility'] = 2;
}


				$mybb->input['visibility'] = 2;
}


			if(!$errors)

			if(empty($errors))

			{
$new_view = array(
"uid" => $mybb->user['uid'],

			{
$new_view = array(
"uid" => $mybb->user['uid'],

Zeile 131Zeile 132
		$page->output_nav_tabs($sub_tabs, 'create_view');

// If we have any error messages, show them

		$page->output_nav_tabs($sub_tabs, 'create_view');

// If we have any error messages, show them

		if($errors)

		if(!empty($errors))

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

$form_container = new FormContainer($lang->create_new_view);

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

$form_container = new FormContainer($lang->create_new_view);

		$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->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->get_input('title'), array('id' => 'title')), 'title');





		if($mybb->input['visibility'] == 2)
{
$visibility_public_checked = true;
}
else
{
$visibility_private_checked = true;
}

		$visibility_public_checked = $mybb->get_input('visibility') == 2;
$visibility_private_checked = !$visibility_public_checked;








$visibility_options = array(
$form->generate_radio_button("visibility", "1", "<strong>{$lang->private}</strong> - {$lang->private_desc}", array("checked" => $visibility_private_checked)),
$form->generate_radio_button("visibility", "2", "<strong>{$lang->public}</strong> - {$lang->public_desc}", array("checked" => $visibility_public_checked))
);
$form_container->output_row($lang->visibility, "", implode("<br />", $visibility_options));


$visibility_options = array(
$form->generate_radio_button("visibility", "1", "<strong>{$lang->private}</strong> - {$lang->private_desc}", array("checked" => $visibility_private_checked)),
$form->generate_radio_button("visibility", "2", "<strong>{$lang->public}</strong> - {$lang->public_desc}", array("checked" => $visibility_public_checked))
);
$form_container->output_row($lang->visibility, "", implode("<br />", $visibility_options));


$form_container->output_row($lang->set_as_default_view, "", $form->generate_yes_no_radio("isdefault", $mybb->input['isdefault'], array('yes' => 1, 'no' => 0)));



$form_container->output_row($lang->set_as_default_view, "", $form->generate_yes_no_radio("isdefault", $mybb->get_input('isdefault'), array('yes' => 1, 'no' => 0)));


		if(count($sort_options) > 0)
{
$sort_directions = array(
"asc" => $lang->ascending,
"desc" => $lang->descending
);

		if(count($sort_options) > 0)
{
$sort_directions = array(
"asc" => $lang->ascending,
"desc" => $lang->descending
);

			$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('sortorder', $sort_directions, $mybb->input['sortorder'], array('id' => 'sortorder')), 'sortby');
}

$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');

			$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->get_input('sortby'), array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('sortorder', $sort_directions, $mybb->get_input('sortorder'), array('id' => 'sortorder')), 'sortby');
}

$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->get_input('perpage'), array('id' => 'perpage', 'min' => 1)), 'perpage');


if($type == "user")


if($type == "user")

		{
$form_container->output_row($lang->display_results_as, "", $form->generate_radio_button('view_type', 'table', $lang->table, array('checked' => ($mybb->input['view_type'] != "card" ? true : false)))."<br />".$form->generate_radio_button('view_type', 'card', $lang->business_card, array('checked' => ($mybb->input['view_type'] == "card" ? true : false))));
}





		{
$form_container->output_row($lang->display_results_as, "", $form->generate_radio_button('view_type', 'table', $lang->table, array('checked' => ($mybb->get_input('view_type') != "card" ? true : false)))."<br />".$form->generate_radio_button('view_type', 'card', $lang->business_card, array('checked' => ($mybb->get_input('view_type') == "card" ? true : false))));
}

$form_container->end();

$active = array();





		$form_container->end();

$field_select .= "<div class=\"view_fields\">\n";

		$field_select = "<div class=\"view_fields\">\n";



		$field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled\">\n";

		$field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled\">\n";

		if(is_array($mybb->input['fields']))

		if(isset($mybb->input['fields']) && is_array($mybb->input['fields']))

		{
foreach($mybb->input['fields'] as $field)
{

		{
foreach($mybb->input['fields'] as $field)
{

Zeile 191Zeile 188
		$field_select .= "<div class=\"disabled\"><div class=\"fields_title\">{$lang->disabled}</div><ul id=\"fields_disabled\">\n";
foreach($fields as $key => $field)
{

		$field_select .= "<div class=\"disabled\"><div class=\"fields_title\">{$lang->disabled}</div><ul id=\"fields_disabled\">\n";
foreach($fields as $key => $field)
{

			if($active[$key])

			if(!empty($active[$key]))

			{
continue;
}

			{
continue;
}

Zeile 207Zeile 204
document.write('".str_replace("/", "\/", $field_select)."');
//]]>
</script>\n";

document.write('".str_replace("/", "\/", $field_select)."');
//]]>
</script>\n";


foreach($fields as $key => $field)
{
$field_options[$key] = $field['title'];
}

$field_select .= "<noscript>".$form->generate_select_box('fields[]', $field_options, $mybb->input['fields'], array('id' => 'fields', 'multiple' => true))."</noscript>\n";



foreach($fields as $key => $field)
{
$field_options[$key] = $field['title'];
}

$field_select .= "<noscript>".$form->generate_select_box('fields[]', $field_options, $mybb->get_input('fields'), array('id' => 'fields', 'multiple' => true))."</noscript>\n";


		$form_container = new FormContainer($lang->fields_to_show);

		$form_container = new FormContainer($lang->fields_to_show);

		$form_container->output_row($lang->fields_to_show_desc, $description, $field_select);

		$form_container->output_row($lang->fields_to_show_desc, '', $field_select);

		$form_container->end();

// Build the search conditions

		$form_container->end();

// Build the search conditions

Zeile 254Zeile 251
				$mybb->input['fields'] = explode(",", $mybb->input['fields_js']);
}


				$mybb->input['fields'] = explode(",", $mybb->input['fields_js']);
}


			if(count($mybb->input['fields']) <= 0)

			if(!is_array($mybb->input['fields']) || count($mybb->input['fields']) <= 0)

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

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

Zeile 267Zeile 264
			if(!in_array($mybb->input['sortby'], array_keys($sort_options)))
{
$errors[] = $lang->error_invalid_view_sortby;

			if(!in_array($mybb->input['sortby'], array_keys($sort_options)))
{
$errors[] = $lang->error_invalid_view_sortby;

			}

if($mybb->input['sortorder'] != "asc" && $mybb->input['sortorder'] != "desc")
{
$errors[] = $lang->error_invalid_view_sortorder;

			}

if($mybb->input['sortorder'] != "asc" && $mybb->input['sortorder'] != "desc")
{
$errors[] = $lang->error_invalid_view_sortorder;

			}

if($mybb->input['visibility'] == 0)

			}

if($mybb->input['visibility'] == 0)

Zeile 279Zeile 276
				$mybb->input['visibility'] = 2;
}


				$mybb->input['visibility'] = 2;
}


			if(!$errors)

			if(empty($errors))

			{
$updated_view = array(
"title" => $db->escape_string($mybb->input['title']),

			{
$updated_view = array(
"title" => $db->escape_string($mybb->input['title']),

Zeile 323Zeile 320
		$page->output_nav_tabs($sub_tabs, 'edit_view');

// If we have any error messages, show them

		$page->output_nav_tabs($sub_tabs, 'edit_view');

// If we have any error messages, show them

		if($errors)

		if(!empty($errors))

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

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

Zeile 346Zeile 343
		$form_container = new FormContainer($lang->edit_view);
$form_container->output_row($lang->view." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');


		$form_container = new FormContainer($lang->edit_view);
$form_container->output_row($lang->view." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');


		if($mybb->input['visibility'] == 2)
{
$visibility_public_checked = true;
}
else
{
$visibility_private_checked = true;
}

		$visibility_public_checked = $mybb->input['visibility'] == 2;
$visibility_private_checked = !$visibility_public_checked;








$visibility_options = array(
$form->generate_radio_button("visibility", "1", "<strong>{$lang->private}</strong> - {$lang->private_desc}", array("checked" => $visibility_private_checked)),


$visibility_options = array(
$form->generate_radio_button("visibility", "1", "<strong>{$lang->private}</strong> - {$lang->private_desc}", array("checked" => $visibility_private_checked)),

Zeile 363Zeile 354

$form_container->output_row($lang->set_as_default_view, "", $form->generate_yes_no_radio("isdefault", $mybb->input['isdefault'], array('yes' => 1, 'no' => 0)));



$form_container->output_row($lang->set_as_default_view, "", $form->generate_yes_no_radio("isdefault", $mybb->input['isdefault'], array('yes' => 1, 'no' => 0)));


		if(count($sort_options) > 0)

		if(is_array($sort_options) && count($sort_options) > 0)

		{
$sort_directions = array(
"asc" => $lang->ascending,
"desc" => $lang->descending
);
$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('sortorder', $sort_directions, $mybb->input['sortorder'], array('id' => 'sortorder')), 'sortby');

		{
$sort_directions = array(
"asc" => $lang->ascending,
"desc" => $lang->descending
);
$form_container->output_row($lang->sort_results_by, "", $form->generate_select_box('sortby', $sort_options, $mybb->input['sortby'], array('id' => 'sortby'))." {$lang->in} ".$form->generate_select_box('sortorder', $sort_directions, $mybb->input['sortorder'], array('id' => 'sortorder')), 'sortby');

		}


		}


		$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');

if($type == "user")

		$form_container->output_row($lang->results_per_page, "", $form->generate_numeric_field('perpage', $mybb->input['perpage'], array('id' => 'perpage', 'min' => 1)), 'perpage');

if($type == "user")

Zeile 381Zeile 372

$form_container->end();



$form_container->end();


		$field_select .= "<div class=\"view_fields\">\n";

		$field_select = "<div class=\"view_fields\">\n";

		$field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled\">\n";
if(is_array($mybb->input['fields']))
{

		$field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled\">\n";
if(is_array($mybb->input['fields']))
{

Zeile 399Zeile 390
		if(is_array($fields))
{
foreach($fields as $key => $field)

		if(is_array($fields))
{
foreach($fields as $key => $field)

			{
if($active[$key])

			{
if(!empty($active[$key]))

				{
continue;
}

				{
continue;
}

Zeile 420Zeile 411
		foreach($fields as $key => $field)
{
$field_options[$key] = $field['title'];

		foreach($fields as $key => $field)
{
$field_options[$key] = $field['title'];

		}


		}


		$field_select .= "<noscript>".$form->generate_select_box('fields[]', $field_options, $mybb->input['fields'], array('id' => 'fields', 'multiple' => true))."</noscript>\n";

$form_container = new FormContainer($lang->fields_to_show);

		$field_select .= "<noscript>".$form->generate_select_box('fields[]', $field_options, $mybb->input['fields'], array('id' => 'fields', 'multiple' => true))."</noscript>\n";

$form_container = new FormContainer($lang->fields_to_show);

		$form_container->output_row($lang->fields_to_show_desc, $description, $field_select);

		$form_container->output_row($lang->fields_to_show_desc, '', $field_select);

		$form_container->end();

// Build the search conditions

		$form_container->end();

// Build the search conditions

Zeile 436Zeile 427

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


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





		$form->end();
$page->output_footer();
}

else if($mybb->input['do'] == "delete")
{

		$form->end();
$page->output_footer();
}

else if($mybb->input['do'] == "delete")
{

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

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

			admin_redirect($base_url."&action=views");
}


			admin_redirect($base_url."&action=views");
}


Zeile 459Zeile 450

$vid = $mybb->get_input('vid', MyBB::INPUT_INT);
$query = $db->simple_select("adminviews", "vid, uid, visibility", "vid = '{$vid}'");


$vid = $mybb->get_input('vid', MyBB::INPUT_INT);
$query = $db->simple_select("adminviews", "vid, uid, visibility", "vid = '{$vid}'");

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


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


		if($vid == 1 || !$admin_view['vid'] || $admin_view['visibility'] == 1 && $mybb->user['uid'] != $admin_view['uid'])
{
flash_message($lang->error_invalid_view_delete, 'error');

		if($vid == 1 || !$admin_view['vid'] || $admin_view['visibility'] == 1 && $mybb->user['uid'] != $admin_view['uid'])
{
flash_message($lang->error_invalid_view_delete, 'error');

Zeile 592Zeile 583

$title_string = "view_title_{$view['vid']}";



$title_string = "view_title_{$view['vid']}";


			if($lang->$title_string)

			if(isset($lang->$title_string))

			{
$view['title'] = $lang->$title_string;
}

			{
$view['title'] = $lang->$title_string;
}

Zeile 635Zeile 626

$query = $db->simple_select("adminoptions", "defaultviews", "uid='{$mybb->user['uid']}'");
$default_views = my_unserialize($db->fetch_field($query, "defaultviews"));


$query = $db->simple_select("adminoptions", "defaultviews", "uid='{$mybb->user['uid']}'");
$default_views = my_unserialize($db->fetch_field($query, "defaultviews"));

	if(!$db->num_rows($query))
{
$create = true;
}

	$create = !$db->num_rows($query);




	$default_views[$type] = $vid;
$default_views = my_serialize($default_views);
$updated_admin = array("defaultviews" => $db->escape_string($default_views));

	$default_views[$type] = $vid;
$default_views = my_serialize($default_views);
$updated_admin = array("defaultviews" => $db->escape_string($default_views));