Example #1
0
             // Selected a new blog:
             $BlogCache =& get_BlogCache();
             $Blog =& $BlogCache->get_by_ID($blog);
         }
     }
 }
 switch ($action) {
     case 'changetype':
         // Change the type of a hit
         // Check permission:
         $current_User->check_perm('stats', 'edit', true);
         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');
         }