831 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
// THIS IS AN EXAMPLE OF HOW YOU WOULD WRAP PHORUM
|
|
|
4 |
// IT IS NOT A DROP IN SOLUTION.
|
|
|
5 |
|
|
|
6 |
// Phorum wrapper to create a portable, dynamic Phorum with a single code base
|
|
|
7 |
// and to safely wrap Phorum to protect it from other applications.
|
|
|
8 |
|
|
|
9 |
include_once "./phorum_settings.php";
|
|
|
10 |
|
|
|
11 |
chdir($PHORUM_DIR);
|
|
|
12 |
|
|
|
13 |
// set a default page
|
|
|
14 |
|
|
|
15 |
// we set $PHORUM["CUSTOM_QUERY_STRING"] so Phorum will parse it instead of
|
|
|
16 |
// the servers QUERY_STRING.
|
|
|
17 |
if(preg_match("/^([a-z]+)(,|$)/", $_SERVER["QUERY_STRING"], $match)){
|
|
|
18 |
$GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] = str_replace($match[0], "", $_SERVER["QUERY_STRING"]);
|
|
|
19 |
$page = basename($match[1]);
|
|
|
20 |
} elseif(isset($_REQUEST["page"])){
|
|
|
21 |
$page = basename($_REQUEST["page"]);
|
|
|
22 |
$getparts = array();
|
|
|
23 |
foreach (explode("&", $_SERVER["QUERY_STRING"]) as $q) {
|
|
|
24 |
if (substr($q, 0, 5) != "page=") {
|
|
|
25 |
$getparts[] = $q;
|
|
|
26 |
}
|
|
|
27 |
}
|
|
|
28 |
$GLOBALS["PHORUM_CUSTOM_QUERY_STRING"] = implode(",", $getparts);
|
|
|
29 |
} else {
|
|
|
30 |
$page="index";
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
if(file_exists("./$page.php")){
|
|
|
36 |
phorum_namespace($page);
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
// create a namespace for Phorum
|
|
|
40 |
function phorum_namespace($page)
|
|
|
41 |
{
|
|
|
42 |
global $PHORUM; // globalize the $PHORUM array
|
|
|
43 |
include_once("./$page.php");
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
?>
|