Skip to content

Instantly share code, notes, and snippets.

@marc1706
Created October 5, 2013 14:14
Show Gist options
  • Save marc1706/6841419 to your computer and use it in GitHub Desktop.
Save marc1706/6841419 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<pmd-cpd>
<duplication lines="8" tokens="36">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/session.php" line="373"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/session.php" line="692"/>
<codefragment> if (strpos($this-&gt;ip, ':') !== false &amp;&amp; strpos($this-&gt;data['session_ip'], ':') !== false)
{
$s_ip = short_ipv6($this-&gt;data['session_ip'], $config['ip_check']);
$u_ip = short_ipv6($this-&gt;ip, $config['ip_check']);
}
else
{
$s_ip = implode('.', array_slice(explode('.', $this-&gt;data['session_ip']), 0, $config['ip_check']));
</codefragment>
</duplication>
<duplication lines="11" tokens="36">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/feed/topics.php" line="81"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/feed/overall.php" line="80"/>
<codefragment> 'ORDER_BY' =&gt; 'p.post_time DESC',
);
return true;
}
function adjust_item(&amp;$item_row, &amp;$row)
{
parent::adjust_item($item_row, $row);
$item_row['title'] = (isset($row['forum_name']) &amp;&amp; $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this-&gt;separator . ' ' . $item_row['title'] : $item_row['title'];
</codefragment>
</duplication>
<duplication lines="16" tokens="33">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/feed/topics.php" line="38"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/feed/news.php" line="66"/>
<codefragment> $in_fid_ary = array_diff($forum_ids_read, $this-&gt;get_excluded_forums(), $this-&gt;get_passworded_forums());
if (empty($in_fid_ary))
{
return false;
}
// We really have to get the post ids first!
$sql = 'SELECT topic_first_post_id, topic_time
FROM ' . TOPICS_TABLE . '
WHERE ' . $this-&gt;db-&gt;sql_in_set('forum_id', $in_fid_ary) . '
AND topic_moved_id = 0
AND topic_visibility = ' . ITEM_APPROVED . '
ORDER BY topic_time DESC';
$result = $this-&gt;db-&gt;sql_query_limit($sql, $this-&gt;num_items);
$post_ids = array();
</codefragment>
</duplication>
<duplication lines="21" tokens="13">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/auth/provider/apache.php" line="25"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/auth/provider/db.php" line="27"/>
<codefragment>class apache extends \phpbb\auth\provider\base
{
/**
* phpBB passwords manager
*
* @var \phpbb\passwords\manager
*/
protected $passwords_manager;
/**
* Apache Authentication Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\config\config $config
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\request\request $request
* @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
</codefragment>
</duplication>
<duplication lines="23" tokens="30">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/groupposition/legend.php" line="228"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/groupposition/teampage.php" line="581"/>
<codefragment> return false;
}
/**
* Get group type language var
*
* @param int $group_type group_type from the groups-table
* @return string name of the language variable for the given group-type.
*/
static public function group_type_language($group_type)
{
switch ($group_type)
{
case GROUP_OPEN:
return 'GROUP_REQUEST';
case GROUP_CLOSED:
return 'GROUP_CLOSED';
case GROUP_HIDDEN:
return 'GROUP_HIDDEN';
case GROUP_SPECIAL:
return 'GROUP_SPECIAL';
case GROUP_FREE:
return 'GROUP_OPEN';
</codefragment>
</duplication>
<duplication lines="26" tokens="49">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/cache/driver/file.php" line="444"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/cache/driver/memory.php" line="348"/>
<codefragment> function sql_exists($query_id)
{
return isset($this-&gt;sql_rowset[$query_id]);
}
/**
* Fetch row from cache (database)
*/
function sql_fetchrow($query_id)
{
if ($this-&gt;sql_row_pointer[$query_id] &lt; sizeof($this-&gt;sql_rowset[$query_id]))
{
return $this-&gt;sql_rowset[$query_id][$this-&gt;sql_row_pointer[$query_id]++];
}
return false;
}
/**
* Fetch a field from the current row of a cached database result (database)
*/
function sql_fetchfield($query_id, $field)
{
if ($this-&gt;sql_row_pointer[$query_id] &lt; sizeof($this-&gt;sql_rowset[$query_id]))
{
return (isset($this-&gt;sql_rowset[$query_id][$this-&gt;sql_row_pointer[$query_id]][$field])) ? $this-&gt;sql_rowset[$query_id][$this-&gt;sql_row_pointer[$query_id]++][$field] : false;
</codefragment>
</duplication>
<duplication lines="13" tokens="16">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/avatar/driver/driver.php" line="126"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/passwords/driver/base.php" line="56"/>
<codefragment> public function get_name()
{
return $this-&gt;name;
}
/**
* Sets the name of the driver.
*
* @param string $name Driver name
*/
public function set_name($name)
{
$this-&gt;name = $name;
</codefragment>
</duplication>
<duplication lines="35" tokens="59">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/search/fulltext_postgres.php" line="359"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/search/fulltext_mysql.php" line="370"/>
<codefragment> return false;
}
// generate a search_key from all the options to identify the results
$search_key = md5(implode('#', array(
implode(', ', $this-&gt;split_words),
$type,
$fields,
$terms,
$sort_days,
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
$post_visibility,
implode(',', $author_ary)
)));
if ($start &lt; 0)
{
$start = 0;
}
// try reading the results from cache
$result_count = 0;
if ($this-&gt;obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE)
{
return $result_count;
}
$id_ary = array();
$join_topic = ($type == 'posts') ? false : true;
// Build sql strings for sorting
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
</codefragment>
</duplication>
<duplication lines="83" tokens="148">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/search/fulltext_postgres.php" line="518"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/search/fulltext_mysql.php" line="514"/>
<codefragment> $id_ary[] = $row[$field];
}
$this-&gt;db-&gt;sql_freeresult($result);
$id_ary = array_unique($id_ary);
}
// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
$this-&gt;save_ids($search_key, implode(' ', $this-&gt;split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir);
$id_ary = array_slice($id_ary, 0, (int) $per_page);
return $result_count;
}
/**
* Performs a search on an author's posts without caring about message contents. Depends on display specific params
*
* @param string $type contains either posts or topics depending on what should be searched for
* @param boolean $firstpost_only if true, only topic starting posts will be considered
* @param array $sort_by_sql contains SQL code for the ORDER BY part of a query
* @param string $sort_key is the key of $sort_by_sql for the selected sorting
* @param string $sort_dir is either a or d representing ASC and DESC
* @param string $sort_days specifies the maximum amount of days a post may be old
* @param array $ex_fid_ary specifies an array of forum ids which should not be searched
* @param string $post_visibility specifies which types of posts the user can view in which forums
* @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched
* @param array $author_ary an array of author ids
* @param string $author_name specifies the author match, when ANONYMOUS is also a search-match
* @param array &amp;$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered
* @param int $start indicates the first index of the page
* @param int $per_page number of ids each page is supposed to contain
* @return boolean|int total number of results
*/
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &amp;$id_ary, &amp;$start, $per_page)
{
// No author? No posts
if (!sizeof($author_ary))
{
return 0;
}
// generate a search_key from all the options to identify the results
$search_key = md5(implode('#', array(
'',
$type,
($firstpost_only) ? 'firstpost' : '',
'',
'',
$sort_days,
$sort_key,
$topic_id,
implode(',', $ex_fid_ary),
$post_visibility,
implode(',', $author_ary),
$author_name,
)));
if ($start &lt; 0)
{
$start = 0;
}
// try reading the results from cache
$result_count = 0;
if ($this-&gt;obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE)
{
return $result_count;
}
$id_ary = array();
// Create some display specific sql strings
if ($author_name)
{
// first one matches post of registered users, second one guests and deleted users
$sql_author = '(' . $this-&gt;db-&gt;sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')';
}
else
{
$sql_author = $this-&gt;db-&gt;sql_in_set('p.poster_id', $author_ary);
}
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $this-&gt;db-&gt;sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
</codefragment>
</duplication>
<duplication lines="15" tokens="45">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/search/fulltext_postgres.php" line="711"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/search/fulltext_mysql.php" line="681"/>
<codefragment> if ($start &gt;= $result_count)
{
$start = floor(($result_count - 1) / $per_page) * $per_page;
$result = $this-&gt;db-&gt;sql_query_limit($sql, $this-&gt;config['search_block_size'], $start);
while ($row = $this-&gt;db-&gt;sql_fetchrow($result))
{
$id_ary[] = (int) $row[$field];
}
$this-&gt;db-&gt;sql_freeresult($result);
$id_ary = array_unique($id_ary);
}
if (sizeof($id_ary))
</codefragment>
</duplication>
<duplication lines="8" tokens="19">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="530"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql_odbc.php" line="375"/>
<codefragment> @ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="8" tokens="16">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql_odbc.php" line="186"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssqlnative.php" line="326"/>
<codefragment> if (defined('DEBUG'))
{
$this-&gt;sql_report('stop', $query);
}
if ($cache &amp;&amp; $cache_ttl)
{
$this-&gt;open_queries[(int) $this-&gt;query_result] = $this-&gt;query_result;
</codefragment>
</duplication>
<duplication lines="23" tokens="67">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql_odbc.php" line="181"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql.php" line="160"/>
<codefragment> if (($this-&gt;query_result = @odbc_exec($this-&gt;db_connect_id, $query)) === false)
{
$this-&gt;sql_error($query);
}
if (defined('DEBUG'))
{
$this-&gt;sql_report('stop', $query);
}
if ($cache &amp;&amp; $cache_ttl)
{
$this-&gt;open_queries[(int) $this-&gt;query_result] = $this-&gt;query_result;
$this-&gt;query_result = $cache-&gt;sql_save($this, $query, $this-&gt;query_result, $cache_ttl);
}
else if (strpos($query, 'SELECT') === 0 &amp;&amp; $this-&gt;query_result)
{
$this-&gt;open_queries[(int) $this-&gt;query_result] = $this-&gt;query_result;
}
}
else if (defined('DEBUG'))
{
$this-&gt;sql_report('fromcache', $query);
</codefragment>
</duplication>
<duplication lines="8" tokens="19">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="530"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql.php" line="464"/>
<codefragment> @ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="8" tokens="14">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql.php" line="160"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mysql.php" line="190"/>
<codefragment> if (($this-&gt;query_result = @mssql_query($query, $this-&gt;db_connect_id)) === false)
{
$this-&gt;sql_error($query);
}
if (defined('DEBUG'))
{
$this-&gt;sql_report('stop', $query);
</codefragment>
</duplication>
<duplication lines="8" tokens="19">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="530"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mysql.php" line="464"/>
<codefragment> @ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="8" tokens="16">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql_odbc.php" line="186"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/oracle.php" line="443"/>
<codefragment> if (defined('DEBUG'))
{
$this-&gt;sql_report('stop', $query);
}
if ($cache &amp;&amp; $cache_ttl)
{
$this-&gt;open_queries[(int) $this-&gt;query_result] = $this-&gt;query_result;
</codefragment>
</duplication>
<duplication lines="8" tokens="19">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="530"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/oracle.php" line="795"/>
<codefragment> @ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="13" tokens="27">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql.php" line="160"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/sqlite.php" line="144"/>
<codefragment> if (($this-&gt;query_result = @mssql_query($query, $this-&gt;db_connect_id)) === false)
{
$this-&gt;sql_error($query);
}
if (defined('DEBUG'))
{
$this-&gt;sql_report('stop', $query);
}
if ($cache &amp;&amp; $cache_ttl)
{
$this-&gt;open_queries[(int) $this-&gt;query_result] = $this-&gt;query_result;
</codefragment>
</duplication>
<duplication lines="6" tokens="18">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="532"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/sqlite.php" line="359"/>
<codefragment> $splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="8" tokens="14">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mssql_odbc.php" line="181"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/postgres.php" line="203"/>
<codefragment> if (($this-&gt;query_result = @odbc_exec($this-&gt;db_connect_id, $query)) === false)
{
$this-&gt;sql_error($query);
}
if (defined('DEBUG'))
{
$this-&gt;sql_report('stop', $query);
</codefragment>
</duplication>
<duplication lines="8" tokens="19">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="530"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/postgres.php" line="483"/>
<codefragment> @ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="8" tokens="19">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/firebird.php" line="530"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/driver/mysqli.php" line="455"/>
<codefragment> @ibase_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];
$this-&gt;sql_report('record_fromcache', $query, $endtime, $splittime);
break;
</codefragment>
</duplication>
<duplication lines="6" tokens="15">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/tools.php" line="142"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/tools.php" line="172"/>
<codefragment> 'mssql' =&gt; array(
'INT:' =&gt; '[int]',
'BINT' =&gt; '[float]',
'UINT' =&gt; '[int]',
'UINT:' =&gt; '[int]',
'TINT:' =&gt; '[int]',
</codefragment>
</duplication>
<duplication lines="8" tokens="15">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/tools.php" line="1771"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/tools.php" line="1886"/>
<codefragment> if (version_compare(sqlite_libversion(), '3.0') == -1)
{
$sql = "SELECT sql
FROM sqlite_master
WHERE type = 'table'
AND name = '{$table_name}'
ORDER BY type DESC, name;";
$result = $this-&gt;db-&gt;sql_query($sql);
</codefragment>
</duplication>
<duplication lines="8" tokens="12">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/tools.php" line="1778"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/tools.php" line="2087"/>
<codefragment> $result = $this-&gt;db-&gt;sql_query($sql);
if (!$result)
{
break;
}
$row = $this-&gt;db-&gt;sql_fetchrow($result);
</codefragment>
</duplication>
<duplication lines="9" tokens="29">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/migration/data/v310/notifications.php" line="27"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php" line="66"/>
<codefragment> 'add_tables' =&gt; array(
$this-&gt;table_prefix . 'notification_types' =&gt; array(
'COLUMNS' =&gt; array(
'notification_type' =&gt; array('VCHAR:255', ''),
'notification_type_enabled' =&gt; array('BOOL', 1),
),
'PRIMARY_KEY' =&gt; array('notification_type', 'notification_type_enabled'),
),
$this-&gt;table_prefix . 'notifications' =&gt; array(
</codefragment>
</duplication>
<duplication lines="8" tokens="6">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php" line="189"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php" line="66"/>
<codefragment> if ($converted_forums &lt; $limit)
{
// There are no more topics, we are done
return;
}
// There are still more topics to query, return the next start value
return $start + $limit;
</codefragment>
</duplication>
<duplication lines="9" tokens="14">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/migration/tool/permission.php" line="613"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/db/migration/tool/config.php" line="141"/>
<codefragment> $arguments[1],
$arguments[0],
);
break;
}
if ($call)
{
return call_user_func_array(array(&amp;$this, $call), $arguments);
</codefragment>
</duplication>
<duplication lines="39" tokens="68">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/report_pm.php" line="191"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/report_post.php" line="158"/>
<codefragment> $this-&gt;get_data('reason_description')
);
}
/**
* Get the user's avatar
*/
public function get_avatar()
{
return $this-&gt;user_loader-&gt;get_avatar($this-&gt;get_data('reporter_id'));
}
/**
* Users needed to query before this notification can be displayed
*
* @return array Array of user_ids
*/
public function users_to_query()
{
return array($this-&gt;get_data('reporter_id'));
}
/**
* Function for preparing the data for insertion in an SQL query
* (The service handles insertion)
*
* @param array $post Data from submit_post
* @param array $pre_create_data Data from pre_create_insert_array()
*
* @return array Array of data ready to be inserted into the database
*/
public function create_insert_array($post, $pre_create_data = array())
{
$this-&gt;set_data('reporter_id', $this-&gt;user-&gt;data['user_id']);
$this-&gt;set_data('reason_title', strtoupper($post['reason_title']));
$this-&gt;set_data('reason_description', $post['reason_description']);
$this-&gt;set_data('report_text', $post['report_text']);
return parent::create_insert_array($post, $pre_create_data);
</codefragment>
</duplication>
<duplication lines="17" tokens="45">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/quote.php" line="113"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/post.php" line="129"/>
<codefragment> sort($users);
$auth_read = $this-&gt;auth-&gt;acl_get_list($users, 'f_read', $post['forum_id']);
if (empty($auth_read))
{
return array();
}
$notify_users = $this-&gt;check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
$sql = 'SELECT n.*
FROM ' . $this-&gt;notifications_table . ' n, ' . $this-&gt;notification_types_table . ' nt
WHERE n.notification_type_id = ' . (int) $this-&gt;notification_type_id . '
AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . '
</codefragment>
</duplication>
<duplication lines="12" tokens="21">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/approve_post.php" line="51"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/approve_topic.php" line="51"/>
<codefragment> public static $notification_option = array(
'id' =&gt; 'moderation_queue',
'lang' =&gt; 'NOTIFICATION_TYPE_MODERATION_QUEUE',
'group' =&gt; 'NOTIFICATION_GROUP_POSTING',
);
/**
* Is available
*/
public function is_available()
{
return !$this-&gt;auth-&gt;acl_get('m_approve');
</codefragment>
</duplication>
<duplication lines="30" tokens="78">
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/quote.php" line="100"/>
<file path="/home/marc/Dokumente/Entwicklung/phpbb3/phpBB/phpbb/notification/type/bookmark.php" line="81"/>
<codefragment> WHERE ' . $this-&gt;db-&gt;sql_in_set('username_clean', $usernames) . '
AND user_id &lt;&gt; ' . (int) $post['poster_id'];
$result = $this-&gt;db-&gt;sql_query($sql);
while ($row = $this-&gt;db-&gt;sql_fetchrow($result))
{
$users[] = $row['user_id'];
}
$this-&gt;db-&gt;sql_freeresult($result);
if (empty($users))
{
return array();
}
sort($users);
$auth_read = $this-&gt;auth-&gt;acl_get_list($users, 'f_read', $post['forum_id']);
if (empty($auth_read))
{
return array();
}
$notify_users = $this-&gt;check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
$sql = 'SELECT n.*
FROM ' . $this-&gt;notifications_table . ' n, ' . $this-&gt;notification_types_table . ' nt
WHERE n.notification_type_id = ' . (int) $this-&gt;notification_type_id . '
AND n.item_parent_id = ' . (int) self::get_item_parent_id($post) . '
</codefragment>
</duplication>
</pmd-cpd>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment