Skip to content

Commit

Permalink
Merge branch 'feature/new-api-for-recaptcha'
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Aug 26, 2019
2 parents 5b2f9ed + 3849985 commit 245e44d
Show file tree
Hide file tree
Showing 34 changed files with 635 additions and 325 deletions.
6 changes: 3 additions & 3 deletions plugins/calendar/autoinstall.php
Expand Up @@ -8,7 +8,7 @@
// | |
// | This file provides helper functions for the automatic plugin install. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2008-2010 by the following authors: |
// | Copyright (C) 2008-2019 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
Expand Down Expand Up @@ -46,8 +46,8 @@ function plugin_autoinstall_calendar($pi_name)
$info = array(
'pi_name' => $pi_name,
'pi_display_name' => $pi_display_name,
'pi_version' => '1.1.7',
'pi_gl_version' => '2.1.1',
'pi_version' => '1.1.8',
'pi_gl_version' => '2.2.1',
'pi_homepage' => 'https://www.geeklog.net/'
);

Expand Down
7 changes: 4 additions & 3 deletions plugins/calendar/configuration_validation.php
Expand Up @@ -2,13 +2,13 @@

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Calendar |
// | Calendar |
// +---------------------------------------------------------------------------+
// | configuration_validation.php |
// | |
// | List of validation rules for the Links plugin configurations |
// | List of validation rules for the Links plugin configurations |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2007-2010 by the following authors: |
// | Copyright (C) 2007-2019 by the following authors: |
// | |
// | Authors: Akeda Bagus - admin AT gedex DOT web DOT id |
// | Tom Homer - tomhomer AT gmail DOT com |
Expand Down Expand Up @@ -50,6 +50,7 @@
$_CONF_VALIDATE['calendar']['aftersave'] = array(
'rule' => array('inList', array('item', 'list', 'plugin', 'home', 'admin'), true)
);
$_CONF_VALIDATE['calendar']['recaptcha'] = ['rule' => ['inList', ['0', '1', '2'], true]];

// Default Permissions
$_CONF_VALIDATE['calendar']['default_permissions[0]'] = array(
Expand Down
32 changes: 31 additions & 1 deletion plugins/calendar/functions.inc
Expand Up @@ -65,6 +65,7 @@ Language::override(array(
if (!isset($_CA_CONF['calendarloginrequired'])) {
$ca_config = config::get_instance();
$_CA_CONF = $ca_config->get_config('calendar');
$_CA_CONF['recaptcha'] = (int) $_CA_CONF['recaptcha'];
}

// +---------------------------------------------------------------------------+
Expand Down Expand Up @@ -1636,7 +1637,12 @@ function plugin_upgrade_calendar()
case '1.1.6':
$current_version = '1.1.7';
break;


case '1.1.7':
calendar_update_ConfValues_1_1_7();
$current_version = '1.1.8'; // Shipped with Geeklog-2.2.1
break;

default:
$done = true;
break;
Expand Down Expand Up @@ -2354,3 +2360,27 @@ function plugin_getlanguageoverrides_calendar()

return array('LANG_CAL_1', 'LANG_CAL_2', '_LANG_CAL_SEARCH', 'LANG_CAL_MESSAGE', 'PLG_calendar_MESSAGE4');
}

/**
* Return the info asked by PLG_collectRecaptchaInfo().
*
* @return array of type => [
* 'type' => type // required, passed as the 1st parameter to
* plugin_templatesetvars_xxx()
* 'version' => reCAPTCHA version, // required: RECAPTCHA_NO_SUPPORT(0), RECAPTCHA_SUPPORT_V2(1),
* RECAPTCHA_SUPPORT_V2_INVISIBLE(2)
* 'form_id' => form id, // required only for reCAPTCHA V2 Invisible
* ]
*/
function plugin_supportsRecaptcha_calendar()
{
global $_CA_CONF;

return [
[
'type' => 'calendar',
'version' => (isset($_CA_CONF['recaptcha']) ? (int) $_CA_CONF['recaptcha'] : RECAPTCHA_SUPPORT_V2_INVISIBLE),
'form_id' => 'submit_event_form',
],
];
}
6 changes: 6 additions & 0 deletions plugins/calendar/install_defaults.php
Expand Up @@ -91,6 +91,10 @@
*/
$_CA_DEFAULT['aftersave'] = 'list';

// Which reCAPTCHA version the plugin supports (since Geeklog 2.2.1)
// Possible values are: RECAPTCHA_SUPPORT_NONE, RECAPTCHA_SUPPORT_V2, RECAPTCHA_SUPPORT_V2_INVISIBLE
$_CA_DEFAULT['recaptcha'] = RECAPTCHA_SUPPORT_V2;

// Events Block
$_CA_DEFAULT['block_isleft'] = 1;
$_CA_DEFAULT['block_order'] = 50;
Expand Down Expand Up @@ -177,6 +181,8 @@ function plugin_initconfig_calendar()
'select', 0, 0, 0, 100, true, 'calendar', 0);
$c->add('aftersave', $_CA_DEFAULT['aftersave'],
'select', 0, 0, 9, 110, true, 'calendar', 0);
$c->add('recaptcha', $_CA_DEFAULT['recaptcha'],
'select', 0, 0, 16, 120, true, 'calendar', 0);

$c->add('tab_permissions', NULL, 'tab', 0, 1, NULL, 0, true, 'calendar', 1);
$c->add('fs_permissions', NULL, 'fieldset', 0, 1, NULL, 0, true, 'calendar', 1);
Expand Down
11 changes: 11 additions & 0 deletions plugins/calendar/install_updates.php
Expand Up @@ -64,3 +64,14 @@ function calendar_update_ConfValues_1_1_2()

return true;
}

