plugins/SpecialPageFuncs.php
changeset 1295 3c9c1b18567b
parent 1270 bd3ee7f12bc1
child 1352 d97cf005f674
--- a/plugins/SpecialPageFuncs.php	Sat Aug 21 23:30:56 2010 -0400
+++ b/plugins/SpecialPageFuncs.php	Sat Aug 21 23:31:36 2010 -0400
@@ -34,6 +34,7 @@
 	register_special_page('GNU_General_Public_License', 'specialpage_gnu_gpl');
 	register_special_page('TagCloud', 'specialpage_tag_cloud');
 	register_special_page('Autofill', 'specialpage_autofill', false);
+	register_special_page('AjaxUpload', 'specialpage_ajaxupload', false);
 }
 
 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace>
@@ -703,4 +704,28 @@
 	echo enano_json_encode($dataset);
 }
 
+function page_Special_AjaxUpload()
+{
+	if ( isset($_GET['uploadstatus']) )
+	{
+		session_start();
+		header('Content-type: text/javascript');
+		$key = "upload_progress_{$_GET['uploadstatus']}";
+		$info = isset($_SESSION[$key]) ? $_SESSION[$key] : array();
+		if ( isset($_SESSION[$key]) && $_SESSION[$key]['done'] )
+			unset($_SESSION[$key]);
+		
+		if ( is_array($info) )
+		{
+			$info['current_time'] = time();
+			if ( !empty($_GET['cancel']) )
+				$_SESSION[$key]['cancel_upload'] = $info['cancel_upload'] = true;
+		}
+		$info['form'] = $_GET['form'];
+		
+		echo enano_json_encode($info);
+		exit;
+	}
+}
+
 ?>