Plugin Directory

Changeset 671947


Ignore:
Timestamp:
02/22/2013 10:12:17 PM (13 years ago)
Author:
Potsky
Message:

v0.3.6

Location:
s2member-secure-file-browser
Files:
79 added
5 edited

Legend:

Unmodified
Added
Removed
  • s2member-secure-file-browser/trunk/class/psk_s2msfb.admin.stats.class.php

    r669185 r671947  
    7979
    8080        global $wpdb;
     81
    8182        $tablename = $wpdb->prefix . PSK_S2MSFB_DB_DOWNLOAD_TABLE_NAME;
    82         $sql       = "SELECT userid,useremail,ip,UNIX_TIMESTAMP(created),filepath FROM $tablename ORDER BY created DESC";
    83         $result    = $wpdb->get_results( $sql , ARRAY_A );
    84 
    85         foreach (get_users() as $user)
    86             $users[$user->ID] = $user->display_name;
    87 
    88 
    89         if (count($result)==0) {
     83        $where     = ( isset( $_GET['t'] ) ) ? 'WHERE created > NOW() - INTERVAL ' . (int) $_GET['t'] . ' DAY' : '';
     84
     85        $sql    = "SELECT COUNT(DISTINCT userid) FROM $tablename $where";
     86        $duser  = $wpdb->get_row( $sql , ARRAY_N );
     87        $duser  = $duser[0];
     88
     89        $sql    = "SELECT COUNT(DISTINCT filepath) FROM $tablename $where";
     90        $dfile  = $wpdb->get_row( $sql , ARRAY_N );
     91        $dfile  = $dfile[0];
     92
     93        $sql    = "SELECT userid,useremail,ip,UNIX_TIMESTAMP(created),filepath FROM $tablename $where ORDER BY created DESC";
     94        $result = $wpdb->get_results( $sql , ARRAY_A );
     95        $cresul = count($result);
     96
     97        $link      = '?page=' . $_GET['page'];
     98
     99        if ( $cresul == 0 ) {
    90100            echo '<div class="alert alert-error">' . __("No download",S2MSFB_ID) . '</div>';
    91101        }
    92         else {
     102
     103        echo '<div class="btn-group">';
     104        echo '    <button class="btn btn-primary btn-mini dropdown-toggle" data-toggle="dropdown">' . __( 'Display' , 'PSK_S2MSFB_ID' ).' <span class="caret"></span></button>';
     105        echo '    <ul class="dropdown-menu">';
     106        echo '      <li><a href="' . $link . '">' . __('all records',PSK_S2MSFB_ID) . '</a></li>';
     107        echo '      <li class="divider"></li>';
     108        echo '      <li><a href="' . $link . '&t=1">' . __('one day',PSK_S2MSFB_ID) . '</a></li>';
     109        echo '      <li><a href="' . $link . '&t=7">' . __('one week',PSK_S2MSFB_ID) . '</a></li>';
     110        echo '      <li><a href="' . $link . '&t=31">' . __('one month',PSK_S2MSFB_ID) . '</a></li>';
     111        echo '      <li><a href="' . $link . '&t=365">' . __('one year',PSK_S2MSFB_ID) . '</a></li>';
     112        echo '    </ul>';
     113        echo '</div>';
     114
     115        if ( $cresul > 0 ) {
     116
     117            foreach (get_users() as $user)
     118                $users[$user->ID] = $user->display_name;
     119
     120            echo '&nbsp;&nbsp;&nbsp;';
     121            switch (@$_GET['t']) {
     122                case '1':
     123                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for 24 hours' , PSK_S2MSFB_ID ) , $dfile, $cresul, $duser);
     124                    break;
     125                case '7':
     126                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one week' , PSK_S2MSFB_ID ) , $dfile, $cresul, $duser);
     127                    break;
     128                case '31':
     129                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one month' , PSK_S2MSFB_ID ) , $dfile, $cresul, $duser);
     130                    break;
     131                case '365':
     132                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one year' , PSK_S2MSFB_ID ) , $dfile, $cresul, $duser);
     133                    break;
     134                default:
     135                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s)' , PSK_S2MSFB_ID ) , $dfile, $cresul, $duser);
     136                    break;
     137            }
     138            echo '<br/>';
     139
    93140            echo '<table class="table sort table-bordered table-hover table-condensed">';
    94141            echo '<thead><tr>';
     
    124171            echo '</tfoot>';
    125172            echo '<tbody>';
     173
    126174            foreach($result as $row) {
     175
    127176                $time = (int)$row['UNIX_TIMESTAMP(created)'];
    128177                $time+= get_option('gmt_offset') * 3600;
     
    144193                echo '</tr>';
    145194            }
     195
    146196            echo '</tbody>';
    147197            echo '</table>';
     
    165215        $tablename = $wpdb->prefix . PSK_S2MSFB_DB_DOWNLOAD_TABLE_NAME;
    166216        $where     = ( isset( $_GET['t'] ) ) ? 'WHERE created > NOW() - INTERVAL ' . (int) $_GET['t'] . ' DAY' : '';
     217
     218        $sql       = "SELECT COUNT(DISTINCT userid) FROM $tablename $where";
     219        $duser     = $wpdb->get_row( $sql , ARRAY_N );
     220        $duser     = $duser[0];
     221
     222        $sql       = "SELECT COUNT(DISTINCT filepath) FROM $tablename $where";
     223        $dfile     = $wpdb->get_row( $sql , ARRAY_N );
     224        $dfile     = $dfile[0];
     225
     226        $sql       = "SELECT COUNT(*) FROM $tablename $where";
     227        $cresult   = $wpdb->get_row( $sql , ARRAY_N );
     228        $cresult   = $cresult[0];
     229
    167230        $sql       = "SELECT filepath, COUNT(*) A FROM $tablename $where GROUP BY filepath ORDER BY A DESC";
    168231        $result    = $wpdb->get_results( $sql , ARRAY_A );
     232
    169233        $total     = 0;
    170234        $link      = '?page=' . $_GET['page'];
    171235
    172         if (count($result)==0) {
     236        if ( count($result) == 0 ) {
    173237            echo '<div class="alert alert-error">' . __("No download",S2MSFB_ID) . '</div>';
    174238        }
     
    187251
    188252        if (count($result)>0) {
     253
     254            echo '&nbsp;&nbsp;&nbsp;';
     255            switch ($_GET['t']) {
     256                case '1':
     257                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for 24 hours' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     258                    break;
     259                case '7':
     260                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one week' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     261                    break;
     262                case '31':
     263                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one month' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     264                    break;
     265                case '365':
     266                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one year' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     267                    break;
     268                default:
     269                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s)' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     270                    break;
     271            }
     272            echo '<br/>';
     273
    189274            echo '<table class="table sortn table-bordered table-hover table-condensed">';
    190275            echo '<thead><tr>';
     
    193278            echo '</tr></thead>';
    194279            echo '<tbody>';
     280
    195281            foreach($result as $row) {
    196282                echo '<tr>';
     
    200286                $total += (int)$row['A'];
    201287            }
     288
    202289            echo '</tbody>';
    203290            echo '<tfoot>';
     
    242329        global $wpdb;
    243330
    244         foreach (get_users() as $user)
    245             $users[$user->ID] = $user->display_name;
    246 
    247331        $tablename = $wpdb->prefix . PSK_S2MSFB_DB_DOWNLOAD_TABLE_NAME;
    248332        $where     = ( isset( $_GET['t'] ) ) ? 'WHERE created > NOW() - INTERVAL ' . (int) $_GET['t'] . ' DAY' : '';
     333
     334        $sql       = "SELECT COUNT(DISTINCT userid) FROM $tablename $where";
     335        $duser     = $wpdb->get_row( $sql , ARRAY_N );
     336        $duser     = $duser[0];
     337
     338        $sql       = "SELECT COUNT(DISTINCT filepath) FROM $tablename $where";
     339        $dfile     = $wpdb->get_row( $sql , ARRAY_N );
     340        $dfile     = $dfile[0];
     341
     342        $sql       = "SELECT COUNT(*) FROM $tablename $where";
     343        $cresult   = $wpdb->get_row( $sql , ARRAY_N );
     344        $cresult   = $cresult[0];
     345
    249346        $sql       = "SELECT userid, COUNT(*) A FROM $tablename $where GROUP BY userid ORDER BY A DESC";
    250347        $result    = $wpdb->get_results( $sql , ARRAY_A );
     348
    251349        $total     = 0;
    252350        $link      = '?page=' . $_GET['page'];
     
    269367
    270368        if (count($result)>0) {
     369
     370            foreach (get_users() as $user)
     371                $users[$user->ID] = $user->display_name;
     372
     373            echo '&nbsp;&nbsp;&nbsp;';
     374            switch ($_GET['t']) {
     375                case '1':
     376                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for 24 hours' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     377                    break;
     378                case '7':
     379                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one week' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     380                    break;
     381                case '31':
     382                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one month' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     383                    break;
     384                case '365':
     385                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s) for one year' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     386                    break;
     387                default:
     388                    echo sprintf( __( '%1$s distinct file(s) downloaded %2$s time(s) by %3$s distinct user(s)' , PSK_S2MSFB_ID ) , $dfile, $cresult, $duser);
     389                    break;
     390            }
     391            echo '<br/>';
     392
    271393            echo '<table class="table sortn table-bordered table-hover table-condensed">';
    272394            echo '<thead><tr>';
     
    275397            echo '</tr></thead>';
    276398            echo '<tbody>';
     399
    277400            foreach($result as $row) {
    278401                if (isset($users[$row['userid']])) {
     
    289412                $total += (int)$row['A'];
    290413            }
    291 
    292414
    293415            echo '</tbody>';
  • s2member-secure-file-browser/trunk/class/psk_s2msfb.widgets.class.php

    r669185 r671947  
    442442                $r.= ( $display_icon == 'u' ) ? '<img style="float:left;width:32px;height:32px;margin-right:5px;margin-top:5px;border:1px solid #888;" src="' . PSK_Tools::get_avatar_url($user_id,32) . '" />' : '';
    443443                $r.= ( $display_icon == 'f' ) ? '<img style="float:left;width:16px;height:16px;margin-right:5px;margin-top:2px;border:0;" src="' . PSK_S2MSFB_IMG_URL . PSK_Tools::get_file_icon($file_path) . '" />' : '';
    444                 $r.= '<span style="word-wrap:break-word;font-weight:bold;">';
     444                $r.= '<span style="font-size:11px;word-wrap:break-word;font-weight:bold;">';
    445445                $r.= $file . '</span>';
    446446                $r.= ($show_filepath) ? '<br/><small>' . sprintf( __( 'in %s' , PSK_S2MSFB_ID ) , $path ) . '</small>' : '';
     
    622622                $r.= '<li style="padding-top:4px;">';
    623623                $r.= ( $display_icon == 'f' ) ? '<img style="float:left;width:16px;height:16px;margin-right:5px;margin-top:2px;border:0;" src="' . PSK_S2MSFB_IMG_URL . PSK_Tools::get_file_icon($file_path) . '" />' : '';
    624                 $r.= '<span style="word-wrap:break-word;font-weight:bold;">';
     624                $r.= '<span style="font-size:11px;word-wrap:break-word;font-weight:bold;">';
    625625                $r.= $file . '</span>';
    626626                $r.= ($show_filepath) ? '<br/><small>' . sprintf( __( 'in %s' , PSK_S2MSFB_ID ) , $path ) . '</small>' : '';
  • s2member-secure-file-browser/trunk/css/jqueryFileTree.css

    r653734 r671947  
    125125.jqueryFileTree LI.ext_tar  A.link { background: url(../img/zip.png) left top no-repeat; }
    126126.jqueryFileTree LI.ext_gz  A.link { background: url(../img/zip.png) left top no-repeat; }
     127.jqueryFileTree LI.ext_vsa  A.link { background: url(../img/vsa.png) left top no-repeat; }
    127128
  • s2member-secure-file-browser/trunk/inc/tools.class.php

    r669185 r671947  
    109109            'tar'   => 'zip.png',
    110110            'gz'    => 'zip.png',
     111            'vsa'    => 'vsa.png',
    111112        );
    112113
  • s2member-secure-file-browser/trunk/readme.txt

    r669202 r671947  
    55Requires at least: 3.3
    66Tested up to: 3.5.1
    7 Stable tag: 0.3.5
     7Stable tag: 0.3.6
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    135135Yes ! `And access-s2member-ccap*` too !
    136136
     137= The browser does not work, it displays `Invalid nonce` for registered users. =
     138
     139The authentication on your website is broken because of a plugin (AJAX requests not correctly handled).
     140This behaviour is correct and it is protecting your files !
     141It happens for example when your authentication is only performed in a HTTPS form and the navigation is done in HTTP.
     142If you use the `Wordpress HTTP` plugin from http://mvied.com/projects/wordpress-https/ for example, you have to force HTTPS on each page which includes the s2member Secure File browser.
     143
    137144
    138145== What's next? ==
     
    161168
    162169== Changelog ==
     170
     171= 0.3.6 =
     172* Enhancement : Add admin statistics (total downloads, unique files and unique downloaders)
     173* Enhancement : Add FAQ "Invalid Nonce"
     174* Enhancement : Add vsa file extension
    163175
    164176= 0.3.5 =
Note: See TracChangeset for help on using the changeset viewer.