mirror of
https://github.com/e107inc/e107.git
synced 2025-04-13 09:01:59 +02:00
Theme download via admin now functioning.
This commit is contained in:
parent
3bd17f3d74
commit
5307008144
@ -73,13 +73,81 @@ if(e_AJAX_REQUEST)
|
||||
|
||||
if(e_AJAX_REQUEST)
|
||||
{
|
||||
if(isset($_GET['src'])) // Process Theme Download.
|
||||
{
|
||||
$string = base64_decode($_GET['src']);
|
||||
parse_str($string,$p);
|
||||
// echo $p['url'];
|
||||
$remotefile = $p['url'];
|
||||
|
||||
$localfile = md5($remotefile.time()).".zip";
|
||||
$status = "Downloading...";
|
||||
|
||||
e107::getFile()->getRemoteFile($remotefile,$localfile);
|
||||
|
||||
if(!file_exists(e_TEMP.$localfile))
|
||||
{
|
||||
$status = ADMIN_FALSE_ICON."<br /><a href='".$remotefile."'>Download Manually</a>";
|
||||
echo $status;
|
||||
exit;
|
||||
}
|
||||
// chmod(e_PLUGIN,0777);
|
||||
chmod(e_TEMP.$localfile,0755);
|
||||
|
||||
require_once(e_HANDLER."pclzip.lib.php");
|
||||
$archive = new PclZip(e_TEMP.$localfile);
|
||||
$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_THEME, PCLZIP_OPT_SET_CHMOD, 0755));
|
||||
// chmod(e_PLUGIN,0755);
|
||||
$dir = basename($unarc[0]['filename']);
|
||||
// chmod(e_UPLOAD.$localfile,0666);
|
||||
|
||||
|
||||
|
||||
/* Cannot use this yet until 'folder' is included in feed.
|
||||
if($dir != $p['plugin_folder'])
|
||||
{
|
||||
|
||||
echo "<br />There is a problem with the data submitted by the author of the plugin.";
|
||||
echo "dir=".$dir;
|
||||
echo "<br />pfolder=".$p['plugin_folder'];
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
if($unarc[0]['folder'] ==1 && is_dir($unarc[0]['filename']))
|
||||
{
|
||||
$status = "Unzipping...";
|
||||
$dir = basename($unarc[0]['filename']);
|
||||
$plugPath = preg_replace("/[^a-z0-9-\._]/", "-", strtolower($dir));
|
||||
$status = ADMIN_TRUE_ICON;
|
||||
//unlink(e_UPLOAD.$localfile);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// print_a($fileList);
|
||||
$status = ADMIN_FALSE_ICON."<br /><a href='".$remotefile."'>Download Manually</a>";
|
||||
//echo $archive->errorInfo(true);
|
||||
// $status = "There was a problem";
|
||||
//unlink(e_UPLOAD.$localfile);
|
||||
}
|
||||
|
||||
echo $status;
|
||||
// @unlink(e_TEMP.$localfile);
|
||||
|
||||
// echo "file=".$file;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$tm = (string) $_GET['id'];
|
||||
$data = $themec->getThemeInfo($tm);
|
||||
echo $themec->renderThemeInfo($data);
|
||||
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
require_once("auth.php");
|
||||
|
||||
|
||||
|
@ -1397,7 +1397,7 @@ class e_form
|
||||
|
||||
function name2id($name)
|
||||
{
|
||||
return rtrim(str_replace(array('[]', '[', ']', '_', '/'), array('-', '-', '', '-', '-'), $name), '-');
|
||||
return rtrim(str_replace(array('[]', '[', ']', '_', '/', ' '), array('-', '-', '', '-', '-', '-'), $name), '-');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,6 +508,7 @@ class themeHandler
|
||||
'date' => $r['@attributes']['date'],
|
||||
'version' => $r['@attributes']['version'],
|
||||
'thumbnail' => $r['@attributes']['thumbnail'],
|
||||
'url' => $r['@attributes']['url'],
|
||||
'description' => varset($r['description'])
|
||||
);
|
||||
|
||||
@ -554,7 +555,7 @@ class themeHandler
|
||||
|
||||
$text .= "<div class='clear'> </div>";
|
||||
|
||||
$amount = 10;
|
||||
$amount = 20;
|
||||
|
||||
|
||||
if($total > $amount)
|
||||
@ -797,6 +798,24 @@ class themeHandler
|
||||
$preview_icon = "<a title='Preview : ".$theme['name']."' rel='external' class='e-tip e-dialog' href='".e_BASE."index.php?themepreview.".$theme['id']."'>".E_32_SEARCH."</a>";
|
||||
$admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "<input class='top e-tip' type='image' src='".e_IMAGE_ABS."e107_icon_32.png' name='selectadmin[".$theme['id']."]' alt=\"".TPVLAN_32."\" title=\"".TPVLAN_32."\" />\n" : E_32_TRUE;
|
||||
|
||||
|
||||
if($_GET['mode'] == 'online')
|
||||
{
|
||||
|
||||
$d = http_build_query($theme,false,'&');
|
||||
$url = e_SELF."?src=".base64_encode($d);
|
||||
$id = $frm->name2id($theme['name']);
|
||||
$main_icon = "<span id='{$id}' style='vertical-align:middle'>
|
||||
<button type='button' data-target='{$id}' data-loading='".e_IMAGE."/generic/loading_32.gif' class='btn btn-primary e-ajax middle' value='Download and Install' data-src='".$url."' ><img src='".e_IMAGE_ABS."generic/download.png' alt='' /></button>
|
||||
</span>";
|
||||
|
||||
$main_icon = "<a data-src='".$url."' href='#' data-target='{$id}' data-loading='".e_IMAGE."/generic/loading_32.gif' class='e-ajax e-tip' title='Download' ><img class='top' src='".e_IMAGE_ABS."icons/download_32.png' alt='' /></a> ";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(!in_array($theme['path'], $this->approvedAdminThemes))
|
||||
{
|
||||
$admin_icon = "";
|
||||
@ -852,7 +871,7 @@ class themeHandler
|
||||
$text = "
|
||||
<div class='f-left block-text admin-theme-cell ".$borderStyle."'>
|
||||
<div class='admin-theme-thumb'>".$thumbnail."</div>
|
||||
<div class='admin-theme-options'>".$main_icon.$admin_icon.$info_icon.$preview_icon."</div>
|
||||
<div id='".$frm->name2id($theme['name'])."' class='admin-theme-options'>".$main_icon.$admin_icon.$info_icon.$preview_icon."</div>
|
||||
<div class='admin-theme-title'>".$theme['name']." ".$theme['version']."</div>
|
||||
</div>";
|
||||
return $text;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.0 KiB |
Loading…
x
Reference in New Issue
Block a user