@@ -5,38 +5,38 @@ discard block |
||
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 |
||
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 |
@@ -5,67 +5,67 @@ discard block |
||
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 | |
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 |
||
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> |
@@ -14,32 +14,32 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | /* functions */ |
17 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
17 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
18 | 18 | |
19 | 19 | # initialize user object |
20 | -$Database = new Database_PDO; |
|
21 | -$User = new User ($Database); |
|
20 | +$Database = new Database_PDO; |
|
21 | +$User = new User ($Database); |
|
22 | 22 | $Admin = new Admin ($Database); |
23 | 23 | $Tools = new Tools ($Database); |
24 | 24 | $Result = new Result (); |
25 | 25 | |
26 | 26 | # verify that user is logged in |
27 | -$User->check_user_session(); |
|
27 | +$User->check_user_session (); |
|
28 | 28 | |
29 | 29 | # create csrf token |
30 | 30 | $csrf = $User->csrf_cookie ("create", "custom_field"); |
31 | 31 | |
32 | 32 | |
33 | 33 | /* reset field name for add! */ |
34 | -if($_POST['action'] == "add") { $_POST['fieldName'] = ""; } |
|
35 | -else { $_POST['oldname'] = $_POST['fieldName'];} |
|
34 | +if ($_POST['action'] == "add") { $_POST['fieldName'] = ""; } |
|
35 | +else { $_POST['oldname'] = $_POST['fieldName']; } |
|
36 | 36 | |
37 | 37 | # fetch old field definition |
38 | -$fieldval = (array) $Tools->fetch_full_field_definition($_POST['table'], $_POST['fieldName']); |
|
38 | +$fieldval = (array) $Tools->fetch_full_field_definition ($_POST['table'], $_POST['fieldName']); |
|
39 | 39 | ?> |
40 | 40 | |
41 | 41 | |
42 | -<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('custom field'); ?></div> |
|
42 | +<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('custom field'); ?></div> |
|
43 | 43 | |
44 | 44 | |
45 | 45 | <div class="pContent"> |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | <!-- name --> |
51 | 51 | <tr> |
52 | - <td><?php print _('Name'); ?></td> |
|
52 | + <td><?php print _ ('Name'); ?></td> |
|
53 | 53 | <td> |
54 | - <input type="text" name="name" class="form-control input-sm" value="<?php print $_POST['fieldName']; ?>" placeholder="<?php print _('Select field name'); ?>" <?php if($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
54 | + <input type="text" name="name" class="form-control input-sm" value="<?php print $_POST['fieldName']; ?>" placeholder="<?php print _ ('Select field name'); ?>" <?php if ($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
55 | 55 | |
56 | 56 | <input type="hidden" name="oldname" value="<?php print $_POST['oldname']; ?>"> |
57 | 57 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
@@ -62,32 +62,32 @@ discard block |
||
62 | 62 | |
63 | 63 | <!-- Description --> |
64 | 64 | <tr> |
65 | - <td><?php print _('Description'); ?></td> |
|
65 | + <td><?php print _ ('Description'); ?></td> |
|
66 | 66 | <td> |
67 | - <input type="text" name="Comment" class="form-control input-sm" value="<?php print @$fieldval['Comment']; ?>" placeholder="<?php print _('Enter comment for users'); ?>" <?php if($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
67 | + <input type="text" name="Comment" class="form-control input-sm" value="<?php print @$fieldval['Comment']; ?>" placeholder="<?php print _ ('Enter comment for users'); ?>" <?php if ($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
68 | 68 | </td> |
69 | 69 | </tr> |
70 | 70 | |
71 | 71 | <!-- type --> |
72 | 72 | <tr> |
73 | - <td><?php print _('Type'); ?></td> |
|
73 | + <td><?php print _ ('Type'); ?></td> |
|
74 | 74 | <?php |
75 | 75 | // define supported types |
76 | - $mTypes = array("varchar"=>"varchar", "integer"=>"int", "boolean"=>"bool", "text"=>"text", "date"=>"date", "datetime"=>"datetime", "set"=>"set", "enum"=>"enum"); |
|
76 | + $mTypes = array ("varchar"=>"varchar", "integer"=>"int", "boolean"=>"bool", "text"=>"text", "date"=>"date", "datetime"=>"datetime", "set"=>"set", "enum"=>"enum"); |
|
77 | 77 | //reformat old type |
78 | - $oldMType = strstr(@$fieldval['Type'], "(", true); |
|
79 | - $oldMSize = str_replace(array("(",")"), "",strstr(@$fieldval['Type'], "(", false)); |
|
78 | + $oldMType = strstr (@$fieldval['Type'], "(", true); |
|
79 | + $oldMSize = str_replace (array ("(", ")"), "", strstr (@$fieldval['Type'], "(", false)); |
|
80 | 80 | |
81 | 81 | //exceptions |
82 | - if(@$fieldval['Type']=="text" || @$fieldval['Type']=="date" || @$fieldval['Type']=="datetime" || @$fieldval['Type']=="set" || @$fieldval['Type']=="enum") { $oldMType = @$fieldval['Type']; } |
|
82 | + if (@$fieldval['Type'] == "text" || @$fieldval['Type'] == "date" || @$fieldval['Type'] == "datetime" || @$fieldval['Type'] == "set" || @$fieldval['Type'] == "enum") { $oldMType = @$fieldval['Type']; } |
|
83 | 83 | ?> |
84 | 84 | <td> |
85 | 85 | <select name="fieldType" class="input-sm input-w-auto form-control"> |
86 | 86 | <?php |
87 | - foreach($mTypes as $name=>$type) { |
|
88 | - if($type==$oldMType) { print "<option value='$type' selected='selected'>$name</option>"; } |
|
89 | - elseif($type=="bool" && $oldMType=="tinyint") { print "<option value='$type' selected='selected'>$name</option>"; } |
|
90 | - else { print "<option value='$type'>$name</option>"; } |
|
87 | + foreach ($mTypes as $name=>$type) { |
|
88 | + if ($type == $oldMType) { print "<option value='$type' selected='selected'>$name</option>"; } |
|
89 | + elseif ($type == "bool" && $oldMType == "tinyint") { print "<option value='$type' selected='selected'>$name</option>"; } |
|
90 | + else { print "<option value='$type'>$name</option>"; } |
|
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | </select> |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | |
97 | 97 | <!-- size --> |
98 | 98 | <tr> |
99 | - <td><?php print _('Size / Length'); ?></td> |
|
99 | + <td><?php print _ ('Size / Length'); ?></td> |
|
100 | 100 | <td> |
101 | - <input type="text" name="fieldSize" class="form-control input-sm input-w-100" value="<?php print @$oldMSize; ?>" placeholder="<?php print _('Enter field length'); ?>" <?php if($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
101 | + <input type="text" name="fieldSize" class="form-control input-sm input-w-100" value="<?php print @$oldMSize; ?>" placeholder="<?php print _ ('Enter field length'); ?>" <?php if ($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
102 | 102 | </td> |
103 | 103 | </tr> |
104 | 104 | |
105 | 105 | <!-- Default --> |
106 | 106 | <tr> |
107 | - <td><?php print _('Default value'); ?></td> |
|
107 | + <td><?php print _ ('Default value'); ?></td> |
|
108 | 108 | <td> |
109 | - <input type="text" name="fieldDefault" class="form-control input-sm" value="<?php print @$fieldval['Default']; ?>" placeholder="<?php print _('Enter default value'); ?>" <?php if($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
109 | + <input type="text" name="fieldDefault" class="form-control input-sm" value="<?php print @$fieldval['Default']; ?>" placeholder="<?php print _ ('Enter default value'); ?>" <?php if ($_POST['action'] == "delete") { print 'readonly'; } ?>> |
|
110 | 110 | </td> |
111 | 111 | </tr> |
112 | 112 | |
113 | 113 | <!-- required --> |
114 | 114 | <tr> |
115 | - <td><?php print _('Required field'); ?></td> |
|
115 | + <td><?php print _ ('Required field'); ?></td> |
|
116 | 116 | <td> |
117 | - <input name="NULL" type="checkbox" value="NO" <?php if(@$fieldval['Null']=="NO") print "checked"; ?>> |
|
117 | + <input name="NULL" type="checkbox" value="NO" <?php if (@$fieldval['Null'] == "NO") print "checked"; ?>> |
|
118 | 118 | </td> |
119 | 119 | </tr> |
120 | 120 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | <!-- footer --> |
127 | 127 | <div class="pFooter"> |
128 | 128 | <div class="btn-group"> |
129 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Close'); ?></button> |
|
130 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success";} ?>" id="editcustomSubmit"><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> |
|
129 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Close'); ?></button> |
|
130 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editcustomSubmit"><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> |
|
131 | 131 | </div> |
132 | 132 | <!-- result --> |
133 | 133 | <div class="customEditResult"></div> |
@@ -5,77 +5,77 @@ |
||
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", "custom_field", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
23 | +$User->csrf_cookie ("validate", "custom_field", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
24 | 24 | |
25 | 25 | |
26 | 26 | /* checks */ |
27 | -if($_POST['action'] == "delete") { |
|
27 | +if ($_POST['action'] == "delete") { |
|
28 | 28 | # no cecks |
29 | 29 | } |
30 | 30 | else { |
31 | 31 | # remove spaces |
32 | - $_POST['name'] = trim($_POST['name']); |
|
32 | + $_POST['name'] = trim ($_POST['name']); |
|
33 | 33 | |
34 | 34 | # length > 4 and < 12 |
35 | - if( (strlen($_POST['name']) < 2) || (strlen($_POST['name']) > 24) ) { $errors[] = _('Name must be between 4 and 24 characters'); } |
|
35 | + if ((strlen ($_POST['name']) < 2) || (strlen ($_POST['name']) > 24)) { $errors[] = _ ('Name must be between 4 and 24 characters'); } |
|
36 | 36 | |
37 | 37 | /* validate HTML */ |
38 | 38 | |
39 | 39 | # must not start with number |
40 | - if(is_numeric(substr($_POST['name'], 0, 1))) { $errors[] = _('Name must not start with number'); } |
|
40 | + if (is_numeric (substr ($_POST['name'], 0, 1))) { $errors[] = _ ('Name must not start with number'); } |
|
41 | 41 | |
42 | 42 | # only alphanumeric and _ are allowed |
43 | - if(!preg_match('/^[a-zA-Z0-9 \_]+$/i', $_POST['name'])) { $errors[] = _('Only alphanumeric, spaces and underscore characters are allowed'); } |
|
43 | + if (!preg_match ('/^[a-zA-Z0-9 \_]+$/i', $_POST['name'])) { $errors[] = _ ('Only alphanumeric, spaces and underscore characters are allowed'); } |
|
44 | 44 | |
45 | 45 | # required must have default value |
46 | - if($_POST['NULL']=="NO" && strlen($_POST['fieldDefault'])==0) { $errors[] = _('Required fields must have default values'); } |
|
46 | + if ($_POST['NULL'] == "NO" && strlen ($_POST['fieldDefault']) == 0) { $errors[] = _ ('Required fields must have default values'); } |
|
47 | 47 | |
48 | 48 | # db type validations |
49 | 49 | |
50 | 50 | //boolean |
51 | - if($_POST['fieldType']=="bool") { |
|
52 | - if($_POST['fieldSize']!=0 && $_POST['fieldSize']!=1) { $errors[] = _('Boolean values can only be 0 or 1'); } |
|
53 | - if($_POST['fieldDefault']!=0 && $_POST['fieldDefault']!=1) { $errors[] = _('Default boolean values can only be 0 or 1'); } |
|
51 | + if ($_POST['fieldType'] == "bool") { |
|
52 | + if ($_POST['fieldSize'] != 0 && $_POST['fieldSize'] != 1) { $errors[] = _ ('Boolean values can only be 0 or 1'); } |
|
53 | + if ($_POST['fieldDefault'] != 0 && $_POST['fieldDefault'] != 1) { $errors[] = _ ('Default boolean values can only be 0 or 1'); } |
|
54 | 54 | } |
55 | 55 | //varchar |
56 | - elseif($_POST['fieldType']=="varchar") { |
|
57 | - if(!is_numeric($_POST['fieldSize'])) { $errors[] = _('Fieldsize must be numeric'); } |
|
58 | - if($_POST['fieldSize']>256) { $errors[] = _('Varchar size limit is 256 characters'); } |
|
56 | + elseif ($_POST['fieldType'] == "varchar") { |
|
57 | + if (!is_numeric ($_POST['fieldSize'])) { $errors[] = _ ('Fieldsize must be numeric'); } |
|
58 | + if ($_POST['fieldSize'] > 256) { $errors[] = _ ('Varchar size limit is 256 characters'); } |
|
59 | 59 | } |
60 | 60 | //number |
61 | - elseif($_POST['fieldType']=="int") { |
|
62 | - if(!is_numeric($_POST['fieldSize'])) { $errors[] = _('Integer values must be numeric'); } |
|
61 | + elseif ($_POST['fieldType'] == "int") { |
|
62 | + if (!is_numeric ($_POST['fieldSize'])) { $errors[] = _ ('Integer values must be numeric'); } |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | 67 | /* die if errors otherwise execute */ |
68 | -if(sizeof($errors) != 0) { |
|
69 | - print '<div class="alert alert alert-danger">'._('Please correct the following errors').':'. "\n"; |
|
70 | - print '<ul>'. "\n"; |
|
71 | - foreach($errors as $error) { |
|
72 | - print '<li style="text-align:left">'. $error .'</li>'. "\n"; |
|
68 | +if (sizeof ($errors) != 0) { |
|
69 | + print '<div class="alert alert alert-danger">'._ ('Please correct the following errors').':'."\n"; |
|
70 | + print '<ul>'."\n"; |
|
71 | + foreach ($errors as $error) { |
|
72 | + print '<li style="text-align:left">'.$error.'</li>'."\n"; |
|
73 | 73 | } |
74 | - print '</ul>'. "\n"; |
|
75 | - print '</div>'. "\n"; |
|
74 | + print '</ul>'."\n"; |
|
75 | + print '</div>'."\n"; |
|
76 | 76 | } |
77 | 77 | else { |
78 | - if(!$Admin->update_custom_field_definition($_POST)) { $Result->show("danger", _("Failed to $_POST[action] field"), true); } |
|
79 | - else { $Result->show("success", _("Field $_POST[action] success"), true); } |
|
78 | + if (!$Admin->update_custom_field_definition ($_POST)) { $Result->show ("danger", _ ("Failed to $_POST[action] field"), true); } |
|
79 | + else { $Result->show ("success", _ ("Field $_POST[action] success"), true); } |
|
80 | 80 | } |
81 | 81 | ?> |
@@ -5,11 +5,11 @@ discard block |
||
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 | |
11 | 11 | /* fetch all custom fields */ |
12 | -$custom_tables = array( "ipaddresses"=>"IP address", |
|
12 | +$custom_tables = array ("ipaddresses"=>"IP address", |
|
13 | 13 | "subnets"=>"subnet", |
14 | 14 | "vlans"=>"VLAN", |
15 | 15 | "vrf"=>"VRF", |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | "racks"=>"Rack"); |
19 | 19 | |
20 | 20 | # create array |
21 | -foreach($custom_tables as $k=>$f) { |
|
22 | - $custom_fields[$k] = $Tools->fetch_custom_fields($k); |
|
23 | - $custom_fields_numeric[$k] = $Tools->fetch_custom_fields_numeric($k); |
|
24 | - $custom_fields[$k]['title'] = "Custom $f fields"; |
|
25 | - $custom_fields[$k]['tooltip'] = "Add new custom $f field"; |
|
21 | +foreach ($custom_tables as $k=>$f) { |
|
22 | + $custom_fields[$k] = $Tools->fetch_custom_fields ($k); |
|
23 | + $custom_fields_numeric[$k] = $Tools->fetch_custom_fields_numeric ($k); |
|
24 | + $custom_fields[$k]['title'] = "Custom $f fields"; |
|
25 | + $custom_fields[$k]['tooltip'] = "Add new custom $f field"; |
|
26 | 26 | } |
27 | 27 | ?> |
28 | 28 | |
29 | -<h4><?php print _('Custom fields'); ?></h4> |
|
29 | +<h4><?php print _ ('Custom fields'); ?></h4> |
|
30 | 30 | <hr> |
31 | 31 | |
32 | -<div class="alert alert-info alert-absolute"><?php print _('You can add additional custom fields to IP addresses and subnets (like CustomerId, location, ...)'); ?>.</div> |
|
32 | +<div class="alert alert-info alert-absolute"><?php print _ ('You can add additional custom fields to IP addresses and subnets (like CustomerId, location, ...)'); ?>.</div> |
|
33 | 33 | <hr style="margin-top:50px;clear:both;"> |
34 | 34 | |
35 | 35 | |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | |
38 | 38 | <tr> |
39 | 39 | <td></td> |
40 | - <td><?php print _('Title'); ?></td> |
|
41 | - <td><?php print _('Description'); ?></td> |
|
42 | - <td><?php print _('Field type'); ?></td> |
|
43 | - <td><?php print _('Default'); ?></td> |
|
44 | - <td><?php print _('Required'); ?></td> |
|
45 | - <td><?php print _('Visible'); ?></td> |
|
40 | + <td><?php print _ ('Title'); ?></td> |
|
41 | + <td><?php print _ ('Description'); ?></td> |
|
42 | + <td><?php print _ ('Field type'); ?></td> |
|
43 | + <td><?php print _ ('Default'); ?></td> |
|
44 | + <td><?php print _ ('Required'); ?></td> |
|
45 | + <td><?php print _ ('Visible'); ?></td> |
|
46 | 46 | <td></td> |
47 | 47 | </tr> |
48 | 48 | |
49 | 49 | <?php |
50 | 50 | # printout each |
51 | -foreach($custom_fields as $k=>$cf) { |
|
51 | +foreach ($custom_fields as $k=>$cf) { |
|
52 | 52 | |
53 | 53 | # save vars and unset |
54 | 54 | $title = $cf['title']; |
@@ -61,41 +61,41 @@ discard block |
||
61 | 61 | $table = $k; |
62 | 62 | |
63 | 63 | # get custom fields |
64 | - $ffields = json_decode($User->settings->hiddenCustomFields, true); |
|
65 | - $ffields = is_array(@$ffields[$table]) ? $ffields[$table] : array(); |
|
64 | + $ffields = json_decode ($User->settings->hiddenCustomFields, true); |
|
65 | + $ffields = is_array (@$ffields[$table]) ? $ffields[$table] : array (); |
|
66 | 66 | |
67 | 67 | print "<tbody id='custom-$k'>"; |
68 | 68 | |
69 | 69 | //title |
70 | 70 | print " <tr>"; |
71 | 71 | print " <th colspan='8'>"; |
72 | - print " <h5>"._($title)."</h5>"; |
|
72 | + print " <h5>"._ ($title)."</h5>"; |
|
73 | 73 | print " </th>"; |
74 | 74 | print " </tr>"; |
75 | 75 | |
76 | 76 | //empty |
77 | - if(sizeof($cf) == 0) { |
|
77 | + if (sizeof ($cf) == 0) { |
|
78 | 78 | print " <tr>"; |
79 | 79 | print " <td colspan='8'>"; |
80 | - print " <div class='alert alert-info alert-nomargin'>"._('No custom fields created yet')."</div>"; |
|
80 | + print " <div class='alert alert-info alert-nomargin'>"._ ('No custom fields created yet')."</div>"; |
|
81 | 81 | print " </td>"; |
82 | 82 | print " </tr>"; |
83 | 83 | } |
84 | 84 | //content |
85 | 85 | else { |
86 | - $size = sizeof($cf); //we must remove title |
|
87 | - $m=0; |
|
86 | + $size = sizeof ($cf); //we must remove title |
|
87 | + $m = 0; |
|
88 | 88 | |
89 | - foreach($cf as $f) |
|
89 | + foreach ($cf as $f) |
|
90 | 90 | { |
91 | 91 | # space? |
92 | - $class = !preg_match('/^[a-zA-Z0-9 \_]+$/i', $f['name']) ? "alert-danger" : ""; |
|
92 | + $class = !preg_match ('/^[a-zA-Z0-9 \_]+$/i', $f['name']) ? "alert-danger" : ""; |
|
93 | 93 | |
94 | 94 | print "<tr class='$class'>"; |
95 | 95 | |
96 | 96 | # ordering |
97 | - if (( ($m+1) != $size) ) { print "<td style='width:10px;'><button class='btn btn-xs btn-default down' data-direction='down' data-table='$table' rel='tooltip' title='Move down' data-fieldname='".$custom_fields_numeric[$table][$m]['name']."' data-nextfieldname='".$custom_fields_numeric[$table][$m+1]['name']."'><i class='fa fa-chevron-down'></i></button></td>"; } |
|
98 | - else { print "<td style='width:10px;'></td>";} |
|
97 | + if ((($m + 1) != $size)) { print "<td style='width:10px;'><button class='btn btn-xs btn-default down' data-direction='down' data-table='$table' rel='tooltip' title='Move down' data-fieldname='".$custom_fields_numeric[$table][$m]['name']."' data-nextfieldname='".$custom_fields_numeric[$table][$m + 1]['name']."'><i class='fa fa-chevron-down'></i></button></td>"; } |
|
98 | + else { print "<td style='width:10px;'></td>"; } |
|
99 | 99 | |
100 | 100 | print "<td class='name'>$f[name]</td>"; |
101 | 101 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | |
111 | 111 | |
112 | 112 | # NULL |
113 | - if(@$f['Null']=="NO") { print "<td>"._('Required')."</td>"; } |
|
114 | - else { print "<td></td>"; } |
|
113 | + if (@$f['Null'] == "NO") { print "<td>"._ ('Required')."</td>"; } |
|
114 | + else { print "<td></td>"; } |
|
115 | 115 | |
116 | 116 | # visible |
117 | - if(in_array($f['name'], $ffields)) { print "<td><span class='text-danger'>"._('No')."</span></td>"; } |
|
118 | - else { print "<td><span class='text-success'>"._('Yes')."</span></td>"; } |
|
117 | + if (in_array ($f['name'], $ffields)) { print "<td><span class='text-danger'>"._ ('No')."</span></td>"; } |
|
118 | + else { print "<td><span class='text-success'>"._ ('Yes')."</span></td>"; } |
|
119 | 119 | |
120 | 120 | #actions |
121 | 121 | print "<td class='actions'>"; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | print " </div>"; |
126 | 126 | |
127 | 127 | # warning for older versions |
128 | - if((is_numeric(substr($f['name'], 0, 1))) || (!preg_match('!^[\w_ ]*$!', $f['name'])) ) { print '<span class="alert alert-warning"><strong>Warning</strong>: '._('Invalid field name').'!</span>'; } |
|
128 | + if ((is_numeric (substr ($f['name'], 0, 1))) || (!preg_match ('!^[\w_ ]*$!', $f['name']))) { print '<span class="alert alert-warning"><strong>Warning</strong>: '._ ('Invalid field name').'!</span>'; } |
|
129 | 129 | |
130 | 130 | print "</td>"; |
131 | 131 | print "</tr>"; |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | //add |
139 | 139 | print "<tr>"; |
140 | 140 | print "<td colspan='8' style='padding-right:0px;'>"; |
141 | - print " <button class='btn btn-xs btn-default pull-right edit-custom-field' data-action='add' data-fieldname='' data-table='$table' rel='tooltip' data-placement='right' title='"._($tooltip)."'><i class='fa fa-plus'></i></button>"; |
|
141 | + print " <button class='btn btn-xs btn-default pull-right edit-custom-field' data-action='add' data-fieldname='' data-table='$table' rel='tooltip' data-placement='right' title='"._ ($tooltip)."'><i class='fa fa-plus'></i></button>"; |
|
142 | 142 | print "</td>"; |
143 | 143 | print "</tr>"; |
144 | 144 | |
145 | 145 | //filter |
146 | 146 | print "<tr>"; |
147 | 147 | print "<td colspan='8' style='padding-right:0px;'>"; |
148 | - print " <button class='btn btn-xs btn-info pull-right edit-custom-filter' data-table='$table' rel='tooltip' data-placement='right' title='"._("Set which field to display in table")."'><i class='fa fa-filter'></i> Filter</button>"; |
|
148 | + print " <button class='btn btn-xs btn-info pull-right edit-custom-filter' data-table='$table' rel='tooltip' data-placement='right' title='"._ ("Set which field to display in table")."'><i class='fa fa-filter'></i> Filter</button>"; |
|
149 | 149 | print "</td>"; |
150 | 150 | print "</tr>"; |
151 | 151 |
@@ -12,23 +12,23 @@ discard block |
||
12 | 12 | |
13 | 13 | |
14 | 14 | /* functions */ |
15 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
15 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
16 | 16 | |
17 | 17 | # initialize user object |
18 | -$Database = new Database_PDO; |
|
19 | -$User = new User ($Database); |
|
18 | +$Database = new Database_PDO; |
|
19 | +$User = new User ($Database); |
|
20 | 20 | $Tools = new Tools ($Database); |
21 | 21 | $Result = new Result (); |
22 | 22 | |
23 | 23 | # verify that user is logged in |
24 | -$User->check_user_session(); |
|
24 | +$User->check_user_session (); |
|
25 | 25 | |
26 | 26 | # get hidden custom fields from settings |
27 | -$filters = json_decode($User->settings->hiddenCustomFields, true); |
|
28 | -isset($filters[$_POST['table']]) ? : $filters[$_POST['table']] = array(); |
|
27 | +$filters = json_decode ($User->settings->hiddenCustomFields, true); |
|
28 | +isset($filters[$_POST['table']]) ? : $filters[$_POST['table']] = array (); |
|
29 | 29 | |
30 | 30 | # fetch custom fields |
31 | -$custom = $Tools->fetch_custom_fields($_POST['table']); |
|
31 | +$custom = $Tools->fetch_custom_fields ($_POST['table']); |
|
32 | 32 | ?> |
33 | 33 | |
34 | 34 | <script type="text/javascript"> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | </script> |
49 | 49 | |
50 | 50 | <!-- header --> |
51 | -<div class="pHeader"><?php print _('Filter custom field display'); ?></div> |
|
51 | +<div class="pHeader"><?php print _ ('Filter custom field display'); ?></div> |
|
52 | 52 | |
53 | 53 | <!-- content --> |
54 | 54 | <div class="pContent"> |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | <input type="hidden" name="table" value="<?php print $_POST['table']; ?>"> |
60 | 60 | |
61 | 61 | <?php |
62 | - foreach($custom as $k=>$c) { |
|
62 | + foreach ($custom as $k=>$c) { |
|
63 | 63 | print "<tr>"; |
64 | 64 | # select |
65 | 65 | print " <td style='width:20px;'>"; |
66 | - if(in_array($k, $filters[$_POST['table']])) { print "<input type='checkbox' class='input-switch' name='$k' checked>"; } |
|
67 | - else { print "<input type='checkbox' class='input-switch' name='$k'>"; } |
|
66 | + if (in_array ($k, $filters[$_POST['table']])) { print "<input type='checkbox' class='input-switch' name='$k' checked>"; } |
|
67 | + else { print "<input type='checkbox' class='input-switch' name='$k'>"; } |
|
68 | 68 | print " </td>"; |
69 | 69 | # name and comment |
70 | 70 | print " <td>".$k." (".$c['Comment'].")</td>"; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | <hr> |
79 | 79 | <div class="text-muted"> |
80 | - <?php print _("Selected fields will not be visible in table view, only in detail view"); ?> |
|
80 | + <?php print _ ("Selected fields will not be visible in table view, only in detail view"); ?> |
|
81 | 81 | </div> |
82 | 82 | <hr> |
83 | 83 | </div> |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | <!-- footer --> |
86 | 86 | <div class="pFooter"> |
87 | 87 | <div class="btn-group"> |
88 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Close'); ?></button> |
|
89 | - <button class="btn btn-sm btn-default " id="editcustomFilterSubmit"><i class="fa fa-check"></i> <?php print ucwords(_("Save filter")); ?></button> |
|
88 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Close'); ?></button> |
|
89 | + <button class="btn btn-sm btn-default " id="editcustomFilterSubmit"><i class="fa fa-check"></i> <?php print ucwords (_ ("Save filter")); ?></button> |
|
90 | 90 | </div> |
91 | 91 | <!-- result --> |
92 | 92 | <div class="customEditFilterResult"></div> |
@@ -6,24 +6,24 @@ discard block |
||
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 | $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 | # set table name |
21 | 21 | $table = $_POST['table']; |
22 | 22 | unset($_POST['table']); |
23 | 23 | |
24 | 24 | /* enthing to write? */ |
25 | -if(sizeof($_POST)>0) { |
|
26 | - foreach($_POST as $k=>$v) { |
|
25 | +if (sizeof ($_POST) > 0) { |
|
26 | + foreach ($_POST as $k=>$v) { |
|
27 | 27 | $filtered_fields[] = $k; |
28 | 28 | } |
29 | 29 | } |
@@ -32,6 +32,6 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /* save */ |
35 | -if(!$Admin->save_custom_fields_filter($table, $filtered_fields)) { } |
|
36 | -else { $Result->show("success", _('Filter saved')); } |
|
35 | +if (!$Admin->save_custom_fields_filter ($table, $filtered_fields)) { } |
|
36 | +else { $Result->show ("success", _ ('Filter saved')); } |
|
37 | 37 | ?> |
38 | 38 | \ No newline at end of file |
@@ -6,23 +6,23 @@ |
||
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 | $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 | # some verifications |
21 | -if( (empty($_POST['current'])) || (empty($_POST['next'])) ) { $Result->show("danger", _('Fileds cannot be empty')."!", true); } |
|
21 | +if ((empty($_POST['current'])) || (empty($_POST['next']))) { $Result->show ("danger", _ ('Fileds cannot be empty')."!", true); } |
|
22 | 22 | |
23 | 23 | |
24 | 24 | /* reorder */ |
25 | -if(!$Admin->reorder_custom_fields($_POST['table'], $_POST['next'], $_POST['current'])) { $Result->show("danger", _('Reordering failed')."!", true); } |
|
26 | -else { $Result->show("success", _('Fields reordered successfully')."!");} |
|
25 | +if (!$Admin->reorder_custom_fields ($_POST['table'], $_POST['next'], $_POST['current'])) { $Result->show ("danger", _ ('Reordering failed')."!", true); } |
|
26 | +else { $Result->show ("success", _ ('Fields reordered successfully')."!"); } |
|
27 | 27 | |
28 | 28 | ?> |
29 | 29 | \ No newline at end of file |
@@ -5,37 +5,37 @@ discard block |
||
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 | # create csrf token |
20 | 20 | $csrf = $User->csrf_cookie ("create", "apiedit"); |
21 | 21 | |
22 | 22 | # ID must be numeric |
23 | -if($_POST['action']!="add" && !is_numeric($_POST['appid'])) { $Result->show("danger", _("Invalid ID"), true, true); } |
|
23 | +if ($_POST['action'] != "add" && !is_numeric ($_POST['appid'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); } |
|
24 | 24 | |
25 | 25 | # fetch api for edit / add |
26 | -if($_POST['action']!="add") { |
|
26 | +if ($_POST['action'] != "add") { |
|
27 | 27 | # fetch api details |
28 | 28 | $api = $Admin->fetch_object ("api", "id", $_POST['appid']); |
29 | 29 | # null ? |
30 | - $api===false ? $Result->show("danger", _("Invalid ID"), true) : null; |
|
30 | + $api === false ? $Result->show ("danger", _ ("Invalid ID"), true) : null; |
|
31 | 31 | # title |
32 | - $title = ucwords($_POST['action']) .' '._('api').' '.$api->app_id; |
|
32 | + $title = ucwords ($_POST['action']).' '._ ('api').' '.$api->app_id; |
|
33 | 33 | } else { |
34 | 34 | # generate new code |
35 | 35 | $api = new StdClass; |
36 | - $api->app_code = str_shuffle(md5(microtime())); |
|
36 | + $api->app_code = str_shuffle (md5 (microtime ())); |
|
37 | 37 | # title |
38 | - $title = _('Add new api key'); |
|
38 | + $title = _ ('Add new api key'); |
|
39 | 39 | } |
40 | 40 | ?> |
41 | 41 | |
@@ -51,66 +51,66 @@ discard block |
||
51 | 51 | |
52 | 52 | <!-- id --> |
53 | 53 | <tr> |
54 | - <td><?php print _('App id'); ?></td> |
|
54 | + <td><?php print _ ('App id'); ?></td> |
|
55 | 55 | <td> |
56 | - <input type="text" name="app_id" class="form-control input-sm" value="<?php print @$api->app_id; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>> |
|
56 | + <input type="text" name="app_id" class="form-control input-sm" value="<?php print @$api->app_id; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>> |
|
57 | 57 | <input type="hidden" name="id" value="<?php print $api->id; ?>"> |
58 | 58 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
59 | 59 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
60 | 60 | </td> |
61 | - <td class="info2"><?php print _('Enter application identifier'); ?></td> |
|
61 | + <td class="info2"><?php print _ ('Enter application identifier'); ?></td> |
|
62 | 62 | </tr> |
63 | 63 | |
64 | 64 | <!-- code --> |
65 | 65 | <tr> |
66 | - <td><?php print _('App code'); ?></td> |
|
67 | - <td><input type="text" id="appcode" name="app_code" class="form-control input-sm" value="<?php print @$api->app_code; ?>" maxlength='32' <?php if($_POST['action'] == "delete") print "readonly"; ?>></td> |
|
68 | - <td class="info2"><?php print _('Application code'); ?> <button class="btn btn-xs btn-default" id="regApiKey"><i class="fa fa-random"></i> <?php print _('Regenerate'); ?></button></td> |
|
66 | + <td><?php print _ ('App code'); ?></td> |
|
67 | + <td><input type="text" id="appcode" name="app_code" class="form-control input-sm" value="<?php print @$api->app_code; ?>" maxlength='32' <?php if ($_POST['action'] == "delete") print "readonly"; ?>></td> |
|
68 | + <td class="info2"><?php print _ ('Application code'); ?> <button class="btn btn-xs btn-default" id="regApiKey"><i class="fa fa-random"></i> <?php print _ ('Regenerate'); ?></button></td> |
|
69 | 69 | </tr> |
70 | 70 | |
71 | 71 | <!-- permissions --> |
72 | 72 | <tr> |
73 | - <td><?php print _('App permissions'); ?></td> |
|
73 | + <td><?php print _ ('App permissions'); ?></td> |
|
74 | 74 | <td> |
75 | 75 | <select name="app_permissions" class="form-control input-sm input-w-auto"> |
76 | 76 | <?php |
77 | - $perms = array(0=>"Disabled",1=>"Read",2=>"Read / Write",3=>"Read / Write / Admin"); |
|
78 | - foreach($perms as $k=>$p) { |
|
79 | - if($k==$api->app_permissions) { print "<option value='$k' selected='selected'>"._($p)."</option>"; } |
|
80 | - else { print "<option value='$k' >"._($p)."</option>"; } |
|
77 | + $perms = array (0=>"Disabled", 1=>"Read", 2=>"Read / Write", 3=>"Read / Write / Admin"); |
|
78 | + foreach ($perms as $k=>$p) { |
|
79 | + if ($k == $api->app_permissions) { print "<option value='$k' selected='selected'>"._ ($p)."</option>"; } |
|
80 | + else { print "<option value='$k' >"._ ($p)."</option>"; } |
|
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | </select> |
84 | - <td class="info2"><?php print _('Application permissions'); ?></td> |
|
84 | + <td class="info2"><?php print _ ('Application permissions'); ?></td> |
|
85 | 85 | </tr> |
86 | 86 | |
87 | 87 | <!-- Security --> |
88 | 88 | <tr> |
89 | - <td><?php print _('App security'); ?></td> |
|
89 | + <td><?php print _ ('App security'); ?></td> |
|
90 | 90 | <td> |
91 | 91 | <select name="app_security" class="form-control input-sm input-w-auto"> |
92 | 92 | <?php |
93 | - $perms = array(0=>"crypt",1=>"ssl",2=>"none",3=>"user"); |
|
93 | + $perms = array (0=>"crypt", 1=>"ssl", 2=>"none", 3=>"user"); |
|
94 | 94 | |
95 | 95 | // user not yet supported |
96 | 96 | unset($perms[3]); |
97 | 97 | |
98 | - foreach($perms as $k=>$p) { |
|
99 | - if($p==$api->app_security) { print "<option value='$p' selected='selected'>"._($p)."</option>"; } |
|
100 | - else { print "<option value='$p' >"._($p)."</option>"; } |
|
98 | + foreach ($perms as $k=>$p) { |
|
99 | + if ($p == $api->app_security) { print "<option value='$p' selected='selected'>"._ ($p)."</option>"; } |
|
100 | + else { print "<option value='$p' >"._ ($p)."</option>"; } |
|
101 | 101 | } |
102 | 102 | ?> |
103 | 103 | </select> |
104 | - <td class="info2"><?php print _('Application security'); ?></td> |
|
104 | + <td class="info2"><?php print _ ('Application security'); ?></td> |
|
105 | 105 | </tr> |
106 | 106 | |
107 | 107 | <!-- description --> |
108 | 108 | <tr> |
109 | - <td><?php print _('Description'); ?></td> |
|
109 | + <td><?php print _ ('Description'); ?></td> |
|
110 | 110 | <td> |
111 | - <input type="text" name="app_comment" class="form-control input-sm" value="<?php print @$api->app_comment; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>> |
|
111 | + <input type="text" name="app_comment" class="form-control input-sm" value="<?php print @$api->app_comment; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>> |
|
112 | 112 | </td> |
113 | - <td class="info2"><?php print _('Enter description'); ?></td> |
|
113 | + <td class="info2"><?php print _ ('Enter description'); ?></td> |
|
114 | 114 | </tr> |
115 | 115 | |
116 | 116 | </table> |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | <!-- footer --> |
125 | 125 | <div class="pFooter"> |
126 | 126 | <div class="btn-group"> |
127 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
128 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="apiEditSubmit"><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> |
|
127 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
128 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="apiEditSubmit"><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> |
|
129 | 129 | </div> |
130 | 130 | <!-- Result --> |
131 | 131 | <div class="apiEditResult"></div> |