Changeset 812 for trunk


Ignore:
Timestamp:
Mar 21, 2024 4:49:53 AM (5 weeks ago)
Author:
anonymous
Message:

Fix depreciation notices

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r810 r812  
    232232        // Use the unicode modifier like this:  preg_replace('/[^0-9]/' . $app->getParam('preg_u'), '', $str);
    233233        'preg_u' => '',
     234
     235        // Prettify json when testing.
     236        'json_options' => JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES,
    234237    );
    235238
  • trunk/lib/PageNumbers.inc.php

    r768 r812  
    6464    public $right_dbl_arrow;
    6565    public $right_dbl_arrow_disabled;
     66    public $url_base;
     67    public $prefs;
    6668
    6769    /**
     
    9193    }
    9294
     95    private function _validNumber($num)
     96    {
     97        if (!isset($num) || '' == $num) {
     98            return false;
     99        }
     100        return preg_match('/^\d+$/', $num);
     101    }
     102
    93103    /**
    94104     * Set the number of items per page.
     
    100110        // (3) Set to default value if provided and valid.
    101111        // (4) Keep as Class default of 25.
    102         if (is_numeric($per_page) && $per_page > 0) {
     112        if ($this->_validNumber($per_page) && $per_page > 0) {
    103113            $this->_per_page = $per_page;
    104114            if ($save_value) {
     
    107117        } else if ($save_value && $this->prefs->exists('items_per_page')) {
    108118            $this->_per_page = (int)$this->prefs->get('items_per_page');
    109         } else if (is_numeric($default) && $default > 0) {
     119        } else if ($this->_validNumber($default) && $default > 0) {
    110120            $this->_per_page = $default;
    111121        }
     
    121131        // (2) By saved preference, if available.
    122132        // (3) Don't change from what was provided at class instantiation.
    123         if (is_numeric($page_number)) {
     133        if ($this->_validNumber($page_number)) {
    124134            if ($page_number < 1) {
    125135                // FIXME: How to go back around to the last page? Hmmm. Set to 1 for now.
     
    142152    public function setTotalItems($total_items)
    143153    {
    144         if (is_numeric($total_items) && $total_items > 0) {
     154        if ($this->_validNumber($total_items) && $total_items > 0) {
    145155            $this->total_items = $total_items;
    146156        } else {
     
    218228        $db =& DB::getInstance();
    219229
    220         if (is_numeric($this->first_item) && is_numeric($this->_per_page)) {
     230        if ($this->_validNumber($this->first_item) && $this->_validNumber($this->_per_page)) {
    221231            return ' LIMIT ' . $db->escapeString($this->first_item) . ', ' . $db->escapeString($this->_per_page) . ' ';
    222232        } else {
  • trunk/lib/SortOrder.inc.php

    r717 r812  
    4646    public $default_order;
    4747    public $base_url;
     48    public $prefs;
    4849
    4950    /**
  • trunk/polyfill/mysql.inc.php

    r806 r812  
    833833        public function mysql_real_escape_string($string, $link = false)
    834834        {
    835             if ('' == $string) {
     835            if ('' == (string)$string) {
    836836                return '';
    837837            }
     
    12161216                    throw new MySQL2PDOException($this->_params[$link]['errno'] .': ' . $this->_params[$link]['error']);
    12171217                } else {
    1218                     throw new MySQL2PDOException('No db at  instance #' . ($link - 1));
     1218                    throw new MySQL2PDOException('No db at instance #' . ($link - 1));
    12191219                }
    12201220            }
Note: See TracChangeset for help on using the changeset viewer.