Plugin Directory

Changeset 3298251


Ignore:
Timestamp:
05/21/2025 05:55:47 PM (11 months ago)
Author:
ownerrez
Message:

Update to version 1.2.1 from GitHub

Location:
ownerrez
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ownerrez/tags/1.2.1/admin/class-ownerrez-admin.php

    r3139962 r3298251  
    9999    public function menu_settings_save()
    100100    {
     101        if (!current_user_can('manage_options')) {
     102            wp_die(__('You do not have sufficient permissions to access this page.'));
     103        }
     104
     105        if (!check_admin_referer('save_ownerrez_settings')) {
     106            wp_die(__('You do not have sufficient permissions to access this page.'));
     107        }
     108
    101109        // Get the options that were sent
    102110        $apiRoot = !empty($_POST["ownerrez_apiRoot"]) ? esc_url_raw($_POST["ownerrez_apiRoot"], ["http", "https"]) : self::DEFAULT_API_ROOT;
     
    184192    public function clear_transients()
    185193    {
     194        if (!current_user_can('manage_options')) {
     195            wp_die(__('You do not have sufficient permissions to access this page.'));
     196        }
     197
     198        if (!check_admin_referer('clear_ownerrez_transients')) {
     199            wp_die(__('You do not have sufficient permissions to access this page.'));
     200        }
     201
    186202        $plugin_public = new OwnerRez_Public($this->ownerrez, $this->version);
    187203        $plugin_public->clear_transients();
  • ownerrez/tags/1.2.1/admin/partials/ownerrez-admin-display.php

    r3139962 r3298251  
    5454        <form method="post" action="<?php echo admin_url('admin-post.php'); ?>">
    5555            <input type="hidden" name="action" value="save_ownerrez_settings" />
     56            <?php wp_nonce_field( 'save_ownerrez_settings' ); ?>
    5657
    5758            <table class="form-table" role="presentation">
     
    119120        <form id="clear_ownerrez_transients" method="post" action="<?php echo admin_url('admin-post.php'); ?>">
    120121            <input type="hidden" name="action" value="clear_ownerrez_transients" />
     122            <?php wp_nonce_field( 'clear_ownerrez_transients' ); ?>
    121123        </form>
    122124    </div>
  • ownerrez/tags/1.2.1/lib/autoload.php

    r3139962 r3298251  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • ownerrez/tags/1.2.1/lib/composer/InstalledVersions.php

    r2890325 r3298251  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • ownerrez/tags/1.2.1/ownerrez.php

    r3139962 r3298251  
    1717 * Plugin URI:        https://www.ownerrez.com/support/wordpress
    1818 * Description:       The official WordPress plugin for the OwnerRez API.
    19  * Version:           1.2.0
     19 * Version:           1.2.1
    2020 * Author:            OwnerRez, Inc.
    2121 * Author URI:        https://www.ownerrez.com/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('OWNERREZ_VERSION', '1.2.0');
     38define('OWNERREZ_VERSION', '1.2.1');
    3939
    4040/**
  • ownerrez/tags/1.2.1/readme.txt

    r3139962 r3298251  
    44Requires at least: 5.4
    55Tested up to: 6.6.0
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77License: MIT
    88License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE
     
    3333
    3434== Changelog ==
     35= 1.2.1 =
     36- Improve security in administrative pages
     37
    3538= 1.2.0 =
    3639- Update URLs to OwnerRez short domain
  • ownerrez/trunk/admin/class-ownerrez-admin.php

    r3139962 r3298251  
    9999    public function menu_settings_save()
    100100    {
     101        if (!current_user_can('manage_options')) {
     102            wp_die(__('You do not have sufficient permissions to access this page.'));
     103        }
     104
     105        if (!check_admin_referer('save_ownerrez_settings')) {
     106            wp_die(__('You do not have sufficient permissions to access this page.'));
     107        }
     108
    101109        // Get the options that were sent
    102110        $apiRoot = !empty($_POST["ownerrez_apiRoot"]) ? esc_url_raw($_POST["ownerrez_apiRoot"], ["http", "https"]) : self::DEFAULT_API_ROOT;
     
    184192    public function clear_transients()
    185193    {
     194        if (!current_user_can('manage_options')) {
     195            wp_die(__('You do not have sufficient permissions to access this page.'));
     196        }
     197
     198        if (!check_admin_referer('clear_ownerrez_transients')) {
     199            wp_die(__('You do not have sufficient permissions to access this page.'));
     200        }
     201
    186202        $plugin_public = new OwnerRez_Public($this->ownerrez, $this->version);
    187203        $plugin_public->clear_transients();
  • ownerrez/trunk/admin/partials/ownerrez-admin-display.php

    r3139962 r3298251  
    5454        <form method="post" action="<?php echo admin_url('admin-post.php'); ?>">
    5555            <input type="hidden" name="action" value="save_ownerrez_settings" />
     56            <?php wp_nonce_field( 'save_ownerrez_settings' ); ?>
    5657
    5758            <table class="form-table" role="presentation">
     
    119120        <form id="clear_ownerrez_transients" method="post" action="<?php echo admin_url('admin-post.php'); ?>">
    120121            <input type="hidden" name="action" value="clear_ownerrez_transients" />
     122            <?php wp_nonce_field( 'clear_ownerrez_transients' ); ?>
    121123        </form>
    122124    </div>
  • ownerrez/trunk/lib/autoload.php

    r3139962 r3298251  
    1515        }
    1616    }
    17     trigger_error(
    18         $err,
    19         E_USER_ERROR
    20     );
     17    throw new RuntimeException($err);
    2118}
    2219
  • ownerrez/trunk/lib/composer/InstalledVersions.php

    r2890325 r3298251  
    2828{
    2929    /**
     30     * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
     31     * @internal
     32     */
     33    private static $selfDir = null;
     34
     35    /**
    3036     * @var mixed[]|null
    3137     * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
    3238     */
    3339    private static $installed;
     40
     41    /**
     42     * @var bool
     43     */
     44    private static $installedIsLocalDir;
    3445
    3546    /**
     
    310321        self::$installed = $data;
    311322        self::$installedByVendor = array();
     323
     324        // when using reload, we disable the duplicate protection to ensure that self::$installed data is
     325        // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
     326        // so we have to assume it does not, and that may result in duplicate data being returned when listing
     327        // all installed packages for example
     328        self::$installedIsLocalDir = false;
     329    }
     330
     331    /**
     332     * @return string
     333     */
     334    private static function getSelfDir()
     335    {
     336        if (self::$selfDir === null) {
     337            self::$selfDir = strtr(__DIR__, '\\', '/');
     338        }
     339
     340        return self::$selfDir;
    312341    }
    313342
     
    323352
    324353        $installed = array();
     354        $copiedLocalDir = false;
    325355
    326356        if (self::$canGetVendors) {
     357            $selfDir = self::getSelfDir();
    327358            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
     359                $vendorDir = strtr($vendorDir, '\\', '/');
    328360                if (isset(self::$installedByVendor[$vendorDir])) {
    329361                    $installed[] = self::$installedByVendor[$vendorDir];
     
    331363                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    332364                    $required = require $vendorDir.'/composer/installed.php';
    333                     $installed[] = self::$installedByVendor[$vendorDir] = $required;
    334                     if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    335                         self::$installed = $installed[count($installed) - 1];
     365                    self::$installedByVendor[$vendorDir] = $required;
     366                    $installed[] = $required;
     367                    if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
     368                        self::$installed = $required;
     369                        self::$installedIsLocalDir = true;
    336370                    }
     371                }
     372                if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
     373                    $copiedLocalDir = true;
    337374                }
    338375            }
     
    351388        }
    352389
    353         if (self::$installed !== array()) {
     390        if (self::$installed !== array() && !$copiedLocalDir) {
    354391            $installed[] = self::$installed;
    355392        }
  • ownerrez/trunk/ownerrez.php

    r3139962 r3298251  
    1717 * Plugin URI:        https://www.ownerrez.com/support/wordpress
    1818 * Description:       The official WordPress plugin for the OwnerRez API.
    19  * Version:           1.2.0
     19 * Version:           1.2.1
    2020 * Author:            OwnerRez, Inc.
    2121 * Author URI:        https://www.ownerrez.com/
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define('OWNERREZ_VERSION', '1.2.0');
     38define('OWNERREZ_VERSION', '1.2.1');
    3939
    4040/**
  • ownerrez/trunk/readme.txt

    r3139962 r3298251  
    44Requires at least: 5.4
    55Tested up to: 6.6.0
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77License: MIT
    88License URI: https://github.com/ownerrez/orez-wp/blob/master/LICENSE
     
    3333
    3434== Changelog ==
     35= 1.2.1 =
     36- Improve security in administrative pages
     37
    3538= 1.2.0 =
    3639- Update URLs to OwnerRez short domain
Note: See TracChangeset for help on using the changeset viewer.