Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mw committed Dec 11, 2018
1 parent f7ef724 commit 63c9c38
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 20 deletions.
6 changes: 0 additions & 6 deletions install/installer.sh
Expand Up @@ -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


Expand All @@ -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


Expand Down Expand Up @@ -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
4 changes: 0 additions & 4 deletions install/uninstall.sh
Expand Up @@ -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
Expand Down
23 changes: 15 additions & 8 deletions lib/MicroweberStorage.php
Expand Up @@ -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);
}
Expand Down
21 changes: 19 additions & 2 deletions views/white_label.php
Expand Up @@ -111,7 +111,7 @@
</div>
</div>

<div class="col-md-4">
<div class="col-md-8">
<div class="form-group">
<label for="logo_admin" class="control-label">Logo for Admin panel (size: 180x35 px)</label>
<input type="text" name="logo_admin" class="form-control" id="logo_admin" value="<?= isset($branding['logo_admin']) ? $branding['logo_admin'] : ''; ?>">
Expand All @@ -130,10 +130,27 @@
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" name="disable_marketplace" value="1" <?= (isset($branding['disable_marketplace']) AND $branding['disable_marketplace'] == 1) ? 'checked' : ''; ?>> Microweber Marketplace
<input type="checkbox" name="disable_marketplace" value="1" <?= (isset($branding['disable_marketplace']) AND $branding['disable_marketplace'] == 1) ? 'checked' : ''; ?>> Disable Microweber Marketplace
</label>
</div>
</div>


<div class="form-group">
<label for="brand_name" class="control-label">WHMCS Intragration</label>
<input type="text" name="whmcs_url" class="form-control" id="whmcs_url" placeholder="Enter the URL of your WHMCS" value="<?= isset($branding['whmcs_url']) ? $branding['whmcs_url'] : ''; ?>">
<br>
<small>You must install the Microweber WHMCS addon from <a href="https://github.com/microweber-dev/whmcs-plugin" target="_blank">this link</a> and then Enter the url of WHMCS for example: https://members.microweber.com/ </small>

</div>








<div class="">
<button type="submit" class="btn btn-primary">Save</button>
</div>
Expand Down

0 comments on commit 63c9c38

Please sign in to comment.