Plugin Directory

Changeset 582774


Ignore:
Timestamp:
08/07/2012 05:41:27 PM (14 years ago)
Author:
zaantar
Message:

1.3.6

Location:
superadmin-helper
Files:
1 deleted
6 edited
10 copied

Legend:

Unmodified
Added
Removed
  • superadmin-helper/tags/1.3.6/includes/options.php

    r519392 r582774  
    186186                <tr valign="top">
    187187                    <th>
     188                        <label>Attempt to access site from banned IP</label><br />
     189                    </th>
     190                    <td>
     191                        <input type="checkbox" name="settings[log_banned_attempt]"
     192                            <?php if( $log_banned_attempt ) echo 'checked="checked"'; ?>
     193                        />
     194                    </td>
     195                    <td><small><?php _e( 'If checked, every attempt to access this site from a banned IP will be logged.', SUH_TEXTDOMAIN ); ?></small></td>
     196                </tr>
     197                <tr valign="top">
     198                    <th>
    188199                        <label><code>wp_mail</code></label><br />
    189200                    </th>
  • superadmin-helper/tags/1.3.6/includes/permban.php

    r519429 r582774  
    1313            id INT NOT NULL AUTO_INCREMENT,
    1414            ip VARCHAR( 63 ) UNIQUE,
     15            attempt_count INT DEFAULT 0,
     16            last_attempt DATETIME,
    1517            PRIMARY KEY ( id )
    1618        )';
     
    9395    if( !is_user_logged_in() && suh_is_banned( $ip ) ) {
    9496        extract( suh_get_settings() );
    95         suh_log( 'Attempt to access from banned IP '.$ip.'.', 1 );
     97        if( $log_banned_attempt ) {
     98            suh_log( 'Attempt to access from banned IP '.$ip.'.', 1 );
     99            suh_increment_attempt_count( $ip );
     100        }
     101       
    96102        echo $banned_message;
    97103        exit();
    98104    }
     105}
     106
     107
     108function suh_increment_attempt_count( $ip ) {
     109    $lock_name = "suh_increment_attempt_count($ip)";
     110    global $wpdb;
     111    $locked = $wpdb->get_var( 'SELECT GET_LOCK(\''.$lock_name.'\', 0)' );
     112    if( $locked != '1' ) {
     113        return;
     114    }
     115    $wpdb->query( $wpdb->prepare( "UPDATE ".suh_permban_table()." SET attempt_count = attempt_count + 1, last_attempt = NOW() WHERE ip LIKE %s", $ip ) );
     116    $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
    99117}
    100118
     
    185203                        <td><strong><?php echo $permban->ip; ?></strong></td>
    186204                        <td>
    187                             <?php
     205                            <p>
     206                                <?php
     207                                    printf( __( "There have been %s attempts to access site from this IP since it was banned.", SUH_TEXTDOMAIN ),
     208                                        $permban->attempt_count
     209                                    );
     210                                    if( $permban->attempt_count > 0 ) {
     211                                        echo " ";
     212                                        printf( __( "Last one occured at %s.", SUH_TEXTDOMAIN ), $permban->last_attempt );
     213                                    }
     214                                ?>
     215                            </p>
     216                            <?php
    188217                                $origins = array();
    189218                                $comments = suh_get_possible_comment_authors( $permban->ip );
     
    219248                                    $entries = array();
    220249                                    foreach( $log_entries as $log_entry ) {
     250                                        $log_text = strlen( $log_entry->text ) > 150 ? substr( $log_entry->text, 0, 150 )."..." : $log_entry->text;
    221251                                        $entries[] = sprintf(
    222                                             '<tr>
    223                                                 <td>%d (%s)</td>
    224                                                 <td>
     252                                            '<tr style="border:none;">
     253                                                <td style="border:none;"><small><code>%d</code>: %s</small></td>
     254                                                <td style="border:none;">
    225255                                                    <form
    226256                                                        method="post" action="index.php?page=wls-superadmin-overview" target="_blank"
     
    231261                                                </td>
    232262                                            </tr>',
    233                                             $log_entry->id, $log_entry->text, $log_entry->id
     263                                            $log_entry->id, $log_text, $log_entry->id
    234264                                        );
    235265                                    }
    236266                                    if( !empty( $entries ) ) {
    237                                         $origins[] = 'WLS log entries concerning this IP address:<table>'.implode( '', $entries ).'</table>';
     267                                        $origins[] = 'WLS log entries concerning this IP address:<table style="border:none;">'.implode( '', $entries ).'</table>';
    238268                                    }
    239269                                }
  • superadmin-helper/tags/1.3.6/languages/superadmin-helper-cs_CZ.po

    r508144 r582774  
    22msgstr ""
    33"Project-Id-Version: Superadmin Helper\n"
    4 "Report-Msgid-Bugs-To: http://wordpress.org/tag/superadmin-helper\n"
    5 "POT-Creation-Date: 2012-01-23 08:22:27+00:00\n"
    6 "PO-Revision-Date: 2012-01-23 09:30+0100\n"
     4"Report-Msgid-Bugs-To: \n"
     5"POT-Creation-Date: 2011-12-20 12:38+0100\n"
     6"PO-Revision-Date: 2011-12-20 13:03+0100\n"
    77"Last-Translator: Zaantar <zaantar@zaantar.eu>\n"
    88"Language-Team: \n"
     
    1515"X-Poedit-SearchPath-0: .\n"
    1616
    17 #. #-#-#-#-#  plugin.pot (Superadmin helper 1.3.2)  #-#-#-#-#
    18 #. Plugin Name of the plugin/theme
     17#: superadmin-helper.php:50
     18#: superadmin-helper.php:61
     19msgid "Superadmin helper settings"
     20msgstr "Nastavení Superadmin Helper"
     21
    1922#: superadmin-helper.php:51
    2023#: superadmin-helper.php:62
     
    2225msgstr "Superadmin Helper"
    2326
    24 #: superadmin-helper.php:61
    25 msgid "Superadmin helper settings"
    26 msgstr "Nastavení Superadmin Helper"
     27#: superadmin-helper.php:77
     28msgid "Options saved"
     29msgstr "Nastavení uloženo"
     30
     31#: superadmin-helper.php:81
     32msgid "Basic information about events in multisite network."
     33msgstr "Základní informace o událostech v síti blogů."
     34
     35#: superadmin-helper.php:82
     36msgid "List of e-mails sent by WordPress"
     37msgstr "Seznam e-mailů odeslaných WordPressem."
     38
     39#: superadmin-helper.php:85
     40msgid "Superadmin Helper was successfully registered with WLS."
     41msgstr "Superadmin Helper byl úspěšně zaregistrován k WLS."
     42
     43#: superadmin-helper.php:89
     44msgid "Error while trying to register Superadmin Helper with WLS."
     45msgstr "Chyba při pokusu o registraci Superadmin Helper k WLS."
     46
     47#: superadmin-helper.php:100
     48msgid "Superadmin Helper successfully unregistered from WLS, log entries deleted."
     49msgstr "Superadmin Helper byl úspěšně odregistrován od WLS a logy byly smazány."
     50
     51#: superadmin-helper.php:104
     52msgid "Error while trying to unregister Superadmin Helper from WLS"
     53msgstr "Chyba při pokusu o odregistrování Superadmin Helper od WLS."
    2754
    2855#: superadmin-helper.php:120
     
    4774
    4875#: superadmin-helper.php:150
    49 #: superadmin-helper.php:585
    50 #: superadmin-helper.php:592
    51 #: superadmin-helper.php:635
     76#: superadmin-helper.php:580
     77#: superadmin-helper.php:587
     78#: superadmin-helper.php:630
    5279msgid "Permban"
    5380msgstr "Permban"
     
    77104msgstr "Primární blog"
    78105
    79 #: superadmin-helper.php:438
     106#: superadmin-helper.php:437
    80107msgid "Last login"
    81108msgstr "Poslední přihlášení"
    82109
    83 #: superadmin-helper.php:640
    84 #: superadmin-helper.php:648
     110#: superadmin-helper.php:635
     111#: superadmin-helper.php:643
    85112msgid "IP address"
    86113msgstr "IP adresa"
    87114
    88 #: superadmin-helper.php:641
    89 #: superadmin-helper.php:649
     115#: superadmin-helper.php:636
     116#: superadmin-helper.php:644
    90117msgid "Notes"
    91118msgstr "Poznámky"
    92119
    93 #: superadmin-helper.php:642
    94 #: superadmin-helper.php:650
     120#: superadmin-helper.php:637
     121#: superadmin-helper.php:645
    95122msgid "Action"
    96123msgstr "Akce"
    97124
    98 #: superadmin-helper.php:663
     125#: superadmin-helper.php:658
    99126msgid "Possible origins of attack / affected visitors"
    100127msgstr "Možné původy útoku nebo postižení návštěvníci"
    101128
    102 #. Plugin URI of the plugin/theme
    103 msgid "http://zaantar.eu/index.php?page=superadmin-helper"
    104 msgstr ""
    105 
    106 #. Description of the plugin/theme
    107 msgid "Sada utilit pro zjednodušení správy sítě blogů. Superadministrátorský plugin. <strong>Vyvinuto a určeno pro blogosphere.cz</strong>"
    108 msgstr ""
    109 
    110 #. Author of the plugin/theme
    111 msgid "Zaantar"
    112 msgstr "Zaantar"
    113 
    114 #. Author URI of the plugin/theme
    115 msgid "http://zaantar.eu"
    116 msgstr "http://zaantar.eu"
    117 
    118 #~ msgid "Options saved"
    119 #~ msgstr "Nastavení uloženo"
    120 
    121 #~ msgid "Basic information about events in multisite network."
    122 #~ msgstr "Základní informace o událostech v síti blogů."
    123 
    124 #~ msgid "List of e-mails sent by WordPress"
    125 #~ msgstr "Seznam e-mailů odeslaných WordPressem."
    126 
    127 #~ msgid "Superadmin Helper was successfully registered with WLS."
    128 #~ msgstr "Superadmin Helper byl úspěšně zaregistrován k WLS."
    129 
    130 #~ msgid "Error while trying to register Superadmin Helper with WLS."
    131 #~ msgstr "Chyba při pokusu o registraci Superadmin Helper k WLS."
    132 
    133 #~ msgid ""
    134 #~ "Superadmin Helper successfully unregistered from WLS, log entries deleted."
    135 #~ msgstr ""
    136 #~ "Superadmin Helper byl úspěšně odregistrován od WLS a logy byly smazány."
    137 
    138 #~ msgid "Error while trying to unregister Superadmin Helper from WLS"
    139 #~ msgstr "Chyba při pokusu o odregistrování Superadmin Helper od WLS."
  • superadmin-helper/tags/1.3.6/readme.txt

    r519429 r582774  
    55Requires at least: 3.1
    66Tested up to: 3.3.1
    7 Stable tag: 1.3.5
     7Stable tag: 1.3.6
    88
    99Set of utilities for managing multisite Wordpress installations. Logging, simple permban, etc.
     
    6565== Changelog ==
    6666
     67= 1.3.6 =
     68* attempts to access site from banned IPs are no longer logged (unless specified in Options menu), but attempt count and last attempt date is stored for each banned IP
     69* minor bug fixes
     70
    6771= 1.3.5 =
    6872* (important)fix: failing SUH_DB_VERSION upgrade when permban table is not already present
     
    9599= 1.2 =
    96100* first really usable version
     101
  • superadmin-helper/tags/1.3.6/superadmin-helper.php

    r519429 r582774  
    33Plugin Name: Superadmin helper
    44Description: Set of utilities for managing multisite Wordpress installations. Logging, simple permban, etc.
    5 Version: 1.3.5
     5Version: 1.3.6
    66Author: Zaantar
    77Author URI: http://zaantar.eu
    8 Donate Link: http://zaantar.eu/index.php?page=Donate
     8Donate Link: http://zaantar.eu/financni-prispevek
    99Plugin URI: http://wordpress.org/extend/plugins/superadmin-helper
    1010License: GPL2
     
    206206
    207207
    208 define( 'SUH_DB_VERSION', 3 );
     208define( 'SUH_DB_VERSION', 4 );
    209209
    210210add_action( 'plugins_loaded', 'suh_db_version_check' );
     
    215215    if( $db_version == SUH_DB_VERSION )
    216216        return;
     217    $lock_name = 'SUH_DB_VERSION_update';
    217218    if( $db_version < 2 ) {
    218219        // convert from multiple site options to one
     
    238239            suh_log( 'Removing duplicate ip entries in suh_permban_table.', 1 );
    239240            global $wpdb;
    240             $lock_name = 'SUH_DB_VERSION_update_2_to_3';
    241241            if( $wpdb->get_var( 'SELECT IS_FREE_LOCK(\''.$lock_name.'\')' ) != '1' ) {
    242242                return;
     
    253253                    $wpdb->last_error
    254254                ), 5 );
    255                 if( is_admin() ) {
     255                /*if( is_admin() ) {
    256256                    suh_nagerr( 'Database error when upgrading Superadmin Helper. Please contact plugin developer.' );
    257                 }
     257                }*/
     258                $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
    258259                return;
    259260            }
     
    265266        suh_log( 'SUH_DB_VERSION upgraded from 2 to 3.', 2 );
    266267    }
     268    if( $db_version < 4 ) {
     269        suh_log( 'Upgrading SUH_DB_VERSION from 3 to 4.', 1 );
     270        if( $permban_ready ) {
     271            global $wpdb;
     272            if( $wpdb->get_var( 'SELECT IS_FREE_LOCK(\''.$lock_name.'\')' ) != '1' ) {
     273                return;
     274            }
     275            $locked = $wpdb->get_var( 'SELECT GET_LOCK(\''.$lock_name.'\', 0)' );
     276            if( $locked != '1' ) {
     277                suh_log( 'Cannot get lock because: '.$wpdb->last_error, 1 );
     278                return;
     279            }
     280            if( $wpdb->query( "ALTER TABLE ".suh_permban_table()." ADD COLUMN (attempt_count INT DEFAULT 0, last_attempt DATETIME)" ) === FALSE ) {
     281                suh_log( sprintf ( 'MySQL while upgrading SUH_DB_VERSION.<br/>last query: "%s"<br/>result: "%s"<br/>error: %s.',
     282                    $wpdb->last_query,
     283                    print_r( $wpdb->last_result, true ),
     284                    $wpdb->last_error
     285                ), 5 );
     286                /*if( is_admin() ) {
     287                    suh_nagerr( 'Database error when upgrading Superadmin Helper. Please contact plugin developer.' );
     288                }*/
     289                $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
     290                return;
     291            }
     292            $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
     293        } else {
     294            suh_log( 'No action needed.', 1 );
     295        }
     296        $settings['db_version'] = 4;
     297        suh_update_settings( $settings );
     298        suh_log( 'SUH_DB_VERSION upgraded from 3 to 4.', 2 );
     299    }   
    267300}
    268301
  • superadmin-helper/trunk/includes/options.php

    r519392 r582774  
    186186                <tr valign="top">
    187187                    <th>
     188                        <label>Attempt to access site from banned IP</label><br />
     189                    </th>
     190                    <td>
     191                        <input type="checkbox" name="settings[log_banned_attempt]"
     192                            <?php if( $log_banned_attempt ) echo 'checked="checked"'; ?>
     193                        />
     194                    </td>
     195                    <td><small><?php _e( 'If checked, every attempt to access this site from a banned IP will be logged.', SUH_TEXTDOMAIN ); ?></small></td>
     196                </tr>
     197                <tr valign="top">
     198                    <th>
    188199                        <label><code>wp_mail</code></label><br />
    189200                    </th>
  • superadmin-helper/trunk/includes/permban.php

    r519429 r582774  
    1313            id INT NOT NULL AUTO_INCREMENT,
    1414            ip VARCHAR( 63 ) UNIQUE,
     15            attempt_count INT DEFAULT 0,
     16            last_attempt DATETIME,
    1517            PRIMARY KEY ( id )
    1618        )';
     
    9395    if( !is_user_logged_in() && suh_is_banned( $ip ) ) {
    9496        extract( suh_get_settings() );
    95         suh_log( 'Attempt to access from banned IP '.$ip.'.', 1 );
     97        if( $log_banned_attempt ) {
     98            suh_log( 'Attempt to access from banned IP '.$ip.'.', 1 );
     99            suh_increment_attempt_count( $ip );
     100        }
     101       
    96102        echo $banned_message;
    97103        exit();
    98104    }
     105}
     106
     107
     108function suh_increment_attempt_count( $ip ) {
     109    $lock_name = "suh_increment_attempt_count($ip)";
     110    global $wpdb;
     111    $locked = $wpdb->get_var( 'SELECT GET_LOCK(\''.$lock_name.'\', 0)' );
     112    if( $locked != '1' ) {
     113        return;
     114    }
     115    $wpdb->query( $wpdb->prepare( "UPDATE ".suh_permban_table()." SET attempt_count = attempt_count + 1, last_attempt = NOW() WHERE ip LIKE %s", $ip ) );
     116    $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
    99117}
    100118
     
    185203                        <td><strong><?php echo $permban->ip; ?></strong></td>
    186204                        <td>
    187                             <?php
     205                            <p>
     206                                <?php
     207                                    printf( __( "There have been %s attempts to access site from this IP since it was banned.", SUH_TEXTDOMAIN ),
     208                                        $permban->attempt_count
     209                                    );
     210                                    if( $permban->attempt_count > 0 ) {
     211                                        echo " ";
     212                                        printf( __( "Last one occured at %s.", SUH_TEXTDOMAIN ), $permban->last_attempt );
     213                                    }
     214                                ?>
     215                            </p>
     216                            <?php
    188217                                $origins = array();
    189218                                $comments = suh_get_possible_comment_authors( $permban->ip );
     
    219248                                    $entries = array();
    220249                                    foreach( $log_entries as $log_entry ) {
     250                                        $log_text = strlen( $log_entry->text ) > 150 ? substr( $log_entry->text, 0, 150 )."..." : $log_entry->text;
    221251                                        $entries[] = sprintf(
    222                                             '<tr>
    223                                                 <td>%d (%s)</td>
    224                                                 <td>
     252                                            '<tr style="border:none;">
     253                                                <td style="border:none;"><small><code>%d</code>: %s</small></td>
     254                                                <td style="border:none;">
    225255                                                    <form
    226256                                                        method="post" action="index.php?page=wls-superadmin-overview" target="_blank"
     
    231261                                                </td>
    232262                                            </tr>',
    233                                             $log_entry->id, $log_entry->text, $log_entry->id
     263                                            $log_entry->id, $log_text, $log_entry->id
    234264                                        );
    235265                                    }
    236266                                    if( !empty( $entries ) ) {
    237                                         $origins[] = 'WLS log entries concerning this IP address:<table>'.implode( '', $entries ).'</table>';
     267                                        $origins[] = 'WLS log entries concerning this IP address:<table style="border:none;">'.implode( '', $entries ).'</table>';
    238268                                    }
    239269                                }
  • superadmin-helper/trunk/languages/superadmin-helper-cs_CZ.po

    r508144 r582774  
    22msgstr ""
    33"Project-Id-Version: Superadmin Helper\n"
    4 "Report-Msgid-Bugs-To: http://wordpress.org/tag/superadmin-helper\n"
    5 "POT-Creation-Date: 2012-01-23 08:22:27+00:00\n"
    6 "PO-Revision-Date: 2012-01-23 09:30+0100\n"
     4"Report-Msgid-Bugs-To: \n"
     5"POT-Creation-Date: 2011-12-20 12:38+0100\n"
     6"PO-Revision-Date: 2011-12-20 13:03+0100\n"
    77"Last-Translator: Zaantar <zaantar@zaantar.eu>\n"
    88"Language-Team: \n"
     
    1515"X-Poedit-SearchPath-0: .\n"
    1616
    17 #. #-#-#-#-#  plugin.pot (Superadmin helper 1.3.2)  #-#-#-#-#
    18 #. Plugin Name of the plugin/theme
     17#: superadmin-helper.php:50
     18#: superadmin-helper.php:61
     19msgid "Superadmin helper settings"
     20msgstr "Nastavení Superadmin Helper"
     21
    1922#: superadmin-helper.php:51
    2023#: superadmin-helper.php:62
     
    2225msgstr "Superadmin Helper"
    2326
    24 #: superadmin-helper.php:61
    25 msgid "Superadmin helper settings"
    26 msgstr "Nastavení Superadmin Helper"
     27#: superadmin-helper.php:77
     28msgid "Options saved"
     29msgstr "Nastavení uloženo"
     30
     31#: superadmin-helper.php:81
     32msgid "Basic information about events in multisite network."
     33msgstr "Základní informace o událostech v síti blogů."
     34
     35#: superadmin-helper.php:82
     36msgid "List of e-mails sent by WordPress"
     37msgstr "Seznam e-mailů odeslaných WordPressem."
     38
     39#: superadmin-helper.php:85
     40msgid "Superadmin Helper was successfully registered with WLS."
     41msgstr "Superadmin Helper byl úspěšně zaregistrován k WLS."
     42
     43#: superadmin-helper.php:89
     44msgid "Error while trying to register Superadmin Helper with WLS."
     45msgstr "Chyba při pokusu o registraci Superadmin Helper k WLS."
     46
     47#: superadmin-helper.php:100
     48msgid "Superadmin Helper successfully unregistered from WLS, log entries deleted."
     49msgstr "Superadmin Helper byl úspěšně odregistrován od WLS a logy byly smazány."
     50
     51#: superadmin-helper.php:104
     52msgid "Error while trying to unregister Superadmin Helper from WLS"
     53msgstr "Chyba při pokusu o odregistrování Superadmin Helper od WLS."
    2754
    2855#: superadmin-helper.php:120
     
    4774
    4875#: superadmin-helper.php:150
    49 #: superadmin-helper.php:585
    50 #: superadmin-helper.php:592
    51 #: superadmin-helper.php:635
     76#: superadmin-helper.php:580
     77#: superadmin-helper.php:587
     78#: superadmin-helper.php:630
    5279msgid "Permban"
    5380msgstr "Permban"
     
    77104msgstr "Primární blog"
    78105
    79 #: superadmin-helper.php:438
     106#: superadmin-helper.php:437
    80107msgid "Last login"
    81108msgstr "Poslední přihlášení"
    82109
    83 #: superadmin-helper.php:640
    84 #: superadmin-helper.php:648
     110#: superadmin-helper.php:635
     111#: superadmin-helper.php:643
    85112msgid "IP address"
    86113msgstr "IP adresa"
    87114
    88 #: superadmin-helper.php:641
    89 #: superadmin-helper.php:649
     115#: superadmin-helper.php:636
     116#: superadmin-helper.php:644
    90117msgid "Notes"
    91118msgstr "Poznámky"
    92119
    93 #: superadmin-helper.php:642
    94 #: superadmin-helper.php:650
     120#: superadmin-helper.php:637
     121#: superadmin-helper.php:645
    95122msgid "Action"
    96123msgstr "Akce"
    97124
    98 #: superadmin-helper.php:663
     125#: superadmin-helper.php:658
    99126msgid "Possible origins of attack / affected visitors"
    100127msgstr "Možné původy útoku nebo postižení návštěvníci"
    101128
    102 #. Plugin URI of the plugin/theme
    103 msgid "http://zaantar.eu/index.php?page=superadmin-helper"
    104 msgstr ""
    105 
    106 #. Description of the plugin/theme
    107 msgid "Sada utilit pro zjednodušení správy sítě blogů. Superadministrátorský plugin. <strong>Vyvinuto a určeno pro blogosphere.cz</strong>"
    108 msgstr ""
    109 
    110 #. Author of the plugin/theme
    111 msgid "Zaantar"
    112 msgstr "Zaantar"
    113 
    114 #. Author URI of the plugin/theme
    115 msgid "http://zaantar.eu"
    116 msgstr "http://zaantar.eu"
    117 
    118 #~ msgid "Options saved"
    119 #~ msgstr "Nastavení uloženo"
    120 
    121 #~ msgid "Basic information about events in multisite network."
    122 #~ msgstr "Základní informace o událostech v síti blogů."
    123 
    124 #~ msgid "List of e-mails sent by WordPress"
    125 #~ msgstr "Seznam e-mailů odeslaných WordPressem."
    126 
    127 #~ msgid "Superadmin Helper was successfully registered with WLS."
    128 #~ msgstr "Superadmin Helper byl úspěšně zaregistrován k WLS."
    129 
    130 #~ msgid "Error while trying to register Superadmin Helper with WLS."
    131 #~ msgstr "Chyba při pokusu o registraci Superadmin Helper k WLS."
    132 
    133 #~ msgid ""
    134 #~ "Superadmin Helper successfully unregistered from WLS, log entries deleted."
    135 #~ msgstr ""
    136 #~ "Superadmin Helper byl úspěšně odregistrován od WLS a logy byly smazány."
    137 
    138 #~ msgid "Error while trying to unregister Superadmin Helper from WLS"
    139 #~ msgstr "Chyba při pokusu o odregistrování Superadmin Helper od WLS."
  • superadmin-helper/trunk/readme.txt

    r519429 r582774  
    55Requires at least: 3.1
    66Tested up to: 3.3.1
    7 Stable tag: 1.3.5
     7Stable tag: 1.3.6
    88
    99Set of utilities for managing multisite Wordpress installations. Logging, simple permban, etc.
     
    6565== Changelog ==
    6666
     67= 1.3.6 =
     68* attempts to access site from banned IPs are no longer logged (unless specified in Options menu), but attempt count and last attempt date is stored for each banned IP
     69* minor bug fixes
     70
    6771= 1.3.5 =
    6872* (important)fix: failing SUH_DB_VERSION upgrade when permban table is not already present
     
    9599= 1.2 =
    96100* first really usable version
     101
  • superadmin-helper/trunk/superadmin-helper.php

    r519429 r582774  
    33Plugin Name: Superadmin helper
    44Description: Set of utilities for managing multisite Wordpress installations. Logging, simple permban, etc.
    5 Version: 1.3.5
     5Version: 1.3.6
    66Author: Zaantar
    77Author URI: http://zaantar.eu
    8 Donate Link: http://zaantar.eu/index.php?page=Donate
     8Donate Link: http://zaantar.eu/financni-prispevek
    99Plugin URI: http://wordpress.org/extend/plugins/superadmin-helper
    1010License: GPL2
     
    206206
    207207
    208 define( 'SUH_DB_VERSION', 3 );
     208define( 'SUH_DB_VERSION', 4 );
    209209
    210210add_action( 'plugins_loaded', 'suh_db_version_check' );
     
    215215    if( $db_version == SUH_DB_VERSION )
    216216        return;
     217    $lock_name = 'SUH_DB_VERSION_update';
    217218    if( $db_version < 2 ) {
    218219        // convert from multiple site options to one
     
    238239            suh_log( 'Removing duplicate ip entries in suh_permban_table.', 1 );
    239240            global $wpdb;
    240             $lock_name = 'SUH_DB_VERSION_update_2_to_3';
    241241            if( $wpdb->get_var( 'SELECT IS_FREE_LOCK(\''.$lock_name.'\')' ) != '1' ) {
    242242                return;
     
    253253                    $wpdb->last_error
    254254                ), 5 );
    255                 if( is_admin() ) {
     255                /*if( is_admin() ) {
    256256                    suh_nagerr( 'Database error when upgrading Superadmin Helper. Please contact plugin developer.' );
    257                 }
     257                }*/
     258                $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
    258259                return;
    259260            }
     
    265266        suh_log( 'SUH_DB_VERSION upgraded from 2 to 3.', 2 );
    266267    }
     268    if( $db_version < 4 ) {
     269        suh_log( 'Upgrading SUH_DB_VERSION from 3 to 4.', 1 );
     270        if( $permban_ready ) {
     271            global $wpdb;
     272            if( $wpdb->get_var( 'SELECT IS_FREE_LOCK(\''.$lock_name.'\')' ) != '1' ) {
     273                return;
     274            }
     275            $locked = $wpdb->get_var( 'SELECT GET_LOCK(\''.$lock_name.'\', 0)' );
     276            if( $locked != '1' ) {
     277                suh_log( 'Cannot get lock because: '.$wpdb->last_error, 1 );
     278                return;
     279            }
     280            if( $wpdb->query( "ALTER TABLE ".suh_permban_table()." ADD COLUMN (attempt_count INT DEFAULT 0, last_attempt DATETIME)" ) === FALSE ) {
     281                suh_log( sprintf ( 'MySQL while upgrading SUH_DB_VERSION.<br/>last query: "%s"<br/>result: "%s"<br/>error: %s.',
     282                    $wpdb->last_query,
     283                    print_r( $wpdb->last_result, true ),
     284                    $wpdb->last_error
     285                ), 5 );
     286                /*if( is_admin() ) {
     287                    suh_nagerr( 'Database error when upgrading Superadmin Helper. Please contact plugin developer.' );
     288                }*/
     289                $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
     290                return;
     291            }
     292            $wpdb->query( 'SELECT RELEASE_LOCK(\''.$lock_name.'\')' );
     293        } else {
     294            suh_log( 'No action needed.', 1 );
     295        }
     296        $settings['db_version'] = 4;
     297        suh_update_settings( $settings );
     298        suh_log( 'SUH_DB_VERSION upgraded from 3 to 4.', 2 );
     299    }   
    267300}
    268301
Note: See TracChangeset for help on using the changeset viewer.