diff --git a/archive/community.applications-2022.11.18-x86_64-1.txz b/archive/community.applications-2022.11.18-x86_64-1.txz index b777419b..e85166b4 100644 Binary files a/archive/community.applications-2022.11.18-x86_64-1.txz and b/archive/community.applications-2022.11.18-x86_64-1.txz differ diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 b/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 index 441e1acf..6dbafc88 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/ca.md5 @@ -2,8 +2,8 @@ ae9874967a4715939f3e97c53676cc33 ./Apps.page 4e55f7483b661af21a25b677179baffe ./CA_notices.page 4c5d4598e1bafa46bd90c27cbe302122 ./ca_settings.page e8d29607ec792ddf9f6832b10ee70fdc ./default.cfg -674959fdd7e96eca322ec80ce4caf89e ./include/exec.php -9051e76ffa5f7f8b07b7f0ac13697b30 ./include/helpers.php +69ab8fcb35d59d712aed59b50932efeb ./include/exec.php +46e4705b2a7e379a7930496228cbaac6 ./include/helpers.php 116042a918060278e77379b0dd73482c ./include/paths.php 532fffdf939594c143e679da02bd841e ./javascript/libraries.js 71f911a818d88d3d567f8a2898094ee2 ./README.md @@ -22,4 +22,4 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php 34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php 25bdaed6f62ac73f9ef7c3ce0c125ef7 ./skins/Narrow/css.php 7eb021a105e2f7a15675ec8a14e6f05e ./skins/Narrow/skin.html -b54dae1d2e95c018a8896b3fe3baf75e ./skins/Narrow/skin.php +8899126b72149ff7064cab07f790290b ./skins/Narrow/skin.php diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php index 49dd6a83..76d442c8 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/exec.php @@ -259,7 +259,7 @@ function DownloadApplicationFeed() { $o['Category'] = trim($o['Category']); if ( ! $o['Category'] ) $o['Category'] = "Other:"; - + if ( $o['RecommendedRaw'] ) { $o['RecommendedDate'] = strtotime($o['RecommendedRaw']); $o['Category'] .= " spotlight:"; @@ -405,9 +405,9 @@ function DownloadApplicationFeed() { writeJsonFile($caPaths['repositoryList'],$ApplicationFeed['repositories']); writeJsonFile($caPaths['extraBlacklist'],$ApplicationFeed['blacklisted']); writeJsonFile($caPaths['extraDeprecated'],$ApplicationFeed['deprecated']); - + updatePluginSupport($myTemplates); - + return true; } @@ -438,7 +438,7 @@ function updatePluginSupport($templates) { $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $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']) ) { writeJsonFile($caPaths['community-templates-info'],$myTemplates); $GLOBALS['templates'] = $myTemplates; - + return; } @@ -718,12 +718,12 @@ function get_content() { $file = $disp['community']; } else $file = &$GLOBALS['templates']; - + if ( empty($file)) return; if ( !$filter && $category === "/NONE/i" ) { getConvertedTemplates(); // Only scan for private XMLs when going HOME - + file_put_contents($caPaths['startupDisplayed'],"startup"); $displayApplications = []; $displayApplications['community'] = []; @@ -1068,13 +1068,13 @@ function previous_apps() { $file = &$GLOBALS['templates']; $extraBlacklist = readJsonFile($caPaths['extraBlacklist']); $extraDeprecated = readJsonFile($caPaths['extraDeprecated']); - + if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) { $dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']); } else { $dockerUpdateStatus = []; } - + # $info contains all installed containers # now correlate that to a template; @@ -1129,13 +1129,13 @@ function previous_apps() { if ( $installed == "action" ) { $tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest"; - + if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" ) { $o['actionCentre'] = true; $o['updateAvailable'] = true; $updateCount++; } - + if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) { if ( $extraBlacklist[$o['Repository']] ) { $o['Blacklist'] = true; @@ -1146,13 +1146,13 @@ function previous_apps() { $o['ModeratorComment'] = $extraDeprecated[$o['Deprecated']]; } } - + if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCentre'] ) continue; } if ( $installed == "action" ) $o['actionCentre'] = true; - + $displayed[] = $o; } } @@ -1186,7 +1186,7 @@ function previous_apps() { if ( ! $flag ) { $testRepo = explode(":",$o['Repository'])[0]; # now associate the template back to a template in the appfeed - + foreach ($file as $appTemplate) { if (startsWith($appTemplate['Repository'],$testRepo)) { $tempPath = $o['InstallPath']; @@ -1223,7 +1223,7 @@ function previous_apps() { if ( checkInstalledPlugin($template) ) { $template['InstallPath'] = "/var/log/plugins/$filename"; $template['Uninstall'] = true; - + if ( $installed == "action" && $template['PluginURL'] && $template['Name'] !== "Community Applications") { $installedVersion = plugin("version","/var/log/plugins/$filename"); if ( ( strcmp($installedVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) ) { @@ -1251,7 +1251,7 @@ function previous_apps() { if ( $index !== false ) { $tmpL = $file[$index]; $tmpL['Uninstall'] = true; - + if ( $installed == "action" ) { $tmpL['actionCentre'] = true; if ( !languageCheck($tmpL) ) @@ -1259,7 +1259,7 @@ function previous_apps() { $tmpL['Updated'] = true; $updateCount++; } - + $displayed[] = $tmpL; } } @@ -1668,7 +1668,7 @@ function removePrivateApp() { } // $templates = readJsonFile($caPaths['community-templates-info']); $templates = &$$GLOBALS['templates']; - + $displayed = readJsonFile($caPaths['community-templates-displayed']); foreach ( $displayed as &$displayType ) { if ( is_array($displayType) ) { @@ -2329,7 +2329,7 @@ function enableActionCentre() { } $extraBlacklist = readJsonFile($caPaths['extraBlacklist']); $extraDeprecated = readJsonFile($caPaths['extraDeprecated']); - + if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) { $dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']); } else { @@ -2364,7 +2364,7 @@ function enableActionCentre() { } if ( $extraDeprecated[$o['Repository']] ) { $o['Deprecated'] = true; - } + } } break; } @@ -2372,10 +2372,10 @@ function enableActionCentre() { } if ( $runningflag ) { $tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest"; - + if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" ) $o['actionCentre'] = true; - + if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) { if ( $extraBlacklist[$o['Repository']] ) { $o['Blacklist'] = true; @@ -2384,10 +2384,10 @@ function enableActionCentre() { $o['Deprecated'] = true; } } - + if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCentre'] ) continue; - + $displayed[] = $o; break; } @@ -2407,7 +2407,7 @@ function enableActionCentre() { $template['Uninstall'] = true; if ( plugin("pluginURL","/var/log/plugins/$filename") !== $template['PluginURL'] ) continue; - + $installedVersion = plugin("version","/var/log/plugins/$filename"); if ( ( strcmp($installedVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) ) { $template['actionCentre'] = true; @@ -2429,10 +2429,10 @@ function enableActionCentre() { if ( $index !== false ) { $tmpL = $file[$index]; $tmpL['Uninstall'] = true; - + if ( !languageCheck($tmpL) ) continue; - + $displayed[] = $tmpL; break; } @@ -2463,7 +2463,7 @@ function checkRequirements() { ######################################################## function saveMultiPluginPending() { global $caPaths; - + $plugin = getPost("plugin",""); $plugins = array_filter(explode("*",$plugin)); if ( count($plugins) > 1 ) { @@ -2482,7 +2482,7 @@ function saveMultiPluginPending() { ############################################## function downloadStatistics() { global $caPaths; - + if ( ! is_file($caPaths['statistics']) ) download_json($caPaths['statisticsURL'],$caPaths['statistics']); } diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php index 5da4dfe2..b84ed0d4 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/include/helpers.php @@ -10,7 +10,7 @@ # Convert Array("one","two","three") to be Array("one"=>$defaultFlag, "two"=>$defaultFlag, "three"=>$defaultFlag # ################################################################################################################## 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 # @@ -70,7 +70,7 @@ function download_url($url, $path = "", $bg = false, $timeout = 45) { debug("DOWNLOAD starting $url\n"); $startTime = time(); - + $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,true); @@ -92,7 +92,7 @@ function download_url($url, $path = "", $bg = false, $timeout = 45) { curl_close($ch); if ( $path ) file_put_contents($path,$out); - + $totalTime = time() - $startTime; debug("DOWNLOAD $url Time: $totalTime RESULT:\n".var_dump_ret($out)); return $out ?: false; @@ -150,7 +150,7 @@ function last_str_replace($haystack, $needle, $replace) { ####################### function mySort($a, $b) { global $sortOrder; - + if ( $sortOrder['sortBy'] == "Name" ) $sortOrder['sortBy'] = "SortName"; if ( $sortOrder['sortBy'] != "downloads" && $sortOrder['sortBy'] != "trendDelta") { @@ -160,7 +160,7 @@ function mySort($a, $b) { $c = $a[$sortOrder['sortBy']]; $d = $b[$sortOrder['sortBy']]; } - + $return1 = ($sortOrder['sortDir'] == "Down") ? -1 : 1; $return2 = ($sortOrder['sortDir'] == "Down") ? 1 : -1; @@ -252,7 +252,7 @@ function fixTemplates($template) { function makeXML($template) { # ensure its a v2 template if the Config entries exist if ( $template['Config'] && ! $template['@attributes'] ) - $template['@attributes'] = array("version"=>2); + $template['@attributes'] = ["version"=>2]; if ($template['Overview']) $template['Description'] = $template['Overview']; @@ -286,7 +286,7 @@ function fixAttributes(&$template,$attribute) { if ( $template[$attribute] ) { 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; } } @@ -337,7 +337,7 @@ function readXmlFile($xmlfile,$generic=false,$stats=true) { # handle the case where there is only a single entry 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 ( $o['Plugin'] ) { @@ -461,7 +461,7 @@ function getAuthor($template) { # Trims the category lists # ############################ function categoryList($cat,$popUp = false) { - $cat = str_replace(array(":,",": "," "),",",$cat); + $cat = str_replace([":,",": "," "],",",$cat); $cat = rtrim($cat,": "); $all_cat = explode(",",$cat); foreach ($all_cat as $trcat) @@ -494,7 +494,7 @@ function languageAuthorList($authors) { # Gets a rounded off download count # ##################################### 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) { if ($downloads > $downloadtmp) { return sprintf(tr("More than %s"),number_format($downloadtmp)); @@ -537,8 +537,8 @@ function formatTags($leadTemplate,$rename="false") { $type = $rename == "true" ? "second" : "default"; - $file = &$GLOBALS['templat`12es']; - + $file = &$GLOBALS['templat`12es']; + $template = $file[$leadTemplate]; $childTemplates = $file[$leadTemplate]['BranchID']; if ( ! is_array($childTemplates) ) @@ -574,13 +574,13 @@ function postReturn($retArray) { if ( ! function_exists("tr") ) { function tr($string,$options=-1) { $translated = _($string,$options); - if ( ! trim($translated) ) + if ( ! trim($translated) ) $translated = $string; - + if ( startsWith($translated,""") && endsWith($translated,""") ) $translated = first_str_replace(last_str_replace($translated,""",""),""",""); - $translated = str_replace('"',""",str_replace("'","'",$translated)); + $translated = str_replace(['"',"'"],[""","'"],$translated)); return $translated; } @@ -612,7 +612,7 @@ function languageCheck($template) { # Writes an ini file # ###################### function write_ini_file($file,$array) { - $res = array(); + $res = []; foreach($array as $key => $val) { if(is_array($val)) { $res[] = "[$key]"; diff --git a/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php b/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php index 4e76fb49..d4a5b64f 100644 --- a/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php +++ b/source/community.applications/usr/local/emhttp/plugins/community.applications/skins/Narrow/skin.php @@ -92,7 +92,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) $template['Deprecated'] = true; $template['ModeratorComment'] = $extraDeprecated[$template['Repository']]; } - + if ( $template['RepositoryTemplate'] ) { $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 = []; $selected = false; $installComment = $template['CAComment']; - + if ( $template['Requires'] ) { $template['Requires'] = markdown(strip_tags(str_replace(["\r","\n"," ","'"],["","
","","'"],trim($template['Requires'])),"
")); preg_match_all("/\/\/(.*?)\/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")."
{$template['Requires']}
$installComment"; - } + } $installComment = str_replace("\n","",$installComment); if ( ! $template['Language'] ) { @@ -166,7 +166,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) } if ( is_file($info[$ind]['template']) ) $actionsContext[] = ["icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$ind]['template'])."','edit');"]; - + $actionsContext[] = ["divider"=>true]; if ($info[$ind]['template']) $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'] = plugin("version","/tmp/plugins/$pluginName"); - + if ( ( strcmp($pluginInstalledVersion,$template['pluginVersion']) < 0 || $template['UpdateAvailable']) && $template['Name'] !== "Community Applications") { @copy($caPaths['pluginTempDownload'],"/tmp/plugins/$pluginName"); $template['UpdateAvailable'] = true; @@ -252,7 +252,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false) $isDeprecated = "&deprecated"; if ( ! $template['Compatible'] ) $isDeprecated = "&incompatible"; - + $updateFlag = false; $requiresText = ""; 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") ) { unset($actionsContext); $actionsContext[] = ["text"=>tr("Pending")]; - } + } } $template['actionsContext'] = $actionsContext; @@ -449,7 +449,7 @@ function getPopupDescriptionSkin($appNumber) { $allRepositories = readJsonFile($caPaths['repositoryList']); $extraBlacklist = readJsonFile($caPaths['extraBlacklist']); $extraDeprecated = readJsonFile($caPaths['extraDeprecated']); - + $pinnedApps = readJsonFile($caPaths['pinnedV2']); 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]; } $currentServer = file_get_contents($caPaths['currentServer']); - + if ( ! $template['Blacklist'] ) { if ( $extraBlacklist[$template['Repository']] ) { $template['Blacklist'] = true; @@ -518,7 +518,7 @@ function getPopupDescriptionSkin($appNumber) { $template['Deprecated'] = true; $template['ModeratorComment'] = $extraDeprecated[$template['Repository']]; } - + $ID = $template['ID']; $template['Profile'] = $allRepositories[$template['RepoName']]['profile']; @@ -639,7 +639,7 @@ function getPopupDescriptionSkin($appNumber) { } if ( is_file($info[$name]['template']) ) $actionsContext[] = ["icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$name]['template'])."','edit');"]; - + $actionsContext[] = ["divider"=>true]; if ( $info[$name]['template'] ) $actionsContext[] = ["icon"=>"ca_fa-delete","text"=>"".tr("Uninstall")."","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") ) { unset($actionsContext); $actionsContext[] = ["text"=>tr("Pending")]; - } + } } $supportContext = []; @@ -840,7 +840,7 @@ function getRepoDescriptionSkin($repository) { $dockerVars = parse_ini_file($caPaths['docker_cfg']); $repositories = readJsonFile($caPaths['repositoryList']); $templates = &$GLOBALS['templates']; - + $repo = $repositories[$repository]; $repo['icon'] = $repo['icon'] ?: "/plugins/dynamix.docker.manager/images/question.png"; $repo['bio'] = $repo['bio'] ? markdown($repo['bio']) : "
".tr("No description present"); @@ -908,7 +908,7 @@ function getRepoDescriptionSkin($repository) { if ( $repo['Video'] ) { if ( $repo['Photo'] ) $t .= "

