Vergleich admin/inc/functions_view_manager.php - 1.8.26 - 1.8.30

  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(!is_array($mybb->input['fields']) || 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 87Zeile 88
			if($mybb->input['visibility'] == 0)
{
$mybb->input['visibility'] = 2;

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

			}

			}





			if(!$errors)

			if(empty($errors))

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

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

Zeile 104Zeile 105
					"perpage" => $mybb->get_input('perpage', MyBB::INPUT_INT),
"view_type" => $db->escape_string($mybb->input['view_type'])
);

					"perpage" => $mybb->get_input('perpage', MyBB::INPUT_INT),
"view_type" => $db->escape_string($mybb->input['view_type'])
);





				$vid = $db->insert_query("adminviews", $new_view);

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

				$vid = $db->insert_query("adminviews", $new_view);

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

Zeile 130Zeile 131

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



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


		// If we have any error messages, show them
if($errors)
{
$page->output_inline_error($errors);
}




		// If we have any error messages, show them
if(!empty($errors))
{
$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->get_input('title'), array('id' => 'title')), 'title');





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

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


if(count($sort_options) > 0)
{

Zeile 162Zeile 157
				"asc" => $lang->ascending,
"desc" => $lang->descending
);

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


		}

$form_container->end();


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



		$active = array();

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

$form_container = new FormContainer($lang->fields_to_show);
$form_container->output_row($lang->fields_to_show_desc, $description, $field_select);
$form_container->end();



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->output_row($lang->fields_to_show_desc, '', $field_select);
$form_container->end();


		// Build the search conditions
if(function_exists($conditions_callback))
{

		// Build the search conditions
if(function_exists($conditions_callback))
{

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 362Zeile 353
		$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->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)));





		if(is_array($sort_options) && count($sort_options) > 0)
{
$sort_directions = array(

		if(is_array($sort_options) && count($sort_options) > 0)
{
$sort_directions = array(

Zeile 370Zeile 361
				"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');

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


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->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']))
{
foreach($mybb->input['fields'] as $field)
{
if($fields[$field])

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

				{

				{

					$field_select .= "<li id=\"field-{$field}\">&#149; {$fields[$field]['title']}</li>";
$active[$field] = 1;
}

					$field_select .= "<li id=\"field-{$field}\">&#149; {$fields[$field]['title']}</li>";
$active[$field] = 1;
}

Zeile 400Zeile 391
		{
foreach($fields as $key => $field)
{

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

				if($active[$key])

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

				{
continue;
}

				{
continue;
}

Zeile 425Zeile 416
		$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
if(function_exists($conditions_callback))
{
$conditions_callback($mybb->input, $form);

		$form_container->end();

// Build the search conditions
if(function_exists($conditions_callback))
{
$conditions_callback($mybb->input, $form);

		}


		}


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

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

	}


	}


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

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

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

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

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

$query = $db->simple_select("adminviews", "COUNT(vid) as views");

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

$query = $db->simple_select("adminviews", "COUNT(vid) as views");

		$views = $db->fetch_field($query, "views");

		$views = $db->fetch_field($query, "views");


if($views == 0)
{


if($views == 0)
{

Zeile 464Zeile 455
		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');

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


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


		if($mybb->request_method == "post")
{
$db->delete_query("adminviews", "vid='{$admin_view['vid']}'");

		if($mybb->request_method == "post")
{
$db->delete_query("adminviews", "vid='{$admin_view['vid']}'");

Zeile 474Zeile 465
			admin_redirect($base_url."&action=views");
}
else

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

		{

		{

			$page->output_confirm_action($base_url."&amp;action=views&amp;do=delete&amp;vid={$admin_view['vid']}", $lang->confirm_view_deletion);
}
}

			$page->output_confirm_action($base_url."&amp;action=views&amp;do=delete&amp;vid={$admin_view['vid']}", $lang->confirm_view_deletion);
}
}

Zeile 500Zeile 491
			$admin_view['sortby'] = str_replace(']]>', ']]]]><![CDATA[>', $admin_view['sortby']);
$admin_view['sortorder'] = str_replace(']]>', ']]]]><![CDATA[>', $admin_view['sortorder']);
$admin_view['view_type'] = str_replace(']]>', ']]]]><![CDATA[>', $admin_view['view_type']);

			$admin_view['sortby'] = str_replace(']]>', ']]]]><![CDATA[>', $admin_view['sortby']);
$admin_view['sortorder'] = str_replace(']]>', ']]]]><![CDATA[>', $admin_view['sortorder']);
$admin_view['view_type'] = str_replace(']]>', ']]]]><![CDATA[>', $admin_view['view_type']);





			$xml .= "\t<view vid=\"{$admin_view['vid']}\" uid=\"{$admin_view['uid']}\" type=\"{$admin_view['type']}\" visibility=\"{$admin_view['visibility']}\">\n";
$xml .= "\t\t<title><![CDATA[{$admin_view['title']}]]></title>\n";
$xml .= "\t\t<fields>\n";

			$xml .= "\t<view vid=\"{$admin_view['vid']}\" uid=\"{$admin_view['uid']}\" type=\"{$admin_view['type']}\" visibility=\"{$admin_view['visibility']}\">\n";
$xml .= "\t\t<title><![CDATA[{$admin_view['title']}]]></title>\n";
$xml .= "\t\t<fields>\n";

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