From 037ae9fd1a3fc7a6986179a14527b36721e4b21c Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Sat, 18 Jul 2009 03:41:49 +0000 Subject: [PATCH] Added checkbox to theme upload form, to set as sitetheme once uploaded. --- e107_admin/theme.php | 11 ++++++-- e107_handlers/theme_handler.php | 49 ++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/e107_admin/theme.php b/e107_admin/theme.php index 33bf3484c..de59ec2e7 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/theme.php,v $ -| $Revision: 1.3 $ -| $Date: 2009-07-09 11:37:36 $ +| $Revision: 1.4 $ +| $Date: 2009-07-18 03:41:49 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -36,7 +36,12 @@ if($_POST['selectadmin']) $mode = "admin"; } -if($_POST['selectmain']) +if($_POST['upload']) +{ + $mode = "choose"; +} + +if($_POST['selectmain'] || varset($_POST['setUploadTheme'])) { $mode = "main"; } diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 24e583bcb..4ff5fe6a3 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -10,8 +10,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $ -| $Revision: 1.38 $ -| $Date: 2009-07-16 02:55:19 $ +| $Revision: 1.39 $ +| $Date: 2009-07-18 03:41:49 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -39,13 +39,14 @@ class themeHandler{ $this->fl = new e_file; - if (isset($_POST['upload'])) { + if (isset($_POST['upload'])) + { $this -> themeUpload(); } $this -> themeArray = $this -> getThemes(); - + // print_a($this -> themeArray); foreach($_POST as $key => $post) { @@ -246,7 +247,9 @@ class themeHandler{ extract($_FILES); if(!is_writable(e_THEME)) { - $ns->tablerender(TPVLAN_16, TPVLAN_20); + // $ns->tablerender(TPVLAN_16, TPVLAN_20); + $emessage->add(TPVLAN_20, E_MESSAGE_INFO); + return FALSE; } else { @@ -263,7 +266,7 @@ class themeHandler{ $emessage->add(TPVLAN_17, E_MESSAGE_ERROR); // $ns->tablerender(TPVLAN_16, TPVLAN_17); // require_once("footer.php"); - return; + return FALSE; } if ($fileSize) { @@ -282,20 +285,34 @@ class themeHandler{ $unarc = ($fileList = PclTarExtract($archiveName, e_THEME)); } - if(!$unarc) { - if($fileType == "zip") { - $error = TPVLAN_46." '".$archive -> errorName(TRUE)."'"; - } else { - $error = TPVLAN_47.PclErrorString().", ".TPVLAN_48.intval(PclErrorCode()); + if(!$unarc) + { + if($fileType == "zip") + { + $error = TPVLAN_46." '".$archive -> errorName(TRUE)."'"; + } + else + { + $error = TPVLAN_47.PclErrorString().", ".TPVLAN_48.intval(PclErrorCode()); } $emessage->add(TPVLAN_18." ".$archiveName." ".$error, E_MESSAGE_ERROR); // $ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error); - return; + return FALSE; } $folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/"))); - $ns->tablerender(TPVLAN_16, "
".TPVLAN_19."
"); + $emessage->add(TPVLAN_19, E_MESSAGE_SUCCESS); + + if(varset($_POST['setUploadTheme'])) + { + $themeArray = $this->getThemes(); + $this->id = $themeArray[$folderName]['id']; + $this->setTheme(); + + } + + // $ns->tablerender(TPVLAN_16, "
".TPVLAN_19."
"); @unlink(e_THEME.$archiveName); } @@ -387,6 +404,12 @@ class themeHandler{ + + ".TPVLAN_10." + + + +
";