Plugin Directory

Changeset 2015726


Ignore:
Timestamp:
01/20/2019 11:57:16 AM (7 years ago)
Author:
pstimpel
Message:

V1.2.0 - better sanitizing of input values - reported by info@… at 2019-01-19

Location:
ps-phpcaptcha/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • ps-phpcaptcha/trunk/README.txt

    r1988982 r2015726  
    5353== Changelog ==
    5454
     55= 1.2.0 =
     56* better sanitizing of input values - reported by info@metamorfosec.com at 2019-01-19
     57
    5558= 1.1.0 =
    5659* added multisite support
  • ps-phpcaptcha/trunk/admin/class-psphpcaptchawp-admin.php

    r1979572 r2015726  
    9696    }
    9797   
     98    public static $MinStringLength = 2;
     99    public static $MaxStringLength = 50;
     100   
     101    public static $MinSizeWidth = 10;
     102    public static $MaxSizeWidth = 1000;
     103   
     104    public static $MinSizeHeight = 5;
     105    public static $MaxSizeHeight = 500;
     106   
     107    public static $MinFontSize = 5;
     108    public static $MaxFontSize = 500;
     109   
     110    public static $MinNumberOfLines = 0;
     111    public static $MaxNumberOfLines = 100;
     112   
     113    public static $MinThicknessOfLines = 0;
     114    public static $MaxThicknessOfLines = 20;
     115   
     116    public static $MinCharsToUse = 10;
     117    public static $MaxCharsToUse = 100;
     118
    98119    public static function getBlogId() {
    99120        if(is_multisite()) {
     
    250271    }
    251272   
    252     private function sanitize_integer($valid, $input, $setting_title, $setting_errorid) {
     273    private function sanitize_integer($valid, $input, $setting_title, $setting_errorid, $minRequiredSize,
     274        $maxAllowedSize) {
    253275        $validreturn = (isset($input) && !empty($input))
    254276            ? sanitize_text_field($input) : $valid;
     
    257279                $setting_title,                     // Setting title
    258280                $setting_errorid,            // Error ID
    259                 sprintf(__('Please enter a valid integer value for %s','psphpcaptchawp'), $setting_title),     // Error
     281                sprintf(__('Please enter a valid integer value for %s, from %d to %d','psphpcaptchawp'),
     282                    $setting_title, $minRequiredSize, $maxAllowedSize),         //Error
    260283                // message
    261284                'error'                         // Type of message
     
    263286            return $valid;
    264287        }
     288        if($validreturn > $maxAllowedSize || $validreturn < $minRequiredSize) {
     289            add_settings_error(
     290                $setting_title,                     // Setting title
     291                $setting_errorid,            // Error ID
     292                sprintf(__('Please enter a valid integer value for %s, from %d to %d','psphpcaptchawp'),
     293                    $setting_title, $minRequiredSize, $maxAllowedSize),         //Error
     294                // message
     295                'error'                         // Type of message
     296            );
     297            return $valid;
     298        }
    265299        return $validreturn;
    266300    }
    267301   
    268     private function sanitize_charstouse($valid, $input, $setting_title, $setting_errorid, $minlength, $sourceIfForm) {
     302    private function sanitize_charstouse($valid, $input, $setting_title, $setting_errorid, $minlength, $maxlength,
     303        $sourceIfForm) {
    269304        if($sourceIfForm) {
    270             if(strlen($input) < $minlength) {
     305            if(strlen($input) < $minlength || strlen($input) > $maxlength) {
    271306                add_settings_error(
    272307                    $setting_title,                     // Setting title
    273308                    $setting_errorid,            // Error ID
    274                     sprintf(__('Please enter a valid value for %s, at least %d chars long', 'psphpcaptchawp')
    275                         , $setting_title, $minlength), // Error message
     309                    sprintf(__('Please enter a valid value for %s, from %d to %d chars long', 'psphpcaptchawp')
     310                        , $setting_title, $minlength, $maxlength), // Error message
    276311                    'error'                         // Type of message
    277312                );
     
    282317                    $setting_title,                     // Setting title
    283318                    $setting_errorid,            // Error ID
    284                     sprintf(__('Please enter a valid value for %s, at least %d chars long', 'psphpcaptchawp')
    285                         , $setting_title, $minlength), // Error message
     319                    sprintf(__('Please enter a valid value for %s, from %d to %d chars long', 'psphpcaptchawp')
     320                        , $setting_title, $minlength, $maxlength), // Error message
    286321                    'error'                         // Type of message
    287322                );
     
    328363   
    329364        $valid['stringlength'] = $this->sanitize_integer($valid['stringlength'], $input['stringlength'],
    330             __('Number of characters','psphpcaptchawp') , 'stringlength');
     365            __('Number of characters','psphpcaptchawp') , 'stringlength',
     366            Psphpcaptchawp_Admin::$MinStringLength, Psphpcaptchawp_Admin::$MaxStringLength);
    331367       
    332368        $valid['charstouse'] = $this->sanitize_charstouse($valid['charstouse'], $input['charstouse'],
    333             __('Characters allowed','psphpcaptchawp'), 'charstouse', 10, $sourceIsForm );
     369            __('Characters allowed','psphpcaptchawp'), 'charstouse', Psphpcaptchawp_Admin::$MinCharsToUse,
     370            Psphpcaptchawp_Admin::$MaxCharsToUse,
     371            $sourceIsForm );
    334372
    335373        $valid['strictlowercase'] = $this->sanitize_boolean($valid['strictlowercase'], $input['strictlowercase'],
     
    349387
    350388        $valid['sizewidth'] = $this->sanitize_integer($valid['sizewidth'], $input['sizewidth'],
    351             __('Image width','psphpcaptchawp'), 'sizewidth');
     389            __('Image width','psphpcaptchawp'), 'sizewidth', Psphpcaptchawp_Admin::$MinSizeWidth,
     390            Psphpcaptchawp_Admin::$MaxSizeWidth);
    352391       
    353392        $valid['sizeheight'] = $this->sanitize_integer($valid['sizeheight'], $input['sizeheight'],
    354             __('Image height','psphpcaptchawp'), 'sizeheight');
     393            __('Image height','psphpcaptchawp'), 'sizeheight', Psphpcaptchawp_Admin::$MinSizeHeight,
     394            Psphpcaptchawp_Admin::$MaxSizeHeight);
    355395       
    356396        $valid['fontsize'] = $this->sanitize_integer($valid['fontsize'], $input['fontsize'],
    357             __('Font size','psphpcaptchawp'), 'fontsize');
     397            __('Font size','psphpcaptchawp'), 'fontsize', Psphpcaptchawp_Admin::$MinFontSize,
     398            Psphpcaptchawp_Admin::$MaxFontSize);
    358399       
    359400        $valid['numberoflines'] = $this->sanitize_integer($valid['numberoflines'], $input['numberoflines'],
    360             __('Number of lines','psphpcaptchawp'), 'numberoflines');
     401            __('Number of lines','psphpcaptchawp'), 'numberoflines', Psphpcaptchawp_Admin::$MinNumberOfLines,
     402            Psphpcaptchawp_Admin::$MaxNumberOfLines);
    361403       
    362404        $valid['thicknessoflines'] = $this->sanitize_integer($valid['thicknessoflines'], $input['thicknessoflines'],
    363             __('Thickness of lines','psphpcaptchawp'), 'thicknessoflines');
     405            __('Thickness of lines','psphpcaptchawp'), 'thicknessoflines',
     406            Psphpcaptchawp_Admin::$MinThicknessOfLines, Psphpcaptchawp_Admin::$MaxThicknessOfLines);
    364407           
    365408        $valid['allowad'] = $this->sanitize_integer($valid['allowad'], $input['allowad'],
    366             __('Allow small advertisement below Captcha image','psphpcaptchawp'), 'allowad');
     409            __('Allow small advertisement below Captcha image','psphpcaptchawp'), 'allowad',0,1);
    367410
    368411        //write setting into file for db-less access
  • ps-phpcaptcha/trunk/languages/psphpcaptchawp-de_DE.po

    r1979642 r2015726  
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/psphpcaptchawp\n"
    77"POT-Creation-Date: 2018-11-23 15:16:27+00:00\n"
    8 "PO-Revision-Date: 2018-11-23 16:18+0100\n"
     8"PO-Revision-Date: 2019-01-20 12:24+0100\n"
    99"Last-Translator: \n"
    1010"Language-Team: \n"
     
    2929
    3030#: admin/class-psphpcaptchawp-admin.php:259
    31 msgid "Please enter a valid integer value for %s"
    32 msgstr "Bitte Ganzzahlwert eingeben für %s"
     31msgid "Please enter a valid integer value for %s, from %d to %d"
     32msgstr "Bitte Ganzzahlwert eingeben für %s, von %d bis %d"
    3333
    3434#: admin/class-psphpcaptchawp-admin.php:274
    3535#: admin/class-psphpcaptchawp-admin.php:284
    36 msgid "Please enter a valid value for %s, at least %d chars long"
    37 msgstr "Bitte Wert eingeben für %s, mindestens %d Zeichen lang"
     36msgid "Please enter a valid value for %s, from %d to %d chars long"
     37msgstr "Bitte Wert eingeben für %s, von %d bis %d Zeichen lang"
    3838
    3939#: admin/class-psphpcaptchawp-admin.php:310
     
    214214msgid "https://wp.peters-webcorner.de"
    215215msgstr "https://wp.peters-webcorner.de"
     216
     217#~ msgid ""
     218#~ "Please enter a valid integer value for %s, greater than %d and lesser "
     219#~ "than %d"
     220#~ msgstr ""
     221#~ "Bitte Wert eingeben für %s, mindestens %d Zeichen lang, mindestens %d und "
     222#~ "maximal %d"
  • ps-phpcaptcha/trunk/languages/psphpcaptchawp-de_DE_formal.po

    r1979642 r2015726  
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/psphpcaptchawp\n"
    77"POT-Creation-Date: 2018-11-23 15:16:27+00:00\n"
    8 "PO-Revision-Date: 2018-11-23 17:11+0100\n"
     8"PO-Revision-Date: 2019-01-20 12:24+0100\n"
    99"Last-Translator: \n"
    1010"Language-Team: \n"
     
    2929
    3030#: admin/class-psphpcaptchawp-admin.php:259
    31 msgid "Please enter a valid integer value for %s"
    32 msgstr "Bitte Ganzzahlwert eingeben für %s"
     31msgid "Please enter a valid integer value for %s, from %d to %d"
     32msgstr "Bitte Ganzzahlwert eingeben für %s, von %d bis %d"
    3333
    3434#: admin/class-psphpcaptchawp-admin.php:274
    3535#: admin/class-psphpcaptchawp-admin.php:284
    36 msgid "Please enter a valid value for %s, at least %d chars long"
    37 msgstr "Bitte Wert eingeben für %s, mindestens %d Zeichen lang"
     36msgid "Please enter a valid value for %s, from %d to %d chars long"
     37msgstr "Bitte Wert eingeben für %s, von %d bis %d Zeichen lang"
    3838
    3939#: admin/class-psphpcaptchawp-admin.php:310
     
    214214msgid "https://wp.peters-webcorner.de"
    215215msgstr "https://wp.peters-webcorner.de"
     216
     217#~ msgid ""
     218#~ "Please enter a valid integer value for %s, greater than %d and lesser "
     219#~ "than %d"
     220#~ msgstr ""
     221#~ "Bitte Wert eingeben für %s, mindestens %d Zeichen lang, mindestens %d und "
     222#~ "maximal %d"
  • ps-phpcaptcha/trunk/languages/psphpcaptchawp-en_UK.po

    r1979642 r2015726  
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/psphpcaptchawp\n"
    77"POT-Creation-Date: 2018-11-23 15:16:27+00:00\n"
     8"PO-Revision-Date: 2019-01-20 12:24+0100\n"
     9"Last-Translator: \n"
     10"Language-Team: \n"
     11"Language: en_US\n"
    812"MIME-Version: 1.0\n"
    913"Content-Type: text/plain; charset=UTF-8\n"
    1014"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2018-11-23 17:19+0100\n"
    12 "Language-Team: \n"
    1315"X-Generator: Poedit 2.2\n"
    14 "Last-Translator: \n"
    1516"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    16 "Language: en_US\n"
    1717
    1818#: admin/class-psphpcaptchawp-admin.php:184
     
    2929
    3030#: admin/class-psphpcaptchawp-admin.php:259
    31 msgid "Please enter a valid integer value for %s"
    32 msgstr "Please enter a valid integer value for %s"
     31msgid "Please enter a valid integer value for %s, from %d to %d"
     32msgstr "Please enter a valid integer value for %s, from %d to %d"
    3333
    3434#: admin/class-psphpcaptchawp-admin.php:274
    3535#: admin/class-psphpcaptchawp-admin.php:284
    36 msgid "Please enter a valid value for %s, at least %d chars long"
    37 msgstr "Please enter a valid value for %s, at least %d chars long"
     36msgid "Please enter a valid value for %s, from %d to %d chars long"
     37msgstr "Please enter a valid value for %s, from %d to %d chars long"
    3838
    3939#: admin/class-psphpcaptchawp-admin.php:310
     
    210210msgid "https://wp.peters-webcorner.de"
    211211msgstr "https://wp.peters-webcorner.de"
     212
     213#~ msgid ""
     214#~ "Please enter a valid integer value for %s, greater than %d and lesser "
     215#~ "than %d"
     216#~ msgstr ""
     217#~ "Please enter a valid integer value for %s, greater than %d and lesser "
     218#~ "than %d"
  • ps-phpcaptcha/trunk/languages/psphpcaptchawp-en_US.po

    r1979642 r2015726  
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/psphpcaptchawp\n"
    77"POT-Creation-Date: 2018-11-23 15:16:27+00:00\n"
     8"PO-Revision-Date: 2019-01-20 12:25+0100\n"
     9"Last-Translator: \n"
     10"Language-Team: \n"
     11"Language: en_US\n"
    812"MIME-Version: 1.0\n"
    913"Content-Type: text/plain; charset=UTF-8\n"
    1014"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2018-11-23 17:06+0100\n"
    12 "Language-Team: \n"
    1315"X-Generator: Poedit 2.2\n"
    14 "Last-Translator: \n"
    1516"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    16 "Language: en_US\n"
    1717
    1818#: admin/class-psphpcaptchawp-admin.php:184
     
    2929
    3030#: admin/class-psphpcaptchawp-admin.php:259
    31 msgid "Please enter a valid integer value for %s"
    32 msgstr "Please enter a valid integer value for %s"
     31msgid "Please enter a valid integer value for %s, from %d to %d"
     32msgstr "Please enter a valid integer value for %s, from %d to %d"
    3333
    3434#: admin/class-psphpcaptchawp-admin.php:274
    3535#: admin/class-psphpcaptchawp-admin.php:284
    36 msgid "Please enter a valid value for %s, at least %d chars long"
    37 msgstr "Please enter a valid value for %s, at least %d chars long"
     36msgid "Please enter a valid value for %s, from %d to %d chars long"
     37msgstr "Please enter a valid value for %s, from %d to %d chars long"
    3838
    3939#: admin/class-psphpcaptchawp-admin.php:310
     
    210210msgid "https://wp.peters-webcorner.de"
    211211msgstr "https://wp.peters-webcorner.de"
     212
     213#~ msgid ""
     214#~ "Please enter a valid integer value for %s, greater than %d and lesser "
     215#~ "than %d"
     216#~ msgstr ""
     217#~ "Please enter a valid integer value for %s, greater than %d and lesser "
     218#~ "than %d"
  • ps-phpcaptcha/trunk/languages/psphpcaptchawp.pot

    r1979389 r2015726  
    55"Project-Id-Version: PS PHPCaptcha for Wordpress 1.0.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/psphpcaptchawp\n"
    7 "POT-Creation-Date: 2018-11-22 18:09:36+00:00\n"
     7"POT-Creation-Date: 2018-11-23 15:16:27+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
     
    1313"Language-Team: LANGUAGE <LL@li.org>\n"
    1414
    15 #: admin/class-psphpcaptchawp-admin.php:135
     15#: admin/class-psphpcaptchawp-admin.php:184
    1616msgid "PS PHPCaptcha for Wordpress - Setup"
    1717msgstr ""
    1818
    19 #: admin/class-psphpcaptchawp-admin.php:148
     19#: admin/class-psphpcaptchawp-admin.php:197
    2020msgid "Settings"
    2121msgstr ""
    2222
    23 #: admin/class-psphpcaptchawp-admin.php:193
     23#: admin/class-psphpcaptchawp-admin.php:242
    2424msgid "Please enter a valid hex value for %s, (#RRGGBB)"
    2525msgstr ""
    2626
    27 #: admin/class-psphpcaptchawp-admin.php:210
    28 msgid "Please enter a valid integer value for %s"
    29 msgstr ""
    30 
    31 #: admin/class-psphpcaptchawp-admin.php:225
    32 #: admin/class-psphpcaptchawp-admin.php:235
    33 msgid "Please enter a valid value for %s, at least %d chars long"
    34 msgstr ""
    35 
    36 #: admin/class-psphpcaptchawp-admin.php:261
     27#: admin/class-psphpcaptchawp-admin.php:259
     28msgid "Please enter a valid integer value for %s, from %d to %d"
     29msgstr ""
     30
     31#: admin/class-psphpcaptchawp-admin.php:274
     32#: admin/class-psphpcaptchawp-admin.php:284
     33msgid "Please enter a valid value for %s, from %d to %d chars long"
     34msgstr ""
     35
     36#: admin/class-psphpcaptchawp-admin.php:310
    3737msgid "Please enter a valid value for %s, (on/off)"
    3838msgstr ""
    3939
    40 #: admin/class-psphpcaptchawp-admin.php:281
    41 #: admin/partials/psphpcaptchawp-admin-display.php:52
    42 #: admin/partials/psphpcaptchawp-admin-display.php:57
     40#: admin/class-psphpcaptchawp-admin.php:330
     41#: admin/partials/psphpcaptchawp-admin-display.php:73
     42#: admin/partials/psphpcaptchawp-admin-display.php:78
    4343msgid "Number of characters"
    4444msgstr ""
    4545
    46 #: admin/class-psphpcaptchawp-admin.php:284
    47 #: admin/partials/psphpcaptchawp-admin-display.php:62
    48 #: admin/partials/psphpcaptchawp-admin-display.php:67
     46#: admin/class-psphpcaptchawp-admin.php:333
     47#: admin/partials/psphpcaptchawp-admin-display.php:83
     48#: admin/partials/psphpcaptchawp-admin-display.php:88
    4949msgid "Characters allowed"
    5050msgstr ""
    5151
    52 #: admin/class-psphpcaptchawp-admin.php:287
     52#: admin/class-psphpcaptchawp-admin.php:336
    5353msgid "Strict to lower case"
    5454msgstr ""
    5555
    56 #: admin/class-psphpcaptchawp-admin.php:291
     56#: admin/class-psphpcaptchawp-admin.php:340
    5757msgid "Background color"
    5858msgstr ""
    5959
    60 #: admin/class-psphpcaptchawp-admin.php:295
     60#: admin/class-psphpcaptchawp-admin.php:344
    6161msgid "Text color"
    6262msgstr ""
    6363
    64 #: admin/class-psphpcaptchawp-admin.php:299
     64#: admin/class-psphpcaptchawp-admin.php:348
    6565msgid "Line color"
    6666msgstr ""
    6767
    68 #: admin/class-psphpcaptchawp-admin.php:302
    69 #: admin/partials/psphpcaptchawp-admin-display.php:115
    70 #: admin/partials/psphpcaptchawp-admin-display.php:120
     68#: admin/class-psphpcaptchawp-admin.php:351
     69#: admin/partials/psphpcaptchawp-admin-display.php:136
     70#: admin/partials/psphpcaptchawp-admin-display.php:141
    7171msgid "Image width"
    7272msgstr ""
    7373
    74 #: admin/class-psphpcaptchawp-admin.php:305
    75 #: admin/partials/psphpcaptchawp-admin-display.php:125
    76 #: admin/partials/psphpcaptchawp-admin-display.php:130
    77 msgid "Image height"
    78 msgstr ""
    79 
    80 #: admin/class-psphpcaptchawp-admin.php:308
    81 #: admin/partials/psphpcaptchawp-admin-display.php:135
    82 #: admin/partials/psphpcaptchawp-admin-display.php:140
    83 msgid "Font size"
    84 msgstr ""
    85 
    86 #: admin/class-psphpcaptchawp-admin.php:311
     74#: admin/class-psphpcaptchawp-admin.php:354
    8775#: admin/partials/psphpcaptchawp-admin-display.php:146
    8876#: admin/partials/psphpcaptchawp-admin-display.php:151
    89 msgid "Number of lines"
    90 msgstr ""
    91 
    92 #: admin/class-psphpcaptchawp-admin.php:314
     77msgid "Image height"
     78msgstr ""
     79
     80#: admin/class-psphpcaptchawp-admin.php:357
    9381#: admin/partials/psphpcaptchawp-admin-display.php:156
    9482#: admin/partials/psphpcaptchawp-admin-display.php:161
     83msgid "Font size"
     84msgstr ""
     85
     86#: admin/class-psphpcaptchawp-admin.php:360
     87#: admin/partials/psphpcaptchawp-admin-display.php:168
     88#: admin/partials/psphpcaptchawp-admin-display.php:173
     89msgid "Number of lines"
     90msgstr ""
     91
     92#: admin/class-psphpcaptchawp-admin.php:363
     93#: admin/partials/psphpcaptchawp-admin-display.php:178
     94#: admin/partials/psphpcaptchawp-admin-display.php:183
    9595msgid "Thickness of lines"
    9696msgstr ""
    9797
    98 #: admin/class-psphpcaptchawp-admin.php:317
    99 #: admin/partials/psphpcaptchawp-admin-display.php:166
    100 #: admin/partials/psphpcaptchawp-admin-display.php:169
     98#: admin/class-psphpcaptchawp-admin.php:366
     99#: admin/partials/psphpcaptchawp-admin-display.php:189
     100#: admin/partials/psphpcaptchawp-admin-display.php:192
    101101msgid "Allow small advertisement below Captcha image"
    102102msgstr ""
    103103
    104 #: admin/partials/psphpcaptchawp-admin-display.php:50
     104#: admin/partials/psphpcaptchawp-admin-display.php:57
     105msgid ""
     106"This is a multisite installation, each site has its own settings. Blog-Id: %s"
     107msgstr ""
     108
     109#: admin/partials/psphpcaptchawp-admin-display.php:64
     110msgid "This is a singlesite installation, turned multisite features off."
     111msgstr ""
     112
     113#: admin/partials/psphpcaptchawp-admin-display.php:71
    105114msgid "Captcha content"
    106115msgstr ""
    107116
    108 #: admin/partials/psphpcaptchawp-admin-display.php:72
    109 #: admin/partials/psphpcaptchawp-admin-display.php:75
     117#: admin/partials/psphpcaptchawp-admin-display.php:93
     118#: admin/partials/psphpcaptchawp-admin-display.php:96
    110119msgid "Strict lower case"
    111120msgstr ""
    112121
    113 #: admin/partials/psphpcaptchawp-admin-display.php:80
     122#: admin/partials/psphpcaptchawp-admin-display.php:101
    114123msgid "Captcha colors"
    115 msgstr ""
    116 
    117 #: admin/partials/psphpcaptchawp-admin-display.php:82
    118 #: admin/partials/psphpcaptchawp-admin-display.php:83
    119 msgid "Background Color"
    120 msgstr ""
    121 
    122 #: admin/partials/psphpcaptchawp-admin-display.php:93
    123 #: admin/partials/psphpcaptchawp-admin-display.php:94
    124 msgid "Text Color"
    125124msgstr ""
    126125
    127126#: admin/partials/psphpcaptchawp-admin-display.php:103
    128127#: admin/partials/psphpcaptchawp-admin-display.php:104
     128msgid "Background Color"
     129msgstr ""
     130
     131#: admin/partials/psphpcaptchawp-admin-display.php:114
     132#: admin/partials/psphpcaptchawp-admin-display.php:115
     133msgid "Text Color"
     134msgstr ""
     135
     136#: admin/partials/psphpcaptchawp-admin-display.php:124
     137#: admin/partials/psphpcaptchawp-admin-display.php:125
    129138msgid "Line Color"
    130139msgstr ""
    131140
    132 #: admin/partials/psphpcaptchawp-admin-display.php:112
     141#: admin/partials/psphpcaptchawp-admin-display.php:133
    133142msgid "Captcha appearance"
    134143msgstr ""
    135144
    136 #: admin/partials/psphpcaptchawp-admin-display.php:143
     145#: admin/partials/psphpcaptchawp-admin-display.php:165
    137146msgid "OCR confusion options"
    138147msgstr ""
    139148
    140 #: admin/partials/psphpcaptchawp-admin-display.php:164
     149#: admin/partials/psphpcaptchawp-admin-display.php:187
    141150msgid "Allow advertisment for Plugin"
    142151msgstr ""
    143152
    144 #: admin/partials/psphpcaptchawp-admin-display.php:177
     153#: admin/partials/psphpcaptchawp-admin-display.php:200
    145154msgid "Save all changes"
    146155msgstr ""
    147156
    148 #: admin/partials/psphpcaptchawp-admin-display.php:183
     157#: admin/partials/psphpcaptchawp-admin-display.php:206
    149158msgid "Example captcha"
    150159msgstr ""
    151160
    152 #: admin/partials/psphpcaptchawp-admin-display.php:187
     161#: admin/partials/psphpcaptchawp-admin-display.php:212
    153162msgid "Reset settings"
    154163msgstr ""
    155164
    156 #: admin/partials/psphpcaptchawp-admin-display.php:233
     165#: admin/partials/psphpcaptchawp-admin-display.php:258
    157166msgid "Set to defaults"
    158167msgstr ""
    159168
    160 #: public/class-psphpcaptchawp-public.php:124
     169#: public/class-psphpcaptchawp-public.php:153
    161170msgid "Enter text displayed at Captcha image"
    162171msgstr ""
    163172
    164 #: public/class-psphpcaptchawp-public.php:137
     173#: public/class-psphpcaptchawp-public.php:173
    165174msgid ""
    166175"Please enter the displayed text into the Captcha text field below the "
     
    168177msgstr ""
    169178
    170 #: public/class-psphpcaptchawp-public.php:151
     179#: public/class-psphpcaptchawp-public.php:188
    171180msgid "Captcha solved wrong, please try again!"
    172181msgstr ""
  • ps-phpcaptcha/trunk/psphpcaptchawp.php

    r1979680 r2015726  
    1717 * Plugin URI:        https://github.com/pstimpel/psphpcaptchawp
    1818 * Description:       Dislike feeding remote tracking enterprises like Google with data just for verifying users? Well, here you go with your own captcha...
    19  * Version:           1.1.0
     19 * Version:           1.2.0
    2020 * Author:            Peter Stimpel
    2121 * Author URI:        https://wp.peters-webcorner.de
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'PLUGIN_NAME_VERSION', '1.1.0' );
     38define( 'PLUGIN_NAME_VERSION', '1.2.0' );
    3939
    4040/**
  • ps-phpcaptcha/trunk/public/class-psphpcaptchawp-public.php

    r1979572 r2015726  
    123123        if(file_exists(__DIR__ . "/../config".$blogId.".php")) {
    124124            require_once __DIR__ . "/../config".$blogId.".php";
    125             $preset['stringlength']=$stringlength;
    126             $preset['charstouse']=$charstouse;
    127             $preset['strictlowercase']=$strictlowercase;
     125           
     126            if($stringlength >= Psphpcaptchawp_Admin::$MinStringLength &&
     127               $stringlength <= Psphpcaptchawp_Admin::$MaxStringLength) {
     128                $preset['stringlength'] = $stringlength;
     129            }
     130           
     131            if(strlen($charstouse) >= Psphpcaptchawp_Admin::$MinCharsToUse &&
     132               strlen($charstouse) <= Psphpcaptchawp_Admin::$MaxCharsToUse) {
     133                $preset['charstouse'] = $charstouse;
     134            }
     135           
     136            if(is_bool($stringlength)) {
     137                $preset['strictlowercase'] = $strictlowercase;
     138            }
     139           
     140            //no sanitizing on wrong put config, needs some more work
    128141            $preset['bgcolor']=$bgcolor;
    129142            $preset['textcolor']=$textcolor;
    130143            $preset['linecolor']=$linecolor;
    131             $preset['sizewidth']=$sizewidth;
    132             $preset['sizeheight']=$sizeheight;
    133             $preset['fontsize']=$fontsize;
    134             $preset['numberoflines']=$numberoflines;
    135             $preset['thicknessoflines']=$thicknessoflines;
    136             $preset['allowad']=$allowad;
     144           
     145            if($sizewidth >= Psphpcaptchawp_Admin::$MinSizeWidth &&
     146               $sizewidth <= Psphpcaptchawp_Admin::$MaxSizeWidth) {
     147                $preset['sizewidth'] = $sizewidth;
     148            }
     149           
     150            if($sizeheight >= Psphpcaptchawp_Admin::$MinSizeHeight &&
     151               $sizeheight <= Psphpcaptchawp_Admin::$MaxSizeHeight) {
     152                $preset['sizeheight'] = $sizeheight;
     153            }
     154           
     155            if($fontsize >= Psphpcaptchawp_Admin::$MinFontSize &&
     156               $fontsize <= Psphpcaptchawp_Admin::$MaxFontSize) {
     157                $preset['fontsize'] = $fontsize;
     158            }
     159           
     160            if($numberoflines >= Psphpcaptchawp_Admin::$MinNumberOfLines &&
     161               $numberoflines <= Psphpcaptchawp_Admin::$MaxNumberOfLines) {
     162                $preset['numberoflines'] = $numberoflines;
     163            }
     164           
     165            if($thicknessoflines >= Psphpcaptchawp_Admin::$MinThicknessOfLines &&
     166               $thicknessoflines <= Psphpcaptchawp_Admin::$MaxThicknessOfLines) {
     167                $preset['thicknessoflines'] = $thicknessoflines;
     168            }
     169           
     170            if(is_bool($allowad)) {
     171                $preset['allowad'] = $allowad;
     172            }
    137173           
    138174        }
Note: See TracChangeset for help on using the changeset viewer.