fix check_function_exists

This commit is contained in:
Namhyeon Go 2019-02-26 14:40:03 +09:00
parent 6f9a01dd01
commit b98663a291
32 changed files with 263 additions and 263 deletions

View File

@ -6,7 +6,7 @@
* @brief Database alternative driver switcher * @brief Database alternative driver switcher
*/ */
if(check_valid_function("exec_db_alt_callback")) { if(!check_function_exists("exec_db_alt_callback")) {
function exec_db_alt_callback($rules, $params=array()) { function exec_db_alt_callback($rules, $params=array()) {
$result = false; $result = false;
$db_driver = get_db_driver(); $db_driver = get_db_driver();
@ -14,7 +14,7 @@ if(check_valid_function("exec_db_alt_callback")) {
foreach($rules as $rule) { foreach($rules as $rule) {
if($rule['driver'] == $db_driver) { if($rule['driver'] == $db_driver) {
if(loadHelper(sprintf("database.%s", $rule['driver']))) { if(loadHelper(sprintf("database.%s", $rule['driver']))) {
if(check_valid_function($rule['callback'])) { if(!check_function_exists($rule['callback'])) {
if(is_array($params) && count($params) > 0) { if(is_array($params) && count($params) > 0) {
$result = call_user_func_array($rule['callback'], $params); $result = call_user_func_array($rule['callback'], $params);
} else { } else {
@ -33,7 +33,7 @@ if(check_valid_function("exec_db_alt_callback")) {
} }
} }
if(check_valid_function("get_db_alt_connect")) { if(!check_function_exists("get_db_alt_connect")) {
function get_db_alt_connect($driver) { function get_db_alt_connect($driver) {
$conn = false; $conn = false;
$config = get_config(); $config = get_config();
@ -67,7 +67,7 @@ if(check_valid_function("get_db_alt_connect")) {
} }
} }
if(check_valid_function("exec_db_alt_query")) { if(!check_function_exists("exec_db_alt_query")) {
function exec_db_alt_query($sql, $bind=array(), $driver="") { function exec_db_alt_query($sql, $bind=array(), $driver="") {
$result = false; $result = false;
@ -100,7 +100,7 @@ if(check_valid_function("exec_db_alt_query")) {
} }
} }
if(check_valid_function("exec_db_alt_fetch_all")) { if(!check_function_exists("exec_db_alt_fetch_all")) {
function exec_db_alt_fetch_all($sql, $bind=array()) { function exec_db_alt_fetch_all($sql, $bind=array()) {
$rows = array(); $rows = array();
@ -133,7 +133,7 @@ if(check_valid_function("exec_db_alt_fetch_all")) {
} }
} }
if(check_valid_function("exec_db_alt_fetch")) { if(!check_function_exists("exec_db_alt_fetch")) {
function exec_db_alt_fetch($sql, $bind) { function exec_db_alt_fetch($sql, $bind) {
$fetched = false; $fetched = false;
@ -147,7 +147,7 @@ if(check_valid_function("exec_db_alt_fetch")) {
} }
} }
if(check_valid_function("get_db_alt_last_id")) { if(!check_function_exists("get_db_alt_last_id")) {
function get_db_alt_last_id($driver) { function get_db_alt_last_id($driver) {
$last_id = false; $last_id = false;

View File

@ -6,7 +6,7 @@
* @brief MySQLi database helper * @brief MySQLi database helper
*/ */
if(check_valid_function("get_db_mysql_imp_connect")) { if(!check_function_exists("get_db_mysql_imp_connect")) {
function get_db_mysql_imp_connect() { function get_db_mysql_imp_connect() {
$conn = false; $conn = false;
$config = get_config(); $config = get_config();
@ -23,7 +23,7 @@ if(check_valid_function("get_db_mysql_imp_connect")) {
} }
} }
if(check_valid_function("exec_db_mysql_imp_query")) { if(!check_function_exists("exec_db_mysql_imp_query")) {
function exec_db_mysql_imp_query($sql, $bind) { function exec_db_mysql_imp_query($sql, $bind) {
$result = false; $result = false;
$dbc = get_dbc_object(); $dbc = get_dbc_object();
@ -35,7 +35,7 @@ if(check_valid_function("exec_db_mysql_imp_query")) {
} }
} }
if(check_valid_function("exec_db_mysql_imp_fetch_all")) { if(!check_function_exists("exec_db_mysql_imp_fetch_all")) {
function exec_db_mysql_imp_fetch_all($sql, $bind) { function exec_db_mysql_imp_fetch_all($sql, $bind) {
$rows = array(); $rows = array();
$result = exec_db_mysql_imp_query($sql, $bind); $result = exec_db_mysql_imp_query($sql, $bind);
@ -48,7 +48,7 @@ if(check_valid_function("exec_db_mysql_imp_fetch_all")) {
} }
} }
if(check_valid_function("close_db_mysql_imp_connect")) { if(!check_function_exists("close_db_mysql_imp_connect")) {
function close_db_mysql_imp_connect() { function close_db_mysql_imp_connect() {
$dbc = get_scope("dbc"); $dbc = get_scope("dbc");
return mysqli_close($dbc); return mysqli_close($dbc);

View File

@ -6,7 +6,7 @@
* @brief MySQL-old (lower than 5.4) database helper * @brief MySQL-old (lower than 5.4) database helper
*/ */
if(check_valid_function("get_db_mysql_old_connect")) { if(!check_function_exists("get_db_mysql_old_connect")) {
function get_db_mysql_old_connect() { function get_db_mysql_old_connect() {
$conn = false; $conn = false;
$config = get_config(); $config = get_config();
@ -26,7 +26,7 @@ if(check_valid_function("get_db_mysql_old_connect")) {
} }
} }
if(check_valid_function("exec_db_mysql_old_query")) { if(!check_function_exists("exec_db_mysql_old_query")) {
function exec_db_mysql_old_query($sql, $bind) { function exec_db_mysql_old_query($sql, $bind) {
$result = false; $result = false;
$dbc = get_dbc_object(); $dbc = get_dbc_object();
@ -38,7 +38,7 @@ if(check_valid_function("exec_db_mysql_old_query")) {
} }
} }
if(check_valid_function("exec_db_mysql_old_fetch_all")) { if(!check_function_exists("exec_db_mysql_old_fetch_all")) {
function exec_db_mysql_old_fetch_all($sql, $bind) { function exec_db_mysql_old_fetch_all($sql, $bind) {
$rows = array(); $rows = array();
$result = exec_db_mysql_old_query($sql, $bind); $result = exec_db_mysql_old_query($sql, $bind);
@ -51,7 +51,7 @@ if(check_valid_function("exec_db_mysql_old_fetch_all")) {
} }
} }
if(check_valid_function("close_db_mysql_old_connect")) { if(!check_function_exists("close_db_mysql_old_connect")) {
function close_db_mysql_old_connect() { function close_db_mysql_old_connect() {
$dbc = get_scope("dbc"); $dbc = get_scope("dbc");
return mysql_close($dbc); return mysql_close($dbc);

View File

@ -6,13 +6,13 @@
* @brief Oracle database helper for ReasonableFramework * @brief Oracle database helper for ReasonableFramework
*/ */
if(check_valid_function("get_db_orable_binded_sql")) { if(!check_function_exists("get_db_orable_binded_sql")) {
function get_db_orable_binded_sql($sql, $bind) { function get_db_orable_binded_sql($sql, $bind) {
return get_db_binded_sql($sql, $bind); return get_db_binded_sql($sql, $bind);
} }
} }
if(check_valid_function("get_db_oracle_stmt")) { if(!check_function_exists("get_db_oracle_stmt")) {
function get_db_oracle_stmt($sql, $bind) { function get_db_oracle_stmt($sql, $bind) {
$stmt = NULL; $stmt = NULL;
@ -23,12 +23,12 @@ if(check_valid_function("get_db_oracle_stmt")) {
} }
} }
if(check_valid_function("exec_db_oracle_connect")) { if(!check_function_exists("exec_db_oracle_connect")) {
function exec_db_oracle_connect($host, $port, $user, $password, $options=array()) { function exec_db_oracle_connect($host, $port, $user, $password, $options=array()) {
$conn = NULL; $conn = NULL;
$envs = get_value_in_array("envs", $options, array()); $envs = get_value_in_array("envs", $options, array());
if(check_valid_function("oci_connect")) { if(!check_function_exists("oci_connect")) {
exit("OCI (Oracle Extension for PHP) not installed!"); exit("OCI (Oracle Extension for PHP) not installed!");
} }
@ -67,7 +67,7 @@ if(check_valid_function("exec_db_oracle_connect")) {
} }
} }
if(check_valid_function("exec_db_oracle_fetch_all")) { if(!check_function_exists("exec_db_oracle_fetch_all")) {
function exec_db_oracle_fetch_all($sql, $bind, $conn) { function exec_db_oracle_fetch_all($sql, $bind, $conn) {
$rows = array(); $rows = array();
@ -97,7 +97,7 @@ if(check_valid_function("exec_db_oracle_fetch_all")) {
} }
} }
if(check_valid_function("exec_db_oracle_query")) { if(!check_function_exists("exec_db_oracle_query")) {
function exec_db_oracle_query($sql, $bind, $conn) { function exec_db_oracle_query($sql, $bind, $conn) {
$flag = false; $flag = false;
@ -110,7 +110,7 @@ if(check_valid_function("exec_db_oracle_query")) {
} }
} }
if(check_valid_function("close_db_oracle_connect")) { if(!check_function_exists("close_db_oracle_connect")) {
function close_db_oracle_connect() { function close_db_oracle_connect() {
$dbc = get_scope("dbc"); $dbc = get_scope("dbc");
return oci_close($dbc); return oci_close($dbc);

View File

@ -13,7 +13,7 @@
* in the webserver configuration. The function execTests returns an array, which * in the webserver configuration. The function execTests returns an array, which
* contains names of all successful tested PHP functions. * contains names of all successful tested PHP functions.
*/ */
if(check_valid_function("exec_test")) { if(!check_function_exists("exec_test")) {
function exec_test() { function exec_test() {
$cmd = "whoami"; $cmd = "whoami";
$cmdPath = "/usr/bin/whoami"; $cmdPath = "/usr/bin/whoami";
@ -103,7 +103,7 @@ if(check_valid_function("exec_test")) {
/* /*
* exec_command() executes a command (like "whoami") with the submited method * exec_command() executes a command (like "whoami") with the submited method
*/ */
if(check_valid_function("exec_command")) { if(!check_function_exists("exec_command")) {
function exec_command($command, $method="shell_exec", $options=array()) { function exec_command($command, $method="shell_exec", $options=array()) {
$return = false; $return = false;

View File

@ -7,21 +7,21 @@
*/ */
// get database prefix // get database prefix
if(check_valid_function("gnb_get_db_prefix")) { if(!check_function_exists("gnb_get_db_prefix")) {
function gnb_get_db_prefix($version=4) { function gnb_get_db_prefix($version=4) {
return ($version > 4) ? "g5_" : "g4_"; return ($version > 4) ? "g5_" : "g4_";
} }
} }
// get table // get table
if(check_valid_function("gnb_get_db_table")) { if(!check_function_exists("gnb_get_db_table")) {
function gnb_get_db_table($tablename) { function gnb_get_db_table($tablename) {
return (gnb_get_db_prefix() . $tablename); return (gnb_get_db_prefix() . $tablename);
} }
} }
// get write table // get write table
if(check_valid_function("gnb_get_write_table")) { if(!check_function_exists("gnb_get_write_table")) {
function gnb_get_write_table($tablename, $version=4) { function gnb_get_write_table($tablename, $version=4) {
$write_prefix = gnb_get_db_prefix() . "write_"; $write_prefix = gnb_get_db_prefix() . "write_";
$write_table = $write_prefix . $tablename; $write_table = $write_prefix . $tablename;
@ -30,7 +30,7 @@ if(check_valid_function("gnb_get_write_table")) {
} }
// get write next // get write next
if(check_valid_function("gnb_get_write_next")) { if(!check_function_exists("gnb_get_write_next")) {
function gnb_get_write_next($tablename) { function gnb_get_write_next($tablename) {
$row = exec_db_fetch("select min(wr_num) as min_wr_num from " . gnb_get_write_table($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); return (intval(get_value_in_array("min_wr_num", $row, 0)) - 1);
@ -38,7 +38,7 @@ if(check_valid_function("gnb_get_write_next")) {
} }
// write post // write post
if(check_valid_function("gnb_write_post")) { if(!check_function_exists("gnb_write_post")) {
function gnb_write_post($tablename, $data=array(), $version=4) { function gnb_write_post($tablename, $data=array(), $version=4) {
$result = 0; $result = 0;
@ -112,14 +112,14 @@ if(check_valid_function("gnb_write_post")) {
} }
} }
if(check_valid_function("gnb_get_posts")) { if(!check_function_exists("gnb_get_posts")) {
function gnb_get_posts($table_name, $page=1, $limit=20, $options=array()) { 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); $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); return exec_db_fetch_all($sql);
} }
} }
if(check_valid_function("gnb_get_post_by_id")) { if(!check_function_exists("gnb_get_post_by_id")) {
function gnb_get_post_by_id($table_name, $post_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"; $sql = "select * from " . gnb_get_write_table($table_name) . " where wr_id = :wr_id";
return exec_db_fetch($sql, array( return exec_db_fetch($sql, array(
@ -128,7 +128,7 @@ if(check_valid_function("gnb_get_post_by_id")) {
} }
} }
if(check_valid_function("gnb_set_post_parameters")) { if(!check_function_exists("gnb_set_post_parameters")) {
function gnb_set_post_parameters($tablename, $wr_id, $bind=array()) { function gnb_set_post_parameters($tablename, $wr_id, $bind=array()) {
$flag = false; $flag = false;
$excludes = array("wr_id"); $excludes = array("wr_id");
@ -144,7 +144,7 @@ if(check_valid_function("gnb_set_post_parameters")) {
} }
// get member data // get member data
if(check_valid_function("gnb_get_member")) { if(!check_function_exists("gnb_get_member")) {
function gnb_get_member($user_name, $tablename="member") { function gnb_get_member($user_name, $tablename="member") {
$result = array(); $result = array();
@ -160,7 +160,7 @@ if(check_valid_function("gnb_get_member")) {
} }
// get password // get password
if(check_valid_function("gnb_get_password")) { if(!check_function_exists("gnb_get_password")) {
function gnb_get_password($password) { function gnb_get_password($password) {
$bind = array( $bind = array(
"password" => $password, "password" => $password,
@ -171,7 +171,7 @@ if(check_valid_function("gnb_get_password")) {
} }
// get config // get config
if(check_valid_function("gnb_get_config")) { if(!check_function_exists("gnb_get_config")) {
function gnb_get_config($tablename="config") { function gnb_get_config($tablename="config") {
$result = array(); $result = array();
@ -183,7 +183,7 @@ if(check_valid_function("gnb_get_config")) {
} }
// run login process // run login process
if(check_valid_function("gnb_process_safe_login")) { if(!check_function_exists("gnb_process_safe_login")) {
function gnb_process_safe_login($user_name, $user_password) { function gnb_process_safe_login($user_name, $user_password) {
$result = false; $result = false;
$mb = gnb_get_member($user_name); $mb = gnb_get_member($user_name);
@ -201,7 +201,7 @@ if(check_valid_function("gnb_process_safe_login")) {
} }
// run join member // run join member
if(check_valid_function("gnb_join_member")) { if(!check_function_exists("gnb_join_member")) {
function gnb_join_member($user_name, $user_password, $data=array(), $tablename="member") { function gnb_join_member($user_name, $user_password, $data=array(), $tablename="member") {
$result = false; $result = false;
@ -288,7 +288,7 @@ if(check_valid_function("gnb_join_member")) {
} }
} }
if(check_valid_function("gnb_make_pipelined_data")) { if(!check_function_exists("gnb_make_pipelined_data")) {
function gnb_make_pipelined_data($data, $delimiter="|") { function gnb_make_pipelined_data($data, $delimiter="|") {
foreach($data as $k=>$v) { foreach($data as $k=>$v) {
$data[$k] = str_replace($delimiter, " ", $v); $data[$k] = str_replace($delimiter, " ", $v);

View File

@ -6,7 +6,7 @@
* @brief HybridAuth DB Helper * @brief HybridAuth DB Helper
*/ */
if(check_valid_function("store_hybridauth_session")) { if(!check_function_exists("store_hybridauth_session")) {
function store_hybridauth_session($data, $user_id) { function store_hybridauth_session($data, $user_id) {
$connection_id = false; $connection_id = false;
@ -23,7 +23,7 @@ if(check_valid_function("store_hybridauth_session")) {
} }
} }
if(check_valid_function("get_stored_hybridauth_session")) { if(!check_function_exists("get_stored_hybridauth_session")) {
function get_stored_hybridauth_session($connection_id) { function get_stored_hybridauth_session($connection_id) {
$stored_session = false; $stored_session = false;
@ -39,7 +39,7 @@ if(check_valid_function("get_stored_hybridauth_session")) {
} }
} }
if(check_valid_function("get_hybridauth_connection_info")) { if(!check_function_exists("get_hybridauth_connection_info")) {
function get_hybridauth_connection_info($connection_id) { function get_hybridauth_connection_info($connection_id) {
$connection_info = false; $connection_info = false;
@ -57,7 +57,7 @@ if(check_valid_function("get_hybridauth_connection_info")) {
} }
} }
if(check_valid_function("get_hybridauth_connection_id")) { if(!check_function_exists("get_hybridauth_connection_id")) {
function get_hybridauth_connection_id($user_id) { function get_hybridauth_connection_id($user_id) {
$connection_id = false; $connection_id = false;

View File

@ -6,7 +6,7 @@
* @brief HybridAuth library RSF Linker * @brief HybridAuth library RSF Linker
***/ ***/
if(check_valid_function("hybridauth_load")) { if(!check_function_exists("hybridauth_load")) {
function hybridauth_load($provider="") { function hybridauth_load($provider="") {
$result = false; $result = false;
@ -43,7 +43,7 @@ if(check_valid_function("hybridauth_load")) {
} }
} }
if(check_valid_function("hybridauth_check_redirect")) { if(!check_function_exists("hybridauth_check_redirect")) {
function hybridauth_check_redirect() { function hybridauth_check_redirect() {
$flag = false; $flag = false;
$requests = get_requests(); $requests = get_requests();
@ -61,7 +61,7 @@ if(check_valid_function("hybridauth_check_redirect")) {
} }
} }
if(check_valid_function("hybridauth_process")) { if(!check_function_exists("hybridauth_process")) {
function hybridauth_process() { function hybridauth_process() {
Hybrid_Endpoint::process(); Hybrid_Endpoint::process();
} }

View File

@ -6,7 +6,7 @@
* @brief IsEmail library linker * @brief IsEmail library linker
*/ */
if(check_valid_function("is_email")) { if(!check_function_exists("is_email")) {
$inc_file = "./vendor/isemail/is_email.php"; $inc_file = "./vendor/isemail/is_email.php";
if(file_exists($inc_file)) { if(file_exists($inc_file)) {
include($inc_file); include($inc_file);

View File

@ -6,7 +6,7 @@
* @brief jCryption (alternative HTTPS on javascript) Helper * @brief jCryption (alternative HTTPS on javascript) Helper
*/ */
if(check_valid_function("jcryption_load")) { if(!check_function_exists("jcryption_load")) {
function jcryption_load() { function jcryption_load() {
$required_files = array( $required_files = array(
"jCryption/sqAES", "jCryption/sqAES",
@ -21,19 +21,19 @@ if(check_valid_function("jcryption_load")) {
} }
} }
if(check_valid_function("jcryption_get_code")) { if(!check_function_exists("jcryption_get_code")) {
function jcryption_get_code() { function jcryption_get_code() {
return "JCryption::decrypt();"; return "JCryption::decrypt();";
} }
} }
if(check_valid_function("jcryption_get_jscode")) { if(!check_function_exists("jcryption_get_jscode")) {
function jcryption_get_jscode($selector) { function jcryption_get_jscode($selector) {
return "$(function() { $(" . $selector . ").jCryption(); });"; return "$(function() { $(" . $selector . ").jCryption(); });";
} }
} }
if(check_valid_function("jcryption_get_js_url")) { if(!check_function_exists("jcryption_get_js_url")) {
function jcryption_get_js_url() { function jcryption_get_js_url() {
return "JCryption::decrypt();"; return "JCryption::decrypt();";
} }

View File

@ -6,7 +6,7 @@
* @brief Network tool helper * @brief Network tool helper
*/ */
if(check_valid_function("get_network_event")) { if(!check_function_exists("get_network_event")) {
function get_network_event() { function get_network_event() {
$config = get_config(); $config = get_config();
@ -24,7 +24,7 @@ if(check_valid_function("get_network_event")) {
} }
} }
if(check_valid_function("get_network_client_addr")) { if(!check_function_exists("get_network_client_addr")) {
function get_network_client_addr() { function get_network_client_addr() {
$addr = ''; $addr = '';
if (isset($_SERVER['HTTP_CLIENT_IP'])) if (isset($_SERVER['HTTP_CLIENT_IP']))
@ -47,7 +47,7 @@ if(check_valid_function("get_network_client_addr")) {
} }
} }
if(check_valid_function("get_network_server_addr")) { if(!check_function_exists("get_network_server_addr")) {
function get_network_server_addr() { function get_network_server_addr() {
$addr = ''; $addr = '';
if(isset($_SERVER['SERVER_ADDR']) && isset($_SERVER['SERVER_PORT'])) { if(isset($_SERVER['SERVER_ADDR']) && isset($_SERVER['SERVER_PORT'])) {
@ -56,7 +56,7 @@ if(check_valid_function("get_network_server_addr")) {
$addr = $_SERVER['SERVER_ADDR']; $addr = $_SERVER['SERVER_ADDR'];
} else if(isset($_SERVER['LOCAL_ADDR'])) { } else if(isset($_SERVER['LOCAL_ADDR'])) {
$addr = $_SERVER['LOCAL_ADDR']; $addr = $_SERVER['LOCAL_ADDR'];
} else if(check_valid_function('gethostname') && check_valid_function('gethostbyname')) { } else if(!check_function_exists('gethostname') && !check_function_exists('gethostbyname')) {
$host = gethostname(); $host = gethostname();
$addr = gethostbyname($host); $addr = gethostbyname($host);
} else { } else {
@ -66,14 +66,14 @@ if(check_valid_function("get_network_server_addr")) {
} }
} }
if(check_valid_function("get_network_hostname")) { if(!check_function_exists("get_network_hostname")) {
function get_network_hostname() { function get_network_hostname() {
$host = ''; $host = '';
if(isset($_SERVER['HTTP_HOST'])) { if(isset($_SERVER['HTTP_HOST'])) {
$host = $_SERVER['HTTP_HOST']; $host = $_SERVER['HTTP_HOST'];
} else if(isset($_SERVER['SERVER_NAME'])) { } else if(isset($_SERVER['SERVER_NAME'])) {
$host = $_SERVER['SERVER_NAME']; $host = $_SERVER['SERVER_NAME'];
} else if(check_valid_function('gethostname')) { } else if(!check_function_exists('gethostname')) {
$host = gethostname(); $host = gethostname();
} else { } else {
$host = 'UNKNOWN'; $host = 'UNKNOWN';
@ -83,13 +83,13 @@ if(check_valid_function("get_network_hostname")) {
} }
} }
if(check_valid_function("check_secure_protocol")) { if(!check_function_exists("check_secure_protocol")) {
function check_secure_protocol() { function check_secure_protocol() {
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443; return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443;
} }
} }
if(check_valid_function("get_os_platform")) { if(!check_function_exists("get_os_platform")) {
function get_os_platform() { function get_os_platform() {
$os = ""; $os = "";
@ -103,7 +103,7 @@ if(check_valid_function("get_os_platform")) {
} }
} }
if(check_valid_function("get_network_outbound_addr")) { if(!check_function_exists("get_network_outbound_addr")) {
function get_network_outbound_addr($protocol="") { function get_network_outbound_addr($protocol="") {
$addr = false; $addr = false;
$config = get_config(); $config = get_config();

View File

@ -6,7 +6,7 @@
* @brief PHP Obfuscator for ReasonableFramework * @brief PHP Obfuscator for ReasonableFramework
*/ */
if(check_valid_function("get_obfuscator")) { if(!check_function_exists("get_obfuscator")) {
function get_obfuscator() { function get_obfuscator() {
$obfuscator = rand(1, 15); $obfuscator = rand(1, 15);
set_scope("obfuscator", $obfuscator); set_scope("obfuscator", $obfuscator);
@ -14,7 +14,7 @@ if(check_valid_function("get_obfuscator")) {
} }
} }
if(check_valid_function("get_obfuscated_result")) { if(!check_function_exists("get_obfuscated_result")) {
function get_obfuscated_result($raw) { function get_obfuscated_result($raw) {
$result = false; $result = false;

View File

@ -6,7 +6,7 @@
* @brief Page navigation helper * @brief Page navigation helper
*/ */
if(check_valid_function("paginate_get_current_page")) { if(!check_function_exists("paginate_get_current_page")) {
function paginate_get_current_page($page=1) { function paginate_get_current_page($page=1) {
$current_page = 1; $current_page = 1;
@ -18,7 +18,7 @@ if(check_valid_function("paginate_get_current_page")) {
} }
} }
if(check_valid_function("paginate_get_total_pages")) { if(!check_function_exists("paginate_get_total_pages")) {
function paginate_get_total_pages($item_per_page=1.0, $total_records=1.0) { function paginate_get_total_pages($item_per_page=1.0, $total_records=1.0) {
$total_pages = 1; $total_pages = 1;
@ -30,7 +30,7 @@ if(check_valid_function("paginate_get_total_pages")) {
} }
} }
if(check_valid_function("paginate_get_query_string")) { if(!check_function_exists("paginate_get_query_string")) {
function paginate_get_query_string() { function paginate_get_query_string() {
loadHelper("networktool"); loadHelper("networktool");
$net_event = get_network_event(); $net_event = get_network_event();
@ -39,7 +39,7 @@ if(check_valid_function("paginate_get_query_string")) {
} }
// https://www.sanwebe.com/2011/05/php-pagination-function // https://www.sanwebe.com/2011/05/php-pagination-function
if(check_valid_function("paginate_make_html")) { if(!check_function_exists("paginate_make_html")) {
function paginate_make_html($item_per_page, $current_page, $total_records, $total_pages, $page_url, $qry='') { function paginate_make_html($item_per_page, $current_page, $total_records, $total_pages, $page_url, $qry='') {
$pagination = ''; $pagination = '';
if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages) { //verify total pages and current page number if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages) { //verify total pages and current page number

View File

@ -8,7 +8,7 @@
if(!defined("_DEF_RSF_")) set_error_exit("do not allow access"); if(!defined("_DEF_RSF_")) set_error_exit("do not allow access");
if(check_valid_function("get_pgkcp_config")) { if(!check_function_exists("get_pgkcp_config")) {
function get_pgkcp_config() { function get_pgkcp_config() {
$pgkcp_config = array(); $pgkcp_config = array();
@ -60,7 +60,7 @@ if(check_valid_function("get_pgkcp_config")) {
} }
} }
if(check_valid_function("get_pgkcp_platform")) { if(!check_function_exists("get_pgkcp_platform")) {
function get_pgkcp_platform($pgkcp_config) { function get_pgkcp_platform($pgkcp_config) {
$platform = false; $platform = false;
@ -80,7 +80,7 @@ if(check_valid_function("get_pgkcp_platform")) {
} }
} }
if(check_valid_function("load_pgkcp_library")) { if(!check_function_exists("load_pgkcp_library")) {
function load_pgkcp_library() { function load_pgkcp_library() {
$inc_file = get_current_working_dir() . "/vendor/pgkcp/res/pp_cli_hub_lib.php"; $inc_file = get_current_working_dir() . "/vendor/pgkcp/res/pp_cli_hub_lib.php";
if(file_exists($inc_file)) { if(file_exists($inc_file)) {

View File

@ -1206,7 +1206,7 @@ class simple_html_dom
$charset = null; $charset = null;
if (check_valid_function('get_last_retrieve_url_contents_content_type')) if (!check_function_exists('get_last_retrieve_url_contents_content_type'))
{ {
$contentTypeHeader = get_last_retrieve_url_contents_content_type(); $contentTypeHeader = get_last_retrieve_url_contents_content_type();
$success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches); $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. // Use this in case mb_detect_charset isn't installed/loaded on this machine.
$charset = false; $charset = false;
if (check_valid_function('mb_detect_encoding')) if (!check_function_exists('mb_detect_encoding'))
{ {
// Have php try to detect the encoding from the text given to us. // 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" ) ); $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );

View File

@ -6,7 +6,7 @@
* @brief SocialHub Utilities (refactoring from SocioRouter Utilities) * @brief SocialHub Utilities (refactoring from SocioRouter Utilities)
*/ */
if(check_valid_function("socialhub_send_message")) { if(!check_function_exists("socialhub_send_message")) {
function socialhub_send_message($provider, $adapter, $message, $options=array()) { function socialhub_send_message($provider, $adapter, $message, $options=array()) {
$response = false; $response = false;
$status = array( $status = array(
@ -48,7 +48,7 @@ if(check_valid_function("socialhub_send_message")) {
} }
} }
if(check_valid_function("socialhub_parse_object_id")) { if(!check_function_exists("socialhub_parse_object_id")) {
function socialhub_parse_object_id($provider, $response) { function socialhub_parse_object_id($provider, $response) {
$object_id = false; $object_id = false;
@ -69,7 +69,7 @@ if(check_valid_function("socialhub_parse_object_id")) {
} }
} }
if(check_valid_function("socialhub_get_object")) { if(!check_function_exists("socialhub_get_object")) {
function socialhub_get_object($provider, $adapter, $object_id) { function socialhub_get_object($provider, $adapter, $object_id) {
$result = false; $result = false;
$access_token = $adapter->getAccessToken(); $access_token = $adapter->getAccessToken();
@ -90,7 +90,7 @@ if(check_valid_function("socialhub_get_object")) {
} }
} }
if(check_valid_function("socialhub_get_object_facebook")) { if(!check_function_exists("socialhub_get_object_facebook")) {
function socialhub_get_object_facebook($adapter, $object_id, $type="post") { function socialhub_get_object_facebook($adapter, $object_id, $type="post") {
$result = false; $result = false;
$response = false; $response = false;

View File

@ -6,7 +6,7 @@
* @brief Excel file parser * @brief Excel file parser
***/ ***/
if(check_valid_function("parse_excel_file")) { if(!check_function_exists("parse_excel_file")) {
function parse_excel_file($filepath, $format="xlsx", $setColumnName=false) { function parse_excel_file($filepath, $format="xlsx", $setColumnName=false) {
$rows = array(); $rows = array();

View File

@ -7,7 +7,7 @@
*/ */
// for Korean Telephone Number // for Korean Telephone Number
if(check_valid_function("parse_tel_number_kr")) { if(!check_function_exists("parse_tel_number_kr")) {
function parse_tel_number_kr($tel) { function parse_tel_number_kr($tel) {
$output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거 $output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거
$local_code = substr($tel, 0, 2); $local_code = substr($tel, 0, 2);
@ -24,21 +24,21 @@ if(check_valid_function("parse_tel_number_kr")) {
} }
} }
if(check_valid_function("get_converted_string")) { if(!check_function_exists("get_converted_string")) {
function get_converted_string($str, $to_charset, $from_charset) { function get_converted_string($str, $to_charset, $from_charset) {
$result = false; $result = false;
if($form_charset == "detect") { if($form_charset == "detect") {
if(check_valid_function("mb_detect_encoding") && check_valid_function("mb_detect_order")) { if(!check_function_exists("mb_detect_encoding") && !check_function_exists("mb_detect_order")) {
$from_charset = mb_detect_encoding($str, mb_detect_order(), true); $from_charset = mb_detect_encoding($str, mb_detect_order(), true);
} else { } else {
$from_charset = "ISO-8859-1"; $from_charset = "ISO-8859-1";
} }
} }
if(check_valid_function("iconv")) { if(!check_function_exists("iconv")) {
$result = iconv($from_charset, $to_charset, $str); $result = iconv($from_charset, $to_charset, $str);
} elseif(check_valid_function("mb_convert_encoding")) { } elseif(!check_function_exists("mb_convert_encoding")) {
$result = mb_convert_encoding($str, $to_charset, $from_charset); $result = mb_convert_encoding($str, $to_charset, $from_charset);
} }
@ -46,7 +46,7 @@ if(check_valid_function("get_converted_string")) {
} }
} }
if(check_valid_function("nl2p")) { if(!check_function_exists("nl2p")) {
function nl2p($string) { function nl2p($string) {
$paragraphs = ''; $paragraphs = '';
foreach (explode("\n", $string) as $line) { foreach (explode("\n", $string) as $line) {
@ -58,31 +58,31 @@ if(check_valid_function("nl2p")) {
} }
} }
if(check_valid_function("br2nl")) { if(!check_function_exists("br2nl")) {
function br2nl($string) { function br2nl($string) {
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string); return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
} }
} }
if(check_valid_function("br2p")) { if(!check_function_exists("br2p")) {
function br2p($string) { function br2p($string) {
return nl2p(br2nl($string)); return nl2p(br2nl($string));
} }
} }
if(check_valid_function("get_formatted_number")) { if(!check_function_exists("get_formatted_number")) {
function get_formatted_number($value) { function get_formatted_number($value) {
return number_format(floatval($value)); return number_format(floatval($value));
} }
} }
if(check_valid_function("get_cutted_string")) { if(!check_function_exists("get_cutted_string")) {
function get_cutted_string($str, $start, $len=0, $charset="utf-8") { function get_cutted_string($str, $start, $len=0, $charset="utf-8") {
$result = ""; $result = "";
if(check_valid_function("iconv_substr")) { if(!check_function_exists("iconv_substr")) {
$result = iconv_substr($str, $start, $len, $charset); $result = iconv_substr($str, $start, $len, $charset);
} elseif(check_valid_function("mb_substr")) { } elseif(!check_function_exists("mb_substr")) {
$result = mb_substr($str, $start, $len, $charset); $result = mb_substr($str, $start, $len, $charset);
} else { } else {
$result = substr($str, $start, $len); $result = substr($str, $start, $len);
@ -92,27 +92,27 @@ if(check_valid_function("get_cutted_string")) {
} }
} }
if(check_valid_function("explode_by_line")) { if(!check_function_exists("explode_by_line")) {
function explode_by_line($str) { function explode_by_line($str) {
return preg_split('/\n|\r\n?/', $str); return preg_split('/\n|\r\n?/', $str);
} }
} }
if(check_valid_function("read_storage_file_by_line")) { if(!check_function_exists("read_storage_file_by_line")) {
function read_storage_file_by_line($filename, $options=array()) { function read_storage_file_by_line($filename, $options=array()) {
return explode_by_line(read_storage_file($filename, $options)); return explode_by_line(read_storage_file($filename, $options));
} }
} }
// https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php // https://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
if(check_valid_function("startsWith")) { if(!check_function_exists("startsWith")) {
function startsWith($haystack, $needle) { function startsWith($haystack, $needle) {
$length = strlen($needle); $length = strlen($needle);
return (substr($haystack, 0, $length) === $needle); return (substr($haystack, 0, $length) === $needle);
} }
} }
if(check_valid_function("endsWith")) { if(!check_function_exists("endsWith")) {
function endsWith($haystack, $needle) { function endsWith($haystack, $needle) {
$length = strlen($needle); $length = strlen($needle);
if($length == 0) { if($length == 0) {
@ -124,7 +124,7 @@ if(check_valid_function("endsWith")) {
} }
// https://stackoverflow.com/questions/4955433/php-multiple-delimiters-in-explode/27767665#27767665 // https://stackoverflow.com/questions/4955433/php-multiple-delimiters-in-explode/27767665#27767665
if(check_valid_function("multiexplode")) { if(!check_function_exists("multiexplode")) {
function multiexplode($delimiters, $string) { function multiexplode($delimiters, $string) {
$ready = str_replace($delimiters, $delimiters[0], $string); $ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready); $launch = explode($delimiters[0], $ready);
@ -132,7 +132,7 @@ if(check_valid_function("multiexplode")) {
} }
} }
if(check_valid_function("parse_pipelined_data")) { if(!check_function_exists("parse_pipelined_data")) {
function parse_pipelined_data($pipelined_data, $keynames=array()) { function parse_pipelined_data($pipelined_data, $keynames=array()) {
$result = array(); $result = array();
$parsed_data = explode("|", $pipelined_data); $parsed_data = explode("|", $pipelined_data);
@ -151,13 +151,13 @@ if(check_valid_function("parse_pipelined_data")) {
} }
} }
if(check_valid_function("eregi_compatible")) { if(!check_function_exists("eregi_compatible")) {
function eregi_compatible($pattern, $subject, &$matches=NULL) { function eregi_compatible($pattern, $subject, &$matches=NULL) {
return preg_match(sprintf("/%s/i", $pattern), $subject, $matches); return preg_match(sprintf("/%s/i", $pattern), $subject, $matches);
} }
} }
if(check_valid_function("eregi_replace_compatible")) { if(!check_function_exists("eregi_replace_compatible")) {
function eregi_replace_compatible($pattern, $replacement, $subject) { function eregi_replace_compatible($pattern, $replacement, $subject) {
return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject); return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject);
} }

View File

@ -6,7 +6,7 @@
* @brief TableWiz helper * @brief TableWiz helper
*/ */
if(check_valid_function("tablewiz_cut_str")) { if(!check_function_exists("tablewiz_cut_str")) {
function tablewiz_cut_str($str, $strlimit=0) { function tablewiz_cut_str($str, $strlimit=0) {
$plaintext = strip_tags($str); $plaintext = strip_tags($str);
@ -19,7 +19,7 @@ if(check_valid_function("tablewiz_cut_str")) {
} }
} }
if(check_valid_function("tablewiz_create")) { if(!check_function_exists("tablewiz_create")) {
function tablewiz_create($rows, $bind=array(), $domid="", $domclass="", $strlimit=0, $thead_html=array(), $tbody_html_list=array()) { function tablewiz_create($rows, $bind=array(), $domid="", $domclass="", $strlimit=0, $thead_html=array(), $tbody_html_list=array()) {
$html = ""; $html = "";

View File

@ -7,7 +7,7 @@
*/ */
/* Query a time server (C) 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */ /* Query a time server (C) 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */
if(check_valid_function("query_time_server")) { if(!check_function_exists("query_time_server")) {
function query_time_server($timeserver, $socket) { function query_time_server($timeserver, $socket) {
// parameters: server, socket, error code, error text, timeout // parameters: server, socket, error code, error text, timeout
$fp = fsockopen($timeserver,$socket,$err,$errstr,5); $fp = fsockopen($timeserver,$socket,$err,$errstr,5);
@ -28,7 +28,7 @@ if(check_valid_function("query_time_server")) {
} }
} }
if(check_valid_function("get_server_time")) { if(!check_function_exists("get_server_time")) {
function get_server_time($timeserver="time.bora.net") { function get_server_time($timeserver="time.bora.net") {
$timestamp = false; $timestamp = false;
$timercvd = query_time_server($timeserver, 37); $timercvd = query_time_server($timeserver, 37);

View File

@ -6,7 +6,7 @@
* @brief Geo Helper based on vWorld (vworld.kr, molit.go.kr) * @brief Geo Helper based on vWorld (vworld.kr, molit.go.kr)
*/ */
if(check_valid_function("vworld_utf8_replace")) { if(!check_function_exists("vworld_utf8_replace")) {
function vworld_utf8_replace($data) { function vworld_utf8_replace($data) {
$regex = <<<'END' $regex = <<<'END'
/ /
@ -32,7 +32,7 @@ END;
} }
} }
if(check_valid_function("vworld_geocode_keyword")) { if(!check_function_exists("vworld_geocode_keyword")) {
function vworld_geocode_keyword($keyword, $category="Poi", $multiple=false) { function vworld_geocode_keyword($keyword, $category="Poi", $multiple=false) {
global $config; global $config;
@ -132,7 +132,7 @@ if(check_valid_function("vworld_geocode_keyword")) {
} }
// get geocode from vworld // get geocode from vworld
if(check_valid_function("vworld_geocode_addr2coord")) { if(!check_function_exists("vworld_geocode_addr2coord")) {
function vworld_geocode_addr2coord($addr) { function vworld_geocode_addr2coord($addr) {
global $config; global $config;
@ -228,7 +228,7 @@ if(check_valid_function("vworld_geocode_addr2coord")) {
} }
} }
if(check_valid_function("vworld_adaptive_addr2coord")) { if(!check_function_exists("vworld_adaptive_addr2coord")) {
function vworld_adaptive_addr2coord($addr) { function vworld_adaptive_addr2coord($addr) {
$geopoint = array( $geopoint = array(
"address" => "", "address" => "",

View File

@ -18,13 +18,13 @@
/* // PRINT CONTENT: echo $response['content']; */ /* // PRINT CONTENT: echo $response['content']; */
/****** END EXAMPLES *****/ /****** END EXAMPLES *****/
if(check_valid_function("get_web_fgc")) { if(!check_function_exists("get_web_fgc")) {
function get_web_fgc($url) { function get_web_fgc($url) {
return (ini_get("allow_url_fopen") ? file_get_contents($url) : false); return (ini_get("allow_url_fopen") ? file_get_contents($url) : false);
} }
} }
if(check_valid_function("get_web_build_qs")) { if(!check_function_exists("get_web_build_qs")) {
function get_web_build_qs($url="", $data) { function get_web_build_qs($url="", $data) {
$qs = ""; $qs = "";
if(empty($url)) { if(empty($url)) {
@ -41,7 +41,7 @@ if(check_valid_function("get_web_build_qs")) {
} }
} }
if(check_valid_function("get_web_cmd")) { if(!check_function_exists("get_web_cmd")) {
function get_web_cmd($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) { function get_web_cmd($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
$output = ""; $output = "";
@ -107,7 +107,7 @@ if(check_valid_function("get_web_cmd")) {
} }
// http://dev.epiloum.net/109 // http://dev.epiloum.net/109
if(check_valid_function("get_web_sock")) { if(!check_function_exists("get_web_sock")) {
function get_web_sock($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_sock($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$output = ""; $output = "";
@ -194,7 +194,7 @@ if(check_valid_function("get_web_sock")) {
} }
} }
if(check_valid_function("get_web_wget")) { if(!check_function_exists("get_web_wget")) {
function get_web_wget($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_wget($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$content = false; $content = false;
@ -214,7 +214,7 @@ if(check_valid_function("get_web_wget")) {
} }
} }
if(check_valid_function("get_web_curl")) { if(!check_function_exists("get_web_curl")) {
function get_web_curl($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) { function get_web_curl($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45, $headers=array()) {
$content = false; $content = false;
$req_headers = array(); $req_headers = array();
@ -251,7 +251,7 @@ if(check_valid_function("get_web_curl")) {
if($method == "post") { if($method == "post") {
foreach($data as $k=>$v) { foreach($data as $k=>$v) {
if(substr($v, 0, 1) == "@") { // if this is a file if(substr($v, 0, 1) == "@") { // if this is a file
if(check_valid_function("curl_file_create")) { // php 5.5+ if(!check_function_exists("curl_file_create")) { // php 5.5+
$data[$k] = curl_file_create(substr($v, 1)); $data[$k] = curl_file_create(substr($v, 1));
} else { } else {
$data[$k] = "@" . realpath(substr($v, 1)); $data[$k] = "@" . realpath(substr($v, 1));
@ -301,7 +301,7 @@ if(check_valid_function("get_web_curl")) {
} }
} }
if(check_valid_function("get_web_page")) { if(!check_function_exists("get_web_page")) {
function get_web_page($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_page($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$status = false; $status = false;
$resno = false; $resno = false;
@ -388,14 +388,14 @@ if(check_valid_function("get_web_page")) {
} }
} }
if(check_valid_function("get_web_identifier")) { if(!check_function_exists("get_web_identifier")) {
function get_web_identifier($url, $method="get", $data=array()) { function get_web_identifier($url, $method="get", $data=array()) {
$hash_data = (count($data) > 0) ? get_hashed_text(serialize($data)) : "*"; $hash_data = (count($data) > 0) ? get_hashed_text(serialize($data)) : "*";
return get_hashed_text(sprintf("%s.%s.%s", get_hashed_text($method), get_hashed_text($url), $hash_data)); return get_hashed_text(sprintf("%s.%s.%s", get_hashed_text($method), get_hashed_text($url), $hash_data));
} }
} }
if(check_valid_function("get_web_cache")) { if(!check_function_exists("get_web_cache")) {
function get_web_cache($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_cache($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$content = false; $content = false;
@ -423,7 +423,7 @@ if(check_valid_function("get_web_cache")) {
} }
} }
if(check_valid_function("get_web_json")) { if(!check_function_exists("get_web_json")) {
function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_json($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$result = false; $result = false;
@ -436,7 +436,7 @@ if(check_valid_function("get_web_json")) {
} }
} }
if(check_valid_function("get_web_dom")) { if(!check_function_exists("get_web_dom")) {
function get_web_dom($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_dom($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$result = false; $result = false;
$response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out); $response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
@ -450,7 +450,7 @@ if(check_valid_function("get_web_dom")) {
} }
} }
if(check_valid_function("get_web_meta")) { if(!check_function_exists("get_web_meta")) {
function get_web_meta($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_meta($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$result = false; $result = false;
$response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out); $response = get_web_page($url, $method, $data, $proxy, $ua, $ct_out, $t_out);
@ -467,7 +467,7 @@ if(check_valid_function("get_web_meta")) {
} }
} }
if(check_valid_function("get_web_xml")) { if(!check_function_exists("get_web_xml")) {
function get_web_xml($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) { function get_web_xml($url, $method="get", $data=array(), $proxy="", $ua="", $ct_out=45, $t_out=45) {
$result = false; $result = false;
@ -480,7 +480,7 @@ if(check_valid_function("get_web_xml")) {
} }
} }
if(check_valid_function("get_parsed_json")) { if(!check_function_exists("get_parsed_json")) {
function get_parsed_json($raw, $options=array()) { function get_parsed_json($raw, $options=array()) {
$result = false; $result = false;
@ -494,11 +494,11 @@ if(check_valid_function("get_parsed_json")) {
} }
} }
if(check_valid_function("get_parsed_xml")) { if(!check_function_exists("get_parsed_xml")) {
function get_parsed_xml($raw, $options=array()) { function get_parsed_xml($raw, $options=array()) {
$result = false; $result = false;
if(check_valid_function("simplexml_load_string")) { if(!check_function_exists("simplexml_load_string")) {
$result = simplexml_load_string($response['content'], null, LIBXML_NOCDATA); $result = simplexml_load_string($response['content'], null, LIBXML_NOCDATA);
} }
@ -506,12 +506,12 @@ if(check_valid_function("get_parsed_xml")) {
} }
} }
if(check_valid_function("get_parsed_dom")) { if(!check_function_exists("get_parsed_dom")) {
function get_parsed_dom($raw, $options=array()) { function get_parsed_dom($raw, $options=array()) {
$result = false; $result = false;
if(loadHelper("simple_html_dom")) { if(loadHelper("simple_html_dom")) {
$result = check_valid_function("str_get_html") ? str_get_html($response['content']) : $raw; $result = !check_function_exists("str_get_html") ? str_get_html($response['content']) : $raw;
} }
return $result; return $result;
@ -519,7 +519,7 @@ if(check_valid_function("get_parsed_dom")) {
} }
// 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters // 2018-06-01: Adaptive JSON is always quotes without escape non-ascii characters
if(check_valid_function("get_adaptive_json")) { if(!check_function_exists("get_adaptive_json")) {
function get_adaptive_json($data) { function get_adaptive_json($data) {
$result = ""; $result = "";
$lines = array(); $lines = array();
@ -537,7 +537,7 @@ if(check_valid_function("get_adaptive_json")) {
} }
// 2018-09-10: support webproxy // 2018-09-10: support webproxy
if(check_valid_function("get_webproxy_url")) { if(!check_function_exists("get_webproxy_url")) {
function get_webproxy_url($url, $route="webproxy") { function get_webproxy_url($url, $route="webproxy") {
return get_route_link($route, array( return get_route_link($route, array(
"url" => $url "url" => $url
@ -545,7 +545,7 @@ if(check_valid_function("get_webproxy_url")) {
} }
} }
if(check_valid_function("get_web_user_agent")) { if(!check_function_exists("get_web_user_agent")) {
function get_web_user_agent($ua="") { function get_web_user_agent($ua="") {
if(empty($ua)) { if(empty($ua)) {
$ua = "ReasonableFramework/1.2 (https://github.com/gnh1201/reasonableframework)"; $ua = "ReasonableFramework/1.2 (https://github.com/gnh1201/reasonableframework)";

View File

@ -6,7 +6,7 @@
* @brief Wordpress Rest API helper * @brief Wordpress Rest API helper
*/ */
if(check_valid_function("get_wp_posts")) { if(!check_function_exists("get_wp_posts")) {
function get_wp_posts($wp_server_url) { function get_wp_posts($wp_server_url) {
$results = array(); $results = array();
@ -43,7 +43,7 @@ if(check_valid_function("get_wp_posts")) {
} }
} }
if(check_valid_function("parse_wp_posts")) { if(!check_function_exists("parse_wp_posts")) {
function parse_wp_posts($wp_server_url) { function parse_wp_posts($wp_server_url) {
$rest_no_route = false; $rest_no_route = false;
@ -90,7 +90,7 @@ if(check_valid_function("parse_wp_posts")) {
} }
} }
if(check_valid_function("get_wp_new_message")) { if(!check_function_exists("get_wp_new_message")) {
function get_wp_new_message($title, $content, $link="") { function get_wp_new_message($title, $content, $link="") {
$new_message = ""; $new_message = "";
@ -111,7 +111,7 @@ if(check_valid_function("get_wp_new_message")) {
} }
} }
if(check_valid_function("authenticate_wp")) { if(!check_function_exists("authenticate_wp")) {
function authenticate_wp($wp_server_url, $client_id, $client_secret, $route="", $code="", $scope="basic", $state="") { function authenticate_wp($wp_server_url, $client_id, $client_secret, $route="", $code="", $scope="basic", $state="") {
$flag = false; $flag = false;
@ -172,7 +172,7 @@ if(check_valid_function("authenticate_wp")) {
} }
} }
if(check_valid_function("write_wp_post")) { if(!check_function_exists("write_wp_post")) {
function write_wp_post($wp_server_url, $access_token, $data=array()) { function write_wp_post($wp_server_url, $access_token, $data=array()) {
$default_data = array( $default_data = array(
"title" => "Untitled", "title" => "Untitled",
@ -201,7 +201,7 @@ if(check_valid_function("write_wp_post")) {
} }
} }
if(check_valid_function("get_wp_categories")) { if(!check_function_exists("get_wp_categories")) {
function get_wp_categories($wp_server_url, $access_token) { function get_wp_categories($wp_server_url, $access_token) {
$response = get_web_json(get_web_build_qs($wp_server_url, array( $response = get_web_json(get_web_build_qs($wp_server_url, array(
"rest_route" => "/wp/v2/categories" "rest_route" => "/wp/v2/categories"

View File

@ -7,21 +7,21 @@
*/ */
// get database prefix // get database prefix
if(check_valid_function("zb4_get_db_prefix")) { if(!check_function_exists("zb4_get_db_prefix")) {
function zb4_get_db_prefix() { function zb4_get_db_prefix() {
return "zetyx_"; return "zetyx_";
} }
} }
// get table // get table
if(check_valid_function("zb4_get_db_table")) { if(!check_function_exists("zb4_get_db_table")) {
function zb4_get_db_table($tablename) { function zb4_get_db_table($tablename) {
return (zb4_get_db_prefix() . $tablename); return (zb4_get_db_prefix() . $tablename);
} }
} }
// get write table // get write table
if(check_valid_function("zb4_get_write_table")) { if(!check_function_exists("zb4_get_write_table")) {
function zb4_get_write_table($tablename, $version=4) { function zb4_get_write_table($tablename, $version=4) {
$write_prefix = zb4_get_db_prefix() . "board_"; $write_prefix = zb4_get_db_prefix() . "board_";
$write_table = $write_prefix . $tablename; $write_table = $write_prefix . $tablename;
@ -30,7 +30,7 @@ if(check_valid_function("zb4_get_write_table")) {
} }
// write post // write post
if(check_valid_function("zb4_write_post")) { if(!check_function_exists("zb4_write_post")) {
function zb4_write_post($tablename, $data=array()) { function zb4_write_post($tablename, $data=array()) {
$result = 0; $result = 0;
$write_table = zb4_get_write_table($tablename); $write_table = zb4_get_write_table($tablename);
@ -105,14 +105,14 @@ if(check_valid_function("zb4_write_post")) {
} }
} }
if(check_valid_function("zb4_get_posts")) { if(!check_function_exists("zb4_get_posts")) {
function zb4_get_posts($table_name, $page=1, $limit=20, $options=array()) { 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); $sql = "select * from " . zb4_get_write_table($table_name) . " order by no desc" . get_page_range($page, $limit);
return exec_db_fetch_all($sql); return exec_db_fetch_all($sql);
} }
} }
if(check_valid_function("zb4_get_post_by_id")) { if(!check_function_exists("zb4_get_post_by_id")) {
function zb4_get_post_by_id($table_name, $post_id) { function zb4_get_post_by_id($table_name, $post_id) {
$sql = "select * from " . zb4_get_write_table($table_name) . " where no = :no"; $sql = "select * from " . zb4_get_write_table($table_name) . " where no = :no";
return exec_db_fetch($sql, array( return exec_db_fetch($sql, array(

View File

@ -36,7 +36,7 @@ if(check_function_exists("check_function_exists") == -1) {
} }
// set scope // set scope
if(check_valid_function("set_scope")) { if(!check_function_exists("set_scope")) {
function set_scope($k, $v) { function set_scope($k, $v) {
global $scope; global $scope;
$scope[$k] = $v; $scope[$k] = $v;
@ -44,7 +44,7 @@ if(check_valid_function("set_scope")) {
} }
// get scope // get scope
if(check_valid_function("get_scope")) { if(!check_function_exists("get_scope")) {
function get_scope($k) { function get_scope($k) {
global $scope; global $scope;
return array_key_exists($k, $scope) ? $scope[$k] : null; return array_key_exists($k, $scope) ? $scope[$k] : null;
@ -52,7 +52,7 @@ if(check_valid_function("get_scope")) {
} }
// register loaded resources // register loaded resources
if(check_valid_function("register_loaded")) { if(!check_function_exists("register_loaded")) {
function register_loaded($k, $v) { function register_loaded($k, $v) {
$loaded = get_scope("loaded"); $loaded = get_scope("loaded");
if(array_key_exists($k, $loaded)) { if(array_key_exists($k, $loaded)) {
@ -65,7 +65,7 @@ if(check_valid_function("register_loaded")) {
} }
// sandbox for include function // sandbox for include function
if(check_valid_function("include_isolate")) { if(!check_function_exists("include_isolate")) {
function include_isolate($file, $data=array()) { function include_isolate($file, $data=array()) {
if(count($data) > 0) { if(count($data) > 0) {
extract($data); extract($data);
@ -75,14 +75,14 @@ if(check_valid_function("include_isolate")) {
} }
// set autoloader // set autoloader
if(check_valid_function("set_autoloader")) { if(!check_function_exists("set_autoloader")) {
function set_autoloader() { function set_autoloader() {
return include('./vendor/autoload.php'); return include('./vendor/autoload.php');
} }
} }
// load view file // load view file
if(check_valid_function("renderView")) { if(!check_function_exists("renderView")) {
function renderView($name, $data=array()) { function renderView($name, $data=array()) {
$flag = true; $flag = true;
$views = explode(';', $name); $views = explode(';', $name);
@ -98,7 +98,7 @@ if(check_valid_function("renderView")) {
} }
// load view by rules // load view by rules
if(check_valid_function("renderViewByRules")) { if(!check_function_exists("renderViewByRules")) {
function renderViewByRules($rules, $data=array()) { function renderViewByRules($rules, $data=array()) {
foreach($rules as $k=>$v) { foreach($rules as $k=>$v) {
if(in_array($k, get_routes())) { if(in_array($k, get_routes())) {
@ -109,7 +109,7 @@ if(check_valid_function("renderViewByRules")) {
} }
// load system module // load system module
if(check_valid_function("loadModule")) { if(!check_function_exists("loadModule")) {
function loadModule($name) { function loadModule($name) {
$flag = true; $flag = true;
$modules = explode(';', $name); $modules = explode(';', $name);
@ -127,7 +127,7 @@ if(check_valid_function("loadModule")) {
} }
// load helper file // load helper file
if(check_valid_function("loadHelper")) { if(!check_function_exists("loadHelper")) {
function loadHelper($name) { function loadHelper($name) {
$flag = true; $flag = true;
$helpers = explode(';', $name); $helpers = explode(';', $name);
@ -145,7 +145,7 @@ if(check_valid_function("loadHelper")) {
} }
// load route file // load route file
if(check_valid_function("loadRoute")) { if(!check_function_exists("loadRoute")) {
function loadRoute($name, $data=array()) { function loadRoute($name, $data=array()) {
$flag = true; $flag = true;
$routes = explode(";", $name); $routes = explode(";", $name);
@ -163,7 +163,7 @@ if(check_valid_function("loadRoute")) {
} }
// load vendor file // load vendor file
if(check_valid_function("loadVendor")) { if(!check_function_exists("loadVendor")) {
function loadVendor($uses, $data=array()) { function loadVendor($uses, $data=array()) {
$flag = true; $flag = true;
$usenames = array(); $usenames = array();
@ -189,7 +189,7 @@ if(check_valid_function("loadVendor")) {
} }
} }
if(check_valid_function("array_key_empty")) { if(!check_function_exists("array_key_empty")) {
function array_key_empty($key, $array) { function array_key_empty($key, $array) {
$empty = true; $empty = true;
@ -203,7 +203,7 @@ if(check_valid_function("array_key_empty")) {
} }
} }
if(check_valid_function("array_key_equals")) { if(!check_function_exists("array_key_equals")) {
function array_key_equals($key, $array, $value) { function array_key_equals($key, $array, $value) {
$equals = false; $equals = false;
@ -217,7 +217,7 @@ if(check_valid_function("array_key_equals")) {
} }
} }
if(check_valid_function("array_key_is_array")) { if(!check_function_exists("array_key_is_array")) {
function array_key_is_array($key, $array) { function array_key_is_array($key, $array) {
$flag = false; $flag = false;
@ -231,7 +231,7 @@ if(check_valid_function("array_key_is_array")) {
} }
} }
if(check_valid_function("array_multikey_empty")) { if(!check_function_exists("array_multikey_empty")) {
function array_multikey_empty($keys, $array) { function array_multikey_empty($keys, $array) {
$flag = false; $flag = false;
foreach($keys as $key) { foreach($keys as $key) {
@ -243,7 +243,7 @@ if(check_valid_function("array_multikey_empty")) {
} }
} }
if(check_valid_function("get_value_in_array")) { if(!check_function_exists("get_value_in_array")) {
function get_value_in_array($name, $arr=array(), $default=false) { function get_value_in_array($name, $arr=array(), $default=false) {
$output = false; $output = false;
@ -257,7 +257,7 @@ if(check_valid_function("get_value_in_array")) {
} }
} }
if(check_valid_function("get_value_in_object")) { if(!check_function_exists("get_value_in_object")) {
function get_value_in_object($name, $obj, $default="") { function get_value_in_object($name, $obj, $default="") {
$output = $obj->$name; $output = $obj->$name;
return $output; return $output;
@ -265,14 +265,14 @@ if(check_valid_function("get_value_in_object")) {
} }
// error handler // error handler
if(check_valid_function("set_error")) { if(!check_function_exists("set_error")) {
function set_error($msg, $code="ERROR") { function set_error($msg, $code="ERROR") {
global $scope; global $scope;
$scope['errors'][] = $code . ": " . $msg; $scope['errors'][] = $code . ": " . $msg;
} }
} }
if(check_valid_function("get_errors")) { if(!check_function_exists("get_errors")) {
function get_errors($d=false, $e=false) { // d: display, e: exit function get_errors($d=false, $e=false) { // d: display, e: exit
global $scope; global $scope;
$errors = $scope['errors']; $errors = $scope['errors'];
@ -290,13 +290,13 @@ if(check_valid_function("get_errors")) {
} }
} }
if(check_valid_function("show_errors")) { if(!check_function_exists("show_errors")) {
function show_errors($exit=true) { function show_errors($exit=true) {
return get_errors(true, $exit); return get_errors(true, $exit);
} }
} }
if(check_valid_function("set_error_exit")) { if(!check_function_exists("set_error_exit")) {
function set_error_exit($msg, $code="ERROR") { function set_error_exit($msg, $code="ERROR") {
set_error($msg, $code); set_error($msg, $code);
show_errors(); show_errors();
@ -304,7 +304,7 @@ if(check_valid_function("set_error_exit")) {
} }
if(check_valid_function("get_property_value")) { if(!check_function_exists("get_property_value")) {
function get_property_value($prop, $obj, $ac=false) { function get_property_value($prop, $obj, $ac=false) {
$result = false; $result = false;
if(is_object($obj) && property_exists($obj, $prop)) { if(is_object($obj) && property_exists($obj, $prop)) {
@ -321,7 +321,7 @@ if(check_valid_function("get_property_value")) {
} }
} }
if(check_valid_function("get_routes")) { if(!check_function_exists("get_routes")) {
function get_routes() { function get_routes() {
$loaded = get_scope("loaded"); $loaded = get_scope("loaded");
return $loaded['route']; return $loaded['route'];

View File

@ -6,7 +6,7 @@
* @brief Configuration module * @brief Configuration module
*/ */
if(check_valid_function("read_config")) { if(!check_function_exists("read_config")) {
function read_config() { function read_config() {
$config = array(); $config = array();
@ -30,7 +30,7 @@ if(check_valid_function("read_config")) {
} }
} }
if(check_valid_function("get_config")) { if(!check_function_exists("get_config")) {
function get_config() { function get_config() {
$config = get_scope("config"); $config = get_scope("config");
@ -42,7 +42,7 @@ if(check_valid_function("get_config")) {
} }
} }
if(check_valid_function("get_config_value")) { if(!check_function_exists("get_config_value")) {
function get_config_value($key) { function get_config_value($key) {
$config = get_config(); $config = get_config();
@ -55,7 +55,7 @@ if(check_valid_function("get_config_value")) {
} }
} }
if(check_valid_function("get_current_datetime")) { if(!check_function_exists("get_current_datetime")) {
function get_current_datetime() { function get_current_datetime() {
$datetime = false; $datetime = false;

View File

@ -6,20 +6,20 @@
* @brief Database module * @brief Database module
*/ */
if(check_valid_function("get_db_driver")) { if(!check_function_exists("get_db_driver")) {
function get_db_driver() { function get_db_driver() {
$config = get_config(); $config = get_config();
return get_value_in_array("db_driver", $config, false); return get_value_in_array("db_driver", $config, false);
} }
} }
if(check_valid_function("check_db_driver")) { if(!check_function_exists("check_db_driver")) {
function check_db_driver($db_driver) { function check_db_driver($db_driver) {
return (get_db_driver() == $db_driver); return (get_db_driver() == $db_driver);
} }
} }
if(check_valid_function("get_db_connect")) { if(!check_function_exists("get_db_connect")) {
function get_db_connect($a=3, $b=0) { function get_db_connect($a=3, $b=0) {
$conn = false; $conn = false;
$config = get_config(); $config = get_config();
@ -58,7 +58,7 @@ if(check_valid_function("get_db_connect")) {
} }
} }
if(check_valid_function("exec_stmt_query")) { if(!check_function_exists("exec_stmt_query")) {
function exec_stmt_query($sql, $bind=array()) { function exec_stmt_query($sql, $bind=array()) {
$stmt = get_db_stmt($sql, $bind); $stmt = get_db_stmt($sql, $bind);
$stmt->execute(); $stmt->execute();
@ -67,7 +67,7 @@ if(check_valid_function("exec_stmt_query")) {
} }
} }
if(check_valid_function("get_dbc_object")) { if(!check_function_exists("get_dbc_object")) {
function get_dbc_object($renew=false) { function get_dbc_object($renew=false) {
$dbc = get_scope("dbc"); $dbc = get_scope("dbc");
@ -79,7 +79,7 @@ if(check_valid_function("get_dbc_object")) {
} }
} }
if(check_valid_function("get_db_binded_param")) { if(!check_function_exists("get_db_binded_param")) {
function get_db_binded_param($expression, $bind) { function get_db_binded_param($expression, $bind) {
foreach($bind as $k=>$v) { foreach($bind as $k=>$v) {
if($expression == (":" . $k)) { if($expression == (":" . $k)) {
@ -91,7 +91,7 @@ if(check_valid_function("get_db_binded_param")) {
} }
} }
if(check_valid_function("get_db_binded_sql")) { if(!check_function_exists("get_db_binded_sql")) {
function get_db_binded_sql($sql, $bind) { function get_db_binded_sql($sql, $bind) {
$d = explode(" ", $sql); $d = explode(" ", $sql);
foreach($d as $k=>$v) { foreach($d as $k=>$v) {
@ -103,7 +103,7 @@ if(check_valid_function("get_db_binded_sql")) {
} }
} }
if(check_valid_function("get_db_stmt")) { if(!check_function_exists("get_db_stmt")) {
function get_db_stmt($sql, $bind=array(), $bind_pdo=false, $show_sql=false) { function get_db_stmt($sql, $bind=array(), $bind_pdo=false, $show_sql=false) {
$sql = !$bind_pdo ? get_db_binded_sql($sql, $bind) : $sql; $sql = !$bind_pdo ? get_db_binded_sql($sql, $bind) : $sql;
$stmt = get_dbc_object()->prepare($sql); $stmt = get_dbc_object()->prepare($sql);
@ -126,7 +126,7 @@ if(check_valid_function("get_db_stmt")) {
} }
} }
if(check_valid_function("get_db_last_id")) { if(!check_function_exists("get_db_last_id")) {
function get_db_last_id() { function get_db_last_id() {
$last_id = false; $last_id = false;
@ -144,7 +144,7 @@ if(check_valid_function("get_db_last_id")) {
} }
} }
if(check_valid_function("exec_db_query")) { if(!check_function_exists("exec_db_query")) {
function exec_db_query($sql, $bind=array(), $options=array()) { function exec_db_query($sql, $bind=array(), $options=array()) {
$dbc = get_dbc_object(); $dbc = get_dbc_object();
@ -215,7 +215,7 @@ if(check_valid_function("exec_db_query")) {
} }
} }
if(check_valid_function("exec_db_fetch_all")) { if(!check_function_exists("exec_db_fetch_all")) {
function exec_db_fetch_all($sql, $bind=array()) { function exec_db_fetch_all($sql, $bind=array()) {
$rows = array(); $rows = array();
$stmt = get_db_stmt($sql, $bind); $stmt = get_db_stmt($sql, $bind);
@ -228,7 +228,7 @@ if(check_valid_function("exec_db_fetch_all")) {
} }
} }
if(check_valid_function("exec_db_fetch")) { if(!check_function_exists("exec_db_fetch")) {
function exec_db_fetch($sql, $bind=array(), $start=0, $bind_limit=false) { function exec_db_fetch($sql, $bind=array(), $start=0, $bind_limit=false) {
$fetched = NULL; $fetched = NULL;
$rows = array(); $rows = array();
@ -253,7 +253,7 @@ if(check_valid_function("exec_db_fetch")) {
} }
} }
if(check_valid_function("get_page_range")) { if(!check_function_exists("get_page_range")) {
function get_page_range($page=1, $limit=16) { function get_page_range($page=1, $limit=16) {
$append_sql = ""; $append_sql = "";
@ -271,7 +271,7 @@ if(check_valid_function("get_page_range")) {
} }
} }
if(check_valid_function("get_bind_to_sql_insert")) { if(!check_function_exists("get_bind_to_sql_insert")) {
function get_bind_to_sql_insert($tablename, $bind) { function get_bind_to_sql_insert($tablename, $bind) {
$bind_keys = array_keys($bind); $bind_keys = array_keys($bind);
$sql = "insert into %s (%s) values (:%s)"; $sql = "insert into %s (%s) values (:%s)";
@ -286,7 +286,7 @@ if(check_valid_function("get_bind_to_sql_insert")) {
} }
} }
if(check_valid_function("get_bind_to_sql_where")) { if(!check_function_exists("get_bind_to_sql_where")) {
// warning: variable k is not protected. do not use variable k and external variable without filter // warning: variable k is not protected. do not use variable k and external variable without filter
function get_bind_to_sql_where($bind, $excludes=array()) { function get_bind_to_sql_where($bind, $excludes=array()) {
$sql_where = ""; $sql_where = "";
@ -301,7 +301,7 @@ if(check_valid_function("get_bind_to_sql_where")) {
} }
} }
if(check_valid_function("get_bind_to_sql_update_set")) { if(!check_function_exists("get_bind_to_sql_update_set")) {
// warning: variable k is not protected. do not use variable k and external variable without filter // warning: variable k is not protected. do not use variable k and external variable without filter
function get_bind_to_sql_update_set($bind, $excludes=array()) { function get_bind_to_sql_update_set($bind, $excludes=array()) {
$sql_update_set = ""; $sql_update_set = "";
@ -318,7 +318,7 @@ if(check_valid_function("get_bind_to_sql_update_set")) {
} }
} }
if(check_valid_function("get_bind_to_sql_select")) { if(!check_function_exists("get_bind_to_sql_select")) {
// warning: variable k is not protected. do not use variable k and external variable without filter // 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()) { function get_bind_to_sql_select($tablename, $bind=array(), $options=array()) {
$sql = "select %s from %s where 1 %s %s %s"; $sql = "select %s from %s where 1 %s %s %s";
@ -389,7 +389,7 @@ if(check_valid_function("get_bind_to_sql_select")) {
} }
} }
if(check_valid_function("get_bind_to_sql_update")) { if(!check_function_exists("get_bind_to_sql_update")) {
function get_bind_to_sql_update($tablename, $bind, $filters=array(), $options=array()) { function get_bind_to_sql_update($tablename, $bind, $filters=array(), $options=array()) {
// process filters // process filters
$excludes = array(); $excludes = array();
@ -421,14 +421,14 @@ if(check_valid_function("get_bind_to_sql_update")) {
} }
} }
if(check_valid_function("get_bind_to_sql_delete")) { if(!check_function_exists("get_bind_to_sql_delete")) {
function get_bind_to_sql_delete($tablename, $bind, $options=array()) { function get_bind_to_sql_delete($tablename, $bind, $options=array()) {
$sql = "delete from %s where 1" . get_bind_to_sql_where($bind); $sql = "delete from %s where 1" . get_bind_to_sql_where($bind);
return $sql; return $sql;
} }
} }
if(check_valid_function("get_bind_to_sql_past_minutes")) { if(!check_function_exists("get_bind_to_sql_past_minutes")) {
function get_bind_to_sql_past_minutes($fieldname, $minutes=5) { function get_bind_to_sql_past_minutes($fieldname, $minutes=5) {
$sql_past_minutes = ""; $sql_past_minutes = "";
if($minutes > 0) { if($minutes > 0) {
@ -439,7 +439,7 @@ if(check_valid_function("get_bind_to_sql_past_minutes")) {
} }
// SQL eXtensible // SQL eXtensible
if(check_valid_function("get_bind_to_sqlx")) { if(!check_function_exists("get_bind_to_sqlx")) {
function get_bind_to_sqlx($filename, $bind, $options=array()) { function get_bind_to_sqlx($filename, $bind, $options=array()) {
$result = false; $result = false;
$sql = read_storage_file(get_file_name($filename, "sqlx"), array( $sql = read_storage_file(get_file_name($filename, "sqlx"), array(
@ -454,14 +454,14 @@ if(check_valid_function("get_bind_to_sqlx")) {
} }
// alias sql_query from exec_db_query // alias sql_query from exec_db_query
if(check_valid_function("sql_query")) { if(!check_function_exists("sql_query")) {
function sql_query($sql, $bind=array()) { function sql_query($sql, $bind=array()) {
return exec_db_query($sql, $bind); return exec_db_query($sql, $bind);
} }
} }
// get timediff // get timediff
if(check_valid_function("get_timediff_on_query")) { if(!check_function_exists("get_timediff_on_query")) {
function get_timediff_on_query($a, $b) { function get_timediff_on_query($a, $b) {
$dt = 0; $dt = 0;
@ -478,7 +478,7 @@ if(check_valid_function("get_timediff_on_query")) {
} }
// get assoc from json raw data // get assoc from json raw data
if(check_valid_function("json_decode_to_assoc")) { if(!check_function_exists("json_decode_to_assoc")) {
function json_decode_to_assoc($data) { function json_decode_to_assoc($data) {
$result = array(); $result = array();
@ -498,7 +498,7 @@ if(check_valid_function("json_decode_to_assoc")) {
} }
// close db connection // close db connection
if(check_valid_function("close_db_connect")) { if(!check_function_exists("close_db_connect")) {
function close_db_connect() { function close_db_connect() {
$dbc = get_scope("dbc"); $dbc = get_scope("dbc");
$dbc->close(); $dbc->close();

View File

@ -6,7 +6,7 @@
* @brief Logger module for ReasonableFramework * @brief Logger module for ReasonableFramework
*/ */
if(check_valid_function("write_visit_log")) { if(!check_function_exists("write_visit_log")) {
function write_visit_log() { function write_visit_log() {
$fw = false; $fw = false;
if(loadHelper("networktool")) { if(loadHelper("networktool")) {
@ -22,7 +22,7 @@ if(check_valid_function("write_visit_log")) {
} }
} }
if(check_valid_function("write_common_log")) { if(!check_function_exists("write_common_log")) {
function write_common_log($msg) { function write_common_log($msg) {
$msg = "\r\n" . $msg; $msg = "\r\n" . $msg;
return write_storage_file($msg, array( return write_storage_file($msg, array(

View File

@ -6,7 +6,7 @@
* @brief Security module for ReasonableFramework * @brief Security module for ReasonableFramework
*/ */
if(check_valid_function("check_token_abuse")) { if(!check_function_exists("check_token_abuse")) {
function check_token_abuse($_p_token, $_n_token) { function check_token_abuse($_p_token, $_n_token) {
$abuse = false; $abuse = false;
@ -19,7 +19,7 @@ if(check_valid_function("check_token_abuse")) {
} }
} }
if(check_valid_function("make_random_id")) { if(!check_function_exists("make_random_id")) {
function make_random_id($length = 10) { function make_random_id($length = 10) {
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
@ -31,7 +31,7 @@ if(check_valid_function("make_random_id")) {
} }
} }
if(check_valid_function("set_session")) { if(!check_function_exists("set_session")) {
function set_session($session_name, $value) { function set_session($session_name, $value) {
if(PHP_VERSION < '5.3.0') { if(PHP_VERSION < '5.3.0') {
session_register($session_name); session_register($session_name);
@ -40,7 +40,7 @@ if(check_valid_function("set_session")) {
} }
} }
if(check_valid_function("get_session")) { if(!check_function_exists("get_session")) {
function get_session($session_name) { function get_session($session_name) {
$session_value = ""; $session_value = "";
if(!array_key_empty($session_name, $_SESSION)) { if(!array_key_empty($session_name, $_SESSION)) {
@ -50,7 +50,7 @@ if(check_valid_function("get_session")) {
} }
} }
if(check_valid_function("set_session_token")) { if(!check_function_exists("set_session_token")) {
function set_session_token() { function set_session_token() {
$_token = make_random_id(10); $_token = make_random_id(10);
set_session("_token", $_token); set_session("_token", $_token);
@ -59,13 +59,13 @@ if(check_valid_function("set_session_token")) {
} }
} }
if(check_valid_function("get_session_token")) { if(!check_function_exists("get_session_token")) {
function get_session_token() { function get_session_token() {
return get_session("_token"); return get_session("_token");
} }
} }
if(check_valid_function("check_token_abuse_by_requests")) { if(!check_function_exists("check_token_abuse_by_requests")) {
function check_token_abuse_by_requests($name, $method="_POST") { function check_token_abuse_by_requests($name, $method="_POST") {
$requests = get_requests(); $requests = get_requests();
@ -80,7 +80,7 @@ if(check_valid_function("check_token_abuse_by_requests")) {
} }
} }
if(check_valid_function("check_login_session")) { if(!check_function_exists("check_login_session")) {
function check_login_session($ss_key, $config) { function check_login_session($ss_key, $config) {
$flag = false; $flag = false;
@ -94,7 +94,7 @@ if(check_valid_function("check_login_session")) {
} }
} }
if(check_valid_function("store_login_session")) { if(!check_function_exists("store_login_session")) {
function store_login_session($ss_key, $config) { function store_login_session($ss_key, $config) {
$flag = false; $flag = false;
@ -113,7 +113,7 @@ if(check_valid_function("store_login_session")) {
} }
} }
if(check_valid_function("process_safe_login")) { if(!check_function_exists("process_safe_login")) {
function process_safe_login($user_name, $user_password, $user_profile=array(), $escape_safe=false) { function process_safe_login($user_name, $user_password, $user_profile=array(), $escape_safe=false) {
$config = get_config(); $config = get_config();
@ -147,7 +147,7 @@ if(check_valid_function("process_safe_login")) {
} }
} }
if(check_valid_function("check_empty_requests")) { if(!check_function_exists("check_empty_requests")) {
function check_empty_requests($fieldnames, $method="get") { function check_empty_requests($fieldnames, $method="get") {
$requests = get_requests(); $requests = get_requests();
$errors = array(); $errors = array();
@ -173,7 +173,7 @@ if(check_valid_function("check_empty_requests")) {
} }
} }
if(check_valid_function("get_hashed_text")) { if(!check_function_exists("get_hashed_text")) {
function get_hashed_text($text, $algo="sha1", $options=array()) { function get_hashed_text($text, $algo="sha1", $options=array()) {
$hashed_text = false; $hashed_text = false;
@ -230,17 +230,17 @@ if(check_valid_function("get_hashed_text")) {
} }
} }
if(check_valid_function("hash_algo_exists")) { if(!check_function_exists("hash_algo_exists")) {
function hash_algo_exists($algo) { function hash_algo_exists($algo) {
$flag = false; $flag = false;
if(check_valid_function("hash_algos")) { if(!check_function_exists("hash_algos")) {
$flag = in_array($algo, hash_algos()); $flag = in_array($algo, hash_algos());
} }
return $flag; return $flag;
} }
} }
if(check_valid_function("get_salt")) { if(!check_function_exists("get_salt")) {
function get_salt() { function get_salt() {
$config = get_config(); $config = get_config();
@ -255,7 +255,7 @@ if(check_valid_function("get_salt")) {
} }
} }
if(check_valid_function("get_password")) { if(!check_function_exists("get_password")) {
function get_password($text, $algo="sha1") { function get_password($text, $algo="sha1") {
$config = get_config(); $config = get_config();
@ -282,7 +282,7 @@ if(check_valid_function("get_password")) {
} }
} }
if(check_valid_function("check_match_password")) { if(!check_function_exists("check_match_password")) {
function check_match_password($p, $n, $algo="sha1") { function check_match_password($p, $n, $algo="sha1") {
$flag = false; $flag = false;
$salt = get_salt(); $salt = get_salt();
@ -304,14 +304,14 @@ if(check_valid_function("check_match_password")) {
} }
} }
if(check_valid_function("protect_dir_path")) { if(!check_function_exists("protect_dir_path")) {
function protect_dir_path($path) { function protect_dir_path($path) {
$path = str_replace('/', '_', $path); $path = str_replace('/', '_', $path);
return $path; return $path;
} }
} }
if(check_valid_function("session_logout")) { if(!check_function_exists("session_logout")) {
function session_logout() { function session_logout() {
$config = get_config(); $config = get_config();
@ -347,19 +347,19 @@ if(check_valid_function("session_logout")) {
} }
} }
if(check_valid_function("get_current_user_id")) { if(!check_function_exists("get_current_user_id")) {
function get_current_user_id() { function get_current_user_id() {
return get_current_session_data("ss_user_id"); return get_current_session_data("ss_user_id");
} }
} }
if(check_valid_function("get_current_user_name")) { if(!check_function_exists("get_current_user_name")) {
function get_current_user_name() { function get_current_user_name() {
return get_current_session_data("ss_user_name"); return get_current_session_data("ss_user_name");
} }
} }
if(check_valid_function("get_current_session_data")) { if(!check_function_exists("get_current_session_data")) {
function get_current_session_data($name) { function get_current_session_data($name) {
$current_data = ""; $current_data = "";
@ -377,7 +377,7 @@ if(check_valid_function("get_current_session_data")) {
} }
} }
if(check_valid_function("get_user_profile")) { if(!check_function_exists("get_user_profile")) {
function get_user_profile() { function get_user_profile() {
$user_profile = array( $user_profile = array(
"user_id" => get_current_user_id(), "user_id" => get_current_user_id(),
@ -388,7 +388,7 @@ if(check_valid_function("get_user_profile")) {
} }
} }
if(check_valid_function("get_fixed_id")) { if(!check_function_exists("get_fixed_id")) {
function get_fixed_id($str, $len=0, $salt="") { function get_fixed_id($str, $len=0, $salt="") {
$config = get_config(); $config = get_config();
@ -399,7 +399,7 @@ if(check_valid_function("get_fixed_id")) {
} }
// https://stackoverflow.com/questions/1996122/how-to-prevent-xss-with-html-php // https://stackoverflow.com/questions/1996122/how-to-prevent-xss-with-html-php
if(check_valid_function("get_clean_xss")) { if(!check_function_exists("get_clean_xss")) {
function get_clean_xss($data, $notags=0) { function get_clean_xss($data, $notags=0) {
if(is_string($data)) { if(is_string($data)) {
// if no tags (equals to strip_tags) // if no tags (equals to strip_tags)
@ -443,20 +443,20 @@ if(check_valid_function("get_clean_xss")) {
} }
} }
if(check_valid_function("get_clean_newlines")) { if(!check_function_exists("get_clean_newlines")) {
function get_clean_newlines($data) { function get_clean_newlines($data) {
return is_string($data) ? trim(preg_replace('~[\r\n]+~', ' ', $data)) : $data; return is_string($data) ? trim(preg_replace('~[\r\n]+~', ' ', $data)) : $data;
} }
} }
if(check_valid_function("get_clean_text")) { if(!check_function_exists("get_clean_text")) {
function get_clean_text($data) { function get_clean_text($data) {
return is_string($data) ? get_clean_newlines(get_clean_xss($data, 1)) : $data; return is_string($data) ? get_clean_newlines(get_clean_xss($data, 1)) : $data;
} }
} }
// support curl or jsonp(callback) // support curl or jsonp(callback)
if(check_valid_function("get_callable_token")) { if(!check_function_exists("get_callable_token")) {
function get_callable_token($token, $callback="", $charset="utf-8") { function get_callable_token($token, $callback="", $charset="utf-8") {
$callback = get_clean_xss($callback); $callback = get_clean_xss($callback);
$retdata = ""; $retdata = "";
@ -471,7 +471,7 @@ if(check_valid_function("get_callable_token")) {
} }
} }
if(check_valid_function("encapsulate_text")) { if(!check_function_exists("encapsulate_text")) {
function encapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="", $hash="", $hash_algo="sha1") { function encapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="", $hash="", $hash_algo="sha1") {
$config = get_config(); $config = get_config();
@ -494,7 +494,7 @@ if(check_valid_function("encapsulate_text")) {
$init_key = empty($key) ? $config['masterkey'] : $key; $init_key = empty($key) ? $config['masterkey'] : $key;
$init_iv = empty($iv) ? $config['masteriv'] : $iv; $init_iv = empty($iv) ? $config['masteriv'] : $iv;
if(check_valid_function("openssl_encrypt")) { if(!check_function_exists("openssl_encrypt")) {
$encrypted_text = @openssl_encrypt($init_text, $algo, $init_key, true, $init_iv); $encrypted_text = @openssl_encrypt($init_text, $algo, $init_key, true, $init_iv);
} else { } else {
$encrypted_text = xor_this($init_key, $init_text); $encrypted_text = xor_this($init_key, $init_text);
@ -509,7 +509,7 @@ if(check_valid_function("encapsulate_text")) {
} }
} }
if(check_valid_function("decapsulate_text")) { if(!check_function_exists("decapsulate_text")) {
function decapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="", $hash="", $hash_algo="sha1") { function decapsulate_text($text, $algo="aes-128-cbc", $key="", $iv="", $hash="", $hash_algo="sha1") {
$config = get_config(); $config = get_config();
@ -525,7 +525,7 @@ if(check_valid_function("decapsulate_text")) {
$init_key = empty($key) ? $config['masterkey'] : $key; $init_key = empty($key) ? $config['masterkey'] : $key;
$init_iv = empty($iv) ? $config['masteriv'] : $iv; $init_iv = empty($iv) ? $config['masteriv'] : $iv;
if(check_valid_function("openssl_decrypt")) { if(!check_function_exists("openssl_decrypt")) {
$decrypted_text = @openssl_decrypt($init_text, $algo, $init_key, true, $init_iv); $decrypted_text = @openssl_decrypt($init_text, $algo, $init_key, true, $init_iv);
} else { } else {
$decrypted_text = xor_this($init_key, $init_text); $decrypted_text = xor_this($init_key, $init_text);
@ -547,14 +547,14 @@ if(check_valid_function("decapsulate_text")) {
} }
} }
if(check_valid_function("make_safe_argument")) { if(!check_function_exists("make_safe_argument")) {
function make_safe_argument($str) { function make_safe_argument($str) {
return addslashes($str); return addslashes($str);
} }
} }
// https://stackoverflow.com/questions/14673551/encrypt-decrypt-with-xor-in-php // https://stackoverflow.com/questions/14673551/encrypt-decrypt-with-xor-in-php
if(check_valid_function("xor_this")) { if(!check_function_exists("xor_this")) {
function xor_this($key, $string, $debug=false) { function xor_this($key, $string, $debug=false) {
$text = $string; $text = $string;
$outText = ""; $outText = "";
@ -574,7 +574,7 @@ if(check_valid_function("xor_this")) {
} }
// https://wiki.ubuntu.com/DevelopmentCodeNames // https://wiki.ubuntu.com/DevelopmentCodeNames
if(check_valid_function("get_generated_name")) { if(!check_function_exists("get_generated_name")) {
function get_generated_name() { function get_generated_name() {
$config = get_config(); $config = get_config();
@ -592,7 +592,7 @@ if(check_valid_function("get_generated_name")) {
} }
} }
if(check_valid_function("check_redirect_origin")) { if(!check_function_exists("check_redirect_origin")) {
function check_redirect_origin($url) { function check_redirect_origin($url) {
$flag = false; $flag = false;

View File

@ -6,7 +6,7 @@
* @brief Stroage module for ReasonableFramework * @brief Stroage module for ReasonableFramework
*/ */
if(check_valid_function("get_current_working_dir")) { if(!check_function_exists("get_current_working_dir")) {
function get_current_working_dir($method="getcwd") { function get_current_working_dir($method="getcwd") {
$working_dir = ""; $working_dir = "";
@ -41,13 +41,13 @@ if(check_valid_function("get_current_working_dir")) {
} }
} }
if(check_valid_function("get_storage_dir")) { if(!check_function_exists("get_storage_dir")) {
function get_storage_dir() { function get_storage_dir() {
return "storage"; return "storage";
} }
} }
if(check_valid_function("get_storage_path")) { if(!check_function_exists("get_storage_path")) {
function get_storage_path($type="data") { function get_storage_path($type="data") {
$dir_path = sprintf("./%s/%s", get_storage_dir(), $type); $dir_path = sprintf("./%s/%s", get_storage_dir(), $type);
@ -61,13 +61,13 @@ if(check_valid_function("get_storage_path")) {
} }
} }
if(check_valid_function("get_storage_url")) { if(!check_function_exists("get_storage_url")) {
function get_storage_url($type="data") { function get_storage_url($type="data") {
return sprintf("%s%s/%s", base_url(), get_storage_dir(), $type); return sprintf("%s%s/%s", base_url(), get_storage_dir(), $type);
} }
} }
if(check_valid_function("move_uploaded_file_to_storage")) { if(!check_function_exists("move_uploaded_file_to_storage")) {
function move_uploaded_file_to_stroage($options=array()) { function move_uploaded_file_to_stroage($options=array()) {
$response = array( $response = array(
"files" => array() "files" => array()
@ -131,7 +131,7 @@ if(check_valid_function("move_uploaded_file_to_storage")) {
} }
} }
if(check_valid_function("read_storage_file")) { if(!check_function_exists("read_storage_file")) {
function read_storage_file($filename, $options=array()) { function read_storage_file($filename, $options=array()) {
$result = false; $result = false;
@ -173,7 +173,7 @@ if(check_valid_function("read_storage_file")) {
} }
} }
if(check_valid_function("iterate_storage_files")) { if(!check_function_exists("iterate_storage_files")) {
function iterate_storage_files($storage_type, $options=array()) { function iterate_storage_files($storage_type, $options=array()) {
$filenames = array(); $filenames = array();
@ -193,7 +193,7 @@ if(check_valid_function("iterate_storage_files")) {
} }
} }
if(check_valid_function("remove_storage_file")) { if(!check_function_exists("remove_storage_file")) {
function remove_storage_file($filename, $options=array()) { function remove_storage_file($filename, $options=array()) {
$result = false; $result = false;
@ -235,7 +235,7 @@ if(check_valid_function("remove_storage_file")) {
} }
} }
if(check_valid_function("write_storage_file")) { if(!check_function_exists("write_storage_file")) {
function write_storage_file($data, $options=array()) { function write_storage_file($data, $options=array()) {
$result = false; $result = false;
@ -288,13 +288,13 @@ if(check_valid_function("write_storage_file")) {
} }
} }
if(check_valid_function("get_real_path")) { if(!check_function_exists("get_real_path")) {
function get_real_path($file) { function get_real_path($file) {
return file_exists($file) ? realpath($file) : false; return file_exists($file) ? realpath($file) : false;
} }
} }
if(check_valid_function("retrieve_storage_files")) { if(!check_function_exists("retrieve_storage_files")) {
function retrieve_storage_files($type, $recursive=false, $excludes=array(".", ".."), $files=array()) { function retrieve_storage_files($type, $recursive=false, $excludes=array(".", ".."), $files=array()) {
$storage_path = get_storage_path($type); $storage_path = get_storage_path($type);
@ -318,7 +318,7 @@ if(check_valid_function("retrieve_storage_files")) {
} }
} }
if(check_valid_function("get_file_extension")) { if(!check_function_exists("get_file_extension")) {
function get_file_extension($file, $options=array()) { function get_file_extension($file, $options=array()) {
$result = false; $result = false;
@ -335,13 +335,13 @@ if(check_valid_function("get_file_extension")) {
} }
} }
if(check_valid_function("check_file_extension")) { if(!check_function_exists("check_file_extension")) {
function check_file_extension($file, $extension, $options=array()) { function check_file_extension($file, $extension, $options=array()) {
return (get_file_extension($file, $options) === $extension); return (get_file_extension($file, $options) === $extension);
} }
} }
if(check_valid_function("get_file_name")) { if(!check_function_exists("get_file_name")) {
function get_file_name($name, $extension="", $basepath="") { function get_file_name($name, $extension="", $basepath="") {
$result = ""; $result = "";

View File

@ -6,19 +6,19 @@
* @brief URI module * @brief URI module
*/ */
if(check_valid_function("base_url")) { if(!check_function_exists("base_url")) {
function base_url() { function base_url() {
return get_config_value("base_url"); return get_config_value("base_url");
} }
} }
if(check_valid_function("base_api_url")) { if(!check_function_exists("base_api_url")) {
function base_api_url() { function base_api_url() {
return get_config_value("base_api_url"); return get_config_value("base_api_url");
} }
} }
if(check_valid_function("get_uri")) { if(!check_function_exists("get_uri")) {
function get_uri() { function get_uri() {
$requests = get_requests(); $requests = get_requests();
@ -31,7 +31,7 @@ if(check_valid_function("get_uri")) {
} }
} }
if(check_valid_function("read_route")) { if(!check_function_exists("read_route")) {
function read_route($route=false) { function read_route($route=false) {
$route = false; $route = false;
@ -57,7 +57,7 @@ if(check_valid_function("read_route")) {
} }
} }
if(check_valid_function("read_route_all")) { if(!check_function_exists("read_route_all")) {
function read_route_all() { function read_route_all() {
$routes = false; $routes = false;
@ -76,7 +76,7 @@ if(check_valid_function("read_route_all")) {
} }
} }
if(check_valid_function("read_requests")) { if(!check_function_exists("read_requests")) {
function read_requests($options=array()) { function read_requests($options=array()) {
// process http encryption // process http encryption
$config = get_config(); $config = get_config();
@ -124,7 +124,7 @@ if(check_valid_function("read_requests")) {
// with security module // with security module
$protect_methods = array("_ALL", "_GET", "_POST", "_JSON", "_SEAL"); $protect_methods = array("_ALL", "_GET", "_POST", "_JSON", "_SEAL");
if(check_valid_function("get_clean_xss")) { if(!check_function_exists("get_clean_xss")) {
foreach($protect_methods as $method) { foreach($protect_methods as $method) {
foreach($requests[$method] as $k=>$v) { foreach($requests[$method] as $k=>$v) {
$requests[$method][$k] = is_string($v) ? get_clean_xss($v) : $v; $requests[$method][$k] = is_string($v) ? get_clean_xss($v) : $v;
@ -151,7 +151,7 @@ if(check_valid_function("read_requests")) {
} }
} }
if(check_valid_function("get_requests")) { if(!check_function_exists("get_requests")) {
function get_requests() { function get_requests() {
$requests = get_scope("requests"); $requests = get_scope("requests");
@ -163,7 +163,7 @@ if(check_valid_function("get_requests")) {
} }
} }
if(check_valid_function("get_final_link")) { if(!check_function_exists("get_final_link")) {
function get_final_link($url, $data=array(), $entity=true) { function get_final_link($url, $data=array(), $entity=true) {
$link = ""; $link = "";
$url = urldecode($url); $url = urldecode($url);
@ -201,7 +201,7 @@ if(check_valid_function("get_final_link")) {
} }
} }
if(check_valid_function("get_route_link")) { if(!check_function_exists("get_route_link")) {
function get_route_link($route, $data=array(), $entity=true, $base_url="") { function get_route_link($route, $data=array(), $entity=true, $base_url="") {
$_data = array( $_data = array(
"route" => $route "route" => $route
@ -220,7 +220,7 @@ if(check_valid_function("get_route_link")) {
// URI: Uniform Resource Identifier // URI: Uniform Resource Identifier
// URL: Uniform Resource Locator // URL: Uniform Resource Locator
if(check_valid_function("redirect_uri")) { if(!check_function_exists("redirect_uri")) {
function redirect_uri($uri, $permanent=false, $options=array()) { function redirect_uri($uri, $permanent=false, $options=array()) {
if(array_key_equals("check_origin", $options, true)) { if(array_key_equals("check_origin", $options, true)) {
if(!check_redirect_origin($uri)) { if(!check_redirect_origin($uri)) {
@ -234,19 +234,19 @@ if(check_valid_function("redirect_uri")) {
} }
} }
if(check_valid_function("redirect_with_params")) { if(!check_function_exists("redirect_with_params")) {
function redirect_with_params($uri, $data=array(), $permanent=false, $entity=false) { function redirect_with_params($uri, $data=array(), $permanent=false, $entity=false) {
redirect_uri(get_final_link($uri, $data, $entity), $permanent); redirect_uri(get_final_link($uri, $data, $entity), $permanent);
} }
} }
if(check_valid_function("redirect_route")) { if(!check_function_exists("redirect_route")) {
function redirect_route($route, $data=array()) { function redirect_route($route, $data=array()) {
redirect_uri(get_route_link($route, $data, false)); redirect_uri(get_route_link($route, $data, false));
} }
} }
if(check_valid_function("get_requested_value")) { if(!check_function_exists("get_requested_value")) {
function get_requested_value($name, $method="_ALL", $escape_quotes=true, $escape_tags=false) { function get_requested_value($name, $method="_ALL", $escape_quotes=true, $escape_tags=false) {
$value = false; $value = false;
$requests = get_requests(); $requests = get_requests();
@ -276,7 +276,7 @@ if(check_valid_function("get_requested_value")) {
} }
} }
if(check_valid_function("get_requested_values")) { if(!check_function_exists("get_requested_values")) {
function get_requested_values($names, $method="_ALL", $escape_quotes=true, $escape_tags=false) { function get_requested_values($names, $method="_ALL", $escape_quotes=true, $escape_tags=false) {
$values = array(); $values = array();
@ -290,14 +290,14 @@ if(check_valid_function("get_requested_values")) {
} }
} }
if(check_valid_function("empty_requested_value")) { if(!check_function_exists("empty_requested_value")) {
function empty_requested_value($name, $method="_ALL") { function empty_requested_value($name, $method="_ALL") {
$value = get_requested_value($name, $method); $value = get_requested_value($name, $method);
return empty($value); return empty($value);
} }
} }
if(check_valid_function("get_binded_requests")) { if(!check_function_exists("get_binded_requests")) {
function get_binded_requests($rules, $method="_ALL") { function get_binded_requests($rules, $method="_ALL") {
$data = array(); $data = array();
@ -311,19 +311,19 @@ if(check_valid_function("get_binded_requests")) {
} }
} }
if(check_valid_function("get_array")) { if(!check_function_exists("get_array")) {
function get_array($arr) { function get_array($arr) {
return is_array($arr) ? $arr : array(); return is_array($arr) ? $arr : array();
} }
} }
if(check_valid_function("check_is_string_not_array")) { if(!check_function_exists("check_is_string_not_array")) {
function check_is_string_not_array($str) { function check_is_string_not_array($str) {
return (is_string($str) && !(is_array($str) || $str == "Array")); return (is_string($str) && !(is_array($str) || $str == "Array"));
} }
} }
if(check_valid_function("set_header_content_type")) { if(!check_function_exists("set_header_content_type")) {
function set_header_content_type($type) { function set_header_content_type($type) {
$type = strtolower($type); $type = strtolower($type);
$rules = array( $rules = array(
@ -342,7 +342,7 @@ if(check_valid_function("set_header_content_type")) {
} }
} }
if(check_valid_function("get_requested_json_value")) { if(!check_function_exists("get_requested_json_value")) {
function get_requested_json_value($name, $escape_quotes=true, $escape_tags=false) { function get_requested_json_value($name, $escape_quotes=true, $escape_tags=false) {
return get_requested_value($name, "_JSON", $escape_quotes, $escape_tags); return get_requested_value($name, "_JSON", $escape_quotes, $escape_tags);
} }

View File

@ -1091,7 +1091,7 @@ if (!defined('ISEMAIL_VALID')) {
// Check DNS? // Check DNS?
$dns_checked = false; $dns_checked = false;
if ($checkDNS && ((int) max($return_status) < ISEMAIL_DNSWARN) && check_valid_function('dns_get_record')) { if ($checkDNS && ((int) max($return_status) < ISEMAIL_DNSWARN) && !check_function_exists('dns_get_record')) {
// https://tools.ietf.org/html/rfc5321#section-2.3.5 // https://tools.ietf.org/html/rfc5321#section-2.3.5
// Names that can // Names that can
// be resolved to MX RRs or address (i.e., A or AAAA) RRs (as discussed // be resolved to MX RRs or address (i.e., A or AAAA) RRs (as discussed