Pagina 1 van 1
Report post code aanpassing
Geplaatst: 24 aug 2005, 19:01
door Muiter
Dit is de originele code:
Code: Selecteer alles
$report_link = ( $userdata['user_level'] >= ADMIN ) ? ' <a href="' . append_sid($phpbb_root_path . 'viewpost_reports.'.$phpEx) . '">' . sprintf($lang['Post_reports_cp'], reports_count()) . '</a> ' : '';
En dit maak ik er van maar wat moet er op XXXXXX?
Code: Selecteer alles
'POST_REPORTS_CP' => $lang['Post_reports_cp'], $XXXXXXX['reports_count'])
Of klopt mijn code helemaal niet?
Geplaatst: 24 aug 2005, 19:07
door Paul
Wat wil je doen? Want deze code klopt helemaal niet

Geplaatst: 24 aug 2005, 19:30
door Muiter
paulus schreef:Wat wil je doen? Want deze code klopt helemaal niet

Ik wil: 'er zijn 5 nieuwe rapporten
Ik kom tot: 'er zijn %2 nieuwe rapporten
Geplaatst: 24 aug 2005, 19:32
door Paul
Code: Selecteer alles
'POST_REPORTS_CP' => sprintf($lang['Post_reports_cp'], reports_count()),
Denk ik

Geplaatst: 24 aug 2005, 21:46
door Muiter
paulus schreef:Code: Selecteer alles
'POST_REPORTS_CP' => sprintf($lang['Post_reports_cp'], reports_count()),
Denk ik