function calendar_update_ConfValues_1_1_7()
{
global $_CONF, $_CA_DEFAULT, $_CA_CONF, $_GROUPS, $_TABLES;

$c = config::get_instance();

require_once $_CONF['path'] . 'plugins/calendar/install_defaults.php';
$c->add('recaptcha', $_CA_DEFAULT['recaptcha'],
'select', 0, 0, 16, 120, true, 'calendar', 0);
}
4 changes: 3 additions & 1 deletion plugins/calendar/language/english.php
Expand Up @@ -211,6 +211,7 @@
'notification' => 'Notification Email?',
'delete_event' => 'Delete Events with Owner?',
'aftersave' => 'After Saving Event',
'recaptcha' => 'reCAPTCHA',
'default_permissions' => 'Event Default Permissions',
'autotag_permissions_event' => '[event: ] Permissions',
'block_enable' => 'Enabled',
Expand Down Expand Up @@ -250,5 +251,6 @@
12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
13 => array('No access' => 0, 'Use' => 2),
14 => array('No access' => 0, 'Read-Only' => 2),
15 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION)
15 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION),
16 => array('Disabled' => RECAPTCHA_NO_SUPPORT, 'reCAPTCHA V2' => RECAPTCHA_SUPPORT_V2, 'reCAPTCHA V2 Invisible' => RECAPTCHA_SUPPORT_V2_INVISIBLE)
);
4 changes: 3 additions & 1 deletion plugins/calendar/language/english_utf-8.php
Expand Up @@ -211,6 +211,7 @@
'notification' => 'Notification Email?',
'delete_event' => 'Delete Events with Owner?',
'aftersave' => 'After Saving Event',
'recaptcha' => 'reCAPTCHA',
'default_permissions' => 'Event Default Permissions',
'autotag_permissions_event' => '[event: ] Permissions',
'block_enable' => 'Enabled',
Expand Down Expand Up @@ -250,5 +251,6 @@
12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
13 => array('No access' => 0, 'Use' => 2),
14 => array('No access' => 0, 'Read-Only' => 2),
15 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION)
15 => array('All' => TOPIC_ALL_OPTION, 'Homepage Only' => TOPIC_HOMEONLY_OPTION, 'Select Topics' => TOPIC_SELECTED_OPTION),
16 => array('Disabled' => RECAPTCHA_NO_SUPPORT, 'reCAPTCHA V2' => RECAPTCHA_SUPPORT_V2, 'reCAPTCHA V2 Invisible' => RECAPTCHA_SUPPORT_V2_INVISIBLE)
);
4 changes: 3 additions & 1 deletion plugins/calendar/language/japanese_utf-8.php
Expand Up @@ -215,6 +215,7 @@
'notification' => 'メールで通知する',
'delete_event' => '所有者の削除と共に削除する',
'aftersave' => 'イベント保存後の画面遷移',
'recaptcha' => 'reCAPTCHA',
'default_permissions' => 'パーミッション',
'autotag_permissions_event' => '[event: ] パーミッション',
'block_enable' => '有効',
Expand Down Expand Up @@ -254,5 +255,6 @@
12 => array('アクセス不可' => 0, '表示' => 2, '表示・編集' => 3),
13 => array('アクセス不可' => 0, '利用する' => 2),
14 => array('アクセス不可' => 0, '表示' => 2),
15 => array('すべて' => 'all', 'ホームページのみ' => 'homeonly', '話題を選択する' => 'selectedtopics')
15 => array('すべて' => TOPIC_ALL_OPTION, 'ホームページのみ' => TOPIC_HOMEONLY_OPTION, '話題を選択する' => TOPIC_SELECTED_OPTION),
16 => array('無効' => RECAPTCHA_NO_SUPPORT, 'reCAPTCHA V2' => RECAPTCHA_SUPPORT_V2, 'reCAPTCHA V2 Invisible' => RECAPTCHA_SUPPORT_V2_INVISIBLE)
);
6 changes: 3 additions & 3 deletions plugins/links/autoinstall.php
Expand Up @@ -2,13 +2,13 @@

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Links Plugin 2.1 |
// | Links Plugin 2.2 |
// +---------------------------------------------------------------------------+
// | autoinstall.php |
// | |
// | This file provides helper functions for the automatic plugin install. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2008-2010 by the following authors: |
// | Copyright (C) 2008-2019 by the following authors: |
// | |
// | Authors: Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
Expand Down Expand Up @@ -52,7 +52,7 @@ function plugin_autoinstall_links($pi_name)
'pi_name' => $pi_name,
'pi_display_name' => $pi_display_name,
'pi_version' => '2.1.7',
'pi_gl_version' => '2.1.1',
'pi_gl_version' => '2.2.1',
'pi_homepage' => 'https://www.geeklog.net/'
);

