| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * FCKeditor - The text editor for internet 4 * Copyright (C) 2003-2005 Frederico Caldeira Knabben 5 * 6 * Licensed under the terms of the GNU Lesser General Public License: 7 * http://www.opensource.org/licenses/lgpl-license.php 8 * 9 * For further information visit: 10 * http://www.fckeditor.net/ 11 * 12 * File Name: GetUploadProgress.php 13 * Implements the GetFolders command, to list the folders 14 * in the current directory. Output is in XML 15 * 16 * File Authors: 17 * Grant French (grant@mcpuk.net) 18 */ 19 20 class GetUploadProgress { 21 var $fckphp_config; 22 var $type; 23 var $cwd; 24 var $actual_cwd; 25 var $uploadID; 26 27 function GetUploadProgress($fckphp_config,$type,$cwd) { 28 $this->fckphp_config=$fckphp_config; 29 $this->type=$type; 30 $this->raw_cwd=$cwd; 31 $this->actual_cwd=str_replace("//","/",($fckphp_config['UserFilesPath']."/$type/".$this->raw_cwd)); 32 $this->real_cwd=str_replace("//","/",($this->fckphp_config['basedir']."/".$this->actual_cwd)); 33 34 if (isset($_GET['uploadID'])) { 35 $this->uploadID=$_GET['uploadID']; 36 } else { 37 $this->uploadID=''; 38 } 39 if (isset($_GET['refreshURL'])) { 40 $this->refreshURL=$_GET['refreshURL']; 41 } else { 42 $this->refreshURL=''; 43 } 44 } 45 46 function run() { 47 if (isset($this->refreshURL)&&($this->refreshURL!="")) { 48 //Continue monitoring 49 $uploadProgress=file($this->refreshURL); 50 $url=$this->refreshURL; 51 } else { 52 //New download 53 $uploadProgressHandler=$this->fckphp_config['uploadProgressHandler']; 54 if ($uploadProgressHandler=='') { 55 //Progresshandler not specified, return generic response 56 ?> 57 <Connector command="GetUploadProgress" resourceType="<?php echo $this->type; ?>"> 58 <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" /> 59 <Progress max="2" value="1" /> 60 <RefreshURL url="" /> 61 </Connector> 62 <?php 63 exit(0); 64 } 65 66 $url=$uploadProgressHandler."?iTotal=0&iRead=0&iStatus=1&sessionid=".$this->uploadID."&dtnow=".time()."&dtstart=".time(); 67 if (!file_exists($url)) { 68 exit(0); 69 } else { 70 $_SESSION[$this->uploadID]=$url; 71 $uploadProgress=file($url); 72 } 73 74 } 75 76 $uploadProgress2=implode("\n",$uploadProgress); 77 78 $parser = xml_parser_create(); 79 xml_parse_into_struct($parser, $uploadProgress2, $vals, $index); 80 81 $refreshURL=isset($vals[$index['REFRESHURL'][0]]['value'])?$vals[$index['REFRESHURL'][0]]['value']:""; 82 $totalBytes=isset($vals[$index['TOTALBYTES'][0]]['value'])?$vals[$index['TOTALBYTES'][0]]['value']:0; 83 $readBytes=isset($vals[$index['READBYTES'][0]]['value'])?$vals[$index['READBYTES'][0]]['value']:0; 84 $status=isset($vals[$index['STATUS'][0]]['value'])?$vals[$index['STATUS'][0]]['value']:1; 85 86 header ("content-type: text/xml"); 87 echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; 88 ?> 89 <Connector command="GetUploadProgress" resourceType="<?php echo $this->type; ?>"> 90 <CurrentFolder path="<?php echo $this->raw_cwd; ?>" url="<?php echo $this->actual_cwd; ?>" /> 91 <Progress max="<?php echo $totalBytes; ?>" value="<?php echo $readBytes; ?>" /> 92 <RefreshURL url="<?php echo htmlentities($refreshURL); ?>" /> 93 </Connector> 94 <?php 95 xml_parser_free($parser); 96 } 97 } 98 99 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |