From 76a3744af7f538324066425843f528e16b559aab Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Thu, 2 Jan 2020 08:44:49 +0800
Subject: [PATCH] Update index.php
---
 index.php | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/index.php b/index.php
index 642a694..5ca4bb4 100644
--- a/index.php
+++ b/index.php
@@ -6,12 +6,12 @@ include 'functions.php';
 //echo '
'. json_encode($_SERVER, JSON_PRETTY_PRINT).'
';
 //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).'
';
 if (!isset($_SERVER['REDIRECT_URL'])) $_SERVER['REDIRECT_URL'] = '/index.php';
-$path = $_SERVER['REDIRECT_URL'];
+$path = spurlencode($_SERVER['REDIRECT_URL'], '/');
 //echo 'path:'. $path;
 $_GET = getGET();
 //echo ''. json_encode($_GET, JSON_PRETTY_PRINT).'
';
 
-$re = main();
+$re = main($path);
 $sendHeaders = array();
 foreach ($re['headers'] as $headerName => $headerVal) {
     header($headerName . ': ' . $headerVal, true);
@@ -19,7 +19,7 @@ foreach ($re['headers'] as $headerName => $headerVal) {
 http_response_code($re['statusCode']);
 echo $re['body'];
 
-function main()
+function main($path)
 {
     global $exts;
     global $constStr;
@@ -218,10 +218,10 @@ namespace:' . $namespace . '
     if ($_POST['submit1']) {
         foreach ($_POST as $k => $v) {
             if (in_array($k, $constEnv)) {
-                if (!(getenv($k)==''&&$v=='')) $tmp[$k] = $v;
+                if (!(getConfig($k)==''&&$v=='')) $tmp[$k] = $v;
             }
         }
-        $response = json_decode(setHerokuConfig($function_name, $tmp, getenv('APIKey')), true);
+        $response = json_decode(setHerokuConfig($function_name, $tmp, getConfig('APIKey')), true);
         if (isset($response['id'])&&isset($response['message'])) {
             $html = $response['id'] . '
 ' . $response['message'] . '
@@ -260,7 +260,7 @@ function_name:' . $_SERVER['function_name'] . '
                 
@@ -269,7 +269,7 @@ function_name:' . $_SERVER['function_name'] . '
         } else $html .= '
         
              | 
-             | 
+             | 
         
';
     }
     $html .= '
@@ -331,10 +331,10 @@ function adminoperate($path)
     }
     if ($_GET['operate_action']==$constStr['encrypt'][$constStr['language']]) {
         // encrypt 加密
-        if (getenv('passfile')=='') return message($constStr['SetpassfileBfEncrypt'][$constStr['language']],'',403);
+        if (getConfig('passfile')=='') return message($constStr['SetpassfileBfEncrypt'][$constStr['language']],'',403);
         if ($_GET['encrypt_folder']=='/') $_GET['encrypt_folder']=='';
         $foldername = spurlencode($_GET['encrypt_folder']);
-        $filename = path_format($path1 . '/' . $foldername . '/' . getenv('passfile'));
+        $filename = path_format($path1 . '/' . $foldername . '/' . getConfig('passfile'));
                 //echo $foldername;
         $result = MSAPI('PUT', $filename, $_GET['encrypt_newpass'], $_SERVER['access_token']);
         return output($result['body'], $result['stat']);
@@ -674,8 +674,8 @@ function render_list($path, $files)
 
 
 
+    if (getConfig('admin')!='') if (!$_SERVER['admin']) {
+        if (getConfig('adminloginpage')=='') { ?>
     
 
@@ -684,7 +684,7 @@ function render_list($path, $files)
         
         
 
-        href="setup"onclick="alert('');">
+        href="setup"onclick="alert('');">
         
     
 
                 
                 
-                
+                
                 
             
         
@@ -1069,7 +1069,7 @@ function render_list($path, $files)
     
 
+        if (getConfig('admin')!='') if (getConfig('adminloginpage')=='') { ?>
     
         
             
@@ -1088,7 +1088,7 @@ function render_list($path, $files)
 
 
 
-
+