Skip to content

Lưu ý: Đây là bộ tài liệu chưa hoàn thiện, đang trong quá trình cập nhật nên nội dung có thể không đúng hoặc chưa đủ. Nếu phát hiện sai lệch, xin báo lại qua GitHub Issues hoặc gửi Pull Request để sửa.

Hàm dùng chung toàn hệ thống ​

Dùng được ở mọi khu vực: ngoài site, quản trị, cronjob, API.

Nguồn: src/includes/functions.php

add_notification ​

php
function add_notification($args)

$args có thể chứa các phần tử: receiver_grs (dạng mảng): Danh sách ID của các nhóm nhận thông báo receiver_ids (dạng mảng): Danh sách ID của người dùng nhận thông báo. Nếu có giá trị rỗng = tất cả người dùng sender_role (dạng chuỗi): Gửi từ (gồm: system, group, admin) sender_group (dạng số): ID của nhóm gửi thông báo (sử dụng khi sender_role là group) sender_admin (dạng số): ID của admin gửi thông báo (sử dụng khi sender_role là admin) isdef (dạng chuỗi): Mã ngôn ngữ của tin nhắn mặc định (bắt buộc) message (dạng mảng): Nội dung thông báo (bắt buộc, có dạng ['mã ngôn ngữ 1' => 'Nội dung 1', 'mã ngôn ngữ 2' => 'Nội dung 2']) link (dạng chuỗi): Liên kết của thông báo add_time (dạng số): Thời gian đăng thông báo (0 = thời gian hiển thị đầu tiên) exp_time (dạng số): Thời gian hết hạn thông báo (0 = vô thời hạn)

Tham số

  • $args array

Trả về: false|string

Khai báo tại src/includes/functions.php:3536

api_url_create ​

php
function api_url_create($action, $language = '', $module = '', $domain = '')

Tham số

  • $action string
  • $language string, mặc định ''
  • $module string, mặc định ''
  • $domain string, mặc định ''

Trả về: false|string

Khai báo tại src/includes/functions.php:2863

betweenURLs ​

php
function betweenURLs($page, $total, $base_url, $urlappend, &$prevPage, &$nextPage)

Tham số

  • $page int
  • $total int
  • $base_url string
  • $urlappend string
  • &$prevPage string
  • &$nextPage string

Khai báo tại src/includes/functions.php:2098

check_endurl_variables ​

php
function check_endurl_variables(&$request_query)

Tham số

  • &$request_query mixed

Khai báo tại src/includes/functions.php:2349

clear_verified_password ​

php
function clear_verified_password(string $module = ''): void

Xóa trạng thái đã xác thực mật khẩu. Một hành động bảo mật không được phép thực hiện đồng thời nhiều khu vực do đó khi xóa thì xóa hết tất cả các khu vực theo module

Tham số

  • $module string, mặc định ''

Trả về: void

Khai báo tại src/includes/functions.php:4329

csrf_check ​

php
function csrf_check($csrf, $key, $prefix = NV_CHECK_SESSION, $lifetime = 3600)

Hàm kiểm tra mã CSRF

Tham số

  • $csrf string
  • $key string
  • $prefix string, mặc định NV_CHECK_SESSION
  • $lifetime int, mặc định 3600

Trả về: bool

Khai báo tại src/includes/functions.php:4253

csrf_create ​

php
function csrf_create($key, $prefix = NV_CHECK_SESSION)

Hàm tạo mã CSRF

Tham số

  • $key string
  • $prefix string, mặc định NV_CHECK_SESSION

Trả về: string

Khai báo tại src/includes/functions.php:4238

DKIM_verify ​

php
function DKIM_verify($domain, $selector)

Tham số

  • $domain string
  • $selector string

Trả về: bool

Khai báo tại src/includes/functions.php:3963

getCanonicalUrl ​

php
function getCanonicalUrl($page_url, $query_check = false, $abs_comp = false)

Lấy biến canonical URL và kiểm soát việc chuyển hướng

Tham số

  • $page_url string: Đường dẫn tuyệt đối từ thư mục gốc đến trang
  • $query_check bool, mặc định false: So sánh query của $page_url với query của $_SERVER['REQUEST_URI']
  • $abs_comp bool, mặc định false: So sánh tuyệt đối (true) hoặc chỉ cần có chứa (false)

Trả về: string

Khai báo tại src/includes/functions.php:2442

getPageUrl ​

php
function getPageUrl($page_url, $is_query_check, $is_abs_check, &$request_uri = '')

