Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/vendors/Textpattern/Security/Filter.php - 58 lines - 1483 bytes - Summary - Text - Print

Description: Basic security filter options.

   1  <?php
   2  
   3  /*
   4   * Textpattern Content Management System
   5   * https://textpattern.com/
   6   *
   7   * Copyright (C) 2020 The Textpattern Development Team
   8   *
   9   * This file is part of Textpattern.
  10   *
  11   * Textpattern is free software; you can redistribute it and/or
  12   * modify it under the terms of the GNU General Public License
  13   * as published by the Free Software Foundation, version 2.
  14   *
  15   * Textpattern is distributed in the hope that it will be useful,
  16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18   * GNU General Public License for more details.
  19   *
  20   * You should have received a copy of the GNU General Public License
  21   * along with Textpattern. If not, see <https://www.gnu.org/licenses/>.
  22   */
  23  
  24  /**
  25   * Basic security filter options.
  26   *
  27   * <code>
  28   * Txp::get('\Textpattern\Security\Filter')->setMaxRequestUriLength(255);
  29   * </code>
  30   *
  31   * @since   4.6.0
  32   * @package Security.
  33   */
  34  
  35  namespace Textpattern\Security;
  36  
  37  use \Txp;
  38  
  39  class Filter
  40  {
  41      /**
  42       * Protection from those who'd bomb the site by GET.
  43       *
  44       * @throws \Textpattern\Security\Exception
  45       * @return \Textpattern\Security\Filter
  46       */
  47  
  48      public function setMaxRequestUriLength($length)
  49      {
  50          $uri = Txp::get('\Textpattern\Server\Config')->getVariable('REQUEST_URI');
  51  
  52          if (strlen($uri) > $length) {
  53              throw new Exception('Requested URL length exceeds application limit.');
  54          }
  55  
  56          return $this;
  57      }
  58  }

title

Description

title

Description

title

Description

title

title

Body