root/devel/mod/toolbar/js.php

Revision 1540, 1.5 kB (checked in by renato, 10 months ago)

Setting prop svn:eol-style in another lot of files.

  • Property svn:eol-style set to native
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      // And the config.
11         global $CFG;
12         
13      // Prepare the page
14         templates_page_setup();
15         
16      // Get the contents of the toolbar, sending the function some dummy data as input
17         $toolbar = toolbar_mainbody('foo');
18         
19      // Which CSS file are we using?
20         $css = optional_param('css','css');
21         if ($css != "css") {
22             $css = "css-box";
23         }
24         
25      // Get the contents of the CSS
26         $css = @file_get_contents($CFG->dirroot . "mod/toolbar/" . $css);
27         $css = str_replace("{{url}}", $CFG->wwwroot, $css);
28     
29      // Strip out newlines
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      // Add some JS to allow applications to know if we're logged in or not
36         if (!isloggedin()) {
37             $isloggedin = "false";
38         } else {
39             $isloggedin = "true";
40         }
41         
42      // Send out a JS-like content type
43         header("Content-type: text/javascript");
44         
45      // Now a little bit of Javascript
46         echo <<< END
47         
48         var isLoggedIn = $isloggedin;
49         
50         document.write("$css");
51         document.write("$toolbar");
52         
53 END;
54
55 ?>
Note: See TracBrowser for help on using the browser.