Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: management.php 4131 2008-08-19 15:31:39Z Tikitiki $
| * $Id: management.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 88 | Zeile 88 |
---|
$errors[] = $lang->error_new_forum_needs_name; }
|
$errors[] = $lang->error_new_forum_needs_name; }
|
if($mybb->input['pid'] == 0 && $mybb->input['type'] == 'f')
| if($mybb->input['pid'] == -1 && $mybb->input['type'] == 'f')
|
{
|
{
|
$errors[] = $lang->error_forum_noparent;
| $errors[] = $lang->error_no_parent;
|
} if(!$errors)
| } if(!$errors)
|
Zeile 890 | Zeile 890 |
---|
$usergroups[$usergroup['gid']] = $usergroup; }
|
$usergroups[$usergroup['gid']] = $usergroup; }
|
| $cached_forum_perms = $cache->read("forumpermissions");
|
$field_list = array('canview', 'canpostthreads', 'canpostreplys', 'canpostpolls', 'canpostattachments'); $form_container = new FormContainer($lang->forum_permissions);
| $field_list = array('canview', 'canpostthreads', 'canpostreplys', 'canpostpolls', 'canpostattachments'); $form_container = new FormContainer($lang->forum_permissions);
|
Zeile 906 | Zeile 907 |
---|
if(isset($mybb->input['default_permissions'])) { if($mybb->input['default_permissions'][$usergroup['gid']])
|
if(isset($mybb->input['default_permissions'])) { if($mybb->input['default_permissions'][$usergroup['gid']])
|
{
| {
|
if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
|
if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
|
{
| {
|
$perms = $existing_permissions[$usergroup['gid']]; $default_checked = false; }
| $perms = $existing_permissions[$usergroup['gid']]; $default_checked = false; }
|
Zeile 916 | Zeile 917 |
---|
{ $perms = $cached_forum_perms[$mybb->input['pid']][$usergroup['gid']]; $default_checked = true;
|
{ $perms = $cached_forum_perms[$mybb->input['pid']][$usergroup['gid']]; $default_checked = true;
|
} } if(!$perms) { $perms = $usergroup; $default_checked = true; } }
| } } if(!$perms) { $perms = $usergroup; $default_checked = true; } }
|
else { if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']]) { $perms = $existing_permissions[$usergroup['gid']]; $default_checked = false;
|
else { if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']]) { $perms = $existing_permissions[$usergroup['gid']]; $default_checked = false;
|
}
| }
|
else if(is_array($cached_forum_perms) && $cached_forum_perms[$mybb->input['pid']][$usergroup['gid']])
|
else if(is_array($cached_forum_perms) && $cached_forum_perms[$mybb->input['pid']][$usergroup['gid']])
|
{
| {
|
$perms = $cached_forum_perms[$mybb->input['pid']][$usergroup['gid']]; $default_checked = true; }
| $perms = $cached_forum_perms[$mybb->input['pid']][$usergroup['gid']]; $default_checked = true; }
|
Zeile 942 | Zeile 943 |
---|
{ $perms = $usergroup; $default_checked = true;
|
{ $perms = $usergroup; $default_checked = true;
|
}
| }
|
}
|
}
|
| $all_check = "";
|
$perm_check = ""; $all_checked = true; foreach($field_list as $forum_permission) { if($usergroup[$forum_permission] == 1)
|
$perm_check = ""; $all_checked = true; foreach($field_list as $forum_permission) { if($usergroup[$forum_permission] == 1)
|
{
| {
|
$value = "true";
|
$value = "true";
|
}
| }
|
else
|
else
|
{
| {
|
$value = "false"; } if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
|
$value = "false"; } if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
|
{
| {
|
$value = $mybb->input['permissions'][$usergroup['gid']][$forum_permission]; } if(isset($mybb->input['permissions'])) { if($mybb->input['permissions'][$usergroup['gid']]['all'])
|
$value = $mybb->input['permissions'][$usergroup['gid']][$forum_permission]; } if(isset($mybb->input['permissions'])) { if($mybb->input['permissions'][$usergroup['gid']]['all'])
|
{
| {
|
$all_checked = false; } if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
|
$all_checked = false; } if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
|
{ $perms_checked[$forum_permission] = 1; } else { $perms_checked[$forum_permission] = 0; }
| { $perms_checked[$forum_permission] = 1; } else { $perms_checked[$forum_permission] = 0; }
|
} else {
| } else {
|
Zeile 1013 | Zeile 1015 |
---|
$buttons[] = $form->generate_submit_button($lang->save_forum); $form->output_submit_wrapper($buttons); $form->end();
|
$buttons[] = $form->generate_submit_button($lang->save_forum); $form->output_submit_wrapper($buttons); $form->end();
|
|
|
$page->output_footer(); }
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_forum_management_edit");
|
$page->output_footer(); }
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_forum_management_edit");
|
|
|
if(!$mybb->input['fid'])
|
if(!$mybb->input['fid'])
|
{ flash_message($lang->error_invalid_fid, 'error'); admin_redirect("index.php?module=forum/management"); }
| { flash_message($lang->error_invalid_fid, 'error'); admin_redirect("index.php?module=forum/management"); }
|
$query = $db->simple_select("forums", "*", "fid='{$mybb->input['fid']}'"); $forum_data = $db->fetch_array($query); if(!$forum_data) { flash_message($lang->error_invalid_fid, 'error');
|
$query = $db->simple_select("forums", "*", "fid='{$mybb->input['fid']}'"); $forum_data = $db->fetch_array($query); if(!$forum_data) { flash_message($lang->error_invalid_fid, 'error');
|
admin_redirect("index.php?module=forum/management"); } $fid = intval($mybb->input['fid']);
| admin_redirect("index.php?module=forum/management"); } $fid = intval($mybb->input['fid']);
|
if($mybb->request_method == "post") { if(!trim($mybb->input['title']))
|
if($mybb->request_method == "post") { if(!trim($mybb->input['title']))
|
{
| {
|
$errors[] = $lang->error_missing_title;
|
$errors[] = $lang->error_missing_title;
|
}
| }
|
$pid = intval($mybb->input['pid']); if($pid == $mybb->input['fid'])
|
$pid = intval($mybb->input['pid']); if($pid == $mybb->input['fid'])
|
{
| {
|
$errors[] = $lang->error_forum_parent_itself; } else { $query = $db->simple_select("forums", "*", "pid='{$mybb->input['fid']}'"); while($child = $db->fetch_array($query))
|
$errors[] = $lang->error_forum_parent_itself; } else { $query = $db->simple_select("forums", "*", "pid='{$mybb->input['fid']}'"); while($child = $db->fetch_array($query))
|
{
| {
|
if($child['fid'] == $pid) { $errors[] = $lang->error_forum_parent_child; break; }
|
if($child['fid'] == $pid) { $errors[] = $lang->error_forum_parent_child; break; }
|
} }
| } }
|
$type = $mybb->input['type'];
| $type = $mybb->input['type'];
|
Zeile 1069 | Zeile 1071 |
---|
{ $errors[] = $lang->error_no_parent; }
|
{ $errors[] = $lang->error_no_parent; }
|
| if($type == 'c' && $forum_data['type'] == 'f') { $query = $db->simple_select('threads', 'COUNT(tid) as num_threads', "fid = '{$fid}'"); if($db->fetch_field($query, "num_threads") > 0) { $errors[] = $lang->error_not_empty; } }
|
if(!$errors) {
| if(!$errors) {
|
Zeile 1118 | Zeile 1129 |
---|
{ case "sqlite3": case "sqlite2":
|
{ case "sqlite3": case "sqlite2":
|
| case "pgsql":
|
$query = $db->simple_select("forums", "fid", "','||parentlist||',' LIKE '%,$fid,%'"); break; default:
| $query = $db->simple_select("forums", "fid", "','||parentlist||',' LIKE '%,$fid,%'"); break; default:
|
Zeile 1151 | Zeile 1163 |
---|
$canview = $permissions['canview']; $canpostthreads = $permissions['canpostthreads'];
|
$canview = $permissions['canview']; $canpostthreads = $permissions['canpostthreads'];
|
$canpostreplies = $permissions['canpostreplies'];
| |
$canpostpolls = $permissions['canpostpolls']; $canpostattachments = $permissions['canpostattachments']; $canpostreplies = $permissions['canpostreplys'];
| $canpostpolls = $permissions['canpostpolls']; $canpostattachments = $permissions['canpostattachments']; $canpostreplies = $permissions['canpostreplys'];
|
Zeile 1179 | Zeile 1190 |
---|
{ $page->output_inline_error($errors); $forum_data = $mybb->input;
|
{ $page->output_inline_error($errors); $forum_data = $mybb->input;
|
} else {
| } else {
|
$forum_data['title'] = $forum_data['name']; }
| $forum_data['title'] = $forum_data['name']; }
|
Zeile 1397 | Zeile 1408 |
---|
$default_checked = true; } }
|
$default_checked = true; } }
|
| $all_check = "";
|
$perm_check = ""; $all_checked = true; foreach($field_list as $forum_permission) { if($usergroup[$forum_permission] == 1)
|
$perm_check = ""; $all_checked = true; foreach($field_list as $forum_permission) { if($usergroup[$forum_permission] == 1)
|
{
| {
|
$value = "true";
|
$value = "true";
|
} else {
| } else {
|
$value = "false"; }
| $value = "false"; }
|
Zeile 1423 | Zeile 1435 |
---|
} if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
|
} if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
|
{ $perms_checked[$forum_permission] = 1; }
| { $perms_checked[$forum_permission] = 1; }
|
else { $perms_checked[$forum_permission] = 0;
| else { $perms_checked[$forum_permission] = 0;
|
Zeile 1434 | Zeile 1446 |
---|
else { if($perms[$forum_permission] != 1)
|
else { if($perms[$forum_permission] != 1)
|
{
| {
|
$all_checked = false; } if($perms[$forum_permission] == 1)
| $all_checked = false; } if($perms[$forum_permission] == 1)
|
Zeile 1472 | Zeile 1484 |
---|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_forum);
|
$form_container->end(); $buttons[] = $form->generate_submit_button($lang->save_forum);
|
$form->output_submit_wrapper($buttons);
| $form->output_submit_wrapper($buttons);
|
$form->end(); $page->output_footer();
| $form->end(); $page->output_footer();
|
Zeile 1511 | Zeile 1523 |
---|
$db->delete_query("moderators", "mid='{$mid}'"); $query = $db->simple_select("moderators", "*", "uid='{$mod['uid']}'");
|
$db->delete_query("moderators", "mid='{$mid}'"); $query = $db->simple_select("moderators", "*", "uid='{$mod['uid']}'");
|
if($db->fetch_array($query))
| if($db->num_rows($query) == 0)
|
{ $updatequery = array( "usergroup" => "2"
| { $updatequery = array( "usergroup" => "2"
|
Zeile 1626 | Zeile 1638 |
---|
$db->delete_query("threads", "fid='{$fid}' {$delquery}"); $db->delete_query("posts", "fid='{$fid}' {$delquery}"); $db->delete_query("moderators", "fid='{$fid}' {$delquery}");
|
$db->delete_query("threads", "fid='{$fid}' {$delquery}"); $db->delete_query("posts", "fid='{$fid}' {$delquery}"); $db->delete_query("moderators", "fid='{$fid}' {$delquery}");
|
| $db->delete_query("forumsubscriptions", "fid='{$fid}' {$delquery}");
|
$cache->update_forums(); $cache->update_moderators();
| $cache->update_forums(); $cache->update_moderators();
|
Zeile 1658 | Zeile 1671 |
---|
if($mybb->input['update'] == "permissions") { $inherit = $mybb->input['default_permissions'];
|
if($mybb->input['update'] == "permissions") { $inherit = $mybb->input['default_permissions'];
|
| if(empty($mybb->input['permissions'])) { $mybb->input['permissions'] = array(); }
|
foreach($mybb->input['permissions'] as $gid => $permission) {
| foreach($mybb->input['permissions'] as $gid => $permission) {
|
Zeile 1681 | Zeile 1699 |
---|
$canpostattachments = $permissions['canpostattachments']; $canpostreplies = $permissions['canpostreplys']; save_quick_perms($fid);
|
$canpostattachments = $permissions['canpostattachments']; $canpostreplies = $permissions['canpostreplys']; save_quick_perms($fid);
|
|
|
$plugins->run_hooks("admin_forum_management_start_permissions_commit"); // Log admin action
| $plugins->run_hooks("admin_forum_management_start_permissions_commit"); // Log admin action
|
Zeile 1720 | Zeile 1738 |
---|
$mid = $db->insert_query("moderators", $new_mod); $db->update_query("users", array('usergroup' => 6), "uid='{$user['uid']}' AND usergroup='2'"); $cache->update_moderators();
|
$mid = $db->insert_query("moderators", $new_mod); $db->update_query("users", array('usergroup' => 6), "uid='{$user['uid']}' AND usergroup='2'"); $cache->update_moderators();
|
|
|
$plugins->run_hooks("admin_forum_management_start_moderators_commit"); // Log admin action
| $plugins->run_hooks("admin_forum_management_start_moderators_commit"); // Log admin action
|
Zeile 1728 | Zeile 1746 |
---|
flash_message($lang->success_moderator_added, 'success'); admin_redirect("index.php?module=forum/management&action=editmod&mid={$mid}");
|
flash_message($lang->success_moderator_added, 'success'); admin_redirect("index.php?module=forum/management&action=editmod&mid={$mid}");
|
}
| }
|
else { flash_message($lang->error_moderator_already_added, 'error'); admin_redirect("index.php?module=forum/management&fid={$fid}#tab_moderators");
|
else { flash_message($lang->error_moderator_already_added, 'error'); admin_redirect("index.php?module=forum/management&fid={$fid}#tab_moderators");
|
}
| }
|
} else {
| } else {
|
Zeile 1759 | Zeile 1777 |
---|
flash_message($lang->success_forum_disporder_updated, 'success'); admin_redirect("index.php?module=forum/management&fid=".$mybb->input['fid']);
|
flash_message($lang->success_forum_disporder_updated, 'success'); admin_redirect("index.php?module=forum/management&fid=".$mybb->input['fid']);
|
} } } if($fid) { $page->add_breadcrumb_item($lang->view_forum, "index.php?module=forum/management");
| } } } if($fid) { $page->add_breadcrumb_item($lang->view_forum, "index.php?module=forum/management");
|
} $page->output_header($lang->forum_management);
| } $page->output_header($lang->forum_management);
|
Zeile 1802 | Zeile 1820 |
---|
else { $form_container = new FormContainer($lang->manage_forums);
|
else { $form_container = new FormContainer($lang->manage_forums);
|
}
| }
|
$form_container->output_row_header($lang->forum); $form_container->output_row_header($lang->order, array("class" => "align_center", 'width' => '5%')); $form_container->output_row_header($lang->controls, array("class" => "align_center", 'style' => 'width: 200px'));
| $form_container->output_row_header($lang->forum); $form_container->output_row_header($lang->order, array("class" => "align_center", 'width' => '5%')); $form_container->output_row_header($lang->controls, array("class" => "align_center", 'style' => 'width: 200px'));
|
Zeile 1892 | Zeile 1910 |
---|
if(!$perms) { $perms = $usergroup;
|
if(!$perms) { $perms = $usergroup;
|
$default_checked = true; }
| $default_checked = true; }
|
} else { if($existing_permissions[$usergroup['gid']])
|
} else { if($existing_permissions[$usergroup['gid']])
|
{
| {
|
$perms = $existing_permissions[$usergroup['gid']]; $default_checked = false; }
| $perms = $existing_permissions[$usergroup['gid']]; $default_checked = false; }
|
Zeile 1910 | Zeile 1928 |
---|
else if($cached_forum_perms[$forum_data['pid']][$usergroup['gid']]) { $perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
|
else if($cached_forum_perms[$forum_data['pid']][$usergroup['gid']]) { $perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
|
$default_checked = true; }
| $default_checked = true; }
|
if(!$perms)
|
if(!$perms)
|
{
| {
|
$perms = $usergroup; $default_checked = true; } }
|
$perms = $usergroup; $default_checked = true; } }
|
| $all_check = "";
|
$perm_check = ""; $all_checked = true; foreach($field_list as $forum_permission)
| $perm_check = ""; $all_checked = true; foreach($field_list as $forum_permission)
|
Zeile 1930 | Zeile 1950 |
---|
else { $value = "false";
|
else { $value = "false";
|
}
| }
|
if($perms[$forum_permission] != 1) { $all_checked = false;
| if($perms[$forum_permission] != 1) { $all_checked = false;
|
Zeile 1964 | Zeile 1984 |
---|
{ $form_container->output_cell("<a href=\"index.php?module=forum/management&action=permissions&gid={$usergroup['gid']}&fid={$fid}\">{$lang->set_permissions}</a>", array("class" => "align_center")); }
|
{ $form_container->output_cell("<a href=\"index.php?module=forum/management&action=permissions&gid={$usergroup['gid']}&fid={$fid}\">{$lang->set_permissions}</a>", array("class" => "align_center")); }
|
$form_container->construct_row(); } $form_container->end();
| $form_container->construct_row(); } $form_container->end();
|
$buttons = array(); $buttons[] = $form->generate_submit_button($lang->update_forum_permissions);
| $buttons = array(); $buttons[] = $form->generate_submit_button($lang->update_forum_permissions);
|
Zeile 2038 | Zeile 2058 |
---|
static $forums_by_parent;
if(!is_array($forums_by_parent))
|
static $forums_by_parent;
if(!is_array($forums_by_parent))
|
{
| {
|
$forum_cache = cache_forums();
foreach($forum_cache as $forum) { $forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; }
|
$forum_cache = cache_forums();
foreach($forum_cache as $forum) { $forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; }
|
}
| }
|
if(!is_array($forums_by_parent[$pid])) {
| if(!is_array($forums_by_parent[$pid])) {
|
Zeile 2056 | Zeile 2076 |
---|
{ foreach($children as $forum) {
|
{ foreach($children as $forum) {
|
$forum['name'] = htmlspecialchars_uni($forum['name']);
| $forum['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&", $forum['name']);
|
if($forum['active'] == 0) { $forum['name'] = "<em>".$forum['name']."</em>";
| if($forum['active'] == 0) { $forum['name'] = "<em>".$forum['name']."</em>";
|