Tham số

  • $page_url string
  • $is_query_check bool
  • $is_abs_check bool
  • &$request_uri string, mặc định ''

Trả về: false|string

Khai báo tại src/includes/functions.php:2384

go_verified_password ​

php
function go_verified_password(string $area, string $redirect_url, bool $go_direct = true): string

Chuyển hướng đến trang xác thực mật khẩu

Tham số

  • $area string: Khu vực cần xác thực mật khẩu
  • $redirect_url string: Url trở về sau khi xác thực thành công
  • $go_direct bool, mặc định true: true: chuyển hướng ngay, false: trả về URL để chuyển hướng

Trả về: string

Ngoại lệ: Exception

Khai báo tại src/includes/functions.php:4349

greeting_for_user_create ​

php
function greeting_for_user_create($user_name, $first_name, $last_name = '', $gender = '', $lang = '')

Function tạo lời chào trong email

Tham số

  • $user_name string
  • $first_name string
  • $last_name string, mặc định ''
  • $gender string, mặc định ''
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1153

is_localhost ​

php
function is_localhost()

Trả về: bool

Khai báo tại src/includes/functions.php:2683

is_verified_password ​

php
function is_verified_password(string $area, string $module = ''): bool

Kiểm tra xem mật khẩu đã được xác thực cho khu vực area hay chưa

Tham số

  • $area string
  • $module string, mặc định ''

Trả về: bool

Khai báo tại src/includes/functions.php:4272

mailAddHtml ​

php
function mailAddHtml($subject, $body, $gconfigs, $lang)

Thêm khung HTML vào nội dung mail.

Tham số

  • $subject string
  • $body string
  • $gconfigs array
  • $lang string

Trả về: string

Khai báo tại src/includes/functions.php:1678

mhash_create ​

php
function mhash_create($module, $op)

Tham số

  • $module string
  • $op string

Trả về: string

Khai báo tại src/includes/functions.php:4201

mload_url_generate ​

php
function mload_url_generate($module, $op, $amp = '&', $checkuser = false, $other_data = [])

Tạo URL truy vấn vào mload.php

Tham số

  • $module string: Tên module
  • $op string: Function của module
  • $amp string, mặc định '&': Sử dụng & hay & trong URL
  • $checkuser bool, mặc định false: Có kết nối file kiểm tra tư cách user hay không
  • $other_data array, mặc định []: Các biến khác cần truyền vào URL

Trả về: string

Khai báo tại src/includes/functions.php:4217

nv_add_hook ​

php
function nv_add_hook($module_name, $tag, $priority, $callback, $hook_module = '', $pid = 0)

Tham số

  • $module_name mixed: Module xảy ra event
  • $tag mixed: TAG
  • $priority int: Ưu tiên
  • $callback mixed: Hàm chạy
  • $hook_module string, mặc định '': Module sử dụng dữ liệu
  • $pid int, mặc định 0: ID quản lý trong CSDL

Khai báo tại src/includes/functions.php:4082

nv_alias_page ​

php
function nv_alias_page($title, $base_url, $num_items, $per_page, $on_page, $add_prevnext_text = true, $full_theme = true)

Tham số

  • $title string
  • $base_url string
  • $num_items int
  • $per_page int
  • $on_page int
  • $add_prevnext_text bool, mặc định true
  • $full_theme bool, mặc định true

Trả về: string

Khai báo tại src/includes/functions.php:2242

nv_apply_hook ​

php
function nv_apply_hook($module, $tag, $args = [], $default = null, $return_type = 0)

Tham số

  • $module string: Module khởi chạy, để trống là hệ thống
  • $tag mixed: Khóa
  • $args mixed, mặc định []: Tham số truyền vào
  • $default mixed, mặc định null: Dữ liệu mặc định trả về nếu hook không tồn tại
  • $return_type mixed, mặc định 0: Để trống thì dữ liệu trả về là giá trị cuối cùng. 1: Gộp array_merge. 2: Gộp array_merge_recursive

Khai báo tại src/includes/functions.php:4024

nv_array_diff_assoc ​

php
function nv_array_diff_assoc($array1, $array2)

Tham số

  • $array1 array
  • $array2 array

Trả về: array

Khai báo tại src/includes/functions.php:71

nv_autoLinkDisable ​

php
function nv_autoLinkDisable($text)

Disable email engines from automatically hyperlinking a URL

Tham số

  • $text string

Trả về: string

Khai báo tại src/includes/functions.php:4010

nv_base64_decode ​

php
function nv_base64_decode($input)

Tham số

  • $input mixed

Trả về: false|string

Khai báo tại src/includes/functions.php:368

nv_base64_encode ​

php
function nv_base64_encode($input)

Tham số

  • $input mixed

Trả về: string

Khai báo tại src/includes/functions.php:357

nv_br2nl ​

php
function nv_br2nl($text)

Tham số

  • $text string

Trả về: string

Khai báo tại src/includes/functions.php:1502

nv_capcha_txt ​

php
function nv_capcha_txt($seccode, $type = 'captcha')

Tham số

  • $seccode string
  • $type string, mặc định 'captcha'

Trả về: bool

Khai báo tại src/includes/functions.php:596

nv_change_buffer ​

php
function nv_change_buffer($buffer)

Tham số

  • $buffer string

Trả về: string

Khai báo tại src/includes/functions.php:2937

nv_check_domain ​

php
function nv_check_domain($domain)

Tham số

  • $domain string

Trả về: string

Khai báo tại src/includes/functions.php:2506

nv_check_url ​

php
function nv_check_url($url, $isArray = false)

Tham số

  • $url string
  • $isArray bool, mặc định false

Trả về: bool|array

Khai báo tại src/includes/functions.php:2553

nv_check_valid_email ​

php
function nv_check_valid_email($mail, $return = false)

Kiểm tra email có hợp lệ hay không Nếu $return = true thì trả về email đã được hợp chuẩn

Tham số

  • $mail string
  • $return bool, mặc định false

Trả về: mixed

Từ phiên bản: 4.3.08

Khai báo tại src/includes/functions.php:524

nv_check_valid_login ​

php
function nv_check_valid_login($login, $max, $min)

Tham số

  • $login string
  • $max int
  • $min int

Trả về: string

Khai báo tại src/includes/functions.php:419

nv_check_valid_pass ​

php
function nv_check_valid_pass($pass, $max, $min)

Tham số

  • $pass string
  • $max int
  • $min int

Trả về: string

Khai báo tại src/includes/functions.php:468

nv_checkagent ​

php
function nv_checkagent($a)

Tham số

  • $a string

Trả về: string

Khai báo tại src/includes/functions.php:230

nv_class_exists ​

php
function nv_class_exists($clName, $autoload = true)

Tham số

  • $clName string
  • $autoload bool, mặc định true

Trả về: bool

Khai báo tại src/includes/functions.php:393

nv_compound_unicode ​

php
function nv_compound_unicode($value)

Hàm chuyển Unicode tổ hợp sang Unicode dựng sẵn

Tham số

  • $value mixed

Trả về: mixed

Khai báo tại src/includes/functions.php:4814

nv_convertfromBytes ​

php
function nv_convertfromBytes($size)

Tham số

  • $size int

Trả về: string

Khai báo tại src/includes/functions.php:250

nv_convertfromSec ​

php
function nv_convertfromSec($sec = 0)

Tham số

  • $sec int, mặc định 0

Trả về: string

Khai báo tại src/includes/functions.php:289

nv_converttoBytes ​

php
function nv_converttoBytes($string)

Tham số

  • $string string

Trả về: false|float|string

Khai báo tại src/includes/functions.php:324

nv_currency_format ​

php
function nv_currency_format(float $num, string $lang = '')

Tham số

  • $num float
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:4649

nv_d2u_get ​

php
function nv_d2u_get(string $str, ?int $hh = null, ?int $mm = null, ?int $ss = null, string $lang = '', string $method = 'get')

Hàm lấy unixtime từ chuỗi get

Tham số

  • $str string
  • $hh ?int, mặc định null
  • $mm ?int, mặc định null
  • $ss ?int, mặc định null
  • $lang string, mặc định ''
  • $method string, mặc định 'get'

Trả về: int

Khai báo tại src/includes/functions.php:4702

nv_d2u_post ​

php
function nv_d2u_post(string $str, ?int $hh = null, ?int $mm = null, ?int $ss = null, string $lang = '')

Hàm lấy unixtime từ chuỗi post

Tham số

  • $str string
  • $hh ?int, mặc định null
  • $mm ?int, mặc định null
  • $ss ?int, mặc định null
  • $lang string, mặc định ''

Trả về: int

Khai báo tại src/includes/functions.php:4758

nv_date ​

php
function nv_date($format, $time = 0)

Tham số

  • $format string
  • $time int, mặc định 0

Trả về: string|null

Khai báo tại src/includes/functions.php:1173

nv_date_format ​

