Skip to content

Commit

Permalink
ncp-web: implement is_active()
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Apr 4, 2018
1 parent c2e8a36 commit ad31dd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ This code also generates the [NextCloudPi docker images](https://hub.docker.com/
* Setup wizard ( NEW 09-27-2017 )
* NextCloudPi Web Panel ( NEW 07-24-2017 )
* Wi-Fi ready ( NEW 03-31-2017 )
* Ram logs ( NEW 03-31-2017 )
* Automatic security updates, activated by default. ( NEW 03-21-2017 )
* Let’s Encrypt for trusted HTTPS certificates.( NEW 03-16-2017 )
* Fail2Ban protection against brute force attacks. ( NEW 02-24-2017 )
Expand Down
9 changes: 8 additions & 1 deletion ncp-web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<?php
// redirect to activation first time
exec("a2query -s ncp-activation", $output, $ret);
if ($ret == 0) {
header("Location: activate");
Expand Down Expand Up @@ -165,12 +166,18 @@
$files = array_diff(scandir($modules_path), array('.', '..', 'nc-wifi.sh', 'nc-info.sh', 'l10n'));

foreach ($files as $file) {

$script = pathinfo($file, PATHINFO_FILENAME);


$txt = file_get_contents($modules_path . $file);

$active = "";
if (preg_match('/^ACTIVE_=yes$/m', $txt, $matches))
$etc = '/usr/local/etc';
exec("bash -c \"source $etc/library.sh && is_active_script $etc/nextcloudpi-config.d/$script\".sh", $output, $ret);
if ($ret == 0) {
$active = "";
}

echo "<li id=\"$script\" class=\"nav-recent\">";
echo "<a href=\"#\"> {$l->__($script, $script)}$active </a>";
Expand Down

0 comments on commit ad31dd7

Please sign in to comment.