Moves privacy fieldset above captcha fieldset SecurityElement, fixes notices and misnamed functions in QueueServer (latter could cause fatal crash), tweaks when spell correction suggestion made in SearchView, a=chris

Chris Pollett [2019-06-23 02:Jun:rd]
Moves privacy fieldset above captcha fieldset SecurityElement, fixes notices and misnamed functions in QueueServer (latter could cause fatal crash), tweaks when spell correction suggestion made in SearchView, a=chris
Filename
src/configs/GroupWikiTool.php
src/executables/ArcTool.php
src/executables/QueueServer.php
src/library/index_bundle_iterators/GroupIterator.php
src/locale/ar/configure.ini
src/locale/bn/configure.ini
src/locale/de/configure.ini
src/locale/en_US/configure.ini
src/locale/es/configure.ini
src/locale/fa/configure.ini
src/locale/fr_FR/configure.ini
src/locale/he/configure.ini
src/locale/hi/configure.ini
src/locale/in_ID/configure.ini
src/locale/it/configure.ini
src/locale/ja/configure.ini
src/locale/kn/configure.ini
src/locale/ko/configure.ini
src/locale/nl/configure.ini
src/locale/pl/configure.ini
src/locale/pt/configure.ini
src/locale/ru/configure.ini
src/locale/te/configure.ini
src/locale/th/configure.ini
src/locale/tr/configure.ini
src/locale/vi_VN/configure.ini
src/locale/zh_CN/configure.ini
src/scripts/suggest.js
src/views/SearchView.php
src/views/elements/SecurityElement.php
diff --git a/src/configs/GroupWikiTool.php b/src/configs/GroupWikiTool.php
index e8b707d8f..857feaf2c 100644
--- a/src/configs/GroupWikiTool.php
+++ b/src/configs/GroupWikiTool.php
@@ -95,6 +95,7 @@ php GroupWikiTool.php reset folder
 php GroupWikiTool.php version folder
   if folder is the name of a Group Wiki page resource folder, then this
   will save a save a new version snapshot to the .archive subfolder
