fix check_function_exists
This commit is contained in:
parent
6f9a01dd01
commit
b98663a291
|
@ -6,7 +6,7 @@
|
|||
* @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()) {
|
||||
$result = false;
|
||||
$db_driver = get_db_driver();
|
||||
|
@ -14,7 +14,7 @@ if(check_valid_function("exec_db_alt_callback")) {
|
|||
foreach($rules as $rule) {
|
||||
if($rule['driver'] == $db_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) {
|
||||
$result = call_user_func_array($rule['callback'], $params);
|
||||
} 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) {
|
||||
$conn = false;
|
||||
$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="") {
|
||||
$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()) {
|
||||
$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) {
|
||||
$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) {
|
||||
$last_id = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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() {
|
||||
$conn = false;
|
||||
$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) {
|
||||
$result = false;
|
||||
$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) {
|
||||
$rows = array();
|
||||
$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() {
|
||||
$dbc = get_scope("dbc");
|
||||
return mysqli_close($dbc);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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() {
|
||||
$conn = false;
|
||||
$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) {
|
||||
$result = false;
|
||||
$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) {
|
||||
$rows = array();
|
||||
$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() {
|
||||
$dbc = get_scope("dbc");
|
||||
return mysql_close($dbc);
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* @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) {
|
||||
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) {
|
||||
$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()) {
|
||||
$conn = NULL;
|
||||
$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!");
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
$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) {
|
||||
$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() {
|
||||
$dbc = get_scope("dbc");
|
||||
return oci_close($dbc);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* in the webserver configuration. The function execTests returns an array, which
|
||||
* contains names of all successful tested PHP functions.
|
||||
*/
|
||||
if(check_valid_function("exec_test")) {
|
||||
if(!check_function_exists("exec_test")) {
|
||||
function exec_test() {
|
||||
$cmd = "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
|
||||
*/
|
||||
if(check_valid_function("exec_command")) {
|
||||
if(!check_function_exists("exec_command")) {
|
||||
function exec_command($command, $method="shell_exec", $options=array()) {
|
||||
$return = false;
|
||||
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
*/
|
||||
|
||||
// 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) {
|
||||
return ($version > 4) ? "g5_" : "g4_";
|
||||
}
|
||||
}
|
||||
|
||||
// get table
|
||||
if(check_valid_function("gnb_get_db_table")) {
|
||||
if(!check_function_exists("gnb_get_db_table")) {
|
||||
function gnb_get_db_table($tablename) {
|
||||
return (gnb_get_db_prefix() . $tablename);
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$write_prefix = gnb_get_db_prefix() . "write_";
|
||||
$write_table = $write_prefix . $tablename;
|
||||
|
@ -30,7 +30,7 @@ if(check_valid_function("gnb_get_write_table")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$row = exec_db_fetch("select min(wr_num) as min_wr_num from " . gnb_get_write_table($tablename));
|
||||
return (intval(get_value_in_array("min_wr_num", $row, 0)) - 1);
|
||||
|
@ -38,7 +38,7 @@ if(check_valid_function("gnb_get_write_next")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$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()) {
|
||||
$sql = "select * from " . gnb_get_write_table($table_name) . " order by wr_id desc" . get_page_range($page, $limit);
|
||||
return exec_db_fetch_all($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(check_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) {
|
||||
$sql = "select * from " . gnb_get_write_table($table_name) . " where wr_id = :wr_id";
|
||||
return exec_db_fetch($sql, array(
|
||||
|
@ -128,7 +128,7 @@ if(check_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()) {
|
||||
$flag = false;
|
||||
$excludes = array("wr_id");
|
||||
|
@ -144,7 +144,7 @@ if(check_valid_function("gnb_set_post_parameters")) {
|
|||
}
|
||||
|
||||
// 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") {
|
||||
$result = array();
|
||||
|
||||
|
@ -160,7 +160,7 @@ if(check_valid_function("gnb_get_member")) {
|
|||
}
|
||||
|
||||
// get password
|
||||
if(check_valid_function("gnb_get_password")) {
|
||||
if(!check_function_exists("gnb_get_password")) {
|
||||
function gnb_get_password($password) {
|
||||
$bind = array(
|
||||
"password" => $password,
|
||||
|
@ -171,7 +171,7 @@ if(check_valid_function("gnb_get_password")) {
|
|||
}
|
||||
|
||||
// get config
|
||||
if(check_valid_function("gnb_get_config")) {
|
||||
if(!check_function_exists("gnb_get_config")) {
|
||||
function gnb_get_config($tablename="config") {
|
||||
$result = array();
|
||||
|
||||
|
@ -183,7 +183,7 @@ if(check_valid_function("gnb_get_config")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$result = false;
|
||||
$mb = gnb_get_member($user_name);
|
||||
|
@ -201,7 +201,7 @@ if(check_valid_function("gnb_process_safe_login")) {
|
|||
}
|
||||
|
||||
// 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") {
|
||||
$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="|") {
|
||||
foreach($data as $k=>$v) {
|
||||
$data[$k] = str_replace($delimiter, " ", $v);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$connection_id = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief HybridAuth library RSF Linker
|
||||
***/
|
||||
|
||||
if(check_valid_function("hybridauth_load")) {
|
||||
if(!check_function_exists("hybridauth_load")) {
|
||||
function hybridauth_load($provider="") {
|
||||
$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() {
|
||||
$flag = false;
|
||||
$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() {
|
||||
Hybrid_Endpoint::process();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief IsEmail library linker
|
||||
*/
|
||||
|
||||
if(check_valid_function("is_email")) {
|
||||
if(!check_function_exists("is_email")) {
|
||||
$inc_file = "./vendor/isemail/is_email.php";
|
||||
if(file_exists($inc_file)) {
|
||||
include($inc_file);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief jCryption (alternative HTTPS on javascript) Helper
|
||||
*/
|
||||
|
||||
if(check_valid_function("jcryption_load")) {
|
||||
if(!check_function_exists("jcryption_load")) {
|
||||
function jcryption_load() {
|
||||
$required_files = array(
|
||||
"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() {
|
||||
return "JCryption::decrypt();";
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("jcryption_get_jscode")) {
|
||||
if(!check_function_exists("jcryption_get_jscode")) {
|
||||
function jcryption_get_jscode($selector) {
|
||||
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() {
|
||||
return "JCryption::decrypt();";
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Network tool helper
|
||||
*/
|
||||
|
||||
if(check_valid_function("get_network_event")) {
|
||||
if(!check_function_exists("get_network_event")) {
|
||||
function get_network_event() {
|
||||
$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() {
|
||||
$addr = '';
|
||||
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() {
|
||||
$addr = '';
|
||||
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'];
|
||||
} else if(isset($_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();
|
||||
$addr = gethostbyname($host);
|
||||
} 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() {
|
||||
$host = '';
|
||||
if(isset($_SERVER['HTTP_HOST'])) {
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
} else if(isset($_SERVER['SERVER_NAME'])) {
|
||||
$host = $_SERVER['SERVER_NAME'];
|
||||
} else if(check_valid_function('gethostname')) {
|
||||
} else if(!check_function_exists('gethostname')) {
|
||||
$host = gethostname();
|
||||
} else {
|
||||
$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() {
|
||||
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() {
|
||||
$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="") {
|
||||
$addr = false;
|
||||
$config = get_config();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief PHP Obfuscator for ReasonableFramework
|
||||
*/
|
||||
|
||||
if(check_valid_function("get_obfuscator")) {
|
||||
if(!check_function_exists("get_obfuscator")) {
|
||||
function get_obfuscator() {
|
||||
$obfuscator = rand(1, 15);
|
||||
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) {
|
||||
$result = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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) {
|
||||
$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) {
|
||||
$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() {
|
||||
loadHelper("networktool");
|
||||
$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
|
||||
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='') {
|
||||
$pagination = '';
|
||||
if($total_pages > 0 && $total_pages != 1 && $current_page <= $total_pages) { //verify total pages and current page number
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
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() {
|
||||
$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) {
|
||||
$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() {
|
||||
$inc_file = get_current_working_dir() . "/vendor/pgkcp/res/pp_cli_hub_lib.php";
|
||||
if(file_exists($inc_file)) {
|
||||
|
|
|
@ -1206,7 +1206,7 @@ class simple_html_dom
|
|||
|
||||
$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();
|
||||
$success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
|
||||
|
@ -1248,7 +1248,7 @@ class simple_html_dom
|
|||
{
|
||||
// Use this in case mb_detect_charset isn't installed/loaded on this machine.
|
||||
$charset = false;
|
||||
if (check_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.
|
||||
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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()) {
|
||||
$response = false;
|
||||
$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) {
|
||||
$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) {
|
||||
$result = false;
|
||||
$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") {
|
||||
$result = false;
|
||||
$response = false;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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) {
|
||||
$rows = array();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
// 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) {
|
||||
$output = preg_replace("/[^0-9]/", "", $tel); // 숫자 이외 제거
|
||||
$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) {
|
||||
$result = false;
|
||||
|
||||
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);
|
||||
} else {
|
||||
$from_charset = "ISO-8859-1";
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("iconv")) {
|
||||
if(!check_function_exists("iconv")) {
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ if(check_valid_function("get_converted_string")) {
|
|||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("nl2p")) {
|
||||
if(!check_function_exists("nl2p")) {
|
||||
function nl2p($string) {
|
||||
$paragraphs = '';
|
||||
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) {
|
||||
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("br2p")) {
|
||||
if(!check_function_exists("br2p")) {
|
||||
function br2p($string) {
|
||||
return nl2p(br2nl($string));
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("get_formatted_number")) {
|
||||
if(!check_function_exists("get_formatted_number")) {
|
||||
function get_formatted_number($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") {
|
||||
$result = "";
|
||||
|
||||
if(check_valid_function("iconv_substr")) {
|
||||
if(!check_function_exists("iconv_substr")) {
|
||||
$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);
|
||||
} else {
|
||||
$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) {
|
||||
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()) {
|
||||
return explode_by_line(read_storage_file($filename, $options));
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$length = strlen($needle);
|
||||
return (substr($haystack, 0, $length) === $needle);
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("endsWith")) {
|
||||
if(!check_function_exists("endsWith")) {
|
||||
function endsWith($haystack, $needle) {
|
||||
$length = strlen($needle);
|
||||
if($length == 0) {
|
||||
|
@ -124,7 +124,7 @@ if(check_valid_function("endsWith")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$ready = str_replace($delimiters, $delimiters[0], $string);
|
||||
$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()) {
|
||||
$result = array();
|
||||
$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) {
|
||||
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) {
|
||||
return preg_replace(sprintf("/%s/i", $pattern), $replacement, $subject);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief TableWiz helper
|
||||
*/
|
||||
|
||||
if(check_valid_function("tablewiz_cut_str")) {
|
||||
if(!check_function_exists("tablewiz_cut_str")) {
|
||||
function tablewiz_cut_str($str, $strlimit=0) {
|
||||
$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()) {
|
||||
$html = "";
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
/* 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) {
|
||||
// parameters: server, socket, error code, error text, timeout
|
||||
$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") {
|
||||
$timestamp = false;
|
||||
$timercvd = query_time_server($timeserver, 37);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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) {
|
||||
$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) {
|
||||
global $config;
|
||||
|
||||
|
@ -132,7 +132,7 @@ if(check_valid_function("vworld_geocode_keyword")) {
|
|||
}
|
||||
|
||||
// get geocode from vworld
|
||||
if(check_valid_function("vworld_geocode_addr2coord")) {
|
||||
if(!check_function_exists("vworld_geocode_addr2coord")) {
|
||||
function vworld_geocode_addr2coord($addr) {
|
||||
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) {
|
||||
$geopoint = array(
|
||||
"address" => "",
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
/* // PRINT CONTENT: echo $response['content']; */
|
||||
/****** END EXAMPLES *****/
|
||||
|
||||
if(check_valid_function("get_web_fgc")) {
|
||||
if(!check_function_exists("get_web_fgc")) {
|
||||
function get_web_fgc($url) {
|
||||
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) {
|
||||
$qs = "";
|
||||
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()) {
|
||||
$output = "";
|
||||
|
||||
|
@ -107,7 +107,7 @@ if(check_valid_function("get_web_cmd")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$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) {
|
||||
$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()) {
|
||||
$content = false;
|
||||
$req_headers = array();
|
||||
|
@ -251,7 +251,7 @@ if(check_valid_function("get_web_curl")) {
|
|||
if($method == "post") {
|
||||
foreach($data as $k=>$v) {
|
||||
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));
|
||||
} else {
|
||||
$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) {
|
||||
$status = 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()) {
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$result = false;
|
||||
$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) {
|
||||
$result = false;
|
||||
$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) {
|
||||
$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()) {
|
||||
$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()) {
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -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()) {
|
||||
$result = false;
|
||||
|
||||
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;
|
||||
|
@ -519,7 +519,7 @@ if(check_valid_function("get_parsed_dom")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$result = "";
|
||||
$lines = array();
|
||||
|
@ -537,7 +537,7 @@ if(check_valid_function("get_adaptive_json")) {
|
|||
}
|
||||
|
||||
// 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") {
|
||||
return get_route_link($route, array(
|
||||
"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="") {
|
||||
if(empty($ua)) {
|
||||
$ua = "ReasonableFramework/1.2 (https://github.com/gnh1201/reasonableframework)";
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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) {
|
||||
$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) {
|
||||
$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="") {
|
||||
$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="") {
|
||||
$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()) {
|
||||
$default_data = array(
|
||||
"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) {
|
||||
$response = get_web_json(get_web_build_qs($wp_server_url, array(
|
||||
"rest_route" => "/wp/v2/categories"
|
||||
|
|
|
@ -7,21 +7,21 @@
|
|||
*/
|
||||
|
||||
// get database prefix
|
||||
if(check_valid_function("zb4_get_db_prefix")) {
|
||||
if(!check_function_exists("zb4_get_db_prefix")) {
|
||||
function zb4_get_db_prefix() {
|
||||
return "zetyx_";
|
||||
}
|
||||
}
|
||||
|
||||
// get table
|
||||
if(check_valid_function("zb4_get_db_table")) {
|
||||
if(!check_function_exists("zb4_get_db_table")) {
|
||||
function zb4_get_db_table($tablename) {
|
||||
return (zb4_get_db_prefix() . $tablename);
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$write_prefix = zb4_get_db_prefix() . "board_";
|
||||
$write_table = $write_prefix . $tablename;
|
||||
|
@ -30,7 +30,7 @@ if(check_valid_function("zb4_get_write_table")) {
|
|||
}
|
||||
|
||||
// write post
|
||||
if(check_valid_function("zb4_write_post")) {
|
||||
if(!check_function_exists("zb4_write_post")) {
|
||||
function zb4_write_post($tablename, $data=array()) {
|
||||
$result = 0;
|
||||
$write_table = zb4_get_write_table($tablename);
|
||||
|
@ -105,14 +105,14 @@ if(check_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()) {
|
||||
$sql = "select * from " . zb4_get_write_table($table_name) . " order by no desc" . get_page_range($page, $limit);
|
||||
return exec_db_fetch_all($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if(check_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) {
|
||||
$sql = "select * from " . zb4_get_write_table($table_name) . " where no = :no";
|
||||
return exec_db_fetch($sql, array(
|
||||
|
|
|
@ -36,7 +36,7 @@ if(check_function_exists("check_function_exists") == -1) {
|
|||
}
|
||||
|
||||
// set scope
|
||||
if(check_valid_function("set_scope")) {
|
||||
if(!check_function_exists("set_scope")) {
|
||||
function set_scope($k, $v) {
|
||||
global $scope;
|
||||
$scope[$k] = $v;
|
||||
|
@ -44,7 +44,7 @@ if(check_valid_function("set_scope")) {
|
|||
}
|
||||
|
||||
// get scope
|
||||
if(check_valid_function("get_scope")) {
|
||||
if(!check_function_exists("get_scope")) {
|
||||
function get_scope($k) {
|
||||
global $scope;
|
||||
return array_key_exists($k, $scope) ? $scope[$k] : null;
|
||||
|
@ -52,7 +52,7 @@ if(check_valid_function("get_scope")) {
|
|||
}
|
||||
|
||||
// register loaded resources
|
||||
if(check_valid_function("register_loaded")) {
|
||||
if(!check_function_exists("register_loaded")) {
|
||||
function register_loaded($k, $v) {
|
||||
$loaded = get_scope("loaded");
|
||||
if(array_key_exists($k, $loaded)) {
|
||||
|
@ -65,7 +65,7 @@ if(check_valid_function("register_loaded")) {
|
|||
}
|
||||
|
||||
// sandbox for include function
|
||||
if(check_valid_function("include_isolate")) {
|
||||
if(!check_function_exists("include_isolate")) {
|
||||
function include_isolate($file, $data=array()) {
|
||||
if(count($data) > 0) {
|
||||
extract($data);
|
||||
|
@ -75,14 +75,14 @@ if(check_valid_function("include_isolate")) {
|
|||
}
|
||||
|
||||
// set autoloader
|
||||
if(check_valid_function("set_autoloader")) {
|
||||
if(!check_function_exists("set_autoloader")) {
|
||||
function set_autoloader() {
|
||||
return include('./vendor/autoload.php');
|
||||
}
|
||||
}
|
||||
|
||||
// load view file
|
||||
if(check_valid_function("renderView")) {
|
||||
if(!check_function_exists("renderView")) {
|
||||
function renderView($name, $data=array()) {
|
||||
$flag = true;
|
||||
$views = explode(';', $name);
|
||||
|
@ -98,7 +98,7 @@ if(check_valid_function("renderView")) {
|
|||
}
|
||||
|
||||
// load view by rules
|
||||
if(check_valid_function("renderViewByRules")) {
|
||||
if(!check_function_exists("renderViewByRules")) {
|
||||
function renderViewByRules($rules, $data=array()) {
|
||||
foreach($rules as $k=>$v) {
|
||||
if(in_array($k, get_routes())) {
|
||||
|
@ -109,7 +109,7 @@ if(check_valid_function("renderViewByRules")) {
|
|||
}
|
||||
|
||||
// load system module
|
||||
if(check_valid_function("loadModule")) {
|
||||
if(!check_function_exists("loadModule")) {
|
||||
function loadModule($name) {
|
||||
$flag = true;
|
||||
$modules = explode(';', $name);
|
||||
|
@ -127,7 +127,7 @@ if(check_valid_function("loadModule")) {
|
|||
}
|
||||
|
||||
// load helper file
|
||||
if(check_valid_function("loadHelper")) {
|
||||
if(!check_function_exists("loadHelper")) {
|
||||
function loadHelper($name) {
|
||||
$flag = true;
|
||||
$helpers = explode(';', $name);
|
||||
|
@ -145,7 +145,7 @@ if(check_valid_function("loadHelper")) {
|
|||
}
|
||||
|
||||
// load route file
|
||||
if(check_valid_function("loadRoute")) {
|
||||
if(!check_function_exists("loadRoute")) {
|
||||
function loadRoute($name, $data=array()) {
|
||||
$flag = true;
|
||||
$routes = explode(";", $name);
|
||||
|
@ -163,7 +163,7 @@ if(check_valid_function("loadRoute")) {
|
|||
}
|
||||
|
||||
// load vendor file
|
||||
if(check_valid_function("loadVendor")) {
|
||||
if(!check_function_exists("loadVendor")) {
|
||||
function loadVendor($uses, $data=array()) {
|
||||
$flag = true;
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$flag = false;
|
||||
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) {
|
||||
$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="") {
|
||||
$output = $obj->$name;
|
||||
return $output;
|
||||
|
@ -265,14 +265,14 @@ if(check_valid_function("get_value_in_object")) {
|
|||
}
|
||||
|
||||
// error handler
|
||||
if(check_valid_function("set_error")) {
|
||||
if(!check_function_exists("set_error")) {
|
||||
function set_error($msg, $code="ERROR") {
|
||||
global $scope;
|
||||
$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
|
||||
global $scope;
|
||||
$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) {
|
||||
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") {
|
||||
set_error($msg, $code);
|
||||
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) {
|
||||
$result = false;
|
||||
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() {
|
||||
$loaded = get_scope("loaded");
|
||||
return $loaded['route'];
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Configuration module
|
||||
*/
|
||||
|
||||
if(check_valid_function("read_config")) {
|
||||
if(!check_function_exists("read_config")) {
|
||||
function read_config() {
|
||||
$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() {
|
||||
$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) {
|
||||
$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() {
|
||||
$datetime = false;
|
||||
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
* @brief Database module
|
||||
*/
|
||||
|
||||
if(check_valid_function("get_db_driver")) {
|
||||
if(!check_function_exists("get_db_driver")) {
|
||||
function get_db_driver() {
|
||||
$config = get_config();
|
||||
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) {
|
||||
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) {
|
||||
$conn = false;
|
||||
$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()) {
|
||||
$stmt = get_db_stmt($sql, $bind);
|
||||
$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) {
|
||||
$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) {
|
||||
foreach($bind as $k=>$v) {
|
||||
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) {
|
||||
$d = explode(" ", $sql);
|
||||
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) {
|
||||
$sql = !$bind_pdo ? get_db_binded_sql($sql, $bind) : $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() {
|
||||
$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()) {
|
||||
$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()) {
|
||||
$rows = array();
|
||||
$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) {
|
||||
$fetched = NULL;
|
||||
$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) {
|
||||
$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) {
|
||||
$bind_keys = array_keys($bind);
|
||||
$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
|
||||
function get_bind_to_sql_where($bind, $excludes=array()) {
|
||||
$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
|
||||
function get_bind_to_sql_update_set($bind, $excludes=array()) {
|
||||
$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
|
||||
function get_bind_to_sql_select($tablename, $bind=array(), $options=array()) {
|
||||
$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()) {
|
||||
// process filters
|
||||
$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()) {
|
||||
$sql = "delete from %s where 1" . get_bind_to_sql_where($bind);
|
||||
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) {
|
||||
$sql_past_minutes = "";
|
||||
if($minutes > 0) {
|
||||
|
@ -439,7 +439,7 @@ if(check_valid_function("get_bind_to_sql_past_minutes")) {
|
|||
}
|
||||
|
||||
// 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()) {
|
||||
$result = false;
|
||||
$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
|
||||
if(check_valid_function("sql_query")) {
|
||||
if(!check_function_exists("sql_query")) {
|
||||
function sql_query($sql, $bind=array()) {
|
||||
return exec_db_query($sql, $bind);
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$dt = 0;
|
||||
|
||||
|
@ -478,7 +478,7 @@ if(check_valid_function("get_timediff_on_query")) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
$result = array();
|
||||
|
||||
|
@ -498,7 +498,7 @@ if(check_valid_function("json_decode_to_assoc")) {
|
|||
}
|
||||
|
||||
// close db connection
|
||||
if(check_valid_function("close_db_connect")) {
|
||||
if(!check_function_exists("close_db_connect")) {
|
||||
function close_db_connect() {
|
||||
$dbc = get_scope("dbc");
|
||||
$dbc->close();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @brief Logger module for ReasonableFramework
|
||||
*/
|
||||
|
||||
if(check_valid_function("write_visit_log")) {
|
||||
if(!check_function_exists("write_visit_log")) {
|
||||
function write_visit_log() {
|
||||
$fw = false;
|
||||
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) {
|
||||
$msg = "\r\n" . $msg;
|
||||
return write_storage_file($msg, array(
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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) {
|
||||
$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) {
|
||||
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
$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) {
|
||||
if(PHP_VERSION < '5.3.0') {
|
||||
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) {
|
||||
$session_value = "";
|
||||
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() {
|
||||
$_token = make_random_id(10);
|
||||
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() {
|
||||
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") {
|
||||
$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) {
|
||||
$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) {
|
||||
$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) {
|
||||
$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") {
|
||||
$requests = get_requests();
|
||||
$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()) {
|
||||
$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) {
|
||||
$flag = false;
|
||||
if(check_valid_function("hash_algos")) {
|
||||
if(!check_function_exists("hash_algos")) {
|
||||
$flag = in_array($algo, hash_algos());
|
||||
}
|
||||
return $flag;
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("get_salt")) {
|
||||
if(!check_function_exists("get_salt")) {
|
||||
function get_salt() {
|
||||
$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") {
|
||||
$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") {
|
||||
$flag = false;
|
||||
$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) {
|
||||
$path = str_replace('/', '_', $path);
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("session_logout")) {
|
||||
if(!check_function_exists("session_logout")) {
|
||||
function session_logout() {
|
||||
$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() {
|
||||
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() {
|
||||
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) {
|
||||
$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() {
|
||||
$user_profile = array(
|
||||
"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="") {
|
||||
$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
|
||||
if(check_valid_function("get_clean_xss")) {
|
||||
if(!check_function_exists("get_clean_xss")) {
|
||||
function get_clean_xss($data, $notags=0) {
|
||||
if(is_string($data)) {
|
||||
// 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) {
|
||||
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) {
|
||||
return is_string($data) ? get_clean_newlines(get_clean_xss($data, 1)) : $data;
|
||||
}
|
||||
}
|
||||
|
||||
// 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") {
|
||||
$callback = get_clean_xss($callback);
|
||||
$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") {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -494,7 +494,7 @@ if(check_valid_function("encapsulate_text")) {
|
|||
$init_key = empty($key) ? $config['masterkey'] : $key;
|
||||
$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);
|
||||
} else {
|
||||
$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") {
|
||||
$config = get_config();
|
||||
|
||||
|
@ -525,7 +525,7 @@ if(check_valid_function("decapsulate_text")) {
|
|||
$init_key = empty($key) ? $config['masterkey'] : $key;
|
||||
$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);
|
||||
} else {
|
||||
$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) {
|
||||
return addslashes($str);
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$text = $string;
|
||||
$outText = "";
|
||||
|
@ -574,7 +574,7 @@ if(check_valid_function("xor_this")) {
|
|||
}
|
||||
|
||||
// https://wiki.ubuntu.com/DevelopmentCodeNames
|
||||
if(check_valid_function("get_generated_name")) {
|
||||
if(!check_function_exists("get_generated_name")) {
|
||||
function get_generated_name() {
|
||||
$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) {
|
||||
$flag = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @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") {
|
||||
$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() {
|
||||
return "storage";
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("get_storage_path")) {
|
||||
if(!check_function_exists("get_storage_path")) {
|
||||
function get_storage_path($type="data") {
|
||||
$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") {
|
||||
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()) {
|
||||
$response = 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()) {
|
||||
$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()) {
|
||||
$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()) {
|
||||
$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()) {
|
||||
$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) {
|
||||
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()) {
|
||||
$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()) {
|
||||
$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()) {
|
||||
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="") {
|
||||
$result = "";
|
||||
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
* @brief URI module
|
||||
*/
|
||||
|
||||
if(check_valid_function("base_url")) {
|
||||
if(!check_function_exists("base_url")) {
|
||||
function 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() {
|
||||
return get_config_value("base_api_url");
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("get_uri")) {
|
||||
if(!check_function_exists("get_uri")) {
|
||||
function get_uri() {
|
||||
$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) {
|
||||
$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() {
|
||||
$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()) {
|
||||
// process http encryption
|
||||
$config = get_config();
|
||||
|
@ -124,7 +124,7 @@ if(check_valid_function("read_requests")) {
|
|||
|
||||
// with security module
|
||||
$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($requests[$method] as $k=>$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() {
|
||||
$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) {
|
||||
$link = "";
|
||||
$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="") {
|
||||
$_data = array(
|
||||
"route" => $route
|
||||
|
@ -220,7 +220,7 @@ if(check_valid_function("get_route_link")) {
|
|||
|
||||
// URI: Uniform Resource Identifier
|
||||
// URL: Uniform Resource Locator
|
||||
if(check_valid_function("redirect_uri")) {
|
||||
if(!check_function_exists("redirect_uri")) {
|
||||
function redirect_uri($uri, $permanent=false, $options=array()) {
|
||||
if(array_key_equals("check_origin", $options, true)) {
|
||||
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) {
|
||||
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()) {
|
||||
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) {
|
||||
$value = false;
|
||||
$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) {
|
||||
$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") {
|
||||
$value = get_requested_value($name, $method);
|
||||
return empty($value);
|
||||
}
|
||||
}
|
||||
|
||||
if(check_valid_function("get_binded_requests")) {
|
||||
if(!check_function_exists("get_binded_requests")) {
|
||||
function get_binded_requests($rules, $method="_ALL") {
|
||||
$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) {
|
||||
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) {
|
||||
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) {
|
||||
$type = strtolower($type);
|
||||
$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) {
|
||||
return get_requested_value($name, "_JSON", $escape_quotes, $escape_tags);
|
||||
}
|
||||
|
|
2
vendor/isemail/is_email.php
vendored
2
vendor/isemail/is_email.php
vendored
|
@ -1091,7 +1091,7 @@ if (!defined('ISEMAIL_VALID')) {
|
|||
// Check DNS?
|
||||
$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
|
||||
// Names that can
|
||||
// be resolved to MX RRs or address (i.e., A or AAAA) RRs (as discussed
|
||||
|
|
Loading…
Reference in New Issue
Block a user