Fixes more bugs with search source scrapring, Very first pass at adding ability to charge credits to join group,a=chris

Chris Pollett [2018-05-11 22:May:th]
Fixes more bugs with search source scrapring, Very first pass at adding ability to charge credits to join group,a=chris
Filename
src/controllers/components/CrawlComponent.php
src/controllers/components/SocialComponent.php
src/library/media_jobs/FeedsUpdateJob.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/models/CreditModel.php
src/models/GroupModel.php
src/views/elements/ManagegroupsElement.php
tests/HiTokenizerTest.php
diff --git a/src/controllers/components/CrawlComponent.php b/src/controllers/components/CrawlComponent.php
index a6409b84f..99d9f7802 100644
--- a/src/controllers/components/CrawlComponent.php
+++ b/src/controllers/components/CrawlComponent.php
@@ -2011,6 +2011,7 @@ class CrawlComponent extends Component implements CrawlConstants
                         'regex'])) {
                         $is_parse_feed = true;
                         $aux_parts = explode("###", $source['AUX_INFO']);
+                        $aux_parts = array_pad($aux_parts, 7, "");
                         list($source['CHANNEL_PATH'],
                             $source['ITEM_PATH'], $source['TITLE_PATH'],
                             $source['DESCRIPTION_PATH'],
diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index 6ff7213c1..094e6fe11 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -100,8 +100,20 @@ class SocialComponent extends Component implements CrawlConstants
             C\REQUEST_JOIN => tl('social_component_by_request'),
             C\PUBLIC_BROWSE_REQUEST_JOIN =>
                 tl('social_component_public_request'),
-            C\PUBLIC_JOIN => tl('social_component_public_join')
+            C\PUBLIC_JOIN => tl('social_component_public_join'),
         ];
+        if (!in_array(C\ADVERTISEMENT_TYPE,
+            ['no_advertisements','external_advertisements'])) {
+            $data['can_monetise_group'] = true;
+            $monetise_codes = [100 => tl('social_component_hundred_credits'),
+                200 => tl('social_component_two_hundred_credits'),
+                500 => tl('social_component_five_hundred_credits'),
+                1000 => tl('social_component_thousand_credits'),
+                2000 => tl('social_component_two_thousand_credits')];
+            $data['REGISTER_CODES'] += $monetise_codes;
+        } else {
+            $data['can_monetise_group'] = false;
+        }
         $data['ACCESS_CODES'] = [
             C\GROUP_PRIVATE => tl('social_component_private'),
             C\GROUP_READ => tl('social_component_read'),
@@ -124,6 +136,12 @@ class SocialComponent extends Component implements CrawlConstants
             1 => tl('social_component_encryption_enable'),
             0 => tl('social_component_encryption_disable'),
         ];
+        if (!in_array(C\ADVERTISEMENT_TYPE,
+            ['no_advertisements','external_advertisements'])) {
+            $data['can_monetise_group'] = true;
+        } else {
+            $data['can_monetise_group'] = false;
+        }
         $search_array = [];
         $default_group = ["name" => "","id" => "", "owner" =>"",
             "register" => -1, "member_access" => -1, 'vote_access' => -1,
@@ -237,7 +255,7 @@ class SocialComponent extends Component implements CrawlConstants
                     if (($add_id = $group_model->getGroupId($name)) > 0) {
                         $register =
                             $group_model->getRegisterType($add_id);
-                        if (($add_id > 0 && $register && $register !=
+                        if (($add_id > 0 && !empty($register) && $register !=
                             C\NO_JOIN) || $_SESSION['USER_ID'] == C\ROOT_ID) {
                             $this->addGroup($data, $add_id, $register);
                             if (isset($_REQUEST['browse']) &&
@@ -1030,19 +1048,34 @@ class SocialComponent extends Component implements CrawlConstants
     {
         $parent = $this->parent;
         $group_model = $parent->model('group');
+        $credit_model = $parent->model('credit');
+        $user_id = $_SESSION['USER_ID'];
         $join_type = (($register == C\REQUEST_JOIN ||
             $register == C\PUBLIC_BROWSE_REQUEST_JOIN) &&
             $_SESSION['USER_ID'] != C\ROOT_ID) ?
             C\INACTIVE_STATUS : C\ACTIVE_STATUS;
+        if ($register >= 100 && !in_array(C\ADVERTISEMENT_TYPE,
+            ['no_advertisements','external_advertisements'])) {
+            $balance = $credit_model->getCreditBalance($user_id);
+            if ($balance - $register < 0) {
+                return $parent->redirectWithMessage(
+                    tl('social_component_buy_more_credits_join'));
+            }
+            $group_name = $group_model->getGroupName($add_id);
+            $strings_to_translate_for_model =
+                [tl('social_component_join_group_fee')];
+            $credit_model->updateCredits($user_id, -$register,
+                'social_component_join_group_fee');
+        }
         $msg = ($join_type == C\ACTIVE_STATUS) ?
             "doMessage('<h1 class=\"red\" >".
             tl('social_component_group_joined'). "</h1>')" :
             "doMessage('<h1 class=\"red\" >".
             tl('social_component_group_request_join'). "</h1>')";
         $group_model->addUserGroup(
-            $_SESSION['USER_ID'], $add_id, $join_type);
+            $user_id, $add_id, $join_type);
         $data['SCRIPT'] .= $msg;
-        if (!in_array($join_type, [C\REQUEST_JOIN,
+        if (!in_array($register, [C\REQUEST_JOIN,
             C\PUBLIC_BROWSE_REQUEST_JOIN] ) ) {
             return;
         }
@@ -1349,7 +1382,7 @@ class SocialComponent extends Component implements CrawlConstants
                 case "addgroup":
                     $register =
                         $group_model->getRegisterType($just_group_id);
-                    if ($just_group_id > 0 && $register
+                    if ($just_group_id > 0 && !empty($register)
                         && $register != C\NO_JOIN) {
                         $this->addGroup($data, $just_group_id, $register);
                         unset($data['SUBSCRIBE_LINK']);
diff --git a/src/library/media_jobs/FeedsUpdateJob.php b/src/library/media_jobs/FeedsUpdateJob.php
index b68fb6025..28f77214d 100644
--- a/src/library/media_jobs/FeedsUpdateJob.php
+++ b/src/library/media_jobs/FeedsUpdateJob.php
@@ -493,8 +493,19 @@ class FeedsUpdateJob extends MediaJob
             return [];
         }
         $tags = $dom_xpath->query($query);
-        if (!$tags) {
-            return [];
+        if (empty($tags) || $tags->length == 0) {
+            if(!empty($dom->textContent)) {
+                $redom = new \DOMDocument;
+                @$redom->loadHTML($dom->textContent);
+                $dom_xpath = new \DOMXPath($redom);
+                if (!$dom_xpath) {
+                    return [];
+                }
+                $tags = $dom_xpath->query($query);
+            }
+            if (empty($tags) || $tags->length == 0) {
+                return [];
+            }
         }
         $i = 0;
         while ($item = $tags->item($i)) {
diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini
index 66382c07f..28e4c079f 100755
--- a/src/locale/ar/configure.ini
+++ b/src/locale/ar/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = "الزحف ميكس التغييرات المحف
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini
index cc5afd834..7218092bc 100755
--- a/src/locale/bn/configure.ini
+++ b/src/locale/bn/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini
index d04c162d7..ebfd182a7 100755
--- a/src/locale/de/configure.ini
+++ b/src/locale/de/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index 26286a8ff..d2282b592 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = "No One"
 social_component_by_request = "By Request"
 social_component_public_request = "Public Request"
 social_component_public_join = "Anyone"
+social_component_hundred_credits = "100 Credits"
+social_component_two_hundred_credits = "200 Credits"
+social_component_five_hundred_credits = "500 Credits"
+social_component_thousand_credits = "1000 Credits"
+social_component_two_thousand_credits = "2000 Credits"
 social_component_private = "No Read"
 social_component_read = "Read"
 social_component_read_comment = "Read Comment"
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = "Could not Unsubscribe!"
 managegroups_element_no_activity = "No Activity"
 social_component_originally_posted = "Originally Posted By: %s"
 social_component_originally_dated = "Original Date: %s"
+social_component_buy_more_credits_join = "Buy Yioop Credits to Join Group!"
+social_component_join_group_fee = "Join discussion group fee "
 social_component_group_joined = "Group joined!"
 social_component_group_request_join = "Join Group Request Made!"
 social_component_activate_group = "Yioop Group %s Activation Request"
@@ -299,6 +306,7 @@ social_component_mix_saved = "Crawl Mix Changes Saved!"
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = "Pattern Lookup Error!"
+chatbot_component_max_patterns_exceeded = "Maximum Chat Bot Patterns Exceeded"
 chatbot_component_missing_required = "Missing Required Fields (Request)!"
 chatbot_component_pattern_added = "Pattern Added!"
 chatbot_component_pattern_updated = "Pattern Updated!"
diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini
index e113282ae..dfc13cd82 100755
--- a/src/locale/es/configure.ini
+++ b/src/locale/es/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = "Guardados los Cambios del Rastreo Mix!"
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini
index 11b686c20..37ed3f11d 100755
--- a/src/locale/fa/configure.ini
+++ b/src/locale/fa/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = "تغییرات ترکیب خزش ذخیره شد!"
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini
index c087e5256..870669641 100755
--- a/src/locale/fr_FR/configure.ini
+++ b/src/locale/fr_FR/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini
index dce7e34b2..f16a5cc4e 100755
--- a/src/locale/he/configure.ini
+++ b/src/locale/he/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini
index 1a56bfcd9..b4e407867 100755
--- a/src/locale/hi/configure.ini
+++ b/src/locale/hi/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/in_ID/configure.ini b/src/locale/in_ID/configure.ini
index 46769424a..8784e0277 100755
--- a/src/locale/in_ID/configure.ini
+++ b/src/locale/in_ID/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini
index 30649e15b..2a5d1c75b 100755
--- a/src/locale/it/configure.ini
+++ b/src/locale/it/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = "Cambiamenti Unione Scansioni effettuati!"
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini
index d40c784c8..846eb8654 100755
--- a/src/locale/ja/configure.ini
+++ b/src/locale/ja/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini
index 454162f4d..1181a4d87 100755
--- a/src/locale/kn/configure.ini
+++ b/src/locale/kn/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = "ಕ್ರಾವ್ಲ್ ಮಿಶ್ರಣದಲ
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini
index 3fa1663f4..8204ca03e 100755
--- a/src/locale/ko/configure.ini
+++ b/src/locale/ko/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini
index 57a0b929f..a85d24514 100644
--- a/src/locale/nl/configure.ini
+++ b/src/locale/nl/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = "niemand"
 social_component_by_request = "Op verzoek"
 social_component_public_request = "openbare Request"
 social_component_public_join = "iedereen"
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = "geen lezen"
 social_component_read = "lezen"
 social_component_read_comment = "Lees Comment"
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = "Kon niet Uitschrijven!"
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = "Groep geworden!"
 social_component_group_request_join = "Lid worden van groep verzoek!"
 social_component_activate_group = "Yioop Groep %s Activation Request"
@@ -299,6 +306,7 @@ social_component_mix_saved = "Crawl Mix Wijzigingen opgeslagen!"
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini
index 5ef1973b8..df318cc0a 100755
--- a/src/locale/pl/configure.ini
+++ b/src/locale/pl/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini
index 4368ac8e2..912ae2906 100755
--- a/src/locale/pt/configure.ini
+++ b/src/locale/pt/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini
index 5e770badf..ff5754fb1 100755
--- a/src/locale/ru/configure.ini
+++ b/src/locale/ru/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini
index 59f07eb13..fb307ae16 100644
--- a/src/locale/te/configure.ini
+++ b/src/locale/te/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = "ఎవరూ లేరు"
 social_component_by_request = "అభ్యర్థన ద్వారా"
 social_component_public_request = "బహిరంగ అభ్యర్థన"
 social_component_public_join = "ఎవరైనా"
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = "చదవలేరు "
 social_component_read = "చదవండి"
 social_component_read_comment = "వ్యాఖ్యను చదవండి "
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = "తొలిగించుట సాధ్
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = "గ్రూప్ లో చేరారు!"
 social_component_group_request_join = "గ్రూప్ లో చేరడానికి అభ్యర్థన చేయబడినది!"
 social_component_activate_group = "yioop గ్రూప్ %s యాక్టివేషన్ అభ్యర్థన"
@@ -299,6 +306,7 @@ social_component_mix_saved = "క్రాల్ మిక్స్ మార్
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini
index ec5e24b08..988cb1fbb 100755
--- a/src/locale/th/configure.ini
+++ b/src/locale/th/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini
index e5d4c9644..47fae1d05 100755
--- a/src/locale/tr/configure.ini
+++ b/src/locale/tr/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini
index 09834a74d..a71f785c8 100755
--- a/src/locale/vi_VN/configure.ini
+++ b/src/locale/vi_VN/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = "Kết hợp đ&atilde; được lưu dữ"
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini
index c68a63f1a..b2303f103 100755
--- a/src/locale/zh_CN/configure.ini
+++ b/src/locale/zh_CN/configure.ini
@@ -99,6 +99,11 @@ social_component_no_join = ""
 social_component_by_request = ""
 social_component_public_request = ""
 social_component_public_join = ""
+social_component_hundred_credits = ""
+social_component_two_hundred_credits = ""
+social_component_five_hundred_credits = ""
+social_component_thousand_credits = ""
+social_component_two_thousand_credits = ""
 social_component_private = ""
 social_component_read = ""
 social_component_read_comment = ""
@@ -157,6 +162,8 @@ social_component_no_unsubscribe = ""
 managegroups_element_no_activity = ""
 social_component_originally_posted = ""
 social_component_originally_dated = ""
+social_component_buy_more_credits_join = ""
+social_component_join_group_fee = ""
 social_component_group_joined = ""
 social_component_group_request_join = ""
 social_component_activate_group = ""
@@ -299,6 +306,7 @@ social_component_mix_saved = ""
 ;
 ; ChatbotComponent.php
 chatbot_component_bot_lookup_error = ""
+chatbot_component_max_patterns_exceeded = ""
 chatbot_component_missing_required = ""
 chatbot_component_pattern_added = ""
 chatbot_component_pattern_updated = ""
diff --git a/src/models/CreditModel.php b/src/models/CreditModel.php
index 6ecc27e58..2e33df9f6 100644
--- a/src/models/CreditModel.php
+++ b/src/models/CreditModel.php
@@ -100,7 +100,7 @@ class CreditModel extends Model
         return 0;
     }
     /**
-     * Credits of debits the ad credit balance of a user by a given amount
+     * Credits or debits the ad credit balance of a user by a given amount
      * for the reason provided
      *
      * @param int $user_id  id of user to add credit or debit to credit balance
diff --git a/src/models/GroupModel.php b/src/models/GroupModel.php
index 966a4d891..c9844bb58 100644
--- a/src/models/GroupModel.php
+++ b/src/models/GroupModel.php
@@ -231,7 +231,8 @@ class GroupModel extends Model implements MediaConstants
      * @param string $group_name  the groupname to be added
      * @param int $user_id user identifier of who owns the group
      * @param int $register flag that says what kinds of registration are
-     *      allowed for this group NO_JOIN, REQUEST_JOIN, PUBLIC_JOIN
+     *      allowed for this group NO_JOIN, REQUEST_JOIN, PUBLIC_JOIN,
+     *      or some group fee amount in credits 100, 200, 500, 1000, 2000
      * @param int $member flag that says how members other than the owner can
      *      access this group GROUP_READ, GROUP_READ_COMMENT (can comment
      *      on threads but not start. i.e., a blog), GROUP_READ_WRITE,
@@ -245,9 +246,10 @@ class GroupModel extends Model implements MediaConstants
      *      group
      * @return int id of group added
      */
-    public function addGroup($group_name, $user_id, $register = C\REQUEST_JOIN,
-        $member = C\GROUP_READ, $voting = C\NON_VOTING_GROUP,
-        $post_lifetime = C\FOREVER, $encryption = 0)
+    public function addGroup($group_name, $user_id,
+        $register = C\REQUEST_JOIN, $member = C\GROUP_READ,
+        $voting = C\NON_VOTING_GROUP, $post_lifetime = C\FOREVER,
+        $encryption = 0)
     {
         $db = $this->db;
         $private_db = $this->private_db;
@@ -496,11 +498,11 @@ class GroupModel extends Model implements MediaConstants
         $where .= " UG.GROUP_ID= :group_id".
             " AND  UG.GROUP_ID=G.GROUP_ID AND OWNER_ID = O.USER_ID";
         $sql = "SELECT G.GROUP_ID AS GROUP_ID,
-            G.GROUP_NAME AS GROUP_NAME, G.ENCRYPTION AS ENCRYPTION,
+            G.GROUP_NAME AS GROUP_NAME,
             G.OWNER_ID AS OWNER_ID, O.USER_NAME AS OWNER, REGISTER_TYPE,
             UG.STATUS AS STATUS, G.MEMBER_ACCESS AS MEMBER_ACCESS,
             G.VOTE_ACCESS AS VOTE_ACCESS, G.POST_LIFETIME AS POST_LIFETIME,
-            UG.JOIN_DATE AS JOIN_DATE
+            UG.JOIN_DATE AS JOIN_DATE, G.ENCRYPTION AS ENCRYPTION
             FROM GROUPS G, USERS O, USER_GROUP UG $where " .
             $db->limitOffset(1);
         $result = $db->execute($sql, $params);
diff --git a/src/views/elements/ManagegroupsElement.php b/src/views/elements/ManagegroupsElement.php
index a9c942f60..0c6f5e5df 100755
--- a/src/views/elements/ManagegroupsElement.php
+++ b/src/views/elements/ManagegroupsElement.php
@@ -155,7 +155,8 @@ class ManagegroupsElement extends Element
                 e("<tr>");
                 foreach ($group as $col_name => $group_column) {
                     if (in_array($col_name, $ignore_columns) || (
-                        $_SERVER["MOBILE"] && !in_array($col_name, $mobile_columns))) {
+                        $_SERVER["MOBILE"] && !in_array($col_name,
+                        $mobile_columns))) {
                         continue;
                     }
                     if (in_array($col_name, $mobile_columns)) {
@@ -188,7 +189,7 @@ class ManagegroupsElement extends Element
                                 $data[$choice_array][$group[$col_name]]?>
                                 </span><?php
                         } else {
-                        ?>
+                            ?>
                             <form  method="get">
                             <input type="hidden" name="c" value="admin" />
                             <input type="hidden" name="<?=C\CSRF_TOKEN ?>"
@@ -440,10 +441,10 @@ class ManagegroupsElement extends Element
                         $data["ENCRYPTION_CODES"],
                         $data['CURRENT_GROUP']['encryption']);
                     ?></td>
-                <?php
+                    <?php
                 }
             ?></tr>
-        <?php
+            <?php
         }
         if ($editgroup) {
             ?>
diff --git a/tests/HiTokenizerTest.php b/tests/HiTokenizerTest.php
index 493169e05..0e8722e82 100644
--- a/tests/HiTokenizerTest.php
+++ b/tests/HiTokenizerTest.php
@@ -103,6 +103,8 @@ class HiTokenizerTest extends UnitTest
     public function partsOfSpeechTestCase()
     {
         $tokenizer = $this->test_objects['FILE1'];
-        echo $tokenizer::tagPartsOfSpeechPhrase("महामा गाँधी का जम 2 अक्टूबर को हुआ");
+        //ideally will get work in new version
+        //echo
+        // $tokenizer::tagPartsOfSpeechPhrase("महामा गाँधी का जम 2 अक्टूबर को हुआ");
     }
 }
ViewGit