From 63c9c38e475eada9117f83394159a05648f618f6 Mon Sep 17 00:00:00 2001 From: Peter Ivanov Date: Tue, 11 Dec 2018 14:57:39 +0200 Subject: [PATCH] updates --- install/installer.sh | 6 ------ install/uninstall.sh | 4 ---- lib/MicroweberStorage.php | 23 +++++++++++++++-------- views/white_label.php | 21 +++++++++++++++++++-- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/install/installer.sh b/install/installer.sh index 4e62073f..c9cede51 100644 --- a/install/installer.sh +++ b/install/installer.sh @@ -44,21 +44,18 @@ unregister_cp=`/usr/local/cpanel/scripts/uninstall_plugin /usr/local/cpanel/micr if [ -z "$unregister_cp" ]; then echo "Cleaning up cPanel plugin" - exit 1 fi unregister_whm=`/usr/local/cpanel/bin/unregister_appconfig /usr/local/cpanel/microweber/install/microweber.conf` if [ -z "$unregister_whm" ]; then echo "Cleaning up WHM plugin" - exit 1 fi unregister_hooks=`/usr/local/cpanel/bin/manage_hooks delete script /usr/local/cpanel/microweber/hooks/mw_hooks.php` if [ -z "$unregister_hooks" ]; then echo "Cleaning up hooks" - exit 1 fi @@ -67,14 +64,12 @@ register_cp=`/usr/local/cpanel/scripts/install_plugin /usr/local/cpanel/microweb if [ -z "$register_cp" ]; then echo "Unable to register cPanel plugin" - exit 1 fi register_whm=`/usr/local/cpanel/bin/register_appconfig /usr/local/cpanel/microweber/install/microweber.conf` if [ -z "$register_whm" ]; then echo "Unable to register WHM plugin" - exit 1 fi @@ -125,5 +120,4 @@ register_hooks=`/usr/local/cpanel/bin/manage_hooks add script /usr/local/cpanel/ if [ -z "$register_hooks" ]; then echo "Unable to register hooks" - exit 1 fi \ No newline at end of file diff --git a/install/uninstall.sh b/install/uninstall.sh index 5543d55a..a5669614 100644 --- a/install/uninstall.sh +++ b/install/uninstall.sh @@ -7,28 +7,24 @@ echo "Uninstalling Microweber cPanel plugin..."; username=`whoami` if [ "$username" != "root" ]; then echo "Please run this script as root"; - exit 1 fi unregister_cp=`/usr/local/cpanel/scripts/uninstall_plugin /usr/local/cpanel/microweber/install/mw-plugin` if [ -z "$unregister_cp" ]; then echo "Unable to remove cPanel plugin" - exit 1 fi unregister_whm=`/usr/local/cpanel/bin/unregister_appconfig /usr/local/cpanel/microweber/install/microweber.conf` if [ -z "$unregister_whm" ]; then echo "Unable to remove WHM plugin" - exit 1 fi unregister_hooks=`/usr/local/cpanel/bin/manage_hooks delete script /usr/local/cpanel/microweber/hooks/mw_hooks.php` if [ -z "$unregister_hooks" ]; then echo "Unable to remove hooks" - exit 1 fi ## Remove symlinks diff --git a/lib/MicroweberStorage.php b/lib/MicroweberStorage.php index 9b2de831..27c06d57 100644 --- a/lib/MicroweberStorage.php +++ b/lib/MicroweberStorage.php @@ -5,20 +5,27 @@ class MicroweberStorage private $file; private $storage; - public function __construct($file = '/usr/local/cpanel/microweber/storage/settings.json') { + public function __construct($file = '/usr/local/cpanel/microweber/storage/settings.json') + { $this->file = $file; } - public function read() { + public function read() + { $data = file_get_contents($this->file); - $this->storage = @json_decode($data,true); - return $this->storage ; + $this->storage = @json_decode($data, true); + return $this->storage; } - - public function save($data) { - if($this->storage and is_array($this->storage)){ - $data = array_merge($this->storage,$data); + + public function save($data) + { + if ($this->storage and is_array($this->storage)) { + $data = array_merge($this->storage, $data); + } + if (is_array($data) and !empty($data)) { + $data = array_map("trim", $data); } + $data = json_encode($data); return file_put_contents($this->file, $data); } diff --git a/views/white_label.php b/views/white_label.php index 1467ad9a..58aeefeb 100644 --- a/views/white_label.php +++ b/views/white_label.php @@ -111,7 +111,7 @@ -
+
@@ -130,10 +130,27 @@
+ + +
+ + +
+ You must install the Microweber WHMCS addon from this link and then Enter the url of WHMCS for example: https://members.microweber.com/ + +
+ + + + + + + +