Share Pastebin
Guest
Public paste!

vigge_sWe

By: a guest | Mar 18th, 2010 | Syntax: PHP | Size: 2.79 KB | Hits: 44 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. // Start Ultimate Points
  2.                                 $p_poll_received = $p_topic_received = $p_post_received = '';
  3.                                
  4.                                 // Check the forum points in the forum tables
  5.                                 $p_pertopic = $p_perpost = $p_peredit = '';
  6.                                
  7.                                 $sql = 'SELECT forum_pertopic, forum_perpost, forum_peredit
  8.                                         FROM ' . FORUMS_TABLE . '
  9.                                         WHERE forum_id = ' . $data['forum_id'];
  10.                                 $result = $db->sql_query_limit($sql, 1);
  11.                                 $forumrow = $db->sql_fetchrow($result);
  12.                                 $db->sql_freeresult($result);
  13.  
  14.                                 // Now let's define the variables with the points from the forum
  15.                                 $p_pertopic     = $forumrow['forum_pertopic'];
  16.                                 $p_perpost      = $forumrow['forum_perpost'];
  17.                                 $p_peredit      = $forumrow['forum_peredit'];
  18.  
  19.                                 // Check the rest of the points
  20.                                 $sql = 'SELECT points_poll_received, points_topic_received, points_post_received, poster_id
  21.                                         FROM ' . POSTS_TABLE . '
  22.                                         WHERE post_id = ' . $data['post_id'];
  23.                                 $result = $db->sql_query_limit($sql, 1);
  24.                                 $row = $db->sql_fetchrow($result);
  25.                                 $db->sql_freeresult($result);
  26.  
  27.                                 // Now let's define the variables with the points for the post
  28.                                 $p_poll_received        = $row['points_poll_received'];
  29.                                 $p_topic_received       = $row['points_topic_received'];
  30.                                 $p_post_received        = $row['points_post_received'];
  31.  
  32.                                 // If the topic_received greater than 0 and pertopic = 1
  33.                                 if ( ($p_topic_received > 0) && ($p_pertopic > 0) && $points_config['pertopic_enable'])
  34.                                 {
  35.                                         // First substract points from user account
  36.                                         substract_points($row['poster_id'], $p_topic_received);
  37.  
  38.                                         // Reset the field $p_topic_received
  39.                                         reset_topic_received($data['post_id']);
  40.                                        
  41.                                         // Now recalculate points
  42.                                         $ultimate_points->update_topic_ch($data['poster_id'], $data['forum_id'], $data['topic_id'], $ultimate_points->strip_text($data['message']));
  43.                                 }
  44.  
  45.                                 // If the post_received is greater than 0 and and perpost = 1
  46.                                 if ( ($p_post_received > 0) && ($p_perpost > 0) && $points_config['perpost_enable'])
  47.                                 {
  48.                                         // First substract old post received points from user points
  49.                                         substract_points($row['poster_id'], $p_post_received);
  50.  
  51.                                         // Now substract the post received points from the post table
  52.                                         reset_post_received($data['post_id']);
  53.                                        
  54.                                         // Now update the post table
  55.                                         $ultimate_points->update_post_ch($data['poster_id'], $data['forum_id'], $data['post_id'], $ultimate_points->strip_text($data['message']));
  56.                                 }
  57.  
  58.                                 //  If the poll_reveived greater than 0 and topic received = 0  and pertopic = 1
  59.                                 if ( ($p_poll_received > 0) && ($p_pertopic > 0) && ($p_topic_received == 0) && ($points_config['pertopic_enable']) )
  60.                                 {
  61.                                         // Update Poll Text with new topic
  62.                                         $ultimate_points->update_topic_ch($poster_id, $data['forum_id'], $data['topic_id'], $ultimate_points->strip_text($data['message']));
  63.                                 }                              
  64.                                 // End Ultimate Points