From 93033ef1f85a8769dac7c67932079c796c310ef7 Mon Sep 17 00:00:00 2001
From: Parth Patel <parthamrutbhai.patel@sjsu.edu>
Date: Sat, 7 May 2022 18:15:28 -0700
Subject: [PATCH] Fixes Issue 249, Ad Credits Redeem, r=chris

---
 src/configs/Config.php                        |   8 +-
 src/configs/Createdb.php                      |   8 +-
 src/configs/PublicHelpPages.php               | 257 ++++++++---
 src/controllers/components/StoreComponent.php | 201 ++++++++-
 src/data/public_default.db                    | Bin 13889536 -> 13586432 bytes
 src/library/VersionFunctions.php              |   9 +
 src/locale/en_US/configure.ini                |  25 +-
 src/models/CreditModel.php                    |  22 +
 src/models/ProfileModel.php                   |   4 +-
 src/views/elements/ManagecreditsElement.php   | 411 +++++++++++++++---
 src/views/layouts/WebLayout.php               |   5 +-
 11 files changed, 785 insertions(+), 165 deletions(-)

diff --git a/src/configs/Config.php b/src/configs/Config.php
index 665ee224f..15239f756 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -157,7 +157,7 @@ function nsconddefine($constant, $value)
  * Version number for upgrade database function
  * @var int
  */
-nsdefine('DATABASE_VERSION', 71);
+nsdefine('DATABASE_VERSION', 72);
 /**
  * Minimum Version fo Yioop for which keyword ad script
  * still works with this version
@@ -921,10 +921,6 @@ nsconddefine('DOWNLOAD_TIME_INTERVAL', 0.5);
 nsconddefine('SEEN_URLS_BEFORE_UPDATE_SCHEDULER', MEMORY_PROFILE * 95);
 /** maximum number of urls to schedule to a given fetcher in one go */
 nsconddefine('MAX_FETCH_SIZE', MEMORY_PROFILE * 1000);
-/** maximum number of files of url data to prcoess while producing a
-   a fetch batch
-*/
-nsconddefine('MAX_FILES_PROCESS_BATCH', 5);
 /** fetcher must wait at least this long between multi-curl requests */
 nsconddefine('MINIMUM_FETCH_LOOP_TIME', 5);
 /** an idling fetcher sleeps this long between queue_server pings*/
@@ -1222,3 +1218,5 @@ nsconddefine('AD_LOGO','resources/adv-logo.png');
 nsconddefine('SENTENCE_COMPRESSION_ENABLED', false);
 /** The number of rows to be used in bulk insert from Lexicon */
 nsconddefine('NUM_LEX_BULK_INSERTS',100000);
+/** Length of advertisement credits service account id string*/
+nsconddefine('AD_CREDITS_SERVICE_ACCOUNT_LEN', 32);
diff --git a/src/configs/Createdb.php b/src/configs/Createdb.php
index 93d983485..ee7e5d047 100755
--- a/src/configs/Createdb.php
+++ b/src/configs/Createdb.php
@@ -78,7 +78,7 @@ if (!in_array($lower_dbms, ['sqlite', 'sqlite3'])) {
         $db->connect(); // default connection goes to actual DB
     }
     $private_exist = true;
