From 76dbd4469ed73e36aa239e2d4be17c5ffa9cd849 Mon Sep 17 00:00:00 2001
From: Cameron <e107inc@gmail.com>
Date: Mon, 25 Jan 2021 17:57:34 -0800
Subject: [PATCH] Fixed error in {XURL_ICONS} shortcode. Added a test. Fixed
 some warnings in the admin/language page.

---
 e107_admin/lancheck.php                       | 15 ++++++-----
 e107_admin/language.php                       |  4 +--
 e107_handlers/user_model.php                  |  1 +
 e107_plugins/social/e_shortcode.php           |  6 ++---
 .../tests/unit/e_parse_shortcodeTest.php      | 27 +++++++++++++++++++
 5 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/e107_admin/lancheck.php b/e107_admin/lancheck.php
index bf59b608f..22b04c458 100644
--- a/e107_admin/lancheck.php
+++ b/e107_admin/lancheck.php
@@ -321,16 +321,16 @@ class lancheck
 
 	public function errorsOnly($val)
 	{
-		$this->errorsOnly = $val;
+		$this->errorsOnly = (bool) $val;
 
 	}
 	
 	public function init()
 	{
 
-		$mode   = $_GET['sub'];
-		$lan    = $_GET['lan'];
-		$file   = $_GET['file'];
+		$mode   = varset($_GET['sub']);
+		$lan    = varset($_GET['lan']);
+		$file   = varset($_GET['file']);
 
 		$this->transLanguage = $lan;
 
@@ -865,12 +865,13 @@ class lancheck
 		$xml = e107::getXml();
 
 		$feed = 'https://e107.org/languagepacks.xml';
-
 		$version = e_VERSION;
 
 		if(!empty($version))
 		{
-			list($ver,$tmp) = explode("-", $version);
+			$tmp = explode("-", $version);
+			$ver = varset($tmp[0]); 
+
 			$feed .= "?ver=". preg_replace('/[^\d\.]/','', $ver);
 		}
 
@@ -913,7 +914,7 @@ class lancheck
 
 				$languages[$id] = array(
 					'name'          => $att['name'],
-					'author'        => $att['author'],
+					'author'        => varset($att['author']),
 					'infoURL'       => $att['infourl'],
 					'tag'           => $att['tag'],
 				//	'folder'        => $att['folder'],
diff --git a/e107_admin/language.php b/e107_admin/language.php
index 84d906a6b..73ee07d5d 100644
--- a/e107_admin/language.php
+++ b/e107_admin/language.php
@@ -179,11 +179,11 @@ if(!empty($_GET['iframe']))
 		function ToolsPage()
 		{
 			$this->loadPackInfo();
-			$pref = e107::getPref();
+			$pref = e107::getPref('multilanguage_verify_errorsonly', false);
 			/** @var lancheck $lck */
 			$lck = e107::getSingleton('lancheck', e_ADMIN."lancheck.php");
 
-			$lck->errorsOnly($pref['multilanguage_verify_errorsonly']);
+			$lck->errorsOnly($pref);
 			// show_packs();
 
 			if($return = $lck->init())
diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php
index b0f955717..e7927a70a 100644
--- a/e107_handlers/user_model.php
+++ b/e107_handlers/user_model.php
@@ -293,6 +293,7 @@ class e_user_model extends e_admin_model
 				'Accoona-AI-Agent',
 				'AddSugarSpiderBot',
 				'AnyApexBot',
+				'applebot',
 				'Arachmo',
 				'B-l-i-t-z-B-O-T',
 				'Baiduspider',
diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php
index fa8cf1941..918924112 100644
--- a/e107_plugins/social/e_shortcode.php
+++ b/e107_plugins/social/e_shortcode.php
@@ -90,11 +90,11 @@ class social_shortcodes extends e_shortcode
 		);
  			
 		// print_a($social);
-	
-		$class      = (!empty($parm['size'])) ?  'fa-'.$parm['size'] : '';
-		$class      .= (isset($parm['class'])) ? (string) $parm['class'] : $class;
 
 
+		$class      = (isset($parm['class'])) ? (string) $parm['class'] : '';
+		$class      .= (!empty($parm['size'])) ?  'fa-'.$parm['size'] : '';
+
 		if(!empty($parm['type']))
 		{
 			$newList = array();
diff --git a/e107_tests/tests/unit/e_parse_shortcodeTest.php b/e107_tests/tests/unit/e_parse_shortcodeTest.php
index 9e38430ed..b23b50041 100644
--- a/e107_tests/tests/unit/e_parse_shortcodeTest.php
+++ b/e107_tests/tests/unit/e_parse_shortcodeTest.php
@@ -647,6 +647,33 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
 
     }
 
+    public function testSocialShortcodes()
+    {
+    	require_once(e_PLUGIN."social/e_shortcode.php");
+
+        try
+		{
+			/** @var social_shortcodes $sc */
+			$sc = $this->make('social_shortcodes');
+		}
+		catch (Exception $e)
+		{
+			$this->fail($e->getMessage());
+		}
+
+		$sc->__construct();
+
+		parse_str('type=facebook,twitter,youtube,flickr,vimeo,google-plus,github,instagram,linkedin&size=3x', $parm);
+
+		$result = $sc->sc_xurl_icons($parm);
+
+		$this->assertStringContainsString('<span class="e-social-twitter fa-3x"></span>', $result);
+		$this->assertStringContainsString('<span class="e-social-youtube fa-3x"></span>', $result);
+
+    }
+
+
+
     public function testUserShortcodes()
     {
         require_once(e_CORE."shortcodes/batch/user_shortcodes.php");