Example #1
0
            param('hit_ID', 'integer', true);
            // Required!
            param('new_hit_type', 'string', true);
            // Required!
            Hitlist::change_type($hit_ID, $new_hit_type);
            $Messages->add(sprintf(T_('Changed hit #%d type to: %s.'), $hit_ID, $new_hit_type), 'success');
            break;
        case 'prune':
            // PRUNE hits for a certain date
            // Check that this action request is not a CSRF hacked request:
            $Session->assert_received_crumb('stats');
            // Check permission:
            $current_User->check_perm('stats', 'edit', true);
            param('date', 'integer', true);
            // Required!
            if ($r = Hitlist::prune($date)) {
                $Messages->add(sprintf(T_('Deleted %d hits for %s.'), $r, date(locale_datefmt(), $date)), 'success');
            } else {
                $Messages->add(sprintf(T_('No hits deleted for %s.'), date(locale_datefmt(), $date)), 'note');
            }
            // Redirect so that a reload doesn't write to the DB twice:
            header_redirect('?ctrl=stats', 303);
            // Will EXIT
            // We have EXITed already at this point!!
            break;
        case 'reset_counters':
            $current_User->check_perm('stats', 'edit', true);
            $sql = 'UPDATE T_track__keyphrase
				SET keyp_count_refered_searches = 0,
					keyp_count_internal_searches = 0';
            $DB->query($sql, ' Reset keyphrases counters');