1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 11:36:08 +02:00

Ajax theme downloads

This commit is contained in:
SecretR
2013-05-19 17:28:43 +03:00
parent 380e46cd56
commit c4121e5fd7
3 changed files with 35 additions and 43 deletions

View File

@@ -69,35 +69,30 @@ if(e_AJAX_REQUEST)
define('e_IFRAME',true);
}
// XXX message till we have better way to do the things
if(isset($_GET['action']) && $_GET['action'] == 'download') // Process Theme Download.
{
$string = base64_decode($_GET['src']);
parse_str($string,$p);
$mp = $themec->getMarketplace();
$mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
$status = $mp->download($p['id'], $p['mode'], $p['type']);
if($status)
{
e107::getMessage()->addInfo($status, 'default', true);
}
unset($_GET['src'], $_GET['action']);
$qry = '';
if($_GET) $qry = '?'.http_build_query($_GET, false, '&');
e107::getRedirect()->redirect(e_REQUEST_SELF.$qry);
}
if(e_AJAX_REQUEST)
{
switch ($_GET['action'])
{
case 'download':
$string = base64_decode($_GET['src']);
parse_str($string,$p);
$mp = $themec->getMarketplace();
$mp->generateAuthKey($e107SiteUsername, $e107SiteUserpass);
// Server flush useless. It's ajax ready state 4, we can't flush (sadly) before that (at least not for all browsers)
echo "<pre>Connecting...<br />"; flush(); // FIXME change the modal default label, default is Loading...
// download and flush
$mp->download($p['id'], $p['mode'], $p['type']);
echo "</pre>"; flush();
exit;
break;
case 'info':
$string = base64_decode($_GET['src']);
parse_str($string,$p);
echo $themec->renderThemeInfo($p);
exit;
break;
case 'preview':
// Theme Info Ajax
$tm = (string) $_GET['id'];