TRUE, "desc" => gettext("Extensions"), "logfile" => "{$config['onebuttoninstaller']['rootfolder']}extensions.txt", "filename" => "extensions.txt", "type" => "plain", "pattern" => "/^(.*)###(.*)###(.*)###(.*)###(.*)###(.*)###(.*)$/", "columns" => array( array("title" => gettext("Extensions"), "class" => "listlr", "param" => "align=\"left\" valign=\"middle\" nowrap", "pmid" => 0), array("title" => gettext("Version"), "class" => "listr", "param" => "align=\"center\" valign=\"middle\"", "pmid" => 1), array("title" => gettext("Description"), "class" => "listr", "param" => "align=\"left\" valign=\"middle\"", "pmid" => 5), array("title" => gettext("Install"), "class" => "listr", "param" => "align=\"center\" valign=\"middle\"", "pmid" => 4) )) ); function log_get_contents($logfile) { $content = array(); if (is_file($logfile)) exec("cat {$logfile}", $extensions); else return; $content = $extensions; return $content; } function log_display($loginfo) { global $g; global $config; global $savemsg; global $image_path; if (!is_array($loginfo)) return; // Create table header echo ""; foreach ($loginfo['columns'] as $columnk => $columnv) { echo "".htmlspecialchars($columnv['title'])."\n"; } echo ""; // Get file content $content = log_get_contents($loginfo['logfile']); if (empty($content)) return; sort($content); $j = 0; /* * EXTENSIONS.TXT format description: PARAMETER DELIMITER -> ### * PMID COMMENT * name: 0 extension name * version: 1 extension version (base for config entry - could change for newer versions) * xmlstring: 2 config.xml or installation directory * command(list)1: 3 execution of SHELL commands / scripts (e.g. download installer, untar, chmod, ...) * command(list)2: 4 empty ("-") or PHP script name (file MUST exist) * description: 5 plain text which can include HTML tags * unsupported 6 unsupported architecture, plattform */ // Create table data foreach ($content as $contentv) { // handle each line => one extension unset($result); $result = explode("###", $contentv); // retrieve extension content (pmid based) if ((FALSE === $result) || (0 == $result)) continue; echo "\n"; for ($i = 0; $i < count($loginfo['columns']); $i++) { // handle pmids (columns) if ($i == count($loginfo['columns']) - 1) { // check if current architecture, plattform is supported // architectures: x86, x64, rpi // platforms: embedded, full, livecd, liveusb if (!empty($result[6]) && ((strpos($result[6], $g['arch']) !== false) || (strpos($result[6], $g['platform']) !== false))) { echo " \n"; } else { // check if extension is already installed (existing config.xml entry or, for command line tools, based on installation directory) if ((isset($config[$result[2]])) || ((strpos($result[2], "/") == 0) && (is_dir("{$config['onebuttoninstaller']['storage_path']}{$result[2]}")))){ echo " \n"; } else { // data for installation echo " \n"; } // EOinstallation } // EOsupported } // EOcount else echo "" . $result[$loginfo['columns'][$i]['pmid']] . "\n"; } // EOcolumns echo "\n"; $j++; } } if (isset($_POST['install'], $_POST['name'])) { foreach($_POST['name'] as $line) { if (isset($line['extension'])) { $savemsg .= gettext("Installation").": {$line['truename']}"."
"; unset($result); exec("cd {$config["onebuttoninstaller"]["storage_path"]} && {$line['command1']}", $result, $return_val); if ($return_val == 0) { foreach ($result as $msg) $savemsg .= $msg."
"; // output on success unset($result); if ("{$line['command2']}" != "-") { // check if a PHP script must be executed if (file_exists("{$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']}")) { $savemsg_old = $savemsg; // save messages for use after output buffering ends ob_start(); // start output buffering include("{$config['onebuttoninstaller']['storage_path']}/{$line['command2']}"); $ausgabe = ob_get_contents(); // get outputs from include command ob_end_clean(); // close output buffering $savemsg = $savemsg_old; // recover saved messages ... $savemsg .= str_replace("\n", "
", $ausgabe)."
"; // ... and append messages from include command } else $errormsg .= sprintf(gettext("PHP script %s not found!"), "{$config["onebuttoninstaller"]["storage_path"]}/{$line['command2']}")."
"; } } // EOcommand1 OK else { // throw error message for command1 $errormsg .= gettext("Installation error").": {$line['truename']}"."
"; foreach ($result as $msg) $errormsg .= $msg."
"; } // EOcommand1 NOK } // EOisset line } // EOforeach } // EOinstall if (isset($_POST['update']) || (isset($config['onebuttoninstaller']['auto_update']) && !isset($_POST['install']))) { $return_val = mwexec("fetch -o {$config['onebuttoninstaller']['rootfolder']}extensions.txt https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/extensions.txt", true); if ($return_val == 0) $savemsg .= gettext("New extensions list successfully downloaded!")."
"; else $errormsg .= gettext("Unable to retrieve extensions list from server!")."
"; } // EOupdate if (!is_file("{$config['onebuttoninstaller']['rootfolder']}extensions.txt")) $errormsg .= sprintf(gettext("File %s not found!"), "{$config['onebuttoninstaller']['rootfolder']}extensions.txt")."
"; bindtextdomain("nas4free", "/usr/local/share/locale"); // to get the right main menu language include("fbegin.inc"); bindtextdomain("nas4free", "/usr/local/share/locale-obi"); ?>
" value="" onclick="return confirm('')" /> " value="" />