Commit cc65c20c authored by Alan Mels's avatar Alan Mels
Browse files
parent c0321d21
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3,5 +3,6 @@ protected_submissions:
    - Latin
  check_quantity: 50
  reject_message: 'Oops! It looks like your post contains spam content. If you believe otherwise, please contact us. We apologize for the inconvenience.'
  langcode: 'en'
  reject_patterns: "http://, https://, www, ftp://, mailto:, smb://, afp://, file://, gopher://, news://, ssl://, sslv2://, sslv3://, tls://, tcp://, udp://, url=\ndating, sex, porn, fuck, free, win, buy, captcha, spam, hello. and bye., mail.ru, reading this message, are whitelisted, great website, late client, ciao a tutti, viagra, cheap, casino, advertising, keyword, promotion, porntubered,     :, ps: how are you?, beautiful models, privet, beautiful girls"
  log_rejected: 0
+6 −0
Original line number Diff line number Diff line
# /modules/protected_submissions/protected_submissions.config_translation.yml
protected_submissions.admin:
  title: 'Protected submissions'
  base_route_name: protected_submissions.admin
  names:
    - protected_submissions.settings
+4 −0
Original line number Diff line number Diff line
protected_submissions.admin:
  title: 'Protected submissions'
  route_name: protected_submissions.admin
  base_route: protected_submissions.admin
