phpBB

Code Changes

File: mcp.php

  Unmodified   Added   Modified   Removed
Line 77Line 77
$post_id = request_var('p', 0);
$topic_id = request_var('t', 0);
$forum_id = request_var('f', 0);

$post_id = request_var('p', 0);
$topic_id = request_var('t', 0);
$forum_id = request_var('f', 0);

 
$report_id = request_var('r', 0);

$user_id = request_var('u', 0);
$username = utf8_normalize_nfc(request_var('username', '', true));


$user_id = request_var('u', 0);
$username = utf8_normalize_nfc(request_var('username', '', true));


Line 166Line 167
		case 'delete_post':
case 'delete_topic':
$module->load('mcp', 'main', 'quickmod');

		case 'delete_post':
case 'delete_topic':
$module->load('mcp', 'main', 'quickmod');

			exit;

			return;

		break;

case 'topic_logs':

		break;

case 'topic_logs':

 
			// Reset start parameter if we jumped from the quickmod dropdown
if (request_var('start', 0))
{
$_REQUEST['start'] = 0;
}


			$module->set_active('logs', 'topic_logs');
break;


			$module->set_active('logs', 'topic_logs');
break;


Line 183Line 190
		break;

default:

		break;

default:

			trigger_error("$action not allowed as quickmod");


			trigger_error("$action not allowed as quickmod", E_USER_ERROR);
break;

	}
}
else

	}
}
else

Line 204Line 212
	$module->set_display('queue', 'approve_details', false);
}


	$module->set_display('queue', 'approve_details', false);
}


if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed')

if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'pm_report_details')

{
$module->set_display('reports', 'report_details', false);

{
$module->set_display('reports', 'report_details', false);

 
}

if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'report_details')
{
$module->set_display('pm_reports', 'pm_report_details', false);

}

if (!$topic_id)

}

if (!$topic_id)

Line 316Line 329

function extra_url()
{


function extra_url()
{

	global $forum_id, $topic_id, $post_id, $user_id;

	global $forum_id, $topic_id, $post_id, $report_id, $user_id;


$url_extra = '';
$url_extra .= ($forum_id) ? "&f=$forum_id" : '';
$url_extra .= ($topic_id) ? "&t=$topic_id" : '';
$url_extra .= ($post_id) ? "&p=$post_id" : '';
$url_extra .= ($user_id) ? "&u=$user_id" : '';


$url_extra = '';
$url_extra .= ($forum_id) ? "&f=$forum_id" : '';
$url_extra .= ($topic_id) ? "&t=$topic_id" : '';
$url_extra .= ($post_id) ? "&p=$post_id" : '';
$url_extra .= ($user_id) ? "&u=$user_id" : '';

 
	$url_extra .= ($report_id) ? "&r=$report_id" : '';


return $url_extra;
}


return $url_extra;
}

Line 550Line 564
		}

$rowset[$row['forum_id']] = $row;

		}

$rowset[$row['forum_id']] = $row;

 
	}
$db->sql_freeresult($result);

return $rowset;
}

/**
* Get simple pm data
*/
function get_pm_data($pm_ids)
{
global $db, $auth, $config, $user;

$rowset = array();

if (!sizeof($pm_ids))
{
return array();
}

$sql_array = array(
'SELECT' => 'p.*, u.*',

'FROM' => array(
USERS_TABLE => 'u',
PRIVMSGS_TABLE => 'p',
),

'WHERE' => $db->sql_in_set('p.msg_id', $pm_ids) . '
AND u.user_id = p.author_id',
);

$sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
unset($sql_array);

while ($row = $db->sql_fetchrow($result))
{
$rowset[$row['msg_id']] = $row;

	}
$db->sql_freeresult($result);


	}
$db->sql_freeresult($result);


Line 560Line 613
* sorting in mcp
*
* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR

* sorting in mcp
*
* @param string $where_sql should either be WHERE (default if ommited) or end with AND or OR

 
*
* $mode reports and reports_closed: the $where parameters uses aliases p for posts table and r for report table
* $mode unapproved_posts: the $where parameters uses aliases p for posts table and t for topic table

