Plugin Directory

Changeset 2978053


Ignore:
Timestamp:
10/12/2023 10:37:44 AM (2 years ago)
Author:
wedos
Message:

Compatibility, Logging, Verification

Location:
wgpwpp/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wgpwpp/trunk/README.txt

    r2971788 r2978053  
    55Requires at least: 5.6
    66Tested up to: 6.3
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    120120
    121121== Changelog ==
     122= v1.0.2 =
     123
     124* Web server compatibility improvements
     125* Logging improvements
     126* Minor adjustments to the verification process
     127
    122128= v1.0.1 =
    123129
  • wgpwpp/trunk/admin/class-wgpwpp-verification.php

    r2971707 r2978053  
    140140    public function generate_verification_header($user, string $random): string
    141141    {
    142         $state_data = sprintf(
    143             '%s-%s-%s-%d-%d',
    144             $this->plugin->get_plugin_name(),
    145             $random,
    146             $user->get('user_login'),
    147             $user->get('id'),
    148             time() + self::VERIFICATION_REQUEST_EXPIRATION
    149         );
     142    $state_data = sprintf(
     143      '%s-%s-%s-%d-%d-%s',
     144      $this->plugin->get_plugin_name(),
     145      $random,
     146      $user->get('user_login'),
     147      $user->get('id'),
     148      time() + self::VERIFICATION_REQUEST_EXPIRATION,
     149      get_rest_url()
     150    );
    150151
    151152        $state = base64_encode($state_data);
     
    248249
    249250        $data = explode('-', $code);
    250         if (count($data) !== 5)
     251    if (count($data) < 5)
    251252        {
    252253      $this->log('Invalid verification request - invalid verification code', $code, Wgpwpp_Log::TYPE_ERROR);
     
    379380                'code'  => 2004,
    380381                'msg'   => 'Failed to send verification email!',
     382        'data'  => [
     383          'challenge' => $code['challenge'],
     384        ],
    381385            ];
    382386        }
  • wgpwpp/trunk/admin/css/wgpwpp-admin.css

    r2971707 r2978053  
    1010.wgpwpp-service-info-table {
    1111    margin-top: 20px;
    12     border: 1px solid black;
    1312    border-collapse: collapse;
    1413}
  • wgpwpp/trunk/includes/class-wgpwpp-log.php

    r2971707 r2978053  
    6262   * @return string
    6363   */
    64   private function get_log_header()
    65   {
    66     $header = 'PHP Version: '.$this->plugin->get_php_version().PHP_EOL;
     64  private function get_log_header(): string
     65  {
     66    $header = "Server info:".PHP_EOL;
     67    $header .= "============".PHP_EOL;
     68    $header .= print_r($_SERVER, true).PHP_EOL.PHP_EOL;
     69
     70    $header .= "WordPress info:".PHP_EOL;
     71    $header .= "===============".PHP_EOL;
     72    $header .= 'PHP Version: '.$this->plugin->get_php_version().PHP_EOL;
    6773    $header .= 'WordPress Version: '.$this->plugin->get_wp_version().PHP_EOL;
    6874    $header .= 'WordPress Admin E-mail: '.$this->plugin->get_admin_email().PHP_EOL;
     
    7076    $header .= 'WordPress Domain: '.$this->plugin->get_host().PHP_EOL;
    7177    $header .= 'WGPWPP Version: '.$this->plugin->get_version().PHP_EOL;
    72     $header .= 'WGPWPP URL: '.$this->plugin->get_admin_page_url().PHP_EOL;
     78    $header .= 'WGPWPP URL: '.$this->plugin->get_admin_page_url().PHP_EOL.PHP_EOL;
     79
     80    $service = $this->plugin->get_service();
     81    $header .= "Service info:".PHP_EOL;
     82    $header .= "=============".PHP_EOL;
     83    $header .= "Service name: ".$service->get_service_name().PHP_EOL;
     84    $header .= "Service TLD: ".$service->get_service_tld().PHP_EOL;
     85    $header .= "Service state: ".$service->get_service_state().PHP_EOL;
     86    $header .= "Service state data: ".print_r($service->get_service_state_data(), true).PHP_EOL;
     87
    7388    return $header;
    7489  }
     
    166181  public function download(): bool
    167182  {
     183    $header = $this->get_log_header().PHP_EOL;
     184    $header .= "Log:".PHP_EOL;
     185    $header .= "====".PHP_EOL.PHP_EOL;
     186
    168187    $log = $this->plugin->option->get(Wgpwpp_Option::OPTION_LOG);
    169188    if (!is_array($log))
     
    175194    if (is_wp_error($hostname))
    176195      return false;
     196
     197    $log = $header.$log;
    177198
    178199    $filename = 'wgpwpp-'.str_replace('.', '-', $hostname).'.log';
     
    201222  public function send_log()
    202223  {
     224    $header = $this->get_log_header().PHP_EOL;
     225    $header .= "Log:".PHP_EOL;
     226    $header .= "====".PHP_EOL.PHP_EOL;
     227
    203228    $log = $this->plugin->option->get(Wgpwpp_Option::OPTION_LOG);
    204229    if (!is_array($log))
     
    214239
    215240    $msg = "WGP WordPress Plugin - DEBUG report".PHP_EOL.PHP_EOL;
    216     $msg .= "WordPress info:".PHP_EOL;
    217     $msg .= $this->get_log_header().PHP_EOL;
    218 
    219     $service = $this->plugin->get_service();
    220     $msg .= "Service info:".PHP_EOL;
    221     $msg .= "Service name: ".$service->get_service_name().PHP_EOL;
    222     $msg .= "Service TLD: ".$service->get_service_tld().PHP_EOL;
    223     $msg .= "Service state: ".$service->get_service_state().PHP_EOL;
    224     $msg .= "Service state data: ".print_r($service->get_service_state_data(), true).PHP_EOL;
    225 
    226     $msg .= PHP_EOL.$log;
     241    $msg .= $header.$log;
    227242
    228243    $headers = [
  • wgpwpp/trunk/wgpwpp.php

    r2971757 r2978053  
    1717 * Plugin URI:        https://www.wedos.global/protection/wp-plugin
    1818 * Description:       Activate and use the WEDOS Global Protection service. WEDOS Global Protection brings global security for your WordPress website, ensures low latency and minimal loading time.
    19  * Version:           1.0.1
     19 * Version:           1.0.2
    2020 * Requires at least: 5.6
    2121 * Requires PHP:      7.4
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 const WGPWPP_VERSION = '1.0.1';
     40const WGPWPP_VERSION = '1.0.2';
    4141const WGPWPP_PLUGIN_NAME = 'wgpwpp';
    4242const WGPWPP_PLUGIN_FILE = __FILE__;
Note: See TracChangeset for help on using the changeset viewer.