","",str_replace(""; $write = fopen($path . $file, 'w') or die("can't open file"); fwrite($write, $data); fclose($write); } ////////////////////////////////////////////////////////////////// // Format JSEND Response ////////////////////////////////////////////////////////////////// function formatJSEND($status,$data=false){ /// Debug ///////////////////////////////////////////////// global $debugMessageStack; $debug = ""; if(count($debugMessageStack) > 0) { $debug .= ',"debug":'; $debug .= json_encode($debugMessageStack); } // Success /////////////////////////////////////////////// if($status=="success"){ if($data){ $jsend = '{"status":"success","data":'.json_encode($data).$debug.'}'; }else{ $jsend = '{"status":"success","data":null'.$debug.'}'; } // Error ///////////////////////////////////////////////// }else{ $jsend = '{"status":"error","message":"'.$data.'"'.$debug.'}'; } // Return //////////////////////////////////////////////// return $jsend; } ////////////////////////////////////////////////////////////////// // Check Function Availability ////////////////////////////////////////////////////////////////// function checkAccess() { return !file_exists(BASE_PATH . "/data/" . $_SESSION['user'] . '_acl.php'); } ////////////////////////////////////////////////////////////////// // Check Function Availability ////////////////////////////////////////////////////////////////// function isAvailable($func) { if (ini_get('safe_mode')) return false; $disabled = ini_get('disable_functions'); if ($disabled) { $disabled = explode(',', $disabled); $disabled = array_map('trim', $disabled); return !in_array($func, $disabled); } return true; } ?>