Skip to content

Commit

Permalink
Check pre-query
Browse files Browse the repository at this point in the history
Check pre query to prevent duplicate listings.

Signed-off-by: sicommnend <>
  • Loading branch information
sicommnend authored and sicommnend committed Sep 14, 2016
1 parent 51ed73c commit c62c7de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions install.xml
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>NEND:clonetopic</id>
<version>0.4.3</version>
<version>0.4.5</version>
<file name="$boarddir/index.php">
<operation>
<search position="after"><![CDATA[ 'credits' => array('Who.php', 'Credits'),
Expand Down Expand Up @@ -123,8 +123,8 @@ $txt['permissionname_simple_clone_any'] = 'Clone anyone\'s topic';
WHERE t.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . ']]></search>
<add><![CDATA[
'.($clone_topics ? 'OR t.id_topic IN ({array_int:clone_topics})' : '' ).(!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') .']]></add>
'.($clone_topics ? 'OR t.id_topic IN ({array_int:clone_topics})'.(!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') : '' ) .']]></add>
</operation>
<operation>
<search position="before"><![CDATA[ ORDER BY ' . (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . '
Expand Down Expand Up @@ -161,8 +161,8 @@ $txt['permissionname_simple_clone_any'] = 'Clone anyone\'s topic';
WHERE ' . ($pre_query ? 't.id_topic IN ({array_int:topic_list})' : 't.id_board = {int:current_board}') . (!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') . ']]></search>
<add><![CDATA[
'.($clone_topics ? 'OR t.id_topic IN ({array_int:clone_topics})' : '' ).(!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') .']]></add>
'.($clone_topics && !$pre_query ? 'OR t.id_topic IN ({array_int:clone_topics})'.(!$modSettings['postmod_active'] || $context['can_approve_posts'] ? '' : '
AND (t.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR t.id_member_started = {int:current_member}') . ')') : '' ) .']]></add>
</operation>
<operation>
<search position="before"><![CDATA[ ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '
Expand Down
2 changes: 1 addition & 1 deletion package-info.xml
Expand Up @@ -3,7 +3,7 @@
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
<id>NEND:clonetopic</id>
<name>Clone Topic</name>
<version>0.4.3</version>
<version>0.4.5</version>
<type>modification</type>
<install>
<database>db.php</database>
Expand Down

0 comments on commit c62c7de

Please sign in to comment.