From 68c040eebbd00fffc7bd60dccf02f43da9b0fa88 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 5 Jan 2020 23:19:20 +0200 Subject: [PATCH] Fixed gh-510 so that snippets are imported from github correctly. --- README.md | 2 +- admin/README.txt | 2 +- admin/language/en-GB/en-GB.com_componentbuilder.ini | 1 + admin/models/ajax.php | 7 ++++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ba0bd708d..02654fdea 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ TODO + *Version*: 2.10.10 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **280701** ++ *Line count*: **280707** + *Field count*: **1503** + *File count*: **1769** + *Folder count*: **280** diff --git a/admin/README.txt b/admin/README.txt index ba0bd708d..02654fdea 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -148,7 +148,7 @@ TODO + *Version*: 2.10.10 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **280701** ++ *Line count*: **280707** + *Field count*: **1503** + *File count*: **1769** + *Folder count*: **280** diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 008220341..f920e5a97 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -4765,6 +4765,7 @@ COM_COMPONENTBUILDER_EQUAL="Equal" COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_PLAN_WITH_THE_SAME_NAME_CATEGORY_AND_TYPE_AND_YOUR_LOCAL_PLAN_WITH_THE_SAME_NAME_CATEGORY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community plan (with the same name, category and type) and your local plan (with the same name, category and type) has the same creation and modified date." COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_AND_YOUR_LOCAL_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community snippet (with the same name, library and type) and your local snippet (with the same name, library and type) has the same creation and modified date." COM_COMPONENTBUILDER_ERROR="Error" +COM_COMPONENTBUILDER_ERROR_BR_S="Error!
%s" COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB="Error! The path has a mismatch and could therefore not retrieve the snippet from gitHub!" COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED="Error! The snippet is faulty and could not be saved." COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS="Error! You do not have access to the snippets." diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 740cc6362..abb441bc0 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -3389,10 +3389,15 @@ class ComponentbuilderModelAjax extends JModelList // set url $url = ComponentbuilderHelper::$snippetPath.rawurlencode($base_path); // get the snippets - if (($snippet = ComponentbuilderHelper::getGithubRepoData('lib_snippet_' . $base_path, $url)) !== false) + if (($snippet = ComponentbuilderHelper::getGithubRepoData('lib_snippet_' . $base_path, $url, null, 'array')) !== false) { return $this->saveSnippet($snippet, $status, $user); } + // see if we have any errors from github + if (ComponentbuilderHelper::checkArray(ComponentbuilderHelper::$githubRepoDataErrors)) + { + return array('message' => JText::sprintf('COM_COMPONENTBUILDER_ERROR_BR_S', implode('
', ComponentbuilderHelper::$githubRepoDataErrors)), 'status' => 'danger'); + } return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger'); } return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS'), 'status' => 'danger');