php
function nv_date_format(int $short = 1, ?int $timestamp = null, string $lang = '')

Tham số

  • $short int, mặc định 1
  • $timestamp ?int, mặc định null
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1240

nv_datetime_format ​

php
function nv_datetime_format(?int $timestamp = null, int $reverse = 0, int $short = 1, string $lang = '')

Hiển thị đầy đủ ngày tháng năm, giờ phút hoặc ngược lại

Tham số

  • $timestamp ?int, mặc định null
  • $reverse int, mặc định 0
  • $short int, mặc định 1
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1296

nv_daymonth_format ​

php
function nv_daymonth_format(?int $timestamp = null, string $lang = '')

Hiển thị ngày tháng (không có năm), định dạng suy ra từ date_short của vùng

Tham số

  • $timestamp ?int, mặc định null
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1315

nv_delete_notification ​

php
function nv_delete_notification($language, $module, $type, $obid)

Tham số

  • $language string
  • $module string
  • $type string
  • $obid array|int|string

Trả về: true

Khai báo tại src/includes/functions.php:3454

nv_editor_br2nl ​

php
function nv_editor_br2nl($text)

Tham số

  • $text string

Trả về: string

Khai báo tại src/includes/functions.php:1532

nv_editor_nl2br ​

php
function nv_editor_nl2br($text)

Tham số

  • $text string

Trả về: string

Khai báo tại src/includes/functions.php:1517

nv_EncodeEmail ​

php
function nv_EncodeEmail($strEmail, $strDisplay = '', $blnCreateLink = true)

Tham số

  • $strEmail string
  • $strDisplay string, mặc định ''
  • $blnCreateLink bool, mặc định true

Trả về: string

Khai báo tại src/includes/functions.php:685

nv_function_exists ​

php
function nv_function_exists($funcName)

Tham số

  • $funcName string

Trả về: bool

Khai báo tại src/includes/functions.php:379

nv_generate_page ​

php
function nv_generate_page($base_url, $num_items, $per_page, $on_page, $add_prevnext_text = true, $onclick = false, $js_func_name = 'nv_urldecode_ajax', $containerid = 'generate_page', $full_theme = true)

Tham số

  • $base_url string|array
  • $num_items int
  • $per_page int
  • $on_page int
  • $add_prevnext_text bool, mặc định true
  • $onclick bool, mặc định false
  • $js_func_name string, mặc định 'nv_urldecode_ajax'
  • $containerid string, mặc định 'generate_page'
  • $full_theme bool, mặc định true

Trả về: string

Khai báo tại src/includes/functions.php:2129

nv_genpass ​

php
function nv_genpass($length = 8, $type = 0)

Tham số

  • $length int, mặc định 8
  • $type int, mặc định 0

Trả về: string

Khai báo tại src/includes/functions.php:648

nv_get_email_template ​

php
function nv_get_email_template($emailid, $lang = '')

Tham số

  • $emailid int|array
  • $lang string, mặc định '': ngôn ngữ nội dung và tiêu đề email

Trả về: bool|mixed

Khai báo tại src/includes/functions.php:4388

nv_get_keywords ​

php
function nv_get_keywords($content, $keyword_limit = 20, $isArr = false)

Tham số

  • $content mixed
  • $keyword_limit int, mặc định 20
  • $isArr bool, mặc định false

Trả về: array|string

Khai báo tại src/includes/functions.php:1583

nv_get_redirect ​

php
function nv_get_redirect($mode = 'post,get', $decode = false)

Tham số

  • $mode string, mặc định 'post,get'
  • $decode bool, mặc định false

Trả về: string

Khai báo tại src/includes/functions.php:3680

nv_getenv ​

php
function nv_getenv($a)

Tham số

  • $a mixed

Trả về: string

Khai báo tại src/includes/functions.php:48

nv_groups_add_user ​

php
function nv_groups_add_user($group_id, $userid, $approved = 1, $mod_data = 'users')

Thêm thành viên vào nhóm

Tham số

  • $group_id int
  • $userid int
  • $approved int, mặc định 1
  • $mod_data string, mặc định 'users'

Trả về: bool

Khai báo tại src/includes/functions.php:805

nv_groups_del_user ​

php
function nv_groups_del_user($group_id, $userid, $mod_data = 'users')

Loại bỏ thành viên khỏi nhóm

Tham số

  • $group_id int
  • $userid int
  • $mod_data string, mặc định 'users'

Trả về: bool

Khai báo tại src/includes/functions.php:899

nv_htmlspecialchars ​

php
function nv_htmlspecialchars($string)

Tham số

  • $string string

Trả về: string

Khai báo tại src/includes/functions.php:1415

nv_http_get_lang ​

php
function nv_http_get_lang($input)

Tham số

  • $input array

Trả về: string

Khai báo tại src/includes/functions.php:4175

nv_insert_logs ​

php
function nv_insert_logs($lang = '', $module_name = '', $name_key = '', $note_action = '', $userid = 0, $link_acess = '')

Tham số

  • $lang string, mặc định ''
  • $module_name string, mặc định ''
  • $name_key string, mặc định ''
  • $note_action string, mặc định ''
  • $userid int, mặc định 0
  • $link_acess string, mặc định ''

Trả về: bool

Ngoại lệ: PDOException

Khai báo tại src/includes/functions.php:3201

nv_insert_notification ​

php
function nv_insert_notification($module, $type, $content = [], $obid = 0, $send_to = 0, $send_from = 0, $area = 1, $admin_view_allowed = 0, $logic_mode = 0)

Tham số

  • $module string: module_name xảy ra thông báo
  • $type string: loại thông báo, do module tùy ý đặt để xử lý
  • $content array, mặc định []: dữ liệu tùy ý do module đặt
  • $obid int, mặc định 0: id đối tượng thông báo, tùy ý do module đặt
  • $send_to array|int, mặc định 0: ID người nhận, bỏ trống nếu để người nhận là tất cả
  • $send_from int, mặc định 0: ID người tạo thông báo, để trống nếu là hệ thống
  • $area int, mặc định 1: xem mô tả bên dưới
  • $admin_view_allowed int, mặc định 0: 0: Tất cả các admin, 1: Quản trị tối cao, 2: Điều hành chung + Quản trị tối cao
  • $logic_mode int, mặc định 0: 0: 0 admin cấp trên thấy thông báo của cấp dưới, 1: Chỉ cấp đó được xem của cấp đó

Trả về: int

Khai báo tại src/includes/functions.php:3388

nv_is_allowed_ancestor ​

php
function nv_is_allowed_ancestor($sources = [])

Kiểm tra trang cha đang nhúng site này bằng iframe có nằm trong danh sách nguồn của chỉ thị frame-ancestors không. Trang cha được xác định qua referer của lần tải tài liệu iframe đầu tiên, nên trình duyệt không gửi referer thì coi như không hợp lệ.

Tham số

  • $sources array, mặc định []: Danh sách nguồn lấy từ cấu hình frame_ancestors_hosts

Trả về: bool

Khai báo tại src/includes/functions.php:128

nv_is_banIp ​

php
function nv_is_banIp($ip)

Tham số

  • $ip string

Trả về: bool

Khai báo tại src/includes/functions.php:200

nv_is_myreferer ​

php
function nv_is_myreferer($referer = '')

Tham số

  • $referer string, mặc định ''

Trả về: int

Khai báo tại src/includes/functions.php:98

nv_is_url ​

php
function nv_is_url($url, $isInternal = false)

Tham số

  • $url string
  • $isInternal bool, mặc định false

Trả về: bool

Khai báo tại src/includes/functions.php:2527

nv_local_api ​

php
function nv_local_api($cmd, $params, $adminidentity = '', $module = '')

Tham số

  • $cmd string
  • $params array
  • $adminidentity string, mặc định ''
  • $module string, mặc định ''

Trả về: mixed

Ngoại lệ: Exception

Khai báo tại src/includes/functions.php:3831

nv_md5safe ​

php
function nv_md5safe($username)

Tham số

  • $username string

Trả về: string

Khai báo tại src/includes/functions.php:406

nv_monthname ​

php
function nv_monthname($i)

Tham số

  • $i int

Trả về: string

Khai báo tại src/includes/functions.php:1358

nv_monthyear_format ​

php
function nv_monthyear_format(?int $timestamp = null, string $lang = '')

Hiển thị tháng năm (không có ngày), định dạng suy ra từ date_short của vùng

Tham số

  • $timestamp ?int, mặc định null
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1337

nv_nl2br ​

php
function nv_nl2br($text, $replacement = '<br />')

Tham số

  • $text string
  • $replacement string, mặc định '<br />'

Trả về: string

Khai báo tại src/includes/functions.php:1483

nv_nl2tag ​

php
function nv_nl2tag($str, $tag = 'p')

Tham số

  • $str string
  • $tag string, mặc định 'p'

Trả về: string

Khai báo tại src/includes/functions.php:1550

nv_number_format ​

