1<?php
2	    if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../').'/');
3        if(!defined('NOSESSION')) define('NOSESSION',true);
4	    require_once(DOKU_INC.'inc/init.php');
5
6        function epub_get_progress_dir($temp_user=null) {
7	        static $dir;
8
9			$seed = md5(rawurldecode($_POST['user']).time());
10		    if(!$dir) {
11                  if(isset($_POST['client'])) {
12				      $user= rawurldecode($_POST['client']) . ":$seed";
13				  }
14			      else {
15					 $user=$temp_user?"$temp_user:$seed":$seed;
16				  }
17				  $dir = dirname(metaFN("epub:$user:tmp",'.meta')) . '/';
18		    }
19
20		    return $dir;
21	    }
22
23        $user= rawurldecode($_POST['user']);
24        if($user) $user=cleanID($user);
25        $dir = epub_get_progress_dir($user);
26        $dir = rtrim($dir,'/');
27        $dir = dirname($dir . ".meta") . '/';
28        $progress_file = $dir . "progress.meta";
29        $content =  io_readFile($progress_file);
30        if($content) {
31          echo "$content\n";
32        }
33        else echo "";
34
35