"; - + $videos = is_array($repo['Video']) ? $repo['Video'] : [$repo['Video']]; $vidText = (count($videos) == 1) ? "Play Video" : "Play Video %s"; $t .= "
"; @@ -1089,7 +1089,7 @@ function displayCard($template) { elseif (strpos($author," Repository") ) $author = sprintf(tr("%s Repository"),str_replace(" Repository","",$author)); } - + if ( !$RepositoryTemplate ) { $cardClass = "ca_appPopup"; $supportContext = []; @@ -1122,7 +1122,7 @@ function displayCard($template) { $Name = str_replace(["' Repository","'s Repository"," Repository"],"",html_entity_decode($author,ENT_QUOTES)); - $Name = str_replace(["'s","'s"],"",$Name); + $Name = str_replace(["'s","'s"],"",$Name); $author = ""; } @@ -1188,13 +1188,13 @@ function displayCard($template) { case 'appDriver': $type = 'plugin'; break; - } + } if ($Removable && !$DockerInfo && ! $Installed && ! $Blacklist) { $card .= ""; } elseif ( $actionCentre && $UpdateAvailable ) { $card .= ""; - } - + } + $card .= "
"; $card .= "
"; $card .= "
"; @@ -1241,7 +1241,7 @@ function displayCard($template) { "; $Overview = $Overview ?: $Description; - + if ( ! $Overview ) $Overview = tr("No description present"); @@ -1273,7 +1273,7 @@ function displayCard($template) { $flagTextStart = " "; $flagTextEnd = " "; } - if ( $UpdateAvailable ) { + if ( $UpdateAvailable ) { $card .= "
".tr("UPDATED")."
@@ -1410,14 +1410,14 @@ function displayPopup($template) { $RecommendedLanguage = $_SESSION['locale'] ?: "en_US"; if ( ! $RecommendedReason[$RecommendedLanguage] ) $RecommendedLanguage = "en_US"; - + preg_match_all("/\/\/(.*?)\\\\/m",$RecommendedReason[$RecommendedLanguage],$searchMatches); if ( count($searchMatches[1]) ) { foreach ($searchMatches[1] as $searchResult) { $RecommendedReason[$RecommendedLanguage] = str_replace("//$searchResult\\\\","$searchResult",$RecommendedReason[$RecommendedLanguage]); } } - + if ( ! $RecommendedWho ) $RecommendedWho = tr("Unraid Staff"); $card .= "
@@ -1482,7 +1482,7 @@ function displayPopup($template) { $card .= "".tr("Downloads")."$downloadText"; elseif ( $topPlugin ) $card .= "".tr("Popularity")."# $topPlugin"; - + if (!$Plugin && !$LanguagePack) $card .= "".tr("Repository")."$Repository"; if ($stars)