Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
//                                                                            //
5
//   Copyright (C) 2006  Phorum Development Team                              //
6
//   http://www.phorum.org                                                    //
7
//                                                                            //
8
//   This program is free software. You can redistribute it and/or modify     //
9
//   it under the terms of either the current Phorum License (viewable at     //
10
//   phorum.org) or the Phorum License that was distributed with this file    //
11
//                                                                            //
12
//   This program is distributed in the hope that it will be useful,          //
13
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
14
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
15
//                                                                            //
16
//   You should have received a copy of the Phorum License                    //
17
//   along with this program.                                                 //
18
////////////////////////////////////////////////////////////////////////////////
19
 
20
    if(!defined("PHORUM_ADMIN")) return;
21
 
22
    $error="";
23
 
24
    $forums=phorum_db_get_forums();
25
    $forum_list=array(0=>"All Forums");
26
 
27
    foreach($forums as $forum_idn=>$forum){
28
        if($forum['folder_flag'] == 0)
29
            $forum_list[$forum_idn]=$forum["name"];
30
    }
31
 
32
    if(count($_POST)){
33
 
34
        if($_POST["days"] > 0){
35
          $ret=phorum_db_prune_oldThreads(time()-(86400*$_POST['days']), intval($_POST['forumid']), $_POST['mode']);
36
          // updating forum-stats
37
          if($_POST['forumid']) {
38
            $PHORUM['forum_id']=$_POST['forumid'];
39
            phorum_db_update_forum_stats(true);
40
          } else {
41
            foreach($forum_list as $fid => $fname) {
42
              $PHORUM['forum_id']=$fid;
43
              phorum_db_update_forum_stats(true);
44
            }
45
          }
46
          // prune messages
47
        }
48
 
49
        if(!$ret){
50
            $error="No messages deleted.<br />";
51
        } else {
52
            echo "$ret Messages deleted.<br />";
53
        }
54
    }
55
 
56
    if($error){
57
        phorum_admin_error($error);
58
    }
59
 
60
    include_once "./include/admin/PhorumInputForm.php";
61
 
62
 
63
    $frm =& new PhorumInputForm ("", "post", "Delete messages");
64
 
65
    $frm->hidden("module", "message_prune");
66
 
67
    $frm->addbreak("Pruning old threads ...");
68
    $frm->addmessage("ATTENTION!<br />This script deletes quickly A LOT of messages. Use it on your own risk.<br />There is no further confirmation message after sending this form!");
69
 
70
    $frm->addrow("older than (days from today)",$frm->text_box("days", "365", 10));
71
    $frm->addrow("in Forum", $frm->select_tag("forumid", $forum_list,0));
72
    $frm->addrow("Check for", $frm->select_tag("mode", array(1=>"When the thread was started",2=>"When the last answer to the thread was posted"),0));
73
 
74
    $frm->show();
75
 
76
 
77
?>