scratch – Diff between revs 28 and 29

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 28 Rev 29
Line 6... Line 6...
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');
Line 9... Line -...
9 require_once('config.php'); -  
10   -  
11 #### Retrieve uploaded file. -  
12 if (!isset($_POST['data']) or empty($_POST['data']) or -  
13 !isset($_POST['action']) or empty($_POST['action'])) -  
14 return; 9 require_once('config.php');
15   10  
16 #### Build the user path. 11 #### Build the user path.
17 $userPath = join( 12 $userPath = join(
18 DIRECTORY_SEPARATOR, 13 DIRECTORY_SEPARATOR,
Line 26... Line 21...
26 $pathPart = pathinfo($userPath); 21 $pathPart = pathinfo($userPath);
27 if (strcasecmp( 22 if (strcasecmp(
28 realpath($pathPart['dirname']), realpath($STORE_FOLDER)) != 0) 23 realpath($pathPart['dirname']), realpath($STORE_FOLDER)) != 0)
29 return; 24 return;
Line -... Line 25...
-   25  
30   26 switch($_SERVER['REQUEST_METHOD']) {
31 $data = $_POST['data']; -  
-   27 case 'POST':
32   28 #### Retrieve uploaded file.
33 switch(strtoupper($_POST['action'])) { 29 if(!isset($_POST['data']) or empty($_POST['data']))
-   30 return;
34 case 'SAVE': 31
35 #### Store the file. 32 #### Store the file.
36 atomized_put_contents($userPath, $data); 33 atomized_put_contents($userPath, $_POST['data']);
37 break; 34 break;
-   35 case 'GET':
-   36 if(!file_exists($userPath))
38 case 'LOAD': 37 return;
39 header('Content-Type: text/html; charset=utf-8'); 38 header('Content-Type: text/html; charset=utf-8');
40 echo atomized_get_contents($userPath, $data); 39 echo atomized_get_contents($userPath);
41 break; 40 break;