Browse Source

Move authkey definition to attribute and script_start

spaghetti 8 years ago
parent
commit
94e8bf3c32
2 changed files with 4 additions and 6 deletions
  1. 1
    6
      design/privateheader.php
  2. 3
    0
      static/functions/script_start.js

+ 1
- 6
design/privateheader.php View File

@@ -8,6 +8,7 @@ define('FOOTER_FILE', SERVER_ROOT.'/design/privatefooter.php');
8 8
 <head>
9 9
   <title><?=display_str($PageTitle)?></title>
10 10
   <meta charset="utf-8" />
11
+  <meta id="auth_holder" userid="<?=G::$LoggedUser['ID']?>" authkey="<?=G::$LoggedUser['AuthKey']?>" />
11 12
   <link rel="shortcut icon" href="favicon.ico?v=<?=md5_file('favicon.ico');?>" />
12 13
   <link rel="search" type="application/opensearchdescription+xml" title="<?=SITE_NAME?>" href="<?=STATIC_SERVER?>opensearch.xml">
13 14
   <link rel="alternate" type="application/rss+xml"
@@ -84,12 +85,6 @@ foreach ($ExtraCSS as $CSS) {
84 85
   <link rel="stylesheet" type="text/css" media="screen" href="<?=STATIC_SERVER."styles/$CSS/style.css?v=".filemtime(SERVER_ROOT.STATIC_SERVER."styles/$CSS/style.css")?>" />
85 86
 <?
86 87
 }
87
-?>
88
-  <script type="text/javascript">
89
-    var authkey = "<?=G::$LoggedUser['AuthKey']?>";
90
-    var userid = <?=G::$LoggedUser['ID']?>;
91
-  </script>
92
-<?
93 88
 
94 89
 $Scripts = array_merge(array('jquery', 'script_start', 'ajax.class', 'global', 'jquery.autocomplete', 'autocomplete', 'tooltipster', 'tooltipster_settings'), explode(',', $JSIncludes));
95 90
 foreach ($Scripts as $Script) {

+ 3
- 0
static/functions/script_start.js View File

@@ -361,3 +361,6 @@ $.fn.extend({
361 361
     return this;
362 362
   }
363 363
 });
364
+
365
+var authkey = document.head.children.auth_holder.attributes.authkey.value;
366
+var userid = parseInt(document.head.children.auth_holder.attributes.userid.value);

Loading…
Cancel
Save