Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-12886

Redundant lock and unlock expressions for QuickMod in viewtopic.php

    Details

      Description

      And it seems to be unintentional:
      *lock*

      'lock'					=> array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),

      Line breaks:

      'lock'					=> array('LOCK_TOPIC', 
      	($topic_data['topic_status'] == ITEM_UNLOCKED) &&
      	(
      		$auth->acl_get('m_lock', $forum_id) ||
      		(
      			$auth->acl_get('f_user_lock', $forum_id) &&
      			$user->data['is_registered'] &&
      			$user->data['user_id'] == $topic_data['topic_poster'] &&
      			$topic_data['topic_status'] == ITEM_UNLOCKED
      		)
      	)
      ),

      *unlock*

      'unlock'				=> array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),

      Line breaks:

      'unlock'				=> array('UNLOCK_TOPIC',
      	($topic_data['topic_status'] != ITEM_UNLOCKED) &&
      	(
      		$auth->acl_get('m_lock', $forum_id) ||
      		(
      			$auth->acl_get('f_user_lock', $forum_id) &&
      			$user->data['is_registered'] &&
      			$user->data['user_id'] == $topic_data['topic_poster'] &&
      			$topic_data['topic_status'] == ITEM_UNLOCKED
      		)
      	)
      ),

      The second topic status in the lock check is redundant.
      The second one in the unlock check is never true, due to the first topic status comparison. I think it should be != ITEM_UNLOCKED there aswell and then its redundant and can be removed aswell.

      If we do not want f_user_lock to be able to unlock topics, it should be

      'unlock'				=> array('UNLOCK_TOPIC', $topic_data['topic_status'] != ITEM_UNLOCKED) && $auth->acl_get('m_lock', $forum_id)),

      instead.
      But the current statement is just non-sense

        Attachments

          Activity

            People

            • Assignee:
              Marc Marc
              Reporter:
              nickvergessen Joas Schilling
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: