big change: check_function_exists() -> is_fn()
This commit is contained in:
parent
17303a5909
commit
0e1af27684
|
@ -6,7 +6,7 @@
|
|||
* @brief KISA Whois/Domain/IP/AS Query Helper (https://whois.kr)
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_whois_kr")) {
|
||||
if(!is_fn("get_whois_kr")) {
|
||||
function get_whois_kr($name, $key, $type="whois") {
|
||||
$response = false;
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
* @documentation https://github.com/gnh1201/catsplit-format
|
||||
*/
|
||||
|
||||
if(!check_function_exists("catsplit_unescape")) {
|
||||
if(!is_fn("catsplit_unescape")) {
|
||||
function catsplit_unescape($data) {
|
||||
return trim($data);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("casplit_escape")) {
|
||||
if(!is_fn("casplit_escape")) {
|
||||
function casplit_escape($data) {
|
||||
return htmlspecialchars($data);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("catsplit_encode")) {
|
||||
if(!is_fn("catsplit_encode")) {
|
||||
function catsplit_encode($data) {
|
||||
$_ks = array();
|
||||
$_vs = array();
|
||||
|
@ -34,7 +34,7 @@ if(!check_function_exists("catsplit_encode")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("catsplit_decode")) {
|
||||
if(!is_fn("catsplit_decode")) {
|
||||
function catsplit_decode($data) {
|
||||
$s_final = array();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Go Namhyeon <gnh1201@gmail.com>
|
||||
// 2019-09-25
|
||||
|
||||
if(!check_function_exists("decode_colona_format") {
|
||||
if(!is_fn("decode_colona_format") {
|
||||
function decode_colona_format($data) {
|
||||
$lines = split_by_line(remove_utf8_bom($data));
|
||||
$jobargs = array();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// @date 2019-10-13
|
||||
// @author Go Namhyeon <gnh1201@gmail.com>
|
||||
|
||||
if(!check_function_exists("unzip")) {
|
||||
if(!is_fn("unzip")) {
|
||||
function unzip($src, $dst, $options=array()) {
|
||||
$flag = false;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
// parse telephone number
|
||||
if(!check_function_exists("get_kr_parsed_tel_number")) {
|
||||
if(!is_fn("get_kr_parsed_tel_number")) {
|
||||
function get_kr_parsed_tel_number($tel) {
|
||||
$output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거
|
||||
$local_code = substr($tel, 0, 2);
|
||||
|
@ -22,7 +22,7 @@ if(!check_function_exists("get_kr_parsed_tel_number")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_kr_get_lastname")) {
|
||||
if(!is_fn("get_kr_get_lastname")) {
|
||||
function get_kr_get_lastname()
|
||||
if(loadHelper("string.utils")) {
|
||||
$words = read_storage_file_by_line("kr.lastname.txt", array(
|
||||
|
@ -33,7 +33,7 @@ if(!check_function_exists("get_kr_get_lastname")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_kr_get_firstname")) {
|
||||
if(!is_fn("get_kr_get_firstname")) {
|
||||
function get_kr_get_firstname() {
|
||||
if(loadHelper("string.utils")) {
|
||||
$words = read_storage_file_by_line("kr.firstname.txt", array(
|
||||
|
@ -44,7 +44,7 @@ if(!check_function_exists("get_kr_get_firstname")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_kr_get_generated_name")) {
|
||||
if(!is_fn("get_kr_get_generated_name")) {
|
||||
function get_kr_get_generated_name() {
|
||||
return sprintf("%s%s", get_kr_get_lastname(), get_kr_get_firstname());
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Database alternative driver switcher
|
||||
*/
|
||||
|
||||
if(!check_function_exists("exec_db_alt_callback")) {
|
||||
if(!is_fn("exec_db_alt_callback")) {
|
||||
function exec_db_alt_callback($rules, $params=array(), $driver="") {
|
||||
$result = false;
|
||||
$db_driver = empty($driver) ? get_db_driver() : $driver;
|
||||
|
@ -14,7 +14,7 @@ if(!check_function_exists("exec_db_alt_callback")) {
|
|||
foreach($rules as $rule) {
|
||||
if($rule['driver'] == $db_driver) {
|
||||
if(loadHelper(sprintf("database.%s", $rule['driver']))) {
|
||||
if(check_function_exists($rule['callback'])) {
|
||||
if(is_fn($rule['callback'])) {
|
||||
if(is_array($params) && count($params) > 0) {
|
||||
$result = call_user_func_array($rule['callback'], $params);
|
||||
} else {
|
||||
|
@ -33,7 +33,7 @@ if(!check_function_exists("exec_db_alt_callback")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_alt_connect")) {
|
||||
if(!is_fn("get_db_alt_connect")) {
|
||||
function get_db_alt_connect($driver) {
|
||||
$conn = false;
|
||||
$config = get_config();
|
||||
|
@ -54,7 +54,7 @@ if(!check_function_exists("get_db_alt_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_alt_query")) {
|
||||
if(!is_fn("exec_db_alt_query")) {
|
||||
function exec_db_alt_query($sql, $bind=array(), $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -83,7 +83,7 @@ if(!check_function_exists("exec_db_alt_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_alt_fetch_all")) {
|
||||
if(!is_fn("exec_db_alt_fetch_all")) {
|
||||
function exec_db_alt_fetch_all($sql, $bind=array(), $options=array()) {
|
||||
$rows = array();
|
||||
|
||||
|
@ -104,7 +104,7 @@ if(!check_function_exists("exec_db_alt_fetch_all")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_alt_fetch")) {
|
||||
if(!is_fn("exec_db_alt_fetch")) {
|
||||
function exec_db_alt_fetch($sql, $bind) {
|
||||
$fetched = false;
|
||||
|
||||
|
@ -118,7 +118,7 @@ if(!check_function_exists("exec_db_alt_fetch")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_alt_last_id")) {
|
||||
if(!is_fn("get_db_alt_last_id")) {
|
||||
function get_db_alt_last_id($driver) {
|
||||
$last_id = false;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// database.mssql.pdo.php
|
||||
|
||||
if(!check_function_exists("get_db_mssql_pdo_connect")) {
|
||||
if(!is_fn("get_db_mssql_pdo_connect")) {
|
||||
function get_db_mssql_pdo_connect() {
|
||||
$conn = false;
|
||||
|
||||
|
@ -29,7 +29,7 @@ if(!check_function_exists("get_db_mssql_pdo_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mssql_pdo_query")) {
|
||||
if(!is_fn("exec_db_mssql_pdo_query")) {
|
||||
function exec_db_mssql_pdo_query($sql, $bind=array(), $options=array()) {
|
||||
$dbc = get_value_in_array("dbc", $options, get_dbc_object());
|
||||
|
||||
|
@ -43,7 +43,7 @@ if(!check_function_exists("exec_db_mssql_pdo_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mssql_pdo_fetch_all")) {
|
||||
if(!is_fn("exec_db_mssql_pdo_fetch_all")) {
|
||||
function exec_db_mssql_pdo_fetch_all($sql, $bind=array(), $options=array()) {
|
||||
$rows = array();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief MySQL(MariaDB) command line driver
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_db_mysql_cmd_connect")) {
|
||||
if(!is_fn("get_db_mysql_cmd_connect")) {
|
||||
function get_db_mysql_cmd_connect() {
|
||||
$result = false;
|
||||
$config = get_config();
|
||||
|
@ -28,7 +28,7 @@ if(!check_function_exists("get_db_mysql_cmd_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mysql_cmd_query")) {
|
||||
if(!is_fn("exec_db_mysql_cmd_query")) {
|
||||
function exec_db_mysql_cmd_query($sql, $bind) {
|
||||
$result = false;
|
||||
$config = get_config();
|
||||
|
@ -51,7 +51,7 @@ if(!check_function_exists("exec_db_mysql_cmd_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mysql_cmd_fetch_all")) {
|
||||
if(!is_fn("exec_db_mysql_cmd_fetch_all")) {
|
||||
function exec_db_mysql_cmd_fetch_all($sql, $bind) {
|
||||
$result = false;
|
||||
|
||||
|
@ -59,7 +59,7 @@ if(!check_function_exists("exec_db_mysql_cmd_fetch_all")) {
|
|||
$lines = explode(DOC_EOL, $tsvData);
|
||||
$rows = array();
|
||||
|
||||
if(check_function_exists("str_getcsv")) {
|
||||
if(is_fn("str_getcsv")) {
|
||||
foreach($lines as $line) {
|
||||
$rows[] = str_getcsv($line, "\t");
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief MySQLi database helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_db_mysql_imp_connect")) {
|
||||
if(!is_fn("get_db_mysql_imp_connect")) {
|
||||
function get_db_mysql_imp_connect() {
|
||||
$conn = false;
|
||||
$config = get_config();
|
||||
|
@ -23,7 +23,7 @@ if(!check_function_exists("get_db_mysql_imp_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mysql_imp_query")) {
|
||||
if(!is_fn("exec_db_mysql_imp_query")) {
|
||||
function exec_db_mysql_imp_query($sql, $bind) {
|
||||
$result = false;
|
||||
$dbc = get_dbc_object();
|
||||
|
@ -35,7 +35,7 @@ if(!check_function_exists("exec_db_mysql_imp_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mysql_imp_fetch_all")) {
|
||||
if(!is_fn("exec_db_mysql_imp_fetch_all")) {
|
||||
function exec_db_mysql_imp_fetch_all($sql, $bind) {
|
||||
$rows = array();
|
||||
$result = exec_db_mysql_imp_query($sql, $bind);
|
||||
|
@ -48,7 +48,7 @@ if(!check_function_exists("exec_db_mysql_imp_fetch_all")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("close_db_mysql_imp_connect")) {
|
||||
if(!is_fn("close_db_mysql_imp_connect")) {
|
||||
function close_db_mysql_imp_connect() {
|
||||
$dbc = get_shared_var("dbc");
|
||||
return mysqli_close($dbc);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief MySQL-old (lower than 5.4) database helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_db_mysql_old_connect")) {
|
||||
if(!is_fn("get_db_mysql_old_connect")) {
|
||||
function get_db_mysql_old_connect() {
|
||||
$conn = false;
|
||||
$config = get_config();
|
||||
|
@ -26,7 +26,7 @@ if(!check_function_exists("get_db_mysql_old_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mysql_old_query")) {
|
||||
if(!is_fn("exec_db_mysql_old_query")) {
|
||||
function exec_db_mysql_old_query($sql, $bind) {
|
||||
$result = false;
|
||||
$dbc = get_dbc_object();
|
||||
|
@ -38,7 +38,7 @@ if(!check_function_exists("exec_db_mysql_old_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_mysql_old_fetch_all")) {
|
||||
if(!is_fn("exec_db_mysql_old_fetch_all")) {
|
||||
function exec_db_mysql_old_fetch_all($sql, $bind) {
|
||||
$rows = array();
|
||||
$result = exec_db_mysql_old_query($sql, $bind);
|
||||
|
@ -51,7 +51,7 @@ if(!check_function_exists("exec_db_mysql_old_fetch_all")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("close_db_mysql_old_connect")) {
|
||||
if(!is_fn("close_db_mysql_old_connect")) {
|
||||
function close_db_mysql_old_connect() {
|
||||
$dbc = get_shared_var("dbc");
|
||||
return mysql_close($dbc);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Oracle database helper for ReasonableFramework
|
||||
*/
|
||||
|
||||
if(!check_function_exists("check_db_oracle_installed")) {
|
||||
if(!is_fn("check_db_oracle_installed")) {
|
||||
function check_db_oracle_installed() {
|
||||
$fn = check_invalid_function(array(
|
||||
"NO_FUNCTION_OCI_PARSE" => "oci_parse",
|
||||
|
@ -25,13 +25,13 @@ if(!check_function_exists("check_db_oracle_installed")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_orable_binded_sql")) {
|
||||
if(!is_fn("get_db_orable_binded_sql")) {
|
||||
function get_db_orable_binded_sql($sql, $bind) {
|
||||
return get_db_binded_sql($sql, $bind);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_oracle_stmt")) {
|
||||
if(!is_fn("get_db_oracle_stmt")) {
|
||||
function get_db_oracle_stmt($sql, $bind) {
|
||||
$stmt = NULL;
|
||||
|
||||
|
@ -46,7 +46,7 @@ if(!check_function_exists("get_db_oracle_stmt")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_oracle_connect")) {
|
||||
if(!is_fn("exec_db_oracle_connect")) {
|
||||
function exec_db_oracle_connect($host, $port, $user, $password, $options=array()) {
|
||||
$conn = NULL;
|
||||
$envs = get_value_in_array("envs", $options, array());
|
||||
|
@ -90,7 +90,7 @@ if(!check_function_exists("exec_db_oracle_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_oracle_fetch_all")) {
|
||||
if(!is_fn("exec_db_oracle_fetch_all")) {
|
||||
function exec_db_oracle_fetch_all($sql, $bind, $conn) {
|
||||
$rows = array();
|
||||
|
||||
|
@ -111,7 +111,7 @@ if(!check_function_exists("exec_db_oracle_fetch_all")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_oracle_query")) {
|
||||
if(!is_fn("exec_db_oracle_query")) {
|
||||
function exec_db_oracle_query($sql, $bind, $conn) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -128,7 +128,7 @@ if(!check_function_exists("exec_db_oracle_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("close_db_oracle_connect")) {
|
||||
if(!is_fn("close_db_oracle_connect")) {
|
||||
function close_db_oracle_connect() {
|
||||
$dbc = get_shared_var("dbc");
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* in the webserver configuration. The function execTests returns an array, which
|
||||
* contains names of all successful tested PHP functions.
|
||||
*/
|
||||
if(!check_function_exists("exec_test")) {
|
||||
if(!is_fn("exec_test")) {
|
||||
function exec_test() {
|
||||
$cmd = "whoami";
|
||||
$cmdPath = "/usr/bin/whoami";
|
||||
|
@ -103,7 +103,7 @@ if(!check_function_exists("exec_test")) {
|
|||
/*
|
||||
* exec_command() executes a command (like "whoami") with the submited method
|
||||
*/
|
||||
if(!check_function_exists("exec_command")) {
|
||||
if(!is_fn("exec_command")) {
|
||||
function exec_command($command, $method="shell_exec", $options=array()) {
|
||||
$return = false;
|
||||
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
*/
|
||||
|
||||
// get database prefix
|
||||
if(!check_function_exists("gnb_get_db_prefix")) {
|
||||
if(!is_fn("gnb_get_db_prefix")) {
|
||||
function gnb_get_db_prefix($version=4) {
|
||||
return ($version > 4) ? "g5_" : "g4_";
|
||||
}
|
||||
}
|
||||
|
||||
// get table
|
||||
if(!check_function_exists("gnb_get_db_table")) {
|
||||
if(!is_fn("gnb_get_db_table")) {
|
||||
function gnb_get_db_table($tablename) {
|
||||
return (gnb_get_db_prefix() . $tablename);
|
||||
}
|
||||
}
|
||||
|
||||
// get write table
|
||||
if(!check_function_exists("gnb_get_write_table")) {
|
||||
if(!is_fn("gnb_get_write_table")) {
|
||||
function gnb_get_write_table($tablename, $version=4) {
|
||||
$write_prefix = gnb_get_db_prefix() . "write_";
|
||||
$write_table = $write_prefix . $tablename;
|
||||
|
@ -30,7 +30,7 @@ if(!check_function_exists("gnb_get_write_table")) {
|
|||
}
|
||||
|
||||
// get write next
|
||||
if(!check_function_exists("gnb_get_write_next")) {
|
||||
if(!is_fn("gnb_get_write_next")) {
|
||||
function gnb_get_write_next($tablename) {
|
||||
$row = exec_db_fetch("select min(wr_num) as min_wr_num from " . gnb_get_write_table($tablename));
|
||||
return (intval(get_value_in_array("min_wr_num", $row, 0)) - 1);
|
||||
|
@ -38,7 +38,7 @@ if(!check_function_exists("gnb_get_write_next")) {
|
|||
}
|
||||
|
||||
// write post
|
||||
if(!check_function_exists("gnb_write_post")) {
|
||||
if(!is_fn("gnb_write_post")) {
|
||||
function gnb_write_post($tablename, $data=array(), $version=4) {
|
||||
$result = 0;
|
||||
|
||||
|
@ -112,14 +112,14 @@ if(!check_function_exists("gnb_write_post")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("gnb_get_posts")) {
|
||||
if(!is_fn("gnb_get_posts")) {
|
||||
function gnb_get_posts($table_name, $page=1, $limit=20, $options=array()) {
|
||||
$sql = "select * from " . gnb_get_write_table($table_name) . " order by wr_id desc" . get_page_range($page, $limit);
|
||||
return exec_db_fetch_all($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("gnb_get_post_by_id")) {
|
||||
if(!is_fn("gnb_get_post_by_id")) {
|
||||
function gnb_get_post_by_id($table_name, $post_id) {
|
||||
$sql = "select * from " . gnb_get_write_table($table_name) . " where wr_id = :wr_id";
|
||||
return exec_db_fetch($sql, array(
|
||||
|
@ -128,7 +128,7 @@ if(!check_function_exists("gnb_get_post_by_id")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("gnb_set_post_parameters")) {
|
||||
if(!is_fn("gnb_set_post_parameters")) {
|
||||
function gnb_set_post_parameters($tablename, $wr_id, $bind=array()) {
|
||||
$flag = false;
|
||||
$excludes = array("wr_id");
|
||||
|
@ -144,7 +144,7 @@ if(!check_function_exists("gnb_set_post_parameters")) {
|
|||
}
|
||||
|
||||
// get member data
|
||||
if(!check_function_exists("gnb_get_member")) {
|
||||
if(!is_fn("gnb_get_member")) {
|
||||
function gnb_get_member($user_name, $tablename="member") {
|
||||
$result = array();
|
||||
|
||||
|
@ -160,7 +160,7 @@ if(!check_function_exists("gnb_get_member")) {
|
|||
}
|
||||
|
||||
// get password
|
||||
if(!check_function_exists("gnb_get_password")) {
|
||||
if(!is_fn("gnb_get_password")) {
|
||||
function gnb_get_password($password) {
|
||||
$bind = array(
|
||||
"password" => $password,
|
||||
|
@ -171,7 +171,7 @@ if(!check_function_exists("gnb_get_password")) {
|
|||
}
|
||||
|
||||
// get config
|
||||
if(!check_function_exists("gnb_get_config")) {
|
||||
if(!is_fn("gnb_get_config")) {
|
||||
function gnb_get_config($tablename="config") {
|
||||
$result = array();
|
||||
|
||||
|
@ -183,7 +183,7 @@ if(!check_function_exists("gnb_get_config")) {
|
|||
}
|
||||
|
||||
// run login process
|
||||
if(!check_function_exists("gnb_process_safe_login")) {
|
||||
if(!is_fn("gnb_process_safe_login")) {
|
||||
function gnb_process_safe_login($user_name, $user_password) {
|
||||
$result = false;
|
||||
$mb = gnb_get_member($user_name);
|
||||
|
@ -201,7 +201,7 @@ if(!check_function_exists("gnb_process_safe_login")) {
|
|||
}
|
||||
|
||||
// run join member
|
||||
if(!check_function_exists("gnb_join_member")) {
|
||||
if(!is_fn("gnb_join_member")) {
|
||||
function gnb_join_member($user_name, $user_password, $data=array(), $tablename="member") {
|
||||
$result = false;
|
||||
|
||||
|
@ -288,7 +288,7 @@ if(!check_function_exists("gnb_join_member")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("gnb_make_pipelined_data")) {
|
||||
if(!is_fn("gnb_make_pipelined_data")) {
|
||||
function gnb_make_pipelined_data($data, $delimiter="|") {
|
||||
foreach($data as $k=>$v) {
|
||||
$data[$k] = str_replace($delimiter, " ", $v);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief HybridAuth DB Helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("store_hybridauth_session")) {
|
||||
if(!is_fn("store_hybridauth_session")) {
|
||||
function store_hybridauth_session($data, $user_id) {
|
||||
$connection_id = false;
|
||||
|
||||
|
@ -23,7 +23,7 @@ if(!check_function_exists("store_hybridauth_session")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_stored_hybridauth_session")) {
|
||||
if(!is_fn("get_stored_hybridauth_session")) {
|
||||
function get_stored_hybridauth_session($connection_id) {
|
||||
$stored_session = false;
|
||||
|
||||
|
@ -39,7 +39,7 @@ if(!check_function_exists("get_stored_hybridauth_session")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_hybridauth_connection_info")) {
|
||||
if(!is_fn("get_hybridauth_connection_info")) {
|
||||
function get_hybridauth_connection_info($connection_id) {
|
||||
$connection_info = false;
|
||||
|
||||
|
@ -57,7 +57,7 @@ if(!check_function_exists("get_hybridauth_connection_info")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_hybridauth_connection_id")) {
|
||||
if(!is_fn("get_hybridauth_connection_id")) {
|
||||
function get_hybridauth_connection_id($user_id) {
|
||||
$connection_id = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief HybridAuth library RSF Linker
|
||||
***/
|
||||
|
||||
if(!check_function_exists("hybridauth_load")) {
|
||||
if(!is_fn("hybridauth_load")) {
|
||||
function hybridauth_load($provider="") {
|
||||
$result = false;
|
||||
|
||||
|
@ -43,7 +43,7 @@ if(!check_function_exists("hybridauth_load")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("hybridauth_check_redirect")) {
|
||||
if(!is_fn("hybridauth_check_redirect")) {
|
||||
function hybridauth_check_redirect() {
|
||||
$flag = false;
|
||||
$requests = get_requests();
|
||||
|
@ -61,7 +61,7 @@ if(!check_function_exists("hybridauth_check_redirect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("hybridauth_process")) {
|
||||
if(!is_fn("hybridauth_process")) {
|
||||
function hybridauth_process() {
|
||||
Hybrid_Endpoint::process();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief IsEmail library linker
|
||||
*/
|
||||
|
||||
if(!check_function_exists("is_email")) {
|
||||
if(!is_fn("is_email")) {
|
||||
$inc_file = "./vendor/_dist/isemail/is_email.php";
|
||||
if(file_exists($inc_file)) {
|
||||
include($inc_file);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief jCryption (alternative HTTPS on javascript) Helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("jCryption_load")) {
|
||||
if(!is_fn("jCryption_load")) {
|
||||
function jCryption_load() {
|
||||
$required_files = array(
|
||||
"jCryption/sqAES",
|
||||
|
@ -21,7 +21,7 @@ if(!check_function_exists("jCryption_load")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("jCryption_get")) {
|
||||
if(!is_fn("jCryption_get")) {
|
||||
function jCryption_get($idx=0, $selector="") {
|
||||
$s = array();
|
||||
$s[] = "JCryption::decrypt();";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// @updated_on 2020-01-27
|
||||
// @author Go Namhyeon <gnh1201@gmail.com>
|
||||
|
||||
if(!check_function_exists("json_decode_ex")) {
|
||||
if(!is_fn("json_decode_ex")) {
|
||||
function json_decode_ex($data, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -29,7 +29,7 @@ if(!check_function_exists("json_decode_ex")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("json_encode_ex")) {
|
||||
if(!is_fn("json_encode_ex")) {
|
||||
function json_encode_ex($data, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
||||
|
||||
if(!check_function_exists("lguplus_install")) {
|
||||
if(!is_fn("lguplus_install")) {
|
||||
function lguplus_install() {
|
||||
$response = get_web_page("https://openapi.sms.uplus.co.kr/sdkFile/php_sdk.zip");
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @documentation https://documentation.mailgun.com/en/latest/api-sending.html
|
||||
*/
|
||||
|
||||
if(!check_function_exists("mailgun_get_config")) {
|
||||
if(!is_fn("mailgun_get_config")) {
|
||||
function mailgun_get_config() {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -20,7 +20,7 @@ if(!check_function_exists("mailgun_get_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("mailgun_send_message")) {
|
||||
if(!is_fn("mailgun_send_message")) {
|
||||
function mailgun_send_message($content, $to, $subject="Untitled") {
|
||||
$response = false;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @documentation https://www.w3.org/Mobile/training/device-detection/mobile_detector.txt
|
||||
*/
|
||||
|
||||
if(!check_function_exists("detect_mobile")) {
|
||||
if(!is_fn("detect_mobile")) {
|
||||
function detect_mobile() {
|
||||
// This function returns the value of a local variable ($dm)
|
||||
// that is 0 if a desktop client is detected and > 0 for mobile.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Network tool helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_network_event")) {
|
||||
if(!is_fn("get_network_event")) {
|
||||
function get_network_event() {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -24,7 +24,7 @@ if(!check_function_exists("get_network_event")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_network_client_addr")) {
|
||||
if(!is_fn("get_network_client_addr")) {
|
||||
function get_network_client_addr() {
|
||||
$addr = '';
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP']))
|
||||
|
@ -47,7 +47,7 @@ if(!check_function_exists("get_network_client_addr")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_network_server_addr")) {
|
||||
if(!is_fn("get_network_server_addr")) {
|
||||
function get_network_server_addr() {
|
||||
$addr = '';
|
||||
if(isset($_SERVER['SERVER_ADDR']) && isset($_SERVER['SERVER_PORT'])) {
|
||||
|
@ -56,7 +56,7 @@ if(!check_function_exists("get_network_server_addr")) {
|
|||
$addr = $_SERVER['SERVER_ADDR'];
|
||||
} else if(isset($_SERVER['LOCAL_ADDR'])) {
|
||||
$addr = $_SERVER['LOCAL_ADDR'];
|
||||
} else if(check_function_exists(array("gethostname", "gethostbyname"))) {
|
||||
} else if(is_fn(array("gethostname", "gethostbyname"))) {
|
||||
$host = gethostname();
|
||||
$addr = gethostbyname($host);
|
||||
} else {
|
||||
|
@ -66,14 +66,14 @@ if(!check_function_exists("get_network_server_addr")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_network_hostname")) {
|
||||
if(!is_fn("get_network_hostname")) {
|
||||
function get_network_hostname() {
|
||||
$host = '';
|
||||
if(isset($_SERVER['HTTP_HOST'])) {
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
} else if(isset($_SERVER['SERVER_NAME'])) {
|
||||
$host = $_SERVER['SERVER_NAME'];
|
||||
} else if(!check_function_exists('gethostname')) {
|
||||
} else if(!is_fn('gethostname')) {
|
||||
$host = gethostname();
|
||||
} else {
|
||||
$host = 'UNKNOWN';
|
||||
|
@ -83,13 +83,13 @@ if(!check_function_exists("get_network_hostname")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_secure_protocol")) {
|
||||
if(!is_fn("check_secure_protocol")) {
|
||||
function check_secure_protocol() {
|
||||
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_os_platform")) {
|
||||
if(!is_fn("get_os_platform")) {
|
||||
function get_os_platform() {
|
||||
$os = "";
|
||||
|
||||
|
@ -103,7 +103,7 @@ if(!check_function_exists("get_os_platform")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_network_outbound_addr")) {
|
||||
if(!is_fn("get_network_outbound_addr")) {
|
||||
function get_network_outbound_addr($protocol="") {
|
||||
$addr = false;
|
||||
$config = get_config();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief PHP Obfuscator for ReasonableFramework
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_obfuscator")) {
|
||||
if(!is_fn("get_obfuscator")) {
|
||||
function get_obfuscator() {
|
||||
$obfuscator = rand(1, 15);
|
||||
set_shared_var("obfuscator", $obfuscator);
|
||||
|
@ -14,7 +14,7 @@ if(!check_function_exists("get_obfuscator")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_obfuscated_result")) {
|
||||
if(!is_fn("get_obfuscated_result")) {
|
||||
function get_obfuscated_result($raw) {
|
||||
$result = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Page navigation helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("paginate_get_current_page")) {
|
||||
if(!is_fn("paginate_get_current_page")) {
|
||||
function paginate_get_current_page($page=1) {
|
||||
$current_page = 1;
|
||||
|
||||
|
@ -18,7 +18,7 @@ if(!check_function_exists("paginate_get_current_page")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("paginate_get_total_pages")) {
|
||||
if(!is_fn("paginate_get_total_pages")) {
|
||||
function paginate_get_total_pages($item_per_page=1.0, $total_records=1.0) {
|
||||
$total_pages = 1;
|
||||
|
||||
|
@ -30,7 +30,7 @@ if(!check_function_exists("paginate_get_total_pages")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("paginate_get_query_string")) {
|
||||
if(!is_fn("paginate_get_query_string")) {
|
||||
function paginate_get_query_string() {
|
||||
loadHelper("networktool");
|
||||
$net_event = get_network_event();
|
||||
|
@ -39,7 +39,7 @@ if(!check_function_exists("paginate_get_query_string")) {
|
|||
}
|
||||
|
||||
// https://www.sanwebe.com/2011/05/php-pagination-function
|
||||
if(!check_function_exists("paginate_make_html")) {
|
||||
if(!is_fn("paginate_make_html")) {
|
||||
function paginate_make_html($item_per_page, $current_page, $total_records, $total_pages, $page_url, $qry='') {
|
||||
$pagination = '';
|
||||
if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages) { //verify total pages and current page number
|
||||
|
|
|
@ -10,7 +10,7 @@ if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
|
|||
|
||||
loadHelper("pgkcp.lnk");
|
||||
|
||||
if(!check_function_exists("install_pgkcp")) {
|
||||
if(!is_fn("install_pgkcp")) {
|
||||
function install_pgkcp() {
|
||||
$response = get_web_page("https://admin8.kcp.co.kr/assist/download/sampleDownload", "get", array(
|
||||
"type1" => "FM01",
|
||||
|
|
|
@ -14,13 +14,13 @@ loadHelper("webpagetool");
|
|||
loadHelper("compress.zip");
|
||||
loadHelper("exectool");
|
||||
|
||||
if(!check_function_exists("get_pgkcp_config")) {
|
||||
if(!is_fn("get_pgkcp_config")) {
|
||||
function get_pgkcp_dir() {
|
||||
return get_current_working_dir() . "/vendor/_dist/pgkcp";
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_pgkcp_config")) {
|
||||
if(!is_fn("get_pgkcp_config")) {
|
||||
function get_pgkcp_config() {
|
||||
$pgkcp_config = array();
|
||||
|
||||
|
@ -73,7 +73,7 @@ if(!check_function_exists("get_pgkcp_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_pgkcp_platform")) {
|
||||
if(!is_fn("get_pgkcp_platform")) {
|
||||
function get_pgkcp_platform($pgkcp_config) {
|
||||
$platform = false;
|
||||
|
||||
|
@ -93,7 +93,7 @@ if(!check_function_exists("get_pgkcp_platform")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("load_pgkcp_library")) {
|
||||
if(!is_fn("load_pgkcp_library")) {
|
||||
function load_pgkcp_library() {
|
||||
$inc_file = get_pgkcp_dir() . "/sample/pp_cli_hub_lib.php";
|
||||
if(file_exists($inc_file)) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @updated_on 2020-01-23
|
||||
*/
|
||||
|
||||
if(!check_function_exists("rfc3164_get_config")) {
|
||||
if(!is_fn("rfc3164_get_config")) {
|
||||
function rfc3164_get_config() {
|
||||
$config = get_config();
|
||||
return array(
|
||||
|
@ -19,7 +19,7 @@ if(!check_function_exists("rfc3164_get_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("rfc3164_send_message")) {
|
||||
if(!is_fn("rfc3164_send_message")) {
|
||||
function rfc3164_send_message($message, $component = "web", $program = "next_big_thing") {
|
||||
$_config = rfc3164_get_config();
|
||||
|
||||
|
|
|
@ -1206,7 +1206,7 @@ class simple_html_dom
|
|||
|
||||
$charset = null;
|
||||
|
||||
if (!check_function_exists('get_last_retrieve_url_contents_content_type'))
|
||||
if (!is_fn('get_last_retrieve_url_contents_content_type'))
|
||||
{
|
||||
$contentTypeHeader = get_last_retrieve_url_contents_content_type();
|
||||
$success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
|
||||
|
@ -1248,7 +1248,7 @@ class simple_html_dom
|
|||
{
|
||||
// Use this in case mb_detect_charset isn't installed/loaded on this machine.
|
||||
$charset = false;
|
||||
if (!check_function_exists('mb_detect_encoding'))
|
||||
if (!is_fn('mb_detect_encoding'))
|
||||
{
|
||||
// Have php try to detect the encoding from the text given to us.
|
||||
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief SocialTools (refactoring from SocioRouter)
|
||||
*/
|
||||
|
||||
if(!check_function_exists("social_send_message")) {
|
||||
if(!is_fn("social_send_message")) {
|
||||
function social_send_message($provider, $adapter, $message, $options=array()) {
|
||||
$response = false;
|
||||
$status = array(
|
||||
|
@ -48,7 +48,7 @@ if(!check_function_exists("social_send_message")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("social_parse_object_id")) {
|
||||
if(!is_fn("social_parse_object_id")) {
|
||||
function social_parse_object_id($provider, $response) {
|
||||
$object_id = false;
|
||||
|
||||
|
@ -69,7 +69,7 @@ if(!check_function_exists("social_parse_object_id")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("social_get_object")) {
|
||||
if(!is_fn("social_get_object")) {
|
||||
function social_get_object($provider, $adapter, $object_id) {
|
||||
$result = false;
|
||||
$access_token = $adapter->getAccessToken();
|
||||
|
@ -90,7 +90,7 @@ if(!check_function_exists("social_get_object")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("social_get_object_facebook")) {
|
||||
if(!is_fn("social_get_object_facebook")) {
|
||||
function social_get_object_facebook($adapter, $object_id, $type="post") {
|
||||
$result = false;
|
||||
$response = false;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Excel file parser
|
||||
***/
|
||||
|
||||
if(!check_function_exists("parse_excel_file")) {
|
||||
if(!is_fn("parse_excel_file")) {
|
||||
function parse_excel_file($filepath, $format="xlsx", $setColumnName=false) {
|
||||
$rows = array();
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
* @brief String utility helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_converted_string")) {
|
||||
if(!is_fn("get_converted_string")) {
|
||||
function get_converted_string($str, $to_charset="detect", $from_charset="detect") {
|
||||
$result = false;
|
||||
|
||||
// detect charset (input)
|
||||
if($form_charset == "detect") {
|
||||
if(check_function_exists(array("mb_detect_encoding", "mb_detect_order"))) {
|
||||
if(is_fn(array("mb_detect_encoding", "mb_detect_order"))) {
|
||||
$from_charset = mb_detect_encoding($str, mb_detect_order(), true);
|
||||
} else {
|
||||
$from_charset = "ISO-8859-1";
|
||||
|
@ -22,9 +22,9 @@ if(!check_function_exists("get_converted_string")) {
|
|||
|
||||
// detect charset (output)
|
||||
if($to_charset == "detect") {
|
||||
if(check_function_exists("mb_internal_encoding")) {
|
||||
if(is_fn("mb_internal_encoding")) {
|
||||
$to_charset = mb_internal_encoding();
|
||||
} elseif(check_function_exists("iconv_get_encoding")) {
|
||||
} elseif(is_fn("iconv_get_encoding")) {
|
||||
$to_charset = iconv_get_encoding("internal_encoding");
|
||||
} else {
|
||||
$_candidates = array(
|
||||
|
@ -49,9 +49,9 @@ if(!check_function_exists("get_converted_string")) {
|
|||
// test conditions
|
||||
if($from_charset == $to_charset) {
|
||||
$result = $str;
|
||||
} elseif(check_function_exists("iconv")) {
|
||||
} elseif(is_fn("iconv")) {
|
||||
$result = iconv($from_charset, $to_charset, $str);
|
||||
} elseif(check_function_exists("mb_convert_encoding")) {
|
||||
} elseif(is_fn("mb_convert_encoding")) {
|
||||
$result = mb_convert_encoding($str, $to_charset, $from_charset);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ if(!check_function_exists("get_converted_string")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("nl2p")) {
|
||||
if(!is_fn("nl2p")) {
|
||||
function nl2p($string) {
|
||||
$paragraphs = '';
|
||||
foreach (explode("\n", $string) as $line) {
|
||||
|
@ -71,31 +71,31 @@ if(!check_function_exists("nl2p")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("br2nl")) {
|
||||
if(!is_fn("br2nl")) {
|
||||
function br2nl($string) {
|
||||
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("br2p")) {
|
||||
if(!is_fn("br2p")) {
|
||||
function br2p($string) {
|
||||
return nl2p(br2nl($string));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_formatted_number")) {
|
||||
if(!is_fn("get_formatted_number")) {
|
||||
function get_formatted_number($value) {
|
||||
return number_format(floatval($value));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_cutted_string")) {
|
||||
if(!is_fn("get_cutted_string")) {
|
||||
function get_cutted_string($str, $start, $len=null, $charset="utf-8") {
|
||||
$result = "";
|
||||
|
||||
if(check_function_exists("iconv_substr")) {
|
||||
if(is_fn("iconv_substr")) {
|
||||
$result = iconv_substr($str, $start, $len, $charset);
|
||||
} elseif(check_function_exists("mb_substr")) {
|
||||
} elseif(is_fn("mb_substr")) {
|
||||
$result = mb_substr($str, $start, $len, $charset);
|
||||
} else {
|
||||
$result = substr($str, $start, $len);
|
||||
|
@ -105,13 +105,13 @@ if(!check_function_exists("get_cutted_string")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_string_length")) {
|
||||
if(!is_fn("get_string_length")) {
|
||||
function get_string_length($str, $charset="utf-8") {
|
||||
$len = 0;
|
||||
|
||||
if(check_function_exists("iconv_strlen")) {
|
||||
if(is_fn("iconv_strlen")) {
|
||||
$len = iconv_strlen($str, $charset);
|
||||
} elseif(check_function_exists("mb_strlen")) {
|
||||
} elseif(is_fn("mb_strlen")) {
|
||||
$len = mb_strlen($str, $charset);
|
||||
} else {
|
||||
$len = strlen($str);
|
||||
|
@ -121,7 +121,7 @@ if(!check_function_exists("get_string_length")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_splitted_strings")) {
|
||||
if(!is_fn("get_splitted_strings")) {
|
||||
function get_splitted_strings($str, $len=32, $chsarset="utf-8") {
|
||||
$strings = array();
|
||||
|
||||
|
@ -145,27 +145,27 @@ if(!check_function_exists("get_splitted_strings")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("split_by_line")) {
|
||||
if(!is_fn("split_by_line")) {
|
||||
function split_by_line($str) {
|
||||
return preg_split('/\n|\r\n?/', $str);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("read_storage_file_by_line")) {
|
||||
if(!is_fn("read_storage_file_by_line")) {
|
||||
function read_storage_file_by_line($filename, $options=array()) {
|
||||
return split_by_line(read_storage_file($filename, $options));
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
|
||||
if(!check_function_exists("startsWith")) {
|
||||
if(!is_fn("startsWith")) {
|
||||
function startsWith($haystack, $needle) {
|
||||
$length = strlen($needle);
|
||||
return (substr($haystack, 0, $length) === $needle);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("endsWith")) {
|
||||
if(!is_fn("endsWith")) {
|
||||
function endsWith($haystack, $needle) {
|
||||
$length = strlen($needle);
|
||||
if($length == 0) {
|
||||
|
@ -177,7 +177,7 @@ if(!check_function_exists("endsWith")) {
|
|||
}
|
||||
|
||||
// https://stackoverflow.com/questions/4955433/php-multiple-delimiters-in-explode/27767665#27767665
|
||||
if(!check_function_exists("multi_explode")) {
|
||||
if(!is_fn("multi_explode")) {
|
||||
function multi_explode($delimiters, $string) {
|
||||
$ready = str_replace($delimiters, $delimiters[0], $string);
|
||||
$launch = explode($delimiters[0], $ready);
|
||||
|
@ -185,7 +185,7 @@ if(!check_function_exists("multi_explode")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("multi_strpos")) {
|
||||
if(!is_fn("multi_strpos")) {
|
||||
function multi_strpos($string, $delimiters, $offset=0) {
|
||||
$last_pos = strlen($string) - 1;
|
||||
$pos = $last_pos;
|
||||
|
@ -205,7 +205,7 @@ if(!check_function_exists("multi_strpos")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("multi_str_split")) {
|
||||
if(!is_fn("multi_str_split")) {
|
||||
function multi_str_split($string, $delimiters) {
|
||||
$strings = array();
|
||||
|
||||
|
@ -223,7 +223,7 @@ if(!check_function_exists("multi_str_split")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("parse_pipelined_data")) {
|
||||
if(!is_fn("parse_pipelined_data")) {
|
||||
function parse_pipelined_data($pipelined_data, $keynames=array()) {
|
||||
$result = array();
|
||||
$parsed_data = explode("|", $pipelined_data);
|
||||
|
@ -243,7 +243,7 @@ if(!check_function_exists("parse_pipelined_data")) {
|
|||
}
|
||||
|
||||
// https://stackoverflow.com/questions/10290849/how-to-remove-multiple-utf-8-bom-sequences
|
||||
if(!check_function_exists("remove_utf8_bom")) {
|
||||
if(!is_fn("remove_utf8_bom")) {
|
||||
function remove_utf8_bom($text) {
|
||||
$bom = pack('H*','EFBBBF');
|
||||
$text = preg_replace("/^$bom/", '', $text);
|
||||
|
@ -251,7 +251,7 @@ if(!check_function_exists("remove_utf8_bom")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_tokenized_text")) {
|
||||
if(!is_fn("get_tokenized_text")) {
|
||||
function get_tokenized_text($text, $delimiters=array()) {
|
||||
if(count($delimiters) > 0) {
|
||||
return array_values(array_filter(multi_explode($delimiters, $text)));
|
||||
|
@ -261,7 +261,7 @@ if(!check_function_exists("get_tokenized_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_highlighted_html_by_words")) {
|
||||
if(!is_fn("get_highlighted_html_by_words")) {
|
||||
function get_highlighted_html_by_word($word, $text, $delimiters=array()) {
|
||||
$html = $text;
|
||||
|
||||
|
@ -274,19 +274,19 @@ if(!check_function_exists("get_highlighted_html_by_words")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_floating_percentage")) {
|
||||
if(!is_fn("get_floating_percentage")) {
|
||||
function get_floating_percentage($x, $a=2) {
|
||||
return round(floatval($x) / 100, floatval($a));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("eregi_compatible")) {
|
||||
if(!is_fn("eregi_compatible")) {
|
||||
function eregi_compatible($pattern, $subject, &$matches=NULL) {
|
||||
return preg_match(sprintf("/%s/i", $pattern), $subject, $matches);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("eregi_replace_compatible")) {
|
||||
if(!is_fn("eregi_replace_compatible")) {
|
||||
function eregi_replace_compatible($pattern, $replacement, $subject) {
|
||||
return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief TableWiz helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("tablewiz_cut_str")) {
|
||||
if(!is_fn("tablewiz_cut_str")) {
|
||||
function tablewiz_cut_str($str, $strlimit=0) {
|
||||
$plaintext = strip_tags($str);
|
||||
|
||||
|
@ -19,7 +19,7 @@ if(!check_function_exists("tablewiz_cut_str")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("tablewiz_create")) {
|
||||
if(!is_fn("tablewiz_create")) {
|
||||
function tablewiz_create($rows, $bind=array(), $domid="", $domclass="", $strlimit=0, $thead_html=array(), $tbody_html_list=array()) {
|
||||
$html = "";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
if(!check_function_exists("get_youtube_thumbnail")) {
|
||||
if(!is_fn("get_youtube_thumbnail")) {
|
||||
function get_youtube_thumbnail($vi) {
|
||||
$ytimgs = array();
|
||||
$ytimg_urls = array();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
/* Query a time server (C) 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */
|
||||
if(!check_function_exists("query_time_server")) {
|
||||
if(!is_fn("query_time_server")) {
|
||||
function query_time_server($timeserver, $socket) {
|
||||
// parameters: server, socket, error code, error text, timeout
|
||||
$fp = fsockopen($timeserver,$socket,$err,$errstr,5);
|
||||
|
@ -28,7 +28,7 @@ if(!check_function_exists("query_time_server")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_server_time")) {
|
||||
if(!is_fn("get_server_time")) {
|
||||
function get_server_time($timeserver="time.bora.net") {
|
||||
$timestamp = false;
|
||||
$timercvd = query_time_server($timeserver, 37);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @documentation https://www.twilio.com/docs/sms/send-messages
|
||||
*/
|
||||
|
||||
if(!check_function_exists("twilio_get_config")) {
|
||||
if(!is_fn("twilio_get_config")) {
|
||||
function twilio_get_config() {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -20,7 +20,7 @@ if(!check_function_exists("twilio_get_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("twilio_get_message_blocks")) {
|
||||
if(!is_fn("twilio_get_message_blocks")) {
|
||||
function twilio_parse_messages($message) {
|
||||
$strings = array();
|
||||
|
||||
|
@ -36,7 +36,7 @@ if(!check_function_exists("twilio_get_message_blocks")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("twilio_send_message")) {
|
||||
if(!is_fn("twilio_send_message")) {
|
||||
function twilio_send_message($message, $to) {
|
||||
$response = false;
|
||||
|
||||
|
@ -67,7 +67,7 @@ if(!check_function_exists("twilio_send_message")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("twilio_send_voice")) {
|
||||
if(!is_fn("twilio_send_voice")) {
|
||||
function twilio_send_voice($message="", $to) {
|
||||
$response = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Geo Helper based on vWorld (vworld.kr, molit.go.kr)
|
||||
*/
|
||||
|
||||
if(!check_function_exists("vworld_utf8_replace")) {
|
||||
if(!is_fn("vworld_utf8_replace")) {
|
||||
function vworld_utf8_replace($data) {
|
||||
$regex = <<<'END'
|
||||
/
|
||||
|
@ -32,7 +32,7 @@ END;
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("vworld_geocode_keyword")) {
|
||||
if(!is_fn("vworld_geocode_keyword")) {
|
||||
function vworld_geocode_keyword($keyword, $category="Poi", $multiple=false) {
|
||||
global $config;
|
||||
|
||||
|
@ -132,7 +132,7 @@ if(!check_function_exists("vworld_geocode_keyword")) {
|
|||
}
|
||||
|
||||
// get geocode from vworld
|
||||
if(!check_function_exists("vworld_geocode_addr2coord")) {
|
||||
if(!is_fn("vworld_geocode_addr2coord")) {
|
||||
function vworld_geocode_addr2coord($addr) {
|
||||
global $config;
|
||||
|
||||
|
@ -228,7 +228,7 @@ if(!check_function_exists("vworld_geocode_addr2coord")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("vworld_adaptive_addr2coord")) {
|
||||
if(!is_fn("vworld_adaptive_addr2coord")) {
|
||||
function vworld_adaptive_addr2coord($addr) {
|
||||
$geopoint = array(
|
||||
"address" => "",
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* * `Slack` is trademark of Slack Technologies Inc.
|
||||
*/
|
||||
|
||||
if(!check_function_exists("send_web_hook")) {
|
||||
if(!is_fn("send_web_hook")) {
|
||||
function send_web_hook($message, $networkid, $options=array()) {
|
||||
$response = false;
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
/* // PRINT CONTENT: echo $response['content']; */
|
||||
/****** END EXAMPLES *****/
|
||||
|
||||
if(!check_function_exists("get_web_fgc")) {
|
||||
if(!is_fn("get_web_fgc")) {
|
||||
function get_web_fgc($url) {
|
||||
return (ini_get("allow_url_fopen") ? file_get_contents($url) : false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_build_qs")) {
|
||||
if(!is_fn("get_web_build_qs")) {
|
||||
function get_web_build_qs($url="", $data) {
|
||||
$qs = "";
|
||||
if(empty($url)) {
|
||||
|
@ -42,7 +42,7 @@ if(!check_function_exists("get_web_build_qs")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_binded_url")) {
|
||||
if(!is_fn("get_web_binded_url")) {
|
||||
function get_web_binded_url($url="", $bind) {
|
||||
if(is_array($bind) && check_array_length($bind, 0) > 0) {
|
||||
$bind_keys = array_keys($bind);
|
||||
|
@ -55,7 +55,7 @@ if(!check_function_exists("get_web_binded_url")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_cmd")) {
|
||||
if(!is_fn("get_web_cmd")) {
|
||||
function get_web_cmd($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||
$output = "";
|
||||
|
||||
|
@ -174,7 +174,7 @@ if(!check_function_exists("get_web_cmd")) {
|
|||
}
|
||||
|
||||
// http://dev.epiloum.net/109
|
||||
if(!check_function_exists("get_web_sock")) {
|
||||
if(!is_fn("get_web_sock")) {
|
||||
function get_web_sock($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$output = "";
|
||||
|
||||
|
@ -261,7 +261,7 @@ if(!check_function_exists("get_web_sock")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_wget")) {
|
||||
if(!is_fn("get_web_wget")) {
|
||||
function get_web_wget($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$content = false;
|
||||
|
||||
|
@ -281,7 +281,7 @@ if(!check_function_exists("get_web_wget")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_curl")) {
|
||||
if(!is_fn("get_web_curl")) {
|
||||
function get_web_curl($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||
$content = false;
|
||||
$_headers = array();
|
||||
|
@ -318,7 +318,7 @@ if(!check_function_exists("get_web_curl")) {
|
|||
if($method == "post") {
|
||||
foreach($data as $k=>$v) {
|
||||
if(substr($v, 0, 1) == "@") { // if this is a file
|
||||
if(check_function_exists("curl_file_create")) { // php 5.5+
|
||||
if(is_fn("curl_file_create")) { // php 5.5+
|
||||
$data[$k] = curl_file_create(substr($v, 1));
|
||||
} else {
|
||||
$data[$k] = "@" . realpath(substr($v, 1));
|
||||
|
@ -393,7 +393,7 @@ if(!check_function_exists("get_web_curl")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_page")) {
|
||||
if(!is_fn("get_web_page")) {
|
||||
function get_web_page($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$status = false;
|
||||
$resno = false;
|
||||
|
@ -492,7 +492,7 @@ if(!check_function_exists("get_web_page")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_identifier")) {
|
||||
if(!is_fn("get_web_identifier")) {
|
||||
function get_web_identifier($url, $method="get", $data=array(), $headers=array()) {
|
||||
$checksum_data = (count($data) > 0) ? get_hashed_text(serialize($data)) : "*";
|
||||
$checksum_header = (count($headers) > 0) ? get_hashed_text(serialize($data)) : "*";
|
||||
|
@ -510,7 +510,7 @@ if(!check_function_exists("get_web_identifier")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_cache")) {
|
||||
if(!is_fn("get_web_cache")) {
|
||||
function get_web_cache($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
|
||||
$content = false;
|
||||
$config = get_config();
|
||||
|
@ -566,7 +566,7 @@ if(!check_function_exists("get_web_cache")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_json")) {
|
||||
if(!is_fn("get_web_json")) {
|
||||
function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$result = false;
|
||||
|
||||
|
@ -579,7 +579,7 @@ if(!check_function_exists("get_web_json")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_dom")) {
|
||||
if(!is_fn("get_web_dom")) {
|
||||
function get_web_dom($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$result = false;
|
||||
$response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
|
||||
|
@ -593,7 +593,7 @@ if(!check_function_exists("get_web_dom")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_meta")) {
|
||||
if(!is_fn("get_web_meta")) {
|
||||
function get_web_meta($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$result = false;
|
||||
$response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
|
||||
|
@ -610,7 +610,7 @@ if(!check_function_exists("get_web_meta")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_xml")) {
|
||||
if(!is_fn("get_web_xml")) {
|
||||
function get_web_xml($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$result = false;
|
||||
|
||||
|
@ -623,7 +623,7 @@ if(!check_function_exists("get_web_xml")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_cspt")) {
|
||||
if(!is_fn("get_web_cspt")) {
|
||||
function get_web_cspt($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
|
||||
$result = false;
|
||||
|
||||
|
@ -638,7 +638,7 @@ if(!check_function_exists("get_web_cspt")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_parsed_json")) {
|
||||
if(!is_fn("get_parsed_json")) {
|
||||
function get_parsed_json($raw, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -652,11 +652,11 @@ if(!check_function_exists("get_parsed_json")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_parsed_xml")) {
|
||||
if(!is_fn("get_parsed_xml")) {
|
||||
function get_parsed_xml($raw, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
if(check_function_exists("simplexml_load_string")) {
|
||||
if(is_fn("simplexml_load_string")) {
|
||||
$result = simplexml_load_string($response['content'], null, LIBXML_NOCDATA);
|
||||
}
|
||||
|
||||
|
@ -664,12 +664,12 @@ if(!check_function_exists("get_parsed_xml")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_parsed_dom")) {
|
||||
if(!is_fn("get_parsed_dom")) {
|
||||
function get_parsed_dom($raw, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
if(loadHelper("simple_html_dom")) {
|
||||
$result = check_function_exists("str_get_html") ? str_get_html($response['content']) : $raw;
|
||||
$result = is_fn("str_get_html") ? str_get_html($response['content']) : $raw;
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
@ -677,7 +677,7 @@ if(!check_function_exists("get_parsed_dom")) {
|
|||
}
|
||||
|
||||
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
|
||||
if(!check_function_exists("get_adaptive_json")) {
|
||||
if(!is_fn("get_adaptive_json")) {
|
||||
function get_adaptive_json($data) {
|
||||
if(loadHelper("json.format")) {
|
||||
return json_encode_ex($data, array("adaptive" => true));
|
||||
|
@ -686,7 +686,7 @@ if(!check_function_exists("get_adaptive_json")) {
|
|||
}
|
||||
|
||||
// 2018-09-10: support webproxy
|
||||
if(!check_function_exists("get_webproxy_url")) {
|
||||
if(!is_fn("get_webproxy_url")) {
|
||||
function get_webproxy_url($url, $route="webproxy") {
|
||||
return get_route_link($route, array(
|
||||
"url" => $url
|
||||
|
@ -694,7 +694,7 @@ if(!check_function_exists("get_webproxy_url")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_web_user_agent")) {
|
||||
if(!is_fn("get_web_user_agent")) {
|
||||
function get_web_user_agent($ua="") {
|
||||
if(empty($ua)) {
|
||||
$ua = "ReasonableFramework/1.6-dev (https://github.com/gnh1201/reasonableframework)";
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Wordpress Rest API helper
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_wp_posts")) {
|
||||
if(!is_fn("get_wp_posts")) {
|
||||
function get_wp_posts($wp_server_url) {
|
||||
$results = array();
|
||||
|
||||
|
@ -43,7 +43,7 @@ if(!check_function_exists("get_wp_posts")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("parse_wp_posts")) {
|
||||
if(!is_fn("parse_wp_posts")) {
|
||||
function parse_wp_posts($wp_server_url) {
|
||||
$rest_no_route = false;
|
||||
|
||||
|
@ -90,7 +90,7 @@ if(!check_function_exists("parse_wp_posts")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_wp_new_message")) {
|
||||
if(!is_fn("get_wp_new_message")) {
|
||||
function get_wp_new_message($title, $content, $link="") {
|
||||
$new_message = "";
|
||||
|
||||
|
@ -111,7 +111,7 @@ if(!check_function_exists("get_wp_new_message")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("authenticate_wp")) {
|
||||
if(!is_fn("authenticate_wp")) {
|
||||
function authenticate_wp($wp_server_url, $client_id, $client_secret, $route="", $code="", $scope="basic", $state="") {
|
||||
$flag = false;
|
||||
|
||||
|
@ -172,7 +172,7 @@ if(!check_function_exists("authenticate_wp")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("write_wp_post")) {
|
||||
if(!is_fn("write_wp_post")) {
|
||||
function write_wp_post($wp_server_url, $access_token, $data=array()) {
|
||||
$default_data = array(
|
||||
"title" => "Untitled",
|
||||
|
@ -201,7 +201,7 @@ if(!check_function_exists("write_wp_post")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_wp_categories")) {
|
||||
if(!is_fn("get_wp_categories")) {
|
||||
function get_wp_categories($wp_server_url, $access_token) {
|
||||
$response = get_web_json(get_web_build_qs($wp_server_url, array(
|
||||
"rest_route" => "/wp/v2/categories"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @documentation https://www.zabbix.com/documentation/current/ (4.4)
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_zabbix_config")) {
|
||||
if(!is_fn("get_zabbix_config")) {
|
||||
function get_zabbix_config() {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -21,20 +21,20 @@ if(!check_function_exists("get_zabbix_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_base_url")) {
|
||||
if(!is_fn("zabbix_get_base_url")) {
|
||||
function zabbix_get_api_url() {
|
||||
$cnf = get_zabbix_config();
|
||||
return sprintf("%s://%s/zabbix/api_jsonrpc.php", $cnf['protocol'], $cnf['host']);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_id")) {
|
||||
if(!is_fn("zabbix_get_id")) {
|
||||
function zabbix_get_id() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_authenticate")) {
|
||||
if(!is_fn("zabbix_authenticate")) {
|
||||
function zabbix_authenticate() {
|
||||
$response = false;
|
||||
|
||||
|
@ -65,7 +65,7 @@ if(!check_function_exists("zabbix_authenticate")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_hosts")) {
|
||||
if(!is_fn("zabbix_get_hosts")) {
|
||||
function zabbix_get_hosts() {
|
||||
$hosts = false;
|
||||
$response = false;
|
||||
|
@ -93,13 +93,13 @@ if(!check_function_exists("zabbix_get_hosts")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_retrieve_hosts")) {
|
||||
if(!is_fn("zabbix_retrieve_hosts")) {
|
||||
function zabbix_retrieve_hosts() {
|
||||
return zabbix_get_hosts();
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_items")) {
|
||||
if(!is_fn("zabbix_get_items")) {
|
||||
function zabbix_get_items($hostids=null) {
|
||||
$items = false;
|
||||
$results = false;
|
||||
|
@ -135,7 +135,7 @@ if(!check_function_exists("zabbix_get_items")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_problems")) {
|
||||
if(!is_fn("zabbix_get_problems")) {
|
||||
function zabbix_get_problems($hostids=null) {
|
||||
$problems = false;
|
||||
$response = false;
|
||||
|
@ -172,7 +172,7 @@ if(!check_function_exists("zabbix_get_problems")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_triggers")) {
|
||||
if(!is_fn("zabbix_get_triggers")) {
|
||||
function zabbix_get_triggers($hostids=null) {
|
||||
$triggers = false;
|
||||
$response = false;
|
||||
|
@ -203,7 +203,7 @@ if(!check_function_exists("zabbix_get_triggers")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_alerts")) {
|
||||
if(!is_fn("zabbix_get_alerts")) {
|
||||
function zabbix_get_alerts($hostids=null, $time_from=0, $time_till=0) {
|
||||
$alerts = false;
|
||||
$response = false;
|
||||
|
@ -247,7 +247,7 @@ if(!check_function_exists("zabbix_get_alerts")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zabbix_get_records")) {
|
||||
if(!is_fn("zabbix_get_records")) {
|
||||
function zabbix_get_records($itemids, $now_dt="", $adjust="-24h", $value_type=3) {
|
||||
$records = false;
|
||||
$response = false;
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
*/
|
||||
|
||||
// get database prefix
|
||||
if(!check_function_exists("zb4_get_db_prefix")) {
|
||||
if(!is_fn("zb4_get_db_prefix")) {
|
||||
function zb4_get_db_prefix() {
|
||||
return "zetyx_";
|
||||
}
|
||||
}
|
||||
|
||||
// get table
|
||||
if(!check_function_exists("zb4_get_db_table")) {
|
||||
if(!is_fn("zb4_get_db_table")) {
|
||||
function zb4_get_db_table($tablename) {
|
||||
return (zb4_get_db_prefix() . $tablename);
|
||||
}
|
||||
}
|
||||
|
||||
// get write table
|
||||
if(!check_function_exists("zb4_get_write_table")) {
|
||||
if(!is_fn("zb4_get_write_table")) {
|
||||
function zb4_get_write_table($tablename, $version=4) {
|
||||
$write_prefix = zb4_get_db_prefix() . "board_";
|
||||
$write_table = $write_prefix . $tablename;
|
||||
|
@ -30,7 +30,7 @@ if(!check_function_exists("zb4_get_write_table")) {
|
|||
}
|
||||
|
||||
// write post
|
||||
if(!check_function_exists("zb4_write_post")) {
|
||||
if(!is_fn("zb4_write_post")) {
|
||||
function zb4_write_post($tablename, $data=array()) {
|
||||
$result = 0;
|
||||
$write_table = zb4_get_write_table($tablename);
|
||||
|
@ -105,14 +105,14 @@ if(!check_function_exists("zb4_write_post")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zb4_get_posts")) {
|
||||
if(!is_fn("zb4_get_posts")) {
|
||||
function zb4_get_posts($table_name, $page=1, $limit=20, $options=array()) {
|
||||
$sql = "select * from " . zb4_get_write_table($table_name) . " order by no desc" . get_page_range($page, $limit);
|
||||
return exec_db_fetch_all($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("zb4_get_post_by_id")) {
|
||||
if(!is_fn("zb4_get_post_by_id")) {
|
||||
function zb4_get_post_by_id($table_name, $post_id) {
|
||||
$sql = "select * from " . zb4_get_write_table($table_name) . " where no = :no";
|
||||
return exec_db_fetch($sql, array(
|
||||
|
|
|
@ -2,50 +2,48 @@
|
|||
/**
|
||||
* @file base.php
|
||||
* @created_on 2018-04-13
|
||||
* @updated_on 2020-02-08
|
||||
* @updated_on 2020-02-10
|
||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
||||
* @brief Base module
|
||||
*/
|
||||
|
||||
// check invalid function (mixed)
|
||||
if(!function_exists("check_invalid_function")) {
|
||||
function check_invalid_function($fn) {
|
||||
$status = -1;
|
||||
// is_not_fn: mixed
|
||||
if(!function_exists("is_not_fn")) {
|
||||
function is_not_fn($fn) {
|
||||
$err = -1;
|
||||
|
||||
if(is_array($fn)) {
|
||||
foreach($fn as $k=>$v) {
|
||||
if(!function_exists($v)) {
|
||||
$status = $k;
|
||||
if(!function_exists($v) || !is_callable($v)) {
|
||||
$err = $k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(!function_exists($fn)) {
|
||||
$status = 0;
|
||||
}
|
||||
} elseif(!function_exists($fn) || !is_callable($fn)) {
|
||||
$err++;
|
||||
}
|
||||
|
||||
return $status;
|
||||
return $err;
|
||||
}
|
||||
}
|
||||
|
||||
// check function exists (bool)
|
||||
if(!(check_invalid_function("check_function_exists") < 0)) {
|
||||
function check_function_exists($fn) {
|
||||
return (check_invalid_function($fn) < 0);
|
||||
// is_fn: bool
|
||||
if(!(is_not_fn("is_fn") < 0)) {
|
||||
function is_fn($fn) {
|
||||
return (is_not_fn($fn) < 0);
|
||||
}
|
||||
}
|
||||
|
||||
// set shared var
|
||||
if(!check_function_exists("set_shared_var")) {
|
||||
// set_shared_var: void
|
||||
if(!is_fn("set_shared_var")) {
|
||||
function set_shared_var($k, $v) {
|
||||
global $shared_vars;
|
||||
$shared_vars[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
// get shared var
|
||||
if(!check_function_exists("get_shared_var")) {
|
||||
// get shared var: mixed
|
||||
if(!is_fn("get_shared_var")) {
|
||||
function get_shared_var($k) {
|
||||
global $shared_vars;
|
||||
return array_key_exists($k, $shared_vars) ? $shared_vars[$k] : null;
|
||||
|
@ -53,7 +51,7 @@ if(!check_function_exists("get_shared_var")) {
|
|||
}
|
||||
|
||||
// register loaded resources
|
||||
if(!check_function_exists("register_loaded")) {
|
||||
if(!is_fn("register_loaded")) {
|
||||
function register_loaded($k, $v) {
|
||||
$loaded = get_shared_var("loaded");
|
||||
|
||||
|
@ -68,7 +66,7 @@ if(!check_function_exists("register_loaded")) {
|
|||
}
|
||||
|
||||
// sandbox for include function
|
||||
if(!check_function_exists("include_isolate")) {
|
||||
if(!is_fn("include_isolate")) {
|
||||
function include_isolate($file, $data=array()) {
|
||||
if(count($data) > 0) {
|
||||
extract($data);
|
||||
|
@ -78,14 +76,14 @@ if(!check_function_exists("include_isolate")) {
|
|||
}
|
||||
|
||||
// set autoloader
|
||||
if(!check_function_exists("set_autoloader")) {
|
||||
if(!is_fn("set_autoloader")) {
|
||||
function set_autoloader() {
|
||||
return include('./vendor/autoload.php');
|
||||
}
|
||||
}
|
||||
|
||||
// load view file
|
||||
if(!check_function_exists("renderView")) {
|
||||
if(!is_fn("renderView")) {
|
||||
function renderView($name, $data=array()) {
|
||||
$flag = true;
|
||||
$views = explode(';', $name);
|
||||
|
@ -101,7 +99,7 @@ if(!check_function_exists("renderView")) {
|
|||
}
|
||||
|
||||
// load view by rules
|
||||
if(!check_function_exists("renderViewByRules")) {
|
||||
if(!is_fn("renderViewByRules")) {
|
||||
function renderViewByRules($rules, $data=array()) {
|
||||
foreach($rules as $k=>$v) {
|
||||
if(in_array($k, get_routes())) {
|
||||
|
@ -112,7 +110,7 @@ if(!check_function_exists("renderViewByRules")) {
|
|||
}
|
||||
|
||||
// load system module
|
||||
if(!check_function_exists("loadModule")) {
|
||||
if(!is_fn("loadModule")) {
|
||||
function loadModule($name) {
|
||||
$flag = true;
|
||||
$modules = explode(';', $name);
|
||||
|
@ -130,7 +128,7 @@ if(!check_function_exists("loadModule")) {
|
|||
}
|
||||
|
||||
// load helper file
|
||||
if(!check_function_exists("loadHelper")) {
|
||||
if(!is_fn("loadHelper")) {
|
||||
function loadHelper($name) {
|
||||
$flag = true;
|
||||
$helpers = explode(';', $name);
|
||||
|
@ -148,7 +146,7 @@ if(!check_function_exists("loadHelper")) {
|
|||
}
|
||||
|
||||
// load route file
|
||||
if(!check_function_exists("loadRoute")) {
|
||||
if(!is_fn("loadRoute")) {
|
||||
function loadRoute($name, $data=array()) {
|
||||
$flag = true;
|
||||
$routes = explode(";", $name);
|
||||
|
@ -166,7 +164,7 @@ if(!check_function_exists("loadRoute")) {
|
|||
}
|
||||
|
||||
// load vendor file
|
||||
if(!check_function_exists("loadVendor")) {
|
||||
if(!is_fn("loadVendor")) {
|
||||
function loadVendor($uses, $data=array()) {
|
||||
$flag = true;
|
||||
$usenames = array();
|
||||
|
@ -192,7 +190,7 @@ if(!check_function_exists("loadVendor")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("array_key_empty")) {
|
||||
if(!is_fn("array_key_empty")) {
|
||||
function array_key_empty($key, $array) {
|
||||
$flag = true;
|
||||
|
||||
|
@ -206,7 +204,7 @@ if(!check_function_exists("array_key_empty")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("array_key_equals")) {
|
||||
if(!is_fn("array_key_equals")) {
|
||||
function array_key_equals($key, $array, $value) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -220,7 +218,7 @@ if(!check_function_exists("array_key_equals")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("array_key_is_array")) {
|
||||
if(!is_fn("array_key_is_array")) {
|
||||
function array_key_is_array($key, $array) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -234,7 +232,7 @@ if(!check_function_exists("array_key_is_array")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("array_keys_empty")) {
|
||||
if(!is_fn("array_keys_empty")) {
|
||||
function array_keys_empty($keys, $array) {
|
||||
$flag = false;
|
||||
foreach($keys as $key) {
|
||||
|
@ -246,7 +244,7 @@ if(!check_function_exists("array_keys_empty")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_value_in_array")) {
|
||||
if(!is_fn("get_value_in_array")) {
|
||||
function get_value_in_array($name, $arr=array(), $default=false) {
|
||||
$output = false;
|
||||
|
||||
|
@ -272,27 +270,27 @@ if(!check_function_exists("get_value_in_array")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_value_in_object")) {
|
||||
if(!is_fn("get_value_in_object")) {
|
||||
function get_value_in_object($name, $obj, $default="") {
|
||||
$output = $obj->$name;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_array_length")) {
|
||||
if(!is_fn("check_array_length")) {
|
||||
function check_array_length($arr, $len) {
|
||||
return ((!is_array($arr) ? -1 : count($arr)) - $len);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_is_empty")) {
|
||||
if(!is_fn("check_is_empty")) {
|
||||
function check_is_empty($v, $d=true) {
|
||||
return (empty($v) ? $d : false);
|
||||
}
|
||||
}
|
||||
|
||||
// error handler (set error)
|
||||
if(!check_function_exists("set_error")) {
|
||||
if(!is_fn("set_error")) {
|
||||
function set_error($msg, $code="ERROR") {
|
||||
global $shared_vars;
|
||||
$shared_vars['errors'][] = $code . ": " . $msg;
|
||||
|
@ -301,7 +299,7 @@ if(!check_function_exists("set_error")) {
|
|||
}
|
||||
|
||||
// error handler (get errors)
|
||||
if(!check_function_exists("get_errors")) {
|
||||
if(!is_fn("get_errors")) {
|
||||
function get_errors($d=false, $e=false) { // d: display, e: exit
|
||||
global $shared_vars;
|
||||
return $shared_vars['errors'];
|
||||
|
@ -309,7 +307,7 @@ if(!check_function_exists("get_errors")) {
|
|||
}
|
||||
|
||||
// error handler (show errors)
|
||||
if(!check_function_exists("show_errors")) {
|
||||
if(!is_fn("show_errors")) {
|
||||
function show_errors($exit=true) {
|
||||
$errors = get_errors();
|
||||
foreach($errors as $err) {
|
||||
|
@ -323,14 +321,14 @@ if(!check_function_exists("show_errors")) {
|
|||
}
|
||||
|
||||
// error handler (trigger error)
|
||||
if(!check_function_exists("trigger_error")) {
|
||||
if(!is_fn("trigger_error")) {
|
||||
function trigger_error($msg, $code="ERROR") {
|
||||
set_error($msg, $code);
|
||||
show_errors();
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_property_value")) {
|
||||
if(!is_fn("get_property_value")) {
|
||||
function get_property_value($prop, $obj, $ac=false) {
|
||||
$result = false;
|
||||
if(is_object($obj) && property_exists($obj, $prop)) {
|
||||
|
@ -347,7 +345,7 @@ if(!check_function_exists("get_property_value")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_routes")) {
|
||||
if(!is_fn("get_routes")) {
|
||||
function get_routes() {
|
||||
$loaded = get_shared_var("loaded");
|
||||
return $loaded['route'];
|
||||
|
@ -355,14 +353,14 @@ if(!check_function_exists("get_routes")) {
|
|||
}
|
||||
|
||||
// Deprecated: array_multikey_empty() is changed to array_keys_empty(), since version 1.2
|
||||
if(!check_function_exists("array_multikey_empty")) {
|
||||
if(!is_fn("array_multikey_empty")) {
|
||||
function array_multikey_empty($keys, $array) {
|
||||
return array_keys_empty($keys, $array);
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: set_error_exit() is changed to do_error()
|
||||
if(!check_function_exists("set_error_exit")) {
|
||||
if(!is_fn("set_error_exit")) {
|
||||
function set_error_exit($msg, $code="ERROR") {
|
||||
do_error($msg, $code);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @brief Configuration module
|
||||
*/
|
||||
|
||||
if(!check_function_exists("read_config")) {
|
||||
if(!is_fn("read_config")) {
|
||||
function read_config() {
|
||||
$config = array();
|
||||
$is_legacy_version = version_compare(phpversion(), "5.3.0", "<");
|
||||
|
@ -33,7 +33,7 @@ if(!check_function_exists("read_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_config")) {
|
||||
if(!is_fn("get_config")) {
|
||||
function get_config() {
|
||||
$config = get_shared_var("config");
|
||||
if(!is_array($config)) {
|
||||
|
@ -44,7 +44,7 @@ if(!check_function_exists("get_config")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_config_value")) {
|
||||
if(!is_fn("get_config_value")) {
|
||||
function get_config_value($key) {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -57,7 +57,7 @@ if(!check_function_exists("get_config_value")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_current_timestamp")) {
|
||||
if(!is_fn("get_current_timestamp")) {
|
||||
function get_current_timestamp($options=array()) {
|
||||
$timestamp = time();
|
||||
|
||||
|
@ -116,7 +116,7 @@ if(!check_function_exists("get_current_timestamp")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_current_datetime")) {
|
||||
if(!is_fn("get_current_datetime")) {
|
||||
function get_current_datetime($options=array()) {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -136,7 +136,7 @@ if(!check_function_exists("get_current_datetime")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_old_version")) {
|
||||
if(!is_fn("get_old_version")) {
|
||||
function get_old_version() {
|
||||
$config = get_config();
|
||||
return get_value_in_array("old_version", $config, 0);
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
* @brief Database module
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_db_driver")) {
|
||||
if(!is_fn("get_db_driver")) {
|
||||
function get_db_driver() {
|
||||
$config = get_config();
|
||||
return get_value_in_array("db_driver", $config, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_db_driver")) {
|
||||
if(!is_fn("check_db_driver")) {
|
||||
function check_db_driver($db_driver) {
|
||||
return (get_db_driver() == $db_driver);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_connect")) {
|
||||
if(!is_fn("get_db_connect")) {
|
||||
function get_db_connect($_RETRY=0) {
|
||||
$conn = false;
|
||||
|
||||
|
@ -58,7 +58,7 @@ if(!check_function_exists("get_db_connect")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_stmt_query")) {
|
||||
if(!is_fn("exec_stmt_query")) {
|
||||
function exec_stmt_query($sql, $bind=array()) {
|
||||
$stmt = get_db_stmt($sql, $bind);
|
||||
$stmt->execute();
|
||||
|
@ -67,7 +67,7 @@ if(!check_function_exists("exec_stmt_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_dbc_object")) {
|
||||
if(!is_fn("get_dbc_object")) {
|
||||
function get_dbc_object($renew=false) {
|
||||
if($renew) {
|
||||
set_shared_var("dbc", get_db_connect());
|
||||
|
@ -101,7 +101,7 @@ if(!function_exists("get_db_binded_sql")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_stmt")) {
|
||||
if(!is_fn("get_db_stmt")) {
|
||||
function get_db_stmt($sql, $bind=array(), $options=array()) {
|
||||
$stmt = NULL;
|
||||
|
||||
|
@ -122,7 +122,7 @@ if(!check_function_exists("get_db_stmt")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_last_id")) {
|
||||
if(!is_fn("get_db_last_id")) {
|
||||
function get_db_last_id() {
|
||||
$last_id = false;
|
||||
|
||||
|
@ -140,7 +140,7 @@ if(!check_function_exists("get_db_last_id")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_query")) {
|
||||
if(!is_fn("exec_db_query")) {
|
||||
function exec_db_query($sql, $bind=array(), $options=array()) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -176,7 +176,7 @@ if(!check_function_exists("exec_db_query")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_fetch_all")) {
|
||||
if(!is_fn("exec_db_fetch_all")) {
|
||||
function exec_db_fetch_all($sql, $bind=array(), $options=array()) {
|
||||
$result = array();
|
||||
|
||||
|
@ -231,13 +231,13 @@ if(!check_function_exists("exec_db_fetch_all")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_zero")) {
|
||||
if(!is_fn("get_db_zero")) {
|
||||
function get_db_zero($value) {
|
||||
return ($value > 0 ? $value : '0');
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_fetch")) {
|
||||
if(!is_fn("exec_db_fetch")) {
|
||||
function exec_db_fetch($sql, $bind=array(), $start=0) {
|
||||
$row = NULL;
|
||||
$rows = NULL;
|
||||
|
@ -264,7 +264,7 @@ if(!check_function_exists("exec_db_fetch")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_page_range")) {
|
||||
if(!is_fn("get_page_range")) {
|
||||
function get_page_range($page=1, $limit=15) {
|
||||
$sql = false;
|
||||
|
||||
|
@ -279,7 +279,7 @@ if(!check_function_exists("get_page_range")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_insert")) {
|
||||
if(!is_fn("get_bind_to_sql_insert")) {
|
||||
function get_bind_to_sql_insert($tablename, $bind, $options=array()) {
|
||||
$sql = false;
|
||||
|
||||
|
@ -362,7 +362,7 @@ if(!check_function_exists("get_bind_to_sql_insert")) {
|
|||
// Deprecated: get_bind_to_sql_where($bind, $excludes) - lower than 1.6
|
||||
// Now: get_bind_to_sql_where($bind, $options) - 1.6 or above
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_where")) {
|
||||
if(!is_fn("get_bind_to_sql_where")) {
|
||||
// warning: variable k is not protected. do not use variable k and external variable without filter
|
||||
function get_bind_to_sql_where($bind, $options=array(), $_options=array()) {
|
||||
$s3 = "";
|
||||
|
@ -490,7 +490,7 @@ if(!check_function_exists("get_bind_to_sql_where")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_table_is_separated")) {
|
||||
if(!is_fn("check_table_is_separated")) {
|
||||
function check_table_is_separated($tablename) {
|
||||
$config = get_config();
|
||||
$db_separated_tables = explode(",", $config['db_separated_tables']);
|
||||
|
@ -498,7 +498,7 @@ if(!check_function_exists("check_table_is_separated")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_db_tablenames")) {
|
||||
if(!is_fn("get_db_tablenames")) {
|
||||
function get_db_tablenames($tablename, $end_dt="", $start_dt="") {
|
||||
$tablenames = array();
|
||||
|
||||
|
@ -546,7 +546,7 @@ if(!check_function_exists("get_db_tablenames")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_select")) {
|
||||
if(!is_fn("get_bind_to_sql_select")) {
|
||||
// warning: variable k is not protected. do not use variable k and external variable without filter
|
||||
function get_bind_to_sql_select($tablename, $bind=array(), $options=array()) {
|
||||
$sql = "select %s from `%s` where %s %s %s";
|
||||
|
@ -697,7 +697,7 @@ if(!check_function_exists("get_bind_to_sql_select")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_update_set")) {
|
||||
if(!is_fn("get_bind_to_sql_update_set")) {
|
||||
// warning: variable k is not protected. do not use variable k and external variable without filter
|
||||
function get_bind_to_sql_update_set($bind, $options=array()) {
|
||||
$sql = "";
|
||||
|
@ -722,7 +722,7 @@ if(!check_function_exists("get_bind_to_sql_update_set")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_update")) {
|
||||
if(!is_fn("get_bind_to_sql_update")) {
|
||||
function get_bind_to_sql_update($tablename, $bind, $options=array()) {
|
||||
$sql = "update %s set %s where %s";
|
||||
|
||||
|
@ -756,14 +756,14 @@ if(!check_function_exists("get_bind_to_sql_update")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_delete")) {
|
||||
if(!is_fn("get_bind_to_sql_delete")) {
|
||||
function get_bind_to_sql_delete($tablename, $bind, $options=array()) {
|
||||
$sql = sprintf("delete from `%s` where %s", $tablename, get_bind_to_sql_where($bind, $options));
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_bind_to_sql_past_minutes")) {
|
||||
if(!is_fn("get_bind_to_sql_past_minutes")) {
|
||||
function get_bind_to_sql_past_minutes($fieldname, $minutes=5) {
|
||||
$sql_past_minutes = "";
|
||||
if($minutes > 0) {
|
||||
|
@ -774,7 +774,7 @@ if(!check_function_exists("get_bind_to_sql_past_minutes")) {
|
|||
}
|
||||
|
||||
// SQL eXtensible
|
||||
if(!check_function_exists("get_bind_to_sqlx")) {
|
||||
if(!is_fn("get_bind_to_sqlx")) {
|
||||
function get_bind_to_sqlx($filename, $bind, $options=array()) {
|
||||
$result = false;
|
||||
$sql = read_storage_file(get_file_name($filename, "sqlx"), array(
|
||||
|
@ -789,14 +789,14 @@ if(!check_function_exists("get_bind_to_sqlx")) {
|
|||
}
|
||||
|
||||
// alias sql_query from exec_db_query
|
||||
if(!check_function_exists("sql_query")) {
|
||||
if(!is_fn("sql_query")) {
|
||||
function sql_query($sql, $bind=array(), $options=array()) {
|
||||
return exec_db_query($sql, $bind, $options);
|
||||
}
|
||||
}
|
||||
|
||||
// get timediff
|
||||
if(!check_function_exists("get_timediff_on_query")) {
|
||||
if(!is_fn("get_timediff_on_query")) {
|
||||
function get_timediff_on_query($a, $b) {
|
||||
$dt = 0;
|
||||
|
||||
|
@ -813,7 +813,7 @@ if(!check_function_exists("get_timediff_on_query")) {
|
|||
}
|
||||
|
||||
// make sql statement to create table
|
||||
if(!check_function_exists("get_bind_to_sql_create")) {
|
||||
if(!is_fn("get_bind_to_sql_create")) {
|
||||
function get_bind_to_sql_create($schemes, $options=array()) {
|
||||
$sql = "";
|
||||
|
||||
|
@ -856,7 +856,7 @@ if(!check_function_exists("get_bind_to_sql_create")) {
|
|||
}
|
||||
|
||||
// table creation
|
||||
if(!check_function_exists("exec_db_table_create")) {
|
||||
if(!is_fn("exec_db_table_create")) {
|
||||
function exec_db_table_create($schemes, $tablename, $options=array()) {
|
||||
$_prefix = get_value_in_array("prefix", $options, "");
|
||||
$_suffix = get_value_in_array("suffix", $options, "");
|
||||
|
@ -946,7 +946,7 @@ if(!check_function_exists("exec_db_table_create")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_table_drop")) {
|
||||
if(!is_fn("exec_db_table_drop")) {
|
||||
function exec_db_table_drop($tablename, $end_dt="", $start_dt="") {
|
||||
$flag = true;
|
||||
|
||||
|
@ -960,7 +960,7 @@ if(!check_function_exists("exec_db_table_drop")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_table_update")) {
|
||||
if(!is_fn("exec_db_table_update")) {
|
||||
function exec_db_table_update($tablename, $bind=array(), $options=array()) {
|
||||
$flag = true;
|
||||
|
||||
|
@ -974,7 +974,7 @@ if(!check_function_exists("exec_db_table_update")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_table_insert")) {
|
||||
if(!is_fn("exec_db_table_insert")) {
|
||||
function exec_db_table_insert($tablename, $bind=array(), $options=array()) {
|
||||
$flag = true;
|
||||
|
||||
|
@ -1002,7 +1002,7 @@ if(!check_function_exists("exec_db_table_insert")) {
|
|||
}
|
||||
|
||||
// temporary table creation
|
||||
if(!check_function_exists("exec_db_temp_create")) {
|
||||
if(!is_fn("exec_db_temp_create")) {
|
||||
function exec_db_temp_create($schemes, $options=array()) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -1029,7 +1029,7 @@ if(!check_function_exists("exec_db_temp_create")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("exec_db_temp_start")) {
|
||||
if(!is_fn("exec_db_temp_start")) {
|
||||
function exec_db_temp_start($sql, $bind=array(), $options=array()) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ if(!check_function_exists("exec_db_temp_start")) {
|
|||
}
|
||||
|
||||
// clear specific temporary table
|
||||
if(!check_function_exists("exec_db_temp_end")) {
|
||||
if(!is_fn("exec_db_temp_end")) {
|
||||
function exec_db_temp_end($tablename) {
|
||||
$sql = sprintf("drop temporary table `%s`", $tablename);
|
||||
return exec_db_query($sql);
|
||||
|
@ -1059,7 +1059,7 @@ if(!check_function_exists("exec_db_temp_end")) {
|
|||
}
|
||||
|
||||
// clear temporery tables
|
||||
if(!check_function_exists("exec_db_temp_clear")) {
|
||||
if(!is_fn("exec_db_temp_clear")) {
|
||||
function exec_db_temp_clear() {
|
||||
$temptables = get_array(get_shared_var("temptables"));
|
||||
foreach($temptables as $tablename) {
|
||||
|
@ -1069,7 +1069,7 @@ if(!check_function_exists("exec_db_temp_clear")) {
|
|||
}
|
||||
|
||||
// close db connection
|
||||
if(!check_function_exists("close_db_connect")) {
|
||||
if(!is_fn("close_db_connect")) {
|
||||
function close_db_connect() {
|
||||
$dbc = get_shared_var("dbc");
|
||||
$dbc->query("KILL CONNECTION_ID()");
|
||||
|
@ -1078,7 +1078,7 @@ if(!check_function_exists("close_db_connect")) {
|
|||
}
|
||||
|
||||
// json decode to assoc
|
||||
if(!check_function_exists("json_decode_assoc")) {
|
||||
if(!is_fn("json_decode_assoc")) {
|
||||
function json_decode_assoc($data) {
|
||||
if(loadHelper("json.format")) {
|
||||
return json_decode_ex($data, array("assoc" => true));
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @brief Logger module for ReasonableFramework
|
||||
*/
|
||||
|
||||
if(!check_function_exists("append_log_to_file")) {
|
||||
if(!is_fn("append_log_to_file")) {
|
||||
function append_log_to_file($data, $filename) {
|
||||
return append_storage_file($data, array(
|
||||
"storage_type" => "logs",
|
||||
|
@ -18,7 +18,7 @@ if(!check_function_exists("append_log_to_file")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("write_visit_log")) {
|
||||
if(!is_fn("write_visit_log")) {
|
||||
function write_visit_log() {
|
||||
$fw = false;
|
||||
|
||||
|
@ -38,7 +38,7 @@ if(!check_function_exists("write_visit_log")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("write_common_log")) {
|
||||
if(!is_fn("write_common_log")) {
|
||||
function write_common_log($message, $component="None", $program="") {
|
||||
$fw = false;
|
||||
|
||||
|
@ -54,7 +54,7 @@ if(!check_function_exists("write_common_log")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("write_debug_log")) {
|
||||
if(!is_fn("write_debug_log")) {
|
||||
function write_debug_log($message, $component="Debug", $program="") {
|
||||
$fw = false;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @sponsor https://patreon.com/catswords (with advanced security)
|
||||
*/
|
||||
|
||||
if(!check_function_exists("check_token_abuse")) {
|
||||
if(!is_fn("check_token_abuse")) {
|
||||
function check_token_abuse($_p_token, $_n_token) {
|
||||
$abuse = false;
|
||||
|
||||
|
@ -21,7 +21,7 @@ if(!check_function_exists("check_token_abuse")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("make_random_id")) {
|
||||
if(!is_fn("make_random_id")) {
|
||||
function make_random_id($length = 10) {
|
||||
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
$charactersLength = strlen($characters);
|
||||
|
@ -33,7 +33,7 @@ if(!check_function_exists("make_random_id")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("set_session")) {
|
||||
if(!is_fn("set_session")) {
|
||||
function set_session($session_name, $value) {
|
||||
if(PHP_VERSION < '5.3.0') {
|
||||
session_register($session_name);
|
||||
|
@ -42,7 +42,7 @@ if(!check_function_exists("set_session")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_session")) {
|
||||
if(!is_fn("get_session")) {
|
||||
function get_session($session_name) {
|
||||
$session_value = "";
|
||||
if(!array_key_empty($session_name, $_SESSION)) {
|
||||
|
@ -52,7 +52,7 @@ if(!check_function_exists("get_session")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("set_session_token")) {
|
||||
if(!is_fn("set_session_token")) {
|
||||
function set_session_token() {
|
||||
$_token = make_random_id(10);
|
||||
set_session("_token", $_token);
|
||||
|
@ -61,13 +61,13 @@ if(!check_function_exists("set_session_token")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_session_token")) {
|
||||
if(!is_fn("get_session_token")) {
|
||||
function get_session_token() {
|
||||
return get_session("_token");
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_token_abuse_by_requests")) {
|
||||
if(!is_fn("check_token_abuse_by_requests")) {
|
||||
function check_token_abuse_by_requests($name, $method="_POST") {
|
||||
$requests = get_requests();
|
||||
|
||||
|
@ -82,7 +82,7 @@ if(!check_function_exists("check_token_abuse_by_requests")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_login_session")) {
|
||||
if(!is_fn("check_login_session")) {
|
||||
function check_login_session($ss_key, $config) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -96,7 +96,7 @@ if(!check_function_exists("check_login_session")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("store_login_session")) {
|
||||
if(!is_fn("store_login_session")) {
|
||||
function store_login_session($ss_key, $config) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -115,7 +115,7 @@ if(!check_function_exists("store_login_session")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("process_safe_login")) {
|
||||
if(!is_fn("process_safe_login")) {
|
||||
function process_safe_login($user_name, $user_password, $user_profile=array(), $escape_safe=false) {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -149,7 +149,7 @@ if(!check_function_exists("process_safe_login")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_empty_requests")) {
|
||||
if(!is_fn("check_empty_requests")) {
|
||||
function check_empty_requests($fieldnames, $method="get") {
|
||||
$requests = get_requests();
|
||||
$errors = array();
|
||||
|
@ -175,7 +175,7 @@ if(!check_function_exists("check_empty_requests")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_hash_algos")) {
|
||||
if(!is_fn("get_hash_algos")) {
|
||||
function get_hash_algos() {
|
||||
$config = get_config();
|
||||
$algos = explode(",", get_value_in_array("hashalgos", $config, "md5,sha1,crypt,crc32,base64,sql_password"));
|
||||
|
@ -183,13 +183,13 @@ if(!check_function_exists("get_hash_algos")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_hash_algo")) {
|
||||
if(!is_fn("check_hash_algo")) {
|
||||
function check_hash_algo($algo) {
|
||||
$flag = in_array($algo, get_hash_algos());
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_hashed_text")) {
|
||||
if(!is_fn("get_hashed_text")) {
|
||||
function get_hashed_text($text, $algo="sha1", $options=array()) {
|
||||
$_text = false;
|
||||
|
||||
|
@ -252,7 +252,7 @@ if(!check_function_exists("get_hashed_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_compressed_text")) {
|
||||
if(!is_fn("get_compressed_text")) {
|
||||
function get_compressed_text($text, $algo="deflate", $options=array()) {
|
||||
$_text = "";
|
||||
|
||||
|
@ -280,7 +280,7 @@ if(!check_function_exists("get_compressed_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_uncompressed_text")) {
|
||||
if(!is_fn("get_uncompressed_text")) {
|
||||
function get_uncompressed_text($text, $algo="deflate", $options=array()) {
|
||||
$_text = "";
|
||||
|
||||
|
@ -308,7 +308,7 @@ if(!check_function_exists("get_uncompressed_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_salt")) {
|
||||
if(!is_fn("get_salt")) {
|
||||
function get_salt() {
|
||||
$salt = "";
|
||||
|
||||
|
@ -321,7 +321,7 @@ if(!check_function_exists("get_salt")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_password")) {
|
||||
if(!is_fn("get_password")) {
|
||||
function get_password($text, $algo="sha1") {
|
||||
return get_hashed_text($text, $algo, array(
|
||||
"salt" => true,
|
||||
|
@ -329,7 +329,7 @@ if(!check_function_exists("get_password")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_match_password")) {
|
||||
if(!is_fn("check_match_password")) {
|
||||
function check_match_password($p, $n, $algo="sha1") {
|
||||
$flag = false;
|
||||
$salt = get_salt();
|
||||
|
@ -351,14 +351,14 @@ if(!check_function_exists("check_match_password")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("protect_dir_path")) {
|
||||
if(!is_fn("protect_dir_path")) {
|
||||
function protect_dir_path($path) {
|
||||
$path = str_replace('/', '_', $path);
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("session_logout")) {
|
||||
if(!is_fn("session_logout")) {
|
||||
function session_logout() {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -394,19 +394,19 @@ if(!check_function_exists("session_logout")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_current_user_id")) {
|
||||
if(!is_fn("get_current_user_id")) {
|
||||
function get_current_user_id() {
|
||||
return get_current_session_data("ss_user_id");
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_current_user_name")) {
|
||||
if(!is_fn("get_current_user_name")) {
|
||||
function get_current_user_name() {
|
||||
return get_current_session_data("ss_user_name");
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_current_session_data")) {
|
||||
if(!is_fn("get_current_session_data")) {
|
||||
function get_current_session_data($name) {
|
||||
$current_data = "";
|
||||
|
||||
|
@ -424,7 +424,7 @@ if(!check_function_exists("get_current_session_data")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_user_profile")) {
|
||||
if(!is_fn("get_user_profile")) {
|
||||
function get_user_profile() {
|
||||
$user_profile = array(
|
||||
"user_id" => get_current_user_id(),
|
||||
|
@ -435,7 +435,7 @@ if(!check_function_exists("get_user_profile")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_fixed_id")) {
|
||||
if(!is_fn("get_fixed_id")) {
|
||||
function get_fixed_id($str, $len=0, $salt="") {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -446,7 +446,7 @@ if(!check_function_exists("get_fixed_id")) {
|
|||
}
|
||||
|
||||
// https://stackoverflow.com/questions/1996122/how-to-prevent-xss-with-html-php
|
||||
if(!check_function_exists("get_clean_xss")) {
|
||||
if(!is_fn("get_clean_xss")) {
|
||||
function get_clean_xss($data, $notags=0) {
|
||||
if(is_string($data)) {
|
||||
// if no tags (equals to strip_tags)
|
||||
|
@ -490,20 +490,20 @@ if(!check_function_exists("get_clean_xss")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_clean_newlines")) {
|
||||
if(!is_fn("get_clean_newlines")) {
|
||||
function get_clean_newlines($data) {
|
||||
return is_string($data) ? trim(preg_replace('~[\r\n]+~', ' ', $data)) : $data;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_clean_text")) {
|
||||
if(!is_fn("get_clean_text")) {
|
||||
function get_clean_text($data) {
|
||||
return is_string($data) ? get_clean_newlines(get_clean_xss($data, 1)) : $data;
|
||||
}
|
||||
}
|
||||
|
||||
// support curl or jsonp(callback)
|
||||
if(!check_function_exists("get_callable_token")) {
|
||||
if(!is_fn("get_callable_token")) {
|
||||
function get_callable_token($token, $callback="", $charset="utf-8") {
|
||||
$callback = get_clean_xss($callback);
|
||||
$retdata = "";
|
||||
|
@ -518,7 +518,7 @@ if(!check_function_exists("get_callable_token")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("encapsulate_text")) {
|
||||
if(!is_fn("encapsulate_text")) {
|
||||
function encapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="", $hash="", $hash_algo="sha1") {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -541,7 +541,7 @@ if(!check_function_exists("encapsulate_text")) {
|
|||
$init_key = empty($key) ? $config['masterkey'] : $key;
|
||||
$init_iv = empty($iv) ? $config['masteriv'] : $iv;
|
||||
|
||||
if(check_function_exists("openssl_encrypt")) {
|
||||
if(is_fn("openssl_encrypt")) {
|
||||
$encrypted_text = @openssl_encrypt($init_text, $algo, $init_key, true, $init_iv);
|
||||
} else {
|
||||
$encrypted_text = get_hashed_text(get_xor_text($init_key, $init_text), "base64", array(
|
||||
|
@ -558,7 +558,7 @@ if(!check_function_exists("encapsulate_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("decapsulate_text")) {
|
||||
if(!is_fn("decapsulate_text")) {
|
||||
function decapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="", $hash="", $hash_algo="sha1") {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -576,7 +576,7 @@ if(!check_function_exists("decapsulate_text")) {
|
|||
$init_key = empty($key) ? $config['masterkey'] : $key;
|
||||
$init_iv = empty($iv) ? $config['masteriv'] : $iv;
|
||||
|
||||
if(!check_function_exists("openssl_decrypt")) {
|
||||
if(!is_fn("openssl_decrypt")) {
|
||||
$decrypted_text = @openssl_decrypt($init_text, $algo, $init_key, true, $init_iv);
|
||||
} else {
|
||||
$encrypted_text = get_hashed_text(get_xor_text($init_key, $init_text), "base64", array(
|
||||
|
@ -602,14 +602,14 @@ if(!check_function_exists("decapsulate_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("make_safe_argument")) {
|
||||
if(!is_fn("make_safe_argument")) {
|
||||
function make_safe_argument($str) {
|
||||
return is_string($str) ? addslashes($str) : $str;
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/14673551/encrypt-decrypt-with-xor-in-php
|
||||
if(!check_function_exists("get_xor_text")) {
|
||||
if(!is_fn("get_xor_text")) {
|
||||
function get_xor_text($key, $string, $debug=false) {
|
||||
$text = $string;
|
||||
$outText = "";
|
||||
|
@ -628,7 +628,7 @@ if(!check_function_exists("get_xor_text")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_random_index")) {
|
||||
if(!is_fn("get_random_index")) {
|
||||
function get_random_index($data) {
|
||||
$index = 0;
|
||||
|
||||
|
@ -645,7 +645,7 @@ if(!check_function_exists("get_random_index")) {
|
|||
}
|
||||
|
||||
// https://wiki.ubuntu.com/DevelopmentCodeNames
|
||||
if(!check_function_exists("get_generated_name")) {
|
||||
if(!is_fn("get_generated_name")) {
|
||||
function get_generated_name() {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -663,7 +663,7 @@ if(!check_function_exists("get_generated_name")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_redirect_origin")) {
|
||||
if(!is_fn("check_redirect_origin")) {
|
||||
function check_redirect_origin($url) {
|
||||
$flag = false;
|
||||
|
||||
|
@ -681,7 +681,7 @@ if(!check_function_exists("check_redirect_origin")) {
|
|||
}
|
||||
|
||||
// since 1.6 or above
|
||||
if(!check_function_exists("start_isolated_session")) {
|
||||
if(!is_fn("start_isolated_session")) {
|
||||
function start_isolated_session() {
|
||||
$config = get_config();
|
||||
if(!array_key_equals("sandboxdisabled", $config, 1)) {
|
||||
|
@ -696,7 +696,7 @@ if(!check_function_exists("start_isolated_session")) {
|
|||
}
|
||||
|
||||
// since 1.6 or above
|
||||
if(!check_function_exists("expire_isolated_session")) {
|
||||
if(!is_fn("expire_isolated_session")) {
|
||||
function expire_isolated_session() {
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @brief Stroage module for ReasonableFramework
|
||||
*/
|
||||
|
||||
if(!check_function_exists("get_current_working_dir")) {
|
||||
if(!is_fn("get_current_working_dir")) {
|
||||
function get_current_working_dir($method="getcwd") {
|
||||
$working_dir = "";
|
||||
|
||||
|
@ -42,19 +42,19 @@ if(!check_function_exists("get_current_working_dir")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_storage_dir")) {
|
||||
if(!is_fn("get_storage_dir")) {
|
||||
function get_storage_dir() {
|
||||
return "storage";
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_safe_path")) {
|
||||
if(!is_fn("get_safe_path")) {
|
||||
function get_safe_path($path) {
|
||||
return str_replace("../", "", $path);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_storage_path")) {
|
||||
if(!is_fn("get_storage_path")) {
|
||||
function get_storage_path($type="data") {
|
||||
$dir_path = sprintf("./%s/%s", get_storage_dir(), get_safe_path($type));
|
||||
|
||||
|
@ -68,13 +68,13 @@ if(!check_function_exists("get_storage_path")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_storage_url")) {
|
||||
if(!is_fn("get_storage_url")) {
|
||||
function get_storage_url($type="data") {
|
||||
return sprintf("%s%s/%s", base_url(), get_storage_dir(), get_safe_path($type));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("move_uploaded_file_to_storage")) {
|
||||
if(!is_fn("move_uploaded_file_to_storage")) {
|
||||
function move_uploaded_file_to_stroage($options=array()) {
|
||||
$response = array(
|
||||
"files" => array()
|
||||
|
@ -147,7 +147,7 @@ if(!check_function_exists("move_uploaded_file_to_storage")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("read_storage_file")) {
|
||||
if(!is_fn("read_storage_file")) {
|
||||
function read_storage_file($filename, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -203,7 +203,7 @@ if(!check_function_exists("read_storage_file")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("iterate_storage_files")) {
|
||||
if(!is_fn("iterate_storage_files")) {
|
||||
function iterate_storage_files($storage_type, $options=array()) {
|
||||
$filenames = array();
|
||||
|
||||
|
@ -223,7 +223,7 @@ if(!check_function_exists("iterate_storage_files")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("remove_storage_file")) {
|
||||
if(!is_fn("remove_storage_file")) {
|
||||
function remove_storage_file($filename, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -280,7 +280,7 @@ if(!check_function_exists("remove_storage_file")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("remove_storage_files")) {
|
||||
if(!is_fn("remove_storage_files")) {
|
||||
function remove_storage_files($storage_type, $options=array()) {
|
||||
$failed = 0;
|
||||
|
||||
|
@ -304,7 +304,7 @@ if(!check_function_exists("remove_storage_files")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("remove_volatile_files")) {
|
||||
if(!is_fn("remove_volatile_files")) {
|
||||
function remove_volatile_files($storage_type, $max_age=0, $options=array()) {
|
||||
return remove_storage_files($storage_type, array(
|
||||
"max_age" => $max_age,
|
||||
|
@ -313,7 +313,7 @@ if(!check_function_exists("remove_volatile_files")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("write_storage_file")) {
|
||||
if(!is_fn("write_storage_file")) {
|
||||
function write_storage_file($data, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -373,7 +373,7 @@ if(!check_function_exists("write_storage_file")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("append_storage_file")) {
|
||||
if(!is_fn("append_storage_file")) {
|
||||
function append_storage_file($data, $options=array()) {
|
||||
$options['mode'] = "a";
|
||||
|
||||
|
@ -389,14 +389,14 @@ if(!check_function_exists("append_storage_file")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_real_path")) {
|
||||
if(!is_fn("get_real_path")) {
|
||||
function get_real_path($filename) {
|
||||
$filename = get_safe_path($filename);
|
||||
return file_exists($filename) ? realpath($filename) : false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("retrieve_storage_dir")) {
|
||||
if(!is_fn("retrieve_storage_dir")) {
|
||||
function retrieve_storage_dir($type, $recursive=false, $excludes=array(".", ".."), $files=array()) {
|
||||
$storage_path = get_storage_path($type);
|
||||
|
||||
|
@ -420,7 +420,7 @@ if(!check_function_exists("retrieve_storage_dir")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_file_extension")) {
|
||||
if(!is_fn("get_file_extension")) {
|
||||
function get_file_extension($file, $options=array()) {
|
||||
$result = false;
|
||||
|
||||
|
@ -437,13 +437,13 @@ if(!check_function_exists("get_file_extension")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_file_extension")) {
|
||||
if(!is_fn("check_file_extension")) {
|
||||
function check_file_extension($file, $extension, $options=array()) {
|
||||
return (get_file_extension($file, $options) === $extension);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_file_name")) {
|
||||
if(!is_fn("get_file_name")) {
|
||||
function get_file_name($name, $extension="", $basepath="") {
|
||||
$result = "";
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
* @brief URI module
|
||||
*/
|
||||
|
||||
if(!check_function_exists("base_url")) {
|
||||
if(!is_fn("base_url")) {
|
||||
function base_url() {
|
||||
return get_config_value("base_url");
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("base_api_url")) {
|
||||
if(!is_fn("base_api_url")) {
|
||||
function base_api_url() {
|
||||
return get_config_value("base_api_url");
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_uri")) {
|
||||
if(!is_fn("get_uri")) {
|
||||
function get_uri() {
|
||||
$requests = get_requests();
|
||||
|
||||
|
@ -32,7 +32,7 @@ if(!check_function_exists("get_uri")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("read_route")) {
|
||||
if(!is_fn("read_route")) {
|
||||
function read_route($route=false) {
|
||||
$route = false;
|
||||
|
||||
|
@ -65,7 +65,7 @@ if(!check_function_exists("read_route")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("read_requests")) {
|
||||
if(!is_fn("read_requests")) {
|
||||
function read_requests($options=array()) {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -132,7 +132,7 @@ if(!check_function_exists("read_requests")) {
|
|||
|
||||
// with security module
|
||||
$protect_methods = array("_ALL", "_GET", "_POST", "_JSON", "_SEAL", "_MIXED");
|
||||
if(check_function_exists("get_clean_xss")) {
|
||||
if(is_fn("get_clean_xss")) {
|
||||
foreach($protect_methods as $method) {
|
||||
$requested_data = get_array(get_value_in_array($method, $requests, false));
|
||||
foreach($requested_data as $k=>$v) {
|
||||
|
@ -164,7 +164,7 @@ if(!check_function_exists("read_requests")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_requests")) {
|
||||
if(!is_fn("get_requests")) {
|
||||
function get_requests() {
|
||||
$requests = get_shared_var("requests");
|
||||
|
||||
|
@ -176,7 +176,7 @@ if(!check_function_exists("get_requests")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_final_link")) {
|
||||
if(!is_fn("get_final_link")) {
|
||||
function get_final_link($url, $data=array(), $entity=true) {
|
||||
$link = "";
|
||||
$url = urldecode($url);
|
||||
|
@ -214,7 +214,7 @@ if(!check_function_exists("get_final_link")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_route_link")) {
|
||||
if(!is_fn("get_route_link")) {
|
||||
function get_route_link($route, $data=array(), $entity=true, $base_url="") {
|
||||
$_data = array(
|
||||
"route" => $route
|
||||
|
@ -233,7 +233,7 @@ if(!check_function_exists("get_route_link")) {
|
|||
|
||||
// URI: Uniform Resource Identifier
|
||||
// URL: Uniform Resource Locator
|
||||
if(!check_function_exists("redirect_uri")) {
|
||||
if(!is_fn("redirect_uri")) {
|
||||
function redirect_uri($uri, $permanent=false, $options=array()) {
|
||||
if(array_key_equals("check_origin", $options, true)) {
|
||||
if(!check_redirect_origin($uri)) {
|
||||
|
@ -247,19 +247,19 @@ if(!check_function_exists("redirect_uri")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("redirect_with_params")) {
|
||||
if(!is_fn("redirect_with_params")) {
|
||||
function redirect_with_params($uri, $data=array(), $permanent=false, $entity=false) {
|
||||
redirect_uri(get_final_link($uri, $data, $entity), $permanent);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("redirect_route")) {
|
||||
if(!is_fn("redirect_route")) {
|
||||
function redirect_route($route, $data=array()) {
|
||||
redirect_uri(get_route_link($route, $data, false));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_requested_value")) {
|
||||
if(!is_fn("get_requested_value")) {
|
||||
function get_requested_value($name, $method="_ALL", $escape_quotes=true, $escape_tags=false) {
|
||||
$value = false;
|
||||
$requests = get_requests();
|
||||
|
@ -299,7 +299,7 @@ if(!check_function_exists("get_requested_value")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_requested_values")) {
|
||||
if(!is_fn("get_requested_values")) {
|
||||
function get_requested_values($names, $method="_ALL", $escape_quotes=true, $escape_tags=false) {
|
||||
$values = array();
|
||||
|
||||
|
@ -313,14 +313,14 @@ if(!check_function_exists("get_requested_values")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("empty_requested_value")) {
|
||||
if(!is_fn("empty_requested_value")) {
|
||||
function empty_requested_value($name, $method="_ALL") {
|
||||
$value = get_requested_value($name, $method);
|
||||
return empty($value);
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_binded_requests")) {
|
||||
if(!is_fn("get_binded_requests")) {
|
||||
function get_binded_requests($rules, $method="_ALL", $equals_kv=false) {
|
||||
$data = array();
|
||||
|
||||
|
@ -336,26 +336,26 @@ if(!check_function_exists("get_binded_requests")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_array")) {
|
||||
if(!is_fn("get_array")) {
|
||||
function get_array($arr) {
|
||||
return is_array($arr) ? $arr : array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!check_function_exists("get_int")) {
|
||||
if(!is_fn("get_int")) {
|
||||
function get_int($str) {
|
||||
return intval(preg_replace('/[^0-9]/', '', $str));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("check_is_string_not_array")) {
|
||||
if(!is_fn("check_is_string_not_array")) {
|
||||
function check_is_string_not_array($str) {
|
||||
return (is_string($str) && !(is_array($str) || $str == "Array"));
|
||||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("set_header_content_type")) {
|
||||
if(!is_fn("set_header_content_type")) {
|
||||
function set_header_content_type($type) {
|
||||
$type = strtolower($type);
|
||||
$rules = array(
|
||||
|
@ -375,7 +375,7 @@ if(!check_function_exists("set_header_content_type")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(!check_function_exists("get_requested_jsondata")) {
|
||||
if(!is_fn("get_requested_jsondata")) {
|
||||
function get_requested_jsondata($name, $escape_quotes=true, $escape_tags=false) {
|
||||
return get_requested_jsondata($name, "_JSON", $escape_quotes, $escape_tags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user