Expand Down
7 changes: 4 additions & 3 deletions plugins/links/configuration_validation.php
Expand Up @@ -2,13 +2,13 @@

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Links |
// | Links |
// +---------------------------------------------------------------------------+
// | configuration_validation.php |
// | |
// | List of validation rules for the Links plugin configurations |
// | List of validation rules for the Links plugin configurations |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2007-2010 by the following authors: |
// | Copyright (C) 2007-2019 by the following authors: |
// | |
// | Authors: Akeda Bagus - admin AT gedex DOT web DOT id |
// | Tom Homer - tomhomer AT gmail DOT com |
Expand Down Expand Up @@ -41,6 +41,7 @@
$_CONF_VALIDATE['links']['show_top10'] = array('rule' => 'boolean');
$_CONF_VALIDATE['links']['show_category_descriptions'] = array('rule' => 'boolean');
$_CONF_VALIDATE['links']['new_window'] = array('rule' => 'boolean');
$_CONF_VALIDATE['links']['recaptcha'] = ['rule' => ['inList', ['0', '1', '2'], true]];

// Links Admin Settings
$_CONF_VALIDATE['links']['hidenewlinks'] = array('rule' => 'boolean');
Expand Down
27 changes: 27 additions & 0 deletions plugins/links/functions.inc
Expand Up @@ -72,6 +72,7 @@ Language::override(array(
if (!isset($_LI_CONF['linksloginrequired'])) {
$li_config = config::get_instance();
$_LI_CONF = $li_config->get_config('links');
$_LI_CONF['recaptcha'] = (int) $_LI_CONF['recaptcha'];
}


Expand Down Expand Up @@ -818,6 +819,7 @@ function plugin_upgrade_links()
break;

case '2.1.6':
links_update_ConfValues_2_1_6();
$current_version = '2.1.7'; // Shipped with Geeklog-2.2.1
break;

Expand Down Expand Up @@ -1946,3 +1948,28 @@ function plugin_getlanguageoverrides_links()

return array('LANG_LINKS', 'LANG_LINKS_STATS', 'LANG_LINKS_SEARCH', 'LANG_LINKS_SUBMIT', 'PLG_links_MESSAGE1', 'PLG_links_MESSAGE4', 'PLG_links_MESSAGE1');
}

/**
* Return the info asked by PLG_collectRecaptchaInfo().
*
* @return array of type => [
* 'type' => type // required, passed as the 1st parameter to
* plugin_templatesetvars_xxx()
* 'version' => reCAPTCHA version, // required: RECAPTCHA_NO_SUPPORT(0), RECAPTCHA_SUPPORT_V2(1),
* RECAPTCHA_SUPPORT_V2_INVISIBLE(2)
* 'form_id' => form id, // required only for reCAPTCHA V2 Invisible
* ]
*/
function plugin_supportsRecaptcha_links()
{
global $_LI_CONF;

return [
[
'type' => 'links',
'version' => (isset($_LI_CONF['recaptcha']) ? (int) $_LI_CONF['recaptcha'] : RECAPTCHA_SUPPORT_V2),
'form_id' => 'submitlink',
],

];
}
6 changes: 6 additions & 0 deletions plugins/links/install_defaults.php
Expand Up @@ -143,6 +143,10 @@
*/
$_LI_DEFAULT['new_window'] = false;

// Which reCAPTCHA version the plugin supports (since Geeklog 2.2.1)
// Possible values are: RECAPTCHA_SUPPORT_NONE, RECAPTCHA_SUPPORT_V2, RECAPTCHA_SUPPORT_V2_INVISIBLE
$_LI_DEFAULT['recaptcha'] = RECAPTCHA_SUPPORT_V2;

/**
* Links root category id
*/
Expand Down Expand Up @@ -215,6 +219,8 @@ function plugin_initconfig_links()
'select', 0, 0, 1, 50, true, 'links', 0);
$c->add('new_window', $_LI_DEFAULT['new_window'], 'select',
0, 0, 1, 55, true, 'links',0);
$c->add('recaptcha', $_LI_DEFAULT['recaptcha'], 'select',
0, 0, 14, 58, true, 'links',0);

