more cleaning

This commit is contained in:
Squidly271 2022-11-18 17:15:50 -05:00
parent 79941dccc4
commit bc7b5c1746
5 changed files with 72 additions and 72 deletions

View File

@ -2,8 +2,8 @@ ae9874967a4715939f3e97c53676cc33 ./Apps.page
4e55f7483b661af21a25b677179baffe ./CA_notices.page 4e55f7483b661af21a25b677179baffe ./CA_notices.page
4c5d4598e1bafa46bd90c27cbe302122 ./ca_settings.page 4c5d4598e1bafa46bd90c27cbe302122 ./ca_settings.page
e8d29607ec792ddf9f6832b10ee70fdc ./default.cfg e8d29607ec792ddf9f6832b10ee70fdc ./default.cfg
674959fdd7e96eca322ec80ce4caf89e ./include/exec.php 69ab8fcb35d59d712aed59b50932efeb ./include/exec.php
9051e76ffa5f7f8b07b7f0ac13697b30 ./include/helpers.php 46e4705b2a7e379a7930496228cbaac6 ./include/helpers.php
116042a918060278e77379b0dd73482c ./include/paths.php 116042a918060278e77379b0dd73482c ./include/paths.php
532fffdf939594c143e679da02bd841e ./javascript/libraries.js 532fffdf939594c143e679da02bd841e ./javascript/libraries.js
71f911a818d88d3d567f8a2898094ee2 ./README.md 71f911a818d88d3d567f8a2898094ee2 ./README.md
@ -22,4 +22,4 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php 34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
25bdaed6f62ac73f9ef7c3ce0c125ef7 ./skins/Narrow/css.php 25bdaed6f62ac73f9ef7c3ce0c125ef7 ./skins/Narrow/css.php
7eb021a105e2f7a15675ec8a14e6f05e ./skins/Narrow/skin.html 7eb021a105e2f7a15675ec8a14e6f05e ./skins/Narrow/skin.html
b54dae1d2e95c018a8896b3fe3baf75e ./skins/Narrow/skin.php 8899126b72149ff7064cab07f790290b ./skins/Narrow/skin.php

View File

