getThemeName(); // keep $theme, $themes1, $themes2 vars for plugin backwards compatibility for the time being $themes1 = $themeHelper->isTopNavTheme(); $themes2 = $themeHelper->isSidebarTheme(); $themeHelper->updateDockerLogColor($docroot); $display['font'] = filter_var($_COOKIE['fontSize'] ?? $display['font'] ?? '', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $header = $display['header']; // keep $header, $backgnd vars for plugin backwards compatibility for the time being $backgnd = $display['background']; $config = "/boot/config"; $entity = $notify['entity'] & 1 == 1; $alerts = '/tmp/plugins/my_alerts.txt'; $wlan0 = file_exists('/sys/class/net/wlan0'); $safemode = _var($var, 'safeMode') == 'yes'; $banner = "$config/plugins/dynamix/banner.png"; // this cannot use the webGui/banner.png file because it is not in the webGui directory but stored on the boot drive $notes = '/var/tmp/unRAIDServer.txt'; if (!file_exists($notes)) { file_put_contents($notes, shell_exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin changes $docroot/plugins/unRAIDServer/unRAIDServer.plg")); } $taskPages = find_pages('Tasks'); $buttonPages = find_pages('Buttons'); $pages = []; // finds subpages if (!empty($myPage['text'])) { $pages[$myPage['name']] = $myPage; } if (_var($myPage, 'Type') == 'xmenu') { $pages = array_merge($pages, find_pages($myPage['name'])); } // nchan related actions $nchan = ['webGui/nchan/notify_poller', 'webGui/nchan/session_check']; if ($wlan0) { $nchan[] = 'webGui/nchan/wlan0'; } // build nchan scripts from found pages $allPages = array_merge($taskPages, $buttonPages, $pages); foreach ($allPages as $page) { if (isset($page['Nchan'])) { nchan_merge($page['root'], $page['Nchan']); } } // act on nchan scripts if (count($pages)) { $running = file_exists($nchan_pid) ? file($nchan_pid, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) : []; $start = array_diff($nchan, $running); // returns any new scripts to be started $running = array_merge($start, $running); // update list of current running nchan scripts // start nchan scripts which are new or have been terminated but still should be running if (count($running)) { file_put_contents_atomic($nchan_pid, implode("\n", $running) . "\n"); foreach ($running as $row) { $script = explode(':', $row, 2)[0]; $output = []; exec('pgrep --ns $$ -f ' . escapeshellarg("$docroot/$script"),$output,$retval); if ($retval !== 0) { // 0=found; 1=none; 2=error exec(escapeshellarg("$docroot/$script") . ' >/dev/null 2>&1 &'); } } } else { @unlink($nchan_pid); } } ?> lang="= strtok($locale, '_') ?: 'en' ?>" class="= $themeHelper->getThemeHtmlClass() ?>">