-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.php
executable file
·89 lines (79 loc) · 2.13 KB
/
functions.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
function getSetting($req) {
$db = $GLOBALS["db"];
$query = mysqli_query($db,"SELECT * FROM `Setting`");
$result = mysqli_fetch_assoc($query);
return $result[$req];
}
function getState($n,$req) {
global $db;
$gUser = mysqli_query($db,"SELECT * FROM `States` WHERE `name`='$n' OR `english`='$n' OR `n`='$n'");
$User = mysqli_fetch_assoc($gUser);
return $User[$req];
}
function ValidState($n) {
$db = $GLOBALS["db"];
$query = mysqli_query($db,"SELECT * FROM `States` WHERE `name`='$n' OR `english`='$n'");
if (mysqli_num_rows($query) == 1) {
return true;
}
else {
return false;
}
}
function getHeader() {
return include 'header.php';
}
function getMenu() {
return include 'menu.php';
}
function getFooter() {
return include 'footer.php';
}
function getButtons() {
return include 'buttons.php';
}
function setTitle($ext,$menu_title = 0) {
$title = getSetting('title');
$titler = "$title | $ext";
if ($menu_title) {
$Wreturn = "
<script>
$(document).prop('title','$titler');
$('#menu-title').text('$ext');
</script>";
}
else {
$Wreturn = "
<script>
$(document).prop('title','$titler');
</script>";
}
return $Wreturn;
}
function formatted_number($n) {
$n = (0+str_replace(",","",$n));
if(!is_numeric($n)) return false;
if ($n>1000000000000) {
$return = round(($n/1000000000000),1).' تریلیون';
$return = str_replace(".",",",$return);
return $return;
}
else if ($n>1000000000) {
$return = round(($n/1000000000),1).' بیلیون';
$return = str_replace(".",",",$return);
return $return;
}
else if ($n>1000000) {
$return = round(($n/1000000),1).' میلیون';
$return = str_replace(".",",",$return);
return $return;
}
else if ($n>1000) {
$return = round(($n/1000),1).' هزار';
$return = str_replace(".",",",$return);
return $return;
}
return number_format($n);
}
$crr_hex = "#2196f3|#263238";