mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Plugin install tweaks and layout fixes.
This commit is contained in:
parent
7640954880
commit
d437765a22
@ -293,9 +293,11 @@ class pluginManager{
|
||||
{
|
||||
|
||||
global $user_pref,$admin_log;
|
||||
|
||||
if (isset($_POST['upload']))
|
||||
{
|
||||
$this -> pluginProcessUpload();
|
||||
$this->action = 'avail';
|
||||
}
|
||||
|
||||
if(isset($_POST['etrigger_ecolumns']))
|
||||
@ -572,7 +574,7 @@ class pluginManager{
|
||||
if($total > $amount)
|
||||
{
|
||||
$parms = $total.",".$amount.",".$from.",".e_SELF.'?mode='.$_GET['mode'].'&frm=[FROM]';
|
||||
$text .= "<div style='text-align:center;margin-top:10px'>".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."</div>";
|
||||
$text .= "<div class='control-group form-inline input-inline' style='text-align:center;margin-top:10px'>".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."</div>";
|
||||
}
|
||||
|
||||
e107::getRender()->tablerender(ADLAN_98.SEP.$caption, $mes->render(). $text);
|
||||
@ -600,7 +602,7 @@ class pluginManager{
|
||||
//<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."' ><span>Download and Install</span></button>
|
||||
|
||||
$url = e_SELF.'?mode=download&src='.base64_encode($d);
|
||||
$dicon = '<a class="e-modal btn btn-default" href="'.$url.'" rel="external" data-loading="'.e_IMAGE.'/generic/loading_32.gif" data-cache="false" data-modal-caption="Downloading and Installing '.$data['plugin_name']." ".$data['plugin_version'].'" target="_blank" ><img class="top" src="'.e_IMAGE_ABS.'icons/download_32.png" alt="" /></a>';
|
||||
$dicon = '<a title="Download and Install" class="e-modal btn btn-default" href="'.$url.'" rel="external" data-loading="'.e_IMAGE.'/generic/loading_32.gif" data-cache="false" data-modal-caption="Downloading and Installing '.$data['plugin_name']." ".$data['plugin_version'].'" target="_blank" >'.ADMIN_INSTALLPLUGIN_ICON.'</a>';
|
||||
|
||||
|
||||
// Temporary Pop-up version.
|
||||
@ -807,17 +809,42 @@ class pluginManager{
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
$fl = e107::getFile();
|
||||
$data = $fl->getUploaded(e_TEMP);
|
||||
$mes = e107::getMessage();
|
||||
|
||||
if(empty($data[0]['error']))
|
||||
{
|
||||
if($fl->unzipArchive($data[0]['name'],'plugin') === true)
|
||||
{
|
||||
$mes->addSuccess(EPL_ADLAN_43);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->addError("There was a problem extracting the .zip file to your plugin directory.");
|
||||
}
|
||||
}
|
||||
|
||||
// $data = process_uploaded_files(e_TEMP);
|
||||
// print_a($data);
|
||||
|
||||
echo $mes->render();
|
||||
|
||||
return;
|
||||
|
||||
// ----------------- Everything below is unused.
|
||||
|
||||
extract($_FILES);
|
||||
/* check if e_PLUGIN dir is writable ... */
|
||||
if(!is_writable(e_PLUGIN))
|
||||
{
|
||||
/* still not writable - spawn error message */
|
||||
// still not writable - spawn error message
|
||||
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* e_PLUGIN is writable - continue */
|
||||
// e_PLUGIN is writable
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
$fileName = $file_userfile['name'][0];
|
||||
$fileSize = $file_userfile['size'][0];
|
||||
@ -833,10 +860,9 @@ class pluginManager{
|
||||
}
|
||||
else
|
||||
{
|
||||
/* not zip or tar - spawn error message */
|
||||
// not zip or tar - spawn error message
|
||||
e107::getRender()->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
|
||||
require_once("footer.php");
|
||||
exit;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($fileSize)
|
||||
@ -844,7 +870,7 @@ class pluginManager{
|
||||
$uploaded = file_upload(e_PLUGIN);
|
||||
$archiveName = $uploaded[0]['name'];
|
||||
|
||||
/* attempt to unarchive ... */
|
||||
// attempt to unarchive
|
||||
|
||||
if($fileType == "zip")
|
||||
{
|
||||
@ -860,7 +886,7 @@ class pluginManager{
|
||||
|
||||
if(!$unarc)
|
||||
{
|
||||
/* unarc failed ... */
|
||||
// unarc failed ...
|
||||
if($fileType == "zip")
|
||||
{
|
||||
$error = EPL_ADLAN_46." '".$archive -> errorName(TRUE)."'";
|
||||
@ -874,9 +900,9 @@ class pluginManager{
|
||||
exit;
|
||||
}
|
||||
|
||||
/* ok it looks like the unarc succeeded - continue */
|
||||
// ok it looks like the unarc succeeded - continue */
|
||||
|
||||
/* get folder name ... */
|
||||
// get folder name ...
|
||||
|
||||
$folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/")));
|
||||
|
||||
@ -1624,12 +1650,17 @@ class pluginManager{
|
||||
$var['avail']['text'] = EPL_ADLAN_23;
|
||||
$var['avail']['link'] = e_SELF."?avail";
|
||||
|
||||
// $var['upload']['text'] = EPL_ADLAN_38;
|
||||
// $var['upload']['link'] = e_SELF."?upload";
|
||||
|
||||
$var['online']['text'] = "Find Plugins";
|
||||
$var['online']['link'] = e_SELF."?mode=online";
|
||||
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$var['upload']['text'] = EPL_ADLAN_38;
|
||||
$var['upload']['link'] = e_SELF."?mode=upload";
|
||||
}
|
||||
|
||||
$var['create']['text'] = "Plugin Builder";
|
||||
$var['create']['link'] = e_SELF."?mode=create";
|
||||
|
||||
|
@ -162,9 +162,9 @@ $NEXTPREV_TEMPLATE['dropdown_nav_first'] = '';
|
||||
$NEXTPREV_TEMPLATE['dropdown_nav_last'] = '';
|
||||
|
||||
// 'tbox npbutton' classes are deprecated!!!
|
||||
$NEXTPREV_TEMPLATE['dropdown_nav_prev'] = '<a class="btn nextprev-item prev tbox npbutton" href="{url}" title="{url_label}">{label}</a> ';
|
||||
$NEXTPREV_TEMPLATE['dropdown_nav_prev'] = '<a class="btn btn-default nextprev-item prev tbox npbutton" href="{url}" title="{url_label}">{label}</a> ';
|
||||
// 'tbox npbutton' classes are deprecated!!!
|
||||
$NEXTPREV_TEMPLATE['dropdown_nav_next'] = ' <a class="btn nextprev-item next tbox npbutton" href="{url}" title="{url_label}">{label}</a>';
|
||||
$NEXTPREV_TEMPLATE['dropdown_nav_next'] = ' <a class="btn btn-default nextprev-item next tbox npbutton" href="{url}" title="{url_label}">{label}</a>';
|
||||
|
||||
// 'npdropdown' class is deprecated!!!
|
||||
$NEXTPREV_TEMPLATE['dropdown_items_start'] = '<select class="tbox npdropdown nextprev-select" name="pageSelect" onchange="window.location.href=this.options[selectedIndex].value">';
|
||||
|
@ -313,6 +313,7 @@ abstract class e_marketplace_adapter_abstract
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$mes = e107::getMessage();
|
||||
$fl = e107::getFile();
|
||||
|
||||
$id = intval($id);
|
||||
$qry = 'id='.$id.'&type='.$type.'&mode='.$mode;
|
||||
@ -327,13 +328,13 @@ abstract class e_marketplace_adapter_abstract
|
||||
|
||||
if(!$result)
|
||||
{
|
||||
$mes->addError("Download Error"); // flush();
|
||||
if(filesize(e_TEMP.$localfile))
|
||||
{
|
||||
$contents = file_get_contents(e_TEMP.$localfile);
|
||||
$contents = explode('REQ_', $contents);
|
||||
$mes->addError('[#'.trim($contents[1]).'] '.trim($contents[0])); flush();
|
||||
}
|
||||
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return false;
|
||||
}
|
||||
@ -350,91 +351,28 @@ abstract class e_marketplace_adapter_abstract
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
if($fl->unzipArchive($localfile,$type))
|
||||
{
|
||||
// $mes->addSuccess("Download Successful");
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
$contents = file_get_contents(e_TEMP.$localfile);
|
||||
if(strlen($contents) < 400)
|
||||
{
|
||||
echo "<script>alert('".$tp->toJS($contents)."')</script>";
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
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_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
|
||||
$dir = e107::getFile(true)->getRootFolder($unarc);
|
||||
$destpath = ($type == 'theme') ? e_THEME : e_PLUGIN;
|
||||
$typeDiz = ucfirst($type);
|
||||
|
||||
@copy(e_TEMP.$localfile, e_BACKUP.$dir.".zip"); // Make a Backup in the system folder.
|
||||
|
||||
if($dir && is_dir($destpath.$dir))
|
||||
{
|
||||
$mes->addError("(".ucfirst($type).") Already Downloaded - ".basename($destpath).'/'.$dir); flush();
|
||||
@unlink(e_TEMP.$localfile);
|
||||
@unlink(e_TEMP.$dir );
|
||||
return false;
|
||||
}
|
||||
|
||||
if($dir == '')
|
||||
{
|
||||
$mes->addError("Couldn't detect the root folder in the zip."); // flush();
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(is_dir(e_TEMP.$dir))
|
||||
{
|
||||
$this->success[] = "Unzipping...";
|
||||
if(!rename(e_TEMP.$dir,$destpath.$dir))
|
||||
{
|
||||
$mes->addError("Couldn't Move ".e_TEMP.$dir." to ".$destpath.$dir." Folder"); // flush(); usleep(50000);
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
$mes->addSuccess("Download Complete!"); flush();
|
||||
|
||||
// $dir = basename($unarc[0]['filename']);
|
||||
// $plugPath = preg_replace("/[^a-z0-9-\._]/", "-", strtolower($dir));
|
||||
//$status = "Done"; // ADMIN_TRUE_ICON;
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return true;
|
||||
$mes->addSuccess("Download Complete!");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//ADMIN_FALSE_ICON.
|
||||
$mes->addSuccess( "<a href='".$remotefile."'>Download Manually</a>"); // flush(); usleep(50000);
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
$mes->addDebug(print_a($unarc, true)); flush();
|
||||
}
|
||||
|
||||
$mes->addDebug(print_a($unarc, true)); flush();
|
||||
}
|
||||
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
public function getSuccess()
|
||||
{
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -942,8 +942,10 @@ class e_file
|
||||
if($d['folder'] == 1 && $target == $test) //
|
||||
{
|
||||
// $text .= "\\n test = ".$test;
|
||||
$text .= "\\n test=".$test;
|
||||
$text .= "\\n target=".$target;
|
||||
$text = "getRootDirectory: ".$d['stored_filename'];
|
||||
$text .= "<br />test=".$test;
|
||||
$text .= "<br />target=".$target;
|
||||
|
||||
if(E107_DEBUG_LEVEL > 0)
|
||||
{
|
||||
e107::getMessage()->addDebug($text);
|
||||
@ -993,5 +995,110 @@ class e_file
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recursive Directory removal .
|
||||
*/
|
||||
public function removeDir($dir)
|
||||
{
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$objects = scandir($dir);
|
||||
foreach ($objects as $object)
|
||||
{
|
||||
if ($object != "." && $object != "..")
|
||||
{
|
||||
if (filetype($dir."/".$object) == "dir")
|
||||
{
|
||||
$this->removeDir($dir."/".$object);
|
||||
}
|
||||
else
|
||||
{
|
||||
@unlink($dir."/".$object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset($objects);
|
||||
@rmdir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* File-class wrapper for upload handler. (Preferred for v2.x)
|
||||
* Process files uploaded in a form post. ie. $_FILES.
|
||||
*/
|
||||
public function getUploaded($uploaddir, $fileinfo = false, $options = null)
|
||||
{
|
||||
require_once(e_HANDLER."upload_handler.php");
|
||||
return process_uploaded_files($uploaddir, $fileinfo, $options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*/
|
||||
public function unzipArchive($localfile, $type)
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
|
||||
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_TEMP, PCLZIP_OPT_SET_CHMOD, 0755)); // Store in TEMP first.
|
||||
$dir = $this->getRootFolder($unarc);
|
||||
$destpath = ($type == 'theme') ? e_THEME : e_PLUGIN;
|
||||
$typeDiz = ucfirst($type);
|
||||
|
||||
@copy(e_TEMP.$localfile, e_BACKUP.$dir.".zip"); // Make a Backup in the system folder.
|
||||
|
||||
if($dir && is_dir($destpath.$dir))
|
||||
{
|
||||
$mes->addError("(".ucfirst($type).") Already Downloaded - ".basename($destpath).'/'.$dir);
|
||||
|
||||
if(file_exists(e_TEMP.$localfile))
|
||||
{
|
||||
@unlink(e_TEMP.$localfile);
|
||||
}
|
||||
|
||||
$this->removeDir(e_TEMP.$dir);
|
||||
return false;
|
||||
}
|
||||
|
||||
if($dir == '')
|
||||
{
|
||||
$mes->addError("Couldn't detect the root folder in the zip."); // flush();
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(is_dir(e_TEMP.$dir))
|
||||
{
|
||||
if(!rename(e_TEMP.$dir,$destpath.$dir))
|
||||
{
|
||||
$mes->addError("Couldn't Move ".e_TEMP.$dir." to ".$destpath.$dir." Folder"); // flush(); usleep(50000);
|
||||
@unlink(e_TEMP.$localfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $dir = basename($unarc[0]['filename']);
|
||||
// $plugPath = preg_replace("/[^a-z0-9-\._]/", "-", strtolower($dir));
|
||||
//$status = "Done"; // ADMIN_TRUE_ICON;
|
||||
@unlink(e_TEMP.$localfile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1672,9 +1672,9 @@ class e_form
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
$text = '<span class="input-append e-search">'.$tp->toGlyph('fa-search').'
|
||||
'.$this->text($name, $searchVal,20,'class=search-query').'
|
||||
<button class="btn btn-primary" name="'.$submitName.'" type="submit">'.LAN_GO.'</button>
|
||||
$text = '<span class="input-append e-search">
|
||||
'.$this->text($name, $searchVal,20,'class=search-query&placeholder='.LAN_SEARCH).'
|
||||
<button class="btn btn-primary" name="'.$submitName.'" type="submit">'.$tp->toGlyph('fa-search',' ').'</button>
|
||||
</span>';
|
||||
|
||||
|
||||
|
@ -417,6 +417,8 @@ class themeHandler
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
return $frm->search($name, $searchVal, $submitName, $filterName, $filterArray, $filterVal);
|
||||
|
||||
$text = '<span class="input-append e-search"><i class="icon-search"></i>
|
||||
'.$frm->text($name, $searchVal,20,'class=search-query').'
|
||||
<button class="btn btn-primary" name="'.$submitName.'" type="submit">'.LAN_GO.'</button>
|
||||
|
@ -115,30 +115,36 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
$admin_log = e107::getAdminLog();
|
||||
|
||||
$ul_temp_dir = '';
|
||||
if (ini_get('open_basedir') != '')
|
||||
{ // Need to move file to intermediate directory before we can read its contents to check it.
|
||||
if (ini_get('open_basedir') != '') // Need to move file to intermediate directory before we can read its contents to check it.
|
||||
{
|
||||
$ul_temp_dir = e_UPLOAD_TEMP_DIR;
|
||||
}
|
||||
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, debug_backtrace(), "DEBUG", "Upload Handler test", "Process uploads to {$uploaddir}, fileinfo ".$fileinfo, FALSE, LOG_TO_ROLLING);
|
||||
{
|
||||
e107::getLog()->e_log_event(10, debug_backtrace(), "DEBUG", "Upload Handler test", "Process uploads to {$uploaddir}, fileinfo ".$fileinfo, FALSE, LOG_TO_ROLLING);
|
||||
}
|
||||
|
||||
// $admin_log->e_log_event(10,__FILE__."|".__FUNCTION__."@".__LINE__,"DEBUG","Upload Handler test","Intermediate directory: {$ul_temp_dir} ",FALSE,LOG_TO_ROLLING);
|
||||
|
||||
$overwrite = varset($options['overwrite'], FALSE);
|
||||
|
||||
$uploaddir = realpath($uploaddir); // Mostly to get rid of the grot that might be passed in from legacy code. Also strips any trailing '/'
|
||||
|
||||
if (!is_dir($uploaddir))
|
||||
{
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Invalid directory: ".$uploaddir, FALSE, FALSE);
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Invalid directory: ".$uploaddir, FALSE, FALSE);
|
||||
}
|
||||
|
||||
return FALSE; // Need a valid directory
|
||||
}
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Destination directory: ".$uploaddir, FALSE, FALSE);
|
||||
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Destination directory: ".$uploaddir, FALSE, FALSE);
|
||||
}
|
||||
|
||||
$final_chmod = varset($options['final_chmod'], 0644);
|
||||
|
||||
if (isset($options['file_array_name']))
|
||||
@ -155,26 +161,28 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
if (!is_array($files))
|
||||
{
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "No files uploaded", FALSE, FALSE);
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "No files uploaded", FALSE, FALSE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$uploaded = array(
|
||||
);
|
||||
$uploaded = array();
|
||||
|
||||
$max_upload_size = calc_max_upload_size(varset($options['max_upload_size'], -1)); // Find overriding maximum upload size
|
||||
$allowed_filetypes = get_filetypes(varset($options['file_mask'], ''), varset($options['filetypes'], ''));
|
||||
$max_upload_size = set_max_size($allowed_filetypes, $max_upload_size);
|
||||
$max_upload_size = calc_max_upload_size(varset($options['max_upload_size'], -1)); // Find overriding maximum upload size
|
||||
$allowed_filetypes = get_filetypes(varset($options['file_mask'], ''), varset($options['filetypes'], ''));
|
||||
$max_upload_size = set_max_size($allowed_filetypes, $max_upload_size);
|
||||
|
||||
// That's the basics set up - we can start processing files now
|
||||
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Start individual files: ".count($files['name'])." Max upload: ".$max_upload_size, FALSE, FALSE);
|
||||
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Start individual files: ".count($files['name'])." Max upload: ".$max_upload_size, FALSE, FALSE);
|
||||
}
|
||||
|
||||
$c = 0;
|
||||
$tp = e107::getParser();
|
||||
|
||||
foreach ($files['name'] as $key=>$name)
|
||||
{
|
||||
$first_error = FALSE; // Clear error flag
|
||||
@ -191,9 +199,10 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
$files['type'][$key] = 'Unknowm mime-type';
|
||||
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Process file {$name}, size ".$files['size'][$key], FALSE, FALSE);
|
||||
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Process file {$name}, size ".$files['size'][$key], FALSE, FALSE);
|
||||
}
|
||||
|
||||
if ($max_file_count && ($c >= $max_file_count))
|
||||
{
|
||||
$first_error = 249; // 'Too many files uploaded' error
|
||||
@ -261,11 +270,15 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
{ // Need to move file to our own temporary directory
|
||||
$tempfilename = $uploadfile;
|
||||
$uploadfile = $ul_temp_dir.basename($uploadfile);
|
||||
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Move {$tempfilename} to {$uploadfile} ", FALSE, LOG_TO_ROLLING);
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Move {$tempfilename} to {$uploadfile} ", FALSE, LOG_TO_ROLLING);
|
||||
}
|
||||
|
||||
@move_uploaded_file($tempfilename, $uploadfile); // This should work on all hosts
|
||||
}
|
||||
|
||||
$tpos = (($file_status = vet_file($uploadfile, $name, $allowed_filetypes, varset($options['extra_file_types'], FALSE))) === TRUE);
|
||||
}
|
||||
if ($tpos === FALSE)
|
||||
@ -275,8 +288,8 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$first_error)
|
||||
{ // All tests passed - can store it somewhere
|
||||
if (!$first_error) // All tests passed - can store it somewhere
|
||||
{
|
||||
$uploaded[$c]['name'] = $name;
|
||||
$uploaded[$c]['rawname'] = $raw_name;
|
||||
$uploaded[$c]['origname'] = $origname;
|
||||
@ -288,14 +301,20 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
if ((!$ul_temp_dir && @move_uploaded_file($uploadfile, $destination_file)) || ($ul_temp_dir && @rename($uploadfile, $destination_file))) // This should work on all hosts
|
||||
{
|
||||
@chmod($destination_file, $final_chmod);
|
||||
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Final chmod() file {$destination_file} to {$final_chmod} ", FALSE, FALSE);
|
||||
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Final chmod() file {$destination_file} to {$final_chmod} ", FALSE, FALSE);
|
||||
}
|
||||
|
||||
$uploaded[$c]['size'] = $files['size'][$key];
|
||||
$uploaded[$c]['fullpath'] = $uploaddir.DIRECTORY_SEPARATOR.$name;
|
||||
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Saved file {$c} OK: ".$uploaded[$c]['name'], FALSE, FALSE);
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Saved file {$c} OK: ".$uploaded[$c]['name'], FALSE, FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -303,8 +322,8 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
}
|
||||
}
|
||||
|
||||
if (!$first_error)
|
||||
{ // This file succeeded
|
||||
if (!$first_error) // This file succeeded
|
||||
{
|
||||
$uploaded[$c]['message'] = LANUPLOAD_3." '".$raw_name."'";
|
||||
$uploaded[$c]['error'] = 0;
|
||||
}
|
||||
@ -363,16 +382,21 @@ function process_uploaded_files($uploaddir, $fileinfo = FALSE, $options = NULL)
|
||||
$uploaded[$c]['message'] = LANUPLOAD_11." '".$name."' <br />".LANUPLOAD_12.": ".$error;
|
||||
$uploaded[$c]['line'] = __LINE__;
|
||||
$uploaded[$c]['file'] = __FILE__;
|
||||
if (UH_DEBUG)
|
||||
$admin_log->
|
||||
e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Main routine error {$first_error} file {$c}: ".$uploaded[$c]['message'], FALSE, FALSE);
|
||||
// If we need to abort on first error, do so here - could check for specific error codes
|
||||
|
||||
if (UH_DEBUG) // If we need to abort on first error, do so here - could check for specific error codes
|
||||
{
|
||||
e107::getLog()->e_log_event(10, __FILE__."|".__FUNCTION__."@".__LINE__, "DEBUG", "Upload Handler test", "Main routine error {$first_error} file {$c}: ".$uploaded[$c]['message'], FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_file($uploadfile))
|
||||
{
|
||||
@unlink($uploadfile); // Don't leave the file on the server if error (although should be auto-deleted)
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
return $uploaded;
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,13 @@ define("EPL_ADLAN_34", "Plugin successfully updated.");
|
||||
define("EPL_ADLAN_35", "Parser settings successfully added.");
|
||||
define("EPL_ADLAN_36", "Parser code insert failed, incorrectly formatted.");
|
||||
|
||||
define("EPL_ADLAN_37", "Upload plugin (.zip or .tar.gz format)");
|
||||
define("EPL_ADLAN_37", "Upload plugin (.zip format)");
|
||||
define("EPL_ADLAN_38", "Upload Plugin");
|
||||
define("EPL_ADLAN_39", "The file could not be uploaded as the ".e_PLUGIN." folder does not have the correct permissions - please change the write permissions and re-upload the file.");
|
||||
define("EPL_ADLAN_40", "Admin Message");
|
||||
define("EPL_ADLAN_41", "That file does not appear to be a valid .zip or .tar archive.");
|
||||
define("EPL_ADLAN_42", "An error has occurred, unable to un-archive the file");
|
||||
define("EPL_ADLAN_43", "Your plugin has been uploaded and unzipped; to install go to <a href='".e_ADMIN."plugin.php?avail'>the uninstalled plugins page</a>."); // FIXME HTML
|
||||
define("EPL_ADLAN_43", "Your plugin has been uploaded and add to the uninstalled plugins list."); // FIXME HTML
|
||||
define("EPL_ADLAN_44", "Auto plugin upload and extraction is disabled as upload to your plugins folder is not allowed at present - if you want to be able to do this, please change the permissions on your ".e_PLUGIN." folder to allow uploads.");
|
||||
define("EPL_ADLAN_45", "Your menu item has been uploaded and unzipped, to activate go to <a href='".e_ADMIN."menus.php'>your menus page</a>."); //FIXME HTML
|
||||
define("EPL_ADLAN_46", "PCLZIP extract error:");
|
||||
|
@ -239,8 +239,10 @@ img.S32:hover {}
|
||||
|
||||
.adminlist .col-selection-cont { position: relative; float:right; }
|
||||
|
||||
span.e-search input[type='text'] { padding-left:25px }
|
||||
span.e-search input[type='text'] { padding-left:15px; text-decoration: italic }
|
||||
/*
|
||||
span.e-search i { margin-right:-20px; margin-left:5px; margin-top:-7px; z-index:100; position:relative; }
|
||||
*/
|
||||
// span.e-search { margin-bottom:-5px; margin-top:10px }
|
||||
/******** SyS Messages / Message text formatting */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user