added dynamic package description tootips

updated tablesorter to v2.25.0
add tablesorter widgets
(filter, saveSort, stickyHeaders, hover highlight)
added cli options to packagemanager script
This commit is contained in:
Derek Macias
2016-01-10 03:23:15 -07:00
parent 71e7008acd
commit 0495315d4f
13 changed files with 7204 additions and 50 deletions

View File

@@ -1,24 +1,27 @@
<?php
$config_file = "/boot/config/plugins/NerdPack/NerdPack.cfg";
require_once("/usr/local/emhttp/plugins/NerdPack/include/NerdPackHelpers.php");
$pkg_path = "/boot/config/plugins/NerdPack/packages/"; // package path
$plg_path ="/boot/config/plugins/NerdPack";// plugin path
$pkg_path = "$plg_path/packages"; // package path
$config_file = "$plg_path/NerdPack.cfg";// config file
$pkg_cfg = (is_file($config_file)) ? parse_ini_file($config_file) : array(); // get package configs
$pkgs_downloaded = array_diff( scandir($pkg_path, 1), array(".", "..") ); // get array of packages
$pkgs_downloaded = array_diff( scandir($pkg_path, 1), array(".", "..") ); // get array of downloaded packages
$pkgs_installed = array_diff( scandir("/var/log/packages", 1), array(".", "..") ); // get array of all installed packages
$pkgs_file = file_get_contents("/boot/config/plugins/NerdPack/packages.json");
$pkgs_github = json_decode($pkgs_file, true);
$pkgs_desc_file = file_get_contents("$pkg_path/packages-desc");// get package descriptions
$pkgs_desc_array = json_decode($pkgs_desc_file, true);
$pkgs_github_file = file_get_contents("$pkg_path/packages.json");// get packages
$pkgs_github_array = json_decode($pkgs_github_file, true);
$pkgs_array = array();
for ($i = 0; $i < sizeof($pkgs_github); $i++) {
for ($i = 0; $i < sizeof($pkgs_github_array); $i++) {
$pkg_nameArray = explode("-", $pkgs_github[$i]["name"]); // split package name into array
$pkg_nameArray = explode("-", $pkgs_github_array[$i]["name"]); // split package name into array
$pkg_name = $pkg_nameArray[0];
if (sizeof($pkg_nameArray) > 4){ //if package name has a subset get it
@@ -35,7 +38,7 @@ for ($i = 0; $i < sizeof($pkgs_github); $i++) {
$pkg = array();
$pkg["name"] = $pkgs_github[$i]["name"]; // add full package name
$pkg["name"] = $pkgs_github_array[$i]["name"]; // add full package name
$pkg["pkgname"] = $pkg_name; // add package name only
@@ -43,24 +46,26 @@ for ($i = 0; $i < sizeof($pkgs_github); $i++) {
$pkg["pkgversion"] = $pkg_version; // add package name with underscored version
$pkg["size"] = $pkgs_github[$i]["size"]; // add package size
$pkg["size"] = format_size($pkgs_github_array[$i]["size"], 1, '?'); // add package size
// checks if package name is installed
$pkg["installed"] = preg_grep($pkg_pattern , $pkgs_installed) ? "yes" : "no";
// checks if package is installed equals github exactly
$pkg["installeq"] = in_array( pathinfo($pkgs_github[$i]["name"], PATHINFO_FILENAME), $pkgs_installed ) ? "yes" : "no";
$pkg["installeq"] = in_array( pathinfo($pkgs_github_array[$i]["name"], PATHINFO_FILENAME), $pkgs_installed ) ? "yes" : "no";
// checks if package name is downloaded
$pkg["downloaded"] = preg_grep($pkg_pattern , $pkgs_downloaded) ? "yes" : "no";
// checks if package is downloaded equals github exactly
$pkg["downloadeq"] = in_array( $pkgs_github[$i]["name"], $pkgs_downloaded ) ? "yes" : "no";
$pkg["downloadeq"] = in_array( $pkgs_github_array[$i]["name"], $pkgs_downloaded ) ? "yes" : "no";
$pkg["config"] = isset($pkg_cfg["$pkg_nver"]) ? $pkg_cfg["$pkg_nver"] : "no"; // checks config for install preference
$pkg["desc"] = $pkgs_desc_array["$pkg_name"];
$pkgs_array[] = $pkg;
}
echo json_encode($pkgs_array);
?>
?>