Plugin Directory

Changeset 1484143


Ignore:
Timestamp:
08/26/2016 02:02:30 PM (10 years ago)
Author:
piotrmocko
Message:

Version 2.0.3

Location:
pwebonedrive/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pwebonedrive/trunk/admin.php

    r1480688 r1484143  
    11<?php
    22/**
    3  * @version 2.0.2
     3 * @version 2.0.3
    44 * @package OneDrive
    55 * @copyright © 2016 Perfect Web sp. z o.o., All rights reserved. https://www.perfect-web.co
     
    109109            wp_die(__('You do not have sufficient permissions to access this page.'));
    110110        }
     111       
     112        $errors = array();
    111113
    112114        // See if the user has posted us some information
     
    114116        if (isset($_POST['submitConfig']))
    115117        {
    116             $errors = array();
    117 
    118118            if (isset($_POST['client_id']) AND $_POST['client_id'])
    119119            {
    120                 if (preg_match('/^[0-9a-zA-Z\-]+$/', $_POST['client_id']))
    121                 {
    122                     update_option('pweb_onedrive_client_id', preg_replace('/[^0-9a-zA-Z\-]$/', '', trim($_POST['client_id'])));
    123                 }
    124                 else
    125                 {
    126                     $errors[] = __('Incorrect Client ID.', 'pwebonedrive');
    127                 }
     120                update_option('pweb_onedrive_client_id', trim($_POST['client_id']));
    128121            }
    129122            else
     
    134127            if (isset($_POST['client_secret']) AND $_POST['client_secret'])
    135128            {
    136                 update_option('pweb_onedrive_client_secret', addslashes(preg_replace('/[\'"\/]/', '', trim($_POST['client_secret']))));
     129                update_option('pweb_onedrive_client_secret', trim($_POST['client_secret']));
    137130            }
    138131            else
     
    141134            }
    142135
    143             if (count($errors))
    144             {
    145                 ?>
    146                 <div class="error"><p><strong><?php echo implode('<br>', $errors); ?></strong></p></div>
    147                 <?php
    148             }
    149             else
     136            if (!count($errors))
    150137            {
    151138                ?>
     
    153140                <?php
    154141            }
     142        }
     143
     144        $client_id = get_option('pweb_onedrive_client_id');
     145        if ((empty($client_id) OR strpos($client_id, '-') !== false OR strlen($client_id) > 16) AND !is_ssl())
     146        {
     147            $errors[] = __('OneDrive API requires website with a vliad SSL certificate. Make sure that you can connect with your website through HTTPS protocol.', 'pwebonedrive');
     148        }
     149
     150        if (count($errors))
     151        {
     152            ?>
     153            <div class="error"><p><strong><?php echo implode('<br>', $errors); ?></strong></p></div>
     154            <?php
    155155        }
    156156        ?>
     
    223223                            <th><label for="pweb-client_id"><?php _e('Client ID', 'pwebonedrive'); ?></label></th>
    224224                            <td>
    225                                 <input id="pweb-client_id" name="client_id" type="text" size="15" maxlength="32" value="<?php echo esc_attr(get_option('pweb_onedrive_client_id')); ?>" class="regular-text">
     225                                <input id="pweb-client_id" name="client_id" type="text" size="15" value="<?php echo esc_attr(get_option('pweb_onedrive_client_id')); ?>" class="regular-text">
    226226                            </td>
    227227                        </tr>
     
    229229                            <th><label for="pweb-client_secret"><?php _e('Client secret', 'pwebonedrive'); ?></label></th>
    230230                            <td>
    231                                 <input id="pweb-client_secret" name="client_secret" type="password" size="15" maxlength="50" value="<?php echo esc_attr(get_option('pweb_onedrive_client_secret')); ?>" class="regular-text">
     231                                <input id="pweb-client_secret" name="client_secret" type="password" size="15" value="<?php echo esc_attr(get_option('pweb_onedrive_client_secret')); ?>" class="regular-text">
    232232                            </td>
    233233                        </tr>
  • pwebonedrive/trunk/pwebonedrive.php

    r1480688 r1484143  
    44 * Plugin URI: https://www.perfect-web.co/wordpress/microsoft-onedrive-gallery-file
    55 * Description: Share easily your photos and files stored on Microsoft OneDrive. You can display a gallery with your photos or a link to a file for download.
    6  * Version: 2.0.2
     6 * Version: 2.0.3
    77 * Text Domain: pwebonedrive
    88 * Author: Piotr Moćko
  • pwebonedrive/trunk/readme.txt

    r1480688 r1484143  
    55Requires at least: 3.1.0
    66Tested up to: 4.6
    7 Stable tag: 2.0.2
     7Stable tag: 2.0.3
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5252= Requirements =
    5353
    54 PHP 5.2+
     54* PHP 5.2+
     55* SSL certificate
    5556
    5657
    5758== Installation ==
    5859
     601. Your website has to have a valid SSL certificate.
    59611. Install ZIP file or upload plugin files to the `/wp-content/plugins/pwebonedrive` directory.
    60621. **Activate the plugin** through the Plugins menu in WordPress.
     
    63651. Set **Redirect URL** in Windows Live Application as shown in plugin configuration.
    6466It should look like this:
    65 `http://yourdomain.com/path-to-wordpress/wp-content/pwebonedrive/callback.php`
     67`https://yourdomain.com/path-to-wordpress/wp-content/pwebonedrive/callback.php`
    6668or if  you have enabled Permalinks in WordPress Settings then it should look like this:
    67 `http://yourdomain.com/path-to-wordpress/pwebonedrive/callback`
     69`https://yourdomain.com/path-to-wordpress/pwebonedrive/callback`
    68701. Set **Mobile client app: No** in Windows Live Application.
    69711. If available set **Enhanced redirection security: Enabled** in Windows Live Application (for applications created before June 2014).
     
    212214
    213215== Changelog ==
     216
     217= 2.0.3 / 26-08-2016 =
     218* Fixed saving new client ID
     219* Force HTTPS on redirect URI
    214220
    215221= 2.0.2 / 22-08-2016 =
  • pwebonedrive/trunk/site.php

    r1479994 r1484143  
    22
    33/**
    4  * @version 2.0.1
     4 * @version 2.0.3
    55 * @package OneDrive
    66 * @copyright © 2016 Perfect Web sp. z o.o., All rights reserved. https://www.perfect-web.co
     
    989989        if ($ssl === null)
    990990        {
    991             $ssl = is_ssl();
     991            $client_id = get_option('pweb_onedrive_client_id');
     992            $ssl = (empty($client_id) || strpos($client_id, '-') !== false || strlen($client_id) > 16) ? true : is_ssl();
    992993        }
    993994
Note: See TracChangeset for help on using the changeset viewer.