-
Notifications
You must be signed in to change notification settings - Fork 8
/
get_setting_data.php
48 lines (44 loc) · 1.37 KB
/
get_setting_data.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
<?php
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
//include "chech_restricted.php";
$isGetSetting = true;
if(!isset($isSetDBclass)){
require 'settings/database.class.php';
}
function getSetting($settingGroup, $settingName){
if($settingGroup == "" && $settingName == ""){
return "";
}
$db_setting = new Database("formbuilder");
$conn = $db_setting->getConnection();
$isSettingNameOnly = true;
if($settingGroup != "" && $settingName ==""){
$sql = "SELECT * FROM settings WHERE setting_group='$settingGroup'";
$isSettingNameOnly = false;
}else if($settingGroup == "" && $settingName !=""){
$sql = "SELECT * FROM settings WHERE setting_name='$settingName'";
}else{
$sql = "SELECT * FROM settings WHERE setting_group='$settingGroup' AND setting_name='$settingName'";
}
$params_row = array();
if($result = $conn->query($sql)) {
$count = mysqli_num_rows($result);
if($count > 0){
while($row = mysqli_fetch_assoc($result)){
$params_row[$row['setting_name']] = $row['setting_value'] ;
}
}
}
if(!empty($params_row)){
if($isSettingNameOnly){
return $params_row[$settingName];
}else{
return $params_row;
}
}else{
return "";
}
}
?>