+247 −34
Original line number Diff line number Diff line
@@ -130,17 +130,35 @@ function _protected_submissions_validate($form, &$form_state) {
    }
  }

  // Have to use the Unicode Character Ranges since some languages work with
  // Only some languages work with the method
  // $match = preg_match("/\p{$lang_script}/u", $randomChar); PCRE
  // explained on https://www.php.net/manual/en/regexp.reference.unicode.php
  // as explained on https://www.php.net/manual/en/regexp.reference.unicode.php,
  // so we use the Unicode Character Ranges per http://www.unicode.org/charts/
  $language_scripts = [
    'Adlam' => [
      '1E900 – 1E95F',
    ],
    'Ahom' => [
      '11700 – 1173F',
    ],
    'Anatolian Hieroglyphs' => [
      '14400 – 1467F',
    ],
    'Arabic' => [
      '0600 - 06FF',
      '0750 – 077F',
      '08A0 – 08FF',
      'FB50 - FDFF',
      'FE70 - FEFF',
      '10A80 – 10A9F',
      '10A60 – 10A7F',
    ],
    'Aramaic' => [
      '10840 – 1085F',
    ],
    'Armenian' => [
      '0530 - 058F',
      'FB00 – FB4F',
    ],
    'Avestan' => [
      '10B00 - 10B3F',
@@ -150,11 +168,18 @@ function _protected_submissions_validate($form, &$form_state) {
    ],
    'Bamum' => [
      'A6A0 – A6FF',
      '16800 – 16A3F',
    ],
    'Bassa Vah' => [
      '16AD0 – 16AFF',
    ],
    'Batak' => [
      '1BC0 – 1BFF',
    ],
    'Bengali' => [
    'Bhaiksuki' => [
      '11C00 – 11C6F',
    ],
    'Bengali and Assamese' => [
      '0980 - 09FF',
    ],
    'Bopomofo' => [
@@ -171,11 +196,15 @@ function _protected_submissions_validate($form, &$form_state) {
      '1740 - 175F',
    ],
    'Canadian Aboriginal' => [
      '1400 - 167F',
      '1400 – 167F',
      '18B0 – 18FF',
    ],
    'Carian' => [
      '102A0 – 102DF',
    ],
    'Caucasian Albanian' => [
      '10530 – 1056F',
    ],
    'Chakma' => [
      '11100 – 1114F',
    ],
@@ -184,109 +213,160 @@ function _protected_submissions_validate($form, &$form_state) {
    ],
    'Cherokee' => [
      '13A0 - 13FF',
      'AB70 – ABBF',
    ],
    'Chorasmian' => [
      '10FB0 – 10FDF',
    ],
    'CJK' => [
      '2E80 - 2EFF',
      '2F00 – 2FDF',
      '2FF0 – 2FFF',
      '3000 - 303F',
      '31C0 – 31EF',
      '3200 - 32FF',
      '3300 - 33FF',
      '3400 - 4DBF',
      '4E00 - 9FFF',
      '4E00 - 9FFC',
      'F900 - FAFF',
      'FE30 - FE4F',
      '20000 - 2A6DF',
      '2A700 – 2B73F',
      '2B740 – 2B81F',
      '2B820 – 2CEAF',
      '20000 - 2A6DD',
      '2A700 – 2B734',
      '2B740 – 2B81D',
      '2B820 – 2CEA1',
      '2CEB0 – 2EBE0',
      '2F800 - 2FA1F',
      '30000 – 3134A',
    ],
    'Coptic' => [
      '2C80 – 2CFF',
      '0370 - 03FF',
      '1F00 - 1FFF',
      '102E0  102FF',
    ],
    'Cuneiform' => [
      '12000 – 123FF',
      '12400 – 1247F',
      '12480 – 1254F',
      '103A0 – 103DF',
      '10380 – 1039F',
    ],
    'Cypriot' => [
    'Cypriot Syllabary' => [
      '10800 - 1083F',
    ],
    'Cyrillic' => [
      '0400 - 04FF',
      '0500 - 052F',
      '2DE0 – 2DFF',
      '1C80 – 1C8F',
    ],
    'Currency Symbols' => [
      '20A0 – 20CF',
    ],
    'Deseret' => [
      '10400 - 1044F',
    ],
    'Devanagari' => [
      '0900 - 097F',
      'A8E0 – A8FF',
    ],
    'Dives Akuru' => [
      '11900 – 1195F',
    ],
    'Dogra' => [
      '11800 – 1184F',
    ],
    'Egyptian Hieroglyphs' => [
      '13000 – 1342F',
      '13430 – 1343F',
    ],
    'Elbasan' => [
      '10500 – 1052F',
    ],
    'Elymaic' => [
      '10FE0 – 10FFF',
    ],
    'Ethiopic' => [
      '1200 - 137F',
      '1380 – 139F',
      '2D80 – 2DDF',
      'AB00 – AB2F',
    ],
    'Georgian' => [
      '10A0 - 10FF',
      '1C90 – 1CBF',
      '2D00 – 2D2F',
    ],
    'Glagolitic' => [
      '2C00 – 2C5F',
      '1E000 – 1E02F',
    ],
    'Gothic' => [
      '10330 - 1034F',
    ],
    'Grantha' => [
      '11300 – 1137F',
    ],
    'Greek' => [
      '0370 - 03FF',
      '1F00 - 1FFF',
      '10140 – 1018F',
    ],
    'Gujarati' => [
      '0A80 - 0AFF',
    ],
    'Gunjala Gondi' => [
      '11D60 – 11DAF',
    ],
    'Gurmukhi' => [
      '0A00 - 0A7F',
    ],
    'Hangul' => [
    'Hangul Jamo' => [
      '1100 – 11FF',
      'A960 – A97F',
      'D7B0 – D7FF',
      '3130 – 318F',
      'FF00 – FFEF',
    ],
    'Hangul Syllables' => [
      'AC00 - D7AF',
      '1100 - 11FF',
      '3130 - 318F',
    ],
    'Hanifi Rohingya' => [
      '10D00 – 10D3F',
    ],
    'Hanunoo' => [
      '1720 - 173F',
    ],
    'Hatran' => [
      '108E0 – 108FF'
    ],
    'Hebrew' => [
      '0590 - 05FF',
      'FB00 – FB4F',
    ],
    'Hiragana' => [
      '3040 - 309F',
    ],
    'Imperial Aramaic' => [
      '10840 - 1085F',
    ],
    'Inscriptional Pahlavi' => [
      '10B60 - 10B7F',
    ],
    'Inscriptional Parthian' => [
      '10B40 - 10B5F',
    ],
    'Javanese' => [
      'A980 – A9DF',
    ],
    'Kaithi' => [
      '11080 – 110CF',
    ],
    'Kana' => [
      '1B100 – 1B12F',
      '1B000 – 1B0FF',
      '1B130 – 1B16F',
    ],
    'Kanbun' => [
      '3190 - 319F',
    ],
    'Kangxi' => [
      '2F00 - 2FDF',
    ],
    'Kannada' => [
      '0C80 - 0CFF',
    ],
    'Katakana' => [
      '30A0 - 30FF',
      '31F0 - 31FF',
      '31F0 - 31FF',
      'FF00 – FFEF',
    ],
    'Kayah Li' => [
      'A900 – A92F',
@@ -294,10 +374,19 @@ function _protected_submissions_validate($form, &$form_state) {
    'Kharoshthi' => [
      '10A00 – 10A5F',
    ],
    'Khitan Small Script' => [
      '18B00 – 18CFF',
    ],
    'Khojki' => [
      '11200 – 1124F',
    ],
    'Khmer' => [
      '1780 - 17FF',
      '19E0 - 19FF',
    ],
    'Khudawadi' => [
      '112B0 – 112FF',
    ],
    'Lao' => [
      '0E80 - 0EFF',
    ],
@@ -306,7 +395,15 @@ function _protected_submissions_validate($form, &$form_state) {
      '0080 - 00FF',
      '0100 - 017F',
      '0180 - 024F',
      '2C60 – 2C7F',
      'A720 – A7FF',
      'AB30 – AB6F',
      '1E00 - 1EFF',
      'FB00 – FB4F',
      'FF00 – FFEF',
      '0250 – 02AF',
      '1D00 – 1D7F',
      '1D80 – 1DBF',
    ],
    'Lepcha' => [
      '1C00 – 1C4F',
@@ -316,6 +413,7 @@ function _protected_submissions_validate($form, &$form_state) {
    ],
    'Lisu' => [
      'A4D0 – A4FF',
      '11FB0 – 11FBF',
    ],
    'Lycian' => [
      '10280 – 1029F',
@@ -323,50 +421,107 @@ function _protected_submissions_validate($form, &$form_state) {
    'Lydian' => [
      '10920 – 1093F',
    ],
    'Mahajani' => [
      '11150 – 1117F'
    ],
    'Makasar' => [
      '11EE0 – 11EFF',
    ],
    'Malayalam' => [
      '0D00 - 0D7F',
    ],
    'Mandaic' => [
      '0840 – 085F',
    ],
    'Manichaean' => [
      '10AC0 – 10AFF',
    ],
    'Marchen' => [
      '11C70 – 11CBF',
    ],
    'Masaram Gondi' => [
      '11D00–11D5F',
    ],
    'Medefaidrin' => [
      '16E40 – 16E9F',
    ],
    'Meetei Mayek' => [
      'ABC0 – ABFF',
      'AAE0 – AAFF'
    ],
    'Meroitic Cursive' => [
      '109A0 – 109FF',
    'Mende Kikaku' => [
      '1E800 – 1E8DF',
    ],
    'Meroitic Hieroglyphs' => [
    'Meroitic' => [
      '109A0 – 109FF',
      '10980 – 1099F',
    ],
    'Miao' => [
      '16F00 – 16F9F',
    ],
    'Modi' => [
      '11600 – 1165F',
    ],
    'Modifier Letters' => [
      'A700 – A71F',
      '02B0 – 02FF',
    ],
    'Mongolian' => [
      '1800 - 18AF',
      '11660 – 1167F',
    ],
    'Mro' => [
      '16A40 – 16A6F',
    ],
    'Myanmar' => [
      '1000 - 109F',
      'AA60 – AA7F',
      'A9E0 – A9FF',
    ],
    'Multani' => [
      '11280 – 112AF',
    ],
    'Nabataean' => [
      '10880 – 108AF',
    ],
    'Nandinagari' => [
      '119A0 – 119FF',
    ],
    'New Tai Lue' => [
      '1980 - 19DF',
    ],
    'Newa' => [
      '11400 – 1147F',
    ],
    'Nko' => [
      '07C0 – 07FF',
    ],
    'Nushu' => [
      '1B170 – 1B2FF',
    ],
    'Nyiakeng Puachue Hmong' => [
      '1E100 – 1E14F',
    ],
    'Ogham' => [
      '1680 - 169F',
    ],
    'Ol Chiki' => [
      '1C50 - 1C7F',
    ],
    'Old Hungarian' => [
      '10C80 – 10CFF',
    ],
    'Old Italic' => [
      '10300 – 1032F',
    ],
    'Old Permic' => [
      '10350 – 1037F',
    ],
    'Old Persian' => [
      '103A0 - 103D',
    ],
    'Old South Arabian' => [
      '10A60 - 10A7F',
    'Old Sogdian' => [
      '10F00  10F2F'
    ],
    'Old Turkic' => [
      '10C00 - 10C4F',
@@ -374,9 +529,28 @@ function _protected_submissions_validate($form, &$form_state) {
    'Oriya' => [
      '0B00 - 0B7F',
    ],
    'Osage' => [
      '104B0 – 104FF',
    ],
    'Osmanya' => [
      '10480 - 104AF',
    ],
    'Pahawh Hmong' => [
      '16B00 – 16B8F',
    ],
    'Pahlavi' => [
      '10B60 – 10B7F',
      '10B80 – 10BAF',
    ],
    'Palmyrene' => [
      '10860 – 1087F',
    ],
    'Parthian' => [
      '10B40 - 10B5F',
    ],
    'Pau Cin Hau' => [
      '11AC0 – 11AFF',
    ],
    'Phags Pa' => [
      'A840 - A87F',
    ],
@@ -401,20 +575,35 @@ function _protected_submissions_validate($form, &$form_state) {
    'Shavian' => [
      '10450 - 1047F',
    ],
    'Siddham' => [
      '11580 – 115FF',
    ],
    'Sinhala' => [
      '0D80 - 0DFF',
      '111E0 – 111FF',
    ],
    'Sogdian' => [
      '10F30 – 10F6F'
    ],
    'Sora Sompeng' => [
      '10D0 - 110FF',
      '110D0 - 110FF',
    ],
    'Soyombo' => [
      '11A50 – 11AAF',
    ],
    'Sundanese' => [
      '1B80 – 1BBF',
      '1CC0–1CCF',
    ],
    'Superscripts and Subscripts' => [
      '2070 – 209F',
    ],
    'Syloti Nagri' => [
      'A800 – A82F',
    ],
    'Syriac' => [
      '0700 - 074F',
      '0860 – 086F',
    ],
    'Tagalog' => [
      '1700 - 171F',
@@ -436,6 +625,12 @@ function _protected_submissions_validate($form, &$form_state) {
    ],
    'Tamil' => [
      '0B80 - 0BFF',
      '11FC0 – 11FFF',
    ],
    'Tangut' => [
      '17000 – 187F7',
      '18800 – 18AFF',
      '18D00 – 18D08',
    ],
    'Telugu' => [
      '0C00 - 0C7F',
@@ -452,12 +647,27 @@ function _protected_submissions_validate($form, &$form_state) {
    'Tifinagh' => [
      '2D30 - 2D7F',
    ],
    'Tirhuta' => [
      '11480 – 114DF',
    ],
    'Ugaritic' => [
      '10380 - 1039F',
    ],
    'Vai' => [
      'A500 – A63F',
    ],
    'Vedic Extensions' => [
      '1CD0 – 1CFF',
    ],
    'Wancho' => [
      '1E2C0 – 1E2FF',
    ],
    'Warang Citi' => [
      '118A0 – 118FF'
    ],
    'Yezidi' => [
      '10E80 – 10EBF',
    ],
    'Yi' => [
      'A000 - A48F',
      'A490 - A4CF',
@@ -465,6 +675,9 @@ function _protected_submissions_validate($form, &$form_state) {
    'Yijing' => [
      '4DC0 - 4DFF',
    ],
    'Zanabazar Square' => [
      '11A00 – 11A4F',
    ],
  ];
  ksort($language_scripts);

+63 −10
Original line number Diff line number Diff line
@@ -60,53 +60,72 @@ class ProtectedSubmissionsForm extends ConfigFormBase {
    $config = $this->config('protected_submissions.settings');

    $language_scripts = [
      'Adlam' => 'Adlam',
      'Ahom' => 'Ahom',
      'Anatolian Hieroglyphs' => 'Anatolian Hieroglyphs',
      'Arabic' => 'Arabic',
      'Aramaic' => 'Aramaic',
      'Armenian' => 'Armenian',
      'Avestan' => 'Avestan',
      'Balinese' => 'Balinese',
      'Bamum' => 'Bamum',
      'Bassa Vah' => 'Bassa Vah',
      'Batak' => 'Batak',
      'Bengali' => 'Bengali',
      'Bhaiksuki' => 'Bhaiksuki',
      'Bengali and Assamese' => 'Bengali and Assamese',
      'Bopomofo' => 'Bopomofo',
      'Brahmi' => 'Brahmi',
      'Buginese' => 'Buginese',
      'Buhid' => 'Buhid',
      'Canadian Aboriginal' => 'Canadian Aboriginal',
      'Carian' => 'Carian',
      'Caucasian Albanian' => 'Caucasian Albanian',
      'Chakma' => 'Chakma',
      'Cham' => 'Cham',
      'Cherokee' => 'Cherokee',
      'Chorasmian' => 'Chorasmian',
      'CJK' => 'CJK',
      'Coptic' => 'Coptic',
      'Cuneiform' => 'Cuneiform',
      'Cypriot' => 'Cypriot',
      'Cypriot Syllabary' => 'Cypriot Syllabary',
      'Cyrillic' => 'Cyrillic',
      'Currency Symbols' => 'Currency Symbols',
      'Deseret' => 'Deseret',
      'Devanagari' => 'Devanagari',
      'Diacritical Marks' => 'Diacritical Marks',
      'Dives Akuru' => 'Dives Akuru',
      'Dogra' => 'Dogra',
      'Egyptian Hieroglyphs' => 'Egyptian Hieroglyphs',
      'Elbasan' => 'Elbasan',
      'Elymaic' => 'Elymaic',
      'Ethiopic' => 'Ethiopic',
      'Georgian' => 'Georgian',
      'Glagolitic' => 'Glagolitic',
      'Gothic' => 'Gothic',
      'Grantha' => 'Grantha',
      'Greek' => 'Greek',
      'Gujarati' => 'Gujarati',
      'Gunjala Gondi' => 'Gunjala Gondi',
      'Gurmukhi' => 'Gurmukhi',
      'Hangul' => 'Hangul',
      'Hangul Jamo' => 'Hangul Jamo',
      'Hangul Syllables' => 'Hangul Syllables',
      'Hanifi Rohingya' => 'Hanifi Rohingya',
      'Hanunoo' => 'Hanunoo',
      'Hatran' => 'Hatran',
      'Hebrew' => 'Hebrew',
      'Hiragana' => 'Hiragana',
      'Imperial Aramaic' => 'Imperial Aramaic',
      'Inscriptional Pahlavi' => 'Inscriptional Pahlavi',
      'Inscriptional Parthian' => 'Inscriptional Parthian',
      'Javanese' => 'Javanese',
      'Kaithi' => 'Kaithi',
      'Kana' => 'Kana',
      'Kanbun' => 'Kanbun',
      'Kangxi' => 'Kangxi',
      'Kannada' => 'Kannada',
      'Katakana' => 'Katakana',
      'Kayah Li' => 'Kayah Li',
      'Kharoshthi' => 'Kharoshthi',
      'Khitan Small Script' => 'Khitan Small Script',
      'Khojki' => 'Khojki',
      'Khmer' => 'Khmer',
      'Khudawadi' => 'Khudawadi',
      'Lao' => 'Lao',
      'Latin' => 'Latin',
      'Lepcha' => 'Lepcha',
@@ -114,24 +133,47 @@ class ProtectedSubmissionsForm extends ConfigFormBase {
      'Lisu' => 'Lisu',
      'Lycian' => 'Lycian',
      'Lydian' => 'Lydian',
      'Mahajani' => 'Mahajani',
      'Makasar' => 'Makasar',
      'Malayalam' => 'Malayalam',
      'Mandaic' => 'Mandaic',
      'Manichaean' => 'Manichaean',
      'Marchen' => 'Marchen',
      'Masaram Gondi' => 'Masaram Gondi',
      'Medefaidrin' => 'Medefaidrin',
      'Meetei Mayek' => 'Meetei Mayek',
      'Meroitic Cursive' => 'Meroitic Cursive',
      'Meroitic Hieroglyphs' => 'Meroitic Hieroglyphs',
      'Mende Kikaku' => 'Mende Kikaku',
      'Meroitic' => 'Meroitic',
      'Miao' => 'Miao',
      'Modi' => 'Modi',
      'Modifier Letters' => 'Modifier Letters',
      'Mongolian' => 'Mongolian',
      'Mro' => 'Mro',
      'Myanmar' => 'Myanmar',
      'Multani' => 'Multani',
      'Nabataean' => 'Nabataean',
      'Nandinagari' => 'Nandinagari',
      'New Tai Lue' => 'New Tai Lue',
      'Newa' => 'Newa',
      'Nko' => 'Nko',
      'Nushu' => 'Nushu',
      'Nyiakeng Puachue Hmong' => 'Nyiakeng Puachue Hmong',
      'Ogham' => 'Ogham',
      'Ol Chiki' => 'Ol Chiki',
      'Old Hungarian' => 'Old Hungarian',
      'Old Italic' => 'Old Italic',
      'Old Permic' => 'Old Permic',
      'Old Persian' => 'Old Persian',
      'Old South Arabian' => 'Old South Arabian',
      'Old Sogdian' => 'Old Sogdian',
      'Old Turkic' => 'Old Turkic',
      'Oriya' => 'Oriya' ,
      'Osage' => 'Osage',
      'Osmanya' => 'Osmanya',
      'Pahawh Hmong' => 'Pahawh Hmong',
      'Pahlavi' => 'Pahlavi',
      'Palmyrene' => 'Palmyrene',
      'Parthian' => 'Parthian',
      'Pau Cin Hau' => 'Pau Cin Hau',
      'Phags Pa' => 'Phags Pa',
      'Phoenician' => 'Phoenician',
      'Rejang' => 'Rejang',
@@ -140,9 +182,13 @@ class ProtectedSubmissionsForm extends ConfigFormBase {
      'Saurashtra' => 'Saurashtra',
      'Sharada' => 'Sharada',
      'Shavian' => 'Shavian',
      'Siddham' => 'Siddham',
      'Sinhala' => 'Sinhala',
      'Sogdian' => 'Sogdian',
      'Sora Sompeng' => 'Sora Sompeng',
      'Soyombo' => 'Soyombo',
      'Sundanese' => 'Sundanese',
      'Superscripts and Subscripts' => 'Superscripts and Subscripts',
      'Syloti Nagri' => 'Syloti Nagri',
      'Syriac' => 'Syriac',
      'Tagalog' => 'Tagalog',
@@ -152,15 +198,22 @@ class ProtectedSubmissionsForm extends ConfigFormBase {
      'Tai Viet' => 'Tai Viet',
      'Takri' => 'Takri',
      'Tamil' => 'Tamil',
      'Tangut' => 'Tangut',
      'Telugu' => 'Telugu',
      'Thaana' => 'Thaana',
      'Thai' => 'Thai',
      'Tibetan' => 'Tibetan',
      'Tifinagh' => 'Tifinagh',
      'Tirhuta' => 'Tirhuta',
      'Ugaritic' => 'Ugaritic',
      'Vai' => 'Vai',
      'Vedic Extensions' => 'Vedic Extensions',
      'Wancho' => 'Wancho',
      'Warang Citi' => 'Warang Citi',
      'Yezidi' => 'Yezidi',
      'Yi' => 'Yi' ,
      'Yijing' => 'Yijing',
      'Zanabazar Square' => 'Zanabazar Square',
    ];

    $form['allowed_scripts'] = [