php
function nv_number_format(float $num, string $lang = '')

Tham số

  • $num float
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:4622

nv_object2array ​

php
function nv_object2array($a)

Tham số

  • $a mixed

Trả về: mixed

Khai báo tại src/includes/functions.php:33

nv_outdated_browser ​

php
function nv_outdated_browser()

Phát hiện trình duyệt đã lỗi thời dựa trên danh sách trình duyệt đã biết. Nếu không xem như không lỗi thời. Nếu giao diện hỗ trợ riêng hãy xử lý bằng hàm theme_outdated_browser()

Trả về: boolean

Khai báo tại src/includes/functions.php:4826

nv_parse_phone ​

php
function nv_parse_phone($phone)

parse_phone()

Tham số

  • $phone mixed

Trả về: array

Khai báo tại src/includes/functions.php:4364

nv_preg_quote ​

php
function nv_preg_quote($a)

Tham số

  • $a string

Trả về: string

Khai báo tại src/includes/functions.php:59

nv_redirect_decrypt ​

php
function nv_redirect_decrypt($string, $insite = true)

Tham số

  • $string string
  • $insite bool, mặc định true

Trả về: string

Khai báo tại src/includes/functions.php:3650

nv_redirect_encrypt ​

php
function nv_redirect_encrypt($url)

Tham số

  • $url string

Trả về: string

Khai báo tại src/includes/functions.php:3637

nv_redirect_location ​

php
function nv_redirect_location($url, $error_code = 301, $noreferrer = false)

Tham số

  • $url string
  • $error_code int, mặc định 301
  • $noreferrer bool, mặc định false

Khai báo tại src/includes/functions.php:3611

nv_region_config ​

php
function nv_region_config(string $key, string $lang = '')

Tham số

  • $key string
  • $lang string, mặc định ''

Trả về: null|string|int

Khai báo tại src/includes/functions.php:4680

nv_sendmail ​

php
function nv_sendmail($from, $to, $subject, $message, $files = '', $AddEmbeddedImage = false, $testmode = false, $cc = [], $bcc = [], $mailhtml = true, $custom_headers = [], $lang = '', $mail_tpl = '')

Tham số

  • $from mixed
  • $to mixed
  • $subject string
  • $message string
  • $files string, mặc định ''
  • $AddEmbeddedImage bool, mặc định false
  • $testmode bool, mặc định false
  • $cc mixed, mặc định []
  • $bcc array, mặc định []
  • $mailhtml bool, mặc định true
  • $custom_headers array, mặc định []
  • $lang mixed, mặc định ''
  • $mail_tpl, mặc định ''

Trả về: bool $from: Nếu là string thì nó được hiểu là reply_address Nếu là array thì có các giá trị sau đây: [reply_name: 'Reply Me' (string|array), reply_address: 'reply@nukeviet.vn'(string|array), from_name: contact@nukeviet.vn (string), from_address: 'NukeViet'] $to: address1@nukeviet.vn Hoặc: [address1@nukeviet.vn,address2@nukeviet.vn] $files: Có thể gửi nhiều files, ngăn cách bởi dấu phẩy Đường dẫn đến file là tuyệt đối $AddEmbeddedImage: Có thêm logo của site hay không. Nếu có thì nó sẽ thay thế cho src="cid:sitelogo" trong thẻ img $cc: contact@nukeviet.vn Hoặc: contact@nukeviet.vn => NukeViet1, contact2@nukeviet.vn => NukeViet2 Hoặc: contact@nukeviet.vn,contact2@nukeviet.vn $bcc: contact@nukeviet.vn Hoặc: contact@nukeviet.vn => NukeViet1, contact2@nukeviet.vn => NukeViet2 Hoặc: contact@nukeviet.vn,contact2@nukeviet.vn $mailhtml: Xác định có thêm khung HTML vào nội dung thư hay không, mặc định true $custom_headers: Tiêu đề tùy chỉnh thêm vào phần header của mail (Dạng: Khóa => Giá trị) $lang: Ngôn ngữ gửi mail, nếu rỗng sẽ là NV_LANG_DATA string $mail_tpl: Tệp mẫu thư tùy chỉnh, nếu trống sẽ lấy theo cấu hình gửi mail

Khai báo tại src/includes/functions.php:1764

nv_sendmail_async ​

php
function nv_sendmail_async($from, $to, $subject, $message, $files = '', $AddEmbeddedImage = false, $testmode = false, $cc = [], $bcc = [], $mailhtml = true, $custom_headers = [], $lang = '')

