Ich habe daher mal versucht die vietopic.php und modcp.php zu erweitern. Mein Ziel habe ich nun auch erreicht. Bin mir aber nicht sicher, ob ich nun alle sicherheitsrelevanten Dinge beachtet habe. Könntet Ihr Profis da mal drüber schauen, damit ich mir auch sicher sein kann, dass es nur von den gewollten Moderatoren und Admins ausgeführt werden kann? Also, gemacht habe ich folgendes:
Code: Alles auswählen
#-----[ OPEN ]------------------------------------------------
#
modcp.php
#-----[ FIND ]------------------------------------------------
#
case 'lock':
#-----[ BEFORE, ADD ]-----------------------------------------
#
case 'postportal':
if ( !$topic_id )
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
if ( !$post_id )
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
$sql = "UPDATE " . POSTS_TABLE . " SET post_portal = 1 WHERE post_id = $post_id AND forum_id = $forum_id AND post_portal = 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
}
if ( !empty($post_id) )
{
$redirect_page = "viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id";
$message = sprintf($lang['Click_view_message'], '<a href="' . $redirect_page . '">', '</a>');
}
elseif ( !empty($topic_id) )
{
$redirect_page = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id'];
$message = sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>');
}
else
{
$redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
$message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
}
$message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'] . '">', '</a>');
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
);
message_die(GENERAL_MESSAGE, $lang['Post_portal_ON'] . '<br /><br />' . $message);
break;
case 'unpostportal':
if ( !$topic_id )
{
message_die(GENERAL_MESSAGE, $lang['None_selected']);
}
if ( !$post_id )
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
$sql = "UPDATE " . POSTS_TABLE . " SET post_portal = 0 WHERE post_id = $post_id AND forum_id = $forum_id AND post_portal = 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update posts table', '', __LINE__, __FILE__, $sql);
}
if ( !empty($post_id) )
{
$redirect_page = "viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id";
$message = sprintf($lang['Click_view_message'], '<a href="' . $redirect_page . '">', '</a>');
}
elseif ( !empty($topic_id) )
{
$redirect_page = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&sid=" . $userdata['session_id'];
$message = sprintf($lang['Click_return_topic'], '<a href="' . $redirect_page . '">', '</a>');
}
else
{
$redirect_page = "modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'];
$message = sprintf($lang['Click_return_modcp'], '<a href="' . $redirect_page . '">', '</a>');
}
$message = $message . '<br \><br \>' . sprintf($lang['Click_return_forum'], '<a href="' . "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&sid=" . $userdata['session_id'] . '">', '</a>');
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . $redirect_page . '">')
);
message_die(GENERAL_MESSAGE, $lang['Post_portal_OFF'] . '<br /><br />' . $message);
break;
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php
#-----[ FIND ]------------------------------------------------
#
if ( $is_auth['auth_mod'] )
{
$temp_url = "modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'];
$ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';
$ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';
$temp_url = "posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&sid=" . $userdata['session_id'];
$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';
$delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';
#-----[ AFTER, ADD ]-----------------------------------------
#
$temp_url = ($post_portal != '' ) ? "modcp.$phpEx?mode=unpostportal&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'] : "modcp.$phpEx?mode=postportal&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id . "&sid=" . $userdata['session_id'];
$postportal_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_post_portal'] . '" alt="' . $lang['Post_portal'] . '" title="' . $lang['Post_portal'] . '" border="0" /></a>';
$postportal = '<a href="' . $temp_url . '">' . $lang['Post_portal'] . '</a>';
#-----[ FIND ]------------------------------------------------
#
'DELETE' => $delpost,
#-----[ AFTER, ADD ]-----------------------------------------
#
'POSTPORTAL_IMG' => $postportal_img,
Am wichtigsten wäre jetzt also für mich, muss ich in der modcp.php noch irgendwelche Dinge zur Sicherheit abfragen?
PS: Die hier genannte Gruppen oder GruFüs haben nichts mit irgendwelchen Gruppenfunktionen des phpBB zu tun.