From eba00c2744a58d1fbfec3841d72e6fdff6be49f0 Mon Sep 17 00:00:00 2001 From: Haitem Date: Mon, 26 Oct 2020 16:45:45 +0100 Subject: [PATCH 1/2] Remake design for plugins buttons --- app/controllers/pluginsController.php | 13 +++--- app/views/templates/part/pluginButton.phtml | 46 ++++++++++++--------- app/views/templates/plugins.phtml | 17 ++------ 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/app/controllers/pluginsController.php b/app/controllers/pluginsController.php index c14ec9f..42b78fe 100644 --- a/app/controllers/pluginsController.php +++ b/app/controllers/pluginsController.php @@ -2,13 +2,16 @@ if (!empty ($_POST)){ if ( isset($_POST['name']) && - $_POST['name'] != '' && - isset($_POST['actualStatus']) + $_POST['name'] != '' ){ - if ($_POST['actualStatus']) { - rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php"); + if ($_POST['status'] == "true") { + if (file_exists ($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php")) { + rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php"); + } } else { - rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php"); + if (file_exists ($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php")) { + rename($_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/' . $_POST['name'] . ".php", $_SERVER['DOCUMENT_ROOT'] . BASEDIR . 'app/plugins/!' . $_POST['name'] . ".php"); + } } header('Location: ./plugins'); die(); diff --git a/app/views/templates/part/pluginButton.phtml b/app/views/templates/part/pluginButton.phtml index d840553..8acea49 100644 --- a/app/views/templates/part/pluginButton.phtml +++ b/app/views/templates/part/pluginButton.phtml @@ -1,21 +1,29 @@
-
-
-
-
-
- -
-
-
- -
-
+
+
+
+
+
+ +
+
+
+
+
+
+ + + echo('b_approve')?> +
+
+
+
+ + + echo('b_disable')?> +
+
+
+
+
diff --git a/app/views/templates/plugins.phtml b/app/views/templates/plugins.phtml index 6a59b5d..a002f96 100644 --- a/app/views/templates/plugins.phtml +++ b/app/views/templates/plugins.phtml @@ -27,27 +27,16 @@
- prepare('langMng',$LANGMNG); $partial->prepare('pluginName',$plugin['name']); $partial->prepare('pluginStatus',$plugin['status']); $partial->render(); - + ?> -
-
- - - -
-
-
-
-
-
From 2117e9acacea2d8e390b44f45b6b22591305a1e5 Mon Sep 17 00:00:00 2001 From: Haitem Date: Fri, 30 Oct 2020 15:25:34 +0100 Subject: [PATCH 2/2] remake to switch betwen enable and disable buton and second button is remove, remova now not work --- app/Bootstrap.php | 4 +++- app/controllers/pluginsController.php | 15 ++++++++++++--- app/views/templates/part/pluginButton.phtml | 8 ++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/Bootstrap.php b/app/Bootstrap.php index 92a884c..c0b6fe2 100644 --- a/app/Bootstrap.php +++ b/app/Bootstrap.php @@ -4,9 +4,11 @@ error_reporting(E_ALL); ini_set( 'display_errors','1'); //setup +parse_str($_SERVER['QUERY_STRING'], $params); +$urlSes = str_replace((!empty ($params['url']) ? $params['url'] : ""), "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])); session_set_cookie_params( 1209600, - str_replace('login', "", str_replace('https://' . $_SERVER['HTTP_HOST'], "", $_SERVER['REQUEST_URI'])), + $urlSes, str_replace("/var/www/", "", $_SERVER['DOCUMENT_ROOT']), true, true diff --git a/app/controllers/pluginsController.php b/app/controllers/pluginsController.php index 42b78fe..5f7ab96 100644 --- a/app/controllers/pluginsController.php +++ b/app/controllers/pluginsController.php @@ -1,9 +1,10 @@
- - echo('b_approve')?> + "/> + get('b_approve') : $LANGMNG->get('b_disable')); ?>