Bläddra i källkod

Makes users.json respected in users.inc

teo greenwood 10 år sedan
förälder
incheckning
fe61edc5d5
3 ändrade filer med 13 tillägg och 11 borttagningar
  1. 5 1
      sys/admin/config/users.inc
  2. 7 9
      sys/admin/config/users.json.example
  3. 1 1
      sys/rss/microblog.php

+ 5 - 1
sys/admin/config/users.inc

@@ -1,6 +1,10 @@
 <?php
-if (!empty($_SERVER['REMOTE_USER']) && $_SERVER['REMOTE_USER'] == "admin") {
+$tcmsUsers = json_decode(file_get_contents('config/users.json'),true)
+if (!empty($_SERVER['REMOTE_USER']) && !empty($tcmsUsers)) {
     $poster = "admin";
+    if(array_search($_SERVER['REMOTE_USER'], $tcmsUsers) == $_SERVER['REMOTE_USER']) {
+      $poster = $key;
+    }
 } else {
     $poster = "Nobody";
 }

+ 7 - 9
sys/admin/config/users.json.example

@@ -1,12 +1,10 @@
 {
-  "tcmsUsers" : {
-    "admin" : {
-      "fullName" : "The Administrator",
-      "email" : "admin@example.com"
-    },
-    "Nobody" : {
-      "fullName" : "Anonymous",
-      "email" : "dev@null.io"
-    }
+  "admin" : {
+    "fullName" : "The Administrator",
+    "email" : "admin@example.com"
+  },
+  "Nobody" : {
+    "fullName" : "Anonymous",
+    "email" : "dev@null.io"
   }
 }

+ 1 - 1
sys/rss/microblog.php

@@ -1,7 +1,7 @@
 <?php 
   //Import your config, set some stuff up, then construct the mining laser
   extract(json_decode(file_get_contents('../admin/config/main.json'),true));
-  extract(json_decode(file_get_contents('../admin/config/users.json'),true));
+  $tcmsUsers = json_decode(file_get_contents('../admin/config/users.json'),true);
   date_default_timezone_set($timezone);
   $tiem = date(DATE_RSS);
   $today = date("m.d.y");