A new, object-oriented, better vesion of μForum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1021 B

  1. <?php
  2. function buildURL($URI, $https = false)
  3. {
  4. $url = 'http';
  5. if ($https && USE_HTTPS)
  6. $url .= 's';
  7. $url .= '://'.FORUM_DOMAIN;
  8. if ($https && USE_HTTPS && HTTPS_PORT != 443)
  9. $url .= ':'.HTTPS_PORT;
  10. if ((!$https || !USE_HTTPS) && HTTP_PORT != 80)
  11. $url .= ':'.HTTP_PORT;
  12. if (strpos($URI, FORUM_PATH) === 0)
  13. $url .= $URI;
  14. else
  15. $url .= FORUM_PATH.'/'.$URI;
  16. return $url;
  17. }
  18. function post_default($key, $default='')
  19. {
  20. $_POST[$key] = (isset($_POST[$key])) ? stripslashes($_POST[$key]) : $default;
  21. }
  22. function clean_input(&$input, $dbobj, $opts = null)
  23. {
  24. $input = trim($input);
  25. $input = $dbobj->real_escape_string($input);
  26. if ($opts != null)
  27. {
  28. if (in_array('spchars', $opts)) //special chars
  29. $input = htmlspecialchars($input);
  30. if (in_array('nnegint', $opts)) //non-negative integer
  31. {
  32. $int_options = array('options' => array('min_range' => 0));
  33. $input = var_dump(filter_var($input, FILTER_VALIDATE_INT, $int_options));
  34. }
  35. }
  36. else
  37. $input = strip_tags($input);
  38. }
  39. ?>