[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/includes/ -> functions_compatibility.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  /**
  23  * Get user avatar
  24  *
  25  * @deprecated 3.1.0-a1 (To be removed: 3.3.0)
  26  *
  27  * @param string $avatar Users assigned avatar name
  28  * @param int $avatar_type Type of avatar
  29  * @param string $avatar_width Width of users avatar
  30  * @param string $avatar_height Height of users avatar
  31  * @param string $alt Optional language string for alt tag within image, can be a language key or text
  32  * @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
  33  * @param bool $lazy If true, will be lazy loaded (requires JS)
  34  *
  35  * @return string Avatar image
  36  */
  37  function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false)
  38  {
  39      // map arguments to new function phpbb_get_avatar()
  40      $row = array(
  41          'avatar'        => $avatar,
  42          'avatar_type'    => $avatar_type,
  43          'avatar_width'    => $avatar_width,
  44          'avatar_height'    => $avatar_height,
  45      );
  46  
  47      return phpbb_get_avatar($row, $alt, $ignore_config, $lazy);
  48  }
  49  
  50  /**
  51  * Hash the password
  52  *
  53  * @deprecated 3.1.0-a2 (To be removed: 3.3.0)
  54  *
  55  * @param string $password Password to be hashed
  56  *
  57  * @return string|bool Password hash or false if something went wrong during hashing
  58  */
  59  function phpbb_hash($password)
  60  {
  61      global $phpbb_container;
  62  
  63      /* @var $passwords_manager \phpbb\passwords\manager */
  64      $passwords_manager = $phpbb_container->get('passwords.manager');
  65      return $passwords_manager->hash($password);
  66  }
  67  
  68  /**
  69  * Check for correct password
  70  *
  71  * @deprecated 3.1.0-a2 (To be removed: 3.3.0)
  72  *
  73  * @param string $password The password in plain text
  74  * @param string $hash The stored password hash
  75  *
  76  * @return bool Returns true if the password is correct, false if not.
  77  */
  78  function phpbb_check_hash($password, $hash)
  79  {
  80      global $phpbb_container;
  81  
  82      /* @var $passwords_manager \phpbb\passwords\manager */
  83      $passwords_manager = $phpbb_container->get('passwords.manager');
  84      return $passwords_manager->check($password, $hash);
  85  }
  86  
  87  /**
  88  * Eliminates useless . and .. components from specified path.
  89  *
  90  * Deprecated, use filesystem class instead
  91  *
  92  * @param string $path Path to clean
  93  * @return string Cleaned path
  94  *
  95  * @deprecated 3.1.0 (To be removed: 3.3.0)
  96  */
  97  function phpbb_clean_path($path)
  98  {
  99      global $phpbb_path_helper, $phpbb_container;
 100  
 101      if (!$phpbb_path_helper && $phpbb_container)
 102      {
 103          /* @var $phpbb_path_helper \phpbb\path_helper */
 104          $phpbb_path_helper = $phpbb_container->get('path_helper');
 105      }
 106      else if (!$phpbb_path_helper)
 107      {
 108          global $phpbb_root_path, $phpEx;
 109  
 110          // The container is not yet loaded, use a new instance
 111          if (!class_exists('\phpbb\path_helper'))
 112          {
 113              require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx);
 114          }
 115  
 116          $request = new phpbb\request\request();
 117          $phpbb_path_helper = new phpbb\path_helper(
 118              new phpbb\symfony_request(
 119                  $request
 120              ),
 121              new phpbb\filesystem\filesystem(),
 122              $request,
 123              $phpbb_root_path,
 124              $phpEx
 125          );
 126      }
 127  
 128      return $phpbb_path_helper->clean_path($path);
 129  }
 130  
 131  /**
 132  * Pick a timezone
 133  *
 134  * @param    string        $default            A timezone to select
 135  * @param    boolean        $truncate            Shall we truncate the options text
 136  *
 137  * @return        string        Returns the options for timezone selector only
 138  *
 139  * @deprecated 3.1.0 (To be removed: 3.3.0)
 140  */
 141  function tz_select($default = '', $truncate = false)
 142  {
 143      global $template, $user;
 144  
 145      return phpbb_timezone_select($template, $user, $default, $truncate);
 146  }
 147  
 148  /**
 149  * Cache moderators. Called whenever permissions are changed
 150  * via admin_permissions. Changes of usernames and group names
 151  * must be carried through for the moderators table.
 152  *
 153  * @deprecated 3.1.0 (To be removed: 3.3.0)
 154  * @return null
 155  */
 156  function cache_moderators()
 157  {
 158      global $db, $cache, $auth;
 159      return phpbb_cache_moderators($db, $cache, $auth);
 160  }
 161  
 162  /**
 163  * Removes moderators and administrators from foe lists.
 164  *
 165  * @deprecated 3.1.0 (To be removed: 3.3.0)
 166  * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
 167  * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
 168  * @return null
 169  */
 170  function update_foes($group_id = false, $user_id = false)
 171  {
 172      global $db, $auth;
 173      return phpbb_update_foes($db, $auth, $group_id, $user_id);
 174  }
 175  
 176  /**
 177  * Get user rank title and image
 178  *
 179  * @param int $user_rank the current stored users rank id
 180  * @param int $user_posts the users number of posts
 181  * @param string &$rank_title the rank title will be stored here after execution
 182  * @param string &$rank_img the rank image as full img tag is stored here after execution
 183  * @param string &$rank_img_src the rank image source is stored here after execution
 184  *
 185  * @deprecated 3.1.0-RC5 (To be removed: 3.3.0)
 186  *
 187  * Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false
 188  */
 189  function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src)
 190  {
 191      global $phpbb_root_path, $phpEx;
 192      if (!function_exists('phpbb_get_user_rank'))
 193      {
 194          include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
 195      }
 196  
 197      $rank_data = phpbb_get_user_rank(array('user_rank' => $user_rank), $user_posts);
 198      $rank_title = $rank_data['title'];
 199      $rank_img = $rank_data['img'];
 200      $rank_img_src = $rank_data['img_src'];
 201  }
 202  
 203  /**
 204   * Retrieve contents from remotely stored file
 205   *
 206   * @deprecated    3.1.2    Use file_downloader instead
 207   */
 208  function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6)
 209  {
 210      global $phpbb_container;
 211  
 212      // Get file downloader and assign $errstr and $errno
 213      /* @var $file_downloader \phpbb\file_downloader */
 214      $file_downloader = $phpbb_container->get('file_downloader');
 215  
 216      $file_data = $file_downloader->get($host, $directory, $filename, $port, $timeout);
 217      $errstr = $file_downloader->get_error_string();
 218      $errno = $file_downloader->get_error_number();
 219  
 220      return $file_data;
 221  }
 222  
 223  /**
 224   * Add log entry
 225   *
 226   * @param    string    $mode                The mode defines which log_type is used and from which log the entry is retrieved
 227   * @param    int        $forum_id            Mode 'mod' ONLY: forum id of the related item, NOT INCLUDED otherwise
 228   * @param    int        $topic_id            Mode 'mod' ONLY: topic id of the related item, NOT INCLUDED otherwise
 229   * @param    int        $reportee_id        Mode 'user' ONLY: user id of the reportee, NOT INCLUDED otherwise
 230   * @param    string    $log_operation        Name of the operation
 231   * @param    array    $additional_data    More arguments can be added, depending on the log_type
 232   *
 233   * @return    int|bool        Returns the log_id, if the entry was added to the database, false otherwise.
 234   *
 235   * @deprecated    3.1.0 (To be removed: 3.3.0)
 236   */
 237  function add_log()
 238  {
 239      global $phpbb_log, $user;
 240  
 241      $args = func_get_args();
 242      $mode = array_shift($args);
 243  
 244      // This looks kind of dirty, but add_log has some additional data before the log_operation
 245      $additional_data = array();
 246      switch ($mode)
 247      {
 248          case 'admin':
 249          case 'critical':
 250              break;
 251          case 'mod':
 252              $additional_data['forum_id'] = array_shift($args);
 253              $additional_data['topic_id'] = array_shift($args);
 254              break;
 255          case 'user':
 256              $additional_data['reportee_id'] = array_shift($args);
 257              break;
 258      }
 259  
 260      $log_operation = array_shift($args);
 261      $additional_data = array_merge($additional_data, $args);
 262  
 263      $user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id'];
 264      $user_ip = (empty($user->ip)) ? '' : $user->ip;
 265  
 266      return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data);
 267  }
 268  
 269  /**
 270   * Sets a configuration option's value.
 271   *
 272   * Please note that this function does not update the is_dynamic value for
 273   * an already existing config option.
 274   *
 275   * @param string $config_name   The configuration option's name
 276   * @param string $config_value  New configuration value
 277   * @param bool   $is_dynamic    Whether this variable should be cached (false) or
 278   *                              if it changes too frequently (true) to be
 279   *                              efficiently cached.
 280   *
 281   * @return null
 282   *
 283   * @deprecated 3.1.0 (To be removed: 3.3.0)
 284   */
 285  function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null)
 286  {
 287      static $config = null;
 288  
 289      if ($set_config !== null)
 290      {
 291          $config = $set_config;
 292  
 293          if (empty($config_name))
 294          {
 295              return;
 296          }
 297      }
 298  
 299      $config->set($config_name, $config_value, !$is_dynamic);
 300  }
 301  
 302  /**
 303   * Increments an integer config value directly in the database.
 304   *
 305   * @param string $config_name   The configuration option's name
 306   * @param int    $increment     Amount to increment by
 307   * @param bool   $is_dynamic    Whether this variable should be cached (false) or
 308   *                              if it changes too frequently (true) to be
 309   *                              efficiently cached.
 310   *
 311   * @return null
 312   *
 313   * @deprecated 3.1.0 (To be removed: 3.3.0)
 314   */
 315  function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null)
 316  {
 317      static $config = null;
 318      if ($set_config !== null)
 319      {
 320          $config = $set_config;
 321          if (empty($config_name))
 322          {
 323              return;
 324          }
 325      }
 326      $config->increment($config_name, $increment, !$is_dynamic);
 327  }
 328  
 329  /**
 330   * Wrapper function of \phpbb\request\request::variable which exists for backwards compatability.
 331   * See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for
 332   * documentation of this function's use.
 333   *
 334   * @deprecated 3.1.0 (To be removed: 3.3.0)
 335   * @param    mixed            $var_name    The form variable's name from which data shall be retrieved.
 336   *                                         If the value is an array this may be an array of indizes which will give
 337   *                                         direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
 338   *                                         then specifying array("var", 1) as the name will return "a".
 339   *                                         If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface}
 340   *                                         as this parameter it will overwrite the current request class instance. If you do
 341   *                                         not do so, it will create its own instance (but leave superglobals enabled).
 342   * @param    mixed            $default    A default value that is returned if the variable was not set.
 343   *                                         This function will always return a value of the same type as the default.
 344   * @param    bool            $multibyte    If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
 345   *                                        Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
 346   * @param    bool            $cookie        This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for
 347   *                                         \phpbb\request\request_interface::variable for backwards compatability reasons.
 348   * @param    \phpbb\request\request_interface|null|false    If an instance of \phpbb\request\request_interface is given the instance is stored in
 349   *                                        a static variable and used for all further calls where this parameters is null. Until
 350   *                                        the function is called with an instance it automatically creates a new \phpbb\request\request
 351   *                                        instance on every call. By passing false this per-call instantiation can be restored
 352   *                                        after having passed in a \phpbb\request\request_interface instance.
 353   *
 354   * @return    mixed    The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
 355   *                     the same as that of $default. If the variable is not set $default is returned.
 356   */
 357  function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null)
 358  {
 359      // This is all just an ugly hack to add "Dependency Injection" to a function
 360      // the only real code is the function call which maps this function to a method.
 361      static $static_request = null;
 362      if ($request instanceof \phpbb\request\request_interface)
 363      {
 364          $static_request = $request;
 365          if (empty($var_name))
 366          {
 367              return;
 368          }
 369      }
 370      else if ($request === false)
 371      {
 372          $static_request = null;
 373          if (empty($var_name))
 374          {
 375              return;
 376          }
 377      }
 378      $tmp_request = $static_request;
 379      // no request class set, create a temporary one ourselves to keep backwards compatibility
 380      if ($tmp_request === null)
 381      {
 382          // false param: enable super globals, so the created request class does not
 383          // make super globals inaccessible everywhere outside this function.
 384          $tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false);
 385      }
 386      return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST);
 387  }
 388  
 389  /**
 390   * Get tables of a database
 391   *
 392   * @deprecated 3.1.0 (To be removed: 3.3.0)
 393   */
 394  function get_tables($db)
 395  {
 396      $db_tools_factory = new \phpbb\db\tools\factory();
 397      $db_tools = $db_tools_factory->get($db);
 398  
 399      return $db_tools->sql_list_tables();
 400  }
 401  
 402  /**
 403   * Global function for chmodding directories and files for internal use
 404   *
 405   * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions.
 406   * The function determines owner and group from common.php file and sets the same to the provided file.
 407   * The function uses bit fields to build the permissions.
 408   * The function sets the appropiate execute bit on directories.
 409   *
 410   * Supported constants representing bit fields are:
 411   *
 412   * CHMOD_ALL - all permissions (7)
 413   * CHMOD_READ - read permission (4)
 414   * CHMOD_WRITE - write permission (2)
 415   * CHMOD_EXECUTE - execute permission (1)
 416   *
 417   * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions.
 418   *
 419   * @param string    $filename    The file/directory to be chmodded
 420   * @param int    $perms        Permissions to set
 421   *
 422   * @return bool    true on success, otherwise false
 423   *
 424   * @deprecated 3.2.0-dev    use \phpbb\filesystem\filesystem::phpbb_chmod() instead
 425   */
 426  function phpbb_chmod($filename, $perms = CHMOD_READ)
 427  {
 428      global $phpbb_filesystem;
 429  
 430      try
 431      {
 432          $phpbb_filesystem->phpbb_chmod($filename, $perms);
 433      }
 434      catch (\phpbb\filesystem\exception\filesystem_exception $e)
 435      {
 436          return false;
 437      }
 438  
 439      return true;
 440  }
 441  
 442  /**
 443   * Test if a file/directory is writable
 444   *
 445   * This function calls the native is_writable() when not running under
 446   * Windows and it is not disabled.
 447   *
 448   * @param string $file Path to perform write test on
 449   * @return bool True when the path is writable, otherwise false.
 450   *
 451   * @deprecated 3.2.0-dev    use \phpbb\filesystem\filesystem::is_writable() instead
 452   */
 453  function phpbb_is_writable($file)
 454  {
 455      global $phpbb_filesystem;
 456  
 457      return $phpbb_filesystem->is_writable($file);
 458  }
 459  
 460  /**
 461   * Checks if a path ($path) is absolute or relative
 462   *
 463   * @param string $path Path to check absoluteness of
 464   * @return boolean
 465   *
 466   * @deprecated 3.2.0-dev    use \phpbb\filesystem\filesystem::is_absolute_path() instead
 467   */
 468  function phpbb_is_absolute($path)
 469  {
 470      global $phpbb_filesystem;
 471  
 472      return $phpbb_filesystem->is_absolute_path($path);
 473  }
 474  
 475  /**
 476   * A wrapper for realpath
 477   *
 478   * @deprecated 3.2.0-dev    use \phpbb\filesystem\filesystem::realpath() instead
 479   */
 480  function phpbb_realpath($path)
 481  {
 482      global $phpbb_filesystem;
 483  
 484      return $phpbb_filesystem->realpath($path);
 485  }
 486  
 487  /**
 488   * Determine which plural form we should use.
 489   * For some languages this is not as simple as for English.
 490   *
 491   * @param $rule        int            ID of the plural rule we want to use, see https://area51.phpbb.com/docs/dev/32x/language/plurals.html
 492   * @param $number    int|float    The number we want to get the plural case for. Float numbers are floored.
 493   * @return    int        The plural-case we need to use for the number plural-rule combination
 494   *
 495   * @deprecated 3.2.0-dev (To be removed: 3.3.0)
 496   */
 497  function phpbb_get_plural_form($rule, $number)
 498  {
 499      global $phpbb_container;
 500  
 501      /** @var \phpbb\language\language $language */
 502      $language = $phpbb_container->get('language');
 503      return $language->get_plural_form($number, $rule);
 504  }
 505  
 506  /**
 507  * @return bool Always true
 508  * @deprecated 3.2.0-dev
 509  */
 510  function phpbb_pcre_utf8_support()
 511  {
 512      return true;
 513  }
 514  
 515  /**
 516  * Load the autoloaders added by the extensions.
 517  *
 518  * @param string $phpbb_root_path Path to the phpbb root directory.
 519  *
 520  * @deprecated 3.2.10 (To be removed 4.0.0)
 521  */
 522  function phpbb_load_extensions_autoloaders($phpbb_root_path)
 523  {
 524      $iterator = new \RecursiveIteratorIterator(
 525          new \phpbb\recursive_dot_prefix_filter_iterator(
 526              new \RecursiveDirectoryIterator(
 527                  $phpbb_root_path . 'ext/',
 528                  \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS
 529              )
 530          ),
 531          \RecursiveIteratorIterator::SELF_FIRST
 532      );
 533      $iterator->setMaxDepth(2);
 534  
 535      foreach ($iterator as $file_info)
 536      {
 537          if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2)
 538          {
 539              $filename = $file_info->getRealPath() . '/autoload.php';
 540              if (file_exists($filename))
 541              {
 542                  require $filename;
 543              }
 544          }
 545      }
 546  }
 547  
 548  /**
 549  * Casts a variable to the given type.
 550  *
 551  * @deprecated
 552  */
 553  function set_var(&$result, $var, $type, $multibyte = false)
 554  {
 555      // no need for dependency injection here, if you have the object, call the method yourself!
 556      $type_cast_helper = new \phpbb\request\type_cast_helper();
 557      $type_cast_helper->set_var($result, $var, $type, $multibyte);
 558  }
 559  
 560  
 561  /**
 562  * Login using http authenticate.
 563  *
 564  * @param array    $param        Parameter array, see $param_defaults array.
 565  *
 566  * @return null
 567  *
 568  * @deprecated 3.2.10 (To be removed 4.0.0)
 569  */
 570  function phpbb_http_login($param)
 571  {
 572      global $auth, $user, $request;
 573      global $config;
 574  
 575      $param_defaults = array(
 576          'auth_message'    => '',
 577  
 578          'autologin'        => false,
 579          'viewonline'    => true,
 580          'admin'            => false,
 581      );
 582  
 583      // Overwrite default values with passed values
 584      $param = array_merge($param_defaults, $param);
 585  
 586      // User is already logged in
 587      // We will not overwrite his session
 588      if (!empty($user->data['is_registered']))
 589      {
 590          return;
 591      }
 592  
 593      // $_SERVER keys to check
 594      $username_keys = array(
 595          'PHP_AUTH_USER',
 596          'Authorization',
 597          'REMOTE_USER', 'REDIRECT_REMOTE_USER',
 598          'HTTP_AUTHORIZATION', 'REDIRECT_HTTP_AUTHORIZATION',
 599          'REMOTE_AUTHORIZATION', 'REDIRECT_REMOTE_AUTHORIZATION',
 600          'AUTH_USER',
 601      );
 602  
 603      $password_keys = array(
 604          'PHP_AUTH_PW',
 605          'REMOTE_PASSWORD',
 606          'AUTH_PASSWORD',
 607      );
 608  
 609      $username = null;
 610      foreach ($username_keys as $k)
 611      {
 612          if ($request->is_set($k, \phpbb\request\request_interface::SERVER))
 613          {
 614              $username = htmlspecialchars_decode($request->server($k));
 615              break;
 616          }
 617      }
 618  
 619      $password = null;
 620      foreach ($password_keys as $k)
 621      {
 622          if ($request->is_set($k, \phpbb\request\request_interface::SERVER))
 623          {
 624              $password = htmlspecialchars_decode($request->server($k));
 625              break;
 626          }
 627      }
 628  
 629      // Decode encoded information (IIS, CGI, FastCGI etc.)
 630      if (!is_null($username) && is_null($password) && strpos($username, 'Basic ') === 0)
 631      {
 632          list($username, $password) = explode(':', base64_decode(substr($username, 6)), 2);
 633      }
 634  
 635      if (!is_null($username) && !is_null($password))
 636      {
 637          set_var($username, $username, 'string', true);
 638          set_var($password, $password, 'string', true);
 639  
 640          $auth_result = $auth->login($username, $password, $param['autologin'], $param['viewonline'], $param['admin']);
 641  
 642          if ($auth_result['status'] == LOGIN_SUCCESS)
 643          {
 644              return;
 645          }
 646          else if ($auth_result['status'] == LOGIN_ERROR_ATTEMPTS)
 647          {
 648              send_status_line(401, 'Unauthorized');
 649  
 650              trigger_error('NOT_AUTHORISED');
 651          }
 652      }
 653  
 654      // Prepend sitename to auth_message
 655      $param['auth_message'] = ($param['auth_message'] === '') ? $config['sitename'] : $config['sitename'] . ' - ' . $param['auth_message'];
 656  
 657      // We should probably filter out non-ASCII characters - RFC2616
 658      $param['auth_message'] = preg_replace('/[\x80-\xFF]/', '?', $param['auth_message']);
 659  
 660      header('WWW-Authenticate: Basic realm="' . $param['auth_message'] . '"');
 661      send_status_line(401, 'Unauthorized');
 662  
 663      trigger_error('NOT_AUTHORISED');
 664  }
 665  
 666  /**
 667  * Converts query string (GET) parameters in request into hidden fields.
 668  *
 669  * Useful for forwarding GET parameters when submitting forms with GET method.
 670  *
 671  * It is possible to omit some of the GET parameters, which is useful if
 672  * they are specified in the form being submitted.
 673  *
 674  * sid is always omitted.
 675  *
 676  * @param \phpbb\request\request $request Request object
 677  * @param array $exclude A list of variable names that should not be forwarded
 678  * @return string HTML with hidden fields
 679  *
 680  * @deprecated 3.2.10 (To be removed 4.0.0)
 681  */
 682  function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
 683  {
 684      $names = $request->variable_names(\phpbb\request\request_interface::GET);
 685      $hidden = '';
 686      foreach ($names as $name)
 687      {
 688          // Sessions are dealt with elsewhere, omit sid always
 689          if ($name == 'sid')
 690          {
 691              continue;
 692          }
 693  
 694          // Omit any additional parameters requested
 695          if (!empty($exclude) && in_array($name, $exclude))
 696          {
 697              continue;
 698          }
 699  
 700          $escaped_name = phpbb_quoteattr($name);
 701  
 702          // Note: we might retrieve the variable from POST or cookies
 703          // here. To avoid exposing cookies, skip variables that are
 704          // overwritten somewhere other than GET entirely.
 705          $value = $request->variable($name, '', true);
 706          $get_value = $request->variable($name, '', true, \phpbb\request\request_interface::GET);
 707          if ($value === $get_value)
 708          {
 709              $escaped_value = phpbb_quoteattr($value);
 710              $hidden .= "<input type='hidden' name=$escaped_name value=$escaped_value />";
 711          }
 712      }
 713      return $hidden;
 714  }
 715  
 716  /**
 717  * Delete all PM(s) for a given user and delete the ones without references
 718  *
 719  * @param    int        $user_id    ID of the user whose private messages we want to delete
 720  *
 721  * @return    boolean        False if there were no pms found, true otherwise.
 722  *
 723  * @deprecated 3.2.10 (To be removed 4.0.0)
 724  */
 725  function phpbb_delete_user_pms($user_id)
 726  {
 727      $user_id = (int) $user_id;
 728  
 729      if (!$user_id)
 730      {
 731          return false;
 732      }
 733  
 734      return phpbb_delete_users_pms(array($user_id));
 735  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1