Declare type of arguments

This commit is contained in:
Visman 2023-03-17 20:46:48 +07:00
parent 4e7f84d2a4
commit 695257cdc8
18 changed files with 99 additions and 99 deletions

View File

@ -316,7 +316,7 @@ else if (isset($_GET['edit_forum']))
<option value="0"><?php echo $lang_subforums['No parent forum'] ?></option>
<?php
// MOD subforums - Visman
function sf_select_view(int $id, $cur_forum, $space = '')
function sf_select_view(int $id, array $cur_forum, string $space = '')
{
global $sf_array_tree, $sf_array_asc;
@ -513,7 +513,7 @@ if (!empty($sf_array_tree[0])) // MOD subforums - Visman
$cur_index = 4;
// MOD subforum - Visman
function sf_list_view(int $id, $space = '')
function sf_list_view(int $id, string $space = '')
{
global $sf_array_tree, $cur_index, $lang_admin_common, $lang_admin_forums;

View File

@ -108,7 +108,7 @@ function http_authenticate_user()
//
// Output $feed as RSS 2.0
//
function output_rss($feed)
function output_rss(array $feed)
{
global $lang_common, $pun_config;
@ -150,7 +150,7 @@ function output_rss($feed)
//
// Output $feed as Atom 1.0
//
function output_atom($feed)
function output_atom(array $feed)
{
global $lang_common, $pun_config;
@ -203,7 +203,7 @@ function output_atom($feed)
//
// Output $feed as XML
//
function output_xml($feed)
function output_xml(array $feed)
{
global $lang_common, $pun_config;
@ -245,7 +245,7 @@ function output_xml($feed)
//
// Output $feed as HTML (using <li> tags)
//
function output_html($feed)
function output_html(array $feed)
{
// Send the Content-type header in case the web server is setup to send something else

View File

@ -35,7 +35,7 @@ function ua_isbot(string $ua, string $ual)
}
function ua_isbotex($ra)
function ua_isbotex(string $ra)
{
$ua = getenv('HTTP_USER_AGENT');
$ual = strtolower($ua);

View File

@ -81,7 +81,7 @@ function generate_quickjump_cache($group_id = false)
}
// MOD subforums - Visman
function generate_quickjump_sf_list($sf_array_tree, $id = 0, $space = '')
function generate_quickjump_sf_list(array $sf_array_tree, int $id = 0, string $space = '')
{
if (empty($sf_array_tree[$id])) return '';
@ -293,7 +293,7 @@ function generate_smiley_cache()
//
// Generate the subforums cache - Visman
//
function generate_subforums_desc(&$list, $tree, $node = 0)
function generate_subforums_desc(array &$list, array $tree, int $node = 0)
{
if (!empty($tree[$node]))
{
@ -306,7 +306,7 @@ function generate_subforums_desc(&$list, $tree, $node = 0)
}
}
function generate_subforums_asc(&$list, $tree, $node = array(0))
function generate_subforums_asc(array &$list, array $tree, array $node = array(0))
{
$list[$node[0]][] = $node[0];

View File

@ -24,7 +24,7 @@ require PUN_ROOT.'lang/'.$admin_language.'/admin_common.php';
//
// Fetch a list of available admin plugins
//
function forum_list_plugins($is_admin)
function forum_list_plugins(bool $is_admin)
{
$plugins = array();
@ -52,7 +52,7 @@ function forum_list_plugins($is_admin)
//
// Display the admin navigation menu
//
function generate_admin_menu($page = '')
function generate_admin_menu(string $page = '')
{
global $pun_config, $pun_user, $lang_admin_common;
@ -132,7 +132,7 @@ function generate_admin_menu($page = '')
//
// Delete topics from $forum_id that are "older than" $prune_date (if $prune_sticky is 1, sticky topics will also be deleted)
//
function prune(int $forum_id, $prune_sticky, int $prune_date)
function prune(int $forum_id, bool $prune_sticky, int $prune_date)
{
global $db;

View File

@ -30,7 +30,7 @@ function is_valid_email(string $email)
//
// Check if $email is banned
//
function is_banned_email(string $email, $id = false)
function is_banned_email(string $email, int $id = null)
{
global $pun_bans;
@ -38,7 +38,7 @@ function is_banned_email(string $email, $id = false)
{
if (empty($cur_ban['email'])) {
continue;
} elseif (false !== $id && $cur_ban['id'] == $id) {
} elseif (null !== $id && $cur_ban['id'] == $id) {
continue;
}
@ -46,12 +46,12 @@ function is_banned_email(string $email, $id = false)
$len = strlen($cur_ban['email']);
if ($cur_ban['email'][0] == '.') {
if (substr($email, -$len) == $cur_ban['email']) {
return false === $id ? true : $cur_ban['email'];
return null === $id ? true : $cur_ban['email'];
}
} else {
$tmp = substr($email, -1-$len);
if ($tmp == '.'.$cur_ban['email'] || $tmp == '@'.$cur_ban['email']) {
return false === $id ? true : $cur_ban['email'];
return null === $id ? true : $cur_ban['email'];
}
}
} else if ($email == $cur_ban['email']) {
@ -79,7 +79,7 @@ function encode_mail_text(string $str)
//
// Make a post email safe
//
function bbcode2email(string $text, $wrap_length = 72, $language = null)
function bbcode2email(string $text, int $wrap_length = 72, string $language = null)
{
static $base_url;
static $wrotes = array();
@ -245,7 +245,7 @@ function bbcode2email(string $text, $wrap_length = 72, $language = null)
//
// Wrapper for PHP's mail()
//
function pun_mail(string $to, string $subject, string $message, $reply_to_email = '', $reply_to_name = '')
function pun_mail(string $to, string $subject, string $message, string $reply_to_email = '', string $reply_to_name = '')
{
global $pun_config, $lang_common;
@ -292,7 +292,7 @@ function pun_mail(string $to, string $subject, string $message, $reply_to_email
// This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com)
// They deserve all the credit for writing it. I made small modifications for it to suit PunBB and its coding standards
//
function server_parse($socket, $expected_response)
function server_parse($socket, string $expected_response)
{
$server_response = '';
while (substr($server_response, 3, 1) != ' ')
@ -310,7 +310,7 @@ function server_parse($socket, $expected_response)
// This function was originally a part of the phpBB Group forum software phpBB2 (http://www.phpbb.com)
// They deserve all the credit for writing it. I made small modifications for it to suit PunBB and its coding standards.
//
function smtp_mail(string $to, string $subject, string $message, $headers = '')
function smtp_mail(string $to, string $subject, string $message, string $headers = '')
{
global $pun_config;
static $local_host;

View File

@ -10,7 +10,7 @@
//
// Cookie stuff!
//
function check_cookie(&$pun_user)
function check_cookie(array &$pun_user)
{
global $db, $db_type, $pun_config, $cookie_name, $cookie_seed;
@ -145,7 +145,7 @@ function escape_cdata(string $str)
// $user can be either a user ID (integer) or a username (string)
// $password can be either a plaintext password or a password hash including salt ($password_is_hash must be set accordingly)
//
function authenticate_user($user, string $password, $password_is_hash = false)
function authenticate_user($user, string $password, bool $password_is_hash = false)
{
global $db, $pun_user;
@ -173,7 +173,7 @@ function authenticate_user($user, string $password, $password_is_hash = false)
//
// Try to determine the current URL
//
function get_current_url($max_length = 0)
function get_current_url(int $max_length = 0)
{
$protocol = get_current_protocol();
$port = isset($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80' && $protocol == 'http') || ($_SERVER['SERVER_PORT'] != '443' && $protocol == 'https')) && strpos($_SERVER['HTTP_HOST'], ':') === false ? ':'.$_SERVER['SERVER_PORT'] : '';
@ -218,7 +218,7 @@ function get_current_protocol()
//
// Fetch the base_url, optionally support HTTPS and HTTP
//
function get_base_url($support_https = false)
function get_base_url(bool $support_https = false)
{
global $pun_config;
static $base_url;
@ -325,7 +325,7 @@ function set_default_user()
//
// SHA1 HMAC with PHP 4 fallback
//
function forum_hmac(string $data, string $key, $raw_output = false)
function forum_hmac(string $data, string $key, bool $raw_output = false)
{
return hash_hmac('sha1', $data, $key, $raw_output);
}
@ -456,7 +456,7 @@ function check_bans()
//
// Check username
//
function check_username(string $username, $exclude_id = null)
function check_username(string $username, int $exclude_id = null)
{
global $db, $pun_config, $errors, $lang_prof_reg, $lang_register, $lang_common;
@ -504,7 +504,7 @@ function check_username(string $username, $exclude_id = null)
//
// Update "Users online"
// ф-ия переписана - Visman
function update_users_online($tid = 0, &$witt_us = array())
function update_users_online(int $tid = 0, array &$witt_us = array())
{
global $db, $pun_config, $onl_u, $onl_g, $onl_s;
@ -580,7 +580,7 @@ function update_users_online($tid = 0, &$witt_us = array())
//
// Display the profile navigation menu
//
function generate_profile_menu($page = '')
function generate_profile_menu(string $page = '')
{
global $lang_profile, $pun_config, $pun_user, $id;
@ -636,7 +636,7 @@ function generate_avatar_markup(int $user_id)
//
// Generate browser's title
//
function generate_page_title($page_title, $p = null)
function generate_page_title($page_title, int $p = null)
{
global $lang_common;
@ -657,7 +657,7 @@ function generate_page_title($page_title, $p = null)
//
// Save array of tracked topics in cookie
//
function set_tracked_topics($tracked_topics)
function set_tracked_topics(array $tracked_topics)
{
global $cookie_name, $cookie_path, $cookie_domain, $cookie_secure, $pun_config;
@ -778,7 +778,7 @@ function delete_avatar(int $user_id)
//
// Delete a topic and all of it's posts
//
function delete_topic(int $topic_id, $flag_f = 1) // not sum - Visman
function delete_topic(int $topic_id, int $flag_f = 1) // not sum - Visman
{
global $db;
@ -932,7 +932,7 @@ function get_usernames_banlist()
// Determines the correct title for $user
// $user must contain the elements 'username', 'title', 'posts', 'g_id' and 'g_user_title'
//
function get_title($user)
function get_title(array $user)
{
global $lang_common, $pun_config;
@ -1032,7 +1032,7 @@ function paginate(int $num_pages, int $cur_page, string $link)
//
// Display a message
//
function message(string $message, $no_back_link = false, $http_status = null)
function message(string $message, bool $no_back_link = false, string $http_status = null)
{
global $db, $lang_common, $pun_config, $pun_start, $tpl_main, $pun_user, $page_js;
@ -1070,7 +1070,7 @@ function message(string $message, $no_back_link = false, $http_status = null)
//
// Format a time string according to $time_format and time zones
//
function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false, $user = null)
function format_time($timestamp, bool $date_only = false, ?string $date_format = null, ?string $time_format = null, bool $time_only = false, bool $no_text = false, array $user = null)
{
global $lang_common, $pun_user, $forum_date_formats, $forum_time_formats;
@ -1114,7 +1114,7 @@ function format_time($timestamp, $date_only = false, $date_format = null, $time_
//
// A wrapper for PHP's number_format function
//
function forum_number_format($number, $decimals = 0)
function forum_number_format($number, int $decimals = 0)
{
global $lang_common;
@ -1125,7 +1125,7 @@ function forum_number_format($number, $decimals = 0)
//
// Generate a random key of length $len
//
function random_key(int $len, $readable = false, $hash = false)
function random_key(int $len, bool $readable = false, bool $hash = false)
{
$key = '';
@ -1195,7 +1195,7 @@ function csrf_hash($script = false, $use_ip = true, $user = false)
//
// Validate the given redirect URL, use the fallback otherwise
//
function validate_redirect(string $redirect_url, $fallback_url)
function validate_redirect(string $redirect_url, ?string $fallback_url)
{
$referrer = parse_url(strtolower($redirect_url));
@ -1342,7 +1342,7 @@ function pun_linebreaks(string $str)
//
// A wrapper for utf8_trim for compatibility
//
function pun_trim($str, $charlist = false)
function pun_trim($str, string $charlist = null)
{
if (! is_scalar($str)) {
$str = '';
@ -1382,7 +1382,7 @@ function pun_strcasecmp(string $strX, string $strY)
// or a string, which is the key that the new element should be inserted before
// $key is optional: it's used when inserting a new key/value pair into an associative array
//
function array_insert(&$input, $offset, $element, $key = null)
function array_insert(array &$input, $offset, $element, $key = null)
{
if (is_null($key))
$key = $offset;
@ -1647,7 +1647,7 @@ function redirect(string $destination_url, string $message)
//
// Display a simple error message
//
function error(string $message, $file = null, $line = null, $db_error = false)
function error(string $message, string $file = null, $line = null, $db_error = false)
{
global $pun_config, $lang_common;
@ -1909,7 +1909,7 @@ function generate_stopwords_cache_id()
//
// Split text into chunks ($inside contains all text inside $start and $end, and $outside contains all text outside)
//
function split_text(string $text, $start, $end, $retab = true)
function split_text(string $text, string $start, string $end, bool $retab = true)
{
global $pun_config;
@ -1937,7 +1937,7 @@ function split_text(string $text, $start, $end, $retab = true)
// Extract blocks from a text with a starting and ending string
// This function always matches the most outer block so nesting is possible
//
function extract_blocks(string $text, $start, $end, $retab = true)
function extract_blocks(string $text, string $start, string $end, bool $retab = true)
{
global $pun_config;
@ -2209,7 +2209,7 @@ function dump()
//
// генерация javascript в футере
//
function generation_js($arr)
function generation_js(array $arr)
{
$res = '';
if (!empty($arr['j']))
@ -2227,7 +2227,7 @@ function generation_js($arr)
// MOD Кто в этой теме
// Отложенное выполнение запроса
//
function witt_query($var = NULL)
function witt_query($var = null)
{
global $db;
static $query;
@ -2251,7 +2251,7 @@ function witt_query($var = NULL)
$db->query($query) or error('Unable to insert/update into online list', __FILE__, __LINE__, $db->error());
$query = NULL;
$query = null;
}
}
}
@ -2278,7 +2278,7 @@ function sf_crumbs(int $id)
//
// Checks the password on the user's data array
//
function forum_password_verify(string $password, $user)
function forum_password_verify(string $password, array $user)
{
global $salt1;
@ -2324,7 +2324,7 @@ function forum_password_verify(string $password, $user)
//
// Sets common http headers
//
function forum_http_headers($type = 'text/html')
function forum_http_headers(string $type = 'text/html')
{
$now = gmdate('D, d M Y H:i:s') . ' GMT';

View File

@ -57,7 +57,7 @@ if (!isset($smilies))
//
// Make sure all BBCodes are lower case and do a little cleanup
//
function preparse_bbcode(string $text, &$errors, $is_signature = false)
function preparse_bbcode(string $text, array &$errors, bool $is_signature = false)
{
global $pun_config, $lang_common, $lang_post, $re_list;
@ -194,7 +194,7 @@ function strip_empty_bbcode(string $text)
//
// Check the structure of bbcode tags and fix simple mistakes where possible
//
function preparse_tags(string $text, &$errors, $is_signature = false)
function preparse_tags(string $text, array &$errors, bool $is_signature = false)
{
global $lang_common, $pun_config, $pun_user;
@ -630,7 +630,7 @@ function preparse_tags(string $text, &$errors, $is_signature = false)
//
// Preparse the contents of [list] bbcode
//
function preparse_list_tag(string $content, $type = '*')
function preparse_list_tag(string $content, string $type = '*')
{
global $lang_common, $re_list;
@ -658,7 +658,7 @@ function preparse_list_tag(string $content, $type = '*')
//
// Truncate URL if longer than 55 characters (add http:// or ftp:// if missing)
//
function handle_url_tag(string $url, $link = '', $bbcode = false)
function handle_url_tag(string $url, string $link = '', bool $bbcode = false)
{
global $pun_config, $pun_user, $page_js;
@ -714,7 +714,7 @@ function handle_url_tag(string $url, $link = '', $bbcode = false)
//
// Turns an URL from the [img] tag into an <img> tag or a <a href...> tag
//
function handle_img_tag(string $url, $is_signature = false, $alt = null, $float = '')
function handle_img_tag(string $url, bool $is_signature = false, ?string $alt = null, string $float = '')
{
global $lang_common, $pun_user;
@ -734,7 +734,7 @@ function handle_img_tag(string $url, $is_signature = false, $alt = null, $float
//
// Email bbcode replace to <a href="mailto:... - Visman
//
function handle_email_tag(string $mail, $body = null)
function handle_email_tag(string $mail, string $body = null)
{
if (null === $body)
$body = $mail;
@ -747,7 +747,7 @@ function handle_email_tag(string $mail, $body = null)
//
// Parse the contents of [list] bbcode
//
function handle_list_tag(string $content, $type = '*')
function handle_list_tag(string $content, string $type = '*')
{
global $re_list;
@ -803,7 +803,7 @@ function handle_time_tag(string $after_time)
//
// Convert BBCodes to their HTML equivalent
//
function do_bbcode(string $text, $is_signature = false)
function do_bbcode(string $text, bool $is_signature = false)
{
global $lang_common, $pun_user, $pun_config, $re_list;
@ -943,9 +943,9 @@ function do_clickable(string $text)
//
// Return an array key, if it exists, otherwise return an empty string
//
function forum_array_key($arr, $key)
function forum_array_key(array $arr, int $key)
{
return isset($arr[$key]) ? $arr[$key] : '';
return $arr[$key] ?? '';
}
@ -976,7 +976,7 @@ function do_smilies(string $text)
//
// Parse message text
//
function parse_message(string $text, $hide_smilies)
function parse_message(string $text, bool $hide_smilies)
{
global $pun_config, $lang_common, $pun_user;
@ -1087,7 +1087,7 @@ function parse_signature(string $text)
//
// Обработчик для текста, но не для кода html тегов - Visman
//
function sva_do_for_only_text(string $text, $do_smilies)
function sva_do_for_only_text(string $text, bool $do_smilies)
{
if (! $do_smilies || '' === $text)
return $text;

View File

@ -13,7 +13,7 @@ if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/pms_new.php'))
else
require PUN_ROOT.'lang/English/pms_new.php';
function generate_pmsn_menu($page = '')
function generate_pmsn_menu(string $page = '')
{
global $pun_user, $lang_pmsn, $pmsn_kol_list, $pmsn_kol_new, $pmsn_kol_save;
global $sidamp, $sidvop;
@ -82,7 +82,7 @@ function generate_pmsn_menu($page = '')
}
}
function pmsn_user_update(int $user, $flag = false)
function pmsn_user_update(int $user, bool $flag = false)
{
global $db, $db_type;
@ -102,7 +102,7 @@ function pmsn_user_update(int $user, $flag = false)
$db->query('UPDATE '.$db->prefix.'users SET '.$tempf.'messages_new='.$mnew.', messages_all='.$mkol.' WHERE id='.$user) or error('Unable to update user', __FILE__, __LINE__, $db->error());
}
function pmsn_user_delete(int $user, $mflag, $topics = array())
function pmsn_user_delete(int $user, int $mflag, array $topics = array())
{
global $db, $db_type;

View File

@ -16,7 +16,7 @@ else
require PUN_ROOT.'lang/English/poll.php';
// вывод сообщений *************************************************************
function poll_mess(string $mess, $ques = '', $vote = '')
function poll_mess(string $mess, string $ques = '', string $vote = '')
{
global $lang_poll;
@ -33,7 +33,7 @@ function poll_mess(string $mess, $ques = '', $vote = '')
// получение данных из формы ***************************************************
function poll_post(string $var, $default = null)
{
return isset($_POST[$var]) ? $_POST[$var] : $default;
return $_POST[$var] ?? $default;
}
// запрещено ли редактировать **************************************************
@ -54,7 +54,7 @@ function poll_bad()
}
// может ли голосовать юзер ****************************************************
function poll_can_vote(int $tid, $uid)
function poll_can_vote(int $tid, ?int $uid)
{
global $db, $cur_topic;
@ -66,7 +66,7 @@ function poll_can_vote(int $tid, $uid)
}
// получение информации по опросу **********************************************
function poll_info(int $tid, $uid = null)
function poll_info(int $tid, ?int $uid = null)
{
global $db;
@ -346,7 +346,7 @@ function ForQues(num,t){if(num > max_ques){return false}var div=document.getElem
}
// проверяем правильность ******************************************************
function poll_form_validate(int $tid, &$errors)
function poll_form_validate(int $tid, array &$errors)
{
global $lang_poll, $pun_config;
@ -408,7 +408,7 @@ function poll_cache_delete(int $tid)
}
// удаление опроса *************************************************************
function poll_delete(int $tid, $flag = false)
function poll_delete(int $tid, bool $flag = false)
{
global $db;
@ -505,7 +505,7 @@ function poll_save(int $tid)
}
// результат голосования в теме ************************************************
function poll_display_topic(int $tid, int $uid, $p = 0, $f = false)
function poll_display_topic(int $tid, int $uid, int $p = 0, bool $f = false)
{
global $pun_config;
static $info = null;
@ -592,7 +592,7 @@ function poll_display_post(int $tid, int $uid)
}
// отображаем результат голосования ********************************************
function poll_display(int $tid, int $uid, $info, $top, $prev = false)
function poll_display(int $tid, int $uid, ?array $info, array $top, bool $prev = false)
{
global $db, $lang_poll, $pun_config, $lang_common;

View File

@ -41,7 +41,7 @@ define('PUN_CJK_HANGUL_REGEX', '['.
']');
function split_words_clear_link_minor($arr)
function split_words_clear_link_minor(array $arr)
{
$res = '';
@ -101,7 +101,7 @@ function split_words_clear_link(string $url)
// "Cleans up" a text string and returns an array of unique words
// This function depends on the current locale setting
//
function split_words(string $text, $idx)
function split_words(string $text, bool $idx)
{
// Remove BBCode
$text = preg_replace('%\[/?(b|u|s|ins|del|em|i|h|colou?r|quote|code|img|url|email|list|topic|post|forum|user|imgr|imgl|hr|size|after|spoiler|right|center|justify|mono)(?:\=[^\]]*)?\]%', ' ', $text);
@ -158,7 +158,7 @@ function split_words(string $text, $idx)
//
// Checks if a word is a valid searchable word
//
function validate_search_word(string $word, $idx)
function validate_search_word(string $word, bool $idx)
{
static $stopwords;
@ -242,7 +242,7 @@ function strip_bbcode(string $text)
//
// Updates the search index with the contents of $post_id (and $subject)
//
function update_search_index($mode, int $post_id, string $message, $subject = null)
function update_search_index(string $mode, int $post_id, string $message, string $subject = null)
{
global $db_type, $db;
@ -356,7 +356,7 @@ function update_search_index($mode, int $post_id, string $message, $subject = nu
//
// Strip search index of indexed words in $post_ids
//
function strip_search_index($post_ids)
function strip_search_index(string $post_ids)
{
global $db_type, $db;

View File

@ -10,7 +10,7 @@ if (!defined('PUN'))
exit;
function security_lang(string $val, $isset = false)
function security_lang(string $val, bool $isset = false)
{
static $lang_sec;
@ -103,7 +103,7 @@ function security_random_name(string $s)
}
function security_show_captcha($tabindex, $acaptcha = true, $qcaptcha = false)
function security_show_captcha(int $tabindex, bool $acaptcha = true, bool $qcaptcha = false)
{
global $lang_common, $cur_index;
@ -240,7 +240,7 @@ function security_test_browser()
}
function security_verify_captcha($form_captcha)
function security_verify_captcha(string $form_captcha)
{
$form_captcha = unserialize($form_captcha);
@ -259,7 +259,7 @@ function security_verify_captcha($form_captcha)
}
function security_msg($error)
function security_msg(string $error)
{
return security_lang('Error '.$error, true) ? security_lang('Error '.$error) : 'Error '.$error;
}

View File

@ -1,7 +1,7 @@
<?php
/**
* Copyright (C) 2013-2018 Visman (mio.visman@yandex.ru)
* Copyright (C) 2013-2023 Visman (mio.visman@yandex.ru)
* Copyright (C) 2008-2012 FluxBB
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
@ -10,14 +10,14 @@
if (!defined('PUN'))
exit;
function sf_status_new($cur_forum)
function sf_status_new(array $cur_forum)
{
global $new_topics;
return isset($new_topics[$cur_forum['fid']]);
}
function sf_data_forum($result, &$forum, $fid = 0)
function sf_data_forum(array $result, array &$forum, int $fid = 0)
{
if (!$fid)
$fid = $forum['fid'];

View File

@ -377,7 +377,7 @@ class upfClass
protected $fileIsUp;
protected $image;
public function loadFile(string $path, $basename = null)
public function loadFile(string $path, string $basename = null)
{
$this->filePath = null;
$this->fileName = null;
@ -523,12 +523,12 @@ class upfClass
];
}
public function saveFile(string $path, $overwrite = false)
public function saveFile(string $path, bool $overwrite = false)
{
return $this->save($path, $overwrite, false);
}
public function saveImage(string $path, $overwrite = false)
public function saveImage(string $path, bool $overwrite = false)
{
if (empty($this->image)) {
$this->error = 'No image';
@ -538,7 +538,7 @@ class upfClass
return $this->save($path, $overwrite, true);
}
protected function save(string $path, $overwrite, $isImage)
protected function save(string $path, bool $overwrite, bool $isImage)
{
if ($this->isBadLink($path)) {
return false;
@ -646,7 +646,7 @@ class upfClass
];
}
public function resizeImage(int $width, $height = null)
public function resizeImage(int $width, ?int $height = null)
{
if (empty($this->image)) {
$this->error = 'No image';
@ -778,7 +778,7 @@ class upfClass
$this->destroyImage();
}
protected function hidePath(string $str, $path = null)
protected function hidePath(string $str, string $path = null)
{
$search = [];
if (null !== $this->filePath) {

View File

@ -12,7 +12,7 @@ function ua_get_filename(string $name, string $folder)
return get_base_url(true).'/img/user_agent/'.$folder.'/'.$name.'.png';
}
function ua_search_for_item($items, string $usrag)
function ua_search_for_item(array $items, string $usrag)
{
foreach ($items as $item)
{
@ -132,12 +132,12 @@ function get_useragent_names(string $usrag)
return $result;
}
function get_useragent_icons($usrag)
function get_useragent_icons(?string $usrag)
{
global $pun_user;
static $uac = array();
if (! is_string($usrag) || $usrag == '') return '';
if (empty($usrag)) return '';
if (isset($uac[$usrag])) return $uac[$usrag];

View File

@ -66,7 +66,7 @@ if (!$pun_user['is_guest'])
// Load the misc.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/misc.php';
function generate_list_of_forums($tree, $current, $forums, $root = 0, $space = '')
function generate_list_of_forums(array $tree, int $current, array $forums, int $root = 0, string $space = '')
{
if (empty($tree[$root])) {
return '';

View File

@ -881,7 +881,7 @@ if ($pun_config['o_search_all_forums'] == '1' || $pun_user['is_admmod'])
echo "\t\t\t\t\t\t".'<div class="checklist">'."\n";
// MOD subforum - Visman
function sf_search_view($id, $space = '')
function sf_search_view(int $id, string $space = '')
{
global $sf_array_tree;
@ -927,7 +927,7 @@ else
echo "\t\t\t\t\t\t".'<select id="forum" name="forum">'."\n";
// MOD subforum - Visman
function sf_search_view($id, $space = '')
function sf_search_view(int $id, string $space = '')
{
global $sf_array_tree;

View File

@ -5,7 +5,7 @@
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
function upf_return_json($data)
function upf_return_json(array $data)
{
global $db;
@ -22,12 +22,12 @@ function upf_return_json($data)
exit(json_encode($data));
}
function upf_get_pg($key, $default = null)
function upf_get_pg(string $key, $default = null)
{
return $_POST[$key] ?? ($_GET[$key] ?? $default);
}
function upf_message($message, $no_back_link = false, $http_status = null)
function upf_message(string $message, bool $no_back_link = false, string $http_status = null)
{
global $upf_ajax;
@ -38,7 +38,7 @@ function upf_message($message, $no_back_link = false, $http_status = null)
}
}
function upf_redirect($destination_url, $message)
function upf_redirect(string $destination_url, string $message)
{
global $upf_ajax, $lang_up;