function log_display($loginfo) { if (!is_array($loginfo)) { return; } // Create table header echo "<tr>"; foreach ($loginfo['columns'] as $columnk => $columnv) { echo "<td {$columnv['param']} class='" . ($columnk == 0 ? "listhdrlr" : "listhdrr") . "'>" . htmlspecialchars($columnv['title']) . "</td>\n"; } echo "</tr>"; // Get log file content $content = log_get_contents($loginfo['logfile'], $loginfo['type']); if (empty($content)) { return; } // Create table data foreach ($content as $contentv) { // Skip invalid pattern matches $result = preg_match($loginfo['pattern'], $contentv, $matches); if (FALSE === $result || 0 == $result) { continue; } // Skip empty lines if (count($loginfo['columns']) == 1 && empty($matches[1])) { continue; } echo "<tr valign=\"top\">\n"; foreach ($loginfo['columns'] as $columnk => $columnv) { echo "<td {$columnv['param']} class='{$columnv['class']}'>" . htmlspecialchars($matches[$columnv['pmid']]) . "</td>\n"; } echo "</tr>\n"; } }
function log_display($loginfo) { global $g; global $config; global $savemsg; global $image_path; if (!is_array($loginfo)) { return; } // Create table header echo "<tr>"; foreach ($loginfo['columns'] as $columnk => $columnv) { echo "<td {$columnv['param']} class='" . ($columnk == 0 ? "listhdrlr" : "listhdrr") . "'>" . htmlspecialchars($columnv['title']) . "</td>\n"; } echo "</tr>"; // 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), check for beta releases * 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, release * architectures: x86, x64, rpi, rpi2, bananapi * platforms: embedded, full, livecd, liveusb * releases: 9.3, 10.2, 10.3032853, 10.3032898, 11.0, ... */ // 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 "<tr valign=\"top\">\n"; for ($i = 0; $i < count($loginfo['columns']); $i++) { // handle pmids (columns) if (!isset($config['onebuttoninstaller']['show_beta']) && strpos($result[1], "RELEASE") === false) { continue; } else { if ($i == count($loginfo['columns']) - 1) { if (!empty($result[6])) { // something unsupported exist $unsupported = explode(",", str_replace(" ", "", $result[6])); for ($k = 0; $k < count($unsupported); $k++) { // check for unsupported release / architecture / platforms if (!check_min_release($unsupported[$k]) || $unsupported[$k] == $g['arch'] || $unsupported[$k] == $g['platform']) { echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}'> <img src='{$image_path}status_disabled.png' border='0' alt='' title='" . gettext('Unsupported architecture/platform/release') . ': ' . $unsupported[$k] . "' /></td>\n"; continue 2; // unsupported, therefore we leave and proceed to the next extension in the list } } } // check if extension is already installed (existing config.xml or postinit cmd entry) $already_installed = false; echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}' "; if (isset($config[$result[2]]) || log_get_status($result[2]) == 1) { echo "><img src='{$image_path}status_enabled.png' border='0' alt='' title='" . gettext('Enabled') . "' /"; $already_installed = true; } if ($already_installed === false || isset($config['onebuttoninstaller']['re_install'])) { // data for installation echo "><input title='" . gettext('Select to install') . "' type='checkbox' name='name[" . $j . "][extension]' value='" . $result[2] . "' />\n <input type='hidden' name='name[" . $j . "][truename]' value='" . $result[0] . "' />\n <input type='hidden' name='name[" . $j . "][command1]' value='" . $result[3] . "' />\n <input type='hidden' name='name[" . $j . "][command2]' value='" . $result[4] . "' />"; } echo "</td>\n"; } else { echo "<td {$loginfo['columns'][$i]['param']} class='{$loginfo['columns'][$i]['class']}'>" . $result[$loginfo['columns'][$i]['pmid']] . "</td>\n"; } } //EObeta-check } // EOcolumns echo "</tr>\n"; $j++; } }