-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
64 lines (62 loc) · 1.64 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
ob_start();
ini_set('date.timezone','Asia/Manila');
date_default_timezone_set('Asia/Manila');
session_start();
require_once('initialize.php');
require_once('classes/DBConnection.php');
require_once('classes/SystemSettings.php');
$db = new DBConnection;
$conn = $db->conn;
function redirect($url=''){
if(!empty($url))
echo '<script>location.href="'.base_url .$url.'"</script>';
}
function validate_image($file){
if(!empty($file)){
// exit;
$ex = explode("?",$file);
$file = $ex[0];
$ts = isset($ex[1]) ? "?".$ex[1] : '';
if(is_file(base_app.$file)){
return base_url.$file.$ts;
}else{
return base_url.'dist/img/no-image-available.png';
}
}else{
return base_url.'dist/img/no-image-available.png';
}
}
function format_num($number = '' , $decimal = ''){
if(is_numeric($number)){
$ex = explode(".",$number);
$decLen = isset($ex[1]) ? strlen($ex[1]) : 0;
if(is_numeric($decimal)){
return number_format($number,$decimal);
}else{
return number_format($number,$decLen);
}
}else{
return "Invalid Input";
}
}
function isMobileDevice(){
$aMobileUA = array(
'/iphone/i' => 'iPhone',
'/ipod/i' => 'iPod',
'/ipad/i' => 'iPad',
'/android/i' => 'Android',
'/blackberry/i' => 'BlackBerry',
'/webos/i' => 'Mobile'
);
//Return true if Mobile User Agent is detected
foreach($aMobileUA as $sMobileKey => $sMobileOS){
if(preg_match($sMobileKey, $_SERVER['HTTP_USER_AGENT'])){
return true;
}
}
//Otherwise return false..
return false;
}
ob_end_flush();
?>