Академический Документы
Профессиональный Документы
Культура Документы
php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 5.0.5 - Licence Number VBFZ48KZZQ
|| # ---------------------------------------------------------------- # ||
|| # Copyright 2000-2013 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
$vbulletin->input->clean_array_gpc('r', array(
'nodeid' => vB_Cleaner::TYPE_INT,
'moderatorid' => vB_Cleaner::TYPE_UINT,
'userid' => vB_Cleaner::TYPE_UINT,
'modusername' => vB_Cleaner::TYPE_STR,
'redir' => vB_Cleaner::TYPE_NOHTML,
));
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
print_cp_header($vbphrase['moderator_manager']);
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modify';
}
if ($_REQUEST['do'] == 'editglobal')
{
$moderator = $assertor->getRow('vBForum:getModGlobalEdit',
array('userid' => $vbulletin->GPC['userid']));
print_form_header('moderator', 'update');
construct_hidden_code('nodeid', '0');
construct_hidden_code('modusername', $moderator['username'], false);
$username = $moderator['username'];
log_admin_action('username = ' . $moderator['username']);
if (empty($moderator['moderatorid']))
{
// this user doesn't have a record for super mod permissions,
which is equivalent to having them all (except the email perms)
$globalperms['permissions'] = array_sum($vbulletin-
>bf_misc_moderatorpermissions) - ($vbulletin-
>bf_misc_moderatorpermissions['newthreademail'] + $vbulletin-
>bf_misc_moderatorpermissions['newpostemail']);
$globalperms['permissions2'] = array_sum($vbulletin-
>bf_misc_moderatorpermissions2);
$moderator = convert_bits_to_array($globalperms['permissions'],
$vbulletin->bf_misc_moderatorpermissions);
$perms2 = convert_bits_to_array($globalperms['permissions2'],
$vbulletin->bf_misc_moderatorpermissions2);
$moderator['username'] = $username;
$moderator = array_merge($perms2, $moderator);
}
else
{
construct_hidden_code('moderatorid', $moderator['moderatorid']);
$perms = convert_bits_to_array($moderator['permissions'],
$vbulletin->bf_misc_moderatorpermissions);
$perms2 = convert_bits_to_array($moderator['permissions2'],
$vbulletin->bf_misc_moderatorpermissions2);
$moderator = array_merge($perms, $perms2, $moderator);
}
$moderator['nodeid'] = $channel['nodeid'];
$moderator['htmltitle'] = $channel['htmltitle'];
print_form_header('moderator', 'update');
print_table_header(construct_phrase($vbphrase['add_new_moderator_to_channel_x'],
$channel['htmltitle']));
}
else
{
// edit moderator - query moderator
$moderator = $assertor->getRow('vBForum:getModeratorChannelInfo',
array('moderatorid' => $vbulletin->GPC['moderatorid']));
// delete link
print_form_header('moderator', 'remove');
construct_hidden_code('moderatorid', $vbulletin->GPC['moderatorid']);
print_table_header($vbphrase['if_you_would_like_to_remove_this_moderator_gmoderator
'] . ' <input type="submit" class="button" value="' .
$vbphrase['remove'] . '" tabindex="1" />');
print_table_footer();
print_form_header('moderator', 'update');
construct_hidden_code('moderatorid', $vbulletin->GPC['moderatorid']);
print_table_header(construct_phrase($vbphrase['edit_moderator_x_for_channel_y'],
$moderator['username'], $moderator['htmltitle']));
}
if ($_REQUEST['do'] != 'editglobal')
{
print_channel_chooser($vbphrase['channel_and_subchannels'], 'nodeid',
$moderator['nodeid']);
if ($_REQUEST['do'] == 'add')
{
print_input_row($vbphrase['moderator_usernames'] .
"<dfn>$vbphrase[separate_usernames_semicolon]</dfn>", 'modusername',
$moderator['username'], 0);
}
else if ($_REQUEST['do'] == 'edit')
{
print_input_row($vbphrase['moderator_username'], 'modusername',
$moderator['username'], 0);
}
construct_hidden_code('redir', $vbulletin->GPC['redir']);
}
// post permissions
print_description_row($vbphrase['post_thread_permissions'], false, 2,
'thead');
print_yes_no_row($vbphrase['can_edit_posts'], 'modperms[caneditposts]',
$moderator['caneditposts']);
print_yes_no_row($vbphrase['can_delete_posts'], 'modperms[candeleteposts]',
$moderator['candeleteposts']);
print_yes_no_row($vbphrase['can_physically_delete_posts'],
'modperms[canremoveposts]', $moderator['canremoveposts']);
// thread permissions
print_yes_no_row($vbphrase['can_open_close_threads'],
'modperms[canopenclose]', $moderator['canopenclose']);
print_yes_no_row($vbphrase['can_edit_threads'], 'modperms[caneditthreads]',
$moderator['caneditthreads']);
print_yes_no_row($vbphrase['can_manage_threads'],
'modperms[canmanagethreads]', $moderator['canmanagethreads']);
print_yes_no_row($vbphrase['can_edit_polls'], 'modperms[caneditpoll]',
$moderator['caneditpoll']);
// moderation permissions
print_description_row($vbphrase['channel_permissions_gcppermission'], false,
2, 'thead');
print_yes_no_row($vbphrase['can_post_announcements'],
'modperms[canannounce]', $moderator['canannounce']);
print_yes_no_row($vbphrase['can_moderate_posts'],
'modperms[canmoderateposts]', $moderator['canmoderateposts']);
print_yes_no_row($vbphrase['can_moderate_attachments'],
'modperms[canmoderateattachments]', $moderator['canmoderateattachments']);
print_yes_no_row($vbphrase['can_mass_move_threads'], 'modperms[canmassmove]',
$moderator['canmassmove']);
print_yes_no_row($vbphrase['can_mass_prune_threads'],
'modperms[canmassprune]', $moderator['canmassprune']);
print_yes_no_row($vbphrase['can_set_forum_password'],
'modperms[cansetpassword]', $moderator['cansetpassword']);
// visitor messaging permissions
print_description_row($vbphrase['visitor_message_permissions'], false, 2,
'thead');
print_yes_no_row($vbphrase['can_edit_posts'],
'modperms[caneditvisitormessages]', $moderator['caneditvisitormessages']);
print_yes_no_row($vbphrase['can_delete_posts'],
'modperms[candeletevisitormessages]', $moderator['candeletevisitormessages']);
print_yes_no_row($vbphrase['can_physically_delete_posts'],
'modperms[canremovevisitormessages]', $moderator['canremovevisitormessages']);
print_yes_no_row($vbphrase['can_moderate_posts'],
'modperms[canmoderatevisitormessages]', $moderator['canmoderatevisitormessages']);
// Social Groups
print_description_row($vbphrase['social_group_permissions'], false, 2,
'thead');
print_yes_no_row($vbphrase['can_edit_social_groups'],
'modperms[caneditsocialgroups]', $moderator['caneditsocialgroups']);
print_yes_no_row($vbphrase['can_delete_social_groups'],
'modperms[candeletesocialgroups]', $moderator['candeletesocialgroups']);
print_yes_no_row($vbphrase['can_transfer_social_groups'],
'modperms[cantransfersocialgroups]', $moderator['cantransfersocialgroups']);
print_yes_no_row($vbphrase['can_edit_pictures'],
'modperms[caneditgrouppicture]', $moderator['caneditgrouppicture']);
print_yes_no_row($vbphrase['can_delete_pictures'],
'modperms[candeletegrouppicture]', $moderator['candeletegrouppicture']);
print_yes_no_row($vbphrase['can_moderate_pictures'],
'modperms[canmoderategrouppicture]', $moderator['canmoderategrouppicture']);
print_yes_no_row($vbphrase['can_edit_posts'],
'modperms[caneditgroupmessages]', $moderator['caneditgroupmessages']);
print_yes_no_row($vbphrase['can_moderate_posts'],
'modperms[canmoderategroupmessages]', $moderator['canmoderategroupmessages']);
print_yes_no_row($vbphrase['can_delete_posts'],
'modperms[candeletegroupmessages]', $moderator['candeletegroupmessages']);
print_yes_no_row($vbphrase['can_physically_delete_posts'],
'modperms[canremovegroupmessages]', $moderator['canremovegroupmessages']);
print_yes_no_row($vbphrase['can_edit_discussions'],
'modperms[caneditdiscussions]', $moderator['caneditdiscussions']);
print_yes_no_row($vbphrase['can_moderate_discussions'],
'modperms[canmoderatediscussions]', $moderator['canmoderatediscussions']);
print_yes_no_row($vbphrase['can_delete_discussions'],
'modperms[candeletediscussions]', $moderator['candeletediscussions']);
print_yes_no_row($vbphrase['can_physically_delete_discussions'],
'modperms[canremovediscussions]', $moderator['canremovediscussions']);
// user permissions
print_description_row($vbphrase['user_permissions'], false, 2, 'thead');
print_yes_no_row($vbphrase['can_view_ip_addresses'], 'modperms[canviewips]',
$moderator['canviewips']);
print_yes_no_row($vbphrase['can_view_whole_profile'],
'modperms[canviewprofile]', $moderator['canviewprofile']);
print_yes_no_row($vbphrase['can_ban_users'], 'modperms[canbanusers]',
$moderator['canbanusers']);
print_yes_no_row($vbphrase['can_restore_banned_users'],
'modperms[canunbanusers]', $moderator['canunbanusers']);
print_yes_no_row($vbphrase['can_edit_user_signatures'],
'modperms[caneditsigs]', $moderator['caneditsigs']);
print_yes_no_row($vbphrase['can_edit_user_avatars'],
'modperms[caneditavatar]', $moderator['caneditavatar']);
print_yes_no_row($vbphrase['can_edit_user_profile_pictures'],
'modperms[caneditprofilepic]', $moderator['caneditprofilepic']);
print_yes_no_row($vbphrase['can_edit_user_reputation_comments_gcppermission'],
'modperms[caneditreputation]', $moderator['caneditreputation']);
// album permissions
print_description_row($vbphrase['user_album_permissions_gmoderator'], false,
2, 'thead');
print_yes_no_row($vbphrase['can_edit_albums_pictures'],
'modperms[caneditalbumpicture]', $moderator['caneditalbumpicture']);
print_yes_no_row($vbphrase['can_delete_albums_pictures'],
'modperms[candeletealbumpicture]', $moderator['candeletealbumpicture']);
print_yes_no_row($vbphrase['can_moderate_pictures'],
'modperms[canmoderatepictures]', $moderator['canmoderatepictures']);
print_yes_no_row($vbphrase['can_edit_picture_comments'],
'modperms[caneditpicturecomments]', $moderator['caneditpicturecomments']);
print_yes_no_row($vbphrase['can_delete_picture_comments'],
'modperms[candeletepicturecomments]', $moderator['candeletepicturecomments']);
print_yes_no_row($vbphrase['can_remove_picture_comments'],
'modperms[canremovepicturecomments]', $moderator['canremovepicturecomments']);
print_yes_no_row($vbphrase['can_moderate_picture_comments'],
'modperms[canmoderatepicturecomments]', $moderator['canmoderatepicturecomments']);
if (!isset($vbulletin->GPC['nodeid']))
{
$vbulletin->GPC['nodeid'] = 0;
}
if ($vbulletin->GPC['moderatorid'])
{
$moddata_existing = $assertor-
>getRow('vBForum:getModeratorInfoToUpdate', array('moderatorid' => $vbulletin-
>GPC['moderatorid']));
$modnames[] = trim(htmlspecialchars_uni($vbulletin-
>GPC['modusername']));
log_admin_action('username = ' . $moddata_existing['username'] . ',
userid = ' . $moddata_existing['userid']);
}
else
{
// split multiple recipients into an array
if (preg_match('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});/', $vbulletin-
>GPC['modusername'])) // multiple recipients attempted
{
$modnamelist = preg_split('/(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]
{5});/', $vbulletin->GPC['modusername'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($modnamelist AS $name)
{
$name = trim($name);
if ($name != '')
{
$modnames[] = htmlspecialchars_uni($name);
}
}
}
// just a single user
else
{
$modnames[] = trim(htmlspecialchars_uni($vbulletin-
>GPC['modusername']));
}
}
$moddata->set('username', $name);
$moddata->set('nodeid', $vbulletin->GPC['nodeid']);
$moddata->pre_save();
$moddata_dms[] =& $moddata;
$successnames[] = $name;
}
unset($moddata);
$dm_errors = '';
// we will only get here if every other DM succeeded
foreach (array_keys($moddata_dms) AS $dmkey)
{
$moddata =& $moddata_dms["$dmkey"];
$moddata->save();
if (!empty($moddata->errors))
{
$html = "<ul><li> " . $moddata->info['user']['username'] .
"</li>";
$html .= "<ul><li>" . implode($moddata->errors, "</li>\n<li>") .
"</li></ul>";
$html .="</ul>";
$dm_errors .= $html;
}
else
{
log_admin_action('username = ' . $moddata->info['user']
['username']);
}
}
if (!empty($dm_errors))
{
$not_affected = array();
// need to find the users not affected
foreach ($moddata_dms AS $moddata)
{
if (empty($moddata->errors))
{
$not_affected[] = $moddata->info['user']['username'];
}
}
print_description_row("$vbphrase[error_occurred_while_making_users_moderators]<bloc
kquote>$dm_errors<br /></blockquote>");
if (!empty($not_affected))
{
print_description_row("$vbphrase[the_following_users_were_made_moderators]<blockquo
te><ul><li>" . implode($not_affected, "</li>\n<li>") . "</li></ul></blockquote>");
}
print_table_footer();
print_cp_footer();
exit;
}
if ($vbulletin->GPC['nodeid'] == 0)
{
// Super Moderator
$file = 'moderator';
$args = array('do'=>'showlist');
}
else if (!empty($vbulletin->GPC['redir']))
{
$file = 'moderator';
$args = array(
'do' => $vbulletin->GPC['redir'] == 'showmods' ? 'showmods' :
'showlist',
'n' => $vbulletin->GPC['nodeid']
);
}
else
{
$file = 'forum';
$args = array(
'do' => 'modify',
'n' => $vbulletin->GPC['nodeid'] . "#channel" . $vbulletin-
>GPC['nodeid']
);
if ($_REQUEST['do'] == 'remove')
{
$vbulletin->input->clean_array_gpc('r', array(
'redir' => vB_Cleaner::TYPE_STR
));
print_delete_confirmation('moderator', $vbulletin->GPC['moderatorid'],
'moderator', 'kill', 'moderator', $hidden);
}
if ($_POST['do'] == 'kill')
{
$mod = $assertor->getRow('vBForum:getModeratorInfoToUpdate',
array('moderatorid' => $vbulletin->GPC['moderatorid']));
if (!$mod)
{
print_stop_message2('invalid_moderator_specified');
}
$vbulletin->input->clean_array_gpc('p', array(
'redir' => vB_Cleaner::TYPE_STR
));
if ($vbulletin->GPC['redir'] == 'modlist')
{
$file = 'moderator';
$args = array('do'=>'showlist');
}
else if ($vbulletin->GPC['redir'] == 'showmods')
{
$file = 'moderator';
$args = array(
'do' => 'showmods',
'n' => $mod['nodeid']
);
}
else
{
$file = 'forum';
$args = array();
}
print_stop_message2('deleted_moderator_successfully', $file, $args);
}
if ($_REQUEST['do'] == 'showlist')
{
print_form_header('', '');
print_table_header($vbphrase['last_online'] . ' - ' .
$vbphrase['color_key']);
print_description_row('
<div class="darkbg" style="border: 2px inset"><ul class="darkbg">
<li class="modtoday">' . $vbphrase['today'] . '</li>
<li class="modyesterday">' . $vbphrase['yesterday'] . '</li>
<li class="modlasttendays">' .
construct_phrase($vbphrase['within_the_last_x_days'], '10') . '</li>
<li class="modsincetendays">' .
construct_phrase($vbphrase['more_than_x_days_ago'], '10') . '</li>
<li class="modsincethirtydays"> ' .
construct_phrase($vbphrase['more_than_x_days_ago'], '30') . '</li>
</ul></div>
');
print_table_footer();
print_form_header('', '');
print_table_header($vbphrase['super_moderators']);
echo "<tr valign=\"top\">\n\t<td class=\"" . fetch_row_bgclass() . "\"
colspan=\"2\">";
echo "<div class=\"darkbg\" style=\"padding: 4px; border: 2px inset; text-
align: " . vB_Template_Runtime::fetchStyleVar('left') . "\"><ul>";
$countmods = 0;
$supergroups = $assertor->getRows('vBForum:getSuperGroups',
array('ismodpermission' => $vbulletin->bf_ugp_adminpermissions['ismoderator']));
if (count($supergroups))
{
foreach ($supergroups AS $supergroup)
{
$countmods++;
if ($supergroup['lastactivity'] >= $unixtoday)
{
$onlinecolor = 'modtoday';
}
else if ($supergroup['lastactivity'] >= ($unixtoday - 86400))
{
$onlinecolor = 'modyesterday';
}
else if ($supergroup['lastactivity'] >= ($unixtoday - 864000))
{
$onlinecolor = 'modlasttendays';
}
else if ($supergroup['lastactivity'] >= ($unixtoday - 2592000))
{
$onlinecolor = 'modsincetendays';
}
else
{
$onlinecolor = 'modsincethirtydays';
}
if ($countmods)
{
print_table_footer(1, $vbphrase['total'] . ": <b>$countmods</b>");
}
else
{
print_table_footer();
}
print_form_header('', '');
print_table_header($vbphrase['moderators']);
echo "<tr valign=\"top\">\n\t<td class=\"" . fetch_row_bgclass() . "\"
colspan=\"2\">";
echo "<div class=\"darkbg\" style=\"padding: 4px; border: 2px inset; text-
align: " . vB_Template_Runtime::fetchStyleVar('left') . "\">";
$countmods = 0;
$moderators = $assertor->getRows('vBForum:getModeratorChannelInfo', array(
'sortby' => array(
'field' => array('user.username', 'node.htmltitle')
)
));
if (count($moderators))
{
$curmod = -1;
foreach ($moderators AS $moderator)
{
if ($curmod != $moderator['userid'])
{
$curmod = $moderator['userid'];
if ($countmods++ != 0)
{
echo "\t\t</ul>\n\t\t</ul>\n\t</li>\n\t</ul>\n";
}
if ($countmods)
{
print_table_footer(1, $vbphrase['total'] . ": <b>$countmods</b>");
}
else
{
print_table_footer();
}
}
if ($_REQUEST['do'] == 'showmods')
{
$channels = $assertor->getRows('vBForum:getModeratorChannelInfo', array(
'nodeid' => $vbulletin->GPC['nodeid'],
'sortby' => array(
array('field' => array('node.htmltitle', 'user.username'))
)
));
if (!count($channels))
{
print_stop_message2('this_channel_does_not_have_any_moderators',NULL,
array(),'');
}
print_form_header('', '');
print_table_header($vbphrase['last_online'] . ' - ' .
$vbphrase['color_key']);
print_description_row('
<div class="darkbg" style="border: 2px inset"><ul class="darkbg">
<li class="modtoday">' . $vbphrase['today'] . '</li>
<li class="modyesterday">' . $vbphrase['yesterday'] . '</li>
<li class="modlasttendays">' .
construct_phrase($vbphrase['within_the_last_x_days'], '10') . '</li>
<li class="modsincetendays">' .
construct_phrase($vbphrase['more_than_x_days_ago'], '10') . '</li>
<li class="modsincethirtydays"> ' .
construct_phrase($vbphrase['more_than_x_days_ago'], '30') . '</li>
</ul></div>
');
print_table_footer();
print_form_header('', '');
print_table_header($vbphrase['moderators']);
echo "<tr valign=\"top\">\n\t<td class=\"" . fetch_row_bgclass() . "\"
colspan=\"2\">";
echo "<div class=\"darkbg\" style=\"padding: 4px; border: 2px inset; text-
align: " . vB_Template_Runtime::fetchStyleVar('left') . "\">";
if ($curnode != $channel['nodeid'])
{
$curnode = $channel['nodeid'];
if ($countnodes++ != 0)
{
echo "\t\t</ul>\n\t\t</ul>\n\t</li>\n\t</ul>\n";
}
if (!empty($modlist))
{
print_table_footer(1, $vbphrase['total'] . ": <b>" . count($modlist) .
"</b>");
}
else
{
print_table_footer();
}
}
if ($_REQUEST['do'] == 'removeall')
{
$modinfo = $assertor->getRow('vBForum:checkUserMod', array('userid' =>
$vbulletin->GPC['userid']));
if (!$modinfo)
{
print_stop_message2('user_no_longer_moderator');
}
if ($_POST['do'] == 'killall')
{
if (empty($vbulletin->GPC['userid']))
{
print_stop_message2('invalid_users_specified');
}
$getuserid = $assertor->getRow('vBForum:getModUserInfoKillAll',
array('userid' => $vbulletin->GPC['userid']));
if (!$getuserid)
{
print_stop_message2('user_no_longer_moderator');
}
else
{
// Legacy Hook 'admin_moderator_killall' Removed //
$assertor->assertQuery('vBForum:moderator', array(
vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE,
vB_dB_Query::CONDITIONS_KEY => array(
array('field' => 'userid', 'value' => $vbulletin->GPC['userid'],
'operator' => vB_dB_Query::OPERATOR_EQ),
array('field' => 'nodeid', 'value' => 0, 'operator' =>
vB_dB_Query::OPERATOR_GT),
)
));
// if the user is in the moderators usergroup, then move them to
registered users usergroup
if ($getuserid['usergroupid'] == 7)
{
if (!$getuserid['customtitle'])
{
if (!$vbulletin->usergroupcache["2"]['usertitle'])
{
$gettitle = $assertor->getRow('usertitle', array(
vB_dB_Query::CONDITIONS_KEY => array(
array('field' => 'minposts', 'value' =>
$getuserid[posts], vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_LTE),
)),
array('field' => array('minposts'), 'direction'
=> array(vB_dB_Query::SORT_DESC))
);
$usertitle = $gettitle['title'];
}
else
{
$usertitle = $vbulletin->usergroupcache["2"]
['usertitle'];
}
}
else
{
$usertitle = $getuserid['usertitle'];
}
$getuserid['usergroupid'] = 2;
if ($getuserid['displaygroupid'] == 7)
{
$userdm->set('displaygroupid', 2);
$getuserid['displaygroupid'] = 2;
}
$userdm->set('usertitle', $usertitle);
$userdm->save();
unset($userdm);
}
print_stop_message2('deleted_moderators_successfully', 'moderator',
array('do' => 'showlist'));
}
}
print_cp_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 12:34, Sat Sep 28th 2013
|| # CVS: $RCSfile$ - $Revision: 71511 $
|| ####################################################################
\*======================================================================*/
?>