"; } elseif (substr($icon,0,5)=='icon-') { $icon = ""; } else { if (substr($icon,0,3)!='fa-') $icon = "fa-$icon"; $icon = ""; } $link = $launch ? "$icon" : $icon; } else { $icon = icon($name); $link = $launch ? "" : ""; } //description $readme = "plugins/{$name}/README.md"; $desc = file_exists($readme) ? Markdown(file_get_contents($readme)) : Markdown("**{$name}**"); //support $support = plugin('support',$plugin_file) ?: ""; $support = $support ? ""._('Support Thread')."" : ""; //author $author = plugin('author',$plugin_file) ?: _('anonymous'); //version $version = plugin('version',$plugin_file) ?: _('unknown'); $date = str_replace('.','',$version); //category $category = plugin('category',$plugin_file) ?: (strpos($version,'-')!==false ? 'next' : 'stable'); //status $status = $check ? _('unknown') : _('checking').'...'; $id = str_replace('.','-',$name); $empty = false; echo ""; echo "$link"; echo "$desc $support"; echo "$author"; echo "$version "; echo " $status"; echo ""; if ($os) { $regular = ['stable','next']; echo ""; } else { echo make_link('remove',basename($plugin_file)); } echo ""; echo ""; } else { //forced plugin check? $checked = (!$audit && !$check) ? check_plugin(basename($plugin_file),$ncsi) : true; $past = false; //toggle stable/next release? if ($os && $branch) { $past = plugin('version',$plugin_file); $tmp_plg = "$name-.plg"; $tmp_file = "/var/tmp/$name.plg"; copy($plugin_file,$tmp_file); exec("sed -ri 's|^(|' $tmp_file"); symlink($tmp_file,"/var/log/plugins/$tmp_plg"); $next = array_filter(explode("\n",check_plugin($tmp_plg,$ncsi)),function($row){return is_numeric($row[0]);}); $next = end($next); if (version_compare($next,$past,'>')) { copy("/tmp/plugins/$tmp_plg",$tmp_file); $plugin_file = $tmp_file; } } //version $version = plugin('version',$plugin_file) ?: _('unknown'); $date = str_replace('.','',$version); //status $status = " "._('not available').""; //compare $changes_file = $plugin_file; $url = plugin('pluginURL',$plugin_file); if ($url !== false) { $filename = "/tmp/plugins/".(($os && $branch) ? $tmp_plg : basename($url)); if ($checked && file_exists($filename)) { if ($past && $past != $version) { $status = make_link('install',$plugin_file,'forced'); } else { $latest = plugin('version',$filename); if ($os ? version_compare($latest,$version,'>') : strcmp($latest,$version) > 0) { if ($os) { $version = ""._('I have read the release notes')."
$latest"; } else { $version .= "
$latest"; } $error = null; if (!$os && (version_compare(plugin("min",$filename,$error) ?: "1.0",$Unraid['version'],">") || version_compare(plugin("max",$filename,$error) ?: "999.9.9",$Unraid['version'],"<"))) { $status = " "._("Update Incompatible").""; } else { $status = make_link("update",basename($plugin_file),$os?'cmdUpdate':''); } $changes_file = $filename; if (!$os) $updates++; } else { //status is considered outdated when older than 1 day if (file_exists($filename)) { $status = filectime($filename) > (time()-86400) ? " "._('up-to-date')."" : " "._('need check').""; } else { $status = " "._('cannot check').""; } } } } } if (strpos($status,'update')!==false) $rank = '0'; elseif (strpos($status,'install')!==false) $rank = '1'; elseif ($status=='need check') $rank = '2'; elseif ($status=='up-to-date') $rank = '3'; else $rank = '4'; if (($changes = plugin('changes',$changes_file)) !== false) { $txtfile = "/tmp/plugins/".basename($plugin_file,'.plg').".txt"; file_put_contents($txtfile,$changes); $version .= " "; } if ($rank < 2 && ($alert = plugin('alert',$changes_file)) !== false) { // generate alert message (if existing) when newer version is available file_put_contents($alerts,($os ? "" : "## $name\n\n").$alert."\n\n",FILE_APPEND); } //write plugin information $empty = false; $id = str_replace('.','-',$name); echo "vid-$id::$date::$version\rsid-$id::$rank::$status\n"; //remove temporary symlink @unlink("/var/log/plugins/$tmp_plg"); } } if ($empty) echo " "._('No plugins installed').""; if (!$init && !($os??false)) echo "\0".$updates; ?>