mirror of
https://github.com/e107inc/e107.git
synced 2025-09-03 03:13:34 +02:00
Added filetypes.xml info in Admin-> Preferences -> File Uploads to remove confusion with file upload limits. Theme upload should be working correctly now.
This commit is contained in:
@@ -1042,6 +1042,7 @@ class e_file
|
||||
* Unzip Plugin or Theme zip file and move to plugin or theme folder.
|
||||
* @param string $localfile - filename located in e_TEMP
|
||||
* @param string $type - addon type, either 'plugin' or 'theme', (possibly 'language' in future).
|
||||
* @return string unzipped folder name on success or false.
|
||||
*/
|
||||
public function unzipArchive($localfile, $type)
|
||||
{
|
||||
@@ -1094,13 +1095,28 @@ class e_file
|
||||
//$status = "Done"; // ADMIN_TRUE_ICON;
|
||||
@unlink(e_TEMP.$localfile);
|
||||
|
||||
return true;
|
||||
return $dir;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get an array of permitted filetypes according to a set hierarchy.
|
||||
* If a specific file name given, that's used. Otherwise the default hierarchy is used
|
||||
*
|
||||
* @param string $file_mask - comma-separated list of allowed file types
|
||||
* @param string $filename - optional override file name - defaults ignored
|
||||
*
|
||||
* @return array of filetypes
|
||||
*/
|
||||
function getFiletypeLimits($file_mask = false, $filename = '') // Wrapper only for now.
|
||||
{
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
$limits = get_filetypes($file_mask, $filename);
|
||||
ksort($limits);
|
||||
return $limits;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -64,14 +64,29 @@ class themeHandler
|
||||
$this->frm = new e_form();
|
||||
|
||||
$this->fl = e107::getFile();
|
||||
|
||||
|
||||
if(isset($_POST['upload']))
|
||||
if(!empty($_POST['upload']))
|
||||
{
|
||||
$this->themeUpload();
|
||||
$unzippedTheme = $this->themeUpload();
|
||||
}
|
||||
|
||||
if(vartrue($_POST['installContent']))
|
||||
if(!empty($_POST['setUploadTheme']) && !empty($unzippedTheme))
|
||||
{
|
||||
$themeArray = $this->getThemes();
|
||||
$this->id = $themeArray[$unzippedTheme]['id'];
|
||||
|
||||
if($this->setTheme())
|
||||
{
|
||||
$mes->addSuccess(TPVLAN_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addError("Could not change site theme."); // TODO LAN
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($_POST['installContent']))
|
||||
{
|
||||
$this->installContent($_POST['installContent']);
|
||||
}
|
||||
@@ -319,15 +334,33 @@ class themeHandler
|
||||
$mes = e107::getMessage();
|
||||
$ns = e107::getRender();
|
||||
|
||||
extract($_FILES);
|
||||
// extract($_FILES);
|
||||
//print_a($_FILES);
|
||||
|
||||
if(!is_writable(e_THEME))
|
||||
if(!is_writable(e_TEMP))
|
||||
{
|
||||
$mes->addInfo(TPVLAN_20);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
$fl = e107::getFile();
|
||||
$mp = $this->getMarketplace();
|
||||
$status = $fl->getUploaded(e_TEMP);
|
||||
|
||||
if(!empty($status[0]['error']))
|
||||
{
|
||||
$mes->addError($status[0]['message']);
|
||||
return;
|
||||
}
|
||||
|
||||
$mes->addSuccess($status[0]['message']);
|
||||
|
||||
return $fl->unzipArchive($status[0]['name'],'theme');
|
||||
|
||||
|
||||
// else
|
||||
/*
|
||||
{
|
||||
// FIXME - temporary fixes to upload process, check required.
|
||||
// Probably in need of a rewrite to use process_uploaded_files();
|
||||
@@ -410,6 +443,8 @@ class themeHandler
|
||||
@unlink(e_THEME.$archiveName);
|
||||
}
|
||||
}
|
||||
*
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -754,7 +789,7 @@ class themeHandler
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class='buttons-bar center'>".$frm->admin_button('upload', TPVLAN_14, 'submit')."</div>
|
||||
<div class='buttons-bar center'>".$frm->admin_button('upload', 1, 'submit', LAN_UPLOAD)."</div>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ if (!defined('e107_INIT'))
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_upload_handler.php');
|
||||
|
||||
//define("UH_DEBUG",TRUE);
|
||||
define("UH_DEBUG", FALSE);
|
||||
|
||||
|
||||
//FIXME need another name
|
||||
// define('e_UPLOAD_TEMP_DIR', e_MEDIA.'temp/');
|
||||
@@ -119,7 +119,16 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
{
|
||||
$ul_temp_dir = e_UPLOAD_TEMP_DIR;
|
||||
}
|
||||
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
define("UH_DEBUG", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
define("UH_DEBUG", false);
|
||||
}
|
||||
|
||||
if (UH_DEBUG)
|
||||
{
|
||||
e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Upload Handler test", "Process uploads to {$uploaddir}, fileinfo ".$fileinfo, FALSE, LOG_TO_ROLLING);
|
||||
|
Reference in New Issue
Block a user