Goed gedacht :thumb:
Geplaatst: 25 aug 2005, 16:36
door Muiter
Na het posten van een nieuw bericht krijg ik het volgende:
message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?
Als ik een antwoordvenster open, verschijnt daaronder ook:
Algemene Fout
Could not get most recent report
DEBUG MODE
SQL Error : 1146 Table 'modelautoforum_nl_-_forum.post_reports' doesn't exist
SELECT COUNT(report_id) as total FROM post_reports WHERE report_status = 1
Line : 256
File : functions_report.php
Zal waarschijnlijk komen omdat ik de links naar de rapporten nu in de header heb staan i.p.v. de footer. Hoe kan ik dit probleem oplossen?
Hele mod:
Code: Selecteer alles
##############################################################
## MOD Title: Report Posts
## MOD Author: wGEric < mods@best-dev.com > (Eric Faerber) http://mods.best-dev.com
## MOD Description: Allows registered users to report posts to moderators. Adds a page where all reports can be displayed and the option to email the moderators when a report is made
## MOD Version: 1.0.1
##
## Installation Level: Moderate
## Installation Time: 18 minutes
## Files To Edit: admin/admin_board.php
## includes/constants.php
## viewtopic.php
## includes/page_tail.php
## language/lang_english/lang_main.php
## templates/subSilver/admin/board_config_body.tpl
## templates/subSilver/subSilver.cfg
## templates/subSilver/viewtopic_body.tpl
## Included Files:
## viewpost_reports.php
## includes/functions_report.php
## language/lang_english/email/report_posts.tpl
## templates/subSilver/report_post.tpl
## templates/subSilver/reports_view.tpl
## templates/subSilver/images/icon_report.gif
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: Enjoy :)
##############################################################
## MOD History:
##
## 2005-04-22 - Version 1.0.1
## - Fixed implode bug (Thanks to the multiple people that reported this)
## - Added flood interval (Thanks FuNEnD3R)
## - Added language for Config page in ACP (Thanks bbcentral)
## - Report post link displays the number of reports (Thanks Nuladion)
##
## 2005-04-12 - Version 1.0.0
## - First Stable release.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
copy viewpost_reports.php to viewpost_reports.php
copy includes/functions_report.php to includes/functions_report.php
copy language/lang_english/email/report_post.tpl to language/lang_english/email/report_post.tpl
copy templates/subSilver/report_post.tpl to templates/subSilver/report_post.tpl
copy templates/subSilver/reports_view.tpl to templates/subSilver/reports_view.tpl
copy templates/subSilver/images/icon_report.gif to templates/subSilver/images/icon_report.gif
#
#-----[ SQL ]------------------------------------------
#
CREATE TABLE phpbb_post_reports (
report_id MEDIUMINT( 8 ) NOT NULL AUTO_INCREMENT ,
post_id MEDIUMINT( 8 ) NOT NULL ,
reporter_id MEDIUMINT( 8 ) NOT NULL ,
report_status TINYINT( 1 ) DEFAULT '0' NOT NULL ,
report_time INT( 11 ) DEFAULT '0' NOT NULL,
report_comments TEXT,
PRIMARY KEY ( report_id )
);
ALTER TABLE phpbb_users ADD user_report_optout TINYINT( 1 ) DEFAULT '0' NOT NULL ;
INSERT INTO phpbb_config ( config_name, config_value ) VALUES ('report_email', '1');
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------
#
$smtp_no = ( !$new['smtp_delivery'] ) ? "checked=\"checked\"" : "";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$report_email_yes = ( $new['report_email'] ) ? 'checked="checked"' : '';
$report_email_no = ( !$new['report_email'] ) ? 'checked="checked"' : '';
#
#-----[ FIND ]------------------------------------------
#
"L_RESET" => $lang['Reset'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_REPORT_EMAIL' => $lang['Report_email'],
'REPORT_EMAIL_YES' => $report_email_yes,
'REPORT_EMAIL_NO' => $report_email_no,
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
if( $userdata['session_logged_in'] )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// report post
//
if ( isset($HTTP_GET_VARS['report']) || isset($HTTP_POST_VARS['report']) )
{
include($phpbb_root_path . 'includes/functions_report.'.$phpEx);
$comments = ( !empty($HTTP_POST_VARS['comments']) ) ? htmlspecialchars(trim($HTTP_POST_VARS['comments'])) : '';
if ( empty($comments) )
{
// show form to add comments about topic
$page_title = $lang['Report_post'] . ' - ' . $topic_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'report_post.tpl')
);
$template->assign_vars(array(
'TOPIC_TITLE' => $topic_title,
'POST_ID' => $post_id,
'U_VIEW_TOPIC' => append_sid($phpbb_root_path . 'viewtopic.'.$phpEx.'?' . POST_TOPIC_URL . '=' . $topic_id),
'L_REPORT_POST' => $lang['Report_post'],
'L_COMMENTS' => $lang['Comments'],
'L_SUBMIT' => $lang['Submit'],
'S_ACTION' => append_sid($phpbb_root_path . 'viewtopic.'.$phpEx.'?report=true&' . POST_POST_URL . '=' . $post_id))
);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit;
}
else
{
if ( !report_flood() )
{
message_die(GENERAL_MESSAGE, $lang['Flood_Error']);
}
// insert the report
insert_report($post_id, $comments);
// email the report if need to
if ( $board_config['report_email'] )
{
email_report($forum_id, $post_id, $topic_title, $comments);
}
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
);
$message = $lang['Post_reported'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
}
#
#-----[ FIND ]------------------------------------------
#
$template->assign_block_vars('postrow', array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ( $userdata['session_logged_in'] )
{
$report_img = '<a href="' . append_sid($phpbb_root_path . 'viewtopic.'.$phpEx.'?report=true&' . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '"><img src="' . $images['icon_report'] . '" border="0" width="20" height="20" alt="' . $lang['Report_post'] . '" title="' . $lang['Report_post'] . '" /></a>';
}
else
{
$report_img = '';
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
'REPORT_IMG' => $report_img,
#
#-----[ OPEN ]------------------------------------------
#
includes/page_tail.php
#
#-----[ FIND ]------------------------------------------
#
$admin_link = ( $userdata['user_level'] == ADMIN ) ? '<a href="' . $phpbb_root_path . 'admin/index.' . $phpEx . '?sid=' . $userdata['session_id'] . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '';
#
#-----[ AFTER, ADD ]------------------------------------------
#
include_once($phpbb_root_path . 'includes/functions_report.'.$phpEx);
$report_link = ( $userdata['user_level'] >= ADMIN ) ? ' <a href="' . append_sid($phpbb_root_path . 'viewpost_reports.'.$phpEx) . '">' . sprintf($lang['Post_reports_cp'], reports_count()) . '</a> ' : '';
#
#-----[ FIND ]------------------------------------------
#
'ADMIN_LINK' => $admin_link)
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$admin_link
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
$report_link .
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
$lang['A_critical_error'] = 'A Critical Error Occurred';
#
#-----[ AFTER, ADD ]------------------------------------------
#
//
// Report Post
//
$lang['Post_reports_cp'] = 'There are %s new Reported Post(s)';
$lang['Closed'] = 'Closed';
$lang['Close'] = 'Close';
$lang['Open'] = 'Open';
$lang['All'] = 'All';
$lang['Display'] = 'Display only';
$lang['Report_post'] = 'Report Post';
$lang['Comments'] = 'Comments';
$lang['Reporter'] = 'Reporter';
$lang['Status'] = 'Status';
$lang['Select_one'] = 'Select One';
$lang['Opt_in'] = 'Opt in to recieve emails when a report is submitted';
$lang['Opt_out'] = 'Opt out so you don\'t recieve emails when a report is submitted';
$lang['Post_reported'] = 'Post report submitted successfully.';
$lang['Close_success'] = 'Reports were Opened/Closed successfully.';
$lang['Opt_success'] = 'You have opt out/in successfully.';
$lang['Delete_success'] = 'Reports were deleted successfully.';
$lang['Click_return_reports'] = 'Click %shere%s to return to the Report Posts control panel.';
$lang['Report_email'] = 'Send Email when Post Reported';
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_ENABLE_PRUNE}</td>
<td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES} <input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_REPORT_EMAIL}</td>
<td class="row2"><input type="radio" name="report_email" value="1" {REPORT_EMAIL_YES} /> {L_YES} <input type="radio" name="report_email" value="0" {REPORT_EMAIL_NO} /> {L_NO}</td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.cfg
#
#-----[ FIND ]------------------------------------------
#
$images['voting_graphic'][4] = "$current_template_images/voting_bar.gif";
#
#-----[ AFTER, ADD ]------------------------------------------
#
$images['icon_report'] = "$current_template_images/icon_report.gif";
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<td valign="top" nowrap="nowrap">{postrow.QUOTE_IMG} {postrow.EDIT_IMG} {postrow.DELETE_IMG} {postrow.IP_IMG}</td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{postrow.IP_IMG}
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
{postrow.REPORT_IMG}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Geplaatst: 25 aug 2005, 18:14
door Paul
de sql uit te voeren