$c->add('tab_admin', NULL, 'tab', 0, 1, NULL, 0, true, 'links', 1);
$c->add('fs_admin', NULL, 'fieldset', 0, 1, NULL, 0, true, 'links', 1);
Expand Down
11 changes: 11 additions & 0 deletions plugins/links/install_updates.php
Expand Up @@ -23,3 +23,14 @@ function links_update_ConfValues_2_1_0()

return true;
}

function links_update_ConfValues_2_1_6()
{
global $_CONF, $_LI_DEFAULT, $_LI_CONF;

$c = config::get_instance();

require_once $_CONF['path'] . 'plugins/links/install_defaults.php';
$c->add('recaptcha', $_LI_DEFAULT['recaptcha'], 'select',
0, 0, 14, 58, true, 'links',0);
}
4 changes: 3 additions & 1 deletion plugins/links/language/english.php
Expand Up @@ -277,6 +277,7 @@
'aftersave' => 'After Saving Link',
'show_category_descriptions' => 'Show Category Description?',
'new_window' => 'Open external links in new window?',
'recaptcha' => 'reCAPTCHA',
'root' => 'ID of Root Category',
'default_permissions' => 'Link Default Permissions',
'category_permissions' => 'Category Default Permissions',
Expand Down Expand Up @@ -309,5 +310,6 @@
1 => array('True' => TRUE, 'False' => FALSE),
9 => array('Forward to Linked Site' => 'item', 'Display Admin List' => 'list', 'Display Public List' => 'plugin', 'Display Home' => 'home', 'Display Admin' => 'admin'),
12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
13 => array('No access' => 0, 'Use' => 2)
13 => array('No access' => 0, 'Use' => 2),
14 => array('Disabled' => RECAPTCHA_NO_SUPPORT, 'reCAPTCHA V2' => RECAPTCHA_SUPPORT_V2, 'reCAPTCHA V2 Invisible' => RECAPTCHA_SUPPORT_V2_INVISIBLE)
);
4 changes: 3 additions & 1 deletion plugins/links/language/english_utf-8.php
Expand Up @@ -277,6 +277,7 @@
'aftersave' => 'After Saving Link',
'show_category_descriptions' => 'Show Category Description?',
'new_window' => 'Open external links in new window?',
'recaptcha' => 'reCAPTCHA',
'root' => 'ID of Root Category',
'default_permissions' => 'Link Default Permissions',
'category_permissions' => 'Category Default Permissions',
Expand Down Expand Up @@ -309,5 +310,6 @@
1 => array('True' => TRUE, 'False' => FALSE),
9 => array('Forward to Linked Site' => 'item', 'Display Admin List' => 'list', 'Display Public List' => 'plugin', 'Display Home' => 'home', 'Display Admin' => 'admin'),
12 => array('No access' => 0, 'Read-Only' => 2, 'Read-Write' => 3),
13 => array('No access' => 0, 'Use' => 2)
13 => array('No access' => 0, 'Use' => 2),
16 => array('Disabled' => RECAPTCHA_NO_SUPPORT, 'reCAPTCHA V2' => RECAPTCHA_SUPPORT_V2, 'reCAPTCHA V2 Invisible' => RECAPTCHA_SUPPORT_V2_INVISIBLE)
);
4 changes: 3 additions & 1 deletion plugins/links/language/japanese_utf-8.php
Expand Up @@ -244,6 +244,7 @@
'aftersave' => 'リンク保存後の画面遷移',
'show_category_descriptions' => 'カテゴリの説明を表示する',
'new_window' => 'リンクを新しいウィンドウで開く',
'recaptcha' => 'reCAPTCHA',
'root' => 'トップカテゴリのID',
'default_permissions' => 'パーミッション',
'category_permissions' => 'パーミッション',
Expand Down Expand Up @@ -276,5 +277,6 @@
1 => array('はい' => true, 'いいえ' => false),
9 => array('ページを表示する' => 'item', 'リストを表示する' => 'list', 'プラグイントップを表示する' => 'plugin', 'ホームを表示する' => 'home', '管理画面トップを表示する' => 'admin'),
12 => array('アクセス不可' => 0, '表示' => 2, '表示・編集' => 3),
13 => array('アクセス不可' => 0, '利用する' => 2)
13 => array('アクセス不可' => 0, '利用する' => 2),
14 => array('無効' => RECAPTCHA_NO_SUPPORT, 'reCAPTCHA V2' => RECAPTCHA_SUPPORT_V2, 'reCAPTCHA V2 Invisible' => RECAPTCHA_SUPPORT_V2_INVISIBLE)
);
9 changes: 5 additions & 4 deletions plugins/recaptcha/README.md
@@ -1,16 +1,16 @@
# Install/Uninstall/Upgrade instruction for the Geeklog reCAPTCHA plugin