-    if(!$private_db->connect(PRIVATE_DB_HOST, PRIVATE_DB_USER,
+    if (!$private_db->connect(PRIVATE_DB_HOST, PRIVATE_DB_USER,
         PRIVATE_DB_PASSWORD, PRIVATE_DB_NAME)) {
         $private_host = preg_replace("/\;dbname\=\w+/", "", PRIVATE_DB_HOST);
         L\crawlLog('Private database doesn\'t exist yet, trying to create it');
@@ -142,7 +142,7 @@ $sql ="INSERT INTO USERS VALUES (" . ROOT_ID . ", 'admin', 'admin','" .
         ROOT_USERNAME . "',
         'root@dev.null', '".L\crawlCrypt('')."', '".ACTIVE_STATUS.
         "', '".L\crawlCrypt(ROOT_USERNAME . AUTH_KEY . $creation_time).
-        "', '$creation_time', 0, 0)";
+        "', '$creation_time', 0, 0, null)";
 $db->execute($sql);
 // set up personal group for root account
 $creation_time = L\microTimestamp();
@@ -158,7 +158,7 @@ $group_model->addGroup($root_group_name,
 $sql ="INSERT INTO USERS VALUES (".PUBLIC_USER_ID.", 'all', 'all','public',
         'public@dev.null', '".L\crawlCrypt('')."', '".INACTIVE_STATUS.
         "', '".L\crawlCrypt('public' . AUTH_KEY . $creation_time)."',
-        '$creation_time', 0, 0)";
+        '$creation_time', 0, 0, null)";
 $db->execute($sql);
 //default public group with group id 1
 $creation_time = L\microTimestamp();
@@ -1200,4 +1200,4 @@ if (in_array($lower_dbms, ['sqlite','sqlite3'])){
     chmod(CRAWL_DIR . "/data/" . DB_NAME . ".db", 0666);
     chmod(CRAWL_DIR . "/data/" . PRIVATE_DB_NAME . ".db", 0666);
 }
-echo "Create DB succeeded\n";
+echo "Create DB succeeded\n";
\ No newline at end of file
diff --git a/src/configs/PublicHelpPages.php b/src/configs/PublicHelpPages.php
index 9525a8158..7e75125c8 100644
--- a/src/configs/PublicHelpPages.php
+++ b/src/configs/PublicHelpPages.php
@@ -28856,18 +28856,17 @@ page_footer=
 
 sort=aname
 
-END_HEAD_VARS&#039;&#039;الزحف النظام"&#039; يتحكم في كيفية الزحف يحدد ماذا الزحف القادم.
+END_HEAD_VARS"&#039;الزحف النظام"&#039; يتحكم في كيفية الزحف يحدد ماذا الزحف القادم.
 
 &lt;br /&gt;
 
-&#039;&#039;اتساع الأول البحث"&#039; يعني أن Yioop الأولى يزحف بذور المواقع, ، تليها
+"&#039;اتساع الأول البحث"&#039; يعني أن Yioop الأولى يزحف بذور المواقع, ، تليها
 مواقع مرتبطة مباشرة إلى الموقع بذور, ، تليها مباشرة إلى مواقع مرتبطة مباشرة
 البذور المواقع, إلخ.
 
 &lt;br /&gt;
 
-ميزانية المضيف تعني أن Yioop يختار ما يجب الزحف إليه بعد ذلك بناء على النتيجة
-يتضمن عدد الصفحات التي زحف إليها بالفعل من كل مضيف في عناوين URL في قائمة الزحف.
+"صفحة أهمية"&#039; يعطي كل البذور الموقع أولية مبلغ من المال. Yioop ثم يزحف البذور المواقع. معين زحف الصفحة النقدية الانقسامات بين المواقع التي تربط إلى القائم على الرابط جودة و ما إذا كان قد تم الزحف حتى الآن. المواقع الأكثر النقدية هي الزحف القادم واستمرت هذه العملية.
 EOD;
 $help_pages["ar"]["%D8%A7%D9%84%D8%B2%D8%AD%D9%81_%D9%8A%D9%85%D8%B2%D8%AC"] = <<< 'EOD'
 page_type=standard
@@ -34675,14 +34674,13 @@ END_HEAD_VARS"&#039;হামাগুড়ি অর্ডার"&#039; নি
 
 &lt;br /&gt;
 
-&#039;&#039;পানা-প্রথম সার্চ&#039;&#039; মানে যে Yioop প্রথম হামাগুড়ি দেয়, বীজ সাইট, দ্বারা অনুসরণ যারা
+"&#039;পানা-প্রথম সার্চ"&#039; মানে যে Yioop প্রথম হামাগুড়ি দেয়, বীজ সাইট, দ্বারা অনুসরণ যারা
 সাইটের সরাসরি লিঙ্ক বীজ সাইট, দ্বারা অনুসরণ যারা সরাসরি লিঙ্ক সাইট থেকে সরাসরি লিঙ্ক
 থেকে বীজ সাইট,, ইত্যাদি.
 
 &lt;br /&gt;
 
-&#039;&#039;হোস্ট বাজেটিং&#039;&#039; মানে ইওপ একটি স্কোরের উপর ভিত্তি করে পরবর্তী কী ক্রল করতে হবে তা চয়ন করে
-পৃষ্ঠাগুলির সংখ্যা জড়িত যা এটি ইতিমধ্যে ক্রল তালিকার ইউআরএলগুলিতে প্রতিটি হোস্ট থেকে ক্রল করেছে।
+"&#039;পৃষ্ঠা গুরুত্ব"&#039; দেয়, প্রতিটি বীজ সাইটের একটি প্রাথমিক পরিমাণ নগদ টাকা. Yioop তারপর হামাগুড়ি দেয়, বীজ সাইট. একটি প্রদত্ত ক্রল পাতা আছে, তার নগদ splits মধ্যে যে সাইট এটি লিঙ্ক উপর ভিত্তি করে লিঙ্ক গুণমান এবং তা হয়েছে ক্রল এখনো. সাইট সাথে সবচেয়ে টাকা করা হয় ক্রল পরবর্তী এবং এই প্রক্রিয়া অব্যাহত.
 EOD;
 $help_pages["bn"]["%E0%A6%B9%E0%A6%BE%E0%A6%AE%E0%A6%BE%E0%A6%97%E0%A7%81%E0%A6%A1%E0%A6%BC%E0%A6%BF_%E0%A6%A6%E0%A7%8D%E0%A6%B0%E0%A6%AC%E0%A6%A3"] = <<< 'EOD'
 page_type=standard
@@ -38664,18 +38662,18 @@ page_footer=
 
 sort=aname
 
-END_HEAD_VARS&#039;&#039;Kriechen, Um&#039;&#039; steuert, wie das kriechen bestimmt, was zu kriechen weiter.
+END_HEAD_VARS"&#039;Kriechen, Um"&#039; steuert, wie das kriechen bestimmt, was zu kriechen weiter.
 
 &lt;br /&gt;
 
-&#039;&#039;Breadth-first-Search&#039;&#039; bedeutet, dass Yioop ersten durchforstungen der Samen-Seiten, gefolgt von denen
+"&#039;Breadth-first-Search"&#039; bedeutet, dass Yioop ersten durchforstungen der Samen-Seiten, gefolgt von denen
 Websites, die direkt mit den Saatgut-Website,, gefolgt von jenen, die direkt mit Websites direkt verlinkt
 Saat-Seiten, usw.
 
 &lt;br /&gt;
 
-&#039;&#039;Host-Budgetierung&#039;&#039; bedeutet, dass Yioop basierend auf einer Punktzahl auswählt, was als nächstes gecrawlt werden soll
-Einschließlich der Anzahl der Seiten, die bereits von jedem Host gecrawlt wurden, in den URLs in der Liste zum Crawlen. EOD;
+"&#039;Seite Bedeutung"&#039; gibt jedem Samen Website einen ersten Betrag an Bargeld. Yioop dann kriecht der seed-sites. Eine bestimmte Seite gecrawlt hat seine cash-Teilungen zu den Seiten, die es den link, um basierend auf der link-Qualität und ob Sie kroch noch. Die Seiten mit dem meisten Bargeld kroch weiter, und dieser Prozess fortgesetzt wird.
+EOD;
 $help_pages["de"]["Locale_Writing_Mode"] = <<< 'EOD'
 page_type=page_alias
 
@@ -41411,8 +41409,7 @@ to seed sites, etc.
 
 &lt;br /&gt;
 
-&#039;&#039;&#039;Host Budgeting&#039;&#039;&#039; means Yioop chooses what to crawl next based on a score
-involving the number of pages it has already crawled from each host in the urls in the to crawl list.
+&#039;&#039;&#039;Page Importance&#039;&#039;&#039; gives each seed site an initial amount of cash. Yioop then crawls the seed sites. A given crawled page has its cash splits  amongst the sites that it link to based on the link quality and whether it has been crawled yet. The sites with the most cash are crawled next and this process is continued.
 EOD;
 $help_pages["en-US"]["Crawl_Robot_Set-up"] = <<< 'EOD'
 page_type=standard
@@ -42134,6 +42131,40 @@ The &#039;&#039;&#039;Purchase&#039;&#039;&#039; button is used to complete the
 
 Beneath the Purchase form is the list of &#039;&#039;&#039;Ad Credit Transactions&#039;&#039;&#039; that have been made with your account.
 EOD;
+$help_pages["en-US"]["Manage_Details"] = <<< 'EOD'
+alternative_path=
+
+author=
+
+default_sort=aname
+
+description=
+
+page_alias=
+
+page_border=solid-border
+
+page_header=
+
+page_footer=
+
+page_type=standard
+
+robots=
+
+share_expires=-2
+
+title=
+
+toc=true
+
+url_shortener=
+
+END_HEAD_VARS&#039;&#039;&#039;Manage Details&#039;&#039;&#039; form can be used to check if any details required by Stripe are yet pending from your side. Yioop does not store or use any of the information provided by you, all the information is processed by Stripe only.
+&lt;br/&gt;&lt;br/&gt;
+
+&#039;&#039;&#039;Start&#039;&#039;&#039; button will redirect you to Stripe site, where you will be shown the details you have provided and which details are still pending to be provided. When you submit your details you agree to the Stripe Connected Account service agreements. Please read them carefully before submitting the details. Yioop does not have any access to how any of your information been collected or used by the Stripe.
+EOD;
 $help_pages["en-US"]["Manage_Machines"] = <<< 'EOD'
 page_type=standard
 
@@ -42705,6 +42736,55 @@ Other possibilities for the proxy type are: &lt;code&gt;http&lt;/code&gt; (defau
 
 
 
+EOD;
+$help_pages["en-US"]["Purchase_Credits"] = <<< 'EOD'
+alternative_path=
+
+author=
+
+default_sort=aname
+
+description=
+
+page_alias=
+
+page_border=solid-border
+
+page_header=
+
+page_footer=
+
+page_type=standard
+
+robots=
+
+share_expires=-2
+
+title=
+
+toc=true
+
+url_shortener=
+
+END_HEAD_VARS&#039;&#039;&#039;Purchase Ad Credits&#039;&#039;&#039; form can be used to purchase ad credits which can then be spent under &#039;&#039;&#039;Manage Advertisements&#039;&#039;&#039;.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Quantity&#039;&#039;&#039; dropdown specifies the number of credits one wants to purchase at what price.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Card Number&#039;&#039;&#039; field should be filled in with a valid credit card.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;CVC&#039;&#039;&#039; field you should put the three or four digit card verification number for your card.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Expiration&#039;&#039;&#039; dropdown is used to set your cards expiration date.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Purchase&#039;&#039;&#039; button is used to complete the purchase of Ad credit.
+&lt;br/&gt;
+
+Beneath the Purchase form is the list of &#039;&#039;&#039;Ad Credit Transactions&#039;&#039;&#039; that have been made with your account.
 EOD;
 $help_pages["en-US"]["Query_Result_Mappings"] = <<< 'EOD'
 page_type=standard
@@ -42767,6 +42847,55 @@ their password on their own;
 * &#039;&#039;&#039;Email Link Password Recovery&#039;&#039;&#039;, a user can specify their login and get emailed a password change link;
 * &#039;&#039;&#039;Email Link and Check Questions Recovery&#039;&#039;&#039;, a user can specify their login and get emailed a password change link. The password change page requires the user correctly answers previously provided recovery questions.
 EOD;
+$help_pages["en-US"]["Redeem_Credits"] = <<< 'EOD'
+alternative_path=
+
+author=
+
+default_sort=aname
+
+description=
+
+page_alias=
+
+page_border=solid-border
+
+page_header=
+
+page_footer=
+
+page_type=standard
+
+robots=
+
+share_expires=-2
+
+title=
+
+toc=true
+
+url_shortener=
+
+END_HEAD_VARS&#039;&#039;&#039;Redeem Credits&#039;&#039;&#039; form can be used to redeem ad credits back to US dollars. Yioop does not store or even have access to your debit card details.
+&lt;br /&gt;&lt;br/&gt;
+
+The &#039;&#039;&#039;Quantity&#039;&#039;&#039; dropdown specifies the number of credits one wants to redeem at shown price. If you are redeeming the credits for the first time in any given month Stripe deducts $2 along with the certain transaction fees.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Card Number&#039;&#039;&#039; field should be filled in with a valid debit card.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;CVC&#039;&#039;&#039; field you should put the three or four digit card verification number for your card.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Expiration&#039;&#039;&#039; drop down is used to set your cards expiration date.
+&lt;br/&gt;
+
+The &#039;&#039;&#039;Redeem&#039;&#039;&#039; button is used to complete the redeem of Ad credit.
+&lt;br/&gt;
+
+Beneath the Redeem form is the list of &#039;&#039;&#039;Ad Credit Transactions&#039;&#039;&#039; that have been made with your account.
+EOD;
 $help_pages["en-US"]["Repeat_Type"] = <<< 'EOD'
 page_type=standard
 
@@ -46639,14 +46768,13 @@ END_HEAD_VARS"&#039;Rastreo de Pedido", " controla cómo el rastreo determina lo
 
 &lt;br /&gt;
 
-&#039;&#039;Búsqueda en anchura&#039;&#039; significa que Yioop primera rastrea las semillas de los sitios,, seguido por los
+"&#039;Búsqueda en anchura" " significa que Yioop primera rastrea las semillas de los sitios,, seguido por los
 los sitios vinculados directamente a la semilla sitio,, seguido por aquellos directamente vinculados a los sitios vinculados directamente
 las semillas de los sitios,, etc.
 
 &lt;br /&gt;
 
-&#039;&#039;Host Budgeting&#039;&#039;  significa que Yioop elige qué rastrear a continuación en función de una puntuación
-que implica el número de páginas que ya ha rastreado desde cada host en las direcciones URL de la lista para rastrear.
+"Página" de Importancia"&#039; da a cada semilla sitio de una cantidad inicial de dinero en efectivo. Yioop, a continuación, arrastra la semilla sitios. Un determinado rastrea la página tiene su dinero en efectivo se divide entre los sitios que se enlace a basado en la calidad de la conexión y si ha sido rastreada todavía. Los sitios con la mayor cantidad de dinero que se rastrea a siguiente y este proceso es continuo.
 EOD;
 $help_pages["es"]["Rastreo_del_Robot_Set-up"] = <<< 'EOD'
 page_type=standard
@@ -48290,14 +48418,13 @@ END_HEAD_VARS"&#039;خزیدن سفارش"&#039; کنترل چگونه خزید
 
 &lt;br /&gt;
 
-&#039;&#039;Breadth-first Search&#039;&#039; به این معنی است که Yioop اول می خزد دانه های سایت, و پس از آن
+"&#039;Breadth-first Search"&#039; به این معنی است که Yioop اول می خزد دانه های سایت, و پس از آن
 سایت به طور مستقیم مرتبط با بذر سایت, و پس از آن به طور مستقیم مرتبط به سایت به طور مستقیم مرتبط
 به دانه سایت, و غیره.
 
 &lt;br /&gt;
 
-&#039;&#039;بودجه ریزی میزبان&#039;&#039;به معنی Yioop را انتخاب می کند چه چیزی را به خزیدن بعدی بر اساس نمره
-شامل تعداد صفحات آن را در حال حاضر از هر میزبان در آدرس در لیست خزیدن خزیده است.
+""صفحه اهمیت"&#039; به هر بذر سایت اولیه مقدار پول نقد. Yioop سپس می خزد بذر سایت. داده crawled صفحه نقد آن را تجزیه در میان سایت های که در آن لینک بر روی لینک کیفیت و این که آیا آن شده است crawled شده است. این سایت با پول بیشتر هستند crawled بعدی و این روند ادامه داشته است.
 EOD;
 $help_pages["fa"]["%D8%AE%D8%B2%DB%8C%D8%AF%D9%86_%D9%85%D8%AE%D9%84%D9%88%D8%B7"] = <<< 'EOD'
 page_type=standard
@@ -52215,8 +52342,7 @@ de graines de sites,, etc.
 
 &lt;br /&gt;
 
-&#039;&#039;&#039;La budgétisation de l’hôte&#039;&#039;&#039; signifie que Yioop choisit ensuite les éléments à explorer en fonction d’un score
-impliquant le nombre de pages qu’il a déjà explorées à partir de chaque hôte dans les URL de la liste à analyser.
+&#039;&#039;&#039;Page Importance&#039;&#039;&#039; donne &agrave; chaque semence le site d&#039;un montant initial de tr&eacute;sorerie. Yioop puis analyse la graine de sites. Un analys&eacute;es page a sa tr&eacute;sorerie divise entre les sites de liaison en fonction de la qualit&eacute; de la liaison et si elle a &eacute;t&eacute; analys&eacute;e encore. Les sites avec le plus d&#039;argent sont analys&eacute;es suivant et ce processus se poursuit.
 EOD;
 $help_pages["fr-FR"]["Analyse_Des_M%C3%A9langes"] = <<< 'EOD'
 page_type=standard
@@ -57256,14 +57382,13 @@ END_HEAD_VARS"לזחול" פקודה " שולט איך לזחול קובע מה
 
 &lt;br /&gt;
 
-&#039;&#039;רוחב-חיפוש הראשון"&#039; פירושו Yioop הראשונה סורקת את זרעי אתרים, ואחריו האלה.
+"&#039;רוחב-חיפוש הראשון"&#039; פירושו Yioop הראשונה סורקת את זרעי אתרים, ואחריו האלה.
 אתרים מקושרים ישירות זרע האתר, ואחריו אלה מקושרים ישירות באתרים המקושרים ישירות
 זרע אתרים, וכו&#039;.
 
 &lt;br /&gt;
 
-תקצוב מארח פירושו Yioop בוחר מה לזחול הבא בהתבסס על ציון
-כולל את מספר העמודים שהוא כבר סרוק מכל מחשב מארח בכתובת ה- URL
+"&#039;דף חשיבות" נותן כל זרע אתר ראשוני סכום של כסף. Yioop ואז זוחל זרע אתרים. נתון זחל דף המזומנים שלה מתחלק בין אתרים זה קישור מבוסס על הקישור איכות, אם זה היה זחל עדיין. האתרים עם הכי הרבה מזומנים זחל הבא. תהליך זה נמשך.
 EOD;
 $help_pages["he"]["%D7%9C%D7%96%D7%97%D7%95%D7%9C_%D7%A8%D7%95%D7%91%D7%95%D7%98_%D7%94%D7%92%D7%93%D7%A8%D7%AA"] = <<< 'EOD'
 page_type=standard
@@ -60932,14 +61057,13 @@ END_HEAD_VARS"क्रॉल" आदेश&#039; नियंत्रण क
 
 &lt;br /&gt;
 
-&#039&#039;चौड़ाई-पहले खोज&#039&#039; इसका मतलब है कि Yioop पहली क्रॉल बीज साइटों, उन लोगों द्वारा पीछा किया
+"&#039;चौड़ाई-पहले खोज"&#039; इसका मतलब है कि Yioop पहली क्रॉल बीज साइटों, उन लोगों द्वारा पीछा किया
 साइटों के लिए सीधे जुड़ा हुआ बीज साइट, द्वारा पीछा उन लोगों से सीधे जुड़े साइटों के लिए सीधे जुड़ा हुआ है
 बीज के लिए साइटों, आदि ।
 
 &lt;br /&gt;
 
-&#039&#039;होस्ट बजटिंग&#039&#039; का मतलब है कि Yioop चुनता है कि स्कोर के आधार पर आगे क्या क्रॉल करना है
-उन पृष्ठों की संख्या को शामिल करना जो इसे पहले से ही क्रॉल करने के लिए सूची में urls में प्रत्येक होस्ट से क्रॉल कर चुके हैं.
+"&#039;पृष्ठ के महत्व"&#039; देता है प्रत्येक बीज साइट एक प्रारंभिक नकदी की राशि. Yioop तो क्रॉल बीज साइटों. एक दिया पृष्ठ क्रॉल अपने कैश विभाजन के बीच साइटों है कि यह करने के लिए लिंक के आधार पर लिंक की गुणवत्ता और क्या यह किया गया है अभी तक क्रॉल. साइटों के साथ सबसे अधिक नकदी क्रॉल कर रहे हैं और इस प्रक्रिया जारी है.
 EOD;
 $help_pages["hi"]["%E0%A4%95%E0%A5%8D%E0%A4%B0%E0%A5%89%E0%A4%B2_%E0%A4%98%E0%A5%8B%E0%A4%B2%E0%A4%BE_%E0%A4%9C%E0%A4%BE_%E0%A4%B8%E0%A4%95%E0%A4%A4%E0%A4%BE_%E0%A4%B9%E0%A5%88"] = <<< 'EOD'
 page_type=standard
@@ -67366,14 +67490,13 @@ END_HEAD_VARS"&#039;Merangkak Order"&#039; mengontrol bagaimana merangkak menent
 
 &lt;br /&gt;
 
-&#039;&#039;Breadth-first Search&#039;&#039; berarti bahwa Yioop pertama merangkak benih situs, diikuti oleh orang-orang
+"&#039;Breadth-first Search"&#039; berarti bahwa Yioop pertama merangkak benih situs, diikuti oleh orang-orang
 situs ini terkait langsung dengan benih situs, diikuti oleh mereka yang secara langsung terhubung ke situs-situs yang tertaut secara langsung
 untuk benih situs, dll.
 
 &lt;br /&gt;
 
-&#039;&#039;Penganggaran Host&#039;&#039; berarti Yioop memilih apa yang harus dirayapi selanjutnya berdasarkan skor
-melibatkan jumlah halaman yang telah dirayapi dari setiap host di url dalam daftar untuk merangkak.
+"&#039;Halaman Pentingnya"&#039; memberikan masing-masing benih situs awal jumlah uang tunai. Yioop kemudian merangkak benih situs. Yang diberikan merangkak halaman memiliki uang tunai perpecahan di antara situs-situs yang link ke berdasarkan kualitas link dan apakah sudah merangkak belum. Situs dengan sebagian besar uang tunai yang merangkak ke depan dan proses ini terus berlanjut.
 EOD;
 $help_pages["id"]["Monetisasi"] = <<< 'EOD'
 page_type=standard
@@ -72367,14 +72490,13 @@ END_HEAD_VARS""Crawl Ordine"&#039; controlli come la ricerca per indicizzazione
 
 &lt;br /&gt;
 
-&#039;&#039;Di Ricerca Breadth-first&#039;&#039; significa che Yioop prima indicizzazione dei semi di siti,, seguita da quelle
+"&#039;Di Ricerca Breadth-first"&#039; significa che Yioop prima indicizzazione dei semi di siti,, seguita da quelle
 siti direttamente collegati al seme sito,, seguiti da coloro che sono direttamente collegati ai siti direttamente collegati
 di semi di siti,, etc.
 
 &lt;br /&gt;
 
-&#039;&#039;Host Budgeting&#039;&#039; significa che Yioop sceglie cosa eseguire la scansione successiva in base a un punteggio
-che coinvolge il numero di pagine che ha già sottoposto a scansione da ciascun host negli URL nell'elenco da sottoporre a ricerca per indicizzazione.
+"&#039;Pagina Importanza", conferisce a ciascun seme il sito di un importo iniziale di cassa. Yioop quindi esegue la scansione del seme siti. Un dato sottoposto a ricerca per indicizzazione pagina ha la sua cassa divide tra i siti che link basa sul link di qualità e se è stato sottoposto a ricerca per indicizzazione di sicurezza. I siti con la maggior parte in contanti sottoposti a ricerca per indicizzazione avanti e questo processo è continuato.
 EOD;
 $help_pages["it"]["Ricerca_per_indicizzazione_Robot_di_Set-up"] = <<< 'EOD'
 page_type=standard
@@ -73732,14 +73854,13 @@ END_HEAD_VARS"&#039;クロール順"&#039;管理どのように這うように
 
 &lt;br/&gt;
 
-&#039;&#039;幅優先探索&#039;&#039;というYioop初ゆっくり流の種サイト[2][C])で続いてい
+"&#039;幅優先探索""というYioop初ゆっくり流の種サイト[2][C])で続いてい
 サイトに直接リンクの種サイト[2][C])の後に直接リンクサイトに直接リンク
 種子サイト[2][C])。
 
 &lt;br/&gt;
 
-&#039;&#039;ホストの予算編成&#039;&#039;は、Yioop がスコアに基づいて次にクロールするものを選択することを意味します。
-各ホストから既にクロールしたページ数が、クロール先リストの url に含まれます
+"ページの重要性"&#039;各種サイトの初期の現金を持つことになります。 Yioopその後ゆっくり流の種ます。 さら這のページをキャッシュ分割の中でのサイトがリンク元、リンクをクリック品質にかけて潜り込む。 当サイトのキャッシュが這次に、このプロセスを継続します。
 EOD;
 $help_pages["ja"]["%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97%E3%82%92%E5%8F%82%E7%85%A7"] = <<< 'EOD'
 page_type=standard
@@ -78024,14 +78145,13 @@ END_HEAD_VARS"&#039;ಕ್ರಾಲ್ ಸಲುವಾಗಿ"&#039; ನಿಯಂ
 
 &lt;br /&gt;
 
-&#039;&#039;ಅಗಲ-ಮೊದಲ ಹುಡುಕು&#039;&#039; ಅಂದರೆ Yioop ಮೊದಲ ಕ್ರಾಲ್ ಬೀಜಗಳು ಸೈಟ್ಗಳು, ನಂತರ ಆ
+"&#039;ಅಗಲ-ಮೊದಲ ಹುಡುಕು"&#039; ಅಂದರೆ Yioop ಮೊದಲ ಕ್ರಾಲ್ ಬೀಜಗಳು ಸೈಟ್ಗಳು, ನಂತರ ಆ
 ಸೈಟ್ಗಳು ನೇರವಾಗಿ ಲಿಂಕ್ ಬೀಜ ಸೈಟ್, ನಂತರ ಆ ಮೂಲಕ ನೇರವಾಗಿ ಲಿಂಕ್ ಸೈಟ್ಗಳು ನೇರವಾಗಿ ಲಿಂಕ್
 ಬೀಜ ಸೈಟ್ಗಳು, ಇತ್ಯಾದಿ.
 
 &lt;br /&gt;
 
-&#039;&#039;ಹೋಸ್ಟ್ ಬಜೆಟಿಂಗ್&#039;&#039; ಎಂದರೆ ಯಿಯೂಪ್ ಸ್ಕೋರ್ ಆಧಾರದ ಮೇಲೆ ಮುಂದೆ ಏನನ್ನು ತೆವಳಬೇಕೆಂದು ಆಯ್ಕೆ ಮಾಡುತ್ತಾನೆ
-ಅದು ಈಗಾಗಲೇ ಪ್ರತಿ ಹೋಸ್ಟ್ ನಿಂದ ಕ್ರಾಲ್ ಗೆ ಕ್ರಾಲ್ ಪಟ್ಟಿಯಲ್ಲಿರುವ ಯುಆರ್ ಎಲ್ ಗಳಲ್ಲಿ ತೆವಳಿಕೊಂಡು ಬಂದಿರುವ ಪುಟಗಳ ಸಂಖ್ಯೆಯನ್ನು ಒಳಗೊಂಡಿದೆ.
+"&#039;ಪುಟ ಪ್ರಾಮುಖ್ಯತೆಯನ್ನು"&#039; ನೀಡುತ್ತದೆ ಪ್ರತಿ ಬೀಜ ಸೈಟ್ ಒಂದು ಆರಂಭಿಕ ನಗದು ಪ್ರಮಾಣವನ್ನು. Yioop ನಂತರ ಕ್ರಾಲ್ ಬೀಜ ಸೈಟ್ಗಳು. ಒಂದು ನಿರ್ದಿಷ್ಟ ಪುಟ ಕ್ರಾಲ್ ತನ್ನದೇ ನಗದು ಅವಕಾಶವಾಯಿತು ನಡುವೆ ಸೈಟ್ಗಳು ಇದು ಲಿಂಕ್ ಆಧರಿಸಿ ಲಿಂಕ್ ಗುಣಮಟ್ಟದ ಮತ್ತು ಎಂಬುದನ್ನು ಇದು ಬಂದಿದೆ ಕ್ರಾಲ್ ಮಾಡಿಲ್ಲ. ಸೈಟ್ಗಳು ಅತ್ಯಂತ ನಗದು ಇವೆ ಕ್ರಾಲ್ ಮುಂದಿನ ಮತ್ತು ಈ ಪ್ರಕ್ರಿಯೆ ಮುಂದುವರಿಯಿತು.
 EOD;
 $help_pages["kn"]["%E0%B2%95%E0%B3%8D%E0%B2%B0%E0%B2%BE%E0%B2%B2%E0%B3%8D_%E0%B2%B0%E0%B3%8B%E0%B2%AC%E0%B3%8B%E0%B2%9F%E0%B3%8D_%E0%B2%B8%E0%B3%86%E0%B2%9F%E0%B3%8D_%E0%B2%85%E0%B2%AA%E0%B3%8D"] = <<< 'EOD'
 page_type=standard
@@ -83980,14 +84100,14 @@ END_HEAD_VARS"링 순서"&#039;하는 방법을 제어하는 크롤 결정하는
 
 &lt;br/&gt;
 
-&#039;&#039;폭 첫 번째 검색&#039;&#039;는 것을 의미 Yioop 먼저 크롤링 씨앗 사이트,다음으로 이러
+"&#039;폭 첫 번째 검색"&#039;는 것을 의미 Yioop 먼저 크롤링 씨앗 사이트,다음으로 이러
 사이트 바로 연결되어 씨앗이트,다음에는 그게 직접 연결된 사이트를 직접 연결되어
 씨 사이트,등입니다.
 
 &lt;br/&gt;
 
-&#039;&#039;호스트 예산&#039;&#039; 책정은 Yioop이 점수에 따라 다음에 크롤링 할 항목을 선택한다는 것을 의미합니다.
-크롤링 대상 목록의 URL에 있는 각 호스트에서 이미 크롤링된 페이지 수를 포함합니다. EOD;
+"&#039;페이지의 중요성"&#039;각 씨 사이트의 초기 금액을 현금입니다. Yioop 크롤 다음의 씨앗은 곳입니다. 주어진 크롤 페이지는 현금 분할 사이트는 그에 대한 링크를 기반으로 링크는 품질 및되었는지 아직 크롤링. 사이트로 가장 현금 크롤링 다음 이 과정이 계속됩니다.
+EOD;
 $help_pages["ko"]["%ED%81%AC%EB%A1%A4_%ED%98%B8%ED%85%94"] = <<< 'EOD'
 page_type=standard
 
@@ -88080,14 +88200,13 @@ END_HEAD_VARS"&#039;Kruipen Om"&#039; bepaalt hoe de crawlen bepaalt wat te craw
 
 &lt;br /&gt;
 
-&#039;&#039;Breedte-eerst Zoeken&#039;&#039; betekent dat Yioop eerste kruipt de zaden sites,, gevolgd door die
+"&#039;Breedte-eerst Zoeken"&#039; betekent dat Yioop eerste kruipt de zaden sites,, gevolgd door die
 sites die direct gekoppeld aan het zaad site,, gevolgd door degenen die direct gekoppeld zijn aan sites die direct gekoppeld
 om het zaad van sites, enz.
 
 &lt;br /&gt;
 
-&#039;&#039;Host Budgeting&#039;&#039; betekent dat Yioop kiest wat er vervolgens wil crawlen op basis van een score
-met betrekking tot het aantal pagina's dat het al heeft gecrawld van elke host in de url's in de te crawlen lijst.
+"&#039;Pagina Belang"&#039; geeft elk zaad site een eerste bedrag van contant geld. Yioop dan kruipt het zaad sites. Een gegeven kroop pagina heeft zijn geld verdeelt onder de sites die een link om op basis van de koppeling van de kwaliteit en of het is kroop nog. De sites met het meeste geld worden kroop naast en dit proces wordt voortgezet.
 EOD;
 $help_pages["nl"]["Kruipen_Robot_Set-up"] = <<< 'EOD'
 page_type=standard
@@ -91205,16 +91324,15 @@ sort=aname
 
 END_HEAD_VARS"- "Na czworakach "Porządek"&#039; określa, jak czołgać określa, że czołgać się dalej.
 
-&lt;br /&gt;
+&lt;BR /&gt;
 
-&#039;&#039;Szukaj w szerokości&#039;&#039; oznacza, że Yioop najpierw skrada nasiona stron,, a następnie
+""Szukaj w szerokości"&#039; oznacza, że Yioop najpierw skrada nasiona stron,, a następnie
 strony związane bezpośrednio ze strony nasienia,, a następnie bezpośrednio linki do stron, które są bezpośrednio związane
 dla nasion stron, itp.
 
-&lt;br /&gt;
+&lt;BR /&gt;
 
-&#039;&#039;Budżetowanie hosta&#039;&#039; oznacza, że Yioop wybiera, co ma być indeksowane dalej na podstawie wyniku
-obejmujące liczbę stron, które już zindeksował z każdego hosta w adresach URL na liście do indeksowania.
+"Ważność strony" daje każda strona nasion początkowej kwoty środków pieniężnych. Następnie Yioop indeksuje strony nasion. Na tej stronie wkradł się lokuje swoje środki pieniężne na sznurek wśród stron, że odwołanie na podstawie jakości związku i czy będzie indeksowane jeszcze. Strony internetowe z najbardziej gotówką idzie dalej, i proces ten trwa nadal.
 EOD;
 $help_pages["pl"]["Czo%C5%82ga%C4%87_ustawienia_robota_"] = <<< 'EOD'
 page_type=standard
@@ -91241,7 +91359,7 @@ page_footer=
 
 sort=aname
 
-END_HEAD_VARSW &#039;&#039;czołgać konfiguracja robota&#039;&#039; pól służy do stron internetowych, które roi się od informacji o tym, kto je omija.
+END_HEAD_VARSW "&#039;czołgać konfiguracja robota"&#039; pól służy do stron internetowych, które roi się od informacji o tym, kto je omija.
 
 *pole "&#039;obejścia robota nazwą"&#039; jest używany do nagłówka user-agent wysłany na twój robot. Ma on format:&lt;BR&gt;
 &lt;Kod&gt;
@@ -100385,14 +100503,13 @@ END_HEAD_VARS"- "Ползком " Порядок"&#039; определяет, к
 
 &lt;БР /&gt;
 
-&#039;&#039;Поиск в ширину&#039;&#039; означает, что Yioop сначала ползает семена сайты,, затем
+"&#039;Поиск в ширину"&#039; означает, что Yioop сначала ползает семена сайты,, затем
 сайты связаны напрямую с сайта семени,, затем-непосредственно ссылки на сайты, напрямую связанные
 для семян сайты, и т. д.
 
 &lt;БР /&gt;
 
-&#039;&#039;Host Budgeting&#039;&#039; означает, что Yioop выбирает, что сканировать дальше на основе оценки
-включая количество страниц, которые он уже просканировал с каждого хоста в URL-адресах в списке обхода.
+"Важность страницы" дает каждый сайт семян начальной суммы денежных средств. Затем Yioop ползает сайты семян. На данной странице пополз размещает свои денежные средства на шпагат среди сайтов, что ссылка на основе качества связи и будет ли он проиндексирован еще. Сайты с наиболее наличными пополз дальше, и этот процесс продолжается.
 EOD;
 $help_pages["ru"]["%D0%9F%D0%BE%D0%BB%D0%B7%D0%B0%D1%82%D1%8C_%D0%A1%D0%BC%D0%B5%D1%81%D0%B5%D0%B9"] = <<< 'EOD'
 page_type=standard
@@ -103910,14 +104027,13 @@ END_HEAD_VARS"&#039;క్రాల్ ఆర్డర్"&#039; నియంత
 
 &lt;br /&gt;
 
-&#039;&#039;వెడల్పు-మొదటి శోధన&#039;&#039; అని అర్థం. Yioop మొదటి crawls విత్తనాలు సైట్లు, ఆ తరువాత
+"&#039;వెడల్పు-మొదటి శోధన"&#039; అని అర్థం. Yioop మొదటి crawls విత్తనాలు సైట్లు, ఆ తరువాత
 సైట్లు నేరుగా ముడిపడి సీడ్ సైట్, ఆ తరువాత నేరుగా లింక్ సైట్లు నేరుగా లింక్
 విత్తనం సైట్లు, etc.
 
 &lt;br /&gt;
 
-&#039;&#039;హోస్ట్ బడ్జెటింగ్&#039;&#039; అంటే స్కోర్ ఆధారంగా తరువాత క్రాల్ చేయడానికి యియూప్ ఎంచుకుంటుంది
-ఇది ఇప్పటికే క్రాల్ జాబితాలోని URL ల్లో ప్రతి హోస్ట్ నుండి క్రాల్ చేసిన పేజీల సంఖ్యను కలిగి ఉంటుంది.
+"&#039;పేజీ ప్రాముఖ్యత"&#039; ఇస్తుంది. ప్రతి సీడ్ సైట్ ఒక ప్రారంభ amount of cash. Yioop అప్పుడు crawls సీడ్ sites. ఇచ్చిన క్రాల్ పేజీ ఉంది. దాని నగదు విడిపోయి మధ్య సైట్లు ఆ లింక్ ఆధారంగా లింక్ నాణ్యత మరియు whether it has been క్రాల్ ఇంకా. తో సైట్లు చాలా నగదు ఉన్నాయి క్రాల్ తదుపరి మరియు ఈ ప్రక్రియ కొనసాగింది.
 EOD;
 $help_pages["te"]["%E0%B0%95%E0%B1%8D%E0%B0%B0%E0%B0%BE%E0%B0%B2%E0%B1%8D_%E0%B0%AE%E0%B0%BF%E0%B0%B6%E0%B1%8D%E0%B0%B0%E0%B0%AE%E0%B0%BE%E0%B0%B2%E0%B0%A4%E0%B1%8B"] = <<< 'EOD'
 page_type=standard
@@ -108206,18 +108322,17 @@ page_footer=
 
 sort=aname
 
-END_HEAD_VARS&#039;&#039;คลานสั่ง&#039;&#039;ควบคุมได้ยังไงคลานบ่งบอกถึงสิ่งที่ต้องคลานต่อไป
+END_HEAD_VARS"&#039;คลานสั่ง"&#039;ควบคุมได้ยังไงคลานบ่งบอกถึงสิ่งที่ต้องคลานต่อไป
 
 &lt;br/&gt;
 
-&#039;&#039;Breadth-ก่อการค้นหา&#039;&#039;หมายความว่า Yioop ก่อนคลานขึ้นเมล็ดพันธุ์เจอเมื่อไหร่เว็บไซต์,ตามด้วยพวกนั้น
+"&#039;Breadth-ก่อการค้นหา"&#039;หมายความว่า Yioop ก่อนคลานขึ้นเมล็ดพันธุ์เจอเมื่อไหร่เว็บไซต์,ตามด้วยพวกนั้น
 เว็บไซต์โดยตรงที่เชื่อมโยงกัดของดินแดนเวลทั้งเว็บไซต์,ตามด้วยพวกนั้นโดยตรงเกี่ยวข้องกับเว็บไซต์โดยตรงเชื่อมโยง
 เพื่อเมล็ดพันธ์เว็บไซต์,เป็นต้น
 
 &lt;br/&gt;
 
-การจัดทํางบประมาณโฮสต์หมายถึง Yioop เลือกสิ่งที่จะรวบรวมข้อมูลต่อไปตามคะแนน
-เกี่ยวข้องกับจํานวนเพจที่ตระเวนแล้วจากแต่ละโฮสต์ใน URL ในรายการการตระเวนไปยัง
+"&#039;หน้าวามสำคัญ"&#039;ให้กันและเมล็ดพันธ์เว็บไซต์การเริ่มต้นจำนวนมากของเงินสด Yioop งั้นก็คลานขึ้นอร์ดของดินแดนเวลทั้งเว็บไซต์. บอกคงคลานหน้ามีของมันเป็นเงินสดแยกในหมู่ที่เว็บไซต์นั่นมันเชื่อมโยงไปยังพื้นฐานที่เชื่อมโยงคุณภาพและไม่ว่ามันคงคลานเลย ยังเว็บไซต์ที่พบกับสุดยอดเงินคือคลานต่อไปและโพรเซสนี้คือองดำเนินต่อไป
 EOD;
 $help_pages["th"]["%E0%B8%84%E0%B8%A5%E0%B8%B2%E0%B8%99%E0%B8%AB%E0%B8%B8%E0%B9%88%E0%B8%99%E0%B8%A2%E0%B8%99%E0%B8%95%E0%B9%8C%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%88%E0%B8%B1%E0%B8%94%E0%B8%89%E0%B8%B2%E0%B8%81"] = <<< 'EOD'
 page_type=standard
@@ -113472,18 +113587,17 @@ page_footer=
 
 sort=aname
 
-END_HEAD_VARS&#039;&#039;Crawl Order&#039;&#039; mga kontrol sa kung paano ang mga pag-crawl tumutukoy sa kung ano ang upang i-crawl sa susunod.
+END_HEAD_VARS"&#039;Crawl Order"&#039; mga kontrol sa kung paano ang mga pag-crawl tumutukoy sa kung ano ang upang i-crawl sa susunod.
 
 &lt;br /&gt;
 
-&#039;&#039;Luwang-unang Paghahanap&#039;&#039; ay nangangahulugan na Yioop unang-crawl ng mga buto ng mga site, na sinundan sa pamamagitan ng mga
+"&#039;Luwang-unang Paghahanap"&#039; ay nangangahulugan na Yioop unang-crawl ng mga buto ng mga site, na sinundan sa pamamagitan ng mga
 mga site na direktang naka-link sa ang mga binhi site (sa[2][C]) na sinundan sa pamamagitan ng mga direktang naka-link sa mga site na naka-link nang direkta
 sa buto ng mga site, atbp.
 
 &lt;br /&gt;
 
-&#039;&#039;Host Badyet&#039;&#039; ay nangangahulugan na Yioop pumili kung ano ang gumagapang susunod na batay sa isang puntos
-kinasasangkutan ng bilang ng mga pahina na ito ay gumagapang na mula sa bawat host sa mga urls sa listahan ng gumagapang.
+"&#039;Pahina ng Kahalagahan"&#039; ay nagbibigay sa bawat binhi site ng isang paunang halaga ng cash. Yioop pagkatapos ay pag-crawl ang mga binhi ng mga site. Isang naibigay na gumapang ang pahinang ito ay may cash hating sa gitna ng ang mga site na ito link sa batay sa link na kalidad at kung ito ay nai-crawl pa. Ang mga site na may mga pinaka-cash ay crawl sa susunod na at ang proseso ay nagpatuloy.
 EOD;
 $help_pages["tl"]["I-Debug_Ang_Display"] = <<< 'EOD'
 page_type=standard
@@ -124697,18 +124811,17 @@ page_footer=
 
 sort=aname
 
-END_HEAD_VARS&#039;&#039;Thu thập thông tin Để&#039;&#039; điều khiển thế nào thu thập thông tin xác định gì để thu thập thông tin tiếp theo.
+END_HEAD_VARS"&#039;Thu thập thông tin Để"&#039; điều khiển thế nào thu thập thông tin xác định gì để thu thập thông tin tiếp theo.
 
 &lt;br /&gt;
 
-&#039;&#039;Rộng-Tìm kiếm đầu tiên&#039;&#039; có nghĩa là Yioop đầu tiên thu thập các hạt trang web, theo những
+"&#039;Rộng-Tìm kiếm đầu tiên"&#039; có nghĩa là Yioop đầu tiên thu thập các hạt trang web, theo những
 các liên kết trực tiếp với các hạt giống trang web, theo những liên kết trực tiếp với các liên kết trực tiếp
 để hạt giống trang web, etc.
 
 &lt;br /&gt;
 
-&#039;&#039;Host Budgeting&#039;&#039; có nghĩa là Yioop chọn những gì để thu thập dữ liệu tiếp theo dựa trên điểm số
-liên quan đến số lượng trang mà nó đã thu thập dữ liệu từ mỗi máy chủ trong các URL trong danh sách thu thập dữ liệu.
+"&#039;Trang Trọng"&#039; mang đến cho mỗi giống trang web một đầu tiên, lượng tiền. Yioop sau đó bò hạt giống trang web. Một thu thập thông tin trang có tiền mặt của nó chia giữa các trang web mà nó liên kết đến dựa trên sự liên kết chất lượng và cho dù nó đã được thu thập thông tin sơ. Các trang web với hầu hết tiền mặt được thu thập thông tin tiếp theo và quá trình này được tiếp tục.
 EOD;
 $help_pages["vi-VN"]["Trang_Nh%C3%B3m_L%E1%BB%B1a_Ch%E1%BB%8Dn"] = <<< 'EOD'
 page_type=standard
@@ -126360,14 +126473,13 @@ END_HEAD_VARS"&#039;爬行了"&#039;控制如何爬确定什么爬下一步。
 
 &lt;br/&gt;
 
-&#039;&#039;广度优先搜索&#039;&#039;意味着Yioop第一个爬种子网站,随后通过这些
+"&#039;广度优先搜索"&#039;意味着Yioop第一个爬种子网站,随后通过这些
 网站的直接链接到的种子网站,，其次是那些直接关系到网站的直接链接
 种子的网站,等。
 
 &lt;br/&gt;
 
-&#039;&#039;主机预算&#039;&#039;意味着 Yioop 根据分数选择要抓取的下一步内容
-涉及已从要爬网列表中的 URL 中的每个主机爬网的页面数
+"&#039;页的重要性"&#039;给各种网站的一个初始金额的现金。 Yioop然后爬种子网站。 一定爬页面具有其现金拆分之一的网站也链接到根据所链接的质量和是否已经爬呢。 该网站最多的现金是爬下来和这个过程仍在继续。
 EOD;
 $help_pages["zh-CN"]["%E7%88%AC%E6%9C%BA%E5%99%A8%E4%BA%BA%E8%AE%BE%E7%BD%AE"] = <<< 'EOD'
 page_type=standard
@@ -129223,3 +129335,4 @@ sort=aname
 
 END_HEAD_VARS
 EOD;
+
diff --git a/src/controllers/components/StoreComponent.php b/src/controllers/components/StoreComponent.php
index b0886af99..9344785fa 100644
--- a/src/controllers/components/StoreComponent.php
+++ b/src/controllers/components/StoreComponent.php
@@ -30,6 +30,7 @@
  */
 namespace seekquarry\yioop\controllers\components;
 
+use seekquarry\yioop as B;
 use seekquarry\yioop\configs as C;
 use seekquarry\yioop\library as L;
 use seekquarry\yioop\library\UrlParser;
@@ -43,6 +44,8 @@ use seekquarry\yioop\library\UrlParser;
  */
 class StoreComponent extends Component
 {
+    private const AD_CREDITS_REDEEM_FEES = 50;
+    private $PAYMENT_AGENCY_POST_FIELDS;
     /**
      * Used to manage the purchase and storage of advertising credits
      *
@@ -50,6 +53,8 @@ class StoreComponent extends Component
      */
     public function manageCredits()
     {
+        $this->PAYMENT_AGENCY_POST_FIELDS = C\CreditConfig::isActive() ?
+            C\CreditConfig::PAYMENT_AGENCY_POST_FIELDS : [];
         $parent = $this->parent;
         $credit_model = $parent->model("credit");
         $signin_model = $parent->model("signin");
@@ -58,7 +63,7 @@ class StoreComponent extends Component
         $data['SCRIPT'] = "";
         $data['MESSAGE'] = "";
         $data["ELEMENT"] = "managecredits";
-        $data["AMOUNTS"] = [0 => tl('store_component_credit_amounts'),
+        $data["AMOUNTS"] = [0 => tl('store_component_credits_purchase_amount'),
             "10" => tl('store_component_ten_in_credits'),
             "20" => tl('store_component_twenty_in_credits'),
             "50" => tl('store_component_fifty_in_credits'),
@@ -85,10 +90,53 @@ class StoreComponent extends Component
         }
         $arg = (isset($_REQUEST['arg'])) ? $parent->clean($_REQUEST['arg'],
             "string") : "";
-        $num_dollars = (isset($_REQUEST['NUM_DOLLARS']) &&
-            isset($data['COST_AMOUNTS'][$_REQUEST['NUM_DOLLARS']])) ?
-            $_REQUEST['NUM_DOLLARS'] : 0;
         $data['BALANCE'] = $credit_model->getCreditBalance($user_id);
+        $data['REDEEM_ENABLED'] = false;
+        $data['CREDITS_SERVICE_ACC_REQS'] = true;
+        if (isset($data['USER']['AD_CREDITS_SERVICE_ACCOUNT'])) {
+            $response = C\CreditConfig::retrieveAccount(
+                $data['USER']['AD_CREDITS_SERVICE_ACCOUNT']);
+            if (isset($response[$this->PAYMENT_AGENCY_POST_FIELDS['error']])) {
+                $data['REDEEM_ENABLED'] = false;
+            } else {
+                if ($response[$this->PAYMENT_AGENCY_POST_FIELDS['cap']][
+                    $this->PAYMENT_AGENCY_POST_FIELDS['transfer']] ==
+                    $this->PAYMENT_AGENCY_POST_FIELDS['active']) {
+                    $data['REDEEM_ENABLED'] = true;
+                }
+                $data['CREDITS_SERVICE_ACC_REQS'] =
+                    $this->checkCreditServiceAccountReqs($response);
+            }
+            $data['USD_AMOUNT'][0] =
+                tl('store_component_credits_redeem_amount');
+            if ($data['BALANCE'] >= 1000) {
+                $usd = $this->getUSDAmount(1000, $credit_model, $user_id);
+                $data['USD_AMOUNT'][1000] =
+                    tl('store_component_credits_in_usd', 1000, $usd);
+            }
+            if ($data['BALANCE'] >= 2000) {
+                $usd = $this->getUSDAmount(2000, $credit_model, $user_id);
+                $data['USD_AMOUNT'][2000] =
+                    tl('store_component_credits_in_usd', 2000, $usd);
+            }
+            if ($data['BALANCE'] >= 5000) {
+                $usd = $this->getUSDAmount(5000, $credit_model, $user_id);
+                $data['USD_AMOUNT'][5000] =
+                    tl('store_component_credits_in_usd', 5000, $usd);
+            }
+            if ($data['BALANCE'] >= 10000) {
+                $usd = $this->getUSDAmount(10000, $credit_model, $user_id);
+                $data['USD_AMOUNT'][10000] =
+                    tl('store_component_credits_in_usd', 10000, $usd);
+            }
+            if ($data['BALANCE'] >= 500) {
+                $usd = $this->getUSDAmount(
+                    $data['BALANCE'], $credit_model, $user_id);
+                $data['USD_AMOUNT'][$data['BALANCE']] =
+                    tl('store_component_credits_in_usd',
+                    $data['BALANCE'], $usd);
+            }
+        }
         if (C\CreditConfig::isActive() || (($user_id == C\ROOT_ID &&
             C\ALLOW_FREE_ROOT_CREDIT_PURCHASE))) {
             $data["INCLUDE_SCRIPTS"][] = 'credit';
@@ -111,11 +159,14 @@ class StoreComponent extends Component
                     tl('store_component_script_failure');
             }
         }
-        $data['FORM_TYPE'] = 'purchaseCredits';
+        $data['FORM_TYPE'] = 'creditsform';
         switch ($arg)
         {
             case "purchaseCredits":
                 $message = "";
+                $num_dollars = (isset($_REQUEST['NUM_DOLLARS']) &&
+                    isset($data['COST_AMOUNTS'][$_REQUEST['NUM_DOLLARS']])) ?
+                    $_REQUEST['NUM_DOLLARS'] : 0;
                 if ($num_dollars <= 0) {
                     return $parent->redirectWithMessage(
                         tl('store_component_invalid_credit_quantity'),
@@ -127,7 +178,7 @@ class StoreComponent extends Component
                 $strings_to_translate_for_model = [
                     tl('advertisement_buy_credits'),
                     tl('advertisement_init_ledger')];
-                $token = $parent->clean($_REQUEST['CREDIT_TOKEN'], "string");
+                $token = $parent->clean($_REQUEST['CARD_TOKEN'], "string");
                 if (!($user_id == C\ROOT_ID &&
                     C\ALLOW_FREE_ROOT_CREDIT_PURCHASE)) {
                     $is_active = C\CreditConfig::isActive();
@@ -138,7 +189,7 @@ class StoreComponent extends Component
                     }
                     if ($is_active && !C\CreditConfig::charge(
                         $num_dollars, $parent->clean(
-                        $_REQUEST['CREDIT_TOKEN'], "string"), $message)) {
+                        $_REQUEST['CARD_TOKEN'], "string"), $message)) {
                         return $parent->redirectWithMessage(
                             tl('store_component_processing_error',
                                 $message), []);
@@ -151,6 +202,78 @@ class StoreComponent extends Component
                     tl('store_component_credits_purchased'),
                     []);
                 break;
+            case "redeemCredits":
+                if (!C\CreditConfig::isActive()) {
+                    return $parent->redirectWithMessage(
+                        tl('managecredits_element_script_failure'), []);
+                }
+                $credit_amount = $_REQUEST['NUM_CREDITS'];
+                $card_token = $_REQUEST['CARD_TOKEN'];
+                if ($card_token == '') {
+                    return $parent->redirectWithMessage(
+                        tl('store_component_credit_token_empty'));
+                }
+                if ($credit_amount == 0) {
+                    return $parent->redirectWithMessage(
+                        tl('store_component_invalid_redeem_quantity'));
+                }
+                $response = C\CreditConfig::updateAccount(
+                    $data['USER']['AD_CREDITS_SERVICE_ACCOUNT'],
+                    [$this->PAYMENT_AGENCY_POST_FIELDS['ext_acc'] =>
+                        $card_token]);
+                if (isset($response[
+                    $this->PAYMENT_AGENCY_POST_FIELDS['error']])) {
+                    return $parent->redirectWithMessage(
+                        tl('store_component_account_error',
+                        $response[$this->PAYMENT_AGENCY_POST_FIELDS['error']]
+                        [$this->PAYMENT_AGENCY_POST_FIELDS['msg']]));
+                }
+                $cents = $this->getUSDAmount(
+                    $credit_amount, $credit_model, $user_id) * 100;
+                $response = C\CreditConfig::transfer(
+                    $data['USER']['AD_CREDITS_SERVICE_ACCOUNT'],
+                        $cents, $card_token);
+                if (isset($response[
+                    $this->PAYMENT_AGENCY_POST_FIELDS['error']])) {
+                    return $parent->redirectWithMessage(
+                        tl('store_component_account_error',
+                        $response[$this->PAYMENT_AGENCY_POST_FIELDS['error']]
+                        [$this->PAYMENT_AGENCY_POST_FIELDS['msg']]));
+                }
+                $credit_model->updateCredits($user_id,
+                    -1*$credit_amount,
+                    'advertisement_redeem_credits');
+                $data["BALANCE"] = $credit_model->
+                    getCreditBalance($user_id);
+                return $parent->redirectWithMessage(
+                    tl('store_component_credits_redeemed'));
+                break;
+            case "manageCreditsAccount":
+                if (!C\CreditConfig::isActive()) {
+                    return $parent->redirectWithMessage(
+                        tl('managecredits_element_script_failure'), []);
+                }
+                if (!isset($data['USER']['AD_CREDITS_SERVICE_ACCOUNT'])) {
+                    $response = C\CreditConfig::createAccount();
+                    if (isset($response[
+                        $this->PAYMENT_AGENCY_POST_FIELDS['error']])) {
+                        return $parent->redirectWithMessage(
+                            tl('store_component_account_error',
+                            $response[$this->PAYMENT_AGENCY_POST_FIELDS['error']]
+                            [$this->PAYMENT_AGENCY_POST_FIELDS['msg']]));
+                    }
+                    $data['USER']['AD_CREDITS_SERVICE_ACCOUNT']
+                        = $response[$this->PAYMENT_AGENCY_POST_FIELDS['id']];
+                    $update_user_fields = ['USER_ID' =>
+                        $data['USER']['USER_ID'], 'AD_CREDITS_SERVICE_ACCOUNT'
+                        => $data['USER']['AD_CREDITS_SERVICE_ACCOUNT']];
+                    $user_model->updateUser($update_user_fields);
+                }
+                $url = $this->getCreditsServiceAccountUrl(
+                    $data['USER']['AD_CREDITS_SERVICE_ACCOUNT'],
+                    $this->PAYMENT_AGENCY_POST_FIELDS['link_type']);
+                $data['SCRIPT'].="window.location.assign('$url');";
+                break;
             case "search":
                 $data["FORM_TYPE"] = "search";
                 $search_array =
@@ -190,7 +313,7 @@ class StoreComponent extends Component
         $parent->pagingLogic($data, $credit_model, "TRANSACTIONS",
             C\DEFAULT_ADMIN_PAGING_NUM, $search_array, "",
             ["USER_ID" => $user_id]);
-        if ($data['FORM_TYPE'] == 'purchaseCredits') {
+        if ($data['FORM_TYPE'] == 'creditsform') {
             $data['SCRIPT'] .= "setDisplay('admin-form-row', false);";
         }
         return $data;
@@ -541,4 +664,66 @@ class StoreComponent extends Component
     {
         $value = trim($value);
     }
+    /**
+     * Calculate the USD amount equivalent to redeem credits amount based on
+     * last redeem transaction time
+     *
+     * @param int $num_credits redeem credits amount
+     * @param object $credit_model credit model object
+     * @param int $user_id user id
+     * @return float usd amount
+     */
+    public function getUSDAmount($num_credits, $credit_model, $user_id)
+    {
+        $cents = $num_credits - self::AD_CREDITS_REDEEM_FEES;
+        $cents -= (C\CreditConfig::PAYMENT_AGENCY_FIXED_FEES +
+            $cents*C\CreditConfig::PAYMENT_AGENCY_AMOUNT_PERCENT_FEES);
+        $active = $credit_model->isCreditsRedeemCurrentMonth($user_id);
+        if (!$active) {
+            $cents -= 200;
+        }
+        return round($cents/100, 2);
+    }
+    /**
+     * Fetches the payment agency service account link for redirecting user
+     * to payment agency site
+     *
+     * @param string $account_id payment service account id
+     * @param string $type payment agency specific url type
+     * @return string url to the payment agency site
+     */
+    public function getCreditsServiceAccountUrl($account_id, $type)
+    {
+        $return_url = C\CreditConfig::PAYMENT_AGENCY_RETURN_BASE_URL .
+            'admin?YIOOP_TOKEN=' . $_REQUEST['YIOOP_TOKEN'] .
+            '&a=manageCredits';
+        $response = C\CreditConfig::accountLink(
+            $account_id, $type, $return_url, $return_url);
+        if (isset($response[$this->PAYMENT_AGENCY_POST_FIELDS['error']])) {
+            return $parent->redirectWithMessage(
+                tl('store_component_account_error',
+                $response[$this->PAYMENT_AGENCY_POST_FIELDS['error']]
+                [$this->PAYMENT_AGENCY_POST_FIELDS['msg']]));
+        }
+        return $response[$this->PAYMENT_AGENCY_POST_FIELDS['url']];
+    }
+    /**
+     * Checks if the payment service account details are pending other than
+     * card details because it is collect everytime while redeeming credits
+     *
+     * @param array $service_account_info details of payment service account
+     * @param bool wether or not details are pending
+     */
+    public function checkCreditServiceAccountReqs($service_account_info)
+    {
+        $requirements = $service_account_info[
+            $this->PAYMENT_AGENCY_POST_FIELDS['req']][
+            $this->PAYMENT_AGENCY_POST_FIELDS['collect']];
+        foreach ($requirements as $requirement) {
+            if ($requirement != $this->PAYMENT_AGENCY_POST_FIELDS['ext_acc']) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
diff --git a/src/data/public_default.db b/src/data/public_default.db
index 94b3bfeb88e6dfe3b817051670050e5cb34f703d..6434f454e6d249191c25e9a5f27e845a1c58e8dd 100644
GIT binary patch
diff --git a/src/library/VersionFunctions.php b/src/library/VersionFunctions.php
index 83a80730c..42e6c1bd9 100644
--- a/src/library/VersionFunctions.php
+++ b/src/library/VersionFunctions.php
@@ -2010,3 +2010,12 @@ function upgradeDatabaseVersion71(&$db)
             $locale, $translation);
     }
 }
+/**
+ * Upgrades a Version 71 version of the Yioop database to a Version 72 version
+ * @param object $db datasource to use to upgrade
+ */
+function upgradeDatabaseVersion72(&$db)
+{
+    $db->execute("ALTER TABLE USERS ADD COLUMN AD_CREDITS_SERVICE_ACCOUNT
+        VARCHAR(" . C\AD_CREDITS_SERVICE_ACCOUNT_LEN . ")");
+}
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index a0f498ffc..0821e31fb 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -325,13 +325,15 @@ chatbot_component_no_delete_pattern = "Could not find pattern id, pattern not de
 chatbot_component_pattern_deleted = "Pattern Deleted!"
 ;
 ; StoreComponent.php
-store_component_credit_amounts = "Number of Credits to Buy"
+store_component_credits_purchase_amount = "Number of Credits to Buy"
 store_component_ten_in_credits = "1000 credits for $10 US"
 store_component_twenty_in_credits = "2000 credits for $20 US"
 store_component_fifty_in_credits = "5000 credits for $50 US"
 store_component_hundred_in_credits = "10000 credits for $100 US"
 store_component_month = "Month"
 store_component_year = "Year"
+store_component_credits_redeem_amount = "Number of Credits to Redeem"
+store_component_credits_in_usd = "%s credits for $%s US"
 store_component_script_failure = "No Working Credit Card Script Found!"
 store_component_invalid_credit_quantity = "Invalid Credit Purchase Quantity"
 advertisement_buy_credits = "Buy Credits"
@@ -339,6 +341,10 @@ advertisement_init_ledger = "Starting Balance"
 store_component_credit_token_empty = "Error: No Credit Token Received!"
 store_component_processing_error = "Payment Processing Error %s"
 store_component_credits_purchased = "Credit purchase complete!"
+store_component_invalid_redeem_quantity = "Invalid Credit Redeem Quantity"
+store_component_redeem_error = "Error: %s"
+store_component_credits_redeemed = "Credit redeem complete! Money will be credited within 14 business days"
+store_component_account_error = "Error: %s"
 store_component_num_days = "Number of Days"
 store_component_one_day = "1 day"
 store_component_seven_days = "7 days"
@@ -958,17 +964,30 @@ managecredits_element_amount = "Amount"
 managecredits_element_date = "Date"
 managecredits_element_total = "Total"
 managecredits_element_purchase_credits = "Purchase Credits"
+managecredits_element_redeem_credits = "Redeem Credits"
+managecredits_element_manage_details = "Manage Details"
+managecredits_element_purchase = "Purchase"
+managecredits_element_redeem = "Redeem"
+managecredits_element_start = "Start"
+managecredits_element_script_failure = "No Working Credit Card Script Found!"
 managecredit_element_num_credits = "Quantity"
 managecredit_element_card_number = "Credit Card Number"
 managecredit_element_cvc = "CVC"
 managecredit_element_expiration = "Expiration"
 managecredits_element_charge_warning = "Using the Purchase button charges the above card the Quantity field&#039;s amount in US dollars and agrees to the "
 managecredits_element_program_terms = "Program Terms"
-managecredits_element_purchase = "Purchase"
-managecredits_element_script_failure = "No Working Credit Card Script Found!"
+managecredits_element_account_setup = "You are redeeming credits for the first time, go to Manage Details tab."
+managecredits_element_account_incomplete = "You have not provided all the required details to Stripe to make your account eligible for redeeming credits, go to Manage Details tab."
+managecredits_element_insufficient_balance = "You must have atleast 500 credits to redeem"
+managecredit_element_debit_card_number = "Debit Card Number"
+managecredits_element_redeem_warning = "Using the Redeem button credits the above card the Quantity field&#039;s amount in US dollars and agrees to the "
+managecredits_element_credit_service_account = "Yioop uses Stripe services for redeeming credits into real money. Using below Start button will redirect to Stripe and agrees to the Stripe Service Agreements."
+managecredits_element_details_complete = "Currently no additional details are required by Stripe."
+managecredits_element_details_due = "Additional details are required by Stripe. If you do not provide those details to Stripe then you will not be able to redeem credits at a certain point. Using the below Start button will redirect to Stripe and agrees to the Stripe Service Agreements."
 managecredits_element_search = "Search"
 advertisement_init_ledger = "Starting Balance"
 advertisement_buy_credits = "Buy Credits"
+advertisement_redeem_credits = "Redeem Credits"
 advertisement_buy_ad = "Buy Ad"
 social_component_join_group_fee = "Join discussion group fee "
 ;
diff --git a/src/models/CreditModel.php b/src/models/CreditModel.php
index 5c1308a64..bacf83750 100644
--- a/src/models/CreditModel.php
+++ b/src/models/CreditModel.php
@@ -117,4 +117,26 @@ class CreditModel extends Model
         $db->execute($ledger_sql, [$user_id, $amount, $type,
             $balance + $amount, $time]);
     }
+    /**
+     * Checks if the credits are redeemed for the first time during
+     * current month
+     *
+     * @param int $user_id id of the user
+     * @return bool wether or not redeeming credit for the first time
+     *      in current month
+     */
+    public function isCreditsRedeemCurrentMonth($user_id) {
+        $db = $this->db;
+        $sql = "SELECT BALANCE FROM CREDIT_LEDGER WHERE USER_ID=?
+            AND TIMESTAMP BETWEEN ? AND ? AND TYPE = ?";
+        $end_timestamp = time();
+        $start_timestamp = $end_timestamp - date("d") * 24 * 3600;
+        $result = $db->execute($sql,
+            [$user_id, $start_timestamp, $end_timestamp,
+            'advertisement_redeem_credits']);
+        if ($result && $row = $db->fetchArray($result)) {
+            return true;
+        }
+        return false;
+    }
 }
diff --git a/src/models/ProfileModel.php b/src/models/ProfileModel.php
index 780f52ce9..baec6b68c 100755
--- a/src/models/ProfileModel.php
+++ b/src/models/ProfileModel.php
@@ -356,7 +356,9 @@ class ProfileModel extends Model
                 PASSWORD VARCHAR(" . C\LONG_NAME_LEN . "), STATUS $integer,
                 HASH VARCHAR(" . C\LONG_NAME_LEN . "),
                 CREATION_TIME VARCHAR(" . C\MICROSECOND_TIMESTAMP_LEN .
-                "), UPS $integer DEFAULT 0, DOWNS $integer DEFAULT 0)",
+                "), UPS $integer DEFAULT 0, DOWNS $integer DEFAULT 0,
+                AD_CREDITS_SERVICE_ACCOUNT VARCHAR(" .
+                C\AD_CREDITS_SERVICE_ACCOUNT_LEN . "))",
             "USRS_USER_NAME_INDEX" => "CREATE INDEX USRS_USER_NAME_INDEX ON
                 USERS(USER_NAME)",
             "USER_GROUP" => "CREATE TABLE USER_GROUP (USER_ID $integer,
diff --git a/src/views/elements/ManagecreditsElement.php b/src/views/elements/ManagecreditsElement.php
index 8067ff36f..520650fee 100644
--- a/src/views/elements/ManagecreditsElement.php
+++ b/src/views/elements/ManagecreditsElement.php
@@ -55,7 +55,7 @@ class ManagecreditsElement extends Element
             $data['TABLE_TITLE'] = tl('managecredits_element_transactions');
             $data['ACTIVITY'] = 'manageCredits';
             if (empty($data['FORM_TYPE'])) {
-                $data['FORM_TYPE'] = "purchaseCredits";
+                $data['FORM_TYPE'] = "creditsform";
             }
             if (in_array($data['FORM_TYPE'], ['search'])) {
                 $data['DISABLE_ADD_TOGGLE'] = true;
@@ -100,6 +100,96 @@ class ManagecreditsElement extends Element
             ?>
         </table>
         </div>
+        <script>
+        function switchTab(newtab, oldtab, oldtab2)
+        {
+            setDisplay(newtab, true);
+            setDisplay(oldtab, false);
+            setDisplay(oldtab2, false);
+            ntab = elt(newtab + "item");
+            if (ntab) {
+                ntab.className = 'active';
+            }
+            otab = elt(oldtab + "item");
+            if (otab) {
+                otab.className = '';
+            }
+            otab2 = elt(oldtab2 + "item");
+            if (otab2) {
+                otab2.className = '';
+            }
+            if (newtab == 'purchasecreditstab') {
+                elt('page-button').innerHTML =
+                    'Purchase';
+                elt('credits-option').value = 'purchaseCredits';
+                elt('start-button-div').style.display = 'none';
+                elt('page-button-div').style.display = 'block';
+                elt('purchase-card-number').setAttribute('<?=
+                    C\CreditConfig::getAttribute('card-number','name')?>',
+                    '<?=C\CreditConfig::getAttribute('card-number','value')?>');
+                elt('purchase-cvc').setAttribute('<?=
+                    C\CreditConfig::getAttribute('cvc','name')?>',
+                    '<?=C\CreditConfig::getAttribute('cvc','value')?>');
+                elt('purchase-exp-month').setAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-month','name')?>',
+                    '<?=C\CreditConfig::getAttribute('exp-month','value')?>');
+                elt('purchase-exp-year').setAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-year','name')?>',
+                    '<?=C\CreditConfig::getAttribute('exp-year','value')?>');
+                elt('redeem-card-number').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('card-number','name')?>');
+                elt('redeem-cvc').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('cvc','name')?>');
+                elt('redeem-exp-month').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-month','name')?>');
+                elt('redeem-exp-year').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-year','name')?>');
+            } else if (newtab == 'redeemcreditstab') {
+                elt('page-button').innerHTML =
+                    'Redeem';
+                elt('credits-option').value = 'redeemCredits';
+                elt('start-button-div').style.display = 'none';
+                elt('page-button-div').style.display = '<?=
+                    $data['REDEEM_ENABLED'] &&
+                    $data['BALANCE'] >= 500 ? 'block' : 'none' ?>';
+                elt('redeem-card-number').setAttribute('<?=
+                    C\CreditConfig::getAttribute('card-number','name')?>',
+                    '<?=C\CreditConfig::getAttribute('card-number','value')?>');
+                elt('redeem-cvc').setAttribute('<?=
+                    C\CreditConfig::getAttribute('cvc','value')?>',
+                    '<?=C\CreditConfig::getAttribute('cvc','value')?>');
+                elt('redeem-exp-month').setAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-month','name')?>',
+                    '<?=C\CreditConfig::getAttribute('exp-month','value')?>');
+                elt('redeem-exp-year').setAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-year','name')?>',
+                    '<?=C\CreditConfig::getAttribute('exp-year','value')?>');
+                elt('purchase-card-number').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('card-number','name')?>');
+                elt('purchase-cvc').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('cvc','name')?>');
+                elt('purchase-exp-month').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-month','name')?>');
+                elt('purchase-exp-year').removeAttribute('<?=
+                    C\CreditConfig::getAttribute('exp-year','name')?>');
+            } else {
+                elt('start-button').innerHTML =
+                    'Start';
+                elt('credits-option').value = 'manageCreditsAccount';
+                elt('start-button-div').style.display = '<?=
+                    $data['CREDITS_SERVICE_ACC_REQS'] == true ?
+                    'block' : 'none' ?>';
+                elt('page-button-div').style.display = 'none';
+            }
+        }
+        if (typeof yioop_post_scripts !== 'object') {
+            yioop_post_scripts = {};
+        }
+        yioop_post_scripts['page-load'] = function() {
+            switchTab('purchasecreditstab', 'redeemcreditstab',
+                'managedetailstab');
+        }
+        </script>
         <?php
     }
     /**
@@ -110,59 +200,244 @@ class ManagecreditsElement extends Element
      */
     public function renderCreditsForm($data)
     { ?>
+        <form id="creditsform" method="post" enctype="multipart/form-data">
+        <ul class='tab-menu-list'>
+        <li><script>
+            document.write('<a href="javascript:switchTab(' +
+                "'purchasecreditstab', 'redeemcreditstab', 'managedetailstab'"
+                + ');"' + "id='purchasecreditstabitem'>" +
+                '<?= tl('managecredits_element_purchase_credits')?></a>');
+            </script>
+            <noscript>
+            <a href="#purchasecreditstab"
+                id='purchasecreditstabitem'><?=
+                tl('managecredits_element_purchase_credits')?></a>
+            </noscript>
+        </li>
+        <li><script>
+            document.write('<a href="javascript:switchTab(' +
+                "'redeemcreditstab', 'purchasecreditstab', 'managedetailstab'"
+                + ');" ' +"id='redeemcreditstabitem'>" +
+                '<?= tl('managecredits_element_redeem_credits')?></a>');
+            </script>
+            <noscript>
+            <a href="#redeemcreditstab" id='redeemcreditstab'><?=
+                tl('managecredits_element_redeem_credits')?></a>
+            </noscript>
+        </li>
+        <li><script>
+            document.write('<a href="javascript:switchTab(' +
+                "'managedetailstab', 'purchasecreditstab', 'redeemcreditstab'"
+                + ');" ' +"id='managedetailstabitem'>" +
+                '<?= tl('managecredits_element_manage_details')?></a>');
+            </script>
+            <noscript>
+            <a href="#managedetailstab" id='managedetailstab' ><?=
+                tl('managecredits_element_manage_details')?></a>
+            </noscript>
+        </li>
+        </ul>
+        <div class='tab-menu-content'>
+        <input type="hidden" name="c" value="admin" />
+        <input type="hidden" name="<?=C\CSRF_TOKEN ?>" value="<?=
+            $data[C\CSRF_TOKEN] ?>" />
+        <input type="hidden" name="a" value="manageCredits"/>
+        <input type="hidden" id="credits-option" name="arg" value="">
+        <input type="hidden" id="card-token" name="CARD_TOKEN" value="" />
+        <?php
+        $this->renderPurchaseCreditsTab($data) ?>
+        <noscript>
+        <div class="center slight-pad">
+        <button class="button-box" type="submit"><?=
+        tl('managecredits_element_purchase')?></button>
+        </div>
+        </noscript>
+        <?php
+        $this->renderRedeemCreditsTab($data) ?>
+        <noscript>
+        <div class="center slight-pad">
+        <button class="button-box" type="submit"><?=
+        tl('managecredits_element_redeem')?></button>
+        </div>
+        </noscript>
+        <?php
+        $this->renderManageDetailsTab($data) ?>
+        <noscript>
+        <div class="center slight-pad">
+        <button class="button-box" type="submit"><?=
+        tl('managecredits_element_start')?></button>
+        </div>
+        </noscript>
+        <div id='page-button-div' class="center slight-pad">
+            <script>
+            document.write('<button class="button-box" id="page-button" ' +
+                'type="submit">');
+            </script>
+        </div>
+        <div id='start-button-div' class="center slight-pad">
+            <script>
+            document.write('<button class="button-box" id="start-button" ' +
+                'type="submit">');
+            </script>
+        </div>
+        </form>
+        <?php
+        if (C\CreditConfig::isActive()) {
+            $ad_script_found = false;
+            for ($i = C\DATABASE_VERSION; $i >= C\MIN_AD_VERSION;$i--) {
+                $get_submit_purchase_script = "FN" . md5(
+                    UrlParser::getBaseDomain(C\NAME_SERVER) .
+                    $i . "getSubmitPurchaseScript");
+                if (method_exists( C\NS_CONFIGS . "CreditConfig",
+                    $get_submit_purchase_script)) {
+                    $ad_script_found = true;
+                    break;
+                }
+            }
+            if ($ad_script_found) {
+                $data['SCRIPT'] .=
+                    e(C\CreditConfig::$get_submit_purchase_script());
+            } else {
+                e("<br /><span class='red'>".
+                    tl('managecredits_element_script_failure').
+                    "</span>");
+            }
+        }
+    }
+    /**
+    * Draws the form fields required to purchase credits
+    * @param array $data containing field values that have already been
+    * been filled in and the anti-CSRF attack token
+    */
+    public function renderPurchaseCreditsTab($data)
+    { ?>
+        <div id="purchasecreditstab">
         <h2><?= tl('managecredits_element_purchase_credits') ?>
-            <?= $this->view->helper("helpbutton")->render(
-                "Manage Credits", $data[C\CSRF_TOKEN]) ?></h2>
-        <form id="purchase-credits-form" method="post" >
-            <input type="hidden" name="c" value="admin" />
-            <input type="hidden" name="<?=C\CSRF_TOKEN ?>" value="<?=
-                $data[C\CSRF_TOKEN] ?>" />
-            <input type="hidden" name="a" value="manageCredits"/>
-            <input type="hidden" name="arg" value="purchaseCredits" />
-            <input type="hidden" id="credit-token"
-                name="CREDIT_TOKEN" value="" />
+        <?= $this->view->helper("helpbutton")->render(
+            "Purchase Credits", $data[C\CSRF_TOKEN]) ?></h2>
+        <table class='name-table'>
+        <tr><th class="table-label"><label for="num-credits"><?=
+            tl('managecredit_element_num_credits') ?>:
+        </label></th>
+        <td>
+        <?php
+        $this->view->helper('options')->render('num-credits',
+            'NUM_DOLLARS', $data["AMOUNTS"], 0);
+        ?>
+        </td>
+        </tr>
+        <tr><th class="table-label"><label for="purchase-card-number"><?=
+            tl('managecredit_element_card_number') ?>:
+        </label></th>
+        <td>
+        <input class="narrow-field" id="purchase-card-number"
+            type="text" size="20" <?=
+                C\CreditConfig::getAttribute('card-number','name')
+                ?>="<?=
+                C\CreditConfig::getAttribute('card-number','value')
+                ?>" />
+        </td></tr>
+        <tr><th class="table-label"><label for="purchase-cvc"><?=
+            tl('managecredit_element_cvc') ?>:
+        </label></th>
+        <td>
+        <input class="narrow-field" id="purchase-cvc"
+            type="text" size="4" <?=
+                C\CreditConfig::getAttribute('cvc','name')?>="<?=
+                C\CreditConfig::getAttribute('cvc','value') ?>" />
+        </td></tr>
+        <tr><th class="table-label"><label for="purchase-exp-month"><?=
+            tl('managecredit_element_expiration') ?>:
+        </label></th>
+        <td>
+        <?php
+        $this->view->helper('options')->render('purchase-exp-month', '',
+            $data['MONTHS'], 0, false, [
+                C\CreditConfig::getAttribute('exp-month','name') =>
+                C\CreditConfig::getAttribute('exp-month','value')]);
+        ?> / <?php
+        $this->view->helper('options')->render('purchase-exp-year', '',
+            $data['YEARS'], 0, false, [
+                C\CreditConfig::getAttribute('exp-year','name') =>
+                C\CreditConfig::getAttribute('exp-year','value')]);
+        ?>
+        </td></tr>
+        <tr>
+        <td></td>
+        <td><div class="narrow-field green tiny-font"><?=
+        tl('managecredits_element_charge_warning')
+        ?> <a target="_blank" rel="noopener" href="<?=B\wikiUrl(
+            'ad_program_terms') ?>"><?=
+        tl('managecredits_element_program_terms')
+        ?></a>.</div></td>
+        </tr>
+        </table>
+        </div> <?php
+    }
+    /**
+    * Draws the form fields required to redeem credits
+    *
+    * @param array $data containing field values that have already been
+    * been filled in and the anti-CSRF attack token
+    */
+    public function renderRedeemCreditsTab($data)
+    { ?>
+        <div id="redeemcreditstab">
+        <h2><?= tl('managecredits_element_redeem_credits') ?>
+        <?= $this->view->helper("helpbutton")->render(
+            "Redeem Credits", $data[C\CSRF_TOKEN]) ?></h2><?php
+        if (!isset($data['USER']['AD_CREDITS_SERVICE_ACCOUNT'])) { ?>
+            <span class='red'><?=
+                tl('managecredits_element_account_setup') ?></span><?php
+        } else if (!$data['REDEEM_ENABLED']) { ?>
+            <span class='red'><?=
+                tl('managecredits_element_account_incomplete') ?></span><?php
+        } else if ($data['BALANCE'] < 500) { ?>
+            <span class='red'><?=
+                tl('managecredits_element_insufficient_balance') ?></span><?php
+        } else { ?>
+            <input type="hidden"  value="usd"
+            <?= C\CreditConfig::getAttribute('currency','name') ?>
+            ="<?=C\CreditConfig::getAttribute('currency','value') ?>">
             <table class='name-table'>
-            <tr><th class="table-label"><label for="num-credits"><?=
-                tl('managecredit_element_num_credits') ?>:
-            </label></th>
-            <td>
-            <?php
-            $this->view->helper('options')->render('num-credits', 'NUM_DOLLARS',
-                $data["AMOUNTS"], 0);
-            ?>
+            <tr>
+            <th class='table-label'>
+            <label for="credits-amount"><?=
+                tl('managecredit_element_num_credits')?>:</label></th>
+            <td><?php
+            $this->view->helper('options')->render('num-credits',
+                'NUM_CREDITS', $data['USD_AMOUNT'], 0); ?>
             </td>
             </tr>
-            <tr><th class="table-label"><label for="card-number"><?=
-                tl('managecredit_element_card_number') ?>:
+            <tr><th class="table-label"><label for="redeem-card-number"><?=
+                tl('managecredit_element_debit_card_number') ?>:
             </label></th>
             <td>
-            <input class="narrow-field" id="card-number"
+            <input class="narrow-field" id="redeem-card-number"
                 type="text" size="20" <?=
-                    C\CreditConfig::getAttribute('card-number','name')
-                    ?>="<?=
-                    C\CreditConfig::getAttribute('card-number','value')
-                    ?>" />
+                C\CreditConfig::getAttribute('redeem-card-number','name')
+                ?>="<?=
+                C\CreditConfig::getAttribute('card-number','value')
+                ?>" />
             </td></tr>
-            <tr><th class="table-label"><label for="cvc"><?=
-                tl('managecredit_element_cvc') ?>:
-            </label></th>
+            <tr><th class="table-label"><label for="redeem-cvc"><?=
+                tl('managecredit_element_cvc') ?>:</label></th>
             <td>
-            <input class="narrow-field" id="cvc"
+            <input class="narrow-field" id="redeem-cvc"
                 type="text" size="4" <?=
-                    C\CreditConfig::getAttribute('cvc','name')?>="<?=
+                    C\CreditConfig::getAttribute('redeem-cvc','name')?>="<?=
                     C\CreditConfig::getAttribute('cvc','value') ?>" />
             </td></tr>
-            <tr><th class="table-label"><label for="expiration"><?=
-                tl('managecredit_element_expiration') ?>:
-            </label></th>
+            <tr><th class="table-label"><label for="redeem-exp-month"><?=
+                tl('managecredit_element_expiration') ?>:</label></th>
             <td>
             <?php
-            $this->view->helper('options')->render('expiration', '',
+            $this->view->helper('options')->render('redeem-exp-month', '',
                 $data['MONTHS'], 0, false, [
                     C\CreditConfig::getAttribute('exp-month','name') =>
                     C\CreditConfig::getAttribute('exp-month','value')]);
             ?> / <?php
-            $this->view->helper('options')->render('', '',
+            $this->view->helper('options')->render('redeem-exp-year', '',
                 $data['YEARS'], 0, false, [
                     C\CreditConfig::getAttribute('exp-year','name') =>
                     C\CreditConfig::getAttribute('exp-year','value')]);
@@ -171,45 +446,41 @@ class ManagecreditsElement extends Element
             <tr>
             <td></td>
             <td><div class="narrow-field green tiny-font"><?=
-            tl('managecredits_element_charge_warning')
+            tl('managecredits_element_redeem_warning')
             ?> <a target="_blank" rel="noopener" href="<?=B\wikiUrl(
                 'ad_program_terms') ?>"><?=
             tl('managecredits_element_program_terms')
             ?></a>.</div></td>
             </tr>
-            <tr>
-            <td></td>
-            <td class="center">
-            <input class="button-box" id="purchase"
-                name="PURCHASE" value="<?=
-                tl('managecredits_element_purchase')
-                ?>" type="submit" />
-            <?php
-            if (C\CreditConfig::isActive()) {
-                $ad_script_found = false;
-                for ($i = C\DATABASE_VERSION; $i >= C\MIN_AD_VERSION; $i--) {
-                    $get_submit_purchase_script = "FN" . md5(
-                        UrlParser::getBaseDomain(C\NAME_SERVER) .
-                        $i . "getSubmitPurchaseScript");
-                    if (method_exists( C\NS_CONFIGS . "CreditConfig",
-                        $get_submit_purchase_script)) {
-                        $ad_script_found = true;
-                        break;
-                    }
-                }
-                if ($ad_script_found) {
-                    $data['SCRIPT'] .=
-                        e(C\CreditConfig::$get_submit_purchase_script());
-                } else {
-                    e("<br /><span class='red'>".
-                        tl('managecredits_element_script_failure')."</span>");
-                }
-            }
-            ?>
-            </td>
-            </tr>
-            </table>
-        </form><?php
+            </table><?php
+        } ?>
+        </div><?php
+    }
+    /**
+     * Draws the form fields showing the payment agency service account
+     * requirements status
+     *
+     * @param array $data containing field values that have already been
+     * been filled in and the anti-CSRF attack token
+     */
+    public function renderManageDetailsTab($data)
+    { ?>
+        <div id="managedetailstab">
+        <h2><?= tl('managecredits_element_manage_details') ?>
+        <?= $this->view->helper("helpbutton")->render(
+            "Manage Details", $data[C\CSRF_TOKEN]) ?></h2><?php
+        if (!isset($data['USER']['AD_CREDITS_SERVICE_ACCOUNT'])) { ?>
+            <div class="red"><?=
+                tl('managecredits_element_credit_service_account')?></div><?php
+        }
+        else if (!$data['CREDITS_SERVICE_ACC_REQS']) { ?>
+            <div class="green"><?=
+                tl('managecredits_element_details_complete')?></div><?php
+        } else { ?>
+            <div class="red"><?=
+                tl('managecredits_element_details_due')?></div><?php
+        } ?>
+        </div><?php
     }
     /**
      * Draws the search for credit transactions forms
diff --git a/src/views/layouts/WebLayout.php b/src/views/layouts/WebLayout.php
index aaa591db8..1a99fe839 100755
--- a/src/views/layouts/WebLayout.php
+++ b/src/views/layouts/WebLayout.php
@@ -417,9 +417,10 @@ class WebLayout extends Layout
             e($data['SCRIPT']);
         }
         if (isset($data['DISPLAY_MESSAGE'])) {
-            e("\ndoMessage('<h1 class=\"display-message\" >" .
+            /*using double quotes in case message string has single quotes*/
++            e("\ndoMessage(\"<h1 class='display-message' >" .
                 $data['DISPLAY_MESSAGE'] .
-                "</h1>');");
+                "</h1>\");");
         } ?>;/*keep semi-colon just in case inserted JS didn't have */
         if (typeof yioop_post_scripts === 'object' ) {
             for (var callback_index in yioop_post_scripts) {
-- 
2.35.1