+
 EOD;
 if (empty($argv[2])) {
     $argv[2] = getcwd();
@@ -106,7 +107,7 @@ if ( $num_args < 3 ) {
 }
 switch ($argv[1]) {
     case "clear-lock":
-        $lock_file = $argv[2] ."/.archive/LOCK";
+        $lock_file = $argv[2] . "/.archive/LOCK";
         if (file_exists($argv[2])) {
             unlink($lock_file);
             echo "Group Wiki Page Resource Lock file removed!";
diff --git a/src/executables/ArcTool.php b/src/executables/ArcTool.php
index 5e51b93ec..b75e7b30d 100755
--- a/src/executables/ArcTool.php
+++ b/src/executables/ArcTool.php
@@ -503,7 +503,9 @@ class ArcTool implements CrawlConstants
             $tmp = $shard->getPostingAtOffset(
                 $next, $posting_start, $posting_end);
             $next = $posting_end + 1;
-            if (!$tmp) break;
+            if (!$tmp) {
+                break;
+            }
             $documents = array_merge($documents, $shard->getPostingsSlice(
                 $old_offset, $old_start, $old_end, 1));
             $raw_postings[] = $tmp;
@@ -521,15 +523,15 @@ class ArcTool implements CrawlConstants
         echo str_pad("", $count + 1, "=")."================\n";
         $j = 0;
         foreach ($documents as $key => $document) {
-            echo "\nDOC ID: ".L\toHexString($key);
-            echo "\nTYPE: ".(($document[self::IS_DOC]) ? "Document" : "Link");
-            echo "\nDOC INDEX: ".$doc_indexes[$j];
+            echo "\nDOC ID: " . L\toHexString($key);
+            echo "\nTYPE: ".  (($document[self::IS_DOC]) ? "Document" : "Link");
+            echo "\nDOC INDEX: " . $doc_indexes[$j];
             $summary_offset = $document[self::SUMMARY_OFFSET];
-            echo "\nSUMMARY OFFSET: ".$summary_offset;
-            echo "\nSCORE: ".$document[self::SCORE];
-            echo "\nDOC RANK: ".$document[self::DOC_RANK];
-            echo "\nRELEVANCE: ".$document[self::RELEVANCE];
-            echo "\nPROXIMITY: ".$document[self::PROXIMITY];
+            echo "\nSUMMARY OFFSET: " . $summary_offset;
+            echo "\nSCORE: " . $document[self::SCORE];
+            echo "\nDOC RANK: " . $document[self::DOC_RANK];
+            echo "\nRELEVANCE: " . $document[self::RELEVANCE];
+            echo "\nPROXIMITY: " . $document[self::PROXIMITY];
             echo "\nHEX POSTING:\n";
             echo "------------\n";
             echo wordwrap(L\toHexString($raw_postings[$j]), 80);
diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php
index c63975df1..47003bca5 100755
--- a/src/executables/QueueServer.php
+++ b/src/executables/QueueServer.php
@@ -583,7 +583,7 @@ class QueueServer implements CrawlConstants, Join
         } else {
             file_put_contents($error_log, $out_msg, FILE_APPEND);
         }
-        $init_args = [susbtr($this->process_name, 2) . ".php", "start",
+        $init_args = [substr($this->process_name, 2) . ".php", "start",
             "none", $process];
         CrawlDaemon::init( $init_args, $this->process_name, -3);
         if ($info[self::STATUS] != self::WAITING_START_MESSAGE_STATE) {
@@ -1313,7 +1313,7 @@ class QueueServer implements CrawlConstants, Join
         $try_to_set_from_old_index = null)
     {
         if ($try_to_set_from_old_index === null) {
-            $try_to_set_from_old_index = array_key(self::$info_parameter_map);
+            $try_to_set_from_old_index = array_keys(self::$info_parameter_map);
         }
         if(empty($this->repeat_type) || $this->repeat_type < 0) {
             $class_name = C\NS_LIB . "IndexArchiveBundle";
@@ -2386,10 +2386,12 @@ class QueueServer implements CrawlConstants, Join
         L\crawlLog("Total urls extracted so far: ".$info_bundle['COUNT']);
         if (isset($sites[self::RECENT_URLS])) {
             L\crawlLog("Of these, the most recent urls are:");
+            set_error_handler(null);
             foreach ($sites[self::RECENT_URLS] as $url) {
                 L\crawlLog("URL: " .
-                iconv("UTF-8", "ISO-8859-1//IGNORE", $url));
+                @iconv("UTF-8", "ISO-8859-1//IGNORE", $url));
             }
+            set_error_handler(C\NS_CONFIGS . "yioop_error_handler");
         }
     }
     /**
diff --git a/src/library/index_bundle_iterators/GroupIterator.php b/src/library/index_bundle_iterators/GroupIterator.php
index 9c436f1c0..7e3c1da68 100644
--- a/src/library/index_bundle_iterators/GroupIterator.php
+++ b/src/library/index_bundle_iterators/GroupIterator.php
@@ -229,7 +229,9 @@ class GroupIterator extends IndexBundleIterator
         $pre_out_pages = [];
         foreach ($pages as $doc_key => $doc_info) {
             if (!is_array($doc_info) || $doc_info[self::SUMMARY_OFFSET] ==
-                self::NEEDS_OFFSET_FLAG) { continue;}
+                self::NEEDS_OFFSET_FLAG) {
+                    continue;
+            }
             $hash_url = substr($doc_key, 0, IndexShard::DOC_KEY_LEN);
             if (isset($doc_info[self::IS_FEED])) {
                 $this->is_feed = true;
diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini
index 8aa629fc0..beec070ce 100755
--- a/src/locale/ar/configure.ini
+++ b/src/locale/ar/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini
index 0ebed5ad3..34eab1c3d 100755
--- a/src/locale/bn/configure.ini
+++ b/src/locale/bn/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini
index a4a3f722e..fc6451920 100755
--- a/src/locale/de/configure.ini
+++ b/src/locale/de/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index 4bb612c5f..fca09702d 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -1199,7 +1199,7 @@ searchsources_element_localize = "Localize"
 searchsources_element_deletesubsearch = "Delete"
 ;
 ; SecurityElement.php
-security_element_auth_captcha = "Auth, Access, Captcha, Recovery, and Analytics"
+security_element_auth_captcha = "Auth, Access, Privacy, Captcha, and Recovery"
 security_element_auth_and_access = "Authentication and Access"
 security_element_authentication_type = "Authentication Type:"
 security_element_zero_unavailable = "BC Math nZero Knowledge Authentication Needs OpenSSL or BC Math!"
@@ -1207,12 +1207,12 @@ security_element_site_timezone = "Timezone:"
 security_element_token_name = "Token Name:"
 security_element_session_name = "Session Name:"
 security_element_autologout = "Autologout:"
-security_element_captcha_type = "Captcha Type"
-security_element_recovery_type = "Recovery Type"
 security_element_privacy = "Privacy"
 security_element_differential_privacy = "Differential Privacy:"
 security_element_group_analytics = "Group Analytics:"
 security_element_search_analytics = "Search Analytics:"
+security_element_captcha_type = "Captcha Type"
+security_element_recovery_type = "Recovery Type"
 security_element_save = "Save"
 security_element_captcha_recovery_questions = "Captcha and Recovery Questions"
 security_element_edit_recovery = "Edit Account Recovery Questions"
diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini
index 5b386b6d6..d251d9580 100755
--- a/src/locale/es/configure.ini
+++ b/src/locale/es/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini
index 573160928..b3650a433 100755
--- a/src/locale/fa/configure.ini
+++ b/src/locale/fa/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini
index 261fb5ae8..a1975415a 100755
--- a/src/locale/fr_FR/configure.ini
+++ b/src/locale/fr_FR/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini
index 07241408a..5459891a2 100755
--- a/src/locale/he/configure.ini
+++ b/src/locale/he/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini
index 845f73738..5c0e197db 100755
--- a/src/locale/hi/configure.ini
+++ b/src/locale/hi/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/in_ID/configure.ini b/src/locale/in_ID/configure.ini
index 19f3c49bc..96942ecd1 100755
--- a/src/locale/in_ID/configure.ini
+++ b/src/locale/in_ID/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini
index 3276dfd4b..61a9d302d 100755
--- a/src/locale/it/configure.ini
+++ b/src/locale/it/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini
index 03420f664..7e43a013c 100755
--- a/src/locale/ja/configure.ini
+++ b/src/locale/ja/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini
index 7f83ee2b5..47b4d5c7a 100755
--- a/src/locale/kn/configure.ini
+++ b/src/locale/kn/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini
index fc7fa571a..f6769ac85 100755
--- a/src/locale/ko/configure.ini
+++ b/src/locale/ko/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini
index e319200aa..0027f66df 100644
--- a/src/locale/nl/configure.ini
+++ b/src/locale/nl/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = "captcha Type"
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = "captcha Type"
+security_element_recovery_type = ""
 security_element_save = "Opslaan"
 security_element_captcha_recovery_questions = "Captcha and Recovery Vragen"
 security_element_edit_recovery = "Wijzig Account Recovery Vragen"
diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini
index b51c90cf8..974d61d5c 100755
--- a/src/locale/pl/configure.ini
+++ b/src/locale/pl/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini
index 9d0096fb2..60ce6e3e2 100755
--- a/src/locale/pt/configure.ini
+++ b/src/locale/pt/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini
index 0ac8a3d8c..0c12dd991 100755
--- a/src/locale/ru/configure.ini
+++ b/src/locale/ru/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini
index 8f4a70799..18de04234 100644
--- a/src/locale/te/configure.ini
+++ b/src/locale/te/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = "సేవ్ చేయి"
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini
index 182997b57..a5b6912a1 100755
--- a/src/locale/th/configure.ini
+++ b/src/locale/th/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini
index 0375e006f..df98e6080 100755
--- a/src/locale/tr/configure.ini
+++ b/src/locale/tr/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini
index 1b5173e17..fcf1c0b4c 100755
--- a/src/locale/vi_VN/configure.ini
+++ b/src/locale/vi_VN/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini
index 17165954e..62cc03e5d 100755
--- a/src/locale/zh_CN/configure.ini
+++ b/src/locale/zh_CN/configure.ini
@@ -1207,12 +1207,12 @@ security_element_site_timezone = ""
 security_element_token_name = ""
 security_element_session_name = ""
 security_element_autologout = ""
-security_element_captcha_type = ""
-security_element_recovery_type = ""
 security_element_privacy = ""
 security_element_differential_privacy = ""
 security_element_group_analytics = ""
 security_element_search_analytics = ""
+security_element_captcha_type = ""
+security_element_recovery_type = ""
 security_element_save = ""
 security_element_captcha_recovery_questions = ""
 security_element_edit_recovery = ""
diff --git a/src/scripts/suggest.js b/src/scripts/suggest.js
index c2cf91bc8..52b2ee2ac 100644
--- a/src/scripts/suggest.js
+++ b/src/scripts/suggest.js
@@ -162,14 +162,14 @@ function onTypeTerm(event, text_field)
                             search_list_array[split_array[1]].split("_");
                             search_list +=  "<li><span id='term" +local_count+
                                 "' class='unselected' onclick = 'void(0)' " +
-                                "title='"+search_split[0]+"' " +
-                                "onmouseover='setSelectedTerm(\""+
-                                local_count+"\",\"selected\")'" +
+                                "title='" + search_split[0] + "' " +
+                                "onmouseover='setSelectedTerm(\"" +
+                                local_count + "\",\"selected\")'" +
                                 "onmouseout='setSelectedTerm(\""+
                                 local_count+"\",\"unselected\")'" +
-                                "onmouseup='termClick(\""+search_split[0]+
-                                "\",this.id)'"+
-                                ">" + search_split[1] + "</span></li>";
+                                "onmouseup='termClick(\"" + search_split[0] +
+                                "\",this.id)' >" + search_split[1] +
+                                "</span></li>";
                             local_count++;
                         }

@@ -255,18 +255,19 @@ function onTypeTerm(event, text_field)
 function correctSpelling(word)
 {
     var prob = 0;
+    var correct_threshold = 25;
     trie_subtree = exist(dictionary, word);
     if (trie_subtree != false) {
         prob = parseInt(trie_subtree[END_OF_TERM_MARKER]);
+        if (prob >= correct_threshold) {
+            return word;
+        }
     }
     var trie_subtree;
     var curr_prob = 0;
     var candidates = known(edits1(word));
-
     candidates.push(word);
     var corrected_word = "";
-    var correct_threshold = 25;
-
     // Use the frequencies to get the best match
     for (var i = 0; i < candidates.length; i++) {
         trie_subtree = exist(dictionary, candidates[i]);
@@ -358,9 +359,10 @@ Array.prototype.unique = function() {
  */
 function known(words_ip)
 {
-    var known_words = new Array(),j=0;
+    var known_words = new Array();
+    var j=0;
     var ret_array;
-    for (var i=0;i < words_ip.length;i++) {
+    for (var i = 0; i < words_ip.length; i++) {
         ret_array = exist(dictionary, words_ip[i]);
         if (ret_array[END_OF_TERM_MARKER] != null) {
             known_words[j] = words_ip[i];
@@ -701,9 +703,10 @@ function spellCheck()
             var csrf_token = elt("csrf-token").value;
         }
         var its_value = elt("its-value").value;
-
         var query = elt("query-field").value;
-        if (query == "") return;
+        if (query == "") {
+            return;
+        }
         var ret_array;
         var ret_word;
         if (localStorage) {
@@ -717,7 +720,8 @@ function spellCheck()
             }
         }
         var term_array = query.split(" ");
-        for (var i = 0; i < term_array.length; i++) {
+        var num_terms = term_array.length;
+        for (var i = 0; i < num_terms; i++) {
             ret_word = "";
             ret_word = correctSpelling(term_array[i].toLowerCase());
             if (ret_word.trim(" ") == "") {
diff --git a/src/views/SearchView.php b/src/views/SearchView.php
index e3e4d14dc..308df2155 100755
--- a/src/views/SearchView.php
+++ b/src/views/SearchView.php
@@ -187,9 +187,9 @@ class SearchView extends View implements CrawlConstants
         $token_string_amp = ($logged_in) ?
             C\CSRF_TOKEN . "=" . $data[C\CSRF_TOKEN]."&amp;" : "";
         ?>
-        <div <?php if (C\WORD_SUGGEST) { e('id="spell-check"'); } ?>
-            class="spell"><span class="hidden"
-        >&nbsp;</span></div>
+        <div <?php if (C\WORD_SUGGEST) {
+            e('id="spell-check"');
+            } ?> class="spell"><span class="hidden" >&nbsp;</span></div>
         <h2 class="serp-stats"><?php
             if ($_SERVER["MOBILE"]) {
             } else {
@@ -223,7 +223,7 @@ class SearchView extends View implements CrawlConstants
         }
         if (!empty($data['BEST_ANSWER'])) {
             ?><div id="best-answer" class="echo-link">
-                 <?= $data['BEST_ANSWER'] ?>
+                 <?= $data['BEST_ANSWER']; ?>
             </div><?php
         }
         foreach ($data['PAGES'] as $page) {
diff --git a/src/views/elements/SecurityElement.php b/src/views/elements/SecurityElement.php
index f54cf4893..9a12e3aa2 100755
--- a/src/views/elements/SecurityElement.php
+++ b/src/views/elements/SecurityElement.php
@@ -107,38 +107,6 @@ class SecurityElement extends Element
             </fieldset>
             </div>
             <div class="top-margin">
-            <fieldset>
-                <legend><label
-                for="captcha-mode"><b><?php
-                e(tl('security_element_captcha_type'));
-                e("&nbsp;" . $this->view->helper("helpbutton")->render(
-                    "Captcha Type", $data[C\CSRF_TOKEN]))
-                ?></b>
-                </label></legend>
-                <?php
-                    $this->view->helper("options")->render("captcha-mode",
-                        "CAPTCHA_MODE", $data['CAPTCHA_MODES'],
-                        $data['CAPTCHA_MODE']);
-                ?>
-            </fieldset>
-            </div>
-            <div class="top-margin">
-            <fieldset>
-                <legend><label
-                for="recovery-mode"><b><?php
-                e(tl('security_element_recovery_type'));
-                e("&nbsp;" . $this->view->helper("helpbutton")->render(
-                    "Recovery Type", $data[C\CSRF_TOKEN]))
-                ?></b>
-                </label></legend>
-                <?php
-                    $this->view->helper("options")->render("recovery-mode",
-                        "RECOVERY_MODE", $data['RECOVERY_MODES'],
-                        $data['RECOVERY_MODE']);
-                ?>
-            </fieldset>
-            </div>
-            <div class="top-margin">
             <fieldset>
                 <legend><label
                 for="privacy-mode"><b><?php
@@ -182,6 +150,38 @@ class SecurityElement extends Element
                 ?>
                 </td></tr></table>
             </div>
+            <div class="top-margin">
+            <fieldset>
+                <legend><label
+                for="captcha-mode"><b><?php
+                e(tl('security_element_captcha_type'));
+                e("&nbsp;" . $this->view->helper("helpbutton")->render(
+                    "Captcha Type", $data[C\CSRF_TOKEN]))
+                ?></b>
+                </label></legend>
+                <?php
+                    $this->view->helper("options")->render("captcha-mode",
+                        "CAPTCHA_MODE", $data['CAPTCHA_MODES'],
+                        $data['CAPTCHA_MODE']);
+                ?>
+            </fieldset>
+            </div>
+            <div class="top-margin">
+            <fieldset>
+                <legend><label
+                for="recovery-mode"><b><?php
+                e(tl('security_element_recovery_type'));
+                e("&nbsp;" . $this->view->helper("helpbutton")->render(
+                    "Recovery Type", $data[C\CSRF_TOKEN]))
+                ?></b>
+                </label></legend>
+                <?php
+                    $this->view->helper("options")->render("recovery-mode",
+                        "RECOVERY_MODE", $data['RECOVERY_MODES'],
+                        $data['RECOVERY_MODE']);
+                ?>
+            </fieldset>
+            </div>
             <div class="top-margin center"><button
                 class="button-box" type="submit"><?=tl('security_element_save')
                 ?></button>
ViewGit