Zeile 11 | Zeile 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 39 | Zeile 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 69 | Zeile 69 |
---|
$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 95 | Zeile 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 165 | Zeile 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 233 | Zeile 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 259 | Zeile 259 |
---|
$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 284 | Zeile 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 372 | Zeile 372 |
---|
$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 457 | Zeile 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 515 | Zeile 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 639 | Zeile 639 |
---|
$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 655 | Zeile 655 |
---|
} }
|
} }
|
| /** * @param string $type * * @return bool|array */
|
function fetch_default_view($type) { global $mybb, $db;
| function fetch_default_view($type) { global $mybb, $db;
|