scratch – Diff between revs 29 and 34

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 29 Rev 34
1 <?php 1 <?php
2   2  
3 ########################################################################### 3 ###########################################################################
4 ## Copyright (C) Wizardry and Steamworks 2017 - License: GNU GPLv3 ## 4 ## Copyright (C) Wizardry and Steamworks 2017 - License: GNU GPLv3 ##
5 ########################################################################### 5 ###########################################################################
6   6  
7 require_once('inc/pseudocrypt.php'); 7 require_once('inc/pseudocrypt.php');
8 require_once('inc/functions.php'); 8 require_once('inc/functions.php');
9 require_once('config.php'); 9 require_once('config.php');
10   10  
11 #### Build the user path. 11 #### Build the user path.
12 $userPath = join( 12 $userPath = join(
13 DIRECTORY_SEPARATOR, 13 DIRECTORY_SEPARATOR,
14 array( 14 array(
15 $STORE_FOLDER, 15 $STORE_FOLDER,
16 $SHARED_EDITOR_FILE 16 $SHARED_EDITOR_FILE
17 ) 17 )
18 ); 18 );
19   19  
20 #### Check for path traversals 20 #### Check for path traversals
21 $pathPart = pathinfo($userPath); 21 $pathPart = pathinfo($userPath);
22 if (strcasecmp( 22 if (strcasecmp(
23 realpath($pathPart['dirname']), realpath($STORE_FOLDER)) != 0) 23 realpath($pathPart['dirname']), realpath($STORE_FOLDER)) != 0)
24 return; 24 return;
25   25  
26 switch($_SERVER['REQUEST_METHOD']) { 26 switch($_SERVER['REQUEST_METHOD']) {
27 case 'POST': 27 case 'POST':
28 #### Retrieve uploaded file. 28 #### Retrieve uploaded file.
29 if(!isset($_POST['data']) or empty($_POST['data'])) 29 if(!isset($_POST['data']) or empty($_POST['data']))
30 return; 30 return;
31 31
32 #### Store the file. 32 #### Store the file.
33 atomized_put_contents($userPath, $_POST['data']); 33 atomized_put_contents($userPath, $_POST['data']);
34 break; 34 break;
35 case 'GET': 35 case 'GET':
36 if(!file_exists($userPath)) 36 if(!file_exists($userPath))
37 return; 37 return;
38 header('Content-Type: text/html; charset=utf-8'); 38 header('Content-Type: text/html; charset=utf-8');
-   39 header('Cache-Control: no-cache, no-store, must-revalidate');
-   40 header('Pragma: no-cache');
-   41 header('Expires: 0');
39 echo atomized_get_contents($userPath); 42 echo atomized_get_contents($userPath);
40 break; 43 break;
41 } 44 }
42   45  
43   46