Khởi tạo một luồng truy vấn không đồng bộ/chạy nền để gửi mail Nếu gửi mail không cần trả về kết quả thì nên sử dụng function này

Tham số

  • $from array|string
  • $to array|string
  • $subject string
  • $message string
  • $files string, mặc định ''
  • $AddEmbeddedImage bool, mặc định false
  • $testmode bool, mặc định false
  • $cc array|string, mặc định []
  • $bcc array, mặc định []
  • $mailhtml bool, mặc định true
  • $custom_headers array, mặc định []
  • $lang string, mặc định ''

Khai báo tại src/includes/functions.php:2021

nv_sendmail_from_template ​

php
function nv_sendmail_from_template($emailid, $data = [], $lang = '', $attachments = '', $test_mode = false)

Tham số

  • $emailid int|array
  • $data array, mặc định []
  • $lang string, mặc định '': ngôn ngữ để lấy subject và body của email, không chỉ ra thì lấy ngôn ngữ giao diện hiện hành. Trường hợp gửi email bất đồng bộ cần chú ý nếu không chỉ ra nó sẽ luôn gửi bằng ngôn ngữ mặc định của site
  • $attachments string, mặc định ''
  • $test_mode boolean, mặc định false

Trả về: bool|bool[]

Khai báo tại src/includes/functions.php:4472

nv_sendmail_template_async ​

php
function nv_sendmail_template_async($emailid, $data = [], $lang = '', $attachments = '')

Khởi tạo một luồng truy vấn không đồng bộ/chạy nền để gửi mail theo mẫu Nếu gửi mail không cần trả về kết quả thì nên sử dụng function này

Tham số

  • $emailid int|array
  • $data array, mặc định []
  • $lang string, mặc định '': dùng để lấy ra subject và body của email. Nếu không chỉ ra thì là ngôn ngữ giao diện hiện hành. Biến này không nên trống, nếu để trống có khả năng nội dung email và tên website có thể lệch nhau
  • $attachments string, mặc định ''

Khai báo tại src/includes/functions.php:2062

nv_set_authorization ​

php
function nv_set_authorization()

Trả về: array

Khai báo tại src/includes/functions.php:3711

nv_show_name_user ​

php
function nv_show_name_user($first_name, $last_name, $user_name = '', $lang = '')

Tham số

  • $first_name string
  • $last_name string
  • $user_name string, mặc định ''
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1003

nv_site_mods ​

php
function nv_site_mods($lang = '')

Tham số

  • $lang string, mặc định ''

Trả về: array|void

Khai báo tại src/includes/functions.php:3298

nv_status_notification ​

php
function nv_status_notification($language, $module, $type, $obid, $status = 1, $area = 1)

Tham số

  • $language string
  • $module string
  • $type string
  • $obid int
  • $status int, mặc định 1
  • $area int, mặc định 1

Trả về: true

Ngoại lệ: PDOException

Khai báo tại src/includes/functions.php:3500

nv_sys_mods ​

php
function nv_sys_mods($lang = '')

Tham số

  • $lang string, mặc định ''

Trả về: array

Khai báo tại src/includes/functions.php:3228

nv_tag2nl ​

php
function nv_tag2nl($str, $tag = 'p')

Tham số

  • $str string
  • $tag string, mặc định 'p'

Trả về: string

Khai báo tại src/includes/functions.php:1568

nv_theme_viewpdf ​

php
function nv_theme_viewpdf(string $file_url): string

Lấy đầy đủ giao diện xem trực tuyến một tệp js. Được dùng để trả về page content cho một iframe xem PDF trực tuyến.

Tham số

  • $file_url string

Trả về: string

Khai báo tại src/includes/functions.php:4864

nv_time_format ​

php
function nv_time_format(int $short = 1, ?int $timestamp = null, string $lang = '')

Tham số

  • $short int, mặc định 1
  • $timestamp ?int, mặc định null
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1264

nv_u2d_get ​

php
function nv_u2d_get(?int $timestamp, string $lang = '', string $method = 'get')

Chuyển unixtime sang chuỗi ngày tháng trong GET

Tham số

  • $timestamp ?int
  • $lang string, mặc định ''
  • $method string, mặc định 'get'

Trả về: string

Khai báo tại src/includes/functions.php:4771

nv_u2d_post ​

php
function nv_u2d_post(?int $timestamp, string $lang = '')

Chuyển unixtime sang chuỗi ngày tháng trong POST

Tham số

  • $timestamp ?int
  • $lang string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:4790

