Dateien hochladen nach „Build/includes“

This commit is contained in:
Stephan 2018-10-24 09:04:42 +00:00
parent 6dda99a36d
commit aee6bac389
4 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,3 @@
preset=medium
tune=film
x264opts=direct=auto:aq-mode=3:force-cfr=1:b-adapt=2:rc-lookahead=60:weightp=0

View file

@ -0,0 +1,58 @@
<?PHP
//***********************************************************************//
// check_appprivilege.inc.php //
// Description: Script to query the active user permission for the //
// called application. //
// This will allow control of the permissions for //
// 3rdparty apps via Control Panel - Permissions //
// Now with query from SynoToken (DSM 4.x and onward) //
// Author: QTip from the german Synology support forum //
// Copyright: 2014-2016 by QTip //
// License: GNU GPLv3 (see LICENSE) //
// Thanks to MrSandman (German Synology support forum) for the nudge in //
// the right direction //
// ------------------------------------------------------------------- //
// Version: 0.31 - 18/09/2016 //
//***********************************************************************//
function check_privilege($appname) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif (isset($_SERVER['HTTP_X_REAL_IP'])){
$clientIP = $_SERVER['HTTP_X_REAL_IP'];
} else {
$clientIP = $_SERVER['REMOTE_ADDR'];
}
putenv('HTTP_COOKIE='.$_SERVER['HTTP_COOKIE']);
putenv('REMOTE_ADDR='.$clientIP);
$login = shell_exec("/usr/syno/synoman/webman/login.cgi");
preg_match('/\"SynoToken\"\s*?:\s*?\"(.*)\"/',$login,$synotoken);
$synotoken = trim($synotoken[1]);
// backup the current state of QUERY_STRING
$tmpenv = getenv('QUERY_STRING');
putenv('QUERY_STRING=SynoToken='.$synotoken);
$synouser = shell_exec("/usr/syno/synoman/webman/modules/authenticate.cgi");
if ($synouser == '') return array('','',0);
// get dsm build
$dsmbuild = shell_exec("/bin/get_key_value /etc.defaults/VERSION buildnumber");
if ($dsmbuild >= 7307) {
$raw_data = shell_exec("/usr/syno/bin/synowebapi --exec api=SYNO.Core.Desktop.Initdata method=get version=1 runner=".$synouser);
$initdata = json_decode(trim($raw_data),true);
$appprivilege = (array_key_exists($appname, $initdata['data']['AppPrivilege']) && $initdata['data']['AppPrivilege'][$appname]) ? 1 : 0;
$is_admin = (array_key_exists('is_admin', $initdata['data']['Session']) && $initdata['data']['Session']['is_admin'] == 1) ? 1 : 0;
} else {
$raw_data = shell_exec("/usr/syno/synoman/webman/initdata.cgi");
$raw_data = substr($raw_data,strpos($raw_data,"{")-1);
$initdata = json_decode(trim($raw_data),true);
$appprivilege = (array_key_exists($appname, $initdata['AppPrivilege']) && $initdata['AppPrivilege'][$appname]) ? 1 : 0;
$is_admin = (array_key_exists('is_admin', $initdata['Session']) && $initdata['Session']['is_admin'] == 1) ? 1 : 0;
}
// print $synotoken." - ".$synouser." - ".$is_admin;
// if application not found or user not admin, return empty string
// restore the old state of QUERY_STRING
putenv('QUERY_STRING='.$tmpenv);
if (!$appprivilege && !$is_admin) return array('','',0);
return array($synotoken,$synouser,$is_admin);
}
?>

32
Build/includes/decode.sed Normal file
View file

@ -0,0 +1,32 @@
s/+/ /g
s/%20/ /g
s/%21/!/g
s/%23/#/g
s/%26/\&/g
s/%28/\(/g
s/%29/\)/g
s/%2B/+/g
s/%3D/=/g
s/%2C/,/g
s/%2E/\./g
s/%2F/\//g
s/%3A/:/g
s/%3F/?/g
s/%40/@/g
s/%C3%9F/ß/g
s/%C3%A4/ä/g
s/%C3%84/Ä/g
s/%C3%B6/ö/g
s/%C3%96/Ö/
s/%C3%BC/ü/g
s/%C3%9C/Ü/g
s/%5B/[/g
s/%5D/]/g
s/%C2%A7/§/g
s/\\\u00e4/ä/g
s/\\\u00f6/ö/g
s/\\\u00c4/Ä/g
s/\\\u00d6/Ö/g
s/\\\u00fC/ü/g
s/\\\u00dC/Ü/g
s/\\\u00dF/ß/g

24
Build/includes/encode.sed Normal file
View file

@ -0,0 +1,24 @@
s/!/%21/g
s/#/%23/g
s/\&/%26/g
s/(/%28/g
s/)/%29/g
s/+/%2B/g
s/=/%3D/g
s/,/%2C/g
s/\./%2E/g
s/\//%2F/g
s/:/%3A/g
s/?/%3F/g
s/@/%40/g
s/ß/%C3%9F/g
s/ä/%C3%A4/g
s/Ä/%C3%84/g
s/ö/%C3%B6/g
s/Ö/%C3%96/g
s/ü/%C3%BC/g
s/Ü/%C3%9C/g
s/\[/%5B/g
s/\]/%5D/g
s/§/%C2%A7/g
s/ /+/g