* Repository: https://github.com/mystralkk/recaptcha
* Version: 1.2.0
* Version: 1.2.1
* License: GPL v2 or later

## What is reCAPTCHA?

ReCAPTCHA(R) is a free anti-bot service providing powerful CAPTCHA(Completely Automated Public Turing test to tell Computers and Humans Apart). This plugin makes it easy to use reCAPTCHA with Geeklog.
reCAPTCHA(R) is a free anti-bot service providing powerful CAPTCHA(Completely Automated Public Turing test to tell Computers and Humans Apart). This plugin makes it easy to use reCAPTCHA with Geeklog.

## System Requirements

* Geeklog-2.2.0+
* Geeklog-2.2.1+

## INSTALL

Expand Down Expand Up @@ -40,11 +40,12 @@ In the following descriptions

| Version | Date(YYYY-MM-DD) |Description |
|:-------:|-----------------:|------------------------------------------------------------------------------------|
| 1.2.1 | 2019-xx-xx |* Dropped the parts of "Integration with Geeklog" configuration related to plugins. Now, the reCAPTCHA plugin gets information through calling plugin_supportsRecaptcha_xxx. |
| 1.2.0 | 2017-12-02 |* Added support for Invisible reCAPTCHA. |
| 1.1.6 | 2017-11-28 |* Added support for Login Form. |
| | |* Added support for Forget Password Form. |
| | |* Added support for the demo mode introduced in Geeklog 2.2.0. |
| 1.1.5 | 2017-04-12 |* Fixed a bug where reCAPTCHA failed to check for input when $_RECAPTCHA_CONF['logging'] is set to off. |
| 1.1.5 | 2017-04-12 |* Fixed a bug where reCAPTCHA failed to check for input when $_RECAPTCHA_CONF['logging'] is set to off. |
| 1.1.4 | 2017-01-18 |* Small bug fix. |
| 1.1.3 | 2016-08-12 |* Replaced COM_siteHeader and COM_siteFooter with COM_createHTMLDocument. |
| 1.1.2 | 2016-02-20 |* Modified to use reCAPTCHA v1.1.2 library. |
Expand Down

0 comments on commit 245e44d

Please sign in to comment.