@ -259,7 +259,7 @@ function DownloadApplicationFeed() {
$o['Category'] = trim($o['Category']); $o['Category'] = trim($o['Category']);
if ( ! $o['Category'] ) if ( ! $o['Category'] )
$o['Category'] = "Other:"; $o['Category'] = "Other:";
if ( $o['RecommendedRaw'] ) { if ( $o['RecommendedRaw'] ) {
$o['RecommendedDate'] = strtotime($o['RecommendedRaw']); $o['RecommendedDate'] = strtotime($o['RecommendedRaw']);
$o['Category'] .= " spotlight:"; $o['Category'] .= " spotlight:";
@ -405,9 +405,9 @@ function DownloadApplicationFeed() {
writeJsonFile($caPaths['repositoryList'],$ApplicationFeed['repositories']); writeJsonFile($caPaths['repositoryList'],$ApplicationFeed['repositories']);
writeJsonFile($caPaths['extraBlacklist'],$ApplicationFeed['blacklisted']); writeJsonFile($caPaths['extraBlacklist'],$ApplicationFeed['blacklisted']);
writeJsonFile($caPaths['extraDeprecated'],$ApplicationFeed['deprecated']); writeJsonFile($caPaths['extraDeprecated'],$ApplicationFeed['deprecated']);
updatePluginSupport($myTemplates); updatePluginSupport($myTemplates);
return true; return true;
} }
@ -438,7 +438,7 @@ function updatePluginSupport($templates) {
$dom->preserveWhiteSpace = false; $dom->preserveWhiteSpace = false;
$dom->formatOutput = true; $dom->formatOutput = true;
$dom->loadXML($xml->asXML()); $dom->loadXML($xml->asXML());
file_put_contents($plugin, $dom->saveXML()); file_put_contents($plugin, $dom->saveXML());
} }
} }
} }
@ -463,7 +463,7 @@ function getConvertedTemplates() {
if ( ! is_dir($caPaths['convertedTemplates']) ) { if ( ! is_dir($caPaths['convertedTemplates']) ) {
writeJsonFile($caPaths['community-templates-info'],$myTemplates); writeJsonFile($caPaths['community-templates-info'],$myTemplates);
$GLOBALS['templates'] = $myTemplates; $GLOBALS['templates'] = $myTemplates;
return; return;
} }
@ -718,12 +718,12 @@ function get_content() {
$file = $disp['community']; $file = $disp['community'];
} else } else
$file = &$GLOBALS['templates']; $file = &$GLOBALS['templates'];
if ( empty($file)) return; if ( empty($file)) return;
if ( !$filter && $category === "/NONE/i" ) { if ( !$filter && $category === "/NONE/i" ) {
getConvertedTemplates(); // Only scan for private XMLs when going HOME getConvertedTemplates(); // Only scan for private XMLs when going HOME
file_put_contents($caPaths['startupDisplayed'],"startup"); file_put_contents($caPaths['startupDisplayed'],"startup");
$displayApplications = []; $displayApplications = [];
$displayApplications['community'] = []; $displayApplications['community'] = [];
@ -1068,13 +1068,13 @@ function previous_apps() {
$file = &$GLOBALS['templates']; $file = &$GLOBALS['templates'];
$extraBlacklist = readJsonFile($caPaths['extraBlacklist']); $extraBlacklist = readJsonFile($caPaths['extraBlacklist']);
$extraDeprecated = readJsonFile($caPaths['extraDeprecated']); $extraDeprecated = readJsonFile($caPaths['extraDeprecated']);
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) { if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']); $dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
} else { } else {
$dockerUpdateStatus = []; $dockerUpdateStatus = [];
} }
# $info contains all installed containers # $info contains all installed containers
# now correlate that to a template; # now correlate that to a template;
@ -1129,13 +1129,13 @@ function previous_apps() {
if ( $installed == "action" ) { if ( $installed == "action" ) {
$tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest"; $tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest";
if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" ) { if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" ) {
$o['actionCentre'] = true; $o['actionCentre'] = true;
$o['updateAvailable'] = true; $o['updateAvailable'] = true;
$updateCount++; $updateCount++;
} }
if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) { if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) {
if ( $extraBlacklist[$o['Repository']] ) { if ( $extraBlacklist[$o['Repository']] ) {
$o['Blacklist'] = true; $o['Blacklist'] = true;
@ -1146,13 +1146,13 @@ function previous_apps() {
$o['ModeratorComment'] = $extraDeprecated[$o['Deprecated']]; $o['ModeratorComment'] = $extraDeprecated[$o['Deprecated']];
} }
} }
if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCentre'] ) if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCentre'] )
continue; continue;
} }
if ( $installed == "action" ) if ( $installed == "action" )
$o['actionCentre'] = true; $o['actionCentre'] = true;
$displayed[] = $o; $displayed[] = $o;
} }
} }
@ -1186,7 +1186,7 @@ function previous_apps() {
if ( ! $flag ) { if ( ! $flag ) {
$testRepo = explode(":",$o['Repository'])[0]; $testRepo = explode(":",$o['Repository'])[0];
# now associate the template back to a template in the appfeed # now associate the template back to a template in the appfeed
foreach ($file as $appTemplate) { foreach ($file as $appTemplate) {
if (startsWith($appTemplate['Repository'],$testRepo)) { if (startsWith($appTemplate['Repository'],$testRepo)) {
$tempPath = $o['InstallPath']; $tempPath = $o['InstallPath'];
@ -1223,7 +1223,7 @@ function previous_apps() {
if ( checkInstalledPlugin($template) ) { if ( checkInstalledPlugin($template) ) {
$template['InstallPath'] = "/var/log/plugins/$filename"; $template['InstallPath'] = "/var/log/plugins/$filename";
$template['Uninstall'] = true; $template['Uninstall'] = true;
if ( $installed == "action" && $template['PluginURL'] && $template['Name'] !== "Community Applications") { if ( $installed == "action" && $template['PluginURL'] && $template['Name'] !== "Community Applications") {
$installedVersion = plugin("version","/var/log/plugins/$filename"); $installedVersion = plugin("version","/var/log/plugins/$filename");
if ( ( strcmp($installedVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) ) { if ( ( strcmp($installedVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) ) {
@ -1251,7 +1251,7 @@ function previous_apps() {
if ( $index !== false ) { if ( $index !== false ) {
$tmpL = $file[$index]; $tmpL = $file[$index];
$tmpL['Uninstall'] = true; $tmpL['Uninstall'] = true;
if ( $installed == "action" ) { if ( $installed == "action" ) {
$tmpL['actionCentre'] = true; $tmpL['actionCentre'] = true;
if ( !languageCheck($tmpL) ) if ( !languageCheck($tmpL) )
@ -1259,7 +1259,7 @@ function previous_apps() {
$tmpL['Updated'] = true; $tmpL['Updated'] = true;
$updateCount++; $updateCount++;
} }
$displayed[] = $tmpL; $displayed[] = $tmpL;
} }
} }
@ -1668,7 +1668,7 @@ function removePrivateApp() {
} }
// $templates = readJsonFile($caPaths['community-templates-info']); // $templates = readJsonFile($caPaths['community-templates-info']);
$templates = &$$GLOBALS['templates']; $templates = &$$GLOBALS['templates'];
$displayed = readJsonFile($caPaths['community-templates-displayed']); $displayed = readJsonFile($caPaths['community-templates-displayed']);
foreach ( $displayed as &$displayType ) { foreach ( $displayed as &$displayType ) {
if ( is_array($displayType) ) { if ( is_array($displayType) ) {
@ -2329,7 +2329,7 @@ function enableActionCentre() {
} }
$extraBlacklist = readJsonFile($caPaths['extraBlacklist']); $extraBlacklist = readJsonFile($caPaths['extraBlacklist']);
$extraDeprecated = readJsonFile($caPaths['extraDeprecated']); $extraDeprecated = readJsonFile($caPaths['extraDeprecated']);
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) { if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']); $dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
} else { } else {
@ -2364,7 +2364,7 @@ function enableActionCentre() {
} }
if ( $extraDeprecated[$o['Repository']] ) { if ( $extraDeprecated[$o['Repository']] ) {
$o['Deprecated'] = true; $o['Deprecated'] = true;
} }
} }
break; break;
} }
@ -2372,10 +2372,10 @@ function enableActionCentre() {
} }
if ( $runningflag ) { if ( $runningflag ) {
$tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest"; $tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest";
if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" ) if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" )
$o['actionCentre'] = true; $o['actionCentre'] = true;
if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) { if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) {
if ( $extraBlacklist[$o['Repository']] ) { if ( $extraBlacklist[$o['Repository']] ) {
$o['Blacklist'] = true; $o['Blacklist'] = true;
@ -2384,10 +2384,10 @@ function enableActionCentre() {
$o['Deprecated'] = true; $o['Deprecated'] = true;
} }
} }
if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCentre'] ) if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCentre'] )
continue; continue;
$displayed[] = $o; $displayed[] = $o;
break; break;
} }
@ -2407,7 +2407,7 @@ function enableActionCentre() {
$template['Uninstall'] = true; $template['Uninstall'] = true;
if ( plugin("pluginURL","/var/log/plugins/$filename") !== $template['PluginURL'] ) if ( plugin("pluginURL","/var/log/plugins/$filename") !== $template['PluginURL'] )
continue; continue;
$installedVersion = plugin("version","/var/log/plugins/$filename"); $installedVersion = plugin("version","/var/log/plugins/$filename");
if ( ( strcmp($installedVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) ) { if ( ( strcmp($installedVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) ) {
$template['actionCentre'] = true; $template['actionCentre'] = true;
@ -2429,10 +2429,10 @@ function enableActionCentre() {
if ( $index !== false ) { if ( $index !== false ) {
$tmpL = $file[$index]; $tmpL = $file[$index];
$tmpL['Uninstall'] = true; $tmpL['Uninstall'] = true;
if ( !languageCheck($tmpL) ) if ( !languageCheck($tmpL) )
continue; continue;
$displayed[] = $tmpL; $displayed[] = $tmpL;
break; break;
} }
@ -2463,7 +2463,7 @@ function checkRequirements() {
######################################################## ########################################################
function saveMultiPluginPending() { function saveMultiPluginPending() {
global $caPaths; global $caPaths;
$plugin = getPost("plugin",""); $plugin = getPost("plugin","");
$plugins = array_filter(explode("*",$plugin)); $plugins = array_filter(explode("*",$plugin));
if ( count($plugins) > 1 ) { if ( count($plugins) > 1 ) {
@ -2482,7 +2482,7 @@ function saveMultiPluginPending() {
############################################## ##############################################
function downloadStatistics() { function downloadStatistics() {
global $caPaths; global $caPaths;
if ( ! is_file($caPaths['statistics']) ) if ( ! is_file($caPaths['statistics']) )
download_json($caPaths['statisticsURL'],$caPaths['statistics']); download_json($caPaths['statisticsURL'],$caPaths['statistics']);
} }

View File

@ -10,7 +10,7 @@
# Convert Array("one","two","three") to be Array("one"=>$defaultFlag, "two"=>$defaultFlag, "three"=>$defaultFlag # # Convert Array("one","two","three") to be Array("one"=>$defaultFlag, "two"=>$defaultFlag, "three"=>$defaultFlag #
################################################################################################################## ##################################################################################################################
function arrayEntriesToObject($sourceArray,$defaultFlag=true) { function arrayEntriesToObject($sourceArray,$defaultFlag=true) {
return is_array($sourceArray) ? array_fill_keys($sourceArray,$defaultFlag) : array(); return is_array($sourceArray) ? array_fill_keys($sourceArray,$defaultFlag) : []);
} }
########################################################################### ###########################################################################
# Helper function to determine if a plugin has an update available or not # # Helper function to determine if a plugin has an update available or not #
@ -70,7 +70,7 @@ function download_url($url, $path = "", $bg = false, $timeout = 45) {
debug("DOWNLOAD starting $url\n"); debug("DOWNLOAD starting $url\n");
$startTime = time(); $startTime = time();
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_FRESH_CONNECT,true); curl_setopt($ch,CURLOPT_FRESH_CONNECT,true);
@ -92,7 +92,7 @@ function download_url($url, $path = "", $bg = false, $timeout = 45) {
curl_close($ch); curl_close($ch);
if ( $path ) if ( $path )
file_put_contents($path,$out); file_put_contents($path,$out);
$totalTime = time() - $startTime; $totalTime = time() - $startTime;
debug("DOWNLOAD $url Time: $totalTime RESULT:\n".var_dump_ret($out)); debug("DOWNLOAD $url Time: $totalTime RESULT:\n".var_dump_ret($out));
return $out ?: false; return $out ?: false;
@ -150,7 +150,7 @@ function last_str_replace($haystack, $needle, $replace) {
####################### #######################
function mySort($a, $b) { function mySort($a, $b) {
global $sortOrder; global $sortOrder;
if ( $sortOrder['sortBy'] == "Name" ) if ( $sortOrder['sortBy'] == "Name" )
$sortOrder['sortBy'] = "SortName"; $sortOrder['sortBy'] = "SortName";
if ( $sortOrder['sortBy'] != "downloads" && $sortOrder['sortBy'] != "trendDelta") { if ( $sortOrder['sortBy'] != "downloads" && $sortOrder['sortBy'] != "trendDelta") {
@ -160,7 +160,7 @@ function mySort($a, $b) {
$c = $a[$sortOrder['sortBy']]; $c = $a[$sortOrder['sortBy']];
$d = $b[$sortOrder['sortBy']]; $d = $b[$sortOrder['sortBy']];
} }
$return1 = ($sortOrder['sortDir'] == "Down") ? -1 : 1; $return1 = ($sortOrder['sortDir'] == "Down") ? -1 : 1;
$return2 = ($sortOrder['sortDir'] == "Down") ? 1 : -1; $return2 = ($sortOrder['sortDir'] == "Down") ? 1 : -1;
@ -252,7 +252,7 @@ function fixTemplates($template) {
function makeXML($template) { function makeXML($template) {
# ensure its a v2 template if the Config entries exist # ensure its a v2 template if the Config entries exist
if ( $template['Config'] && ! $template['@attributes'] ) if ( $template['Config'] && ! $template['@attributes'] )
$template['@attributes'] = array("version"=>2); $template['@attributes'] = ["version"=>2];
if ($template['Overview']) $template['Description'] = $template['Overview']; if ($template['Overview']) $template['Description'] = $template['Overview'];
@ -286,7 +286,7 @@ function fixAttributes(&$template,$attribute) {
if ( $template[$attribute] ) { if ( $template[$attribute] ) {
foreach ($template[$attribute] as $tempArray) foreach ($template[$attribute] as $tempArray)
$tempArray2[] = isset($tempArray['value']) ? array('@attributes'=>$tempArray['@attributes'],'@value'=>$tempArray['value']) : array('@attributes'=>$tempArray['@attributes']); $tempArray2[] = isset($tempArray['value']) ? ['@attributes'=>$tempArray['@attributes'],'@value'=>$tempArray['value']] : ['@attributes'=>$tempArray['@attributes']];
$template[$attribute] = $tempArray2; $template[$attribute] = $tempArray2;
} }
} }
@ -337,7 +337,7 @@ function readXmlFile($xmlfile,$generic=false,$stats=true) {
# handle the case where there is only a single <Config> entry # handle the case where there is only a single <Config> entry
if ( $o['Config']['@attributes'] ) if ( $o['Config']['@attributes'] )
$o['Config'] = array('@attributes'=>$o['Config']['@attributes'],'value'=>$o['Config']['value']); $o['Config'] = ['@attributes'=>$o['Config']['@attributes'],'value'=>$o['Config']['value']];
if ( $stats) { if ( $stats) {
if ( $o['Plugin'] ) { if ( $o['Plugin'] ) {
@ -461,7 +461,7 @@ function getAuthor($template) {
# Trims the category lists # # Trims the category lists #
############################ ############################
function categoryList($cat,$popUp = false) { function categoryList($cat,$popUp = false) {
$cat = str_replace(array(":,",": "," "),",",$cat); $cat = str_replace([":,",": "," "],",",$cat);
$cat = rtrim($cat,": "); $cat = rtrim($cat,": ");
$all_cat = explode(",",$cat); $all_cat = explode(",",$cat);
foreach ($all_cat as $trcat) foreach ($all_cat as $trcat)
@ -494,7 +494,7 @@ function languageAuthorList($authors) {
# Gets a rounded off download count # # Gets a rounded off download count #
##################################### #####################################
function getDownloads($downloads,$lowFlag=false) { function getDownloads($downloads,$lowFlag=false) {
$downloadCount = array("10000000000","5000000000","1000000000","500000000","100000000","50000000","25000000","10000000","5000000","2500000","1000000","500000","250000","100000","50000","25000","10000","5000","1000","500","100"); $downloadCount = ["10000000000","5000000000","1000000000","500000000","100000000","50000000","25000000","10000000","5000000","2500000","1000000","500000","250000","100000","50000","25000","10000","5000","1000","500","100"];
foreach ($downloadCount as $downloadtmp) { foreach ($downloadCount as $downloadtmp) {
if ($downloads > $downloadtmp) { if ($downloads > $downloadtmp) {
return sprintf(tr("More than %s"),number_format($downloadtmp)); return sprintf(tr("More than %s"),number_format($downloadtmp));
@ -537,8 +537,8 @@ function formatTags($leadTemplate,$rename="false") {
$type = $rename == "true" ? "second" : "default"; $type = $rename == "true" ? "second" : "default";
$file = &$GLOBALS['templat`12es']; $file = &$GLOBALS['templat`12es'];
$template = $file[$leadTemplate]; $template = $file[$leadTemplate];
$childTemplates = $file[$leadTemplate]['BranchID']; $childTemplates = $file[$leadTemplate]['BranchID'];
if ( ! is_array($childTemplates) ) if ( ! is_array($childTemplates) )
@ -574,13 +574,13 @@ function postReturn($retArray) {
if ( ! function_exists("tr") ) { if ( ! function_exists("tr") ) {
function tr($string,$options=-1) { function tr($string,$options=-1) {
$translated = _($string,$options); $translated = _($string,$options);
if ( ! trim($translated) ) if ( ! trim($translated) )
$translated = $string; $translated = $string;
if ( startsWith($translated,"&#34;") && endsWith($translated,"&#34;") ) if ( startsWith($translated,"&#34;") && endsWith($translated,"&#34;") )
$translated = first_str_replace(last_str_replace($translated,"&#34;",""),"&#34;",""); $translated = first_str_replace(last_str_replace($translated,"&#34;",""),"&#34;","");
$translated = str_replace('"',"&#34;",str_replace("'","&#39;",$translated)); $translated = str_replace(['"',"'"],["&#34;","&#39;"],$translated));
return $translated; return $translated;
} }
@ -612,7 +612,7 @@ function languageCheck($template) {
# Writes an ini file # # Writes an ini file #
###################### ######################
function write_ini_file($file,$array) { function write_ini_file($file,$array) {
$res = array(); $res = [];
foreach($array as $key => $val) { foreach($array as $key => $val) {
if(is_array($val)) { if(is_array($val)) {
$res[] = "[$key]"; $res[] = "[$key]";

View File

@ -92,7 +92,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$template['Deprecated'] = true; $template['Deprecated'] = true;
$template['ModeratorComment'] = $extraDeprecated[$template['Repository']]; $template['ModeratorComment'] = $extraDeprecated[$template['Repository']];
} }
if ( $template['RepositoryTemplate'] ) { if ( $template['RepositoryTemplate'] ) {
$template['Icon'] = $template['icon'] ?: "/plugins/dynamix.docker.manager/images/question.png"; $template['Icon'] = $template['icon'] ?: "/plugins/dynamix.docker.manager/images/question.png";
@ -117,7 +117,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$actionsContext = []; $actionsContext = [];
$selected = false; $selected = false;
$installComment = $template['CAComment']; $installComment = $template['CAComment'];
if ( $template['Requires'] ) { if ( $template['Requires'] ) {
$template['Requires'] = markdown(strip_tags(str_replace(["\r","\n","&#xD;","'"],["","<br>","","&#39;"],trim($template['Requires'])),"<br>")); $template['Requires'] = markdown(strip_tags(str_replace(["\r","\n","&#xD;","'"],["","<br>","","&#39;"],trim($template['Requires'])),"<br>"));
preg_match_all("/\/\/(.*?)&#92;/m",$template['Requires'],$searchMatches); preg_match_all("/\/\/(.*?)&#92;/m",$template['Requires'],$searchMatches);
@ -127,7 +127,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
} }
} }
$installComment = tr("This application has additional requirements")."<br>{$template['Requires']}<br>$installComment"; $installComment = tr("This application has additional requirements")."<br>{$template['Requires']}<br>$installComment";
} }
$installComment = str_replace("\n","",$installComment); $installComment = str_replace("\n","",$installComment);
if ( ! $template['Language'] ) { if ( ! $template['Language'] ) {
@ -166,7 +166,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
} }
if ( is_file($info[$ind]['template']) ) if ( is_file($info[$ind]['template']) )
$actionsContext[] = ["icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$ind]['template'])."','edit');"]; $actionsContext[] = ["icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$ind]['template'])."','edit');"];
$actionsContext[] = ["divider"=>true]; $actionsContext[] = ["divider"=>true];
if ($info[$ind]['template']) if ($info[$ind]['template'])
$actionsContext[] = ["icon"=>"ca_fa-delete","text"=>tr("Uninstall"),"action"=>"uninstallDocker('".addslashes($info[$ind]['template'])."','{$template['Name']}');"]; $actionsContext[] = ["icon"=>"ca_fa-delete","text"=>tr("Uninstall"),"action"=>"uninstallDocker('".addslashes($info[$ind]['template'])."','{$template['Name']}');"];
@ -209,7 +209,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$template['pluginVersion'] = $tmpPluginVersion; $template['pluginVersion'] = $tmpPluginVersion;
} }
$template['pluginVersion'] = plugin("version","/tmp/plugins/$pluginName"); $template['pluginVersion'] = plugin("version","/tmp/plugins/$pluginName");
if ( ( strcmp($pluginInstalledVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) && $template['Name'] !== "Community Applications") { if ( ( strcmp($pluginInstalledVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) && $template['Name'] !== "Community Applications") {
@copy($caPaths['pluginTempDownload'],"/tmp/plugins/$pluginName"); @copy($caPaths['pluginTempDownload'],"/tmp/plugins/$pluginName");
$template['UpdateAvailable'] = true; $template['UpdateAvailable'] = true;
@ -252,7 +252,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$isDeprecated = "&deprecated"; $isDeprecated = "&deprecated";
if ( ! $template['Compatible'] ) if ( ! $template['Compatible'] )
$isDeprecated = "&incompatible"; $isDeprecated = "&incompatible";
$updateFlag = false; $updateFlag = false;
$requiresText = ""; $requiresText = "";
if ( $template['RequiresFile'] && ! is_file($template['RequiresFile']) ) { if ( $template['RequiresFile'] && ! is_file($template['RequiresFile']) ) {
@ -308,7 +308,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
if ( file_exists($caPaths['pluginPending'].$template['LanguagePack']) || file_exists("{$caPaths['pluginPending']}lang-{$template['LanguagePack']}.xml") ) { if ( file_exists($caPaths['pluginPending'].$template['LanguagePack']) || file_exists("{$caPaths['pluginPending']}lang-{$template['LanguagePack']}.xml") ) {
unset($actionsContext); unset($actionsContext);
$actionsContext[] = ["text"=>tr("Pending")]; $actionsContext[] = ["text"=>tr("Pending")];
} }
} }
$template['actionsContext'] = $actionsContext; $template['actionsContext'] = $actionsContext;
@ -449,7 +449,7 @@ function getPopupDescriptionSkin($appNumber) {
$allRepositories = readJsonFile($caPaths['repositoryList']); $allRepositories = readJsonFile($caPaths['repositoryList']);
$extraBlacklist = readJsonFile($caPaths['extraBlacklist']); $extraBlacklist = readJsonFile($caPaths['extraBlacklist']);
$extraDeprecated = readJsonFile($caPaths['extraDeprecated']); $extraDeprecated = readJsonFile($caPaths['extraDeprecated']);
$pinnedApps = readJsonFile($caPaths['pinnedV2']); $pinnedApps = readJsonFile($caPaths['pinnedV2']);
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) { if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
@ -507,7 +507,7 @@ function getPopupDescriptionSkin($appNumber) {
$template = $file[$index]; $template = $file[$index];
} }
$currentServer = file_get_contents($caPaths['currentServer']); $currentServer = file_get_contents($caPaths['currentServer']);
if ( ! $template['Blacklist'] ) { if ( ! $template['Blacklist'] ) {
if ( $extraBlacklist[$template['Repository']] ) { if ( $extraBlacklist[$template['Repository']] ) {
$template['Blacklist'] = true; $template['Blacklist'] = true;
@ -518,7 +518,7 @@ function getPopupDescriptionSkin($appNumber) {
$template['Deprecated'] = true; $template['Deprecated'] = true;
$template['ModeratorComment'] = $extraDeprecated[$template['Repository']]; $template['ModeratorComment'] = $extraDeprecated[$template['Repository']];
} }
$ID = $template['ID']; $ID = $template['ID'];
$template['Profile'] = $allRepositories[$template['RepoName']]['profile']; $template['Profile'] = $allRepositories[$template['RepoName']]['profile'];
@ -639,7 +639,7 @@ function getPopupDescriptionSkin($appNumber) {
} }
if ( is_file($info[$name]['template']) ) if ( is_file($info[$name]['template']) )
$actionsContext[] = ["icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$name]['template'])."','edit');"]; $actionsContext[] = ["icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$name]['template'])."','edit');"];
$actionsContext[] = ["divider"=>true]; $actionsContext[] = ["divider"=>true];
if ( $info[$name]['template'] ) if ( $info[$name]['template'] )
$actionsContext[] = ["icon"=>"ca_fa-delete","text"=>"<span class='ca_red'>".tr("Uninstall")."</span>","action"=>"uninstallDocker('".addslashes($info[$name]['template'])."','{$template['Name']}');"]; $actionsContext[] = ["icon"=>"ca_fa-delete","text"=>"<span class='ca_red'>".tr("Uninstall")."</span>","action"=>"uninstallDocker('".addslashes($info[$name]['template'])."','{$template['Name']}');"];
@ -748,7 +748,7 @@ function getPopupDescriptionSkin($appNumber) {
if ( file_exists($caPaths['pluginPending'].$template['LanguagePack']) || file_exists("{$caPaths['pluginPending']}lang-{$template['LanguagePack']}.xml") ) { if ( file_exists($caPaths['pluginPending'].$template['LanguagePack']) || file_exists("{$caPaths['pluginPending']}lang-{$template['LanguagePack']}.xml") ) {
unset($actionsContext); unset($actionsContext);
$actionsContext[] = ["text"=>tr("Pending")]; $actionsContext[] = ["text"=>tr("Pending")];
} }
} }
$supportContext = []; $supportContext = [];
@ -840,7 +840,7 @@ function getRepoDescriptionSkin($repository) {
$dockerVars = parse_ini_file($caPaths['docker_cfg']); $dockerVars = parse_ini_file($caPaths['docker_cfg']);
$repositories = readJsonFile($caPaths['repositoryList']); $repositories = readJsonFile($caPaths['repositoryList']);
$templates = &$GLOBALS['templates']; $templates = &$GLOBALS['templates'];
$repo = $repositories[$repository]; $repo = $repositories[$repository];
$repo['icon'] = $repo['icon'] ?: "/plugins/dynamix.docker.manager/images/question.png"; $repo['icon'] = $repo['icon'] ?: "/plugins/dynamix.docker.manager/images/question.png";
$repo['bio'] = $repo['bio'] ? markdown($repo['bio']) : "<br><center>".tr("No description present"); $repo['bio'] = $repo['bio'] ? markdown($repo['bio']) : "<br><center>".tr("No description present");
@ -908,7 +908,7 @@ function getRepoDescriptionSkin($repository) {
if ( $repo['Video'] ) { if ( $repo['Video'] ) {
if ( $repo['Photo'] ) if ( $repo['Photo'] )
$t .= "<div><hr></div>"; $t .= "<div><hr></div>";
$videos = is_array($repo['Video']) ? $repo['Video'] : [$repo['Video']]; $videos = is_array($repo['Video']) ? $repo['Video'] : [$repo['Video']];
$vidText = (count($videos) == 1) ? "Play Video" : "Play Video %s"; $vidText = (count($videos) == 1) ? "Play Video" : "Play Video %s";
$t .= "<div>"; $t .= "<div>";
@ -1089,7 +1089,7 @@ function displayCard($template) {
elseif (strpos($author," Repository") ) elseif (strpos($author," Repository") )
$author = sprintf(tr("%s Repository"),str_replace(" Repository","",$author)); $author = sprintf(tr("%s Repository"),str_replace(" Repository","",$author));
} }
if ( !$RepositoryTemplate ) { if ( !$RepositoryTemplate ) {
$cardClass = "ca_appPopup"; $cardClass = "ca_appPopup";
$supportContext = []; $supportContext = [];
@ -1122,7 +1122,7 @@ function displayCard($template) {
$Name = str_replace(["' Repository","'s Repository"," Repository"],"",html_entity_decode($author,ENT_QUOTES)); $Name = str_replace(["' Repository","'s Repository"," Repository"],"",html_entity_decode($author,ENT_QUOTES));
$Name = str_replace(["&apos;s","'s"],"",$Name); $Name = str_replace(["&apos;s","'s"],"",$Name);
$author = ""; $author = "";
} }
@ -1188,13 +1188,13 @@ function displayCard($template) {
case 'appDriver': case 'appDriver':
$type = 'plugin'; $type = 'plugin';
break; break;
} }
if ($Removable && !$DockerInfo && ! $Installed && ! $Blacklist) { if ($Removable && !$DockerInfo && ! $Installed && ! $Blacklist) {
$card .= "<input class='ca_multiselect ca_tooltip' title='".tr("Check off to select multiple reinstalls")."' type='checkbox' data-name='$previousAppName' data-humanName='$Name' data-type='$type' data-deletepath='$InstallPath' $checked>"; $card .= "<input class='ca_multiselect ca_tooltip' title='".tr("Check off to select multiple reinstalls")."' type='checkbox' data-name='$previousAppName' data-humanName='$Name' data-type='$type' data-deletepath='$InstallPath' $checked>";
} elseif ( $actionCentre && $UpdateAvailable ) { } elseif ( $actionCentre && $UpdateAvailable ) {
$card .= "<input class='ca_multiselect ca_tooltip' title='".tr("Check off to select multiple updates")."' type='checkbox' data-name='$previousAppName' data-humanName='$Name' data-type='$type' data-language='$LanguagePack' $checked>"; $card .= "<input class='ca_multiselect ca_tooltip' title='".tr("Check off to select multiple updates")."' type='checkbox' data-name='$previousAppName' data-humanName='$Name' data-type='$type' data-language='$LanguagePack' $checked>";
} }
$card .= "</div>"; $card .= "</div>";
$card .= "<div class='$cardClass $backgroundClickable'>"; $card .= "<div class='$cardClass $backgroundClickable'>";
$card .= "<div class='ca_iconArea'>"; $card .= "<div class='ca_iconArea'>";
@ -1241,7 +1241,7 @@ function displayCard($template) {
"; ";
$Overview = $Overview ?: $Description; $Overview = $Overview ?: $Description;
if ( ! $Overview ) if ( ! $Overview )
$Overview = tr("No description present"); $Overview = tr("No description present");
@ -1273,7 +1273,7 @@ function displayCard($template) {
$flagTextStart = "&nbsp;"; $flagTextStart = "&nbsp;";
$flagTextEnd = "&nbsp;"; $flagTextEnd = "&nbsp;";
} }
if ( $UpdateAvailable ) { if ( $UpdateAvailable ) {
$card .= " $card .= "
<div class='betaCardBackground'> <div class='betaCardBackground'>
<div class='installedCardText ca_center'>".tr("UPDATED")."</div> <div class='installedCardText ca_center'>".tr("UPDATED")."</div>
@ -1410,14 +1410,14 @@ function displayPopup($template) {
$RecommendedLanguage = $_SESSION['locale'] ?: "en_US"; $RecommendedLanguage = $_SESSION['locale'] ?: "en_US";
if ( ! $RecommendedReason[$RecommendedLanguage] ) if ( ! $RecommendedReason[$RecommendedLanguage] )
$RecommendedLanguage = "en_US"; $RecommendedLanguage = "en_US";
preg_match_all("/\/\/(.*?)\\\\/m",$RecommendedReason[$RecommendedLanguage],$searchMatches); preg_match_all("/\/\/(.*?)\\\\/m",$RecommendedReason[$RecommendedLanguage],$searchMatches);
if ( count($searchMatches[1]) ) { if ( count($searchMatches[1]) ) {
foreach ($searchMatches[1] as $searchResult) { foreach ($searchMatches[1] as $searchResult) {
$RecommendedReason[$RecommendedLanguage] = str_replace("//$searchResult\\\\","<a style=cursor:pointer; onclick=doSidebarSearch(&quot;$searchResult&quot;);>$searchResult</a>",$RecommendedReason[$RecommendedLanguage]); $RecommendedReason[$RecommendedLanguage] = str_replace("//$searchResult\\\\","<a style=cursor:pointer; onclick=doSidebarSearch(&quot;$searchResult&quot;);>$searchResult</a>",$RecommendedReason[$RecommendedLanguage]);
} }
} }
if ( ! $RecommendedWho ) $RecommendedWho = tr("Unraid Staff"); if ( ! $RecommendedWho ) $RecommendedWho = tr("Unraid Staff");
$card .= " $card .= "
<div class='spotlightPopup'> <div class='spotlightPopup'>
@ -1482,7 +1482,7 @@ function displayPopup($template) {
$card .= "<tr><td class='popupTableLeft'>".tr("Downloads")."</td><td class='popupTableRight'>$downloadText</td></tr>"; $card .= "<tr><td class='popupTableLeft'>".tr("Downloads")."</td><td class='popupTableRight'>$downloadText</td></tr>";
elseif ( $topPlugin ) elseif ( $topPlugin )
$card .= "<tr><td class='popupTableLeft'>".tr("Popularity")."</td><td class='popupTableRight'># $topPlugin</td></tr>"; $card .= "<tr><td class='popupTableLeft'>".tr("Popularity")."</td><td class='popupTableRight'># $topPlugin</td></tr>";
if (!$Plugin && !$LanguagePack) if (!$Plugin && !$LanguagePack)
$card .= "<tr><td class='popupTableLeft'>".tr("Repository")."</td><td class='popupTableRight' style='white-space:nowrap;'>$Repository</td></tr>"; $card .= "<tr><td class='popupTableLeft'>".tr("Repository")."</td><td class='popupTableRight' style='white-space:nowrap;'>$Repository</td></tr>";
if ($stars) if ($stars)