echo strtoupper($lang['about']); ?> </a></li> <?php if (show_local_content_link()) { echo "<li><a href=\"http://{$_SERVER['SERVER_ADDR']}:8090/\" target=\"_self\">LOCAL CONTENT</a></li>"; } ?> </ul> </div> <div id="content"> <?php $modcount = 0; $fsmods = getmods_fs(); # if there were any modules found in the filesystem if ($fsmods) { # get a list from the databases (where the sorting # and visibility is stored) $dbmods = getmods_db(); # populate the module list from the filesystem # with the visibility/sorting info from the database foreach (array_keys($dbmods) as $moddir) { if (isset($fsmods[$moddir])) { $fsmods[$moddir]['position'] = $dbmods[$moddir]['position']; $fsmods[$moddir]['hidden'] = $dbmods[$moddir]['hidden']; } } # custom sorting function in common.php uasort($fsmods, 'bypos');
function getTasks() { $db = getdb(); $rv = $db->query("SELECT * FROM tasks WHERE dismissed IS NULL"); $tasks = array(); $modules = array(); while ($row = $rv->fetchArray(SQLITE3_ASSOC)) { $row['tasktime'] = time(); // so we can calculate against server time, not browser time if ($row['completed'] && $row['retval'] == 0) { // if the command completed successfully // auto dismiss and notify the client $row['dismissed'] = time(); $db_dismissed = $db->escapeString($row['dismissed']); $db_task_id = $db->escapeString($row['task_id']); $db->exec("UPDATE tasks SET dismissed = '{$db_dismissed}' WHERE task_id = '{$db_task_id}'"); // we also get the latest version number and return it // this is a bit inefficient, getting them all when we just need one if (empty($modules)) { $modules = getmods_fs(); } // a bit of cacheing $row['version'] = $modules[$row['moddir']]['version']; } array_push($tasks, $row); } header("HTTP/1.1 200 OK"); header("Content-Type: application/json"); echo json_encode($tasks); # , JSON_PRETTY_PRINT); # this only works in 5.4+ -- RACHEL-PLUS has 5.3.10 exit; }
function syncmods_fs2db() { # get info on the modules in the filesystem $fsmods = getmods_fs(); # get info on the modules in the database $dbmods = getmods_db(); $db = getdb(); if ($db) { $db->exec("BEGIN"); # insert anything we found in the fs that wasn't in the db foreach (array_keys($fsmods) as $moddir) { if (!isset($dbmods[$moddir])) { $db_moddir = $db->escapeString($moddir); $db_title = $db->escapeString($fsmods[$moddir]['title']); $db_position = $db->escapeString($fsmods[$moddir]['position']); $db->exec("INSERT into modules (moddir, title, position, hidden) " . "VALUES ('{$db_moddir}', '{$db_title}', '{$db_position}', '0')"); #error_log("INSERT into modules (moddir, title, position, hidden) " . # "VALUES ('$db_moddir', '$db_title', '$db_position', '0')"); } } # delete anything from the db that wasn't in the fs foreach (array_keys($dbmods) as $moddir) { if (!isset($fsmods[$moddir])) { $db_moddir = $db->escapeString($moddir); $db->exec("DELETE FROM modules WHERE moddir = '{$db_moddir}'"); #error_log("DELETE FROM modules WHERE moddir = '$db_moddir'"); } } $db->exec("COMMIT"); } }
<?php require_once "common.php"; if (!authorized()) { exit; } $page_title = "Install"; $page_script = ""; $page_nav = "install"; include "head.php"; $mods_fs = getmods_fs(); ?> <style> /* existing modules list (for deleting) */ #modlist { list-style: none; padding-left: 10px; } #modlist li { width: 20em; position: relative; border-bottom: 1px solid #999; margin-bottom: 10px; } #modlist button { font-size: small; position: absolute; border: 1px solid #999; right: 0; bottom: 0; padding: 1px 5px 0 5px;
<span id="cur_contentshell">v2.2.2</span> <div style="float: right; margin-left: 20px;"> <div style="float: left; width: 24px; height: 24px; margin-top: 2px;"> <img src="../art/spinner.gif" id="spinner" style="display: none;"> </div> <button id="updatebut" onclick="selfUpdate();" style="margin-left: 5px;">Check for Updates</button> </div> </td></tr> <tr><th colspan="2">Content<div id='avail_something'>Content Updates Available Below</div></th></tr> <?php # get module info foreach (getmods_fs() as $mod) { echo "\n <tr><td>{$mod['moddir']}</td><td>\n <span id='cur_{$mod['moddir']}'>{$mod['version']}</span>\n <button style='display: none; float: right; margin-left: 20px;' id='avail_{$mod['moddir']}' onclick=\"modUpdate('{$mod['moddir']}');\"></button>\n <div class='progbar' id='prog_{$mod['moddir']}'><div class='progbarin' id='progin_{$mod['moddir']}'></div></div>\n </td></tr>\n "; #echo "<div class='update_available' id='avail_$mod[moddir]'> Update Available</span></td></tr>\n"; } ?> </table> <ul style="margin-top: 40px;"> <li>blank indicates the item predates versioning.</li> <li>? indicates the version could not be determined, and perhaps the item is not actually installed</li> <li>* indicates the version number was recorded at installation; if you have modified your installation this info may be out of date</li> </ul> </div> </body>