Plugin Directory

Changeset 1229768


Ignore:
Timestamp:
08/25/2015 01:47:40 AM (11 years ago)
Author:
maxwellberkel
Message:

Release 0.12.3 ready

Location:
wp-log-viewer
Files:
32 added
6 edited

Legend:

Unmodified
Added
Removed
  • wp-log-viewer/trunk/libs/Auth.php

    r1226150 r1229768  
    1 <?php 
    2    
     1<?php
     2
    33namespace Allbitsnbytes\WPLogViewer;
    44
     
    2222 */
    2323class Auth {
    24    
     24
    2525    use IsSingleton;
    26    
     26
    2727    /**
    2828     * Database session prefix
     
    3333     */
    3434    const DB_SESS_PREFIX = '_wplv_sess_';
    35    
     35
    3636    /**
    3737     * Database session user prefix
     
    4242     */
    4343    const DB_SESS_USER_PREFIX = '_wplv_usr_';
    44    
     44
    4545    /**
    4646     * Prefix to use for session cookie
     
    5151     */
    5252    const COOKIE_PREFIX = 'wordpress_logged_in_';
    53    
     53
    5454    /**
    5555     * Length of generated keys
     
    6060     */
    6161    const KEY_LENGTH = 40;
    62    
     62
    6363    /**
    6464     * Cookie token length
     
    6969     */
    7070    const COOKIE_TOKEN_LENGTH = 25;
    71    
     71
    7272    /**
    7373     * Authenticate code
    74      * 
     74     *
    7575     * Authentication will check for cookie token and session key, then use session key to check for api key
    7676     *
     
    8080     */
    8181    const AUTHENTICATED = 2;
    82    
     82
    8383    /**
    8484     * Skip authentication code
    85      * 
     85     *
    8686     * Allow request through
    8787     *
     
    9191     */
    9292    const SKIP = 1;
    93    
     93
    9494    /**
    9595     * Check if user credentials are valid
     
    103103    public function is_valid_login($username, $password) {
    104104        global $wpdb;
    105        
     105
    106106        // TODO
    107107    }
    108    
     108
    109109
    110110    /**
     
    118118    public function create_user_session($username) {
    119119        global $wpdb;
    120        
     120
    121121        // TODO
    122122    }
    123    
    124    
     123
     124
    125125    /**
    126126     * Remove session for an authenticated user
     
    133133    public function clear_user_session($username) {
    134134        global $wpdb;
    135        
     135
    136136        // TODO
    137137    }
    138    
    139    
     138
     139
    140140    /**
    141141     * Check if a authenticated session is in use
     
    154154            $id = $wpdb->get_var($wpdb->prepare($sql, self::DB_SESS_PREFIX . $cookie_token));
    155155
    156             return intval($id) > 0 ? true : false; 
     156            return intval($id) > 0 ? true : false;
    157157        }
    158158
     
    171171    public function create_api_session($user_id) {
    172172        global $wpdb;
     173
     174        $this->clear_api_session();
    173175
    174176        $api_key = $this->get_api_key($user_id);
     
    238240    public function get_api_session($user_id) {
    239241        global $wpdb;
    240        
     242
    241243        $info = [
    242244            'api_key'       => $this->get_api_key($user_id),
     
    256258    /**
    257259     * Get session key from cookie
    258      * 
     260     *
    259261     * If no session key is found an empty string will be returned
    260262     *
     
    268270        return isset($_COOKIE[self::COOKIE_PREFIX . $cookie_token]) ? $_COOKIE[self::COOKIE_PREFIX . $cookie_token] : '';
    269271    }
    270    
    271    
     272
     273
    272274    /**
    273275     * Get cookie key token
     
    285287            }
    286288        }
    287        
     289
    288290        return '';
    289291    }
     
    293295     * Get user api key
    294296     *
    295      * If user doesn't have an api key, generate a new one 
     297     * If user doesn't have an api key, generate a new one
    296298     *
    297299     * @since 0.1.0
     
    303305        global $wpdb;
    304306
    305         if (is_int($user_id) && $user_id > 0) {     
     307        if (is_int($user_id) && $user_id > 0) {
    306308            $sql = 'select meta_value from ' . $wpdb->usermeta . ' where meta_key="wplv_api_key" and user_id=%d';
    307309            $api_key = $wpdb->get_var($wpdb->prepare($sql, $user_id));
  • wp-log-viewer/trunk/libs/Plugin.php

    r1226734 r1229768  
    3333     */
    3434    public function init() {
    35         if ((!defined('DOING_AJAX') || (defined('DOING_AJAX') && !DOING_AJAX)) && isset($_COOKIE['wplv_logged_in'])) {
    36             $auth = Auth::get_instance();
    37             $auth->clear_api_session();
    38             setcookie('wplv_logged_in', null, -1);
    39         }
    40 
    4135        // Register actions
    4236        add_action('admin_menu', [$this, 'add_navigation']);
     
    8276            $localized['session_key']   = $wp_session_info['session_key'];
    8377
    84             if ($auth->create_api_session($user_id)) {
    85                 $expires = time() + (200 * WEEK_IN_SECONDS);
    86                 setcookie('wplv_logged_in', $wp_session_info['cookie_token'], $expires, '/', $_SERVER['SERVER_NAME'], false, true);
    87             }
     78            $auth->create_api_session($user_id);
    8879        }
    8980
  • wp-log-viewer/trunk/libs/Router.php

    r1226150 r1229768  
    1 <?php 
    2    
     1<?php
     2
    33namespace Allbitsnbytes\WPLogViewer;
    44
     
    2525 */
    2626class Router {
    27    
     27
    2828    use IsSingleton;
    29    
     29
    3030    /**
    3131     * @var array Registered handlers
     
    8383        return isset($_REQUEST['do']) ? filter_var($_REQUEST['do'], FILTER_SANITIZE_STRING) : '';
    8484    }
    85    
    86    
     85
     86
    8787    /**
    8888     * Get parameters sent in the request
     
    9494    private function get_params() {
    9595        $params = $_REQUEST;
    96        
     96
    9797        unset($params['do']);
    98        
     98
    9999        return $params;
    100100    }
    101101
    102    
     102
    103103    /**
    104104     * Register an action and handler
     
    114114            $this->handlers[$action] = [];
    115115        }
    116        
     116
    117117        if (is_array($handler) && isset($handler['method']) && isset($handler['call']) && isset($handler['auth']) && is_callable($handler['call'])) {
    118118            $this->handlers[$action][] = $handler;
    119119        }
    120120    }
    121    
    122    
     121
     122
    123123    /**
    124124     * Register a GET handler
     
    138138        ]);
    139139    }
    140    
    141    
     140
     141
    142142    /**
    143143     * Register a POST handler
     
    208208        if ($handled === 0) {
    209209            $response->set_code(404);
    210         } 
     210        }
    211211
    212212        $response->send();
  • wp-log-viewer/trunk/readme.txt

    r1227245 r1229768  
    33License: GPLv3
    44License URI: http://www.gnu.org/licenses/gpl.html
    5 Tags: wordpress, debugging, log viewer, debug, log, error_log, debug.log
     5Tags: wordpress, debugging, log viewer, debug, log, error_log, debug.log, admin
    66Requires at least: 3.9
    77Tested up to: 4.3
    8 Stable tag: 0.12.2
     8Stable tag: 0.12.3
    99
    1010Easily search, sort and group log entries.  Click the log file with one click.  See new errors automatically without refreshing.
     
    130130All notable changes will be tracked in this change log.
    131131
     132= 0.12.3 =
     133Release date: 2015-08-24
     134
     135* Fix:
     136    * Fixed a bug that cause plugin to not load  based on certain server configurations
     137
    132138= 0.12.2 =
    133139Release date: 2015-08-20
  • wp-log-viewer/trunk/wp-log-viewer.php

    r1226734 r1229768  
    1010 * Plugin URI:  https://github.com/allbitsnbytes/wp-log-viewer
    1111 * Description: Wordpress debug log viewer plugin
    12  * Version:     0.12.2
     12 * Version:     0.12.3
    1313 * Author:      Maxwell Berkel
    1414 * Author URI:  http://allbitsnbytes.com
Note: See TracChangeset for help on using the changeset viewer.