File: maintenance.php

package info (click to toggle)
horde3 3.0.4-4sarge7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 15,980 kB
  • ctags: 16,295
  • sloc: php: 68,726; xml: 2,382; sql: 498; makefile: 74; sh: 63; pascal: 6
file content (80 lines) | stat: -rw-r--r-- 3,031 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
 * $Horde: horde/services/maintenance.php,v 1.31.2.1 2005/01/03 12:25:45 jan Exp $
 *
 * Copyright 2001-2005 Michael Slusarz <slusarz@bigworm.colorado.edu>
 * Copyright 2001-2005 Charles J. Hagenbuch <chuck@horde.org>
 * Copyright 2001-2005 Jon Parise <jon@horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 */

@define('HORDE_BASE', dirname(__FILE__) . '/..');
require_once HORDE_BASE . '/lib/base.php';
require_once 'Horde/Maintenance.php';

/* Make sure there is a user logged in. */
if (!Auth::getAuth()) {
    Horde::authenticationFailureRedirect();
}

/* If no 'module' parameter passed in, die with an error. */
if (!($module = basename(Util::getFormData('module')))) {
    Horde::fatal(PEAR::raiseError(_("Do not directly access maintenance.php")), __FILE__, __LINE__);
}

/* Load the module specific maintenance class now. */
if (!($maint = &Maintenance::factory($module))) {
    Horde::fatal(PEAR::raiseError(_("The Maintenance:: class did not load successfully")), __FILE__, __LINE__);
}

/* Have the maintenance module do all necessary processing. */
list($action, $tasks) = $maint->runMaintenancePage();

/* Print top elements of confirmation page. */
require HORDE_TEMPLATES . '/common-header.inc';
require HORDE_TEMPLATES . '/maintenance/maintenance_top.inc';

if ($action == MAINTENANCE_OUTPUT_CONFIRM) {
    /* Confirmation-style output. */
    require HORDE_TEMPLATES . '/maintenance/confirm_top.inc';

    if ($browser->hasFeature('javascript')) {
        require HORDE_TEMPLATES . '/maintenance/javascript.inc';
    }

    /* $pref, $descrip, & $checked need to be set for the templates. */
    foreach ($tasks as $pref) {
        list($descrip, $checked) = $maint->infoMaintenance($pref);
        require HORDE_TEMPLATES . '/maintenance/confirm_middle.inc';
    }

    require HORDE_TEMPLATES . '/maintenance/confirm_bottom.inc';
} elseif ($action == MAINTENANCE_OUTPUT_AGREE) {
    /* Agreement-style output. */
    require HORDE_TEMPLATES . '/maintenance/agreement_top.inc';

    /* $pref & $descrip need to be set for the templates. */
    foreach ($tasks as $pref) {
        list($descrip, $checked) = $maint->infoMaintenance($pref);
        require HORDE_TEMPLATES . '/maintenance/agreement_middle.inc';
    }

    require HORDE_TEMPLATES . '/maintenance/agreement_bottom.inc';
} elseif ($action == MAINTENANCE_OUTPUT_NOTICE) {
    /* Notice-style output. */
    require HORDE_TEMPLATES . '/maintenance/notice_top.inc';

    /* $pref & $descrip need to be set for the templates. */
    foreach ($tasks as $pref) {
        list($descrip, $checked) = $maint->infoMaintenance($pref);
        require HORDE_TEMPLATES . '/maintenance/notice_middle.inc';
    }

    require HORDE_TEMPLATES . '/maintenance/notice_bottom.inc';
}

/* Print bottom elements of maintenance page. */
require HORDE_TEMPLATES . '/maintenance/maintenance_bottom.inc';
require HORDE_TEMPLATES . '/common-footer.inc';