*/
function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
{

*/
function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, &$sort_order_sql, &$total, $forum_id = 0, $topic_id = 0, $where_sql = 'WHERE')
{

Line 607Line 663
			$type = 'posts';
$default_key = 't';
$default_dir = 'd';

			$type = 'posts';
$default_key = 't';
$default_dir = 'd';

			$where_sql .= ($topic_id) ? ' topic_id = ' . $topic_id . ' AND' : '';

			$where_sql .= ($topic_id) ? ' p.topic_id = ' . $topic_id . ' AND' : '';





			$sql = 'SELECT COUNT(post_id) AS total
FROM ' . POSTS_TABLE . "
$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : get_forum_list('m_approve')) . '
AND post_approved = 0';



			$sql = 'SELECT COUNT(p.post_id) AS total
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
$where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
AND p.post_approved = 0
AND t.topic_id = p.topic_id
AND t.topic_first_post_id <> p.post_id';


if ($min_time)
{


if ($min_time)
{

Line 627Line 685

$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "


$sql = 'SELECT COUNT(topic_id) AS total
FROM ' . TOPICS_TABLE . "

				$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : get_forum_list('m_approve')) . '

				$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '

					AND topic_approved = 0';

if ($min_time)

					AND topic_approved = 0';

if ($min_time)

Line 636Line 694
			}
break;


			}
break;


 
		case 'pm_reports':
case 'pm_reports_closed':

		case 'reports':
case 'reports_closed':

		case 'reports':
case 'reports_closed':

			$type = 'reports';



			$pm = (strpos($mode, 'pm_') === 0) ? true : false;

$type = ($pm) ? 'pm_reports' : 'reports';

			$default_key = 't';
$default_dir = 'd';
$limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : '';

if ($topic_id)
{

			$default_key = 't';
$default_dir = 'd';
$limit_time_sql = ($min_time) ? "AND r.report_time >= $min_time" : '';

if ($topic_id)
{

				$where_sql .= ' p.topic_id = ' . $topic_id;

				$where_sql .= ' p.topic_id = ' . $topic_id . ' AND ';

			}
else if ($forum_id)
{

			}
else if ($forum_id)
{

				$where_sql .= ' p.forum_id = ' . $forum_id;

				$where_sql .= ' p.forum_id = ' . $forum_id . ' AND ';

			}

			}

			else

			else if (!$pm)

			{

			{

				$where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list('!m_report'), true, true);

				$where_sql .= ' ' . $db->sql_in_set('p.forum_id', get_forum_list(array('!f_read', '!m_report')), true, true) . ' AND ';

			}


			}


			if ($mode == 'reports')

			if ($mode == 'reports' || $mode == 'pm_reports')

			{

			{

				$where_sql .= ' AND r.report_closed = 0';

				$where_sql .= ' r.report_closed = 0 AND ';

			}
else
{

			}
else
{

				$where_sql .= ' AND r.report_closed = 1';

				$where_sql .= ' r.report_closed = 1 AND ';

			}


			}


 
			if ($pm)
{
$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . PRIVMSGS_TABLE . " p
$where_sql r.post_id = 0
AND p.msg_id = r.pm_id
$limit_time_sql";
}
else
{

			$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p

			$sql = 'SELECT COUNT(r.report_id) AS total
FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . " p

				$where_sql

					$where_sql r.pm_id = 0

					AND p.post_id = r.post_id
$limit_time_sql";

					AND p.post_id = r.post_id
$limit_time_sql";

 
			}

		break;

case 'viewlogs':

		break;

case 'viewlogs':

Line 679Line 752

$sql = 'SELECT COUNT(log_id) AS total
FROM ' . LOG_TABLE . "


$sql = 'SELECT COUNT(log_id) AS total
FROM ' . LOG_TABLE . "

				$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : get_forum_list('m_')) . '

				$where_sql " . $db->sql_in_set('forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_'))) . '

					AND log_time >= ' . $min_time . '
AND log_type = ' . LOG_MOD;
break;

					AND log_time >= ' . $min_time . '
AND log_type = ' . LOG_MOD;
break;

Line 710Line 783
			$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject');

			$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject');

 
		break;

case 'pm_reports':
$limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
$sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']);
$sort_by_sql = array('a' => 'u.username_clean', 'r' => 'ru.username', 'p' => 'p.message_time', 't' => 'r.report_time', 's' => 'p.message_subject');

		break;

case 'logs':

		break;

case 'logs':