Geplaatst: 25 aug 2005, 18:18
door Muiter
paulus schreef:de sql uit te voeren

Deze mod draait al maanden goed alleen was de link geplaatst als tekst 'Rapporten' in de header maar nu wil ik dat veranderen zoals de mod bedoeld is naar 'X nieuw rapporten'.
Geplaatst: 27 aug 2005, 11:25
door Muiter
Iemand?
Geplaatst: 28 aug 2005, 15:52
door Muiter
Er is een nieuwe versie uitgekomen van deze mod en nu werkt deze code wel:
Code: Selecteer alles
'POST_REPORTS_CP' => sprintf($lang['Post_reports_cp'], reports_count()),
Hoe kan ik aan 'reports_count' een kleur meegeven?
Geplaatst: 28 aug 2005, 16:10
door Bee
Daarvoor moet je de taalstring aanpassen in het taalbestand, en HTML tags toevoegen.
Geplaatst: 28 aug 2005, 16:48
door Muiter
Het heeft even goed gewerkt maar nu krijg ik deze foutmelding:
Warning: Invalid argument supplied for foreach() in /home/virtual/site82/fst/var/www/html/viewpost_reports.php on line 101
Warning: implode(): Bad arguments. in /home/virtual/site82/fst/var/www/html/viewpost_reports.php on line 107
Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site82/fst/var/www/html/viewpost_reports.php:101) in /home/virtual/site82/fst/var/www/html/includes/page_header.php on line 993
Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site82/fst/var/www/html/viewpost_reports.php:101) in /home/virtual/site82/fst/var/www/html/includes/page_header.php on line 995
Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site82/fst/var/www/html/viewpost_reports.php:101) in /home/virtual/site82/fst/var/www/html/includes/page_header.php on line 996
Code: Selecteer alles
<?php
/***************************************************************************
* viewpost_reports.php
* -------------------
* begin : Sunday, Jul 8, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id $
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_report.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if( !$userdata['session_logged_in'] )
{
redirect($phpbb_root_path . 'login.'.$phpEx.'?redirect=viewpost_reports.'.$phpEx);
}
if ( $userdata['user_level'] < ADMIN )
{
message_die(GENERAL_MESSAGE, $lang['Not_Moderator'], $lang['Not_Authorised']);
}
if ( isset($HTTP_POST_VARS['status']) || isset($HTTP_GET_VARS['status']) )
{
$status = ( !empty($HTTP_POST_VARS['status']) ) ? $HTTP_POST_VARS['status'] : $HTTP_GET_VARS['status'];
}
else
{
$status = REPORT_NEW;
}
if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
{
$mode = ( !empty($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
}
else
{
$mode = '';
}
if ( $mode == 'close' || $mode == 'open' )
{
$posts = $HTTP_POST_VARS[POST_POST_URL];
foreach($posts as $row)
{
$post_ids[] = intval($row);
}
$sql = "UPDATE " . POST_REPORTS_TABLE . " SET
report_status = " . ( ( $mode == 'close' ) ? REPORT_CLOSED : REPORT_NEW ) . "
WHERE report_id IN (" . implode(',', $post_ids) . ")";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update status', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Close_success'] . '<br /><br />' . sprintf($lang['Click_return_reports'], '<a href="' . append_sid($phpbb_root_path . 'viewpost_reports.'.$phpEx) . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else if ( $mode == 'optout' || $mode == 'optin' )
{
$sql = "UPDATE " . USERS_TABLE . " SET
user_report_optout = " . (( $mode == 'optout' ) ? 1 : 0) . "
WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not opt status', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Opt_success'] . '<br /><br />' . sprintf($lang['Click_return_reports'], '<a href="' . append_sid($phpbb_root_path . 'viewpost_reports.'.$phpEx) . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
else if ( $mode == 'delete' )
{
$posts = $HTTP_POST_VARS[POST_POST_URL];
foreach($posts as $row)
{
$post_ids[] = intval($row);
}
$sql = "DELETE FROM " . POST_REPORTS_TABLE . "
WHERE report_id IN (" . implode(',', $post_ids) . ")";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete reports', '', __LINE__, __FILE__, $sql);
}
$message = $lang['Delete_success'] . '<br /><br />' . sprintf($lang['Click_return_reports'], '<a href="' . append_sid($phpbb_root_path . 'viewpost_reports.'.$phpEx) . '">', '</a>');
message_die(GENERAL_MESSAGE, $message);
}
$page_title = $lang['View_post_reports'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'reports_view.tpl')
);
$template->assign_vars(array(
'L_DISPLAY' => $lang['Display'],
'L_OPEN' => $lang['Open'],
'L_CLOSE' => $lang['Close'],
'L_DELETE' => $lang['Delete'],
'L_CLOSED' => $lang['Closed'],
'L_ALL' => $lang['All'],
'L_POST' => $lang['Post'],
'L_REPORTER' => $lang['Reporter'],
'L_COMMENTS' => $lang['Comments'],
'L_STATUS' => $lang['Status'],
'L_SELECT_ONE' => $lang['Select_one'],
'L_SUBMIT' => $lang['Submit'],
'L_OPT_OUT' => ( $userdata['user_report_optout'] ) ? $lang['Opt_in'] : $lang['Opt_out'],
'U_OPT_OUT' => ( $userdata['user_report_optout'] ) ? append_sid($phpbb_root_path . 'viewpost_reports.' . $phpEx . '?mode=optin') : append_sid($phpbb_root_path . 'viewpost_reports.' . $phpEx . '?mode=optout'),
'S_OPEN' => ( $status == REPORT_NEW ) ? ' selected="selected"' : '',
'S_CLOSED' => ( $status == REPORT_CLOSED ) ? ' selected="selected"' : '',
'S_ALL' => ( $status == 'all' ) ? ' selected="selected"' : '',
'S_ACTION' => append_sid($phpbb_root_path . 'viewpost_reports.'.$phpEx))
);
show_reports($status);
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
Geplaatst: 28 aug 2005, 16:55
door Paul
Zijn er wel reports?
Geplaatst: 28 aug 2005, 16:59
door Muiter
Die kan ik nu niet zien door deze melding.
Toen alles net goed werkte waren er wel rapporten en er staan ook een aantal in de database.
Geplaatst: 28 aug 2005, 17:04
door Paul
deze melding hoort als het goed is alleen te koment wanneer je een report delete

(Dan eigenlijk ook niet, het is dus vreemd dat hij hem geeft, als je dat niet ales mode hebt)
Geplaatst: 28 aug 2005, 18:12
door Muiter
Wat een ^&$&) mod. Hij werkt inderdaad goed maar geeft wel onnodige errors. Is dit op te lossen of kan ik beter een andere mod nemen?
Ik snap ook niet wat mijn moderators wel of niet kunnen doen in dat scherm.