karma.php
author Adriano Pereira <adrianopt2@gmail.com>
Sat, 14 Aug 2010 08:57:24 +0100
changeset 2 75450c27099a
parent 1 87ba86c9d5a6
permissions -rw-r--r--
Added tag 1.0 for changeset 87ba86c9d5a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     1
<?php
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     2
/**!info**
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     3
{
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     4
  "Plugin Name"  : "Karma",
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
     5
  "Plugin URI"   : "http://enanocms.org/plugin/karma",
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     6
  "Description"  : "Karma is a plugin that enables in the user page a voting system, to evaluate the popularity of each member.",
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     7
  "Author"       : "Adriano Pereira",
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     8
  "Version"      : "1.0",
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
     9
  "Author URI"   : "http://enanocms.org/"
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    10
}
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    11
**!*/
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    12
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    13
$plugins->attachHook('userpage_sidebar_left',  'karma();');
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    14
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    15
function karma()
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    16
{
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    17
  // Importing...
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    18
  global $db, $session, $paths;
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    19
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    20
  if($session->user_logged_in)
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    21
  {  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    22
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    23
  // If the user votes, get the vote
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    24
  $vote = !empty($_GET['vote']) && in_array($_GET['vote'], array('Yes', 'No'))
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    25
            ? $_GET['vote']
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    26
            : null;
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    27
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    28
  // Get the user_id from the user that is voting
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    29
  $user_voting_id = $session->user_id;
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    30
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    31
  // Find the page_id that is the username of the current user page and gets the user_id from database
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    32
  $username = str_replace('_', ' ', dirtify_page_id($paths->page_id));
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    33
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    34
  $q = $db->sql_query('SELECT user_id FROM '. table_prefix. "users WHERE username = '$username'");
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    35
  if ( !$q )
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    36
    $db->_die();
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    37
  $voted = $db->fetchrow();
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    38
  $user_voted_id = $voted['user_id'];
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    39
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    40
  // Retrieves from database the total votes, yes votes, no votes and the karma from user
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    41
  $q = $db->sql_query('SELECT karma_yes_votes, karma_no_votes, (karma_yes_votes + karma_no_votes) AS karma_total_votes, (karma_yes_votes - karma_no_votes) AS karma FROM '. table_prefix."users_extra WHERE user_id = '$user_voted_id'");
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    42
  if ( !$q )
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    43
    $db->_die();
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    44
  $karma_info = $db->fetchrow();
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    45
  $total_votes = $karma_info['karma_total_votes'];
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    46
  $yes_votes = $karma_info['karma_yes_votes'];
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    47
  $no_votes = $karma_info['karma_no_votes'];
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    48
  $karma = $karma_info['karma'];
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    49
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    50
  // Search in the database if the user has already voted in this user
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    51
  $q = $db->sql_query('SELECT user_voted_id, user_voting_id FROM '. table_prefix."karma WHERE user_voted_id = '$user_voted_id' AND user_voting_id = '$user_voting_id'");
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    52
  if ( !$q )
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    53
    $db->_die();
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    54
  $num_votes = $db->numrows();
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    55
  $db->free_result();
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    56
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    57
  // If the user that votes and the user voted id is equal or the user has already voted, displays the commom page
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    58
  
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    59
  // If we're on our own user page, block voting
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    60
  $same_user = $user_voting_id === $user_voted_id;
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    61
  
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    62
  // If we have not yet voted on this user, allow that to take place below
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    63
  $can_vote = $num_votes == 0 && !$same_user && $session->user_level >= USER_LEVEL_MEMBER;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    64
  
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    65
  echo "<th colspan='4'>$username's karma</th>";
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    66
  
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    67
  $did_vote = false;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    68
  if ( $can_vote )
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
    69
  {
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    70
    // Know if the vote is yes or no and do the respective action in database
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    71
    $increment_col = !empty($vote) && $vote == 'Yes' ? 'karma_yes_votes' : 'karma_no_votes';
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    72
    if ( !empty($vote) )
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    73
    {
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    74
      $q = $db->sql_query('INSERT INTO '. table_prefix."karma (user_voting_id, user_voted_id) VALUES ('$user_voting_id', '$user_voted_id')");
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    75
      if ( !$q )
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    76
        $db->_die();
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    77
      $q = $db->sql_query('UPDATE '. table_prefix."users_extra SET $increment_col = $increment_col + 1");
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    78
        if ( !$q )
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    79
          $db->_die();
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    80
        
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    81
      if ( $vote == 'Yes' )
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    82
        $yes_votes++;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    83
      else
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    84
        $no_votes++;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    85
        
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    86
      // recalculate
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    87
      $karma = $yes_votes - $no_votes;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    88
      $total_votes = $yes_votes + $no_votes;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    89
      
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    90
      $did_vote = true;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    91
    }
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    92
    else
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    93
    {
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    94
      // Label to commom page title
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    95
      echo <<<EOF
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    96
        <tr>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    97
        <td colspan="4" class="row3" style="text-align: center;">
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    98
        <b>Do you like me?</b><br/>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
    99
        <form action="">
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   100
          <input type="submit" value="Yes" name="vote" style="background-color: #00CA00; border: 2px solid #000000; width: 40px; color: #FFFFFF; font-size: 14px; text-align:center;">
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   101
          <input type="submit" value="No" name="vote" style="background-color: #FA1205; border: 2px solid #000000; width: 40px; color: #FFFFFF; font-size: 14px; text-align:center;">
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   102
        </form>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   103
      </tr>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   104
EOF;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   105
    }
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   106
  }
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   107
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   108
  // Label to commom page content and page content
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   109
  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   110
  if ($karma < 0)
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   111
  {
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   112
	  $karma_color = '#FA1205';
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   113
  }
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   114
  elseif ($karma > 0)
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   115
  { 
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   116
    $karma_color = '#00CA00';
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   117
  }
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   118
  else
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   119
  {
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   120
    $karma_color = '#000000';
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   121
  }
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   122
?>
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   123
  <?php if ( $did_vote ): ?>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   124
    <tr>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   125
      <td colspan="4" class="row3">
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   126
        <div class="info-box-mini">Thanks for voting for this user's karma.</div>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   127
      </td>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   128
    </tr>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   129
  <?php endif; ?>
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   130
    
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   131
	<tr>
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   132
	
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   133
		<td colspan="2" class="row1">
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   134
      Your Karma is: <span style="color: <?php echo $karma_color; ?>;"><?php echo $karma;?><br/></font>
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   135
		</td>
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   136
		
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   137
		<td colspan="2" class="row2">
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   138
			'Yes' votes: <?php echo $yes_votes;?><br/>
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   139
			'No' votes: <?php echo $no_votes;?><br/>
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   140
			Number of votes: <?php echo $total_votes;?><br/>			
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   141
		</td>
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   142
	</tr>
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   143
<?php
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   144
}
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   145
}
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   146
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   147
/**!install dbms="mysql"; **
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   148
CREATE TABLE {{TABLE_PREFIX}}karma(
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   149
  vote_id int(18) NOT NULL auto_increment,
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   150
  user_voting_id int(12),
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   151
  user_voted_id int(12),  
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   152
  PRIMARY KEY ( vote_id )
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   153
 ) ENGINE=`MyISAM` CHARSET=`UTF8` COLLATE=`utf8_bin`;
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   154
 
1
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   155
ALTER TABLE {{TABLE_PREFIX}}users_extra ADD COLUMN karma_yes_votes int(12) NOT NULL DEFAULT 0;
87ba86c9d5a6 Fixed and cleaned up
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   156
ALTER TABLE {{TABLE_PREFIX}}users_extra ADD COLUMN karma_no_votes int(12) NOT NULL DEFAULT 0;
0
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   157
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   158
**!*/
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   159
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   160
/**!uninstall **
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   161
DROP TABLE {{TABLE_PREFIX}}karma;
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   162
ALTER TABLE {{TABLE_PREFIX}}users_extra DROP karma_yes_votes;
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   163
ALTER TABLE {{TABLE_PREFIX}}users_extra DROP karma_no_votes;
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   164
**!*/
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   165
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   166
6904847e956b First revision
Adriano Pereira <adrianopt2@gmail.com>
parents:
diff changeset
   167
?>