Subversion Repositories Applications.papyrus

Rev

Rev 831 | Details | Compare with Previous | 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
define('phorum_page','script');
20
define('PHORUM_SCRIPT', 1);
21
 
22
include_once("./common.php");
23
 
24
// if we are running in the webserver, bail out
25
if (isset($_SERVER["REMOTE_ADDR"])) {
26
    echo $PHORUM["DATA"]["LANG"]["CannotBeRunFromBrowser"];
27
    return;
28
}
29
 
30
if (! isset($_SERVER["argv"][1])) {
31
    phorum_script_usage();
32
}
33
 
34
// figure out what module we are trying to run
35
if (strpos($_SERVER["argv"][1], "--module=") === 0) {
36
    $module = substr(strstr($_SERVER["argv"][1], "="), 1);
37
    if (strlen($module) > 0) {
38
        $args = $_SERVER["argv"];
39
        unset($args[0]);
40
        $args[1] = $module;
41
        phorum_hook("external", $args);
42
    }
43
    else {
44
        phorum_script_usage();
45
    }
46
}
47
elseif ($argv[1] == "--scheduled") {
48
    phorum_hook("scheduled");
49
}
50
else {
51
    phorum_script_usage();
52
}
53
 
54
function phorum_script_usage() {
55
    $PHORUM=$GLOBALS["PHORUM"];
56
    echo $PHORUM["DATA"]["LANG"]["ScriptUsage"];
57
    exit(1);
58
}
59
?>