1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-28 10:20:45 +02:00

Added checkbox to theme upload form, to set as sitetheme once uploaded.

This commit is contained in:
CaMer0n
2009-07-18 03:41:49 +00:00
parent ae1d9b14ba
commit 037ae9fd1a
2 changed files with 44 additions and 16 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/theme.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/theme.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2009-07-09 11:37:36 $ | $Date: 2009-07-18 03:41:49 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -36,7 +36,12 @@ if($_POST['selectadmin'])
$mode = "admin"; $mode = "admin";
} }
if($_POST['selectmain']) if($_POST['upload'])
{
$mode = "choose";
}
if($_POST['selectmain'] || varset($_POST['setUploadTheme']))
{ {
$mode = "main"; $mode = "main";
} }

View File

@@ -10,8 +10,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $
| $Revision: 1.38 $ | $Revision: 1.39 $
| $Date: 2009-07-16 02:55:19 $ | $Date: 2009-07-18 03:41:49 $
| $Author: e107coders $ | $Author: e107coders $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -39,13 +39,14 @@ class themeHandler{
$this->fl = new e_file; $this->fl = new e_file;
if (isset($_POST['upload'])) { if (isset($_POST['upload']))
{
$this -> themeUpload(); $this -> themeUpload();
} }
$this -> themeArray = $this -> getThemes(); $this -> themeArray = $this -> getThemes();
// print_a($this -> themeArray);
foreach($_POST as $key => $post) foreach($_POST as $key => $post)
{ {
@@ -246,7 +247,9 @@ class themeHandler{
extract($_FILES); extract($_FILES);
if(!is_writable(e_THEME)) 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 else
{ {
@@ -263,7 +266,7 @@ class themeHandler{
$emessage->add(TPVLAN_17, E_MESSAGE_ERROR); $emessage->add(TPVLAN_17, E_MESSAGE_ERROR);
// $ns->tablerender(TPVLAN_16, TPVLAN_17); // $ns->tablerender(TPVLAN_16, TPVLAN_17);
// require_once("footer.php"); // require_once("footer.php");
return; return FALSE;
} }
if ($fileSize) { if ($fileSize) {
@@ -282,20 +285,34 @@ class themeHandler{
$unarc = ($fileList = PclTarExtract($archiveName, e_THEME)); $unarc = ($fileList = PclTarExtract($archiveName, e_THEME));
} }
if(!$unarc) { if(!$unarc)
if($fileType == "zip") { {
if($fileType == "zip")
{
$error = TPVLAN_46." '".$archive -> errorName(TRUE)."'"; $error = TPVLAN_46." '".$archive -> errorName(TRUE)."'";
} else { }
else
{
$error = TPVLAN_47.PclErrorString().", ".TPVLAN_48.intval(PclErrorCode()); $error = TPVLAN_47.PclErrorString().", ".TPVLAN_48.intval(PclErrorCode());
} }
$emessage->add(TPVLAN_18." ".$archiveName." ".$error, E_MESSAGE_ERROR); $emessage->add(TPVLAN_18." ".$archiveName." ".$error, E_MESSAGE_ERROR);
// $ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error); // $ns->tablerender(TPVLAN_16, TPVLAN_18." ".$archiveName." ".$error);
return; return FALSE;
} }
$folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/"))); $folderName = substr($fileList[0]['stored_filename'], 0, (strpos($fileList[0]['stored_filename'], "/")));
$ns->tablerender(TPVLAN_16, "<div class='center'>".TPVLAN_19."</div>"); $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, "<div class='center'>".TPVLAN_19."</div>");
@unlink(e_THEME.$archiveName); @unlink(e_THEME.$archiveName);
} }
@@ -387,6 +404,12 @@ class themeHandler{
<input class='tbox' type='file' name='file_userfile[]' size='50' /> <input class='tbox' type='file' name='file_userfile[]' size='50' />
</td> </td>
</tr> </tr>
<tr>
<td>".TPVLAN_10."</td>
<td>
<input type='checkbox' name='setUploadTheme' value='1' />
</td>
</tr>
</table> </table>
<div class='buttons-bar center'>"; <div class='buttons-bar center'>";