mirror of
https://github.com/e107inc/e107.git
synced 2025-04-14 01:22:13 +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:
parent
540922d25c
commit
00696d92d3
@ -51,7 +51,7 @@ $security_risks = array(
|
||||
if(ini_get($risk))
|
||||
{
|
||||
$srch = '<tr><td class="forumheader2">'.$risk.'</td><td class="forumheader3">';
|
||||
$repl = '<tr><td class="forumheader2">'.$risk.'</td><td title="'.$tp->toAttribute($diz).'" class="forumheader3" style="background-color:red">';
|
||||
$repl = '<tr><td class="forumheader2">'.$risk.'</td><td title="'.$tp->toAttribute($diz).'" class="forumheader3 alert alert-danger">';
|
||||
$phpinfo = str_replace($srch,$repl,$phpinfo);
|
||||
$mes->addWarning("<b>".$risk."</b>: ".$diz);
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ class pluginManager{
|
||||
|
||||
if(empty($data[0]['error']))
|
||||
{
|
||||
if($fl->unzipArchive($data[0]['name'],'plugin') === true)
|
||||
if($fl->unzipArchive($data[0]['name'],'plugin'))
|
||||
{
|
||||
$mes->addSuccess(EPL_ADLAN_43);
|
||||
}
|
||||
|
@ -2281,10 +2281,34 @@ $text .= "
|
||||
// File Uploads
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_upload.php");
|
||||
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$text .= "
|
||||
<fieldset class='e-hideme' id='core-prefs-uploads'>
|
||||
<legend>File Uploading</legend>
|
||||
<legend>File Uploading</legend>";
|
||||
|
||||
|
||||
$upload_max_filesize = ini_get('upload_max_filesize');
|
||||
$post_max_size = ini_get('post_max_size');
|
||||
|
||||
$maxINI = min($upload_max_filesize,$post_max_size);
|
||||
|
||||
if($maxINI < $pref['upload_maxfilesize'])
|
||||
{
|
||||
$text .= "<div class='alert-block alert alert-danger'>";
|
||||
$text .= "The maximum upload size imposed by your php.ini settings is: ".$maxINI."</div>";
|
||||
$pref['upload_maxfilesize'] = $maxINI;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$text .= "
|
||||
<table class='table adminform'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
@ -2307,7 +2331,7 @@ $text .= "
|
||||
<td>".
|
||||
$frm->text('upload_maxfilesize', $pref['upload_maxfilesize'], 10)
|
||||
."
|
||||
<div class='field-help'>".UPLLAN_34." (upload_max_filesize = ".ini_get('upload_max_filesize').", post_max_size = ".ini_get('post_max_size')." )</div>
|
||||
<div class='field-help'>".UPLLAN_34."</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -2317,9 +2341,41 @@ $text .= "
|
||||
<div class='field-help'>".UPLLAN_38."</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>Filetype upload limits</td>
|
||||
<td>
|
||||
|
||||
<table class='table table-striped table-bordered'>
|
||||
<tr><th>".LAN_TYPE."</th><th>".UPLLAN_33."</th>
|
||||
";
|
||||
|
||||
$fl = e107::getFile();
|
||||
$data = $fl->getFiletypeLimits();
|
||||
|
||||
foreach($data as $k=>$v)
|
||||
{
|
||||
$text .= "<tr><td>".$k."</td>
|
||||
<td>".$fl->file_size_encode($v)."</td>
|
||||
</tr>";
|
||||
|
||||
|
||||
}
|
||||
// $text .= print_a($data,true);
|
||||
|
||||
|
||||
|
||||
$text .= "</table>
|
||||
|
||||
<div>** For security reasons these values may only be changed manually in the following file: <b>".str_replace("../",'',e_SYSTEM).e_READ_FILETYPES."</b></div>
|
||||
</td>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
".pref_submit('uploads')."
|
||||
".pref_submit('uploads');
|
||||
|
||||
|
||||
|
||||
$text .= "
|
||||
</fieldset>";
|
||||
|
||||
|
||||
|
@ -177,6 +177,7 @@ else
|
||||
|
||||
|
||||
|
||||
|
||||
if($mode == 'download' && !empty($_GET['src']))
|
||||
{
|
||||
define('e_IFRAME', true);
|
||||
@ -210,10 +211,9 @@ elseif(vartrue($_POST['selectadmin']))
|
||||
|
||||
if(vartrue($_POST['upload']))
|
||||
{
|
||||
$mode = "choose";
|
||||
$mode = "upload";
|
||||
}
|
||||
|
||||
if(vartrue($_POST['selectmain']) || varset($_POST['setUploadTheme']))
|
||||
elseif(vartrue($_POST['selectmain']) || varset($_POST['setUploadTheme']))
|
||||
{
|
||||
$mode = "main";
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user