Vergleich admin/inc/functions_view_manager.php - 1.8.3 - 1.8.25

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
/**
* Builds the "view management" interface allowing administrators to edit their custom designed "views"
*

/**
* Builds the "view management" interface allowing administrators to edit their custom designed "views"
*

 * @param string The base URL to this instance of the view manager
* @param string The internal type identifier for this view
* @param array Array of fields this view supports
* @param array Array of possible sort options this view supports if any
* @param string Optional callback function which generates list of "conditions" for this view

 * @param string $base_url The base URL to this instance of the view manager
* @param string $type The internal type identifier for this view
* @param array $fields Array of fields this view supports
* @param array $sort_options Array of possible sort options this view supports if any
* @param string $conditions_callback Optional callback function which generates list of "conditions" for this view

 */
function view_manager($base_url, $type, $fields, $sort_options=array(), $conditions_callback="")
{

 */
function view_manager($base_url, $type, $fields, $sort_options=array(), $conditions_callback="")
{

Zeile 39Zeile 39

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


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

		$query = $db->simple_select("adminviews", "vid, uid, visibility", "vid='".$mybb->get_input('vid', 1)."'");

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

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

if(!$admin_view['vid'] || $admin_view['visibility'] == 1 && $mybb->user['uid'] != $admin_view['uid'])

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

if(!$admin_view['vid'] || $admin_view['visibility'] == 1 && $mybb->user['uid'] != $admin_view['uid'])

Zeile 64Zeile 64
			{
$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;
}


			if($mybb->get_input('perpage', 1) <= 0)

			if($mybb->get_input('perpage', MyBB::INPUT_INT) <= 0)

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

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

Zeile 95Zeile 95
					"uid" => $mybb->user['uid'],
"title" => $db->escape_string($mybb->input['title']),
"type" => $type,

					"uid" => $mybb->user['uid'],
"title" => $db->escape_string($mybb->input['title']),
"type" => $type,

					"visibility" => $mybb->get_input('visibility', 1),
"fields" => $db->escape_string(serialize($mybb->input['fields'])),
"conditions" => $db->escape_string(serialize($mybb->input['conditions'])),
"custom_profile_fields" => $db->escape_string(serialize($mybb->input['profile_fields'])),

					"visibility" => $mybb->get_input('visibility', MyBB::INPUT_INT),
"fields" => $db->escape_string(my_serialize($mybb->input['fields'])),
"conditions" => $db->escape_string(my_serialize($mybb->input['conditions'])),
"custom_profile_fields" => $db->escape_string(my_serialize($mybb->input['profile_fields'])),

					"sortby" => $db->escape_string($mybb->input['sortby']),
"sortorder" => $db->escape_string($mybb->input['sortorder']),

					"sortby" => $db->escape_string($mybb->input['sortby']),
"sortorder" => $db->escape_string($mybb->input['sortorder']),

					"perpage" => $mybb->get_input('perpage', 1),

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

					"view_type" => $db->escape_string($mybb->input['view_type'])
);


					"view_type" => $db->escape_string($mybb->input['view_type'])
);


