Changeset 707

Show
Ignore:
Timestamp:
07/17/07 00:18:17 (17 months ago)
Author:
rats
Message:

- GUI:

  • Fixed #457: Improved max-attempts limit for lost password's CAPTCHA
  • Fixed serveral errors.
  • SQL:
    • Added: cpatcha_count on table login in database.sq
Location:
trunk
Files:
1 added
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/CHANGELOG

    r706 r707  
    88|               * gui: disable stats-alias in client menu         | 
    99\_________________________________________________________________/ 
     10 
     112007-07-16 Benedikt Heintel 
     12        - GUI: 
     13                * Fixed #457: Improved max-attempts limit for lost password's CAPTCHA 
     14                * Fixed serveral errors. 
     15        - SQL: 
     16                * Added: cpatcha_count on table login in database.sql 
    1017 
    11182007-07-16 Raphael Geissert 
  • trunk/configs/database/database.sql

    r625 r707  
    359359  `ipaddr` varchar(15) default NULL, 
    360360  `lastaccess` int(10) unsigned default NULL, 
    361   `login_count` tinyint(1) default NULL, 
     361  `login_count` tinyint(1) default 0, 
     362  `captcha_count` tinyint(1) default 0, 
    362363  `user_name` varchar(255) default NULL 
    363364) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 
  • trunk/gui/admin/settings.php

    r685 r707  
    8383                                        'BRUTEFORCE_BLOCK_TIME_VALUE' => $cfg['BRUTEFORCE_BLOCK_TIME'], 
    8484                                        'BRUTEFORCE_BETWEEN_TIME_VALUE' => $cfg['BRUTEFORCE_BETWEEN_TIME'], 
     85                                        'BRUTEFORCE_MAX_CAPTCHA' => $cfg['BRUTEFORCE_MAX_CAPTCHA'], 
    8586                                        'DOMAIN_ROWS_PER_PAGE' => $cfg['DOMAIN_ROWS_PER_PAGE'] 
    8687                                        ) 
     
    141142                       'TR_BRUTEFORCE_BLOCK_TIME' => tr('Blocktime (minutes)'), 
    142143                       'TR_BRUTEFORCE_BETWEEN_TIME' => tr('Block time between logins (seconds)'), 
     144                       'TR_BRUTEFORCE_MAX_CAPTCHA' => tr('Max number of Chapcha geraneration'), 
    143145                       'TR_OTHER_SETTINGS' => tr('Other settings'), 
    144146                       'TR_USER_INITIAL_LANG' => tr('Default language'), 
  • trunk/gui/client/add_mail_acc.php

    r702 r707  
    11<?php 
    22/** 
    3  *  ispCP (OMEGA) - Virtual Hosting Control System | Omega Version 
     3 *  ispCP ω (OMEGA) a Virtual Hosting Control System 
    44 * 
    55 *  @copyright  2001-2006 by moleSoftware GmbH 
  • trunk/gui/client/catchall.php

    r662 r707  
    11<?php 
    22/** 
    3  *  ispCP (OMEGA) - Virtual Hosting Control System | Omega Version 
    4  * 
    5  *  @copyright  2001-2006 by moleSoftware GmbH 
    6  *  @copyright  2006-2007 by ispCP | http://isp-control.net 
    7  *  @link               http://isp-control.net 
    8  *  @author             ispCP Team (2007) 
    9  * 
    10  *  @license 
    11  *  This program is free software; you can redistribute it and/or modify it under 
    12  *  the terms of the MPL General Public License as published by the Free Software 
    13  *  Foundation; either version 1.1 of the License, or (at your option) any later 
    14  *  version. 
    15  *  You should have received a copy of the MPL Mozilla Public License along with 
    16  *  this program; if not, write to the Open Source Initiative (OSI) 
    17  *  http://opensource.org | osi@opensource.org 
    18  **/ 
    19  
     3* ispCP ω (OMEGA) a Virtual Hosting Control System 
     4* 
     5* @copyright 2001-2006 by moleSoftware GmbH 
     6* @copyright 2006-2007 by ispCP | http://isp-control.net 
     7* @link http://isp-control.net 
     8* @author ispCP Team (2007) 
     9* @license This program is free software; you can redistribute it and/or modify it under 
     10*   the terms of the MPL General Public License as published by the Free Software 
     11*   Foundation; either version 1.1 of the License, or (at your option) any later 
     12*   version. 
     13*   You should have received a copy of the MPL Mozilla Public License along with 
     14*   this program; if not, write to the Open Source Initiative (OSI) 
     15*   http://opensource.org | osi@opensource.org 
     16*/ 
    2017 
    2118require '../include/ispcp-lib.php'; 
     
    2421 
    2522$tpl = new pTemplate(); 
    26  
    27 $tpl -> define_dynamic('page', $cfg['CLIENT_TEMPLATE_PATH'].'/catchall.tpl'); 
    28  
    29 $tpl -> define_dynamic('page_message', 'page'); 
    30  
    31 $tpl -> define_dynamic('logged_from', 'page'); 
    32  
    33 $tpl -> define_dynamic('mail_message', 'page'); 
    34  
    35 $tpl -> define_dynamic('mail_item', 'page'); 
    36  
    37 $tpl -> define_dynamic('mail_auto_respond', 'mail_item'); 
    38  
    39 $tpl -> define_dynamic('mails_total', 'page'); 
    40  
    41 $tpl -> define_dynamic('catchall_message', 'page'); 
    42  
    43 $tpl -> define_dynamic('catchall_item', 'page'); 
    44  
    45 $tpl -> define_dynamic('ftp_message', 'page'); 
    46  
    47 $tpl -> define_dynamic('ftp_item', 'page'); 
    48  
    49 $tpl -> define_dynamic('no_mails', 'page'); 
    50  
    51 // 
     23$tpl->define_dynamic('page', $cfg['CLIENT_TEMPLATE_PATH'] . '/catchall.tpl'); 
     24$tpl->define_dynamic('page_message', 'page'); 
     25$tpl->define_dynamic('logged_from', 'page'); 
     26$tpl->define_dynamic('mail_message', 'page'); 
     27$tpl->define_dynamic('mail_item', 'page'); 
     28$tpl->define_dynamic('mail_auto_respond', 'mail_item'); 
     29$tpl->define_dynamic('mails_total', 'page'); 
     30$tpl->define_dynamic('catchall_message', 'page'); 
     31$tpl->define_dynamic('catchall_item', 'page'); 
     32$tpl->define_dynamic('ftp_message', 'page'); 
     33$tpl->define_dynamic('ftp_item', 'page'); 
     34$tpl->define_dynamic('no_mails', 'page'); 
     35 
    5236// page functions. 
    53 // 
    54  
    55 function gen_user_mail_action($mail_id, $mail_status) 
    56 { 
    57  
     37 
     38function gen_user_mail_action($mail_id, $mail_status) { 
    5839    global $cfg; 
    5940 
    60  
    61  
    6241    if ($mail_status === $cfg['ITEM_OK_STATUS']) { 
    63  
    64          return array(tr('Delete'), "delete_mail_acc.php?id=$mail_id", "edit_mail_acc.php?id=$mail_id"); 
    65  
    66     } else { 
    67  
     42        return array(tr('Delete'), "delete_mail_acc.php?id=$mail_id", "edit_mail_acc.php?id=$mail_id"); 
     43    } else { 
    6844        return array(tr('N/A'), '#', '#'); 
    69  
    70     } 
    71 } 
    72  
    73 function gen_user_mail_auto_respond(&$tpl, $mail_id, $mail_type, $mail_status, $mail_auto_respond) 
    74 { 
    75  
     45    } 
     46} 
     47 
     48function gen_user_mail_auto_respond(&$tpl, $mail_id, $mail_type, $mail_status, $mail_auto_respond) { 
    7649    global $cfg; 
    7750 
    7851    if (preg_match('/_mail$/', $mail_type) == 1) { 
    79  
    8052        if ($mail_status === $cfg['ITEM_OK_STATUS']) { 
    81  
    8253            if ($mail_auto_respond === '_no_') { 
    83  
    84                 $tpl -> assign( 
    85                                 array( 
    86                                         'AUTO_RESPOND_ACTION' => tr('Enable'), 
    87                                         'AUTO_RESPOND_ACTION_SCRIPT' => "enable_mail_arsp.php?id=$mail_id" 
    88                                      ) 
    89                               ); 
    90  
     54                $tpl->assign( 
     55                    array('AUTO_RESPOND_ACTION' => tr('Enable'), 
     56                        'AUTO_RESPOND_ACTION_SCRIPT' => "enable_mail_arsp.php?id=$mail_id" 
     57                        ) 
     58                    ); 
    9159            } else { 
    92  
    93                 $tpl -> assign( 
    94                                 array( 
    95                                         'AUTO_RESPOND_ACTION' => tr('Disable'), 
    96                                         'AUTO_RESPOND_ACTION_SCRIPT' => "disable_mail_arsp.php?id=$mail_id" 
    97                                      ) 
    98                               ); 
    99  
     60                $tpl->assign( 
     61                    array('AUTO_RESPOND_ACTION' => tr('Disable'), 
     62                        'AUTO_RESPOND_ACTION_SCRIPT' => "disable_mail_arsp.php?id=$mail_id" 
     63                        ) 
     64                    ); 
    10065            } 
    101  
    102             $tpl -> parse('MAIL_AUTO_RESPOND', 'mail_auto_respond'); 
    103  
     66            $tpl->parse('MAIL_AUTO_RESPOND', 'mail_auto_respond'); 
    10467        } else { 
    105  
    106             $tpl -> assign('MAIL_AUTO_RESPOND', ''); 
    107  
     68            $tpl->assign('MAIL_AUTO_RESPOND', ''); 
    10869        } 
    109  
    110     } else { 
    111  
    112         $tpl -> assign('MAIL_AUTO_RESPOND', ''); 
    113  
    114     } 
    115  
    116 } 
    117  
    118 function gen_page_dmn_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) 
    119 { 
    120  
     70    } else { 
     71        $tpl->assign('MAIL_AUTO_RESPOND', ''); 
     72    } 
     73} 
     74 
     75function gen_page_dmn_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) { 
    12176    $dmn_query = <<<SQL_QUERY 
    122  
    12377        select 
    124  
    12578            mail_id, mail_acc, mail_type, status, mail_auto_respond 
    126  
    12779        from 
    128  
    12980            mail_users 
    130  
    13181        where 
    132  
    13382            domain_id = '$dmn_id' 
    134  
    13583          and 
    136  
    13784            sub_id = 0 
    138  
    13985                and 
    140  
    14186                                (mail_type  = 'normal_mail' 
    14287                        or 
    14388                                mail_type  = 'normal_forward') 
    144  
    14589        order by 
    146  
    14790            mail_type desc, 
    148  
    14991            mail_id 
    150  
    15192SQL_QUERY; 
    15293 
    15394    $rs = execute_query($sql, $dmn_query); 
    15495 
    155     if ($rs -> RecordCount() == 0) { 
    156  
     96    if ($rs->RecordCount() == 0) { 
    15797        return 0; 
    158  
    159     } else { 
    160  
    161         while (!$rs -> EOF) { 
    162  
    163             list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs -> fields['mail_id'], $rs -> fields['status']); 
    164  
    165                         $mail_acc = decode_idna($rs -> fields['mail_acc']); 
    166  
    167                         $show_dmn_name = decode_idna($dmn_name); 
    168  
    169  
    170             $tpl -> assign( 
    171                             array( 
    172                                     'MAIL_ACC' => $mail_acc."@".$show_dmn_name, 
    173                                     'MAIL_TYPE' => user_trans_mail_type($rs -> fields['mail_type']), 
    174                                     'MAIL_STATUS' => translate_dmn_status($rs -> fields['status']), 
    175                                     'MAIL_ACTION' => $mail_action, 
    176                                     'MAIL_ACTION_SCRIPT' => $mail_action_script, 
    177                                                                         'MAIL_EDIT_SCRIPT' => $mail_edit_script 
    178                                  ) 
    179                           ); 
     98    } else { 
     99        while (!$rs->EOF) { 
     100            list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs->fields['mail_id'], $rs->fields['status']); 
     101            $mail_acc = decode_idna($rs->fields['mail_acc']); 
     102            $show_dmn_name = decode_idna($dmn_name); 
     103 
     104            $tpl->assign( 
     105                array('MAIL_ACC' => $mail_acc . "@" . $show_dmn_name, 
     106                    'MAIL_TYPE' => user_trans_mail_type($rs->fields['mail_type']), 
     107                    'MAIL_STATUS' => translate_dmn_status($rs->fields['status']), 
     108                    'MAIL_ACTION' => $mail_action, 
     109                    'MAIL_ACTION_SCRIPT' => $mail_action_script, 
     110                    'MAIL_EDIT_SCRIPT' => $mail_edit_script 
     111                    ) 
     112                ); 
    180113 
    181114            gen_user_mail_auto_respond($tpl, 
    182                                        $rs -> fields['mail_id'], 
    183                                        $rs -> fields['mail_type'], 
    184                                        $rs -> fields['status'], 
    185                                        $rs -> fields['mail_auto_respond']); 
    186  
    187             $tpl -> parse('MAIL_ITEM', '.mail_item'); 
    188  
    189             $rs -> MoveNext(); 
    190  
     115                $rs->fields['mail_id'], 
     116                $rs->fields['mail_type'], 
     117                $rs->fields['status'], 
     118                $rs->fields['mail_auto_respond']); 
     119 
     120            $tpl->parse('MAIL_ITEM', '.mail_item'); 
     121            $rs->MoveNext(); 
    191122        } 
    192123 
    193         return $rs -> RecordCount(); 
    194  
    195     } 
    196  
    197 } 
    198  
    199 function gen_page_sub_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) 
    200 { 
    201  
     124        return $rs->RecordCount(); 
     125    } 
     126} 
     127 
     128function gen_page_sub_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) { 
    202129    $sub_query = <<<SQL_QUERY 
    203130 
     
    211138            t2.status, 
    212139            t2.mail_auto_respond 
    213  
    214140        from 
    215  
    216141            subdomain as t1, 
    217  
    218142            mail_users as t2 
    219  
    220143        where 
    221  
    222144            t1.domain_id = '$dmn_id' 
    223  
    224145          and 
    225  
    226146             t2.domain_id = '$dmn_id' 
    227  
    228147                and 
    229  
    230148                                (t2.mail_type = 'subdom_mail' 
    231149                        or 
    232150                                t2.mail_type = 'subdom_forward') 
    233  
    234151          and 
    235  
    236152            t1.subdomain_id = t2.sub_id 
    237  
    238  
    239153        order by 
    240  
    241154            t2.mail_type desc, t2.mail_id 
    242  
    243155SQL_QUERY; 
    244156 
    245157    $rs = execute_query($sql, $sub_query); 
    246158 
    247     if ($rs -> RecordCount() == 0) { 
    248  
     159    if ($rs->RecordCount() == 0) { 
    249160        return 0; 
    250  
    251     } else { 
    252  
    253         while (!$rs -> EOF) { 
    254  
    255             list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs -> fields['mail_id'], $rs -> fields['status']); 
    256  
    257                         $mail_acc = decode_idna($rs -> fields['mail_acc']); 
    258  
    259                         $show_sub_name = decode_idna($rs -> fields['sub_name']); 
    260  
    261                         $show_dmn_name = decode_idna($dmn_name); 
    262  
    263             $tpl -> assign( 
    264                             array( 
    265                                     'MAIL_ACC' => $mail_acc."@".$show_sub_name.".".$show_dmn_name, 
    266                                     'MAIL_TYPE' => user_trans_mail_type($rs -> fields['mail_type']), 
    267                                     'MAIL_STATUS' => user_trans_item_status($rs -> fields['status']), 
    268                                     'MAIL_ACTION' => $mail_action, 
    269                                     'MAIL_ACTION_SCRIPT' => $mail_action_script, 
    270                                                                         'MAIL_EDIT_SCRIPT' => $mail_edit_script 
    271                                  ) 
    272                           ); 
     161    } else { 
     162        while (!$rs->EOF) { 
     163            list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs->fields['mail_id'], $rs->fields['status']); 
     164 
     165            $mail_acc = decode_idna($rs->fields['mail_acc']); 
     166 
     167            $show_sub_name = decode_idna($rs->fields['sub_name']); 
     168 
     169            $show_dmn_name = decode_idna($dmn_name); 
     170 
     171            $tpl->assign( 
     172                array('MAIL_ACC' => $mail_acc . "@" . $show_sub_name . "." . $show_dmn_name, 
     173                    'MAIL_TYPE' => user_trans_mail_type($rs->fields['mail_type']), 
     174                    'MAIL_STATUS' => user_trans_item_status($rs->fields['status']), 
     175                    'MAIL_ACTION' => $mail_action, 
     176                    'MAIL_ACTION_SCRIPT' => $mail_action_script, 
     177                    'MAIL_EDIT_SCRIPT' => $mail_edit_script 
     178                    ) 
     179                ); 
    273180 
    274181            gen_user_mail_auto_respond($tpl, 
    275                                        $rs -> fields['mail_id'], 
    276                                        $rs -> fields['mail_type'], 
    277                                        $rs -> fields['status'], 
    278                                        $rs -> fields['mail_auto_respond']); 
    279  
    280             $tpl -> parse('MAIL_ITEM', '.mail_item'); 
    281  
    282             $rs -> MoveNext(); 
    283  
     182                $rs->fields['mail_id'], 
     183                $rs->fields['mail_type'], 
     184                $rs->fields['status'], 
     185                $rs->fields['mail_auto_respond']); 
     186 
     187            $tpl->parse('MAIL_ITEM', '.mail_item'); 
     188 
     189            $rs->MoveNext(); 
    284190        } 
    285191 
    286         return $rs -> RecordCount(); 
    287  
    288     } 
    289  
    290 } 
    291  
    292 function gen_page_als_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) 
    293 { 
    294  
     192        return $rs->RecordCount(); 
     193    } 
     194} 
     195 
     196function gen_page_als_mail_list(&$tpl, &$sql, $dmn_id, $dmn_name) { 
    295197    $als_query = <<<SQL_QUERY 
    296  
    297198        select 
    298  
    299199            t1.alias_id as als_id, 
    300200            t1.alias_name as als_name, 
     
    304204            t2.status, 
    305205            t2.mail_auto_respond 
    306  
    307206        from 
    308  
    309207            domain_aliasses as t1, 
    310208            mail_users as t2 
    311  
    312209        where 
    313  
    314210            t1.domain_id = '$dmn_id' 
    315  
    316211          and 
    317  
    318212            t2.domain_id = '$dmn_id' 
    319  
    320213          and 
    321  
    322214            t1.alias_id = t2.sub_id 
    323  
    324215                and 
    325  
    326216                                (t2.mail_type = 'alias_mail' 
    327217                        or 
    328218                                t2.mail_type = 'alias_forward') 
    329  
    330219        order by 
    331  
    332220            t2.mail_type desc, t2.mail_id 
    333  
    334221SQL_QUERY; 
    335222 
    336223    $rs = execute_query($sql, $als_query); 
    337224 
    338     if ($rs -> RecordCount() == 0) { 
    339  
     225    if ($rs->RecordCount() == 0) { 
    340226        return 0; 
    341  
    342     } else { 
    343  
    344         while (!$rs -> EOF) { 
    345  
    346             list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs -> fields['mail_id'], $rs -> fields['status']); 
    347  
    348  
    349                         $mail_acc = decode_idna($rs -> fields['mail_acc']); 
    350  
    351                         $show_dmn_name = decode_idna($dmn_name); 
    352  
    353                         $show_als_name = decode_idna($rs -> fields['als_name']); 
    354  
    355                         $tpl -> assign( 
    356                             array( 
    357                                     'MAIL_ACC' => $mail_acc."@".$show_als_name, 
    358                                     'MAIL_TYPE' => user_trans_mail_type($rs -> fields['mail_type']), 
    359                                     'MAIL_STATUS' => user_trans_item_status($rs -> fields['status']), 
    360                                     'MAIL_ACTION' => $mail_action, 
    361                                     'MAIL_ACTION_SCRIPT' => $mail_action_script, 
    362                                                                         'MAIL_EDIT_SCRIPT' => $mail_edit_script 
    363                                  ) 
    364                           ); 
     227    } else { 
     228        while (!$rs->EOF) { 
     229            list($mail_action, $mail_action_script, $mail_edit_script) = gen_user_mail_action($rs->fields['mail_id'], $rs->fields['status']); 
     230 
     231            $mail_acc = decode_idna($rs->fields['mail_acc']); 
     232 
     233            $show_dmn_name = decode_idna($dmn_name); 
     234 
     235            $show_als_name = decode_idna($rs->fields['als_name']); 
     236 
     237            $tpl->assign( 
     238                array('MAIL_ACC' => $mail_acc . "@" . $show_als_name, 
     239                    'MAIL_TYPE' => user_trans_mail_type($rs->fields['mail_type']), 
     240                    'MAIL_STATUS' => user_trans_item_status($rs->fields['status']), 
     241                    'MAIL_ACTION' => $mail_action, 
     242                    'MAIL_ACTION_SCRIPT' => $mail_action_script, 
     243                    'MAIL_EDIT_SCRIPT' => $mail_edit_script 
     244                    ) 
     245                ); 
    365246 
    366247            gen_user_mail_auto_respond($tpl, 
    367                                        $rs -> fields['mail_id'], 
    368                                        $rs -> fields['mail_type'], 
    369                                        $rs -> fields['status'], 
    370                                        $rs -> fields['mail_auto_respond']); 
    371  
    372             $tpl -> parse('MAIL_ITEM', '.mail_item'); 
    373  
    374             $rs -> MoveNext(); 
    375  
     248                $rs->fields['mail_id'], 
     249                $rs->fields['mail_type'], 
     250                $rs->fields['status'], 
     251                $rs->fields['mail_auto_respond']); 
     252 
     253            $tpl->parse('MAIL_ITEM', '.mail_item'); 
     254 
     255            $rs->MoveNext(); 
    376256        } 
    377257 
    378         return $rs -> RecordCount(); 
    379  
    380     } 
    381  
    382 } 
    383  
    384 function gen_user_catchall_action($mail_id, $mail_status) 
    385 { 
    386  
     258        return $rs->RecordCount(); 
     259    } 
     260} 
     261 
     262function gen_user_catchall_action($mail_id, $mail_status) { 
    387263    global $cfg; 
    388264 
    389265    if ($mail_status === $cfg['ITEM_ADD_STATUS']) { 
    390  
    391266        return array(tr('N/A'), '#'); 
    392  
    393267    } else if ($mail_status === $cfg['ITEM_OK_STATUS']) { 
    394  
    395268        return array(tr('Delete CatchAll'), "delete_catchall.php?id=$mail_id"); 
    396  
    397269    } else if ($mail_status === $cfg['ITEM_CHANGE_STATUS']) { 
    398  
    399270        return array(tr('N/A'), '#'); 
    400  
    401271    } else if ($mail_status === $cfg['ITEM_DELETE_STATUS']) { 
    402  
    403272        return array(tr('N/A'), '#'); 
    404  
    405     } else { 
    406  
     273    } else { 
    407274        return null; 
    408  
    409     } 
    410  
    411 } 
    412  
    413 function gen_catchall_item(&$tpl, $action, $dmn_id, $dmn_name, $mail_id, $mail_acc, $mail_status, $ca_type) 
    414 { 
    415  
    416         $show_dmn_name = decode_idna($dmn_name); 
     275    } 
     276} 
     277 
     278function gen_catchall_item(&$tpl, $action, $dmn_id, $dmn_name, $mail_id, $mail_acc, $mail_status, $ca_type) { 
     279    $show_dmn_name = decode_idna($dmn_name); 
    417280 
    418281    if ($action === 'create') { 
    419  
    420         $tpl -> assign( 
    421                           array( 
    422                                   'CATCHALL_DOMAIN' => $show_dmn_name, 
    423                                   'CATCHALL_ACC' => tr('None'), 
    424