A few more cleanups, and unfortunately we cant convert the whole $config to javascript, so just do the SFIABDIRECTORY that we need for now, we can add more later

This commit is contained in:
james 2010-08-20 18:00:47 +00:00
parent 030f2030e8
commit 4143f289af
2 changed files with 8 additions and 4 deletions

View File

@ -124,6 +124,10 @@ else {
$config[$r->var]=$r->val; $config[$r->var]=$r->val;
} }
} }
//doh! we cant do it all, becuase it continains things like registration passwords! lets just add things as we need them i guess
//this gets turned into a 'config' object that is accessible in javascript (and output directly to the browser, so dont put
//anything in it that shouldnt be available to the public!
$configjs['SFIABDIRECTORY']=$config['SFIABDIRECTORY'];
$dbdbversion=$config['DBVERSION']; $dbdbversion=$config['DBVERSION'];
$dbcodeversion=@file($prependdir."db/db.code.version.txt"); $dbcodeversion=@file($prependdir."db/db.code.version.txt");

View File

@ -32,6 +32,7 @@ $HEADER_SENT=false;
function send_header($title="", $nav=null, $icon=null, $titletranslated=false) { function send_header($title="", $nav=null, $icon=null, $titletranslated=false) {
global $HEADER_SENT; global $HEADER_SENT;
global $config; global $config;
global $configjs;
global $roles; global $roles;
global $prependdir; global $prependdir;
global $conference; global $conference;
@ -48,11 +49,11 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false) {
<title><? if($title && !$titletranslated) echo i18n($title); else if($title) echo $title; else echo i18n($config['fairname']); ?></title> <title><? if($title && !$titletranslated) echo i18n($title); else if($title) echo $title; else echo i18n($config['fairname']); ?></title>
<? <?
foreach($theme['css'] AS $cssfile) { foreach($theme['css'] AS $cssfile) {
echo "<link rel=\"stylesheet\" href=\"{$config['SFIABDIRECTORY']}/theme/{$config['theme']}/{$cssfile}\" type=\"text/css\" media=\"all\" />\n"; echo " <link rel=\"stylesheet\" href=\"{$config['SFIABDIRECTORY']}/theme/{$config['theme']}/{$cssfile}\" type=\"text/css\" media=\"all\" />\n";
} }
?> ?>
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type="text/css" media="all" /> <link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type="text/css" media="all" />
<meta charset="UTF-8"> <meta charset="utf-8">
</head> </head>
<body> <body>
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/js/jquery/1.3.2/jquery.min.js"></script>
@ -67,8 +68,7 @@ $(document).ready(function(){
if($("#importantdatesbox").length) if($("#importantdatesbox").length)
$("#importantdatesbox").load("important_dates.php?display=box"); $("#importantdatesbox").load("important_dates.php?display=box");
}); });
//and dump the whole PHP configuration into a Javascript Object, so we can use it anywhere we need to refer to config variables in javascript var config=<?=json_encode($configjs)?>;
var config=<?=json_encode($config)?>;
</script> </script>
<? <?
//if we're under /admin or /config or /super we also want the translation editor //if we're under /admin or /config or /super we also want the translation editor