phpBB

Code Changes

File: phpbb/log/log.php

  Unmodified   Added   Modified   Removed
Line 229Line 229
		}

$sql_ary = array(

		}

$sql_ary = array(

			'user_id'		=> $user_id,
'log_ip' => $log_ip,

			'user_id'		=> !empty($user_id) ? $user_id : ANONYMOUS,
'log_ip' => !empty($log_ip) ? $log_ip : '',

			'log_time'		=> $log_time,
'log_operation' => $log_operation,
);

			'log_time'		=> $log_time,
'log_operation' => $log_operation,
);

Line 402Line 402
			}
}


			}
}


		$sql = 'DELETE FROM ' . LOG_TABLE . "

		$sql = 'DELETE FROM ' . $this->log_table . "

					$sql_where";
$this->db->sql_query($sql);


					$sql_where";
$this->db->sql_query($sql);


Line 521Line 521
			$sql_keywords = $this->generate_sql_keyword($keywords);
}


			$sql_keywords = $this->generate_sql_keyword($keywords);
}


		if ($count_logs)
{
$sql = 'SELECT COUNT(l.log_id) AS total_entries
FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
WHERE l.log_type = ' . (int) $log_type . '



		$get_logs_sql_ary = array(
'SELECT' => 'l.*, u.username, u.username_clean, u.user_colour',
'FROM' => array(
$this->log_table => 'l',
USERS_TABLE => 'u',
),
'WHERE' => 'l.log_type = ' . (int) $log_type . "

					AND l.user_id = u.user_id

					AND l.user_id = u.user_id

					AND l.log_time >= ' . (int) $log_time . "

 
					$sql_keywords

					$sql_keywords

					$sql_additional";






























































					$sql_additional",

'ORDER_BY' => $sort_by,
);

if ($log_time)
{
$get_logs_sql_ary['WHERE'] = 'l.log_time >= ' . (int) $log_time . '
AND ' . $get_logs_sql_ary['WHERE'];
}

/**
* Modify the query to obtain the logs data
*
* @event core.get_logs_main_query_before
* @var array get_logs_sql_ary The array in the format of the query builder with the query
* to get the log count and the log list
* @var string mode Mode of the entries we display
* @var bool count_logs Do we count all matching entries?
* @var int limit Limit the number of entries
* @var int offset Offset when fetching the entries
* @var mixed forum_id Limit entries to the forum_id,
* can also be an array of forum_ids
* @var int topic_id Limit entries to the topic_id
* @var int user_id Limit entries to the user_id
* @var int log_time Limit maximum age of log entries
* @var string sort_by SQL order option
* @var string keywords Will only return entries that have the
* keywords in log_operation or log_data
* @var string profile_url URL to the users profile
* @var int log_type Limit logs to a certain type. If log_type
* is false, no entries will be returned.
* @var string sql_additional Additional conditions for the entries,
* e.g.: 'AND l.forum_id = 1'
* @since 3.1.5-RC1
*/
$vars = array(
'get_logs_sql_ary',
'mode',
'count_logs',
'limit',
'offset',
'forum_id',
'topic_id',
'user_id',
'log_time',
'sort_by',
'keywords',
'profile_url',
'log_type',
'sql_additional',
);
extract($this->dispatcher->trigger_event('core.get_logs_main_query_before', compact($vars)));

if ($count_logs)
{
$count_logs_sql_ary = $get_logs_sql_ary;

$count_logs_sql_ary['SELECT'] = 'COUNT(l.log_id) AS total_entries';
unset($count_logs_sql_ary['ORDER_BY']);

$sql = $this->db->sql_build_query('SELECT', $count_logs_sql_ary);

			$result = $this->db->sql_query($sql);
$this->entry_count = (int) $this->db->sql_fetchfield('total_entries');
$this->db->sql_freeresult($result);

			$result = $this->db->sql_query($sql);
$this->entry_count = (int) $this->db->sql_fetchfield('total_entries');
$this->db->sql_freeresult($result);

Line 548Line 610
			}
}


			}
}


		$sql = 'SELECT l.*, u.username, u.username_clean, u.user_colour
FROM ' . $this->log_table . ' l, ' . USERS_TABLE . ' u
WHERE l.log_type = ' . (int) $log_type . '
AND u.user_id = l.user_id
' . (($log_time) ? 'AND l.log_time >= ' . (int) $log_time : '') . "
$sql_keywords
$sql_additional
ORDER BY $sort_by";

		$sql = $this->db->sql_build_query('SELECT', $get_logs_sql_ary);








		$result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset);

$i = 0;

		$result = $this->db->sql_query_limit($sql, $limit, $this->last_page_offset);

$i = 0;

Line 707Line 762
				$log[$key]['reportee_username_full'] = get_username_string('full', $row['reportee_id'], $reportee_data_list[$row['reportee_id']]['username'], $reportee_data_list[$row['reportee_id']]['user_colour'], false, $profile_url);
}
}

				$log[$key]['reportee_username_full'] = get_username_string('full', $row['reportee_id'], $reportee_data_list[$row['reportee_id']]['username'], $reportee_data_list[$row['reportee_id']]['user_colour'], false, $profile_url);
}
}

 

/**
* Allow modifying or execute extra final filter on log entries
*
* @event core.get_logs_after
* @var array log Array with all our log entries
* @var array topic_id_list Array of topic ids, for which we
* get the permission data
* @var array reportee_id_list Array of additional user IDs we
* get the username strings for
* @var string mode Mode of the entries we display
* @var bool count_logs Do we count all matching entries?
* @var int limit Limit the number of entries
* @var int offset Offset when fetching the entries
* @var mixed forum_id Limit entries to the forum_id,
* can also be an array of forum_ids
* @var int topic_id Limit entries to the topic_id
* @var int user_id Limit entries to the user_id
* @var int log_time Limit maximum age of log entries
* @var string sort_by SQL order option
* @var string keywords Will only return entries that have the
* keywords in log_operation or log_data
* @var string profile_url URL to the users profile
* @var int log_type The type of logs it was filtered
* @since 3.1.3-RC1
*/
$vars = array(
'log',
'topic_id_list',
'reportee_id_list',
'mode',
'count_logs',
'limit',
'offset',
'forum_id',
'topic_id',
'user_id',
'log_time',
'sort_by',
'keywords',
'profile_url',
'log_type',
);
extract($this->dispatcher->trigger_event('core.get_logs_after', compact($vars)));


return $log;
}


return $log;
}

Line 794Line 893
		$forum_auth = array('f_read' => array(), 'm_' => array());
$topic_ids = array_unique($topic_ids);


		$forum_auth = array('f_read' => array(), 'm_' => array());
$topic_ids = array_unique($topic_ids);


		$sql = 'SELECT topic_id, forum_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids));





















		$sql_ary = array(
'SELECT' => 'topic_id, forum_id',
'FROM' => array(
TOPICS_TABLE => 't',
),
'WHERE' => $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)),
);

/**
* Allow modifying SQL query before topic data is retrieved.
*
* @event core.phpbb_log_get_topic_auth_sql_before
* @var array topic_ids Array with unique topic IDs
* @var array sql_ary SQL array
* @since 3.1.11-RC1
*/
$vars = array(
'topic_ids',
'sql_ary',
);
extract($this->dispatcher->trigger_event('core.phpbb_log_get_topic_auth_sql_before', compact($vars)));

$sql = $this->db->sql_build_query('SELECT', $sql_ary);

		$result = $this->db->sql_query($sql);

while ($row = $this->db->sql_fetchrow($result))

		$result = $this->db->sql_query($sql);

while ($row = $this->db->sql_fetchrow($result))