diff --git a/archive/community.applications-2021.02.21-x86_64-1.txz b/archive/community.applications-2021.02.21-x86_64-1.txz index 8dad81ae..9d5fe2b4 100644 Binary files a/archive/community.applications-2021.02.21-x86_64-1.txz and b/archive/community.applications-2021.02.21-x86_64-1.txz differ 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 d381ce53..f10c0822 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 @@ -556,7 +556,7 @@ function displayRepositories() { # get_content - get the results from templates according to categories, filters, etc # ###################################################################################### function get_content() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths, $caSettings; $filter = getPost("filter",false); $category = getPost("category",false); @@ -623,7 +623,6 @@ function get_content() { writeJsonFile($caPaths['community-templates-displayed'],$displayApplications); @unlink($caPaths['community-templates-allSearchResults']); @unlink($caPaths['community-templates-catSearchResults']); -// $sortOrder['sortBy'] = "noSort"; $o['display'] = my_display_apps($displayApplications['community'],"1"); $o['script'] = "$('#templateSortButtons,#sortButtons').hide();enableIcon('#sortIcon',false);"; postReturn($o); @@ -753,7 +752,6 @@ function get_content() { $searchResults['favNameHit'] = array(); $displayApplications['community'] = array_merge($searchResults['favNameHit'],$searchResults['nameHit'],$searchResults['anyHit']); -// $sortOrder['sortBy'] = "noSort"; } else { usort($display,"mySort"); $displayApplications['community'] = $display; @@ -771,9 +769,7 @@ function get_content() { @unlink($caPaths['community-templates-catSearchResults']); } $o['display'] = display_apps(); -/* if ( count($displayApplications['community']) < 2 ) { - //$o['script'] = "disableSort();"; - } */ + postReturn($o); } @@ -781,7 +777,7 @@ function get_content() { # force_update -> forces an update of the applications # ######################################################## function force_update() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; $lastUpdatedOld = readJsonFile($caPaths['lastUpdated-old']); @@ -836,7 +832,7 @@ function force_update() { # display_content - displays the templates according to view mode, sort order, etc # #################################################################################### function display_content() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; $pageNumber = getPost("pageNumber","1"); $startup = getPost("startup",false); @@ -860,7 +856,8 @@ function display_content() { # convert_docker - called when system adds a container from dockerHub # ####################################################################### function convert_docker() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + $dockerID = getPost("ID",""); $file = readJsonFile($caPaths['dockerSearchResults']); @@ -892,7 +889,8 @@ function convert_docker() { # search_dockerhub - returns the results from dockerHub # ######################################################### function search_dockerhub() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + $filter = getPost("filter",""); $pageNumber = getPost("page","1"); @@ -949,12 +947,14 @@ function search_dockerhub() { # dismiss_warning - dismisses the warning from appearing at startup # ##################################################################### function dismiss_warning() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + file_put_contents($caPaths['warningAccepted'],"warning dismissed"); postReturn(['status'=>"warning dismissed"]); } function dismiss_plugin_warning() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + file_put_contents($caPaths['pluginWarning'],"disclaimer ok"); postReturn(['status'=>"disclaimed"]); } @@ -963,7 +963,8 @@ function dismiss_plugin_warning() { # Displays the list of installed or previously installed apps # ############################################################### function previous_apps() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths, $caSettings, $DockerClient; + $installed = getPost("installed",""); $dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']); $info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array(); @@ -1158,7 +1159,6 @@ if ( $caSettings['dockerRunning'] ) { # Removes an app from the previously installed list (ie: deletes the user template # #################################################################################### function remove_application() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; $application = getPost("application",""); if ( pathinfo($application,PATHINFO_EXTENSION) == "xml" || pathinfo($application,PATHINFO_EXTENSION) == "plg" ) @unlink($application); @@ -1170,7 +1170,8 @@ function remove_application() { # Checks for an update still available (to update display) after update installed # ################################################################################### function updatePLGstatus() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + $filename = getPost("filename",""); $displayed = readJsonFile($caPaths['community-templates-displayed']); $superCategories = array_keys($displayed); @@ -1190,7 +1191,7 @@ function updatePLGstatus() { # Uninstalls a docker # ####################### function uninstall_docker() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $DockerClient, $dockerRunning; $application = getPost("application",""); # get the name of the container / image @@ -1214,7 +1215,8 @@ function uninstall_docker() { # Pins / Unpins an application for later viewing # ################################################## function pinApp() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + $repository = getPost("repository","oops"); $name = getPost("name","oops"); $pinnedApps = readJsonFile($caPaths['pinnedV2']); @@ -1227,7 +1229,8 @@ function pinApp() { # Gets if any apps are pinned or not # ###################################### function areAppsPinned() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + postReturn(['status' => in_array(true,readJsonFile($caPaths['pinnedV2']))]); } @@ -1235,7 +1238,7 @@ function areAppsPinned() { # Displays the pinned applications # #################################### function pinnedApps() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths, $caSettings; $pinnedApps = readJsonFile($caPaths['pinnedV2']); $file = readJsonFile($caPaths['community-templates-info']); @unlink($caPaths['community-templates-allSearchResults']); @@ -1276,7 +1279,6 @@ function pinnedApps() { # Displays the possible branch tags for an app # ################################################ function displayTags() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; $leadTemplate = getPost("leadTemplate","oops"); postReturn(['tags'=>formatTags($leadTemplate)]); } @@ -1285,7 +1287,7 @@ function displayTags() { # Displays The Statistics For The Appfeed # ########################################### function statistics() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths, $caSettings; @unlink($caPaths['community-templates-displayed']); @unlink($caPaths['community-templates-allSearchResults']); @unlink($caPaths['community-templates-catSearchResults']); @@ -1372,7 +1374,8 @@ function statistics() { # Removes a private app from the list # ####################################### function removePrivateApp() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths; + $path = getPost("path",false); if ( ! $path || pathinfo($path,PATHINFO_EXTENSION) != "xml") { @@ -1403,7 +1406,7 @@ function removePrivateApp() { # Creates the entries for autocomplete on searches # #################################################### function populateAutoComplete() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; + global $caPaths, $caSettings; $templates = readJsonFile($caPaths['community-templates-info']); $autoComplete = array_map(function($x){return str_replace(":","",tr($x['Cat']));},readJsonFile($caPaths['categoryList'])); foreach ($templates as $template) { @@ -1417,10 +1420,7 @@ function populateAutoComplete() { $autoComplete[$template['Repo']] = $template['Repo']; } $name = trim(strtolower($template['SortName'])); -/* if ( $name !== "pihole template" ) { - $name = str_ireplace(strtolower($template['Author'])."-","",$name); - $name = str_ireplace(strtolower($template['Author'])." ","",$name); - } */ + $autoComplete[$name] = $name; if ( startsWith($autoComplete[$name],"dynamix ") ) $autoComplete[$name] = str_replace("dynamix ","",$autoComplete[$name]); @@ -1451,7 +1451,6 @@ function populateAutoComplete() { # Displays the changelog # ########################## function caChangeLog() { - global $caPaths, $caSettings, $DockerClient, $DockerTemplates, $dockerRunning, $sortOrder; $o = "