|
Revision 956, 1.5 kB
(checked in by ben, 2 years ago)
|
The toolbar now has a go-anywhere Javascript version, for slapping on other sites and pages you want to bring into your social network.
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
* Toolbar Javascript include |
|---|
| 5 |
*/ |
|---|
| 6 |
|
|---|
| 7 |
// We're going to need the main include file. |
|---|
| 8 |
require("../../includes.php"); |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
global $CFG; |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
templates_page_setup(); |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
$toolbar = toolbar_mainbody('foo'); |
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
$css = optional_param('css','css'); |
|---|
| 21 |
if ($css != "css") { |
|---|
| 22 |
$css = "css-box"; |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
$css = @file_get_contents($CFG->dirroot . "mod/toolbar/" . $css); |
|---|
| 27 |
$css = str_replace("{{url}}", $CFG->wwwroot, $css); |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
$toolbar = str_replace("\n","",str_replace("\r","",$toolbar)); |
|---|
| 31 |
$toolbar = addslashes($toolbar); |
|---|
| 32 |
$css = str_replace("\n","",str_replace("\r","",$css)); |
|---|
| 33 |
$css = addslashes($css); |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
if (!isloggedin()) { |
|---|
| 37 |
$isloggedin = "false"; |
|---|
| 38 |
} else { |
|---|
| 39 |
$isloggedin = "true"; |
|---|
| 40 |
} |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
header("Content-type: text/javascript"); |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
echo <<< END |
|---|
| 47 |
|
|---|
| 48 |
var isLoggedIn = $isloggedin; |
|---|
| 49 |
|
|---|
| 50 |
document.write("$css"); |
|---|
| 51 |
document.write("$toolbar"); |
|---|
| 52 |
|
|---|
| 53 |
END; |
|---|
| 54 |
|
|---|
| 55 |
?> |
|---|