Fork me on GitHub

Comment by quy (2016-01-12 16:42:12)

Edited by quy (2016-01-12 16:45:05)

 1:  1:
 I know this is sort of "hackish", but would you be ok with this to keep the changes minimal/simple? The message is hardcoded for now, but will be in $lang_misc. Also, are you ok with the wordings of the message? I know this is sort of "hackish", but would you be ok with this to keep the changes minimal/simple? The message is hardcoded for now, but will be in $lang_misc. Also, are you ok with the wordings of the message?
  
 [code]  [code]
  if ($topic_id)   if ($topic_id)
  {   {
  if ($pun_config['o_topic_subscriptions'] != '1')   if ($pun_config['o_topic_subscriptions'] != '1')
  message($lang_common['No permission'], false, '403 Forbidden');   message($lang_common['No permission'], false, '403 Forbidden');
   
  if (!isset($_GET['csrf_token']))   if (!isset($_GET['csrf_token']))
  {   {
  $token_url = '&csrf_token='.pun_csrf_token();   $token_url = '&csrf_token='.pun_csrf_token();
   
- message('Click <a href="misc.php?action=unsubscribe&tid='.$topic_id.$token_url.'">here</a> to confirm unsubscribing.', true); + message('Click <a href="misc.php?action=unsubscribe&tid='.$topic_id.$token_url.'">here</a> to confirm unsubscribing.', true);
  }   }
  else   else
  check_csrf($_GET['csrf_token']);   check_csrf($_GET['csrf_token']);
   
  $result = $db->query('SELECT 1 FROM '.$db->prefix.'topic_subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$topic_id) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());   $result = $db->query('SELECT 1 FROM '.$db->prefix.'topic_subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$topic_id) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
  if (!$db->num_rows($result))   if (!$db->num_rows($result))
  message($lang_misc['Not subscribed topic']);   message($lang_misc['Not subscribed topic']);
   
  $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$topic_id) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());   $db->query('DELETE FROM '.$db->prefix.'topic_subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$topic_id) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());
   
  redirect('viewtopic.php?id='.$topic_id, $lang_misc['Unsubscribe redirect']);   redirect('viewtopic.php?id='.$topic_id, $lang_misc['Unsubscribe redirect']);
  }   }
 [/code] [/code]