752 'dateline' => $dateline, |
752 'dateline' => $dateline, |
753 'action' => $log_entry['action'] |
753 'action' => $log_entry['action'] |
754 ); |
754 ); |
755 |
755 |
756 break; |
756 break; |
|
757 case 'votereset': |
|
758 if ( !$this->perms->get_permissions('history_rollback_extra') ) |
|
759 return 'Denied!'; |
|
760 |
|
761 // pull existing vote data |
|
762 $q = $db->sql_query('SELECT delvotes, delvote_ips FROM ' . table_prefix . "pages WHERE urlname = '$this->page_id' AND namespace = '$this->namespace';"); |
|
763 if ( !$q ) |
|
764 $db->_die(); |
|
765 |
|
766 if ( $db->numrows() < 1 ) |
|
767 return array( |
|
768 'success' => false, |
|
769 'error' => 'page_not_exist', |
|
770 'action' => $log_entry['action'] |
|
771 ); |
|
772 |
|
773 list($curr_delvotes, $curr_delvote_ips) = $db->fetchrow_num(); |
|
774 $db->free_result(); |
|
775 |
|
776 // merge with existing votes |
|
777 $old_delvote_ips = unserialize($log_entry['page_text']); |
|
778 $new_delvote_ips = unserialize($curr_delvote_ips); |
|
779 $new_delvote_ips['u'] = array_unique(array_merge($new_delvote_ips['u'], $old_delvote_ips['u'])); |
|
780 $new_delvote_ips['ip'] = array_unique(array_merge($new_delvote_ips['ip'], $old_delvote_ips['ip'])); |
|
781 $new_delvotes = count($new_delvote_ips['ip']); |
|
782 $new_delvote_ips = $db->escape(serialize($new_delvote_ips)); |
|
783 |
|
784 // update pages table |
|
785 $q = $db->sql_query('UPDATE ' . table_prefix . "pages SET delvotes = $new_delvotes, delvote_ips = '$new_delvote_ips' WHERE urlname = '$this->page_id' AND namespace = '$this->namespace';"); |
|
786 |
|
787 $cache->purge('page_meta'); |
|
788 |
|
789 return array( |
|
790 'success' => true, |
|
791 'dateline' => $dateline, |
|
792 'action' => $log_entry['action'] |
|
793 ); |
|
794 break; |
757 default: |
795 default: |
758 |
796 |
759 return array( |
797 return array( |
760 'success' => false, |
798 'success' => false, |
761 'error' => 'rb_action_not_supported', |
799 'error' => 'rb_action_not_supported', |