mirror of
https://github.com/e107inc/e107.git
synced 2025-08-20 21:32:09 +02:00
Theme download via admin now functioning.
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user