From d437765a2229f171697fcb02407428983c0269e8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 4 Feb 2015 04:01:08 -0800 Subject: [PATCH] Plugin install tweaks and layout fixes. --- e107_admin/plugin.php | 57 +++++++--- e107_core/templates/nextprev_template.php | 4 +- e107_handlers/e_marketplace.php | 88 +++------------- e107_handlers/file_class.php | 111 +++++++++++++++++++- e107_handlers/form_handler.php | 6 +- e107_handlers/theme_handler.php | 2 + e107_handlers/upload_handler.php | 98 ++++++++++------- e107_languages/English/admin/lan_plugin.php | 4 +- e107_themes/bootstrap/admin_style.css | 4 +- 9 files changed, 239 insertions(+), 135 deletions(-) diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index 5c53da310..565ac6fc4 100644 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -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 .= "
".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."
"; + $text .= "
".$tp->parseTemplate("{NEXTPREV=$parms}",TRUE)."
"; } e107::getRender()->tablerender(ADLAN_98.SEP.$caption, $mes->render(). $text); @@ -600,7 +602,7 @@ class pluginManager{ // $url = e_SELF.'?mode=download&src='.base64_encode($d); - $dicon = ''; + $dicon = ''.ADMIN_INSTALLPLUGIN_ICON.''; // 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"; diff --git a/e107_core/templates/nextprev_template.php b/e107_core/templates/nextprev_template.php index 908cb63f8..7573ae2bc 100644 --- a/e107_core/templates/nextprev_template.php +++ b/e107_core/templates/nextprev_template.php @@ -162,9 +162,9 @@ $NEXTPREV_TEMPLATE['dropdown_nav_first'] = ''; $NEXTPREV_TEMPLATE['dropdown_nav_last'] = ''; // 'tbox npbutton' classes are deprecated!!! -$NEXTPREV_TEMPLATE['dropdown_nav_prev'] = ' '; +$NEXTPREV_TEMPLATE['dropdown_nav_prev'] = ' '; // 'tbox npbutton' classes are deprecated!!! -$NEXTPREV_TEMPLATE['dropdown_nav_next'] = ' '; +$NEXTPREV_TEMPLATE['dropdown_nav_next'] = ' '; // 'npdropdown' class is deprecated!!! $NEXTPREV_TEMPLATE['dropdown_items_start'] = '