nv_unhtmlspecialchars ​

php
function nv_unhtmlspecialchars($string)

Tham số

  • $string string|int|float|array

Trả về: string|int|float|array

Khai báo tại src/includes/functions.php:1387

nv_url_rewrite ​

php
function nv_url_rewrite($buffer, $is_url = false)

Tham số

  • $buffer string
  • $is_url bool, mặc định false

Trả về: string

Khai báo tại src/includes/functions.php:2697

nv_url_rewrite_callback ​

php
function nv_url_rewrite_callback($matches)

Tham số

  • $matches string

Trả về: string

Khai báo tại src/includes/functions.php:2723

nv_user_avatar_color ​

php
function nv_user_avatar_color($seed)

Sinh màu nền cố định theo tài khoản cho ảnh đại diện dạng chữ. Độ bão hòa và độ sáng được giữ nguyên để chữ màu trắng luôn đủ tương phản

Tham số

  • $seed string

Trả về: string

Khai báo tại src/includes/functions.php:1110

nv_user_avatar_letters ​

php
function nv_user_avatar_letters($first_name, $last_name, $user_name = '')

Lấy tối đa 2 ký tự làm ảnh đại diện dạng chữ

Tham số

  • $first_name string: Tên
  • $last_name string: Họ
  • $user_name string, mặc định ''

Trả về: string

Khai báo tại src/includes/functions.php:1030

nv_user_avatar_url ​

php
function nv_user_avatar_url($photo): string

Lấy URL ảnh đại diện từ giá trị cột photo trong CSDL

Tham số

  • $photo string|null: Đường dẫn tương đối lưu trong CSDL

Trả về: string URL ảnh hoặc rỗng nếu chưa có ảnh

Khai báo tại src/includes/functions.php:1126

nv_user_avatar_words ​

php
function nv_user_avatar_words($string)

Chuẩn hóa chuỗi về dạng chỉ còn chữ và số an toàn

Tham số

  • $string string

Trả về: string

Khai báo tại src/includes/functions.php:1091

nv_user_groups ​

php
function nv_user_groups($in_groups, $res_2step = false, $manual_groups = [])

Tham số

  • $in_groups mixed
  • $res_2step bool, mặc định false
  • $manual_groups array, mặc định []

Trả về: array

Khai báo tại src/includes/functions.php:713

nv_user_in_groups ​

php
function nv_user_in_groups($groups_view)

Tham số

  • $groups_view string

Trả về: bool

Khai báo tại src/includes/functions.php:768

nv_uuid4 ​

php
function nv_uuid4()

Hàm tạo UUID v4

Trả về: string

Xem thêm: https://tools.ietf.org/html/rfc4122

Khai báo tại src/includes/functions.php:4800

parse_csp ​

php
function parse_csp($json_csp)

Tham số

  • $json_csp string

Trả về: string

Khai báo tại src/includes/functions.php:3085

post_async ​

php
function post_async($url, $params = [], $headers = [])

Make an asynchronous POST request Thực hiện yêu cầu POST không đồng bộ trong nội bộ site mà không cần chờ phản hồi => Không ảnh hưởng, không trì hoãn tiến trình đang chạy

post_async()

Tham số

  • $url string
  • $params array, mặc định []
  • $headers array, mặc định []

Khai báo tại src/includes/functions.php:3759

pr ​

php
function pr($a)

Tham số

  • $a mixed

Khai báo tại src/includes/functions.php:22

set_cdn_urls ​

php
function set_cdn_urls(&$global_config, $cdn_is_enabled, $cl_country)

Tham số

  • &$global_config mixed
  • $cdn_is_enabled mixed
  • $cl_country mixed

Khai báo tại src/includes/functions.php:4110

set_verified_password ​

php
function set_verified_password(string $area, string $module = ''): void

Đặt trạng thái đã xác thực mật khẩu cho khu vực area

Tham số

  • $area string
  • $module string, mặc định ''

Trả về: void

Khai báo tại src/includes/functions.php:4305

strip_punctuation ​

php
function strip_punctuation($text)

Tham số

  • $text string

Trả về: string

Khai báo tại src/includes/functions.php:1446

url_get_contents ​

php
function url_get_contents($url)

Tham số

  • $url mixed

Trả về: mixed

Khai báo tại src/includes/functions.php:2646

urlRewriteWithDomain ​

php
function urlRewriteWithDomain($url, $domain)

Tham số

  • $url string
  • $domain string

Trả về: string

Khai báo tại src/includes/functions.php:2828