Skip to content

Commit 05beae4

Browse files
author
Marius Cramer
committed
Resolved differences from svn merge to trunk and git master
1 parent bd68aae commit 05beae4

File tree

3 files changed

+219
-147
lines changed

3 files changed

+219
-147
lines changed

interface/lib/classes/aps_guicontroller.inc.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,9 @@ public function getPackageDetails($id)
728728
// Using parse_url() to filter malformed URLs
729729
$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
730730
basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$icon);
731-
// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
732-
$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
731+
// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
732+
$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
733+
733734
$pkg['Icon'] = $path;
734735
}
735736
else $pkg['Icon'] = '';
@@ -743,8 +744,8 @@ public function getPackageDetails($id)
743744
// Using parse_url() to filter malformed URLs
744745
$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
745746
basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$screen['path']);
746-
// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
747-
$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
747+
// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
748+
$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
748749

749750
$pkg['Screenshots'][] = array('ScreenPath' => $path,
750751
'ScreenDescription' => htmlspecialchars(trim((string)$screen->description)));
@@ -842,4 +843,4 @@ public function getPackageDetails($id)
842843
return $pkg;
843844
}
844845
}
845-
?>
846+
?>

interface/lib/classes/tform.inc.php

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -92,112 +92,112 @@ function checkPerm($record_id,$perm) {
9292

9393
return $result;
9494

95-
}
96-
97-
}
98-
99-
function getNextTab() {
100-
// Which tab is shown
101-
if($this->errorMessage == '') {
102-
// If there is no error
103-
if(isset($_REQUEST["next_tab"]) && $_REQUEST["next_tab"] != '') {
104-
// If the next tab is known
105-
$active_tab = $_REQUEST["next_tab"];
106-
} else {
107-
// else use the default tab
108-
$active_tab = $this->formDef['tab_default'];
109-
}
110-
} else {
111-
// Show the same tab again in case of an error
112-
$active_tab = $_SESSION["s"]["form"]["tab"];
113-
}
114-
115-
return $active_tab;
116-
}
117-
118-
function getCurrentTab() {
119-
return $_SESSION["s"]["form"]["tab"];
120-
}
121-
95+
}
96+
97+
}
98+
99+
function getNextTab() {
100+
// Which tab is shown
101+
if($this->errorMessage == '') {
102+
// If there is no error
103+
if(isset($_REQUEST["next_tab"]) && $_REQUEST["next_tab"] != '') {
104+
// If the next tab is known
105+
$active_tab = $_REQUEST["next_tab"];
106+
} else {
107+
// else use the default tab
108+
$active_tab = $this->formDef['tab_default'];
109+
}
110+
} else {
111+
// Show the same tab again in case of an error
112+
$active_tab = $_SESSION["s"]["form"]["tab"];
113+
}
114+
115+
return $active_tab;
116+
}
117+
118+
function getCurrentTab() {
119+
return $_SESSION["s"]["form"]["tab"];
120+
}
121+
122122
function isReadonlyTab($tab, $primary_id) {
123123
global $app, $conf;
124-
124+
125125
// Add backticks for incomplete table names.
126-
if(stristr($this->formDef['db_table'],'.')) {
127-
$escape = '';
128-
} else {
129-
$escape = '`';
130-
}
131-
126+
if(stristr($this->formDef['db_table'],'.')) {
127+
$escape = '';
128+
} else {
129+
$escape = '`';
130+
}
131+
132132
$sql = "SELECT sys_userid FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
133-
$record = $app->db->queryOneRecord($sql);
134-
133+
$record = $app->db->queryOneRecord($sql);
134+
135135
// return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record.
136136
if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
137137
return true;
138138
} else {
139139
return false;
140140
}
141-
}
142-
143-
141+
}
142+
143+
144144
// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
145145
function lng($msg) {
146146
global $app,$conf;
147-
147+
148148
if(isset($this->wordbook[$msg])) {
149149
return $this->wordbook[$msg];
150150
} else {
151151
return $app->lng($msg);
152152
}
153-
153+
154154
}
155-
155+
156156
function checkClientLimit($limit_name,$sql_where = '') {
157157
global $app;
158-
158+
159159
$check_passed = true;
160160
$limit_name = $app->db->quote($limit_name);
161161
if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
162-
162+
163163
// Get the limits of the client that is currently logged in
164164
$client_group_id = $_SESSION["s"]["user"]["default_group"];
165165
$client = $app->db->queryOneRecord("SELECT $limit_name as number, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
166-
166+
167167
// Check if the user may add another item
168168
if($client["number"] >= 0) {
169169
$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE ".$this->getAuthSQL('u');
170170
if($sql_where != '') $sql .= ' and '.$sql_where;
171171
$tmp = $app->db->queryOneRecord($sql);
172172
if($tmp["number"] >= $client["number"]) $check_passed = false;
173173
}
174-
174+
175175
return $check_passed;
176176
}
177-
177+
178178
function checkResellerLimit($limit_name,$sql_where = '') {
179179
global $app;
180-
180+
181181
$check_passed = true;
182182
$limit_name = $app->db->quote($limit_name);
183183
if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
184-
184+
185185
// Get the limits of the client that is currently logged in
186186
$client_group_id = $_SESSION["s"]["user"]["default_group"];
187187
$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
188-
188+
189189
//* If the client belongs to a reseller, we will check against the reseller Limit too
190190
if($client['parent_client_id'] != 0) {
191-
191+
192192
//* first we need to know the groups of this reseller
193193
$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
194194
$reseller_groups = $tmp["groups"];
195195
$reseller_userid = $tmp["userid"];
196-
196+
197197
// Get the limits of the reseller of the logged in client
198198
$client_group_id = $_SESSION["s"]["user"]["default_group"];
199199
$reseller = $app->db->queryOneRecord("SELECT $limit_name as number FROM client WHERE client_id = ".$client['parent_client_id']);
200-
200+
201201
// Check if the user may add another item
202202
if($reseller["number"] >= 0) {
203203
$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE (sys_groupid IN (".$reseller_groups.") or sys_userid = ".$reseller_userid.")";
@@ -206,13 +206,13 @@ function checkResellerLimit($limit_name,$sql_where = '') {
206206
if($tmp["number"] >= $reseller["number"]) $check_passed = false;
207207
}
208208
}
209-
209+
210210
return $check_passed;
211211
}
212-
212+
213213
//* get the difference record of two arrays
214214
function getDiffRecord($record_old,$record_new) {
215-
215+
216216
if(is_array($record_new) && count($record_new) > 0) {
217217
foreach($record_new as $key => $val) {
218218
if(@$record_old[$key] != $val) {
@@ -231,72 +231,72 @@ function getDiffRecord($record_old,$record_new) {
231231
}
232232
}
233233
return $diffrec;
234-
234+
235235
}
236-
236+
237237
/**
238238
* Generate HTML for DATETIME fields.
239-
*
239+
*
240240
* @access private
241241
* @param string $form_element Name of the form element.
242242
* @param string $default_value Selected value for fields.
243243
* @param bool $display_secons Include seconds selection.
244-
* @return string HTML
244+
* @return string HTML
245245
*/
246246
function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
247247
{
248248
$_datetime = strtotime($default_value);
249249
$_showdate = ($_datetime === false) ? false : true;
250250

251251
$dselect = array('day','month','year','hour','minute');
252-
if ($display_seconds === true) {
252+
if ($display_seconds === true) {
253253
$dselect[] = 'second';
254254
}
255-
255+
256256
$out = '';
257-
257+
258258
foreach ($dselect as $dt_element)
259259
{
260260
$dt_options = array();
261261
$dt_space = 1;
262-
262+
263263
switch ($dt_element) {
264264
case 'day':
265265
for ($i = 1; $i <= 31; $i++) {
266-
$dt_options[] = array('name' => sprintf('%02d', $i),
267-
'value' => sprintf('%d', $i));
268-
}
269-
$selected_value = date('d', $_datetime);
266+
$dt_options[] = array('name' => sprintf('%02d', $i),
267+
'value' => sprintf('%d', $i));
268+
}
269+
$selected_value = date('d', $_datetime);
270270
break;
271-
271+
272272
case 'month':
273273
for ($i = 1; $i <= 12; $i++) {
274-
$dt_options[] = array('name' => strftime('%b', mktime(0, 0, 0, $i, 1, 2000)),
275-
'value' => strftime('%m', mktime(0, 0, 0, $i, 1, 2000)));
276-
}
277-
$selected_value = date('n', $_datetime);
274+
$dt_options[] = array('name' => strftime('%b', mktime(0, 0, 0, $i, 1, 2000)),
275+
'value' => strftime('%m', mktime(0, 0, 0, $i, 1, 2000)));
276+
}
277+
$selected_value = date('n', $_datetime);
278278
break;
279-
279+
280280
case 'year':
281281
$start_year = strftime("%Y");
282282
$years = range((int)$start_year, (int)($start_year+3));
283-
284-
foreach ($years as $year) {
285-
$dt_options[] = array('name' => $year,
286-
'value' => $year);
287-
}
288-
$selected_value = date('Y', $_datetime);
289-
$dt_space = 2;
283+
284+
foreach ($years as $year) {
285+
$dt_options[] = array('name' => $year,
286+
'value' => $year);
287+
}
288+
$selected_value = date('Y', $_datetime);
289+
$dt_space = 2;
290290
break;
291-
291+
292292
case 'hour':
293293
foreach(range(0, 23) as $hour) {
294294
$dt_options[] = array('name' => sprintf('%02d', $hour),
295-
'value' => sprintf('%d', $hour));
295+
'value' => sprintf('%d', $hour));
296296
}
297297
$selected_value = date('G', $_datetime);
298298
break;
299-
299+
300300
case 'minute':
301301
foreach(range(0, 59) as $minute) {
302302
if (($minute % 5) == 0) {
@@ -306,34 +306,34 @@ function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
306306
}
307307
$selected_value = (int)floor(date('i', $_datetime));
308308
break;
309-
310-
case 'second':
309+
310+
case 'second':
311311
foreach(range(0, 59) as $second) {
312312
$dt_options[] = array('name' => sprintf('%02d', $second),
313-
'value' => sprintf('%d', $second));
313+
'value' => sprintf('%d', $second));
314314
}
315315
$selected_value = (int)floor(date('s', $_datetime));
316316
break;
317317
}
318-
318+
319319
$out .= "<select name=\"".$form_element."[$dt_element]\" id=\"".$form_element."_$dt_element\" class=\"selectInput\" style=\"width: auto; float: none;\">";
320320
if (!$_showdate) {
321321
$out .= "<option value=\"-\" selected=\"selected\">--</option>" . PHP_EOL;
322322
} else {
323323
$out .= "<option value=\"-\">--</option>" . PHP_EOL;
324324
}
325-
325+
326326
foreach ($dt_options as $dt_opt) {
327327
if ( $_showdate && ($selected_value == $dt_opt['value']) ) {
328328
$out .= "<option value=\"{$dt_opt['value']}\" selected=\"selected\">{$dt_opt['name']}</option>" . PHP_EOL;
329329
} else {
330330
$out .= "<option value=\"{$dt_opt['value']}\">{$dt_opt['name']}</option>" . PHP_EOL;
331331
}
332332
}
333-
333+
334334
$out .= '</select>' . str_repeat('&nbsp;', $dt_space);
335335
}
336-
336+
337337
return $out;
338338
}
339339
}

0 commit comments

Comments
 (0)