Fix coding style part 2

This commit is contained in:
Job Snijders
2015-07-15 11:04:22 +02:00
parent ad9590df9b
commit d8693f05ae
733 changed files with 37338 additions and 33926 deletions
+55 -66
View File
@@ -14,86 +14,75 @@
enable_debug();
include_once("../includes/defaults.inc.php");
include_once("../config.php");
include_once("../includes/definitions.inc.php");
include_once("includes/functions.inc.php");
include_once("../includes/functions.php");
include_once("includes/authenticate.inc.php");
require_once '../includes/defaults.inc.php';
require_once '../config.php';
require_once '../includes/definitions.inc.php';
require_once 'includes/functions.inc.php';
require_once '../includes/functions.php';
require_once 'includes/authenticate.inc.php';
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if (!$_SESSION['authenticated']) {
echo 'unauthenticated';
exit;
}
$new_conf_type = $_POST['new_conf_type'];
$new_conf_name = $_POST['new_conf_name'];
$new_conf_desc = $_POST['new_conf_desc'];
if(empty($new_conf_name))
{
echo("You haven't specified a config name");
exit;
if (empty($new_conf_name)) {
echo "You haven't specified a config name";
exit;
}
elseif(empty($new_conf_desc))
{
echo("You haven't specified a config description");
exit;
else if (empty($new_conf_desc)) {
echo "You haven't specified a config description";
exit;
}
elseif(empty($_POST['new_conf_single_value']) && empty($_POST['new_conf_multi_value']))
{
echo("You haven't specified a config value");
exit;
else if (empty($_POST['new_conf_single_value']) && empty($_POST['new_conf_multi_value'])) {
echo "You haven't specified a config value";
exit;
}
$db_inserted = '0';
if($new_conf_type == 'Single')
{
$new_conf_type = 'single';
$new_conf_value = $_POST['new_conf_single_value'];
$db_inserted = add_config_item($new_conf_name,$new_conf_value,$new_conf_type,$new_conf_desc);
if ($new_conf_type == 'Single') {
$new_conf_type = 'single';
$new_conf_value = $_POST['new_conf_single_value'];
$db_inserted = add_config_item($new_conf_name, $new_conf_value, $new_conf_type, $new_conf_desc);
}
elseif($new_conf_type == 'Single Array')
{
$new_conf_type = 'single-array';
$new_conf_value = $_POST['new_conf_single_value'];
$db_inserted = add_config_item($new_conf_name,$new_conf_value,$new_conf_type,$new_conf_desc);
}
elseif($new_conf_type == 'Standard Array' || $new_conf_type == 'Multi Array')
{
if($new_conf_type == 'Standard Array')
{
$new_conf_type = 'array';
}
elseif($new_conf_type == 'Multi Array')
{
$new_conf_type = 'multi-array';
}
else
{
# $new_conf_type is invalid so clear values so we don't create any config
$new_conf_value = '';
}
$new_conf_value = nl2br($_POST['new_conf_multi_value']);
$values = explode('<br />',$new_conf_value);
foreach ($values as $item)
{
$new_conf_value = trim($item);
$db_inserted = add_config_item($new_conf_name,$new_conf_value,$new_conf_type,$new_conf_desc);
}
}
else
{
echo('Bad config type!');
$db_inserted = 0;
exit;
else if ($new_conf_type == 'Single Array') {
$new_conf_type = 'single-array';
$new_conf_value = $_POST['new_conf_single_value'];
$db_inserted = add_config_item($new_conf_name, $new_conf_value, $new_conf_type, $new_conf_desc);
}
else if ($new_conf_type == 'Standard Array' || $new_conf_type == 'Multi Array') {
if ($new_conf_type == 'Standard Array') {
$new_conf_type = 'array';
}
else if ($new_conf_type == 'Multi Array') {
$new_conf_type = 'multi-array';
}
else {
// $new_conf_type is invalid so clear values so we don't create any config
$new_conf_value = '';
}
if($db_inserted == 1)
{
echo('Your new config item has been added');
}
else
{
echo('An error occurred adding your config item to the database');
$new_conf_value = nl2br($_POST['new_conf_multi_value']);
$values = explode('<br />', $new_conf_value);
foreach ($values as $item) {
$new_conf_value = trim($item);
$db_inserted = add_config_item($new_conf_name, $new_conf_value, $new_conf_type, $new_conf_desc);
}
}
else {
echo 'Bad config type!';
$db_inserted = 0;
exit;
}//end if
?>
if ($db_inserted == 1) {
echo 'Your new config item has been added';
}
else {
echo 'An error occurred adding your config item to the database';
}