Zeile 165Zeile 165
			$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->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_text_box('perpage', $mybb->input['perpage'], array('id' => 'perpage')), '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")
{


if($type == "user")
{

Zeile 233Zeile 233
	}
else if($mybb->input['do'] == "edit")
{

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

		$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', 1)."'");

		$query = $db->simple_select("adminviews", "*", "vid='".$mybb->get_input('vid', MyBB::INPUT_INT)."'");

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

// Does the view not exist?

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

// Does the view not exist?

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


			if($mybb->get_input('perpage', 1) <= 0)

			if($mybb->get_input('perpage', MyBB::INPUT_INT) <= 0)

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

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

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

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

					"visibility" => $mybb->get_input('visibility', 1),
"fields" => $db->escape_string(serialize($mybb->input['fields'])),
"conditions" => $db->escape_string(serialize($mybb->input['conditions'])),
"custom_profile_fields" => $db->escape_string(serialize($mybb->input['profile_fields'])),

					"visibility" => $mybb->get_input('visibility', MyBB::INPUT_INT),
"fields" => $db->escape_string(my_serialize($mybb->input['fields'])),
"conditions" => $db->escape_string(my_serialize($mybb->input['conditions'])),
"custom_profile_fields" => $db->escape_string(my_serialize($mybb->input['profile_fields'])),

					"sortby" => $db->escape_string($mybb->input['sortby']),
"sortorder" => $db->escape_string($mybb->input['sortorder']),

					"sortby" => $db->escape_string($mybb->input['sortby']),
"sortorder" => $db->escape_string($mybb->input['sortorder']),

					"perpage" => $mybb->get_input('perpage', 1),

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

					"view_type" => $db->escape_string($mybb->input['view_type'])
);
$db->update_query("adminviews", $updated_view, "vid='{$admin_view['vid']}'");

					"view_type" => $db->escape_string($mybb->input['view_type'])
);
$db->update_query("adminviews", $updated_view, "vid='{$admin_view['vid']}'");

Zeile 363Zeile 363

$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_text_box('perpage', $mybb->input['perpage'], array('id' => 'perpage')), '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();


Zeile 386Zeile 386
		if(is_array($mybb->input['fields']))
{
foreach($mybb->input['fields'] as $field)

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

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

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

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

			{

			{

				if($active[$key])
{
continue;

				if($active[$key])
{
continue;

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


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


		$vid = $mybb->get_input('vid', 1);

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

		$query = $db->simple_select("adminviews", "vid, uid, visibility", "vid = '{$vid}'");
$admin_view = $db->fetch_array($query);


		$query = $db->simple_select("adminviews", "vid, uid, visibility", "vid = '{$vid}'");
$admin_view = $db->fetch_array($query);


Zeile 472Zeile 472
			$db->delete_query("adminviews", "vid='{$admin_view['vid']}'");
flash_message($lang->success_view_deleted, 'success');
admin_redirect($base_url."&action=views");

			$db->delete_query("adminviews", "vid='{$admin_view['vid']}'");
flash_message($lang->success_view_deleted, 'success');
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);

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

Zeile 515Zeile 515
				if(!$conditions) continue;
if(is_array($condition))
{

				if(!$conditions) continue;
if(is_array($condition))
{

					$condition = serialize($condition);

					$condition = my_serialize($condition);

					$is_serialized = " is_serialized=\"1\"";
}
$condition = str_replace(']]>', ']]]]><![CDATA[>', $condition);

					$is_serialized = " is_serialized=\"1\"";
}
$condition = str_replace(']]>', ']]]]><![CDATA[>', $condition);

Zeile 543Zeile 543
	else
{
$page->output_header($lang->view_manager);

	else
{
$page->output_header($lang->view_manager);


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



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


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

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

Zeile 575Zeile 575
				$view_type = "group";
if($view['username'])
{

				$view_type = "group";
if($view['username'])
{

					$created = "<br /><small>{$lang->created_by} {$view['username']}</small>";


					$username = htmlspecialchars_uni($view['username']);
$created = "<br /><small>{$lang->created_by} {$username}</small>";

				}
}
else
{
$view_type = "user";

				}
}
else
{
$view_type = "user";

			}


			}


			$default_add = '';
if($default_view == $view['vid'])
{

			$default_add = '';
if($default_view == $view['vid'])
{

Zeile 639Zeile 640
		$create = true;
}
$default_views[$type] = $vid;

		$create = true;
}
$default_views[$type] = $vid;

	$default_views = serialize($default_views);

	$default_views = my_serialize($default_views);

	$updated_admin = array("defaultviews" => $db->escape_string($default_views));

if($create == true)

	$updated_admin = array("defaultviews" => $db->escape_string($default_views));

if($create == true)

Zeile 655Zeile 656
	}
}


	}
}


 
/**
* @param string $type
*
* @return bool|array
*/

function fetch_default_view($type)
{
global $mybb, $db;

function fetch_default_view($type)
{
global $mybb, $db;