|
|
@ -1359,10 +1359,7 @@ class Database { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT $clean_columns FROM $table_name $conditions"; |
|
|
|
$sql = "SELECT $clean_columns FROM $table_name $conditions"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = self::query($sql); |
|
|
|
$result = self::query($sql); |
|
|
|
$array = array(); |
|
|
|
$array = array(); |
|
|
@ -1391,11 +1388,14 @@ class Database { |
|
|
|
if (empty($conditions)) { |
|
|
|
if (empty($conditions)) { |
|
|
|
return ''; |
|
|
|
return ''; |
|
|
|
} |
|
|
|
} |
|
|
|
$return_value = ''; |
|
|
|
$return_value = ''; |
|
|
|
foreach ($conditions as $type_condition => $condition_data) { |
|
|
|
foreach ($conditions as $type_condition => $condition_data) { |
|
|
|
|
|
|
|
if ($condition_data == false) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
$type_condition = strtolower($type_condition); |
|
|
|
$type_condition = strtolower($type_condition); |
|
|
|
switch($type_condition) { |
|
|
|
switch($type_condition) { |
|
|
|
case 'where': |
|
|
|
case 'where': |
|
|
|
foreach ($condition_data as $condition => $value_array) { |
|
|
|
foreach ($condition_data as $condition => $value_array) { |
|
|
|
if (is_array($value_array)) { |
|
|
|
if (is_array($value_array)) { |
|
|
|
$clean_values = array(); |
|
|
|
$clean_values = array(); |
|
|
@ -1418,12 +1418,11 @@ class Database { |
|
|
|
if (!empty($where_return)) { |
|
|
|
if (!empty($where_return)) { |
|
|
|
$return_value = " WHERE $where_return" ; |
|
|
|
$return_value = " WHERE $where_return" ; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'order': |
|
|
|
case 'order': |
|
|
|
$order_array = explode(' ', $condition_data); |
|
|
|
$order_array = explode(' ', $condition_data); |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($order_array)) { |
|
|
|
if (!empty($order_array)) { |
|
|
|
if (count($order_array) > 1) { |
|
|
|
if (count($order_array) > 1 && !empty($order_array[0])) { |
|
|
|
$order_array[0] = self::escape_string($order_array[0]); |
|
|
|
$order_array[0] = self::escape_string($order_array[0]); |
|
|
|
if (!empty($order_array[1])) { |
|
|
|
if (!empty($order_array[1])) { |
|
|
|
$order_array[1] = strtolower($order_array[1]); |
|
|
|
$order_array[1] = strtolower($order_array[1]); |
|
|
@ -1434,11 +1433,10 @@ class Database { |
|
|
|
} |
|
|
|
} |
|
|
|
$return_value .= ' ORDER BY '.$order_array[0].' '.$order; |
|
|
|
$return_value .= ' ORDER BY '.$order_array[0].' '.$order; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$return_value .= ' ORDER BY '.$order_array[0].' DESC '; |
|
|
|
$return_value .= ' ORDER BY '.$order_array[0].' DESC '; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'limit': |
|
|
|
case 'limit': |
|
|
|
$limit_array = explode(',', $condition_data); |
|
|
|
$limit_array = explode(',', $condition_data); |
|
|
|
if (!empty($limit_array)) { |
|
|
|
if (!empty($limit_array)) { |
|
|
@ -1448,8 +1446,7 @@ class Database { |
|
|
|
$return_value .= ' LIMIT '.intval($limit_array[0]); |
|
|
|
$return_value .= ' LIMIT '.intval($limit_array[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $return_value; |
|
|
|
return $return_value; |
|
|
|