Completed
Pull Request — master (#532)
06:37
created
app/install/select_install_type.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		<ol style="margin-top:20px;">
18 18
 		<!-- automatic -->
19 19
 		<li>
20
-			<a href="<?php print create_link("install","install_automatic",null,null,null,true); ?>" class="btn btn-sm btn-default">Automatic database installation</a>
20
+			<a href="<?php print create_link ("install", "install_automatic", null, null, null, true); ?>" class="btn btn-sm btn-default">Automatic database installation</a>
21 21
 			<br>
22 22
 			<div class="text-muted">phpipam installer will create database for you automatically.</div>
23 23
 			<br>
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		
26 26
 		<!-- Mysql inport -->
27 27
 		<li>
28
-			<a href="<?php print create_link("install","install_mysqlimport",null,null,null,true); ?>" class="btn btn-sm btn-default">MySQL import instructions</a>	
28
+			<a href="<?php print create_link ("install", "install_mysqlimport", null, null, null, true); ?>" class="btn btn-sm btn-default">MySQL import instructions</a>	
29 29
 			<br>
30 30
 			<div class="text-muted">Install DB files with mysqlimport tool.</div>
31 31
 			<br>		
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		
34 34
 		<!-- Manual install -->
35 35
 		<li>
36
-			<a href="<?php print create_link("install","install_manual",null,null,null,true); ?>" class="btn btn-sm btn-default">Manual database installation</a>	
36
+			<a href="<?php print create_link ("install", "install_manual", null, null, null, true); ?>" class="btn btn-sm btn-default">Manual database installation</a>	
37 37
 			<br>
38 38
 			<div class="text-muted">Install database manually with SQL queries.</div>
39 39
 			<br>		
Please login to merge, or discard this patch.
app/install/install-execute.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 # if already installed ignore!
20 20
 if($Install->check_table ("widgets", false) && @$_POST['dropdb']!="on") {
21
-	# check for possible errors
22
-	if(sizeof($errors = $Tools->verify_database())>0) 						{ }
23
-	else 																	{ $Result->show("danger", _("Database already installed"), true);}
21
+    # check for possible errors
22
+    if(sizeof($errors = $Tools->verify_database())>0) 						{ }
23
+    else 																	{ $Result->show("danger", _("Database already installed"), true);}
24 24
 }
25 25
 
26 26
 # get possible advanced options
@@ -30,6 +30,6 @@  discard block
 block discarded – undo
30 30
 
31 31
 # try to install new database */
32 32
 if($Install->install_database ($_POST['mysqlrootuser'], $_POST['mysqlrootpass'], $dropdb, $createdb, $creategrants)) {
33
- 	$Result->show("success alert-block", 'Database installed successfully! <a href="?page=install&section=install_automatic&subnetId=configure" class="btn btn-sm btn-default">Continue</a>', true);
33
+        $Result->show("success alert-block", 'Database installed successfully! <a href="?page=install&section=install_automatic&subnetId=configure" class="btn btn-sm btn-default">Continue</a>', true);
34 34
 }
35 35
 ?>
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,31 +5,31 @@
 block discarded – undo
5 5
  **************************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$Install 	= new Install ($Database);
11
+$Database = new Database_PDO;
12
+$Install = new Install ($Database);
13 13
 $Tools	 	= new Tools ($Database);
14 14
 $Result 	= new Result ();
15 15
 
16 16
 # make sure it is properly requested
17
-if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest")						{ $Result->show("danger", _("Invalid request"), true); }
17
+if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { $Result->show ("danger", _ ("Invalid request"), true); }
18 18
 
19 19
 # if already installed ignore!
20
-if($Install->check_table ("widgets", false) && @$_POST['dropdb']!="on") {
20
+if ($Install->check_table ("widgets", false) && @$_POST['dropdb'] != "on") {
21 21
 	# check for possible errors
22
-	if(sizeof($errors = $Tools->verify_database())>0) 						{ }
23
-	else 																	{ $Result->show("danger", _("Database already installed"), true);}
22
+	if (sizeof ($errors = $Tools->verify_database ()) > 0) { }
23
+	else { $Result->show ("danger", _ ("Database already installed"), true); }
24 24
 }
25 25
 
26 26
 # get possible advanced options
27
-$dropdb 		= @$_POST['dropdb']=="on" ? true : false;
28
-$createdb 		= @$_POST['createdb']=="on" ? true : false;
29
-$creategrants 	= @$_POST['creategrants']=="on" ? true : false;
27
+$dropdb = @$_POST['dropdb'] == "on" ? true : false;
28
+$createdb = @$_POST['createdb'] == "on" ? true : false;
29
+$creategrants = @$_POST['creategrants'] == "on" ? true : false;
30 30
 
31 31
 # try to install new database */
32
-if($Install->install_database ($_POST['mysqlrootuser'], $_POST['mysqlrootpass'], $dropdb, $createdb, $creategrants)) {
33
- 	$Result->show("success alert-block", 'Database installed successfully! <a href="?page=install&section=install_automatic&subnetId=configure" class="btn btn-sm btn-default">Continue</a>', true);
32
+if ($Install->install_database ($_POST['mysqlrootuser'], $_POST['mysqlrootpass'], $dropdb, $createdb, $creategrants)) {
33
+ 	$Result->show ("success alert-block", 'Database installed successfully! <a href="?page=install&section=install_automatic&subnetId=configure" class="btn btn-sm btn-default">Continue</a>', true);
34 34
 }
35 35
 ?>
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/nameservers/index.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -22,69 +22,69 @@
 block discarded – undo
22 22
 # first check if they exist!
23 23
 if($all_nameservers===false) { $Result->show("danger", _("No nameserver sets defined")."!", true);}
24 24
 else {
25
-	print '<table id="nameserverManagement" class="table sorted table-striped table-top table-hover table-td-top">'. "\n";
25
+    print '<table id="nameserverManagement" class="table sorted table-striped table-top table-hover table-td-top">'. "\n";
26 26
 
27
-	# headers
28
-	print "<thead>";
29
-	print '<tr>'. "\n";
30
-	print '	<th>'._('Nameserver set').'</th>'. "\n";
31
-	print '	<th>'._('Nameservers').'</th>'. "\n";
32
-	print '	<th>'._('Sections').'</th>'. "\n";
33
-	print '	<th>'._('Description').'</th>'. "\n";
34
-	print '	<th></th>'. "\n";
35
-	print '</tr>'. "\n";
36
-	print "</thead>";
27
+    # headers
28
+    print "<thead>";
29
+    print '<tr>'. "\n";
30
+    print '	<th>'._('Nameserver set').'</th>'. "\n";
31
+    print '	<th>'._('Nameservers').'</th>'. "\n";
32
+    print '	<th>'._('Sections').'</th>'. "\n";
33
+    print '	<th>'._('Description').'</th>'. "\n";
34
+    print '	<th></th>'. "\n";
35
+    print '</tr>'. "\n";
36
+    print "</thead>";
37 37
 
38 38
     print "<tbody>";
39
-	# loop
40
-	foreach ($all_nameservers as $nameservers) {
41
-		//cast
42
-		$nameservers = (array) $nameservers;
39
+    # loop
40
+    foreach ($all_nameservers as $nameservers) {
41
+        //cast
42
+        $nameservers = (array) $nameservers;
43 43
 
44
-		unset($permitted_sections);
45
-		$permitted_sections = array();
44
+        unset($permitted_sections);
45
+        $permitted_sections = array();
46 46
 
47
-		// sections
48
-		if (!is_null($nameservers['permissions'])) {
49
-			$sections = array_filter(explode(";", $nameservers['permissions']));
50
-			// some
51
-			if (sizeof($sections)>0) {
52
-				foreach($sections as $id) {
53
-					$sect = $Admin->fetch_object ("sections", "id", $id);
54
-					// exists
55
-					if ($sect!==false) {
56
-						$permitted_sections[] = "<span class='badge badge1 badge5'>".$sect->name."</span>";
57
-					}
58
-				}
59
-			}
60
-			else {
61
-				$permitted_sections[] = "/";
62
-			}
63
-		}
64
-		// none
65
-		else {
66
-			$permitted_sections[] = "/";
67
-		}
47
+        // sections
48
+        if (!is_null($nameservers['permissions'])) {
49
+            $sections = array_filter(explode(";", $nameservers['permissions']));
50
+            // some
51
+            if (sizeof($sections)>0) {
52
+                foreach($sections as $id) {
53
+                    $sect = $Admin->fetch_object ("sections", "id", $id);
54
+                    // exists
55
+                    if ($sect!==false) {
56
+                        $permitted_sections[] = "<span class='badge badge1 badge5'>".$sect->name."</span>";
57
+                    }
58
+                }
59
+            }
60
+            else {
61
+                $permitted_sections[] = "/";
62
+            }
63
+        }
64
+        // none
65
+        else {
66
+            $permitted_sections[] = "/";
67
+        }
68 68
 
69
-		// merge all nmeservers
70
-		$all_nameservers = explode(";", $nameservers['namesrv1']);
69
+        // merge all nmeservers
70
+        $all_nameservers = explode(";", $nameservers['namesrv1']);
71 71
 
72
-		//print details
73
-		print '<tr>'. "\n";
74
-		print '	<td class="name"><strong>'. $nameservers['name'] .'</strong></td>'. "\n";
75
-		print '	<td class="namesrv1">'. implode("<br>", $all_nameservers) .'</td>'. "\n";
76
-		print '	<td class="sections">'. implode("<br>", $permitted_sections).'</td>'. "\n";
77
-		print '	<td class="description">'. $nameservers['description'] .'</td>'. "\n";
78
-		print "	<td class='actions'>";
79
-		print "	<div class='btn-group'>";
80
-		print "		<button class='btn btn-xs btn-default nameserverManagement' data-action='edit'   data-nameserverid='$nameservers[id]'><i class='fa fa-pencil'></i></button>";
81
-		print "		<button class='btn btn-xs btn-default nameserverManagement' data-action='delete' data-nameserverid='$nameservers[id]'><i class='fa fa-times'></i></button>";
82
-		print "	</div>";
83
-		print "	</td>";
84
-		print '</tr>'. "\n";
85
-	}
86
-	print "</tbody>";
87
-	print '</table>'. "\n";
72
+        //print details
73
+        print '<tr>'. "\n";
74
+        print '	<td class="name"><strong>'. $nameservers['name'] .'</strong></td>'. "\n";
75
+        print '	<td class="namesrv1">'. implode("<br>", $all_nameservers) .'</td>'. "\n";
76
+        print '	<td class="sections">'. implode("<br>", $permitted_sections).'</td>'. "\n";
77
+        print '	<td class="description">'. $nameservers['description'] .'</td>'. "\n";
78
+        print "	<td class='actions'>";
79
+        print "	<div class='btn-group'>";
80
+        print "		<button class='btn btn-xs btn-default nameserverManagement' data-action='edit'   data-nameserverid='$nameservers[id]'><i class='fa fa-pencil'></i></button>";
81
+        print "		<button class='btn btn-xs btn-default nameserverManagement' data-action='delete' data-nameserverid='$nameservers[id]'><i class='fa fa-times'></i></button>";
82
+        print "	</div>";
83
+        print "	</td>";
84
+        print '</tr>'. "\n";
85
+    }
86
+    print "</tbody>";
87
+    print '</table>'. "\n";
88 88
 }
89 89
 ?>
90 90
 
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,34 +5,34 @@  discard block
 block discarded – undo
5 5
  ************************************************/
6 6
 
7 7
 # verify that user is logged in
8
-$User->check_user_session();
8
+$User->check_user_session ();
9 9
 
10 10
 # fetch all vrfs
11
-$all_nameservers = $Admin->fetch_all_objects("nameservers", "id");
11
+$all_nameservers = $Admin->fetch_all_objects ("nameservers", "id");
12 12
 ?>
13 13
 
14
-<h4><?php print _('Manage Nameserver sets'); ?></h4>
14
+<h4><?php print _ ('Manage Nameserver sets'); ?></h4>
15 15
 <hr><br>
16 16
 
17
-<button class='btn btn-sm btn-default nameserverManagement' data-action='add' data-nameserverid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _('Add nameserver set'); ?></button>
17
+<button class='btn btn-sm btn-default nameserverManagement' data-action='add' data-nameserverid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _ ('Add nameserver set'); ?></button>
18 18
 
19 19
 <!-- nameserver sets -->
20 20
 <?php
21 21
 
22 22
 # first check if they exist!
23
-if($all_nameservers===false) { $Result->show("danger", _("No nameserver sets defined")."!", true);}
23
+if ($all_nameservers === false) { $Result->show ("danger", _ ("No nameserver sets defined")."!", true); }
24 24
 else {
25
-	print '<table id="nameserverManagement" class="table sorted table-striped table-top table-hover table-td-top">'. "\n";
25
+	print '<table id="nameserverManagement" class="table sorted table-striped table-top table-hover table-td-top">'."\n";
26 26
 
27 27
 	# headers
28 28
 	print "<thead>";
29
-	print '<tr>'. "\n";
30
-	print '	<th>'._('Nameserver set').'</th>'. "\n";
31
-	print '	<th>'._('Nameservers').'</th>'. "\n";
32
-	print '	<th>'._('Sections').'</th>'. "\n";
33
-	print '	<th>'._('Description').'</th>'. "\n";
34
-	print '	<th></th>'. "\n";
35
-	print '</tr>'. "\n";
29
+	print '<tr>'."\n";
30
+	print '	<th>'._ ('Nameserver set').'</th>'."\n";
31
+	print '	<th>'._ ('Nameservers').'</th>'."\n";
32
+	print '	<th>'._ ('Sections').'</th>'."\n";
33
+	print '	<th>'._ ('Description').'</th>'."\n";
34
+	print '	<th></th>'."\n";
35
+	print '</tr>'."\n";
36 36
 	print "</thead>";
37 37
 
38 38
     print "<tbody>";
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 		$nameservers = (array) $nameservers;
43 43
 
44 44
 		unset($permitted_sections);
45
-		$permitted_sections = array();
45
+		$permitted_sections = array ();
46 46
 
47 47
 		// sections
48
-		if (!is_null($nameservers['permissions'])) {
49
-			$sections = array_filter(explode(";", $nameservers['permissions']));
48
+		if (!is_null ($nameservers['permissions'])) {
49
+			$sections = array_filter (explode (";", $nameservers['permissions']));
50 50
 			// some
51
-			if (sizeof($sections)>0) {
52
-				foreach($sections as $id) {
51
+			if (sizeof ($sections) > 0) {
52
+				foreach ($sections as $id) {
53 53
 					$sect = $Admin->fetch_object ("sections", "id", $id);
54 54
 					// exists
55
-					if ($sect!==false) {
55
+					if ($sect !== false) {
56 56
 						$permitted_sections[] = "<span class='badge badge1 badge5'>".$sect->name."</span>";
57 57
 					}
58 58
 				}
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 
69 69
 		// merge all nmeservers
70
-		$all_nameservers = explode(";", $nameservers['namesrv1']);
70
+		$all_nameservers = explode (";", $nameservers['namesrv1']);
71 71
 
72 72
 		//print details
73
-		print '<tr>'. "\n";
74
-		print '	<td class="name"><strong>'. $nameservers['name'] .'</strong></td>'. "\n";
75
-		print '	<td class="namesrv1">'. implode("<br>", $all_nameservers) .'</td>'. "\n";
76
-		print '	<td class="sections">'. implode("<br>", $permitted_sections).'</td>'. "\n";
77
-		print '	<td class="description">'. $nameservers['description'] .'</td>'. "\n";
73
+		print '<tr>'."\n";
74
+		print '	<td class="name"><strong>'.$nameservers['name'].'</strong></td>'."\n";
75
+		print '	<td class="namesrv1">'.implode ("<br>", $all_nameservers).'</td>'."\n";
76
+		print '	<td class="sections">'.implode ("<br>", $permitted_sections).'</td>'."\n";
77
+		print '	<td class="description">'.$nameservers['description'].'</td>'."\n";
78 78
 		print "	<td class='actions'>";
79 79
 		print "	<div class='btn-group'>";
80 80
 		print "		<button class='btn btn-xs btn-default nameserverManagement' data-action='edit'   data-nameserverid='$nameservers[id]'><i class='fa fa-pencil'></i></button>";
81 81
 		print "		<button class='btn btn-xs btn-default nameserverManagement' data-action='delete' data-nameserverid='$nameservers[id]'><i class='fa fa-times'></i></button>";
82 82
 		print "	</div>";
83 83
 		print "	</td>";
84
-		print '</tr>'. "\n";
84
+		print '</tr>'."\n";
85 85
 	}
86 86
 	print "</tbody>";
87
-	print '</table>'. "\n";
87
+	print '</table>'."\n";
88 88
 }
89 89
 ?>
90 90
 
Please login to merge, or discard this patch.
app/admin/nameservers/edit-result.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,38 +25,38 @@
 block discarded – undo
25 25
 
26 26
 # Name and primary nameserver must be present!
27 27
 if ($_POST['action']!="delete") {
28
-	if($_POST['name'] == "") 				{ $Result->show("danger", _("Name is mandatory"), true); }
29
-	if(trim($_POST['namesrv-1']) == "") 	{ $Result->show("danger", _("Primary nameserver is mandatory"), true); }
28
+    if($_POST['name'] == "") 				{ $Result->show("danger", _("Name is mandatory"), true); }
29
+    if(trim($_POST['namesrv-1']) == "") 	{ $Result->show("danger", _("Primary nameserver is mandatory"), true); }
30 30
 }
31 31
 
32 32
 // merge nameservers
33 33
 foreach($_POST as $key=>$line) {
34
-	if (strlen(strstr($key,"namesrv-"))>0) {
35
-		if (strlen($line)>0) {
36
-			$all_nameservers[] = trim($line);
37
-		}
38
-	}
34
+    if (strlen(strstr($key,"namesrv-"))>0) {
35
+        if (strlen($line)>0) {
36
+            $all_nameservers[] = trim($line);
37
+        }
38
+    }
39 39
 }
40 40
 $_POST['namesrv1'] = isset($all_nameservers) ? implode(";", $all_nameservers) : "";
41 41
 
42 42
 // set sections
43 43
 foreach($_POST as $key=>$line) {
44
-	if (strlen(strstr($key,"section-"))>0) {
45
-		$key2 = str_replace("section-", "", $key);
46
-		$temp[] = $key2;
47
-		unset($_POST[$key]);
48
-	}
44
+    if (strlen(strstr($key,"section-"))>0) {
45
+        $key2 = str_replace("section-", "", $key);
46
+        $temp[] = $key2;
47
+        unset($_POST[$key]);
48
+    }
49 49
 }
50 50
 # glue sections together
51 51
 $_POST['permissions'] = sizeof($temp)>0 ? implode(";", $temp) : null;
52 52
 
53 53
 # set update array
54 54
 $values = array("id"=>@$_POST['nameserverId'],
55
-				"name"=>$_POST['name'],
56
-				"permissions"=>$_POST['permissions'],
57
-				"namesrv1"=>$_POST['namesrv1'],
58
-				"description"=>$_POST['description']
59
-				);
55
+                "name"=>$_POST['name'],
56
+                "permissions"=>$_POST['permissions'],
57
+                "namesrv1"=>$_POST['namesrv1'],
58
+                "description"=>$_POST['description']
59
+                );
60 60
 # update
61 61
 if(!$Admin->object_modify("nameservers", $_POST['action'], "id", $values))	{ $Result->show("danger",  _("Failed to $_POST[action] nameserver set").'!', true); }
62 62
 else																		{ $Result->show("success", _("Nameserver set $_POST[action] successfull").'!', false); }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@
 block discarded – undo
5 5
  ***************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 # strip input tags
20
-$_POST = $Admin->strip_input_tags($_POST);
20
+$_POST = $Admin->strip_input_tags ($_POST);
21 21
 
22 22
 # validate csrf cookie
23
-$User->csrf_cookie ("validate", "ns", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
23
+$User->csrf_cookie ("validate", "ns", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
24 24
 
25 25
 
26 26
 # Name and primary nameserver must be present!
27
-if ($_POST['action']!="delete") {
28
-	if($_POST['name'] == "") 				{ $Result->show("danger", _("Name is mandatory"), true); }
29
-	if(trim($_POST['namesrv-1']) == "") 	{ $Result->show("danger", _("Primary nameserver is mandatory"), true); }
27
+if ($_POST['action'] != "delete") {
28
+	if ($_POST['name'] == "") { $Result->show ("danger", _ ("Name is mandatory"), true); }
29
+	if (trim ($_POST['namesrv-1']) == "") { $Result->show ("danger", _ ("Primary nameserver is mandatory"), true); }
30 30
 }
31 31
 
32 32
 // merge nameservers
33
-foreach($_POST as $key=>$line) {
34
-	if (strlen(strstr($key,"namesrv-"))>0) {
35
-		if (strlen($line)>0) {
36
-			$all_nameservers[] = trim($line);
33
+foreach ($_POST as $key=>$line) {
34
+	if (strlen (strstr ($key, "namesrv-")) > 0) {
35
+		if (strlen ($line) > 0) {
36
+			$all_nameservers[] = trim ($line);
37 37
 		}
38 38
 	}
39 39
 }
40
-$_POST['namesrv1'] = isset($all_nameservers) ? implode(";", $all_nameservers) : "";
40
+$_POST['namesrv1'] = isset($all_nameservers) ? implode (";", $all_nameservers) : "";
41 41
 
42 42
 // set sections
43
-foreach($_POST as $key=>$line) {
44
-	if (strlen(strstr($key,"section-"))>0) {
45
-		$key2 = str_replace("section-", "", $key);
43
+foreach ($_POST as $key=>$line) {
44
+	if (strlen (strstr ($key, "section-")) > 0) {
45
+		$key2 = str_replace ("section-", "", $key);
46 46
 		$temp[] = $key2;
47 47
 		unset($_POST[$key]);
48 48
 	}
49 49
 }
50 50
 # glue sections together
51
-$_POST['permissions'] = sizeof($temp)>0 ? implode(";", $temp) : null;
51
+$_POST['permissions'] = sizeof ($temp) > 0 ? implode (";", $temp) : null;
52 52
 
53 53
 # set update array
54
-$values = array("id"=>@$_POST['nameserverId'],
54
+$values = array ("id"=>@$_POST['nameserverId'],
55 55
 				"name"=>$_POST['name'],
56 56
 				"permissions"=>$_POST['permissions'],
57 57
 				"namesrv1"=>$_POST['namesrv1'],
58 58
 				"description"=>$_POST['description']
59 59
 				);
60 60
 # update
61
-if(!$Admin->object_modify("nameservers", $_POST['action'], "id", $values))	{ $Result->show("danger",  _("Failed to $_POST[action] nameserver set").'!', true); }
62
-else																		{ $Result->show("success", _("Nameserver set $_POST[action] successfull").'!', false); }
61
+if (!$Admin->object_modify ("nameservers", $_POST['action'], "id", $values)) { $Result->show ("danger", _ ("Failed to $_POST[action] nameserver set").'!', true); }
62
+else { $Result->show ("success", _ ("Nameserver set $_POST[action] successfull").'!', false); }
63 63
 
64 64
 
65 65
 # remove all references if delete
66
-if($_POST['action']=="delete") { $Admin->remove_object_references ("nameservers", "id", $_POST['nameserverId']); }
66
+if ($_POST['action'] == "delete") { $Admin->remove_object_references ("nameservers", "id", $_POST['nameserverId']); }
67 67
 ?>
Please login to merge, or discard this patch.
app/admin/nameservers/edit.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 # get Nameserver sets
25 25
 if($_POST['action']!="add") {
26
-	$nameservers = $Admin->fetch_object ("nameservers", "id", $_POST['nameserverId']);
27
-	$nameservers!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
28
-	$nameservers = (array) $nameservers;
26
+    $nameservers = $Admin->fetch_object ("nameservers", "id", $_POST['nameserverId']);
27
+    $nameservers!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
28
+    $nameservers = (array) $nameservers;
29 29
 }
30 30
 
31 31
 # disable edit on delete
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 	<tbody id="nameservers">
60 60
 	<!-- Nameservers -->
61 61
 	<?php
62
-	//loop
63
-	$m=1;
64
-	foreach ($nameservers['namesrv1'] as $ns) {
65
-		print "<tr id='namesrv-$m'>";
66
-		print "	<td>"._("Nameserver")." $m</td>";
67
-		print "	<td>";
68
-		print "	<input type='text' class='rd form-control input-sm' name='namesrv-$m' value='$ns' $readonly>";
69
-		print "	</td>";
70
-		print "	<td><button class='btn btn-sm btn-default' id='remove_nameserver' data-id='namesrv-".$m."'><i class='fa fa-trash-o'></i></button></td>";
71
-		print "</tr>";
72
-		//next
73
-		$m++;
74
-	}
75
-	?>
62
+    //loop
63
+    $m=1;
64
+    foreach ($nameservers['namesrv1'] as $ns) {
65
+        print "<tr id='namesrv-$m'>";
66
+        print "	<td>"._("Nameserver")." $m</td>";
67
+        print "	<td>";
68
+        print "	<input type='text' class='rd form-control input-sm' name='namesrv-$m' value='$ns' $readonly>";
69
+        print "	</td>";
70
+        print "	<td><button class='btn btn-sm btn-default' id='remove_nameserver' data-id='namesrv-".$m."'><i class='fa fa-trash-o'></i></button></td>";
71
+        print "</tr>";
72
+        //next
73
+        $m++;
74
+    }
75
+    ?>
76 76
 	</tbody>
77 77
 
78 78
 	<tbody>
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 		<td><?php print _('Description'); ?></td>
91 91
 		<td>
92 92
 			<?php
93
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="nameserverId" value="'. $_POST['nameserverId'] .'">'. "\n";}
94
-			?>
93
+            if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="nameserverId" value="'. $_POST['nameserverId'] .'">'. "\n";}
94
+            ?>
95 95
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
96 96
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
97 97
 			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _('Description'); ?>" value="<?php print @$nameservers['description']; ?>" <?php print $readonly; ?>>
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 		<td style="vertical-align: top !important"><?php print _('Sections to display nameserver set in'); ?>:</td>
105 105
 		<td>
106 106
 		<?php
107
-		# select sections
108
-		$sections = $Sections->fetch_all_sections();
109
-		# reformat domains sections to array
110
-		$nameservers_sections = explode(";", @$nameservers['permissions']);
111
-		$nameservers_sections = is_array($nameservers_sections) ? $nameservers_sections : array();
112
-		// loop
113
-		if ($sections !== false) {
114
-			foreach($sections as $section) {
115
-				if(in_array($section->id, @$nameservers_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
116
-				else 												{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
117
-			}
118
-		}
119
-		?>
107
+        # select sections
108
+        $sections = $Sections->fetch_all_sections();
109
+        # reformat domains sections to array
110
+        $nameservers_sections = explode(";", @$nameservers['permissions']);
111
+        $nameservers_sections = is_array($nameservers_sections) ? $nameservers_sections : array();
112
+        // loop
113
+        if ($sections !== false) {
114
+            foreach($sections as $section) {
115
+                if(in_array($section->id, @$nameservers_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
116
+                else 												{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
117
+            }
118
+        }
119
+        ?>
120 120
 		</td>
121 121
 		<td></td>
122 122
 	</tr>
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	</form>
127 127
 
128 128
 	<?php
129
-	//print delete warning
130
-	if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing nameserver set will also remove all references from belonging subnets!"), false);}
131
-	?>
129
+    //print delete warning
130
+    if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing nameserver set will also remove all references from belonging subnets!"), false);}
131
+    ?>
132 132
 </div>
133 133
 
134 134
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,10 @@
 block discarded – undo
136 136
 <div class="pFooter">
137 137
 	<div class="btn-group">
138 138
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
139
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editNameservers"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
139
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
140
+else { print "btn-success"; } ?>" id="editNameservers"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
141
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
142
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
140 143
 	</div>
141 144
 	<!-- result -->
142 145
 	<div class="nameserverManagementEditResult"></div>
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,39 +5,39 @@  discard block
 block discarded – undo
5 5
  ************************************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Tools	 	= new Tools ($Database);
15
-$Sections	= new Sections ($Database);
15
+$Sections = new Sections ($Database);
16 16
 $Result 	= new Result ();
17 17
 
18 18
 # verify that user is logged in
19
-$User->check_user_session();
19
+$User->check_user_session ();
20 20
 
21 21
 # create csrf token
22 22
 $csrf = $User->csrf_cookie ("create", "ns");
23 23
 
24 24
 # get Nameserver sets
25
-if($_POST['action']!="add") {
25
+if ($_POST['action'] != "add") {
26 26
 	$nameservers = $Admin->fetch_object ("nameservers", "id", $_POST['nameserverId']);
27
-	$nameservers!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
27
+	$nameservers !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true);
28 28
 	$nameservers = (array) $nameservers;
29 29
 }
30 30
 
31 31
 # disable edit on delete
32
-$readonly = $_POST['action']=="delete" ? "readonly" : "";
32
+$readonly = $_POST['action'] == "delete" ? "readonly" : "";
33 33
 
34 34
 # set nameservers
35
-$nameservers['namesrv1'] = !isset($nameservers) ? array(" ") : explode(";", $nameservers['namesrv1']);
35
+$nameservers['namesrv1'] = !isset($nameservers) ? array (" ") : explode (";", $nameservers['namesrv1']);
36 36
 ?>
37 37
 
38 38
 
39 39
 <!-- header -->
40
-<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('Nameserver set'); ?></div>
40
+<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('Nameserver set'); ?></div>
41 41
 
42 42
 <!-- content -->
43 43
 <div class="pContent">
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	<tbody>
49 49
 	<!-- name  -->
50 50
 	<tr>
51
-		<td style="width: 200px;"><?php print _('Name'); ?></td>
51
+		<td style="width: 200px;"><?php print _ ('Name'); ?></td>
52 52
 		<td>
53
-			<input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _('Nameserver set'); ?>" value="<?php print @$nameservers['name']; ?>" <?php print $readonly; ?>>
53
+			<input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _ ('Nameserver set'); ?>" value="<?php print @$nameservers['name']; ?>" <?php print $readonly; ?>>
54 54
 		</td>
55 55
 		<td></td>
56 56
 	</tr>
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 	<!-- Nameservers -->
61 61
 	<?php
62 62
 	//loop
63
-	$m=1;
63
+	$m = 1;
64 64
 	foreach ($nameservers['namesrv1'] as $ns) {
65 65
 		print "<tr id='namesrv-$m'>";
66
-		print "	<td>"._("Nameserver")." $m</td>";
66
+		print "	<td>"._ ("Nameserver")." $m</td>";
67 67
 		print "	<td>";
68 68
 		print "	<input type='text' class='rd form-control input-sm' name='namesrv-$m' value='$ns' $readonly>";
69 69
 		print "	</td>";
@@ -80,40 +80,40 @@  discard block
 block discarded – undo
80 80
 	<tr>
81 81
 		<td></td>
82 82
 		<td>
83
-			<button class="btn btn-sm btn-default" id="add_nameserver" data-id='<?php print $m; ?>' <?php print $readonly; ?>><i class="fa fa-plus"></i> <?php print _('Add nameserver'); ?></button>
83
+			<button class="btn btn-sm btn-default" id="add_nameserver" data-id='<?php print $m; ?>' <?php print $readonly; ?>><i class="fa fa-plus"></i> <?php print _ ('Add nameserver'); ?></button>
84 84
 		</td>
85 85
 		<td></td>
86 86
 	</tr>
87 87
 
88 88
 	<!-- Description -->
89 89
 	<tr>
90
-		<td><?php print _('Description'); ?></td>
90
+		<td><?php print _ ('Description'); ?></td>
91 91
 		<td>
92 92
 			<?php
93
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="nameserverId" value="'. $_POST['nameserverId'] .'">'. "\n";}
93
+			if (($_POST['action'] == "edit") || ($_POST['action'] == "delete")) { print '<input type="hidden" name="nameserverId" value="'.$_POST['nameserverId'].'">'."\n"; }
94 94
 			?>
95 95
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
96 96
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
97
-			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _('Description'); ?>" value="<?php print @$nameservers['description']; ?>" <?php print $readonly; ?>>
97
+			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _ ('Description'); ?>" value="<?php print @$nameservers['description']; ?>" <?php print $readonly; ?>>
98 98
 		</td>
99 99
 		<td></td>
100 100
 	</tr>
101 101
 
102 102
 	<!-- sections -->
103 103
 	<tr>
104
-		<td style="vertical-align: top !important"><?php print _('Sections to display nameserver set in'); ?>:</td>
104
+		<td style="vertical-align: top !important"><?php print _ ('Sections to display nameserver set in'); ?>:</td>
105 105
 		<td>
106 106
 		<?php
107 107
 		# select sections
108
-		$sections = $Sections->fetch_all_sections();
108
+		$sections = $Sections->fetch_all_sections ();
109 109
 		# reformat domains sections to array
110
-		$nameservers_sections = explode(";", @$nameservers['permissions']);
111
-		$nameservers_sections = is_array($nameservers_sections) ? $nameservers_sections : array();
110
+		$nameservers_sections = explode (";", @$nameservers['permissions']);
111
+		$nameservers_sections = is_array ($nameservers_sections) ? $nameservers_sections : array ();
112 112
 		// loop
113 113
 		if ($sections !== false) {
114
-			foreach($sections as $section) {
115
-				if(in_array($section->id, @$nameservers_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
116
-				else 												{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
114
+			foreach ($sections as $section) {
115
+				if (in_array ($section->id, @$nameservers_sections)) { print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'.$section->id.'" value="on" checked> '.$section->name.'</div>'."\n"; }
116
+				else { print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'.$section->id.'" value="on">'.$section->name.'</span></div>'."\n"; }
117 117
 			}
118 118
 		}
119 119
 		?>
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 	<?php
129 129
 	//print delete warning
130
-	if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing nameserver set will also remove all references from belonging subnets!"), false);}
130
+	if ($_POST['action'] == "delete") { $Result->show ("warning", "<strong>"._ ('Warning').":</strong> "._ ("removing nameserver set will also remove all references from belonging subnets!"), false); }
131 131
 	?>
132 132
 </div>
133 133
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 <!-- footer -->
136 136
 <div class="pFooter">
137 137
 	<div class="btn-group">
138
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
139
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editNameservers"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
138
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
139
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editNameservers"><i class="fa <?php if ($_POST['action'] == "add") { print "fa-plus"; } else if ($_POST['action'] == "delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords (_ ($_POST['action'])); ?></button>
140 140
 	</div>
141 141
 	<!-- result -->
142 142
 	<div class="nameserverManagementEditResult"></div>
Please login to merge, or discard this patch.
app/admin/widgets/index.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -27,57 +27,57 @@
 block discarded – undo
27 27
 
28 28
 	<!-- Language list -->
29 29
 	<?php
30
-	/* no results */
31
-	if($widgets===false) { ?>
30
+    /* no results */
31
+    if($widgets===false) { ?>
32 32
 		<tr>
33 33
 			<td colspan="4"><div class="alert alert-info alert-nomargin"><?php print _('No widgets created yet'); ?></div></td>
34 34
 		</tr>
35 35
 	<?php } else {
36
-		# headers
37
-		print "<thead>";
38
-		print "<tr>";
39
-		print "	<th>"._('Title')."</th>";
40
-		print "	<th>"._('Description')."</th>";
41
-		print "	<th>"._('File')."</th>";
42
-		print "	<th>"._('Admin')."</th>";
43
-		print "	<th>"._('Active')."</th>";
44
-		print "	<th>"._('Parameters')."</th>";
45
-		print "	<th>"._('Validity')."</th>";
46
-		print "	<th></th>";
47
-		print "</tr>";
48
-		print "</thead>";
36
+        # headers
37
+        print "<thead>";
38
+        print "<tr>";
39
+        print "	<th>"._('Title')."</th>";
40
+        print "	<th>"._('Description')."</th>";
41
+        print "	<th>"._('File')."</th>";
42
+        print "	<th>"._('Admin')."</th>";
43
+        print "	<th>"._('Active')."</th>";
44
+        print "	<th>"._('Parameters')."</th>";
45
+        print "	<th>"._('Validity')."</th>";
46
+        print "	<th></th>";
47
+        print "</tr>";
48
+        print "</thead>";
49 49
 
50 50
         print "<tbody>";
51
-		# print
52
-		foreach($widgets as $w) {
53
-			# cast
54
-			$w = (array) $w;
51
+        # print
52
+        foreach($widgets as $w) {
53
+            # cast
54
+            $w = (array) $w;
55 55
 
56
-			# verify validity
57
-			$valid = $Tools->verify_widget($w['wfile']);
56
+            # verify validity
57
+            $valid = $Tools->verify_widget($w['wfile']);
58 58
 
59
-			if($valid)  { $vPrint = "<span class='alert alert-success'>"._('Valid')."</span>"; }
60
-			else		{ $vPrint = "<span class='alert alert-danger'>"._('Invalid')."</span>"; }
59
+            if($valid)  { $vPrint = "<span class='alert alert-success'>"._('Valid')."</span>"; }
60
+            else		{ $vPrint = "<span class='alert alert-danger'>"._('Invalid')."</span>"; }
61 61
 
62
-			print "<tr>";
63
-			print "	<td>"._($w['wtitle'])."</td>";
64
-			print "	<td>"._($w['wdescription'])."</td>";
65
-			print "	<td>$w[wfile].php</td>";
66
-			print "	<td>"._($w['wadminonly'])."</td>";
67
-			print "	<td>"._($w['wactive'])."</td>";
68
-			print "	<td>"._($w['wparams'])."</td>";
69
-			print "	<td>$vPrint</td>";
70
-			print "	<td>";
71
-			print "	<div class='btn-group'>";
72
-			print "		<button class='btn btn-xs btn-default wedit' data-action='edit' data-wid='$w[wid]'><i class='fa fa-pencil'></i></button>";
73
-			print "		<button class='btn btn-xs btn-default wedit' data-action='delete' data-wid='$w[wid]'><i class='fa fa-times'></i></button>";
74
-			print "	</div>";
75
-			print "	</td>";
76
-			print "</tr>";
77
-		}
78
-		print "</tbody>";
79
-	}
80
-	?>
62
+            print "<tr>";
63
+            print "	<td>"._($w['wtitle'])."</td>";
64
+            print "	<td>"._($w['wdescription'])."</td>";
65
+            print "	<td>$w[wfile].php</td>";
66
+            print "	<td>"._($w['wadminonly'])."</td>";
67
+            print "	<td>"._($w['wactive'])."</td>";
68
+            print "	<td>"._($w['wparams'])."</td>";
69
+            print "	<td>$vPrint</td>";
70
+            print "	<td>";
71
+            print "	<div class='btn-group'>";
72
+            print "		<button class='btn btn-xs btn-default wedit' data-action='edit' data-wid='$w[wid]'><i class='fa fa-pencil'></i></button>";
73
+            print "		<button class='btn btn-xs btn-default wedit' data-action='delete' data-wid='$w[wid]'><i class='fa fa-times'></i></button>";
74
+            print "	</div>";
75
+            print "	</td>";
76
+            print "</tr>";
77
+        }
78
+        print "</tbody>";
79
+    }
80
+    ?>
81 81
 
82 82
 
83 83
 </table>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,8 @@
 block discarded – undo
27 27
 		<tr>
28 28
 			<td colspan="4"><div class="alert alert-info alert-nomargin"><?php print _('No languages present created yet'); ?></div></td>
29 29
 		</tr>
30
-	<?php } else {
30
+	<?php }
31
+else {
31 32
 		# headers
32 33
 		print "<tr>";
33 34
 		print "	<th>"._('Language code')."</th>";
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,67 +5,67 @@  discard block
 block discarded – undo
5 5
  ****************************************/
6 6
 
7 7
 # verify that user is logged in
8
-$User->check_user_session();
8
+$User->check_user_session ();
9 9
 
10 10
 # fetch all widgets
11
-$widgets = $Admin->fetch_all_objects("widgets", "wid");
11
+$widgets = $Admin->fetch_all_objects ("widgets", "wid");
12 12
 ?>
13 13
 
14 14
 
15
-<h4><?php print _('Widgets'); ?></h4>
15
+<h4><?php print _ ('Widgets'); ?></h4>
16 16
 <hr>
17 17
 <?php
18 18
 print "<p class='muted'>";
19
-print _('You can manage widgets here').".<br>";
19
+print _ ('You can manage widgets here').".<br>";
20 20
 print "</p>";
21 21
 ?>
22 22
 
23 23
 <!-- Add new -->
24
-<button class="btn btn-sm btn-default wedit" data-action='add' style="margin-bottom:10px;"><i class="fa fa-plus"></i> <?php print _("Create new widget"); ?></button>
24
+<button class="btn btn-sm btn-default wedit" data-action='add' style="margin-bottom:10px;"><i class="fa fa-plus"></i> <?php print _ ("Create new widget"); ?></button>
25 25
 
26 26
 <table class="table sorted table-striped table-top" style="min-width:400px;">
27 27
 
28 28
 	<!-- Language list -->
29 29
 	<?php
30 30
 	/* no results */
31
-	if($widgets===false) { ?>
31
+	if ($widgets === false) { ?>
32 32
 		<tr>
33
-			<td colspan="4"><div class="alert alert-info alert-nomargin"><?php print _('No widgets created yet'); ?></div></td>
33
+			<td colspan="4"><div class="alert alert-info alert-nomargin"><?php print _ ('No widgets created yet'); ?></div></td>
34 34
 		</tr>
35 35
 	<?php } else {
36 36
 		# headers
37 37
 		print "<thead>";
38 38
 		print "<tr>";
39
-		print "	<th>"._('Title')."</th>";
40
-		print "	<th>"._('Description')."</th>";
41
-		print "	<th>"._('File')."</th>";
42
-		print "	<th>"._('Admin')."</th>";
43
-		print "	<th>"._('Active')."</th>";
44
-		print "	<th>"._('Parameters')."</th>";
45
-		print "	<th>"._('Validity')."</th>";
39
+		print "	<th>"._ ('Title')."</th>";
40
+		print "	<th>"._ ('Description')."</th>";
41
+		print "	<th>"._ ('File')."</th>";
42
+		print "	<th>"._ ('Admin')."</th>";
43
+		print "	<th>"._ ('Active')."</th>";
44
+		print "	<th>"._ ('Parameters')."</th>";
45
+		print "	<th>"._ ('Validity')."</th>";
46 46
 		print "	<th></th>";
47 47
 		print "</tr>";
48 48
 		print "</thead>";
49 49
 
50 50
         print "<tbody>";
51 51
 		# print
52
-		foreach($widgets as $w) {
52
+		foreach ($widgets as $w) {
53 53
 			# cast
54 54
 			$w = (array) $w;
55 55
 
56 56
 			# verify validity
57
-			$valid = $Tools->verify_widget($w['wfile']);
57
+			$valid = $Tools->verify_widget ($w['wfile']);
58 58
 
59
-			if($valid)  { $vPrint = "<span class='alert alert-success'>"._('Valid')."</span>"; }
60
-			else		{ $vPrint = "<span class='alert alert-danger'>"._('Invalid')."</span>"; }
59
+			if ($valid) { $vPrint = "<span class='alert alert-success'>"._ ('Valid')."</span>"; }
60
+			else { $vPrint = "<span class='alert alert-danger'>"._ ('Invalid')."</span>"; }
61 61
 
62 62
 			print "<tr>";
63
-			print "	<td>"._($w['wtitle'])."</td>";
64
-			print "	<td>"._($w['wdescription'])."</td>";
63
+			print "	<td>"._ ($w['wtitle'])."</td>";
64
+			print "	<td>"._ ($w['wdescription'])."</td>";
65 65
 			print "	<td>$w[wfile].php</td>";
66
-			print "	<td>"._($w['wadminonly'])."</td>";
67
-			print "	<td>"._($w['wactive'])."</td>";
68
-			print "	<td>"._($w['wparams'])."</td>";
66
+			print "	<td>"._ ($w['wadminonly'])."</td>";
67
+			print "	<td>"._ ($w['wactive'])."</td>";
68
+			print "	<td>"._ ($w['wparams'])."</td>";
69 69
 			print "	<td>$vPrint</td>";
70 70
 			print "	<td>";
71 71
 			print "	<div class='btn-group'>";
@@ -84,5 +84,5 @@  discard block
 block discarded – undo
84 84
 
85 85
 <hr>
86 86
 <div class="alert alert-info alert-block alert-auto alert-absolute">
87
-	<?php print _('Instructions')." : "._('Create widget file in directory app/dashboard/widgets/')."."; ?>
87
+	<?php print _ ('Instructions')." : "._ ('Create widget file in directory app/dashboard/widgets/')."."; ?>
88 88
 </div>
Please login to merge, or discard this patch.
app/admin/widgets/edit-result.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 # ID must be numeric */
27 27
 if($_POST['action']!="add") {
28
-	if(!is_numeric($_POST['wid']))								{ $Result->show("danger", _("Invalid ID"), true); }
28
+    if(!is_numeric($_POST['wid']))								{ $Result->show("danger", _("Invalid ID"), true); }
29 29
 }
30 30
 # Title and path must be present!
31 31
 if($_POST['action']!="delete") {
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 
38 38
 # set update values
39 39
 $values = array("wid"=>@$_POST['wid'],
40
-				"wtitle"=>$_POST['wtitle'],
41
-				"wdescription"=>@$_POST['wdescription'],
42
-				"wfile"=>$_POST['wfile'],
43
-				"wadminonly"=>$_POST['wadminonly'],
44
-				"wactive"=>$_POST['wactive'],
45
-				"wparams"=>$_POST['wparams'],
46
-				"whref"=>$_POST['whref'],
47
-				"wsize"=>$_POST['wsize']
48
-				);
40
+                "wtitle"=>$_POST['wtitle'],
41
+                "wdescription"=>@$_POST['wdescription'],
42
+                "wfile"=>$_POST['wfile'],
43
+                "wadminonly"=>$_POST['wadminonly'],
44
+                "wactive"=>$_POST['wactive'],
45
+                "wparams"=>$_POST['wparams'],
46
+                "whref"=>$_POST['whref'],
47
+                "wsize"=>$_POST['wsize']
48
+                );
49 49
 # update
50 50
 if(!$Admin->object_modify("widgets", $_POST['action'], "wid", $values))	{ $Result->show("danger",  _("Widget $_POST[action] error")."!", true); }
51 51
 else																	{ $Result->show("success", _("Widget $_POST[action] success")."!", true); }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,38 +5,38 @@  discard block
 block discarded – undo
5 5
  *************************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 # strip input tags
20
-$_POST = $Admin->strip_input_tags($_POST);
20
+$_POST = $Admin->strip_input_tags ($_POST);
21 21
 
22 22
 # validate csrf cookie
23
-$User->csrf_cookie ("validate", "widget", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
23
+$User->csrf_cookie ("validate", "widget", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
24 24
 
25 25
 
26 26
 # ID must be numeric */
27
-if($_POST['action']!="add") {
28
-	if(!is_numeric($_POST['wid']))								{ $Result->show("danger", _("Invalid ID"), true); }
27
+if ($_POST['action'] != "add") {
28
+	if (!is_numeric ($_POST['wid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
29 29
 }
30 30
 # Title and path must be present!
31
-if($_POST['action']!="delete") {
32
-if(strlen($_POST['wtitle'])==0 || strlen($_POST['wfile'])==0) 	{ $Result->show("danger", _("Filename and title are mandatory")."!", true); }
31
+if ($_POST['action'] != "delete") {
32
+if (strlen ($_POST['wtitle']) == 0 || strlen ($_POST['wfile']) == 0) { $Result->show ("danger", _ ("Filename and title are mandatory")."!", true); }
33 33
 }
34 34
 
35 35
 # Remove .php form wfile if it is present
36
-$_POST['wfile'] = str_replace(".php","",trim(@$_POST['wfile']));
36
+$_POST['wfile'] = str_replace (".php", "", trim (@$_POST['wfile']));
37 37
 
38 38
 # set update values
39
-$values = array("wid"=>@$_POST['wid'],
39
+$values = array ("wid"=>@$_POST['wid'],
40 40
 				"wtitle"=>$_POST['wtitle'],
41 41
 				"wdescription"=>@$_POST['wdescription'],
42 42
 				"wfile"=>$_POST['wfile'],
@@ -47,6 +47,6 @@  discard block
 block discarded – undo
47 47
 				"wsize"=>$_POST['wsize']
48 48
 				);
49 49
 # update
50
-if(!$Admin->object_modify("widgets", $_POST['action'], "wid", $values))	{ $Result->show("danger",  _("Widget $_POST[action] error")."!", true); }
51
-else																	{ $Result->show("success", _("Widget $_POST[action] success")."!", true); }
50
+if (!$Admin->object_modify ("widgets", $_POST['action'], "wid", $values)) { $Result->show ("danger", _ ("Widget $_POST[action] error")."!", true); }
51
+else { $Result->show ("success", _ ("Widget $_POST[action] success")."!", true); }
52 52
 ?>
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/widgets/edit.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 
23 23
 # fetch widget
24 24
 if($_POST['action']!="add") {
25
-	$w = $Admin->fetch_object ("widgets", "wid", $_POST['wid']);
26
-	$w!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
27
-	$w = (array) $w;
25
+    $w = $Admin->fetch_object ("widgets", "wid", $_POST['wid']);
26
+    $w!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
27
+    $w = (array) $w;
28 28
 }
29 29
 ?>
30 30
 
Please login to merge, or discard this patch.
Braces   +60 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,14 +40,20 @@  discard block
 block discarded – undo
40 40
 	<!-- name -->
41 41
 	<tr>
42 42
 	    <td><?php print _('Title'); ?></td>
43
-	    <td><input class="form-control input-sm input-w-250" type="text" name="wtitle" value="<?php print @$w['wtitle']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
43
+	    <td><input class="form-control input-sm input-w-250" type="text" name="wtitle" value="<?php print @$w['wtitle']; ?>" <?php if($_POST['action'] == "delete") {
44
+    print "readonly";
45
+}
46
+?>></td>
44 47
     </tr>
45 48
 
46 49
     <!-- description -->
47 50
     <tr>
48 51
     	<td><?php print _('Description'); ?></td>
49 52
     	<td>
50
-    		<input class="form-control input-sm input-w-250" type="text" name="wdescription" value="<?php print @$w['wdescription']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>>
53
+    		<input class="form-control input-sm input-w-250" type="text" name="wdescription" value="<?php print @$w['wdescription']; ?>" <?php if($_POST['action'] == "delete") {
54
+    print "readonly";
55
+}
56
+?>>
51 57
 
52 58
     		<input type="hidden" name="wid" value="<?php print $_POST['wid']; ?>">
53 59
     		<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
@@ -58,13 +64,19 @@  discard block
 block discarded – undo
58 64
 	<!-- File -->
59 65
 	<tr>
60 66
 	    <td><?php print _('File'); ?></td>
61
-	    <td><input class="form-control input-sm input-w-250" type="text" name="wfile" value="<?php print @$w['wfile']; ?>.php" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
67
+	    <td><input class="form-control input-sm input-w-250" type="text" name="wfile" value="<?php print @$w['wfile']; ?>.php" <?php if($_POST['action'] == "delete") {
68
+    print "readonly";
69
+}
70
+?>></td>
62 71
     </tr>
63 72
 
64 73
 	<!-- params -->
65 74
 	<tr>
66 75
 	    <td><?php print _('Parameters'); ?></td>
67
-	    <td><input class="form-control input-sm input-w-250" type="text" name="wparams" value="<?php print @$w['wparams']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
76
+	    <td><input class="form-control input-sm input-w-250" type="text" name="wparams" value="<?php print @$w['wparams']; ?>" <?php if($_POST['action'] == "delete") {
77
+    print "readonly";
78
+}
79
+?>></td>
68 80
     </tr>
69 81
 
70 82
 	<!-- Admin -->
@@ -72,8 +84,14 @@  discard block
 block discarded – undo
72 84
 	    <td><?php print _('Admin only'); ?></td>
73 85
 	    <td>
74 86
 	    	<select name="wadminonly" class="form-control input-sm input-w-auto">
75
-	    		<option value="no"  <?php if(@$w['wadminonly']=='no')  print "selected='selected'"; ?>><?php print _('No'); ?></option>
76
-	    		<option value="yes" <?php if(@$w['wadminonly']=='yes') print "selected='selected'"; ?>><?php print _('Yes'); ?></option>
87
+	    		<option value="no"  <?php if(@$w['wadminonly']=='no') {
88
+    print "selected='selected'";
89
+}
90
+?>><?php print _('No'); ?></option>
91
+	    		<option value="yes" <?php if(@$w['wadminonly']=='yes') {
92
+    print "selected='selected'";
93
+}
94
+?>><?php print _('Yes'); ?></option>
77 95
 
78 96
 	    	</select>
79 97
 	    </td>
@@ -84,8 +102,14 @@  discard block
 block discarded – undo
84 102
 	    <td><?php print _('Active'); ?></td>
85 103
 	    <td>
86 104
 	    	<select name="wactive" class="form-control input-sm input-w-auto">
87
-	    		<option value="no"  <?php if(@$w['wactive']=='no')  print "selected='selected'"; ?>><?php print _('No'); ?></option>
88
-	    		<option value="yes" <?php if(@$w['wactive']=='yes') print "selected='selected'"; ?>><?php print _('Yes'); ?></option>
105
+	    		<option value="no"  <?php if(@$w['wactive']=='no') {
106
+    print "selected='selected'";
107
+}
108
+?>><?php print _('No'); ?></option>
109
+	    		<option value="yes" <?php if(@$w['wactive']=='yes') {
110
+    print "selected='selected'";
111
+}
112
+?>><?php print _('Yes'); ?></option>
89 113
 
90 114
 	    	</select>
91 115
 	    </td>
@@ -96,8 +120,14 @@  discard block
 block discarded – undo
96 120
 	    <td><?php print _('Link to page'); ?></td>
97 121
 	    <td>
98 122
 	    	<select name="whref" class="form-control input-sm input-w-auto">
99
-	    		<option value="no"  <?php if(@$w['whref']=='no')  print "selected='selected'"; ?>><?php print _('No'); ?></option>
100
-	    		<option value="yes" <?php if(@$w['whref']=='yes') print "selected='selected'"; ?>><?php print _('Yes'); ?></option>
123
+	    		<option value="no"  <?php if(@$w['whref']=='no') {
124
+    print "selected='selected'";
125
+}
126
+?>><?php print _('No'); ?></option>
127
+	    		<option value="yes" <?php if(@$w['whref']=='yes') {
128
+    print "selected='selected'";
129
+}
130
+?>><?php print _('Yes'); ?></option>
101 131
 
102 132
 	    	</select>
103 133
 	    </td>
@@ -108,10 +138,22 @@  discard block
 block discarded – undo
108 138
 	    <td><?php print _('Widget size'); ?></td>
109 139
 	    <td>
110 140
 	    	<select name="wsize" class="form-control input-sm input-w-auto">
111
-	    		<option value="4"  <?php if(@$w['wsize']=='4')  print "selected='selected'"; ?>>25%</option>
112
-	    		<option value="6"  <?php if(@$w['wsize']=='6')  print "selected='selected'"; ?>>50%</option>
113
-	    		<option value="8"  <?php if(@$w['wsize']=='8')  print "selected='selected'"; ?>>75%</option>
114
-	    		<option value="12" <?php if(@$w['wsize']=='12') print "selected='selected'"; ?>>100%</option>
141
+	    		<option value="4"  <?php if(@$w['wsize']=='4') {
142
+    print "selected='selected'";
143
+}
144
+?>>25%</option>
145
+	    		<option value="6"  <?php if(@$w['wsize']=='6') {
146
+    print "selected='selected'";
147
+}
148
+?>>50%</option>
149
+	    		<option value="8"  <?php if(@$w['wsize']=='8') {
150
+    print "selected='selected'";
151
+}
152
+?>>75%</option>
153
+	    		<option value="12" <?php if(@$w['wsize']=='12') {
154
+    print "selected='selected'";
155
+}
156
+?>>100%</option>
115 157
 	    	</select>
116 158
 	    </td>
117 159
     </tr>
@@ -126,7 +168,10 @@  discard block
 block discarded – undo
126 168
 <div class="pFooter">
127 169
 	<div class="btn-group">
128 170
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
129
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="widgetEditSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
171
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
172
+else { print "btn-success"; } ?>" id="widgetEditSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
173
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
174
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
130 175
 	</div>
131 176
 
132 177
 	<!-- Result -->
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -5,31 +5,31 @@  discard block
 block discarded – undo
5 5
  *************************************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9 9
 
10 10
 # initialize user object
11
-$Database 	= new Database_PDO;
12
-$User 		= new User ($Database);
11
+$Database = new Database_PDO;
12
+$User = new User ($Database);
13 13
 $Admin	 	= new Admin ($Database);
14 14
 $Tools	 	= new Tools ($Database);
15 15
 $Result 	= new Result ();
16 16
 
17 17
 # verify that user is logged in
18
-$User->check_user_session();
18
+$User->check_user_session ();
19 19
 
20 20
 # create csrf token
21 21
 $csrf = $User->csrf_cookie ("create", "widget");
22 22
 
23 23
 # fetch widget
24
-if($_POST['action']!="add") {
24
+if ($_POST['action'] != "add") {
25 25
 	$w = $Admin->fetch_object ("widgets", "wid", $_POST['wid']);
26
-	$w!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
26
+	$w !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true);
27 27
 	$w = (array) $w;
28 28
 }
29 29
 ?>
30 30
 
31 31
 <!-- header -->
32
-<div class="pHeader"><?php print ucwords($_POST['action'])." widget"; ?></div>
32
+<div class="pHeader"><?php print ucwords ($_POST['action'])." widget"; ?></div>
33 33
 
34 34
 <!-- content -->
35 35
 <div class="pContent">
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 
40 40
 	<!-- name -->
41 41
 	<tr>
42
-	    <td><?php print _('Title'); ?></td>
43
-	    <td><input class="form-control input-sm input-w-250" type="text" name="wtitle" value="<?php print @$w['wtitle']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
42
+	    <td><?php print _ ('Title'); ?></td>
43
+	    <td><input class="form-control input-sm input-w-250" type="text" name="wtitle" value="<?php print @$w['wtitle']; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>></td>
44 44
     </tr>
45 45
 
46 46
     <!-- description -->
47 47
     <tr>
48
-    	<td><?php print _('Description'); ?></td>
48
+    	<td><?php print _ ('Description'); ?></td>
49 49
     	<td>
50
-    		<input class="form-control input-sm input-w-250" type="text" name="wdescription" value="<?php print @$w['wdescription']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>>
50
+    		<input class="form-control input-sm input-w-250" type="text" name="wdescription" value="<?php print @$w['wdescription']; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>>
51 51
 
52 52
     		<input type="hidden" name="wid" value="<?php print $_POST['wid']; ?>">
53 53
     		<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
@@ -57,23 +57,23 @@  discard block
 block discarded – undo
57 57
 
58 58
 	<!-- File -->
59 59
 	<tr>
60
-	    <td><?php print _('File'); ?></td>
61
-	    <td><input class="form-control input-sm input-w-250" type="text" name="wfile" value="<?php print @$w['wfile']; ?>.php" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
60
+	    <td><?php print _ ('File'); ?></td>
61
+	    <td><input class="form-control input-sm input-w-250" type="text" name="wfile" value="<?php print @$w['wfile']; ?>.php" <?php if ($_POST['action'] == "delete") print "readonly"; ?>></td>
62 62
     </tr>
63 63
 
64 64
 	<!-- params -->
65 65
 	<tr>
66
-	    <td><?php print _('Parameters'); ?></td>
67
-	    <td><input class="form-control input-sm input-w-250" type="text" name="wparams" value="<?php print @$w['wparams']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
66
+	    <td><?php print _ ('Parameters'); ?></td>
67
+	    <td><input class="form-control input-sm input-w-250" type="text" name="wparams" value="<?php print @$w['wparams']; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>></td>
68 68
     </tr>
69 69
 
70 70
 	<!-- Admin -->
71 71
 	<tr>
72
-	    <td><?php print _('Admin only'); ?></td>
72
+	    <td><?php print _ ('Admin only'); ?></td>
73 73
 	    <td>
74 74
 	    	<select name="wadminonly" class="form-control input-sm input-w-auto">
75
-	    		<option value="no"  <?php if(@$w['wadminonly']=='no')  print "selected='selected'"; ?>><?php print _('No'); ?></option>
76
-	    		<option value="yes" <?php if(@$w['wadminonly']=='yes') print "selected='selected'"; ?>><?php print _('Yes'); ?></option>
75
+	    		<option value="no"  <?php if (@$w['wadminonly'] == 'no')  print "selected='selected'"; ?>><?php print _ ('No'); ?></option>
76
+	    		<option value="yes" <?php if (@$w['wadminonly'] == 'yes') print "selected='selected'"; ?>><?php print _ ('Yes'); ?></option>
77 77
 
78 78
 	    	</select>
79 79
 	    </td>
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 
82 82
 	<!-- Active -->
83 83
 	<tr>
84
-	    <td><?php print _('Active'); ?></td>
84
+	    <td><?php print _ ('Active'); ?></td>
85 85
 	    <td>
86 86
 	    	<select name="wactive" class="form-control input-sm input-w-auto">
87
-	    		<option value="no"  <?php if(@$w['wactive']=='no')  print "selected='selected'"; ?>><?php print _('No'); ?></option>
88
-	    		<option value="yes" <?php if(@$w['wactive']=='yes') print "selected='selected'"; ?>><?php print _('Yes'); ?></option>
87
+	    		<option value="no"  <?php if (@$w['wactive'] == 'no')  print "selected='selected'"; ?>><?php print _ ('No'); ?></option>
88
+	    		<option value="yes" <?php if (@$w['wactive'] == 'yes') print "selected='selected'"; ?>><?php print _ ('Yes'); ?></option>
89 89
 
90 90
 	    	</select>
91 91
 	    </td>
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 
94 94
 	<!-- Link to file -->
95 95
 	<tr>
96
-	    <td><?php print _('Link to page'); ?></td>
96
+	    <td><?php print _ ('Link to page'); ?></td>
97 97
 	    <td>
98 98
 	    	<select name="whref" class="form-control input-sm input-w-auto">
99
-	    		<option value="no"  <?php if(@$w['whref']=='no')  print "selected='selected'"; ?>><?php print _('No'); ?></option>
100
-	    		<option value="yes" <?php if(@$w['whref']=='yes') print "selected='selected'"; ?>><?php print _('Yes'); ?></option>
99
+	    		<option value="no"  <?php if (@$w['whref'] == 'no')  print "selected='selected'"; ?>><?php print _ ('No'); ?></option>
100
+	    		<option value="yes" <?php if (@$w['whref'] == 'yes') print "selected='selected'"; ?>><?php print _ ('Yes'); ?></option>
101 101
 
102 102
 	    	</select>
103 103
 	    </td>
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 
106 106
 	<!-- Size -->
107 107
 	<tr>
108
-	    <td><?php print _('Widget size'); ?></td>
108
+	    <td><?php print _ ('Widget size'); ?></td>
109 109
 	    <td>
110 110
 	    	<select name="wsize" class="form-control input-sm input-w-auto">
111
-	    		<option value="4"  <?php if(@$w['wsize']=='4')  print "selected='selected'"; ?>>25%</option>
112
-	    		<option value="6"  <?php if(@$w['wsize']=='6')  print "selected='selected'"; ?>>50%</option>
113
-	    		<option value="8"  <?php if(@$w['wsize']=='8')  print "selected='selected'"; ?>>75%</option>
114
-	    		<option value="12" <?php if(@$w['wsize']=='12') print "selected='selected'"; ?>>100%</option>
111
+	    		<option value="4"  <?php if (@$w['wsize'] == '4')  print "selected='selected'"; ?>>25%</option>
112
+	    		<option value="6"  <?php if (@$w['wsize'] == '6')  print "selected='selected'"; ?>>50%</option>
113
+	    		<option value="8"  <?php if (@$w['wsize'] == '8')  print "selected='selected'"; ?>>75%</option>
114
+	    		<option value="12" <?php if (@$w['wsize'] == '12') print "selected='selected'"; ?>>100%</option>
115 115
 	    	</select>
116 116
 	    </td>
117 117
     </tr>
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 <!-- footer -->
126 126
 <div class="pFooter">
127 127
 	<div class="btn-group">
128
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
129
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="widgetEditSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
128
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
129
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="widgetEditSubmit"><i class="fa <?php if ($_POST['action'] == "add") { print "fa-plus"; } else if ($_POST['action'] == "delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords (_ ($_POST['action'])); ?></button>
130 130
 	</div>
131 131
 
132 132
 	<!-- Result -->
Please login to merge, or discard this patch.
app/admin/ripe-import/import-subnets.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -24,73 +24,73 @@
 block discarded – undo
24 24
 
25 25
 //get unique keys for subnets because they are not sequential if deleted!!!
26 26
 foreach($_POST as $key=>$line) {
27
-	if (strlen(strstr($key,"subnet"))>0) {
28
-		$allSubnets[] = $key;
29
-	}
27
+    if (strlen(strstr($key,"subnet"))>0) {
28
+        $allSubnets[] = $key;
29
+    }
30 30
 }
31 31
 
32 32
 # format and verify each record
33 33
 foreach($allSubnets as $subnet) {
34
-	//get sequential number
35
-	$m = str_replace("subnet-", "", $subnet);
36
-
37
-	//reformat subnet
38
-	$_temp = explode("/", $_POST['subnet-' . $m]);
39
-
40
-	//set subnet details for importing
41
-	$subnet_import['subnet'] 	   = $Subnets->transform_to_decimal($_temp[0]);
42
-	$subnet_import['mask'] 	   	   = $_temp[1];
43
-	$subnet_import['sectionId']    = $_POST['section-' . $m];
44
-	$subnet_import['description']  = $_POST['description-' . $m];
45
-	$subnet_import['vlanId'] 	   = $_POST['vlan-' . $m];
46
-	$subnet_import['vrfId'] 	   = $_POST['vrf-' . $m];
47
-	$subnet_import['showName']	   = $_POST['showName-' . $m];
48
-
49
-	//cidr
50
-	if(strlen($err=$Subnets->verify_cidr($Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask']))>5) {
51
-		$errors[] = $err;
52
-	}
53
-	//overlapping, only root !
54
-	else if (strlen($err=$Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId']))>5) {
55
-		$errors[] = $err;
56
-	}
57
-	//set insert
58
-	else {
59
-		$subnets_to_insert[] = $subnet_import;
60
-	}
34
+    //get sequential number
35
+    $m = str_replace("subnet-", "", $subnet);
36
+
37
+    //reformat subnet
38
+    $_temp = explode("/", $_POST['subnet-' . $m]);
39
+
40
+    //set subnet details for importing
41
+    $subnet_import['subnet'] 	   = $Subnets->transform_to_decimal($_temp[0]);
42
+    $subnet_import['mask'] 	   	   = $_temp[1];
43
+    $subnet_import['sectionId']    = $_POST['section-' . $m];
44
+    $subnet_import['description']  = $_POST['description-' . $m];
45
+    $subnet_import['vlanId'] 	   = $_POST['vlan-' . $m];
46
+    $subnet_import['vrfId'] 	   = $_POST['vrf-' . $m];
47
+    $subnet_import['showName']	   = $_POST['showName-' . $m];
48
+
49
+    //cidr
50
+    if(strlen($err=$Subnets->verify_cidr($Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask']))>5) {
51
+        $errors[] = $err;
52
+    }
53
+    //overlapping, only root !
54
+    else if (strlen($err=$Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId']))>5) {
55
+        $errors[] = $err;
56
+    }
57
+    //set insert
58
+    else {
59
+        $subnets_to_insert[] = $subnet_import;
60
+    }
61 61
 }
62 62
 
63 63
 
64 64
 # print errors if they exist or success
65 65
 if(isset($errors)) {
66
-	print '<div class="alert alert-danger alert-absolute">'._('Please fix the following errors before inserting').':<hr>'. "\n";
67
-	foreach ($errors as $line) {
68
-		print $line.'<br>';
69
-	}
70
-	print '</div>';
66
+    print '<div class="alert alert-danger alert-absolute">'._('Please fix the following errors before inserting').':<hr>'. "\n";
67
+    foreach ($errors as $line) {
68
+        print $line.'<br>';
69
+    }
70
+    print '</div>';
71 71
 }
72 72
 else {
73
-	$errors_import_failed = 0;
74
-
75
-	//insert if all other is ok!
76
-	foreach($subnets_to_insert as $subnet_import) {
77
-		//formulate insert query
78
-		$values = array("sectionId"=>$subnet_import['sectionId'],
79
-						"subnet"=>$subnet_import['subnet'],
80
-						"mask"=>$subnet_import['mask'],
81
-						"description"=>$subnet_import['description'],
82
-						"vlanId"=>$subnet_import['vlanId'],
83
-						"vrfId"=>$subnet_import['vrfId'],
84
-						"masterSubnetId"=>0,
85
-						"showName"=>$subnet_import['showName']
86
-						);
87
-
88
-		if(!$Admin->object_modify("subnets", "add", "id", $values)) {
89
-			$Result->show("danger", _('Failed to import subnet').' '. $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], false);
90
-			$errors_import_failed++;
91
-		}
92
-	}
93
-	//check if all is ok and print it!
94
-	if($errors_import_failed == 0) 	{ $Result->show("success", _("Import successfull")."!", false); }
73
+    $errors_import_failed = 0;
74
+
75
+    //insert if all other is ok!
76
+    foreach($subnets_to_insert as $subnet_import) {
77
+        //formulate insert query
78
+        $values = array("sectionId"=>$subnet_import['sectionId'],
79
+                        "subnet"=>$subnet_import['subnet'],
80
+                        "mask"=>$subnet_import['mask'],
81
+                        "description"=>$subnet_import['description'],
82
+                        "vlanId"=>$subnet_import['vlanId'],
83
+                        "vrfId"=>$subnet_import['vrfId'],
84
+                        "masterSubnetId"=>0,
85
+                        "showName"=>$subnet_import['showName']
86
+                        );
87
+
88
+        if(!$Admin->object_modify("subnets", "add", "id", $values)) {
89
+            $Result->show("danger", _('Failed to import subnet').' '. $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], false);
90
+            $errors_import_failed++;
91
+        }
92
+    }
93
+    //check if all is ok and print it!
94
+    if($errors_import_failed == 0) 	{ $Result->show("success", _("Import successfull")."!", false); }
95 95
 }
96 96
 ?>
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,52 +6,52 @@  discard block
 block discarded – undo
6 6
 
7 7
 
8 8
 /* functions */
9
-require( dirname(__FILE__) . '/../../../functions/functions.php');
9
+require(dirname (__FILE__).'/../../../functions/functions.php');
10 10
 
11 11
 # initialize user object
12
-$Database 	= new Database_PDO;
13
-$User 		= new User ($Database);
12
+$Database = new Database_PDO;
13
+$User = new User ($Database);
14 14
 $Admin	 	= new Admin ($Database);
15 15
 $Subnets	= new Subnets ($Database);
16 16
 $Result 	= new Result ();
17 17
 
18 18
 # verify that user is logged in
19
-$User->check_user_session();
19
+$User->check_user_session ();
20 20
 
21 21
 
22 22
 //get size of subnets - $_POST/4
23
-$size = sizeof($_POST) / 4;
23
+$size = sizeof ($_POST) / 4;
24 24
 
25 25
 //get unique keys for subnets because they are not sequential if deleted!!!
26
-foreach($_POST as $key=>$line) {
27
-	if (strlen(strstr($key,"subnet"))>0) {
26
+foreach ($_POST as $key=>$line) {
27
+	if (strlen (strstr ($key, "subnet")) > 0) {
28 28
 		$allSubnets[] = $key;
29 29
 	}
30 30
 }
31 31
 
32 32
 # format and verify each record
33
-foreach($allSubnets as $subnet) {
33
+foreach ($allSubnets as $subnet) {
34 34
 	//get sequential number
35
-	$m = str_replace("subnet-", "", $subnet);
35
+	$m = str_replace ("subnet-", "", $subnet);
36 36
 
37 37
 	//reformat subnet
38
-	$_temp = explode("/", $_POST['subnet-' . $m]);
38
+	$_temp = explode ("/", $_POST['subnet-'.$m]);
39 39
 
40 40
 	//set subnet details for importing
41
-	$subnet_import['subnet'] 	   = $Subnets->transform_to_decimal($_temp[0]);
41
+	$subnet_import['subnet'] = $Subnets->transform_to_decimal ($_temp[0]);
42 42
 	$subnet_import['mask'] 	   	   = $_temp[1];
43
-	$subnet_import['sectionId']    = $_POST['section-' . $m];
44
-	$subnet_import['description']  = $_POST['description-' . $m];
45
-	$subnet_import['vlanId'] 	   = $_POST['vlan-' . $m];
46
-	$subnet_import['vrfId'] 	   = $_POST['vrf-' . $m];
47
-	$subnet_import['showName']	   = $_POST['showName-' . $m];
43
+	$subnet_import['sectionId']    = $_POST['section-'.$m];
44
+	$subnet_import['description']  = $_POST['description-'.$m];
45
+	$subnet_import['vlanId'] = $_POST['vlan-'.$m];
46
+	$subnet_import['vrfId'] = $_POST['vrf-'.$m];
47
+	$subnet_import['showName'] = $_POST['showName-'.$m];
48 48
 
49 49
 	//cidr
50
-	if(strlen($err=$Subnets->verify_cidr($Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask']))>5) {
50
+	if (strlen ($err = $Subnets->verify_cidr ($Subnets->transform_to_dotted ($subnet_import['subnet'])."/".$subnet_import['mask'])) > 5) {
51 51
 		$errors[] = $err;
52 52
 	}
53 53
 	//overlapping, only root !
54
-	else if (strlen($err=$Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId']))>5) {
54
+	else if (strlen ($err = $Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted ($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId'])) > 5) {
55 55
 		$errors[] = $err;
56 56
 	}
57 57
 	//set insert
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 # print errors if they exist or success
65
-if(isset($errors)) {
66
-	print '<div class="alert alert-danger alert-absolute">'._('Please fix the following errors before inserting').':<hr>'. "\n";
65
+if (isset($errors)) {
66
+	print '<div class="alert alert-danger alert-absolute">'._ ('Please fix the following errors before inserting').':<hr>'."\n";
67 67
 	foreach ($errors as $line) {
68 68
 		print $line.'<br>';
69 69
 	}
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	$errors_import_failed = 0;
74 74
 
75 75
 	//insert if all other is ok!
76
-	foreach($subnets_to_insert as $subnet_import) {
76
+	foreach ($subnets_to_insert as $subnet_import) {
77 77
 		//formulate insert query
78
-		$values = array("sectionId"=>$subnet_import['sectionId'],
78
+		$values = array ("sectionId"=>$subnet_import['sectionId'],
79 79
 						"subnet"=>$subnet_import['subnet'],
80 80
 						"mask"=>$subnet_import['mask'],
81 81
 						"description"=>$subnet_import['description'],
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 						"showName"=>$subnet_import['showName']
86 86
 						);
87 87
 
88
-		if(!$Admin->object_modify("subnets", "add", "id", $values)) {
89
-			$Result->show("danger", _('Failed to import subnet').' '. $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], false);
88
+		if (!$Admin->object_modify ("subnets", "add", "id", $values)) {
89
+			$Result->show ("danger", _ ('Failed to import subnet').' '.$Subnets->transform_to_dotted ($subnet_import['subnet'])."/".$subnet_import['mask'], false);
90 90
 			$errors_import_failed++;
91 91
 		}
92 92
 	}
93 93
 	//check if all is ok and print it!
94
-	if($errors_import_failed == 0) 	{ $Result->show("success", _("Import successfull")."!", false); }
94
+	if ($errors_import_failed == 0) { $Result->show ("success", _ ("Import successfull")."!", false); }
95 95
 }
96 96
 ?>
97 97
\ No newline at end of file
Please login to merge, or discard this patch.