@@ -65,29 +65,29 @@ |
||
65 | 65 | */ |
66 | 66 | function smarty_function_multienum_to_array($params, &$smarty) |
67 | 67 | { |
68 | - $ret = ""; |
|
69 | - if(empty($params['string'])) { |
|
68 | + $ret = ""; |
|
69 | + if(empty($params['string'])) { |
|
70 | 70 | if (empty($params['default'])) |
71 | 71 | $ret = array(); |
72 | 72 | else if(is_array($params['default'])) |
73 | 73 | $ret = $params['default']; |
74 | 74 | else |
75 | - $ret = unencodeMultienum($params['default']); |
|
75 | + $ret = unencodeMultienum($params['default']); |
|
76 | 76 | } else { |
77 | - if (is_array($params['string'])) |
|
78 | - $ret = $params['string']; |
|
79 | - else |
|
80 | - $ret = unencodeMultienum($params['string']); |
|
77 | + if (is_array($params['string'])) |
|
78 | + $ret = $params['string']; |
|
79 | + else |
|
80 | + $ret = unencodeMultienum($params['string']); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | - if (!empty($params['assign'])) |
|
85 | - { |
|
86 | - $smarty->assign($params['assign'], $ret); |
|
87 | - return ""; |
|
88 | - } |
|
84 | + if (!empty($params['assign'])) |
|
85 | + { |
|
86 | + $smarty->assign($params['assign'], $ret); |
|
87 | + return ""; |
|
88 | + } |
|
89 | 89 | |
90 | - return ($ret); |
|
90 | + return ($ret); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | ?> |
@@ -66,10 +66,10 @@ |
||
66 | 66 | function smarty_function_multienum_to_array($params, &$smarty) |
67 | 67 | { |
68 | 68 | $ret = ""; |
69 | - if(empty($params['string'])) { |
|
69 | + if (empty($params['string'])) { |
|
70 | 70 | if (empty($params['default'])) |
71 | 71 | $ret = array(); |
72 | - else if(is_array($params['default'])) |
|
72 | + else if (is_array($params['default'])) |
|
73 | 73 | $ret = $params['default']; |
74 | 74 | else |
75 | 75 | $ret = unencodeMultienum($params['default']); |
@@ -67,17 +67,19 @@ |
||
67 | 67 | { |
68 | 68 | $ret = ""; |
69 | 69 | if(empty($params['string'])) { |
70 | - if (empty($params['default'])) |
|
71 | - $ret = array(); |
|
72 | - else if(is_array($params['default'])) |
|
73 | - $ret = $params['default']; |
|
74 | - else |
|
75 | - $ret = unencodeMultienum($params['default']); |
|
70 | + if (empty($params['default'])) { |
|
71 | + $ret = array(); |
|
72 | + } else if(is_array($params['default'])) { |
|
73 | + $ret = $params['default']; |
|
74 | + } else { |
|
75 | + $ret = unencodeMultienum($params['default']); |
|
76 | + } |
|
76 | 77 | } else { |
77 | - if (is_array($params['string'])) |
|
78 | - $ret = $params['string']; |
|
79 | - else |
|
80 | - $ret = unencodeMultienum($params['string']); |
|
78 | + if (is_array($params['string'])) { |
|
79 | + $ret = $params['string']; |
|
80 | + } else { |
|
81 | + $ret = unencodeMultienum($params['string']); |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | |
83 | 85 |
@@ -281,28 +281,28 @@ discard block |
||
281 | 281 | */ |
282 | 282 | function smarty_function_sugar_button($params, &$smarty) |
283 | 283 | { |
284 | - if(empty($params['module'])) { |
|
285 | - $smarty->trigger_error("sugar_button: missing required param (module)"); |
|
286 | - } else if(empty($params['id'])) { |
|
287 | - $smarty->trigger_error("sugar_button: missing required param (id)"); |
|
288 | - } else if(empty($params['view'])) { |
|
289 | - $smarty->trigger_error("sugar_button: missing required param (view)"); |
|
290 | - } |
|
291 | - |
|
292 | - $js_form = (empty($params['form_id'])) ? "var _form = (this.form) ? this.form : document.forms[0];" : "var _form = document.getElementById('{$params['form_id']}');"; |
|
293 | - |
|
294 | - $type = $params['id']; |
|
295 | - $location = (empty($params['location'])) ? "" : "_".$params['location']; |
|
296 | - |
|
297 | - if(!is_array($type)) { |
|
298 | - $module = $params['module']; |
|
299 | - $view = $params['view']; |
|
300 | - switch(strtoupper($type)) { |
|
301 | - case "SEARCH": |
|
284 | + if(empty($params['module'])) { |
|
285 | + $smarty->trigger_error("sugar_button: missing required param (module)"); |
|
286 | + } else if(empty($params['id'])) { |
|
287 | + $smarty->trigger_error("sugar_button: missing required param (id)"); |
|
288 | + } else if(empty($params['view'])) { |
|
289 | + $smarty->trigger_error("sugar_button: missing required param (view)"); |
|
290 | + } |
|
291 | + |
|
292 | + $js_form = (empty($params['form_id'])) ? "var _form = (this.form) ? this.form : document.forms[0];" : "var _form = document.getElementById('{$params['form_id']}');"; |
|
293 | + |
|
294 | + $type = $params['id']; |
|
295 | + $location = (empty($params['location'])) ? "" : "_".$params['location']; |
|
296 | + |
|
297 | + if(!is_array($type)) { |
|
298 | + $module = $params['module']; |
|
299 | + $view = $params['view']; |
|
300 | + switch(strtoupper($type)) { |
|
301 | + case "SEARCH": |
|
302 | 302 | $output = '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" onclick="SUGAR.savedViews.setChooser();" class="button" type="submit" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/> '; |
303 | - break; |
|
303 | + break; |
|
304 | 304 | |
305 | - case "CANCEL": |
|
305 | + case "CANCEL": |
|
306 | 306 | $cancelButton = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}'; |
307 | 307 | $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=DetailView&module={$smarty.request.return_module|escape:"url"}&record={$smarty.request.return_id|escape:"url"}\'); return false;" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" type="button" id="'.$type.$location.'"> '; |
308 | 308 | $cancelButton .= '{elseif !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($fields.id.value))}'; |
@@ -314,30 +314,30 @@ discard block |
||
314 | 314 | $cancelButton .= '{/if}'; |
315 | 315 | |
316 | 316 | $output = $cancelButton; |
317 | - break; |
|
317 | + break; |
|
318 | 318 | |
319 | - case "DELETE": |
|
319 | + case "DELETE": |
|
320 | 320 | $output = '{if $bean->aclAccess("delete")}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'ListView\'; _form.action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button">{/if} '; |
321 | 321 | break; |
322 | 322 | |
323 | - case "DUPLICATE": |
|
324 | - $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''. $module . '\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\'' . $view . '\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} '; |
|
323 | + case "DUPLICATE": |
|
324 | + $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''. $module . '\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\'' . $view . '\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} '; |
|
325 | 325 | break; |
326 | 326 | |
327 | - case "EDIT"; |
|
328 | - $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} '; |
|
327 | + case "EDIT"; |
|
328 | + $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} '; |
|
329 | 329 | break; |
330 | 330 | |
331 | - case "FIND_DUPLICATES": |
|
332 | - $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} '; |
|
331 | + case "FIND_DUPLICATES": |
|
332 | + $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} '; |
|
333 | 333 | break; |
334 | 334 | |
335 | - case "SAVE": |
|
336 | - $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
|
337 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
338 | - break; |
|
335 | + case "SAVE": |
|
336 | + $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
|
337 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
338 | + break; |
|
339 | 339 | |
340 | - case "SUBPANELSAVE": |
|
340 | + case "SUBPANELSAVE": |
|
341 | 341 | if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
342 | 342 | |
343 | 343 | /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ |
@@ -353,112 +353,111 @@ discard block |
||
353 | 353 | } |
354 | 354 | //if different here then change the group return right above |
355 | 355 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
356 | - |
|
357 | - */ |
|
356 | + */ |
|
358 | 357 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
359 | 358 | /* END - SECURITY GROUPS */ |
360 | 359 | |
361 | 360 | break; |
362 | - case "SUBPANELCANCEL": |
|
361 | + case "SUBPANELCANCEL": |
|
363 | 362 | $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
364 | 363 | |
365 | 364 | break; |
366 | - case "SUBPANELFULLFORM": |
|
365 | + case "SUBPANELFULLFORM": |
|
367 | 366 | $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
368 | 367 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
369 | 368 | break; |
370 | - case "DCMENUCANCEL": |
|
369 | + case "DCMENUCANCEL": |
|
371 | 370 | $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
372 | 371 | break; |
373 | - case "DCMENUSAVE": |
|
372 | + case "DCMENUSAVE": |
|
374 | 373 | if ($view == 'QuickCreate') { |
375 | 374 | $view = "form_DCQuickCreate_{$module}"; |
376 | 375 | } else if ($view == 'EditView') { |
377 | 376 | $view = "form_DCEditView_{$module}"; |
378 | 377 | } |
379 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
378 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
380 | 379 | break; |
381 | - case "DCMENUFULLFORM": |
|
380 | + case "DCMENUFULLFORM": |
|
382 | 381 | $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\'' . $params['module'] . '\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
383 | 382 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
384 | 383 | $output .= '<input type="hidden" name="is_admin" value="">'; |
385 | 384 | break; |
386 | - case "POPUPSAVE": |
|
387 | - $view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view; |
|
388 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
|
389 | - . 'class="button primary" onclick="'.$js_form.' _form.action.value=\'Popup\';' |
|
390 | - . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
391 | - . '_popupcreate_save_button" id="' . $params['module'] |
|
392 | - . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
385 | + case "POPUPSAVE": |
|
386 | + $view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view; |
|
387 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
|
388 | + . 'class="button primary" onclick="'.$js_form.' _form.action.value=\'Popup\';' |
|
389 | + . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
390 | + . '_popupcreate_save_button" id="' . $params['module'] |
|
391 | + . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
393 | 392 | break; |
394 | - case "POPUPCANCEL": |
|
393 | + case "POPUPCANCEL": |
|
395 | 394 | $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
396 | - . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
|
397 | - . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
398 | - . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
395 | + . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
|
396 | + . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
397 | + . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
399 | 398 | break; |
400 | - case "AUDIT": |
|
401 | - $popup_request_data = array( |
|
402 | - 'call_back_function' => 'set_return', |
|
403 | - 'form_name' => 'EditView', |
|
404 | - 'field_to_name_array' => array(), |
|
405 | - ); |
|
406 | - $json = getJSONobj(); |
|
407 | - |
|
408 | - require_once('include/SugarFields/Parsers/MetaParser.php'); |
|
409 | - $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
|
410 | - $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">'; |
|
399 | + case "AUDIT": |
|
400 | + $popup_request_data = array( |
|
401 | + 'call_back_function' => 'set_return', |
|
402 | + 'form_name' => 'EditView', |
|
403 | + 'field_to_name_array' => array(), |
|
404 | + ); |
|
405 | + $json = getJSONobj(); |
|
406 | + |
|
407 | + require_once('include/SugarFields/Parsers/MetaParser.php'); |
|
408 | + $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
|
409 | + $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">'; |
|
411 | 410 | $output = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
412 | 411 | break; |
413 | 412 | |
414 | 413 | |
415 | - } //switch |
|
416 | - if(isset($params['appendTo'])) { |
|
417 | - $smarty->append($params['appendTo'], $output); |
|
418 | - return; |
|
419 | - } |
|
420 | - return $output; |
|
421 | - } else if(is_array($type) && isset($type['sugar_html'])) { |
|
422 | - require_once('include/SugarHtml/SugarHtml.php'); |
|
423 | - |
|
424 | - $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']); |
|
425 | - replaceFormClick($dom_tree, $js_form); |
|
426 | - $output = SugarHtml::createHtml($dom_tree); |
|
427 | - |
|
428 | - if(isset($params['appendTo'])) { |
|
429 | - $smarty->append($params['appendTo'], $output); |
|
430 | - return; |
|
431 | - } |
|
432 | - return $output; |
|
433 | - } else if(is_array($type) && isset($type['customCode'])) { |
|
434 | - require_once('include/SugarHtml/SugarHtml.php'); |
|
435 | - |
|
436 | - $dom_tree = SugarHtml::parseHtmlTag($type['customCode']); |
|
437 | - $hidden_exists = false; |
|
438 | - |
|
439 | - replaceFormClick($dom_tree, $js_form, $hidden_exists); |
|
440 | - if($hidden_exists) { |
|
441 | - //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form |
|
442 | - $form = $smarty->get_template_vars('form'); |
|
443 | - $hidden_fields = $dom_tree; |
|
444 | - extractHiddenInputs($hidden_fields); |
|
445 | - if(!isset($form)) { |
|
446 | - $form = array(); |
|
447 | - } |
|
448 | - if(!isset($form['hidden'])) { |
|
449 | - $form['hidden'] = array(); |
|
450 | - } |
|
451 | - $form['hidden'][] = SugarHtml::createHtml($hidden_fields); |
|
452 | - $smarty->assign('form', $form); |
|
453 | - } |
|
454 | - $output = SugarHtml::createHtml($dom_tree); |
|
455 | - |
|
456 | - if(isset($params['appendTo'])) { |
|
457 | - $smarty->append($params['appendTo'], $output); |
|
458 | - return; |
|
459 | - } |
|
460 | - return $output; |
|
461 | - } |
|
414 | + } //switch |
|
415 | + if(isset($params['appendTo'])) { |
|
416 | + $smarty->append($params['appendTo'], $output); |
|
417 | + return; |
|
418 | + } |
|
419 | + return $output; |
|
420 | + } else if(is_array($type) && isset($type['sugar_html'])) { |
|
421 | + require_once('include/SugarHtml/SugarHtml.php'); |
|
422 | + |
|
423 | + $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']); |
|
424 | + replaceFormClick($dom_tree, $js_form); |
|
425 | + $output = SugarHtml::createHtml($dom_tree); |
|
426 | + |
|
427 | + if(isset($params['appendTo'])) { |
|
428 | + $smarty->append($params['appendTo'], $output); |
|
429 | + return; |
|
430 | + } |
|
431 | + return $output; |
|
432 | + } else if(is_array($type) && isset($type['customCode'])) { |
|
433 | + require_once('include/SugarHtml/SugarHtml.php'); |
|
434 | + |
|
435 | + $dom_tree = SugarHtml::parseHtmlTag($type['customCode']); |
|
436 | + $hidden_exists = false; |
|
437 | + |
|
438 | + replaceFormClick($dom_tree, $js_form, $hidden_exists); |
|
439 | + if($hidden_exists) { |
|
440 | + //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form |
|
441 | + $form = $smarty->get_template_vars('form'); |
|
442 | + $hidden_fields = $dom_tree; |
|
443 | + extractHiddenInputs($hidden_fields); |
|
444 | + if(!isset($form)) { |
|
445 | + $form = array(); |
|
446 | + } |
|
447 | + if(!isset($form['hidden'])) { |
|
448 | + $form['hidden'] = array(); |
|
449 | + } |
|
450 | + $form['hidden'][] = SugarHtml::createHtml($hidden_fields); |
|
451 | + $smarty->assign('form', $form); |
|
452 | + } |
|
453 | + $output = SugarHtml::createHtml($dom_tree); |
|
454 | + |
|
455 | + if(isset($params['appendTo'])) { |
|
456 | + $smarty->append($params['appendTo'], $output); |
|
457 | + return; |
|
458 | + } |
|
459 | + return $output; |
|
460 | + } |
|
462 | 461 | |
463 | 462 | } |
464 | 463 | /** |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | */ |
282 | 282 | function smarty_function_sugar_button($params, &$smarty) |
283 | 283 | { |
284 | - if(empty($params['module'])) { |
|
284 | + if (empty($params['module'])) { |
|
285 | 285 | $smarty->trigger_error("sugar_button: missing required param (module)"); |
286 | - } else if(empty($params['id'])) { |
|
286 | + } else if (empty($params['id'])) { |
|
287 | 287 | $smarty->trigger_error("sugar_button: missing required param (id)"); |
288 | - } else if(empty($params['view'])) { |
|
288 | + } else if (empty($params['view'])) { |
|
289 | 289 | $smarty->trigger_error("sugar_button: missing required param (view)"); |
290 | 290 | } |
291 | 291 | |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | $type = $params['id']; |
295 | 295 | $location = (empty($params['location'])) ? "" : "_".$params['location']; |
296 | 296 | |
297 | - if(!is_array($type)) { |
|
297 | + if (!is_array($type)) { |
|
298 | 298 | $module = $params['module']; |
299 | 299 | $view = $params['view']; |
300 | - switch(strtoupper($type)) { |
|
300 | + switch (strtoupper($type)) { |
|
301 | 301 | case "SEARCH": |
302 | 302 | $output = '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" onclick="SUGAR.savedViews.setChooser();" class="button" type="submit" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/> '; |
303 | 303 | break; |
@@ -317,28 +317,28 @@ discard block |
||
317 | 317 | break; |
318 | 318 | |
319 | 319 | case "DELETE": |
320 | - $output = '{if $bean->aclAccess("delete")}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'ListView\'; _form.action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button">{/if} '; |
|
320 | + $output = '{if $bean->aclAccess("delete")}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'ListView\'; _form.action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button">{/if} '; |
|
321 | 321 | break; |
322 | 322 | |
323 | 323 | case "DUPLICATE": |
324 | - $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''. $module . '\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\'' . $view . '\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} '; |
|
324 | + $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\''.$view.'\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} '; |
|
325 | 325 | break; |
326 | 326 | |
327 | 327 | case "EDIT"; |
328 | - $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} '; |
|
328 | + $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} '; |
|
329 | 329 | break; |
330 | 330 | |
331 | 331 | case "FIND_DUPLICATES": |
332 | - $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} '; |
|
332 | + $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\''.$module.'\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} '; |
|
333 | 333 | break; |
334 | 334 | |
335 | 335 | case "SAVE": |
336 | 336 | $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view); |
337 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
337 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\''.$view.'\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} '; |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case "SUBPANELSAVE": |
341 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
341 | + if ($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
342 | 342 | |
343 | 343 | /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ |
344 | 344 | /** |
@@ -355,20 +355,20 @@ discard block |
||
355 | 355 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
356 | 356 | |
357 | 357 | */ |
358 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
358 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \''.$params['module'].'_subpanel_save_button\');return false;" type="submit" name="'.$params['module'].'_subpanel_save_button" id="'.$params['module'].'_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
359 | 359 | /* END - SECURITY GROUPS */ |
360 | 360 | |
361 | 361 | break; |
362 | 362 | case "SUBPANELCANCEL": |
363 | - $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
363 | + $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="'.$params['module'].'_subpanel_cancel_button" id="'.$params['module'].'_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
364 | 364 | |
365 | 365 | break; |
366 | 366 | case "SUBPANELFULLFORM": |
367 | - $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
367 | + $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';" type="submit" name="'.$params['module'].'_subpanel_full_form_button" id="'.$params['module'].'_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
368 | 368 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
369 | 369 | break; |
370 | 370 | case "DCMENUCANCEL": |
371 | - $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
371 | + $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="'.$params['module'].'_dcmenu_cancel_button" id="'.$params['module'].'_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
372 | 372 | break; |
373 | 373 | case "DCMENUSAVE": |
374 | 374 | if ($view == 'QuickCreate') { |
@@ -376,10 +376,10 @@ discard block |
||
376 | 376 | } else if ($view == 'EditView') { |
377 | 377 | $view = "form_DCEditView_{$module}"; |
378 | 378 | } |
379 | - $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
379 | + $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \''.$params['module'].'_subpanel_save_button\');return false;" type="submit" name="'.$params['module'].'_dcmenu_save_button" id="'.$params['module'].'_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
|
380 | 380 | break; |
381 | 381 | case "DCMENUFULLFORM": |
382 | - $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\'' . $params['module'] . '\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
382 | + $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\''.$params['module'].'\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="'.$params['module'].'_subpanel_full_form_button" id="'.$params['module'].'_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> '; |
|
383 | 383 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
384 | 384 | $output .= '<input type="hidden" name="is_admin" value="">'; |
385 | 385 | break; |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | $view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view; |
388 | 388 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
389 | 389 | . 'class="button primary" onclick="'.$js_form.' _form.action.value=\'Popup\';' |
390 | - . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module'] |
|
391 | - . '_popupcreate_save_button" id="' . $params['module'] |
|
390 | + . 'return check_form(\''.$view.'\')" type="submit" name="'.$params['module'] |
|
391 | + . '_popupcreate_save_button" id="'.$params['module'] |
|
392 | 392 | . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
393 | 393 | break; |
394 | 394 | case "POPUPCANCEL": |
395 | 395 | $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
396 | 396 | . 'class="button" onclick="toggleDisplay(\'addform\');return false;" ' |
397 | - . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"' |
|
398 | - . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
397 | + . 'name="'.$params['module'].'_popup_cancel_button" type="submit"' |
|
398 | + . 'id="'.$params['module'].'_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
399 | 399 | break; |
400 | 400 | case "AUDIT": |
401 | 401 | $popup_request_data = array( |
@@ -407,45 +407,45 @@ discard block |
||
407 | 407 | |
408 | 408 | require_once('include/SugarFields/Parsers/MetaParser.php'); |
409 | 409 | $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data)); |
410 | - $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">'; |
|
410 | + $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name='.$params['module'].'", true, false, '.$encoded_popup_request_data.'); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">'; |
|
411 | 411 | $output = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
412 | 412 | break; |
413 | 413 | |
414 | 414 | |
415 | 415 | } //switch |
416 | - if(isset($params['appendTo'])) { |
|
416 | + if (isset($params['appendTo'])) { |
|
417 | 417 | $smarty->append($params['appendTo'], $output); |
418 | 418 | return; |
419 | 419 | } |
420 | 420 | return $output; |
421 | - } else if(is_array($type) && isset($type['sugar_html'])) { |
|
421 | + } else if (is_array($type) && isset($type['sugar_html'])) { |
|
422 | 422 | require_once('include/SugarHtml/SugarHtml.php'); |
423 | 423 | |
424 | 424 | $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']); |
425 | 425 | replaceFormClick($dom_tree, $js_form); |
426 | 426 | $output = SugarHtml::createHtml($dom_tree); |
427 | 427 | |
428 | - if(isset($params['appendTo'])) { |
|
428 | + if (isset($params['appendTo'])) { |
|
429 | 429 | $smarty->append($params['appendTo'], $output); |
430 | 430 | return; |
431 | 431 | } |
432 | 432 | return $output; |
433 | - } else if(is_array($type) && isset($type['customCode'])) { |
|
433 | + } else if (is_array($type) && isset($type['customCode'])) { |
|
434 | 434 | require_once('include/SugarHtml/SugarHtml.php'); |
435 | 435 | |
436 | 436 | $dom_tree = SugarHtml::parseHtmlTag($type['customCode']); |
437 | 437 | $hidden_exists = false; |
438 | 438 | |
439 | 439 | replaceFormClick($dom_tree, $js_form, $hidden_exists); |
440 | - if($hidden_exists) { |
|
440 | + if ($hidden_exists) { |
|
441 | 441 | //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form |
442 | 442 | $form = $smarty->get_template_vars('form'); |
443 | 443 | $hidden_fields = $dom_tree; |
444 | 444 | extractHiddenInputs($hidden_fields); |
445 | - if(!isset($form)) { |
|
445 | + if (!isset($form)) { |
|
446 | 446 | $form = array(); |
447 | 447 | } |
448 | - if(!isset($form['hidden'])) { |
|
448 | + if (!isset($form['hidden'])) { |
|
449 | 449 | $form['hidden'] = array(); |
450 | 450 | } |
451 | 451 | $form['hidden'][] = SugarHtml::createHtml($hidden_fields); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | } |
454 | 454 | $output = SugarHtml::createHtml($dom_tree); |
455 | 455 | |
456 | - if(isset($params['appendTo'])) { |
|
456 | + if (isset($params['appendTo'])) { |
|
457 | 457 | $smarty->append($params['appendTo'], $output); |
458 | 458 | return; |
459 | 459 | } |
@@ -475,21 +475,21 @@ discard block |
||
475 | 475 | $set_submit = false; |
476 | 476 | $is_hidden_field = false; |
477 | 477 | //if the code is wrapped with the form element, it will escape the operation for JS replacement |
478 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
478 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
479 | 479 | return false; |
480 | 480 | |
481 | - if(isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
|
481 | + if (isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
|
482 | 482 | $is_hidden_field = true; |
483 | 483 | } |
484 | 484 | |
485 | 485 | //Replace the JS syntax where the sugar_button contains the event handler for this.form |
486 | - if(isset($dom_tree['onclick'])) { |
|
487 | - if(strpos($dom_tree['onclick'], "this.form") !== false) { |
|
486 | + if (isset($dom_tree['onclick'])) { |
|
487 | + if (strpos($dom_tree['onclick'], "this.form") !== false) { |
|
488 | 488 | $dom_tree['onclick'] = str_replace("this.form", "_form", $dom_tree['onclick']); |
489 | - if(substr($dom_tree['onclick'], -1) != ';') |
|
489 | + if (substr($dom_tree['onclick'], -1) != ';') |
|
490 | 490 | $dom_tree['onclick'] .= ";"; |
491 | 491 | //Onclick handler contains returning a variable, for example it prompts a confirm message. |
492 | - if(strpos($dom_tree['onclick'], "return ") !== false ) { |
|
492 | + if (strpos($dom_tree['onclick'], "return ") !== false) { |
|
493 | 493 | $dom_tree['onclick'] = $js_form.' var _onclick=(function(){ldelim}'.$dom_tree['onclick']."{rdelim}()); if(_onclick!==false) _form.submit();"; |
494 | 494 | } else { |
495 | 495 | $dom_tree['onclick'] = $js_form.$dom_tree['onclick']."_form.submit();"; |
@@ -498,19 +498,19 @@ discard block |
||
498 | 498 | $set_submit = true; |
499 | 499 | } |
500 | 500 | } |
501 | - foreach($dom_tree as $key => $sub_tree) { |
|
502 | - if(is_array($sub_tree)) { |
|
501 | + foreach ($dom_tree as $key => $sub_tree) { |
|
502 | + if (is_array($sub_tree)) { |
|
503 | 503 | list($_submit, $_hidden) = replaceFormClick($dom_tree[$key], $js_form, $hidden_field_exists); |
504 | 504 | $set_submit = ($set_submit) ? $set_submit : $_submit; |
505 | 505 | $is_hidden_field = ($is_hidden_field) ? $is_hidden_field : $_hidden; |
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
509 | - if($set_submit && isset($dom_tree['type'])) { |
|
509 | + if ($set_submit && isset($dom_tree['type'])) { |
|
510 | 510 | $dom_tree['type'] = "button"; |
511 | 511 | $set_submit = false; |
512 | 512 | } |
513 | - if($is_hidden_field && isset($dom_tree['tag']) && $dom_tree['tag'] == 'input' ) { |
|
513 | + if ($is_hidden_field && isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
514 | 514 | $hidden_field_exists = true; |
515 | 515 | $is_hidden_field = false; |
516 | 516 | } |
@@ -527,20 +527,20 @@ discard block |
||
527 | 527 | 'hidden' |
528 | 528 | ); |
529 | 529 | //all hidden fields in the form elements must NOT attach in the original form |
530 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
530 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
531 | 531 | $dom_tree = array(); |
532 | 532 | } |
533 | - foreach($dom_tree as $key => $sub_tree) { |
|
534 | - if(is_numeric($key) && isset($sub_tree['tag']) && $sub_tree['tag'] == 'input') { |
|
535 | - if( !isset($sub_tree['type']) || in_array($sub_tree['type'], $allow_types) === false ) { |
|
533 | + foreach ($dom_tree as $key => $sub_tree) { |
|
534 | + if (is_numeric($key) && isset($sub_tree['tag']) && $sub_tree['tag'] == 'input') { |
|
535 | + if (!isset($sub_tree['type']) || in_array($sub_tree['type'], $allow_types) === false) { |
|
536 | 536 | unset($dom_tree[$key]); |
537 | 537 | } |
538 | - } else if(is_array($sub_tree)) { |
|
538 | + } else if (is_array($sub_tree)) { |
|
539 | 539 | extractHiddenInputs($dom_tree[$key]); |
540 | 540 | } |
541 | 541 | } |
542 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
543 | - if( !isset($dom_tree['type']) || in_array($dom_tree['type'], $allow_types) === false ) { |
|
542 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
543 | + if (!isset($dom_tree['type']) || in_array($dom_tree['type'], $allow_types) === false) { |
|
544 | 544 | $dom_tree = array(); |
545 | 545 | } |
546 | 546 | } |
@@ -338,7 +338,9 @@ discard block |
||
338 | 338 | break; |
339 | 339 | |
340 | 340 | case "SUBPANELSAVE": |
341 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
341 | + if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) { |
|
342 | + $view = "form_SubpanelQuickCreate_{$module}"; |
|
343 | + } |
|
342 | 344 | |
343 | 345 | /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ |
344 | 346 | /** |
@@ -475,8 +477,9 @@ discard block |
||
475 | 477 | $set_submit = false; |
476 | 478 | $is_hidden_field = false; |
477 | 479 | //if the code is wrapped with the form element, it will escape the operation for JS replacement |
478 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
479 | - return false; |
|
480 | + if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
481 | + return false; |
|
482 | + } |
|
480 | 483 | |
481 | 484 | if(isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
482 | 485 | $is_hidden_field = true; |
@@ -486,8 +489,9 @@ discard block |
||
486 | 489 | if(isset($dom_tree['onclick'])) { |
487 | 490 | if(strpos($dom_tree['onclick'], "this.form") !== false) { |
488 | 491 | $dom_tree['onclick'] = str_replace("this.form", "_form", $dom_tree['onclick']); |
489 | - if(substr($dom_tree['onclick'], -1) != ';') |
|
490 | - $dom_tree['onclick'] .= ";"; |
|
492 | + if(substr($dom_tree['onclick'], -1) != ';') { |
|
493 | + $dom_tree['onclick'] .= ";"; |
|
494 | + } |
|
491 | 495 | //Onclick handler contains returning a variable, for example it prompts a confirm message. |
492 | 496 | if(strpos($dom_tree['onclick'], "return ") !== false ) { |
493 | 497 | $dom_tree['onclick'] = $js_form.' var _onclick=(function(){ldelim}'.$dom_tree['onclick']."{rdelim}()); if(_onclick!==false) _form.submit();"; |
@@ -16,14 +16,14 @@ |
||
16 | 16 | */ |
17 | 17 | function smarty_make_timestamp($string) |
18 | 18 | { |
19 | - if(empty($string)) { |
|
19 | + if (empty($string)) { |
|
20 | 20 | // use "now": |
21 | 21 | $time = time(); |
22 | 22 | |
23 | 23 | } elseif (preg_match('/^\d{14}$/', $string)) { |
24 | 24 | // it is mysql timestamp format of YYYYMMDDHHMMSS? |
25 | - $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2), |
|
26 | - substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); |
|
25 | + $time = mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), |
|
26 | + substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4)); |
|
27 | 27 | |
28 | 28 | } elseif (is_numeric($string)) { |
29 | 29 | // it is a numeric string, we handle it as timestamp |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Smarty shared plugin |
|
4 | - * @package Smarty |
|
5 | - * @subpackage plugins |
|
6 | - */ |
|
3 | + * Smarty shared plugin |
|
4 | + * @package Smarty |
|
5 | + * @subpackage plugins |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | |
9 | 9 | /** |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } elseif (preg_match('/^\d{14}$/', $string)) { |
24 | 24 | // it is mysql timestamp format of YYYYMMDDHHMMSS? |
25 | 25 | $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2), |
26 | - substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); |
|
26 | + substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); |
|
27 | 27 | |
28 | 28 | } elseif (is_numeric($string)) { |
29 | 29 | // it is a numeric string, we handle it as timestamp |
@@ -44,9 +44,9 @@ |
||
44 | 44 | */ |
45 | 45 | function smarty_modifier_in_array($needle = null, $haystack = null) |
46 | 46 | { |
47 | - //Smarty barfs if Array is empty |
|
47 | + //Smarty barfs if Array is empty |
|
48 | 48 | if($haystack == null || empty($haystack)) { |
49 | - return false; |
|
49 | + return false; |
|
50 | 50 | } |
51 | 51 | return in_array($needle, $haystack); |
52 | 52 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | function smarty_modifier_in_array($needle = null, $haystack = null) |
46 | 46 | { |
47 | 47 | //Smarty barfs if Array is empty |
48 | - if($haystack == null || empty($haystack)) { |
|
48 | + if ($haystack == null || empty($haystack)) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | return in_array($needle, $haystack); |
@@ -39,24 +39,24 @@ |
||
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * smarty_function_sugar_email_btn |
|
44 | - * This is the constructor for the Smarty plugin. |
|
45 | - * This function exists so that the proper email button based on user prefs is loaded into the quotes module. |
|
46 | - * |
|
47 | - * @param $params The runtime Smarty key/value arguments |
|
48 | - * @param $smarty The reference to the Smarty object used in this invocation |
|
49 | - */ |
|
42 | + /** |
|
43 | + * smarty_function_sugar_email_btn |
|
44 | + * This is the constructor for the Smarty plugin. |
|
45 | + * This function exists so that the proper email button based on user prefs is loaded into the quotes module. |
|
46 | + * |
|
47 | + * @param $params The runtime Smarty key/value arguments |
|
48 | + * @param $smarty The reference to the Smarty object used in this invocation |
|
49 | + */ |
|
50 | 50 | function smarty_function_sugar_email_btn($params, &$smarty) |
51 | 51 | { |
52 | - global $app_strings, $current_user; |
|
53 | - $pdfButtons = ''; |
|
54 | - $client = $current_user->getPreference('email_link_type'); |
|
55 | - if ($client != 'sugar') { |
|
56 | - $pdfButtons = '<input title="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" onclick="location.href=\'mailto:\';return false;"> '; |
|
57 | - } else { |
|
58 | - $pdfButtons = '<input id="email_as_pdf_button" title="'. $app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"] . '" onclick="this.form.email_action.value=\'EmailLayout\';"> '; |
|
59 | - } |
|
60 | - return $pdfButtons; |
|
52 | + global $app_strings, $current_user; |
|
53 | + $pdfButtons = ''; |
|
54 | + $client = $current_user->getPreference('email_link_type'); |
|
55 | + if ($client != 'sugar') { |
|
56 | + $pdfButtons = '<input title="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" onclick="location.href=\'mailto:\';return false;"> '; |
|
57 | + } else { |
|
58 | + $pdfButtons = '<input id="email_as_pdf_button" title="'. $app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"] . '" onclick="this.form.email_action.value=\'EmailLayout\';"> '; |
|
59 | + } |
|
60 | + return $pdfButtons; |
|
61 | 61 | } |
62 | 62 | ?> |
@@ -53,9 +53,9 @@ |
||
53 | 53 | $pdfButtons = ''; |
54 | 54 | $client = $current_user->getPreference('email_link_type'); |
55 | 55 | if ($client != 'sugar') { |
56 | - $pdfButtons = '<input title="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" onclick="location.href=\'mailto:\';return false;"> '; |
|
56 | + $pdfButtons = '<input title="'.$app_strings["LBL_EMAIL_COMPOSE"].'" class="button" type="submit" name="button" value="'.$app_strings["LBL_EMAIL_COMPOSE"].'" onclick="location.href=\'mailto:\';return false;"> '; |
|
57 | 57 | } else { |
58 | - $pdfButtons = '<input id="email_as_pdf_button" title="'. $app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"] . '" onclick="this.form.email_action.value=\'EmailLayout\';"> '; |
|
58 | + $pdfButtons = '<input id="email_as_pdf_button" title="'.$app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"].'" class="button" type="submit" name="button" value="'.$app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"].'" onclick="this.form.email_action.value=\'EmailLayout\';"> '; |
|
59 | 59 | } |
60 | 60 | return $pdfButtons; |
61 | 61 | } |
@@ -42,9 +42,9 @@ |
||
42 | 42 | |
43 | 43 | |
44 | 44 | function smarty_modifier_lookup($value='', $from=array()){ |
45 | - $value = trim($value); |
|
46 | - if (array_key_exists($value, $from)) { |
|
47 | - return $from[$value]; |
|
48 | - } |
|
49 | - return ''; |
|
45 | + $value = trim($value); |
|
46 | + if (array_key_exists($value, $from)) { |
|
47 | + return $from[$value]; |
|
48 | + } |
|
49 | + return ''; |
|
50 | 50 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
4 | 4 | /********************************************************************************* |
5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
6 | 6 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | -function smarty_modifier_lookup($value='', $from=array()){ |
|
44 | +function smarty_modifier_lookup($value = '', $from = array()) { |
|
45 | 45 | $value = trim($value); |
46 | 46 | if (array_key_exists($value, $from)) { |
47 | 47 | return $from[$value]; |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -74,14 +74,14 @@ |
||
74 | 74 | |
75 | 75 | function smarty_function_sugarvar_connector($params, &$smarty) { |
76 | 76 | |
77 | - $displayParams = $smarty->get_template_vars('displayParams'); |
|
78 | - if(!isset($displayParams['module'])) { |
|
79 | - $smarty->trigger_error("sugarvar_connector: missing 'module' parameter"); |
|
80 | - $GLOBALS['log']->error("sugarvar_connector: missing 'module' parameter"); |
|
81 | - return; |
|
82 | - } |
|
77 | + $displayParams = $smarty->get_template_vars('displayParams'); |
|
78 | + if(!isset($displayParams['module'])) { |
|
79 | + $smarty->trigger_error("sugarvar_connector: missing 'module' parameter"); |
|
80 | + $GLOBALS['log']->error("sugarvar_connector: missing 'module' parameter"); |
|
81 | + return; |
|
82 | + } |
|
83 | 83 | |
84 | - require_once('include/connectors/utils/ConnectorUtils.php'); |
|
85 | - echo ConnectorUtils::getConnectorButtonScript($displayParams, $smarty); |
|
84 | + require_once('include/connectors/utils/ConnectorUtils.php'); |
|
85 | + echo ConnectorUtils::getConnectorButtonScript($displayParams, $smarty); |
|
86 | 86 | } |
87 | 87 | ?> |
88 | 88 | \ No newline at end of file |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | |
34 | 34 | |
35 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
35 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
36 | 36 | /********************************************************************************* |
37 | 37 | * SugarCRM Community Edition is a customer relationship management program developed by |
38 | 38 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | function smarty_function_sugarvar_connector($params, &$smarty) { |
76 | 76 | |
77 | 77 | $displayParams = $smarty->get_template_vars('displayParams'); |
78 | - if(!isset($displayParams['module'])) { |
|
78 | + if (!isset($displayParams['module'])) { |
|
79 | 79 | $smarty->trigger_error("sugarvar_connector: missing 'module' parameter"); |
80 | 80 | $GLOBALS['log']->error("sugarvar_connector: missing 'module' parameter"); |
81 | 81 | return; |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -57,33 +57,33 @@ |
||
57 | 57 | global $app_strings; |
58 | 58 | |
59 | 59 | if(isset($params['type']) && $params['type'] == 'php') { |
60 | - if(!isset($params['file'])) { |
|
61 | - $smarty->trigger_error($app_strings['ERR_MISSING_REQUIRED_FIELDS'] . 'include'); |
|
62 | - } |
|
60 | + if(!isset($params['file'])) { |
|
61 | + $smarty->trigger_error($app_strings['ERR_MISSING_REQUIRED_FIELDS'] . 'include'); |
|
62 | + } |
|
63 | 63 | |
64 | - $includeFile = $params['file']; |
|
65 | - if(!file_exists($includeFile)) { |
|
66 | - $smarty->trigger_error($app_strings['ERR_NO_SUCH_FILE'] . ': ' . $includeFile); |
|
67 | - } |
|
64 | + $includeFile = $params['file']; |
|
65 | + if(!file_exists($includeFile)) { |
|
66 | + $smarty->trigger_error($app_strings['ERR_NO_SUCH_FILE'] . ': ' . $includeFile); |
|
67 | + } |
|
68 | 68 | |
69 | - ob_start(); |
|
70 | - require($includeFile); |
|
71 | - $output_html = ob_get_contents(); |
|
72 | - ob_end_clean(); |
|
73 | - echo $output_html; |
|
69 | + ob_start(); |
|
70 | + require($includeFile); |
|
71 | + $output_html = ob_get_contents(); |
|
72 | + ob_end_clean(); |
|
73 | + echo $output_html; |
|
74 | 74 | } else if(is_array($params['include'])) { |
75 | - $code = ''; |
|
76 | - foreach($params['include'] as $include) { |
|
77 | - if(isset($include['file'])) { |
|
78 | - $file = $include['file']; |
|
79 | - if(preg_match('/[\.]js$/si',$file)) { |
|
80 | - $code .= "<script src=\"". getJSPath($include['file']) ."\"></script>"; |
|
81 | - } else if(preg_match('/[\.]php$/si', $file)) { |
|
82 | - require_once($file); |
|
83 | - } |
|
84 | - } |
|
85 | - } //foreach |
|
86 | - return $code; |
|
87 | - } //if |
|
75 | + $code = ''; |
|
76 | + foreach($params['include'] as $include) { |
|
77 | + if(isset($include['file'])) { |
|
78 | + $file = $include['file']; |
|
79 | + if(preg_match('/[\.]js$/si',$file)) { |
|
80 | + $code .= "<script src=\"". getJSPath($include['file']) ."\"></script>"; |
|
81 | + } else if(preg_match('/[\.]php$/si', $file)) { |
|
82 | + require_once($file); |
|
83 | + } |
|
84 | + } |
|
85 | + } //foreach |
|
86 | + return $code; |
|
87 | + } //if |
|
88 | 88 | } |
89 | 89 | ?> |
90 | 90 | \ No newline at end of file |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | { |
57 | 57 | global $app_strings; |
58 | 58 | |
59 | - if(isset($params['type']) && $params['type'] == 'php') { |
|
60 | - if(!isset($params['file'])) { |
|
61 | - $smarty->trigger_error($app_strings['ERR_MISSING_REQUIRED_FIELDS'] . 'include'); |
|
59 | + if (isset($params['type']) && $params['type'] == 'php') { |
|
60 | + if (!isset($params['file'])) { |
|
61 | + $smarty->trigger_error($app_strings['ERR_MISSING_REQUIRED_FIELDS'].'include'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $includeFile = $params['file']; |
65 | - if(!file_exists($includeFile)) { |
|
66 | - $smarty->trigger_error($app_strings['ERR_NO_SUCH_FILE'] . ': ' . $includeFile); |
|
65 | + if (!file_exists($includeFile)) { |
|
66 | + $smarty->trigger_error($app_strings['ERR_NO_SUCH_FILE'].': '.$includeFile); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | ob_start(); |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | $output_html = ob_get_contents(); |
72 | 72 | ob_end_clean(); |
73 | 73 | echo $output_html; |
74 | - } else if(is_array($params['include'])) { |
|
74 | + } else if (is_array($params['include'])) { |
|
75 | 75 | $code = ''; |
76 | - foreach($params['include'] as $include) { |
|
77 | - if(isset($include['file'])) { |
|
76 | + foreach ($params['include'] as $include) { |
|
77 | + if (isset($include['file'])) { |
|
78 | 78 | $file = $include['file']; |
79 | - if(preg_match('/[\.]js$/si',$file)) { |
|
80 | - $code .= "<script src=\"". getJSPath($include['file']) ."\"></script>"; |
|
81 | - } else if(preg_match('/[\.]php$/si', $file)) { |
|
79 | + if (preg_match('/[\.]js$/si', $file)) { |
|
80 | + $code .= "<script src=\"".getJSPath($include['file'])."\"></script>"; |
|
81 | + } else if (preg_match('/[\.]php$/si', $file)) { |
|
82 | 82 | require_once($file); |
83 | 83 | } |
84 | 84 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | // matches all valid variables (no quotes, no modifiers) |
132 | 132 | $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' |
133 | - . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; |
|
133 | + . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; |
|
134 | 134 | |
135 | 135 | // matches valid variable syntax: |
136 | 136 | // $foo |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // |foo|bar |
173 | 173 | // |foo:$foo->bar |
174 | 174 | $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|' |
175 | - . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; |
|
175 | + . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; |
|
176 | 176 | |
177 | 177 | // matches valid function name: |
178 | 178 | // foo123 |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // "text"|bar |
194 | 194 | // $foo->bar |
195 | 195 | $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|' |
196 | - . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; |
|
196 | + . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; |
|
197 | 197 | |
198 | 198 | // matches valid parenthesised function parameters: |
199 | 199 | // |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // _foo_bar($foo,"bar") |
211 | 211 | // foo123($foo,$foo->bar(),"foo") |
212 | 212 | $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:' |
213 | - . $this->_parenth_param_regexp . '))'; |
|
213 | + . $this->_parenth_param_regexp . '))'; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | |
264 | 264 | /* replace special blocks by "{php}" */ |
265 | 265 | $source_content = preg_replace_callback($search, create_function ('$matches', "return '" |
266 | - . $this->_quote_replace($this->left_delimiter) . 'php' |
|
267 | - . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'" |
|
268 | - . $this->_quote_replace($this->right_delimiter) |
|
269 | - . "';") |
|
270 | - , $source_content); |
|
266 | + . $this->_quote_replace($this->left_delimiter) . 'php' |
|
267 | + . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'" |
|
268 | + . $this->_quote_replace($this->right_delimiter) |
|
269 | + . "';") |
|
270 | + , $source_content); |
|
271 | 271 | |
272 | 272 | /* Gather all template tags. */ |
273 | 273 | preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match); |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if ($postfilter === false) continue; |
389 | 389 | if ($postfilter[3] || is_callable($postfilter[0])) { |
390 | 390 | $compiled_content = call_user_func_array($postfilter[0], |
391 | - array($compiled_content, &$this)); |
|
391 | + array($compiled_content, &$this)); |
|
392 | 392 | $this->_plugins['postfilter'][$filter_name][3] = true; |
393 | 393 | } else { |
394 | 394 | $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented"); |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | $output = call_user_func_array($plugin_func, array($tag_args, &$this)); |
650 | 650 | if($output != '') { |
651 | 651 | $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command) |
652 | - . $output |
|
653 | - . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; |
|
652 | + . $output |
|
653 | + . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; |
|
654 | 654 | } |
655 | 655 | } else { |
656 | 656 | $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; |
1116 | 1116 | else |
1117 | 1117 | $output .= "if ({$section_props}['max'] < 0)\n" . |
1118 | - " {$section_props}['max'] = {$section_props}['loop'];\n"; |
|
1118 | + " {$section_props}['max'] = {$section_props}['loop'];\n"; |
|
1119 | 1119 | |
1120 | 1120 | if (!isset($attrs['step'])) |
1121 | 1121 | $output .= "{$section_props}['step'] = 1;\n"; |
@@ -1124,9 +1124,9 @@ discard block |
||
1124 | 1124 | $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; |
1125 | 1125 | else { |
1126 | 1126 | $output .= "if ({$section_props}['start'] < 0)\n" . |
1127 | - " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . |
|
1128 | - "else\n" . |
|
1129 | - " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; |
|
1127 | + " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . |
|
1128 | + "else\n" . |
|
1129 | + " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | $output .= "if ({$section_props}['show']) {\n"; |
@@ -1136,9 +1136,9 @@ discard block |
||
1136 | 1136 | $output .= " {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n"; |
1137 | 1137 | } |
1138 | 1138 | $output .= " if ({$section_props}['total'] == 0)\n" . |
1139 | - " {$section_props}['show'] = false;\n" . |
|
1140 | - "} else\n" . |
|
1141 | - " {$section_props}['total'] = 0;\n"; |
|
1139 | + " {$section_props}['show'] = false;\n" . |
|
1140 | + "} else\n" . |
|
1141 | + " {$section_props}['total'] = 0;\n"; |
|
1142 | 1142 | |
1143 | 1143 | $output .= "if ({$section_props}['show']):\n"; |
1144 | 1144 | $output .= " |
@@ -1987,8 +1987,8 @@ discard block |
||
1987 | 1987 | } |
1988 | 1988 | if (!isset($this->_plugin_info[$type][$name])) { |
1989 | 1989 | $this->_plugin_info[$type][$name] = array($this->_current_file, |
1990 | - $this->_current_line_no, |
|
1991 | - $delayed_loading); |
|
1990 | + $this->_current_line_no, |
|
1991 | + $delayed_loading); |
|
1992 | 1992 | } |
1993 | 1993 | } |
1994 | 1994 | |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | case 'get': |
2057 | 2057 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2058 | 2058 | $this->_syntax_error("(secure mode) super global access not permitted", |
2059 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2059 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2060 | 2060 | return; |
2061 | 2061 | } |
2062 | 2062 | $compiled_ref = "\$_GET"; |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | case 'post': |
2066 | 2066 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2067 | 2067 | $this->_syntax_error("(secure mode) super global access not permitted", |
2068 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2068 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2069 | 2069 | return; |
2070 | 2070 | } |
2071 | 2071 | $compiled_ref = "\$_POST"; |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | case 'cookies': |
2075 | 2075 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2076 | 2076 | $this->_syntax_error("(secure mode) super global access not permitted", |
2077 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2077 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2078 | 2078 | return; |
2079 | 2079 | } |
2080 | 2080 | $compiled_ref = "\$_COOKIE"; |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | case 'env': |
2084 | 2084 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2085 | 2085 | $this->_syntax_error("(secure mode) super global access not permitted", |
2086 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2086 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2087 | 2087 | return; |
2088 | 2088 | } |
2089 | 2089 | $compiled_ref = "\$_ENV"; |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | case 'server': |
2093 | 2093 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2094 | 2094 | $this->_syntax_error("(secure mode) super global access not permitted", |
2095 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2095 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2096 | 2096 | return; |
2097 | 2097 | } |
2098 | 2098 | $compiled_ref = "\$_SERVER"; |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | case 'session': |
2102 | 2102 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2103 | 2103 | $this->_syntax_error("(secure mode) super global access not permitted", |
2104 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2104 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2105 | 2105 | return; |
2106 | 2106 | } |
2107 | 2107 | $compiled_ref = "\$_SESSION"; |
@@ -2114,7 +2114,7 @@ discard block |
||
2114 | 2114 | case 'request': |
2115 | 2115 | if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) { |
2116 | 2116 | $this->_syntax_error("(secure mode) super global access not permitted", |
2117 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2117 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2118 | 2118 | return; |
2119 | 2119 | } |
2120 | 2120 | if ($this->request_use_auto_globals) { |
@@ -2141,7 +2141,7 @@ discard block |
||
2141 | 2141 | case 'const': |
2142 | 2142 | if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) { |
2143 | 2143 | $this->_syntax_error("(secure mode) constants not permitted", |
2144 | - E_USER_WARNING, __FILE__, __LINE__); |
|
2144 | + E_USER_WARNING, __FILE__, __LINE__); |
|
2145 | 2145 | return; |
2146 | 2146 | } |
2147 | 2147 | array_shift($indexes); |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | return ((is_object($this->_plugins[$type][$name][0][0])) ? |
2198 | 2198 | "\$this->_plugins['$type']['$name'][0][0]->" /* method callback */ |
2199 | 2199 | : (string)($this->_plugins[$type][$name][0][0]).'::' /* class callback */ |
2200 | - ). $this->_plugins[$type][$name][0][1]; |
|
2200 | + ). $this->_plugins[$type][$name][0][1]; |
|
2201 | 2201 | |
2202 | 2202 | } else { |
2203 | 2203 | /* function callback */ |
@@ -2342,7 +2342,7 @@ discard block |
||
2342 | 2342 | $message = " expected {/$_open_tag} (opened line $_line_no)."; |
2343 | 2343 | } |
2344 | 2344 | $this->_syntax_error("mismatched tag {/$close_tag}.$message", |
2345 | - E_USER_ERROR, __FILE__, __LINE__); |
|
2345 | + E_USER_ERROR, __FILE__, __LINE__); |
|
2346 | 2346 | } |
2347 | 2347 | |
2348 | 2348 | } |
@@ -38,41 +38,41 @@ discard block |
||
38 | 38 | /**#@+ |
39 | 39 | * @access private |
40 | 40 | */ |
41 | - var $_folded_blocks = array(); // keeps folded template blocks |
|
42 | - var $_current_file = null; // the current template being compiled |
|
43 | - var $_current_line_no = 1; // line number for error messages |
|
44 | - var $_capture_stack = array(); // keeps track of nested capture buffers |
|
45 | - var $_plugin_info = array(); // keeps track of plugins to load |
|
46 | - var $_init_smarty_vars = false; |
|
47 | - var $_permitted_tokens = array('true','false','yes','no','on','off','null'); |
|
48 | - var $_db_qstr_regexp = null; // regexps are setup in the constructor |
|
49 | - var $_si_qstr_regexp = null; |
|
50 | - var $_qstr_regexp = null; |
|
51 | - var $_func_regexp = null; |
|
52 | - var $_reg_obj_regexp = null; |
|
53 | - var $_var_bracket_regexp = null; |
|
54 | - var $_num_const_regexp = null; |
|
55 | - var $_dvar_guts_regexp = null; |
|
56 | - var $_dvar_regexp = null; |
|
57 | - var $_cvar_regexp = null; |
|
58 | - var $_svar_regexp = null; |
|
59 | - var $_avar_regexp = null; |
|
60 | - var $_mod_regexp = null; |
|
61 | - var $_var_regexp = null; |
|
62 | - var $_parenth_param_regexp = null; |
|
63 | - var $_func_call_regexp = null; |
|
64 | - var $_obj_ext_regexp = null; |
|
65 | - var $_obj_start_regexp = null; |
|
66 | - var $_obj_params_regexp = null; |
|
67 | - var $_obj_call_regexp = null; |
|
68 | - var $_cacheable_state = 0; |
|
69 | - var $_cache_attrs_count = 0; |
|
70 | - var $_nocache_count = 0; |
|
71 | - var $_cache_serial = null; |
|
72 | - var $_cache_include = null; |
|
73 | - |
|
74 | - var $_strip_depth = 0; |
|
75 | - var $_additional_newline = "\n"; |
|
41 | + var $_folded_blocks = array(); // keeps folded template blocks |
|
42 | + var $_current_file = null; // the current template being compiled |
|
43 | + var $_current_line_no = 1; // line number for error messages |
|
44 | + var $_capture_stack = array(); // keeps track of nested capture buffers |
|
45 | + var $_plugin_info = array(); // keeps track of plugins to load |
|
46 | + var $_init_smarty_vars = false; |
|
47 | + var $_permitted_tokens = array('true', 'false', 'yes', 'no', 'on', 'off', 'null'); |
|
48 | + var $_db_qstr_regexp = null; // regexps are setup in the constructor |
|
49 | + var $_si_qstr_regexp = null; |
|
50 | + var $_qstr_regexp = null; |
|
51 | + var $_func_regexp = null; |
|
52 | + var $_reg_obj_regexp = null; |
|
53 | + var $_var_bracket_regexp = null; |
|
54 | + var $_num_const_regexp = null; |
|
55 | + var $_dvar_guts_regexp = null; |
|
56 | + var $_dvar_regexp = null; |
|
57 | + var $_cvar_regexp = null; |
|
58 | + var $_svar_regexp = null; |
|
59 | + var $_avar_regexp = null; |
|
60 | + var $_mod_regexp = null; |
|
61 | + var $_var_regexp = null; |
|
62 | + var $_parenth_param_regexp = null; |
|
63 | + var $_func_call_regexp = null; |
|
64 | + var $_obj_ext_regexp = null; |
|
65 | + var $_obj_start_regexp = null; |
|
66 | + var $_obj_params_regexp = null; |
|
67 | + var $_obj_call_regexp = null; |
|
68 | + var $_cacheable_state = 0; |
|
69 | + var $_cache_attrs_count = 0; |
|
70 | + var $_nocache_count = 0; |
|
71 | + var $_cache_serial = null; |
|
72 | + var $_cache_include = null; |
|
73 | + |
|
74 | + var $_strip_depth = 0; |
|
75 | + var $_additional_newline = "\n"; |
|
76 | 76 | |
77 | 77 | /**#@-*/ |
78 | 78 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->_si_qstr_regexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\''; |
92 | 92 | |
93 | 93 | // matches single or double quoted strings |
94 | - $this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')'; |
|
94 | + $this->_qstr_regexp = '(?:'.$this->_db_qstr_regexp.'|'.$this->_si_qstr_regexp.')'; |
|
95 | 95 | |
96 | 96 | // matches bracket portion of vars |
97 | 97 | // [0] |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | // $foo[5].bar[$foobar][4] |
116 | 116 | $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))'; |
117 | 117 | $this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]'; |
118 | - $this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp |
|
119 | - . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?'; |
|
120 | - $this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp; |
|
118 | + $this->_dvar_guts_regexp = '\w+(?:'.$this->_var_bracket_regexp |
|
119 | + . ')*(?:\.\$?\w+(?:'.$this->_var_bracket_regexp.')*)*(?:'.$this->_dvar_math_regexp.'(?:'.$this->_num_const_regexp.'|'.$this->_dvar_math_var_regexp.')*)?'; |
|
120 | + $this->_dvar_regexp = '\$'.$this->_dvar_guts_regexp; |
|
121 | 121 | |
122 | 122 | // matches config vars: |
123 | 123 | // #foo# |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | $this->_svar_regexp = '\%\w+\.\w+\%'; |
130 | 130 | |
131 | 131 | // matches all valid variables (no quotes, no modifiers) |
132 | - $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' |
|
133 | - . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; |
|
132 | + $this->_avar_regexp = '(?:'.$this->_dvar_regexp.'|' |
|
133 | + . $this->_cvar_regexp.'|'.$this->_svar_regexp.')'; |
|
134 | 134 | |
135 | 135 | // matches valid variable syntax: |
136 | 136 | // $foo |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | // #foo# |
140 | 140 | // "text" |
141 | 141 | // "text" |
142 | - $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')'; |
|
142 | + $this->_var_regexp = '(?:'.$this->_avar_regexp.'|'.$this->_qstr_regexp.')'; |
|
143 | 143 | |
144 | 144 | // matches valid object call (one level of object nesting allowed in parameters): |
145 | 145 | // $foo->bar |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | // $foo->bar($foo->bar) |
153 | 153 | // $foo->bar($foo->bar()) |
154 | 154 | // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar)) |
155 | - $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')'; |
|
155 | + $this->_obj_ext_regexp = '\->(?:\$?'.$this->_dvar_guts_regexp.')'; |
|
156 | 156 | $this->_obj_restricted_param_regexp = '(?:' |
157 | - . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')' |
|
158 | - . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)'; |
|
159 | - $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|' |
|
160 | - . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)'; |
|
161 | - $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp |
|
162 | - . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)'; |
|
163 | - $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; |
|
164 | - $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)'; |
|
157 | + . '(?:'.$this->_var_regexp.'|'.$this->_num_const_regexp.')(?:'.$this->_obj_ext_regexp.'(?:\((?:(?:'.$this->_var_regexp.'|'.$this->_num_const_regexp.')' |
|
158 | + . '(?:\s*,\s*(?:'.$this->_var_regexp.'|'.$this->_num_const_regexp.'))*)?\))?)*)'; |
|
159 | + $this->_obj_single_param_regexp = '(?:\w+|'.$this->_obj_restricted_param_regexp.'(?:\s*,\s*(?:(?:\w+|' |
|
160 | + . $this->_var_regexp.$this->_obj_restricted_param_regexp.')))*)'; |
|
161 | + $this->_obj_params_regexp = '\((?:'.$this->_obj_single_param_regexp |
|
162 | + . '(?:\s*,\s*'.$this->_obj_single_param_regexp.')*)?\)'; |
|
163 | + $this->_obj_start_regexp = '(?:'.$this->_dvar_regexp.'(?:'.$this->_obj_ext_regexp.')+)'; |
|
164 | + $this->_obj_call_regexp = '(?:'.$this->_obj_start_regexp.'(?:'.$this->_obj_params_regexp.')?(?:'.$this->_dvar_math_regexp.'(?:'.$this->_num_const_regexp.'|'.$this->_dvar_math_var_regexp.')*)?)'; |
|
165 | 165 | |
166 | 166 | // matches valid modifier syntax: |
167 | 167 | // |foo |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | // |foo:"bar":$foobar |
172 | 172 | // |foo|bar |
173 | 173 | // |foo:$foo->bar |
174 | - $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|' |
|
175 | - . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; |
|
174 | + $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|'.$this->_num_const_regexp.'|' |
|
175 | + . $this->_obj_call_regexp.'|'.$this->_avar_regexp.'|'.$this->_qstr_regexp.'))*)'; |
|
176 | 176 | |
177 | 177 | // matches valid function name: |
178 | 178 | // foo123 |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | // "text" |
193 | 193 | // "text"|bar |
194 | 194 | // $foo->bar |
195 | - $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|' |
|
196 | - . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; |
|
195 | + $this->_param_regexp = '(?:\s*(?:'.$this->_obj_call_regexp.'|' |
|
196 | + . $this->_var_regexp.'|'.$this->_num_const_regexp.'|\w+)(?>'.$this->_mod_regexp.'*)\s*)'; |
|
197 | 197 | |
198 | 198 | // matches valid parenthesised function parameters: |
199 | 199 | // |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | // $foo, $bar, "text" |
202 | 202 | // $foo|bar, "foo"|bar, $foo->bar($foo)|bar |
203 | 203 | $this->_parenth_param_regexp = '(?:\((?:\w+|' |
204 | - . $this->_param_regexp . '(?:\s*,\s*(?:(?:\w+|' |
|
205 | - . $this->_param_regexp . ')))*)?\))'; |
|
204 | + . $this->_param_regexp.'(?:\s*,\s*(?:(?:\w+|' |
|
205 | + . $this->_param_regexp.')))*)?\))'; |
|
206 | 206 | |
207 | 207 | // matches valid function call: |
208 | 208 | // foo() |
209 | 209 | // foo_bar($foo) |
210 | 210 | // _foo_bar($foo,"bar") |
211 | 211 | // foo123($foo,$foo->bar(),"foo") |
212 | - $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:' |
|
213 | - . $this->_parenth_param_regexp . '))'; |
|
212 | + $this->_func_call_regexp = '(?:'.$this->_func_regexp.'\s*(?:' |
|
213 | + . $this->_parenth_param_regexp.'))'; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | /* fetch all special blocks */ |
258 | 258 | $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s"; |
259 | 259 | |
260 | - preg_match_all($search, $source_content, $match, PREG_SET_ORDER); |
|
260 | + preg_match_all($search, $source_content, $match, PREG_SET_ORDER); |
|
261 | 261 | $this->_folded_blocks = $match; |
262 | 262 | reset($this->_folded_blocks); |
263 | 263 | |
264 | 264 | /* replace special blocks by "{php}" */ |
265 | - $source_content = preg_replace_callback($search, create_function ('$matches', "return '" |
|
266 | - . $this->_quote_replace($this->left_delimiter) . 'php' |
|
265 | + $source_content = preg_replace_callback($search, create_function('$matches', "return '" |
|
266 | + . $this->_quote_replace($this->left_delimiter).'php' |
|
267 | 267 | . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'" |
268 | 268 | . $this->_quote_replace($this->right_delimiter) |
269 | 269 | . "';") |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $sp_match[1] = array_unique($sp_match[1]); |
284 | 284 | usort($sp_match[1], '_smarty_sort_length'); |
285 | 285 | for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { |
286 | - $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]); |
|
286 | + $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp], '%%%SMARTYSP'.$curr_sp.'%%%', $text_blocks[$curr_tb]); |
|
287 | 287 | } |
288 | 288 | /* process each one */ |
289 | 289 | for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $compiled_tags[] = $this->_compile_tag($template_tags[$i]); |
313 | 313 | $this->_current_line_no += substr_count($template_tags[$i], "\n"); |
314 | 314 | } |
315 | - if (count($this->_tag_stack)>0) { |
|
315 | + if (count($this->_tag_stack) > 0) { |
|
316 | 316 | list($_open_tag, $_line_no) = end($this->_tag_stack); |
317 | 317 | $this->_syntax_error("unclosed tag \{$_open_tag} (opened line $_line_no).", E_USER_ERROR, __FILE__, __LINE__); |
318 | 318 | return; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | /* remove trailing whitespaces from the last text_block */ |
338 | 338 | $text_blocks[$j] = rtrim($text_blocks[$j]); |
339 | 339 | } |
340 | - $text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>"; |
|
340 | + $text_blocks[$j] = "<?php echo '".strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\"))."'; ?>"; |
|
341 | 341 | if ($compiled_tags[$j] == '{/strip}') { |
342 | 342 | $compiled_tags[$j] = "\n"; /* slurped by php, but necessary |
343 | 343 | if a newline is following the closing strip-tag */ |
@@ -350,19 +350,19 @@ discard block |
||
350 | 350 | } |
351 | 351 | $compiled_content = ''; |
352 | 352 | |
353 | - $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%'; |
|
353 | + $tag_guard = '%%%SMARTYOTG'.md5(uniqid(rand(), true)).'%%%'; |
|
354 | 354 | |
355 | 355 | /* Interleave the compiled contents and text blocks to get the final result. */ |
356 | 356 | for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { |
357 | 357 | if ($compiled_tags[$i] == '') { |
358 | 358 | // tag result empty, remove first newline from following text block |
359 | - $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]); |
|
359 | + $text_blocks[$i + 1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i + 1]); |
|
360 | 360 | } |
361 | 361 | // replace legit PHP tags with placeholder |
362 | 362 | $text_blocks[$i] = str_replace('<?', $tag_guard, $text_blocks[$i]); |
363 | 363 | $compiled_tags[$i] = str_replace('<?', $tag_guard, $compiled_tags[$i]); |
364 | 364 | |
365 | - $compiled_content .= $text_blocks[$i] . $compiled_tags[$i]; |
|
365 | + $compiled_content .= $text_blocks[$i].$compiled_tags[$i]; |
|
366 | 366 | } |
367 | 367 | $compiled_content .= str_replace('<?', $tag_guard, $text_blocks[$i]); |
368 | 368 | |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | $compiled_content = str_replace($tag_guard, '<?', $compiled_content); |
375 | 375 | |
376 | 376 | // remove \n from the end of the file, if any |
377 | - if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) { |
|
377 | + if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n")) { |
|
378 | 378 | $compiled_content = substr($compiled_content, 0, -1); |
379 | 379 | } |
380 | 380 | |
381 | 381 | if (!empty($this->_cache_serial)) { |
382 | - $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; |
|
382 | + $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>".$compiled_content; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | // run compiled template through postfilter functions |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $_plugins_params = "array('plugins' => array("; |
407 | 407 | foreach ($this->_plugin_info as $plugin_type => $plugins) { |
408 | 408 | foreach ($plugins as $plugin_name => $plugin_info) { |
409 | - $_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], "; |
|
409 | + $_plugins_params .= "array('$plugin_type', '$plugin_name', '".strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\"))."', $plugin_info[1], "; |
|
410 | 410 | $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),'; |
411 | 411 | } |
412 | 412 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $this->_init_smarty_vars = false; |
423 | 423 | } |
424 | 424 | |
425 | - $compiled_content = $template_header . $compiled_content; |
|
425 | + $compiled_content = $template_header.$compiled_content; |
|
426 | 426 | return true; |
427 | 427 | } |
428 | 428 | |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | return ''; |
440 | 440 | |
441 | 441 | /* Split tag into two three parts: command, command modifiers and the arguments. */ |
442 | - if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp |
|
443 | - . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*)) |
|
442 | + if (!preg_match('~^(?:('.$this->_num_const_regexp.'|'.$this->_obj_call_regexp.'|'.$this->_var_regexp |
|
443 | + . '|\/?'.$this->_reg_obj_regexp.'|\/?'.$this->_func_regexp.')('.$this->_mod_regexp.'*)) |
|
444 | 444 | (?:\s+(.*))?$ |
445 | 445 | ~xs', $template_tag, $match)) { |
446 | 446 | $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__); |
@@ -450,14 +450,14 @@ discard block |
||
450 | 450 | $tag_modifier = isset($match[2]) ? $match[2] : null; |
451 | 451 | $tag_args = isset($match[3]) ? $match[3] : null; |
452 | 452 | |
453 | - if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) { |
|
453 | + if (preg_match('~^'.$this->_num_const_regexp.'|'.$this->_obj_call_regexp.'|'.$this->_var_regexp.'$~', $tag_command)) { |
|
454 | 454 | /* tag name is a variable or object */ |
455 | - $_return = $this->_parse_var_props($tag_command . $tag_modifier); |
|
456 | - return "<?php echo $_return; ?>" . $this->_additional_newline; |
|
455 | + $_return = $this->_parse_var_props($tag_command.$tag_modifier); |
|
456 | + return "<?php echo $_return; ?>".$this->_additional_newline; |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | /* If the tag name is a registered object, we process it. */ |
460 | - if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) { |
|
460 | + if (preg_match('~^\/?'.$this->_reg_obj_regexp.'$~', $tag_command)) { |
|
461 | 461 | return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier); |
462 | 462 | } |
463 | 463 | |
@@ -539,17 +539,17 @@ discard block |
||
539 | 539 | |
540 | 540 | case 'strip': |
541 | 541 | case '/strip': |
542 | - if (substr($tag_command, 0, 1)=='/') { |
|
542 | + if (substr($tag_command, 0, 1) == '/') { |
|
543 | 543 | $this->_pop_tag('strip'); |
544 | - if (--$this->_strip_depth==0) { /* outermost closing {/strip} */ |
|
544 | + if (--$this->_strip_depth == 0) { /* outermost closing {/strip} */ |
|
545 | 545 | $this->_additional_newline = "\n"; |
546 | - return '{' . $tag_command . '}'; |
|
546 | + return '{'.$tag_command.'}'; |
|
547 | 547 | } |
548 | 548 | } else { |
549 | 549 | $this->_push_tag('strip'); |
550 | - if ($this->_strip_depth++==0) { /* outermost opening {strip} */ |
|
550 | + if ($this->_strip_depth++ == 0) { /* outermost opening {strip} */ |
|
551 | 551 | $this->_additional_newline = ""; |
552 | - return '{' . $tag_command . '}'; |
|
552 | + return '{'.$tag_command.'}'; |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | return ''; |
@@ -565,14 +565,14 @@ discard block |
||
565 | 565 | return ''; |
566 | 566 | |
567 | 567 | case 3: /* literal */ |
568 | - return "<?php echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline; |
|
568 | + return "<?php echo '".strtr($block[2], array("'"=>"\'", "\\"=>"\\\\"))."'; ?>".$this->_additional_newline; |
|
569 | 569 | |
570 | 570 | case 4: /* php */ |
571 | 571 | if ($this->security && !$this->security_settings['PHP_TAGS']) { |
572 | 572 | $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__); |
573 | 573 | return; |
574 | 574 | } |
575 | - return '<?php ' . $block[3] .' ?>'; |
|
575 | + return '<?php '.$block[3].' ?>'; |
|
576 | 576 | } |
577 | 577 | break; |
578 | 578 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | include_once $plugin_file; |
631 | 631 | |
632 | - $plugin_func = 'smarty_compiler_' . $tag_command; |
|
632 | + $plugin_func = 'smarty_compiler_'.$tag_command; |
|
633 | 633 | if (!is_callable($plugin_func)) { |
634 | 634 | $message = "plugin function $plugin_func() not found in $plugin_file\n"; |
635 | 635 | $have_function = false; |
@@ -647,10 +647,10 @@ discard block |
||
647 | 647 | if ($found) { |
648 | 648 | if ($have_function) { |
649 | 649 | $output = call_user_func_array($plugin_func, array($tag_args, &$this)); |
650 | - if($output != '') { |
|
651 | - $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command) |
|
650 | + if ($output != '') { |
|
651 | + $output = '<?php '.$this->_push_cacheable_state('compiler', $tag_command) |
|
652 | 652 | . $output |
653 | - . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; |
|
653 | + . $this->_pop_cacheable_state('compiler', $tag_command).' ?>'; |
|
654 | 654 | } |
655 | 655 | } else { |
656 | 656 | $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | |
705 | 705 | include_once $plugin_file; |
706 | 706 | |
707 | - $plugin_func = 'smarty_block_' . $tag_command; |
|
707 | + $plugin_func = 'smarty_block_'.$tag_command; |
|
708 | 708 | if (!function_exists($plugin_func)) { |
709 | 709 | $message = "plugin function $plugin_func() not found in $plugin_file\n"; |
710 | 710 | $have_function = false; |
@@ -734,12 +734,12 @@ discard block |
||
734 | 734 | $this->_pop_tag($tag_command); |
735 | 735 | |
736 | 736 | if ($start_tag) { |
737 | - $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command); |
|
737 | + $output = '<?php '.$this->_push_cacheable_state('block', $tag_command); |
|
738 | 738 | $attrs = $this->_parse_attrs($tag_args); |
739 | - $_cache_attrs=''; |
|
739 | + $_cache_attrs = ''; |
|
740 | 740 | $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs); |
741 | 741 | $output .= "$_cache_attrs\$this->_tag_stack[] = array('$tag_command', array(".implode(',', $arg_list).')); '; |
742 | - $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);'; |
|
742 | + $output .= '$_block_repeat=true;'.$this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);'; |
|
743 | 743 | $output .= 'while ($_block_repeat) { ob_start(); ?>'; |
744 | 744 | } else { |
745 | 745 | $output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); '; |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | if ($tag_modifier != '') { |
748 | 748 | $this->_parse_modifiers($_out_tag_text, $tag_modifier); |
749 | 749 | } |
750 | - $output .= '$_block_repeat=false;echo ' . $_out_tag_text . '; } '; |
|
751 | - $output .= " array_pop(\$this->_tag_stack); " . $this->_pop_cacheable_state('block', $tag_command) . '?>'; |
|
750 | + $output .= '$_block_repeat=false;echo '.$_out_tag_text.'; } '; |
|
751 | + $output .= " array_pop(\$this->_tag_stack); ".$this->_pop_cacheable_state('block', $tag_command).'?>'; |
|
752 | 752 | } |
753 | 753 | |
754 | 754 | return true; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | |
790 | 790 | include_once $plugin_file; |
791 | 791 | |
792 | - $plugin_func = 'smarty_function_' . $tag_command; |
|
792 | + $plugin_func = 'smarty_function_'.$tag_command; |
|
793 | 793 | if (!function_exists($plugin_func)) { |
794 | 794 | $message = "plugin function $plugin_func() not found in $plugin_file\n"; |
795 | 795 | $have_function = false; |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs); |
817 | 817 | |
818 | 818 | $output = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)"; |
819 | - if($tag_modifier != '') { |
|
819 | + if ($tag_modifier != '') { |
|
820 | 820 | $this->_parse_modifiers($output, $tag_modifier); |
821 | 821 | } |
822 | 822 | |
823 | - if($output != '') { |
|
824 | - $output = '<?php ' . $_cacheable_state . $_cache_attrs . 'echo ' . $output . ';' |
|
825 | - . $this->_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline; |
|
823 | + if ($output != '') { |
|
824 | + $output = '<?php '.$_cacheable_state.$_cache_attrs.'echo '.$output.';' |
|
825 | + . $this->_pop_cacheable_state('function', $tag_command)."?>".$this->_additional_newline; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | return true; |
@@ -848,10 +848,10 @@ discard block |
||
848 | 848 | list($object, $obj_comp) = explode('->', $tag_command); |
849 | 849 | |
850 | 850 | $arg_list = array(); |
851 | - if(count($attrs)) { |
|
851 | + if (count($attrs)) { |
|
852 | 852 | $_assign_var = false; |
853 | 853 | foreach ($attrs as $arg_name => $arg_value) { |
854 | - if($arg_name == 'assign') { |
|
854 | + if ($arg_name == 'assign') { |
|
855 | 855 | $_assign_var = $arg_value; |
856 | 856 | unset($attrs['assign']); |
857 | 857 | continue; |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
865 | - if($this->_reg_objects[$object][2]) { |
|
865 | + if ($this->_reg_objects[$object][2]) { |
|
866 | 866 | // smarty object argument format |
867 | 867 | $args = "array(".implode(',', (array)$arg_list)."), \$this"; |
868 | 868 | } else { |
@@ -876,13 +876,13 @@ discard block |
||
876 | 876 | $prefix = ''; |
877 | 877 | $postfix = ''; |
878 | 878 | $newline = ''; |
879 | - if(!is_object($this->_reg_objects[$object][0])) { |
|
880 | - $this->_trigger_fatal_error("registered '$object' is not an object" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); |
|
881 | - } elseif(!empty($this->_reg_objects[$object][1]) && !in_array($obj_comp, $this->_reg_objects[$object][1])) { |
|
879 | + if (!is_object($this->_reg_objects[$object][0])) { |
|
880 | + $this->_trigger_fatal_error("registered '$object' is not an object", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); |
|
881 | + } elseif (!empty($this->_reg_objects[$object][1]) && !in_array($obj_comp, $this->_reg_objects[$object][1])) { |
|
882 | 882 | $this->_trigger_fatal_error("'$obj_comp' is not a registered component of object '$object'", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); |
883 | - } elseif(method_exists($this->_reg_objects[$object][0], $obj_comp)) { |
|
883 | + } elseif (method_exists($this->_reg_objects[$object][0], $obj_comp)) { |
|
884 | 884 | // method |
885 | - if(in_array($obj_comp, $this->_reg_objects[$object][3])) { |
|
885 | + if (in_array($obj_comp, $this->_reg_objects[$object][3])) { |
|
886 | 886 | // block method |
887 | 887 | if ($start_tag) { |
888 | 888 | $prefix = "\$this->_tag_stack[] = array('$obj_comp', $args); "; |
@@ -904,22 +904,22 @@ discard block |
||
904 | 904 | $return = "\$this->_reg_objects['$object'][0]->$obj_comp"; |
905 | 905 | } |
906 | 906 | |
907 | - if($return != null) { |
|
908 | - if($tag_modifier != '') { |
|
907 | + if ($return != null) { |
|
908 | + if ($tag_modifier != '') { |
|
909 | 909 | $this->_parse_modifiers($return, $tag_modifier); |
910 | 910 | } |
911 | 911 | |
912 | - if(!empty($_assign_var)) { |
|
913 | - $output = "\$this->assign('" . $this->_dequote($_assign_var) ."', $return);"; |
|
912 | + if (!empty($_assign_var)) { |
|
913 | + $output = "\$this->assign('".$this->_dequote($_assign_var)."', $return);"; |
|
914 | 914 | } else { |
915 | - $output = 'echo ' . $return . ';'; |
|
915 | + $output = 'echo '.$return.';'; |
|
916 | 916 | $newline = $this->_additional_newline; |
917 | 917 | } |
918 | 918 | } else { |
919 | 919 | $output = ''; |
920 | 920 | } |
921 | 921 | |
922 | - return '<?php ' . $prefix . $output . $postfix . "?>" . $newline; |
|
922 | + return '<?php '.$prefix.$output.$postfix."?>".$newline; |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | /** |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | |
958 | 958 | $_params = "array('args' => array(".implode(', ', (array)$arg_list)."))"; |
959 | 959 | |
960 | - return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>" . $this->_additional_newline; |
|
960 | + return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>".$this->_additional_newline; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | /** |
@@ -992,8 +992,8 @@ discard block |
||
992 | 992 | $arg_list[] = "'$arg_name' => $arg_value"; |
993 | 993 | } |
994 | 994 | |
995 | - if ( $theme_template == 'true' ) |
|
996 | - $include_file = '"'.SugarThemeRegistry::current()->getTemplate(str_replace(array('"',"'"),'',$include_file)).'"'; |
|
995 | + if ($theme_template == 'true') |
|
996 | + $include_file = '"'.SugarThemeRegistry::current()->getTemplate(str_replace(array('"', "'"), '', $include_file)).'"'; |
|
997 | 997 | |
998 | 998 | $output = '<?php '; |
999 | 999 | |
@@ -1005,13 +1005,13 @@ discard block |
||
1005 | 1005 | "\$_smarty_tpl_vars = \$this->_tpl_vars;\n"; |
1006 | 1006 | |
1007 | 1007 | |
1008 | - $_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))"; |
|
1009 | - $output .= "\$this->_smarty_include($_params);\n" . |
|
1010 | - "\$this->_tpl_vars = \$_smarty_tpl_vars;\n" . |
|
1008 | + $_params = "array('smarty_include_tpl_file' => ".$include_file.", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))"; |
|
1009 | + $output .= "\$this->_smarty_include($_params);\n". |
|
1010 | + "\$this->_tpl_vars = \$_smarty_tpl_vars;\n". |
|
1011 | 1011 | "unset(\$_smarty_tpl_vars);\n"; |
1012 | 1012 | |
1013 | 1013 | if (isset($assign_var)) { |
1014 | - $output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n"; |
|
1014 | + $output .= "\$this->assign(".$assign_var.", ob_get_contents()); ob_end_clean();\n"; |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | $output .= ' ?>'; |
@@ -1035,20 +1035,20 @@ discard block |
||
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | $assign_var = (empty($attrs['assign'])) ? '' : $this->_dequote($attrs['assign']); |
1038 | - $once_var = (empty($attrs['once']) || $attrs['once']=='false') ? 'false' : 'true'; |
|
1038 | + $once_var = (empty($attrs['once']) || $attrs['once'] == 'false') ? 'false' : 'true'; |
|
1039 | 1039 | |
1040 | 1040 | $arg_list = array(); |
1041 | - foreach($attrs as $arg_name => $arg_value) { |
|
1042 | - if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { |
|
1043 | - if(is_bool($arg_value)) |
|
1041 | + foreach ($attrs as $arg_name => $arg_value) { |
|
1042 | + if ($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { |
|
1043 | + if (is_bool($arg_value)) |
|
1044 | 1044 | $arg_value = $arg_value ? 'true' : 'false'; |
1045 | 1045 | $arg_list[] = "'$arg_name' => $arg_value"; |
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - $_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))"; |
|
1049 | + $_params = "array('smarty_file' => ".$attrs['file'].", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))"; |
|
1050 | 1050 | |
1051 | - return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>" . $this->_additional_newline; |
|
1051 | + return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>".$this->_additional_newline; |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | if (!isset($attrs['max'])) |
1115 | 1115 | $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; |
1116 | 1116 | else |
1117 | - $output .= "if ({$section_props}['max'] < 0)\n" . |
|
1117 | + $output .= "if ({$section_props}['max'] < 0)\n". |
|
1118 | 1118 | " {$section_props}['max'] = {$section_props}['loop'];\n"; |
1119 | 1119 | |
1120 | 1120 | if (!isset($attrs['step'])) |
@@ -1123,9 +1123,9 @@ discard block |
||
1123 | 1123 | if (!isset($attrs['start'])) |
1124 | 1124 | $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; |
1125 | 1125 | else { |
1126 | - $output .= "if ({$section_props}['start'] < 0)\n" . |
|
1127 | - " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . |
|
1128 | - "else\n" . |
|
1126 | + $output .= "if ({$section_props}['start'] < 0)\n". |
|
1127 | + " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n". |
|
1128 | + "else\n". |
|
1129 | 1129 | " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; |
1130 | 1130 | } |
1131 | 1131 | |
@@ -1135,9 +1135,9 @@ discard block |
||
1135 | 1135 | } else { |
1136 | 1136 | $output .= " {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n"; |
1137 | 1137 | } |
1138 | - $output .= " if ({$section_props}['total'] == 0)\n" . |
|
1139 | - " {$section_props}['show'] = false;\n" . |
|
1140 | - "} else\n" . |
|
1138 | + $output .= " if ({$section_props}['total'] == 0)\n". |
|
1139 | + " {$section_props}['show'] = false;\n". |
|
1140 | + "} else\n". |
|
1141 | 1141 | " {$section_props}['total'] = 0;\n"; |
1142 | 1142 | |
1143 | 1143 | $output .= "if ({$section_props}['show']):\n"; |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | if (isset($attrs['key'])) { |
1185 | - $key = $this->_dequote($attrs['key']); |
|
1185 | + $key = $this->_dequote($attrs['key']); |
|
1186 | 1186 | if (!preg_match('~^\w+$~', $key)) { |
1187 | 1187 | return $this->_syntax_error("foreach: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__); |
1188 | 1188 | } |
@@ -1262,8 +1262,8 @@ discard block |
||
1262 | 1262 | |
1263 | 1263 | /* Tokenize args for 'if' tag. */ |
1264 | 1264 | preg_match_all('~(?> |
1265 | - ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*)? | # valid object call |
|
1266 | - ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)? | # var or quoted string |
|
1265 | + ' . $this->_obj_call_regexp.'(?:'.$this->_mod_regexp.'*)? | # valid object call |
|
1266 | + ' . $this->_var_regexp.'(?:'.$this->_mod_regexp.'*)? | # var or quoted string |
|
1267 | 1267 | \-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\||\%|\+|\-|\/|\*|\@ | # valid non-word token |
1268 | 1268 | \b\w+\b | # valid word token |
1269 | 1269 | \S+ # anything else |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | |
1272 | 1272 | $tokens = $match[0]; |
1273 | 1273 | |
1274 | - if(empty($tokens)) { |
|
1274 | + if (empty($tokens)) { |
|
1275 | 1275 | $_error_msg = $elseif ? "'elseif'" : "'if'"; |
1276 | 1276 | $_error_msg .= ' statement requires arguments'; |
1277 | 1277 | $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, __LINE__); |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | |
1281 | 1281 | // make sure we have balanced parenthesis |
1282 | 1282 | $token_count = array_count_values($tokens); |
1283 | - if(isset($token_count['(']) && $token_count['('] != $token_count[')']) { |
|
1283 | + if (isset($token_count['(']) && $token_count['('] != $token_count[')']) { |
|
1284 | 1284 | $this->_syntax_error("unbalanced parenthesis in if statement", E_USER_ERROR, __FILE__, __LINE__); |
1285 | 1285 | } |
1286 | 1286 | |
@@ -1370,15 +1370,15 @@ discard block |
||
1370 | 1370 | /* If last token was a ')', we operate on the parenthesized |
1371 | 1371 | expression. The start of the expression is on the stack. |
1372 | 1372 | Otherwise, we operate on the last encountered token. */ |
1373 | - if ($tokens[$i-1] == ')') { |
|
1373 | + if ($tokens[$i - 1] == ')') { |
|
1374 | 1374 | $is_arg_start = array_pop($is_arg_stack); |
1375 | 1375 | if ($is_arg_start != 0) { |
1376 | - if (preg_match('~^' . $this->_func_regexp . '$~', $tokens[$is_arg_start-1])) { |
|
1376 | + if (preg_match('~^'.$this->_func_regexp.'$~', $tokens[$is_arg_start - 1])) { |
|
1377 | 1377 | $is_arg_start--; |
1378 | 1378 | } |
1379 | 1379 | } |
1380 | 1380 | } else |
1381 | - $is_arg_start = $i-1; |
|
1381 | + $is_arg_start = $i - 1; |
|
1382 | 1382 | /* Construct the argument for 'is' expression, so it knows |
1383 | 1383 | what to operate on. */ |
1384 | 1384 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | return modified tokens, where the first one is the result |
1389 | 1389 | of the 'is' expression and the rest are the tokens it |
1390 | 1390 | didn't touch. */ |
1391 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
1391 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
1392 | 1392 | |
1393 | 1393 | /* Replace the old tokens with the new ones. */ |
1394 | 1394 | array_splice($tokens, $is_arg_start, count($tokens), $new_tokens); |
@@ -1399,19 +1399,19 @@ discard block |
||
1399 | 1399 | break; |
1400 | 1400 | |
1401 | 1401 | default: |
1402 | - if(preg_match('~^' . $this->_func_regexp . '$~', $token) ) { |
|
1402 | + if (preg_match('~^'.$this->_func_regexp.'$~', $token)) { |
|
1403 | 1403 | // function call |
1404 | - if($this->security && |
|
1404 | + if ($this->security && |
|
1405 | 1405 | !in_array($token, $this->security_settings['IF_FUNCS'])) { |
1406 | 1406 | $this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); |
1407 | 1407 | } |
1408 | - } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') { |
|
1408 | + } elseif (preg_match('~^'.$this->_var_regexp.'$~', $token) && (strpos('+-*/^%&|', substr($token, -1)) === false) && isset($tokens[$i + 1]) && $tokens[$i + 1] == '(') { |
|
1409 | 1409 | // variable function call |
1410 | 1410 | $this->_syntax_error("variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__); |
1411 | - } elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) { |
|
1411 | + } elseif (preg_match('~^'.$this->_obj_call_regexp.'|'.$this->_var_regexp.'(?:'.$this->_mod_regexp.'*)$~', $token)) { |
|
1412 | 1412 | // object or variable |
1413 | 1413 | $token = $this->_parse_var_props($token); |
1414 | - } elseif(is_numeric($token)) { |
|
1414 | + } elseif (is_numeric($token)) { |
|
1415 | 1415 | // number, skip it |
1416 | 1416 | } else { |
1417 | 1417 | $this->_syntax_error("unidentified token '$token'", E_USER_ERROR, __FILE__, __LINE__); |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { |
1484 | 1484 | $expr_end++; |
1485 | 1485 | $expr_arg = $tokens[$expr_end++]; |
1486 | - $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; |
|
1486 | + $expr = "!(1 & ($is_arg / ".$this->_parse_var_props($expr_arg)."))"; |
|
1487 | 1487 | } else |
1488 | 1488 | $expr = "!(1 & $is_arg)"; |
1489 | 1489 | break; |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { |
1493 | 1493 | $expr_end++; |
1494 | 1494 | $expr_arg = $tokens[$expr_end++]; |
1495 | - $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; |
|
1495 | + $expr = "(1 & ($is_arg / ".$this->_parse_var_props($expr_arg)."))"; |
|
1496 | 1496 | } else |
1497 | 1497 | $expr = "(1 & $is_arg)"; |
1498 | 1498 | break; |
@@ -1501,7 +1501,7 @@ discard block |
||
1501 | 1501 | if (@$tokens[$expr_end] == 'by') { |
1502 | 1502 | $expr_end++; |
1503 | 1503 | $expr_arg = $tokens[$expr_end++]; |
1504 | - $expr = "!($is_arg % " . $this->_parse_var_props($expr_arg) . ")"; |
|
1504 | + $expr = "!($is_arg % ".$this->_parse_var_props($expr_arg).")"; |
|
1505 | 1505 | } else { |
1506 | 1506 | $this->_syntax_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__); |
1507 | 1507 | } |
@@ -1532,11 +1532,11 @@ discard block |
||
1532 | 1532 | { |
1533 | 1533 | |
1534 | 1534 | /* Tokenize tag attributes. */ |
1535 | - preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+) |
|
1535 | + preg_match_all('~(?:'.$this->_obj_call_regexp.'|'.$this->_qstr_regexp.' | (?>[^"\'=\s]+) |
|
1536 | 1536 | )+ | |
1537 | 1537 | [=] |
1538 | 1538 | ~x', $tag_args, $match); |
1539 | - $tokens = $match[0]; |
|
1539 | + $tokens = $match[0]; |
|
1540 | 1540 | |
1541 | 1541 | $attrs = array(); |
1542 | 1542 | /* Parse state: |
@@ -1577,9 +1577,9 @@ discard block |
||
1577 | 1577 | $token = 'false'; |
1578 | 1578 | } else if ($token == 'null') { |
1579 | 1579 | $token = 'null'; |
1580 | - } else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) { |
|
1580 | + } else if (preg_match('~^'.$this->_num_const_regexp.'|0[xX][0-9a-fA-F]+$~', $token)) { |
|
1581 | 1581 | /* treat integer literally */ |
1582 | - } else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) { |
|
1582 | + } else if (!preg_match('~^'.$this->_obj_call_regexp.'|'.$this->_var_regexp.'(?:'.$this->_mod_regexp.')*$~', $token)) { |
|
1583 | 1583 | /* treat as a string, double-quote it escaping quotes */ |
1584 | 1584 | $token = '"'.addslashes($token).'"'; |
1585 | 1585 | } |
@@ -1593,8 +1593,8 @@ discard block |
||
1593 | 1593 | $last_token = $token; |
1594 | 1594 | } |
1595 | 1595 | |
1596 | - if($state != 0) { |
|
1597 | - if($state == 1) { |
|
1596 | + if ($state != 0) { |
|
1597 | + if ($state == 1) { |
|
1598 | 1598 | $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); |
1599 | 1599 | } else { |
1600 | 1600 | $this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__); |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | */ |
1615 | 1615 | function _parse_vars_props(&$tokens) |
1616 | 1616 | { |
1617 | - foreach($tokens as $key => $val) { |
|
1617 | + foreach ($tokens as $key => $val) { |
|
1618 | 1618 | $tokens[$key] = $this->_parse_var_props($val); |
1619 | 1619 | } |
1620 | 1620 | } |
@@ -1631,52 +1631,52 @@ discard block |
||
1631 | 1631 | { |
1632 | 1632 | $val = trim($val); |
1633 | 1633 | |
1634 | - if(preg_match('~^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match)) { |
|
1634 | + if (preg_match('~^('.$this->_obj_call_regexp.'|'.$this->_dvar_regexp.')('.$this->_mod_regexp.'*)$~', $val, $match)) { |
|
1635 | 1635 | // $ variable or object |
1636 | 1636 | $return = $this->_parse_var($match[1]); |
1637 | 1637 | $modifiers = $match[2]; |
1638 | - if (!empty($this->default_modifiers) && !preg_match('~(^|\|)smarty:nodefaults($|\|)~',$modifiers)) { |
|
1639 | - $_default_mod_string = implode('|',(array)$this->default_modifiers); |
|
1640 | - $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers; |
|
1638 | + if (!empty($this->default_modifiers) && !preg_match('~(^|\|)smarty:nodefaults($|\|)~', $modifiers)) { |
|
1639 | + $_default_mod_string = implode('|', (array)$this->default_modifiers); |
|
1640 | + $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string.'|'.$modifiers; |
|
1641 | 1641 | } |
1642 | 1642 | $this->_parse_modifiers($return, $modifiers); |
1643 | 1643 | return $return; |
1644 | - } elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1644 | + } elseif (preg_match('~^'.$this->_db_qstr_regexp.'(?:'.$this->_mod_regexp.'*)$~', $val)) { |
|
1645 | 1645 | // double quoted text |
1646 | - preg_match('~^(' . $this->_db_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); |
|
1646 | + preg_match('~^('.$this->_db_qstr_regexp.')('.$this->_mod_regexp.'*)$~', $val, $match); |
|
1647 | 1647 | $return = $this->_expand_quoted_text($match[1]); |
1648 | - if($match[2] != '') { |
|
1648 | + if ($match[2] != '') { |
|
1649 | 1649 | $this->_parse_modifiers($return, $match[2]); |
1650 | 1650 | } |
1651 | 1651 | return $return; |
1652 | 1652 | } |
1653 | - elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1653 | + elseif (preg_match('~^'.$this->_num_const_regexp.'(?:'.$this->_mod_regexp.'*)$~', $val)) { |
|
1654 | 1654 | // numerical constant |
1655 | - preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); |
|
1656 | - if($match[2] != '') { |
|
1655 | + preg_match('~^('.$this->_num_const_regexp.')('.$this->_mod_regexp.'*)$~', $val, $match); |
|
1656 | + if ($match[2] != '') { |
|
1657 | 1657 | $this->_parse_modifiers($match[1], $match[2]); |
1658 | 1658 | return $match[1]; |
1659 | 1659 | } |
1660 | 1660 | } |
1661 | - elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1661 | + elseif (preg_match('~^'.$this->_si_qstr_regexp.'(?:'.$this->_mod_regexp.'*)$~', $val)) { |
|
1662 | 1662 | // single quoted text |
1663 | - preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); |
|
1664 | - if($match[2] != '') { |
|
1663 | + preg_match('~^('.$this->_si_qstr_regexp.')('.$this->_mod_regexp.'*)$~', $val, $match); |
|
1664 | + if ($match[2] != '') { |
|
1665 | 1665 | $this->_parse_modifiers($match[1], $match[2]); |
1666 | 1666 | return $match[1]; |
1667 | 1667 | } |
1668 | 1668 | } |
1669 | - elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1669 | + elseif (preg_match('~^'.$this->_cvar_regexp.'(?:'.$this->_mod_regexp.'*)$~', $val)) { |
|
1670 | 1670 | // config var |
1671 | 1671 | return $this->_parse_conf_var($val); |
1672 | 1672 | } |
1673 | - elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1673 | + elseif (preg_match('~^'.$this->_svar_regexp.'(?:'.$this->_mod_regexp.'*)$~', $val)) { |
|
1674 | 1674 | // section var |
1675 | 1675 | return $this->_parse_section_prop($val); |
1676 | 1676 | } |
1677 | - elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) { |
|
1677 | + elseif (!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) { |
|
1678 | 1678 | // literal string |
1679 | - return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"'); |
|
1679 | + return $this->_expand_quoted_text('"'.strtr($val, array('\\' => '\\\\', '"' => '\\"')).'"'); |
|
1680 | 1680 | } |
1681 | 1681 | return $val; |
1682 | 1682 | } |
@@ -1690,11 +1690,11 @@ discard block |
||
1690 | 1690 | function _expand_quoted_text($var_expr) |
1691 | 1691 | { |
1692 | 1692 | // if contains unescaped $, expand it |
1693 | - if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) { |
|
1693 | + if (preg_match_all('~(?:\`(?<!\\\\)\$'.$this->_dvar_guts_regexp.'(?:'.$this->_obj_ext_regexp.')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) { |
|
1694 | 1694 | $_match = $_match[0]; |
1695 | 1695 | $_replace = array(); |
1696 | - foreach($_match as $_var) { |
|
1697 | - $_replace[$_var] = '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."'; |
|
1696 | + foreach ($_match as $_var) { |
|
1697 | + $_replace[$_var] = '".('.$this->_parse_var(str_replace('`', '', $_var)).')."'; |
|
1698 | 1698 | } |
1699 | 1699 | $var_expr = strtr($var_expr, $_replace); |
1700 | 1700 | $_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr); |
@@ -1702,7 +1702,7 @@ discard block |
||
1702 | 1702 | $_return = $var_expr; |
1703 | 1703 | } |
1704 | 1704 | // replace double quoted literal string with single quotes |
1705 | - $_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return); |
|
1705 | + $_return = preg_replace('~^"([\s\w]+)"$~', "'\\1'", $_return); |
|
1706 | 1706 | return $_return; |
1707 | 1707 | } |
1708 | 1708 | |
@@ -1718,26 +1718,26 @@ discard block |
||
1718 | 1718 | $_has_math = false; |
1719 | 1719 | $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE); |
1720 | 1720 | |
1721 | - if(count($_math_vars) > 1) { |
|
1721 | + if (count($_math_vars) > 1) { |
|
1722 | 1722 | $_first_var = ""; |
1723 | 1723 | $_complete_var = ""; |
1724 | 1724 | $_output = ""; |
1725 | 1725 | // simple check if there is any math, to stop recursion (due to modifiers with "xx % yy" as parameter) |
1726 | - foreach($_math_vars as $_k => $_math_var) { |
|
1726 | + foreach ($_math_vars as $_k => $_math_var) { |
|
1727 | 1727 | $_math_var = $_math_vars[$_k]; |
1728 | 1728 | |
1729 | - if(!empty($_math_var) || is_numeric($_math_var)) { |
|
1729 | + if (!empty($_math_var) || is_numeric($_math_var)) { |
|
1730 | 1730 | // hit a math operator, so process the stuff which came before it |
1731 | - if(preg_match('~^' . $this->_dvar_math_regexp . '$~', $_math_var)) { |
|
1731 | + if (preg_match('~^'.$this->_dvar_math_regexp.'$~', $_math_var)) { |
|
1732 | 1732 | $_has_math = true; |
1733 | - if(!empty($_complete_var) || is_numeric($_complete_var)) { |
|
1733 | + if (!empty($_complete_var) || is_numeric($_complete_var)) { |
|
1734 | 1734 | $_output .= $this->_parse_var($_complete_var); |
1735 | 1735 | } |
1736 | 1736 | |
1737 | 1737 | // just output the math operator to php |
1738 | 1738 | $_output .= $_math_var; |
1739 | 1739 | |
1740 | - if(empty($_first_var)) |
|
1740 | + if (empty($_first_var)) |
|
1741 | 1741 | $_first_var = $_complete_var; |
1742 | 1742 | |
1743 | 1743 | $_complete_var = ""; |
@@ -1746,8 +1746,8 @@ discard block |
||
1746 | 1746 | } |
1747 | 1747 | } |
1748 | 1748 | } |
1749 | - if($_has_math) { |
|
1750 | - if(!empty($_complete_var) || is_numeric($_complete_var)) |
|
1749 | + if ($_has_math) { |
|
1750 | + if (!empty($_complete_var) || is_numeric($_complete_var)) |
|
1751 | 1751 | $_output .= $this->_parse_var($_complete_var); |
1752 | 1752 | |
1753 | 1753 | // get the modifiers working (only the last var from math + modifier is left) |
@@ -1756,15 +1756,15 @@ discard block |
||
1756 | 1756 | } |
1757 | 1757 | |
1758 | 1758 | // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit) |
1759 | - if(is_numeric(substr($var_expr, 0, 1))) |
|
1759 | + if (is_numeric(substr($var_expr, 0, 1))) |
|
1760 | 1760 | $_var_ref = $var_expr; |
1761 | 1761 | else |
1762 | 1762 | $_var_ref = substr($var_expr, 1); |
1763 | 1763 | |
1764 | - if(!$_has_math) { |
|
1764 | + if (!$_has_math) { |
|
1765 | 1765 | |
1766 | 1766 | // get [foo] and .foo and ->foo and (...) pieces |
1767 | - preg_match_all('~(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, $match); |
|
1767 | + preg_match_all('~(?:^\w+)|'.$this->_obj_params_regexp.'|(?:'.$this->_var_bracket_regexp.')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, $match); |
|
1768 | 1768 | |
1769 | 1769 | $_indexes = $match[0]; |
1770 | 1770 | $_var_name = array_shift($_indexes); |
@@ -1782,9 +1782,9 @@ discard block |
||
1782 | 1782 | $_var_name = substr(array_shift($_indexes), 1); |
1783 | 1783 | $_output = "\$this->_smarty_vars['$_var_name']"; |
1784 | 1784 | } |
1785 | - } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) { |
|
1785 | + } elseif (is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) { |
|
1786 | 1786 | // because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers |
1787 | - if(count($_indexes) > 0) |
|
1787 | + if (count($_indexes) > 0) |
|
1788 | 1788 | { |
1789 | 1789 | $_var_name .= implode("", $_indexes); |
1790 | 1790 | $_indexes = array(); |
@@ -1801,9 +1801,9 @@ discard block |
||
1801 | 1801 | $_output .= "[$_index]"; |
1802 | 1802 | } elseif (substr($_index, 0, 1) == '$') { |
1803 | 1803 | if (strpos($_index, '.') !== false) { |
1804 | - $_output .= '[' . $this->_parse_var($_index) . ']'; |
|
1804 | + $_output .= '['.$this->_parse_var($_index).']'; |
|
1805 | 1805 | } else { |
1806 | - $_output .= "[\$this->_tpl_vars['" . substr($_index, 1) . "']]"; |
|
1806 | + $_output .= "[\$this->_tpl_vars['".substr($_index, 1)."']]"; |
|
1807 | 1807 | } |
1808 | 1808 | } else { |
1809 | 1809 | $_var_parts = explode('.', $_index); |
@@ -1813,19 +1813,19 @@ discard block |
||
1813 | 1813 | } |
1814 | 1814 | } else if (substr($_index, 0, 1) == '.') { |
1815 | 1815 | if (substr($_index, 1, 1) == '$') |
1816 | - $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]"; |
|
1816 | + $_output .= "[\$this->_tpl_vars['".substr($_index, 2)."']]"; |
|
1817 | 1817 | else |
1818 | - $_output .= "['" . substr($_index, 1) . "']"; |
|
1819 | - } else if (substr($_index,0,2) == '->') { |
|
1820 | - if(substr($_index,2,2) == '__') { |
|
1818 | + $_output .= "['".substr($_index, 1)."']"; |
|
1819 | + } else if (substr($_index, 0, 2) == '->') { |
|
1820 | + if (substr($_index, 2, 2) == '__') { |
|
1821 | 1821 | $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__); |
1822 | - } elseif($this->security && substr($_index, 2, 1) == '_') { |
|
1822 | + } elseif ($this->security && substr($_index, 2, 1) == '_') { |
|
1823 | 1823 | $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); |
1824 | 1824 | } elseif (substr($_index, 2, 1) == '$') { |
1825 | 1825 | if ($this->security) { |
1826 | 1826 | $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); |
1827 | 1827 | } else { |
1828 | - $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}'; |
|
1828 | + $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index, 3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}'; |
|
1829 | 1829 | } |
1830 | 1830 | } else { |
1831 | 1831 | $_output .= $_index; |
@@ -1850,7 +1850,7 @@ discard block |
||
1850 | 1850 | */ |
1851 | 1851 | function _parse_parenth_args($parenth_args) |
1852 | 1852 | { |
1853 | - preg_match_all('~' . $this->_param_regexp . '~',$parenth_args, $match); |
|
1853 | + preg_match_all('~'.$this->_param_regexp.'~', $parenth_args, $match); |
|
1854 | 1854 | $orig_vals = $match = $match[0]; |
1855 | 1855 | $this->_parse_vars_props($match); |
1856 | 1856 | $replace = array(); |
@@ -1913,18 +1913,18 @@ discard block |
||
1913 | 1913 | */ |
1914 | 1914 | function _parse_modifiers(&$output, $modifier_string) |
1915 | 1915 | { |
1916 | - preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match); |
|
1916 | + preg_match_all('~\|(@?\w+)((?>:(?:'.$this->_qstr_regexp.'|[^|]+))*)~', '|'.$modifier_string, $_match); |
|
1917 | 1917 | list(, $_modifiers, $modifier_arg_strings) = $_match; |
1918 | 1918 | |
1919 | 1919 | for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) { |
1920 | 1920 | $_modifier_name = $_modifiers[$_i]; |
1921 | 1921 | |
1922 | - if($_modifier_name == 'smarty') { |
|
1922 | + if ($_modifier_name == 'smarty') { |
|
1923 | 1923 | // skip smarty modifier |
1924 | 1924 | continue; |
1925 | 1925 | } |
1926 | 1926 | |
1927 | - preg_match_all('~:(' . $this->_qstr_regexp . '|[^:]+)~', $modifier_arg_strings[$_i], $_match); |
|
1927 | + preg_match_all('~:('.$this->_qstr_regexp.'|[^:]+)~', $modifier_arg_strings[$_i], $_match); |
|
1928 | 1928 | $_modifier_args = $_match[1]; |
1929 | 1929 | |
1930 | 1930 | if (substr($_modifier_name, 0, 1) == '@') { |
@@ -1938,22 +1938,22 @@ discard block |
||
1938 | 1938 | && !$this->_get_plugin_filepath('modifier', $_modifier_name) |
1939 | 1939 | && function_exists($_modifier_name)) { |
1940 | 1940 | if ($this->security && !in_array($_modifier_name, $this->security_settings['MODIFIER_FUNCS'])) { |
1941 | - $this->_trigger_fatal_error("[plugin] (secure mode) modifier '$_modifier_name' is not allowed" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); |
|
1941 | + $this->_trigger_fatal_error("[plugin] (secure mode) modifier '$_modifier_name' is not allowed", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); |
|
1942 | 1942 | } else { |
1943 | - $this->_plugins['modifier'][$_modifier_name] = array($_modifier_name, null, null, false); |
|
1943 | + $this->_plugins['modifier'][$_modifier_name] = array($_modifier_name, null, null, false); |
|
1944 | 1944 | } |
1945 | 1945 | } |
1946 | 1946 | $this->_add_plugin('modifier', $_modifier_name); |
1947 | 1947 | |
1948 | 1948 | $this->_parse_vars_props($_modifier_args); |
1949 | 1949 | |
1950 | - if($_modifier_name == 'default') { |
|
1950 | + if ($_modifier_name == 'default') { |
|
1951 | 1951 | // supress notifications of default modifier vars and args |
1952 | - if(substr($output, 0, 1) == '$') { |
|
1953 | - $output = '@' . $output; |
|
1952 | + if (substr($output, 0, 1) == '$') { |
|
1953 | + $output = '@'.$output; |
|
1954 | 1954 | } |
1955 | - if(isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') { |
|
1956 | - $_modifier_args[0] = '@' . $_modifier_args[0]; |
|
1955 | + if (isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') { |
|
1956 | + $_modifier_args[0] = '@'.$_modifier_args[0]; |
|
1957 | 1957 | } |
1958 | 1958 | } |
1959 | 1959 | if (count($_modifier_args) > 0) |
@@ -1962,7 +1962,7 @@ discard block |
||
1962 | 1962 | $_modifier_args = ''; |
1963 | 1963 | |
1964 | 1964 | if ($_map_array) { |
1965 | - $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))"; |
|
1965 | + $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : ".$this->_compile_plugin_call('modifier', $_modifier_name)."(\$_tmp$_modifier_args))"; |
|
1966 | 1966 | |
1967 | 1967 | } else { |
1968 | 1968 | |
@@ -2003,9 +2003,9 @@ discard block |
||
2003 | 2003 | { |
2004 | 2004 | /* Extract the reference name. */ |
2005 | 2005 | $_ref = substr($indexes[0], 1); |
2006 | - foreach($indexes as $_index_no=>$_index) { |
|
2007 | - if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) { |
|
2008 | - $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); |
|
2006 | + foreach ($indexes as $_index_no=>$_index) { |
|
2007 | + if (substr($_index, 0, 1) != '.' && $_index_no < 2 || !preg_match('~^(\.|\[|->)~', $_index)) { |
|
2008 | + $this->_syntax_error('$smarty'.implode('', array_slice($indexes, 0, 2)).' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); |
|
2009 | 2009 | } |
2010 | 2010 | } |
2011 | 2011 | |
@@ -2129,7 +2129,7 @@ discard block |
||
2129 | 2129 | return null; |
2130 | 2130 | |
2131 | 2131 | case 'template': |
2132 | - $compiled_ref = "'" . addslashes($this->_current_file) . "'"; |
|
2132 | + $compiled_ref = "'".addslashes($this->_current_file)."'"; |
|
2133 | 2133 | $_max_index = 1; |
2134 | 2134 | break; |
2135 | 2135 | |
@@ -2146,10 +2146,10 @@ discard block |
||
2146 | 2146 | } |
2147 | 2147 | array_shift($indexes); |
2148 | 2148 | if (preg_match('!^\.\w+$!', $indexes[0])) { |
2149 | - $compiled_ref = '@' . substr($indexes[0], 1); |
|
2149 | + $compiled_ref = '@'.substr($indexes[0], 1); |
|
2150 | 2150 | } else { |
2151 | 2151 | $_val = $this->_parse_var_props(substr($indexes[0], 1)); |
2152 | - $compiled_ref = '@constant(' . $_val . ')'; |
|
2152 | + $compiled_ref = '@constant('.$_val.')'; |
|
2153 | 2153 | } |
2154 | 2154 | $_max_index = 1; |
2155 | 2155 | break; |
@@ -2168,12 +2168,12 @@ discard block |
||
2168 | 2168 | break; |
2169 | 2169 | |
2170 | 2170 | default: |
2171 | - $this->_syntax_error('$smarty.' . $_ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__); |
|
2171 | + $this->_syntax_error('$smarty.'.$_ref.' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__); |
|
2172 | 2172 | break; |
2173 | 2173 | } |
2174 | 2174 | |
2175 | 2175 | if (isset($_max_index) && count($indexes) > $_max_index) { |
2176 | - $this->_syntax_error('$smarty' . implode('', $indexes) .' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); |
|
2176 | + $this->_syntax_error('$smarty'.implode('', $indexes).' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); |
|
2177 | 2177 | } |
2178 | 2178 | |
2179 | 2179 | array_shift($indexes); |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | return ((is_object($this->_plugins[$type][$name][0][0])) ? |
2198 | 2198 | "\$this->_plugins['$type']['$name'][0][0]->" /* method callback */ |
2199 | 2199 | : (string)($this->_plugins[$type][$name][0][0]).'::' /* class callback */ |
2200 | - ). $this->_plugins[$type][$name][0][1]; |
|
2200 | + ).$this->_plugins[$type][$name][0][1]; |
|
2201 | 2201 | |
2202 | 2202 | } else { |
2203 | 2203 | /* function callback */ |
@@ -2221,7 +2221,7 @@ discard block |
||
2221 | 2221 | if ($prefilter === false) { |
2222 | 2222 | unset($this->_plugins['prefilter'][$filter_name]); |
2223 | 2223 | $_params = array('plugins' => array(array('prefilter', $filter_name, null, null, false))); |
2224 | - require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); |
|
2224 | + require_once(SMARTY_CORE_DIR.'core.load_plugins.php'); |
|
2225 | 2225 | smarty_core_load_plugins($_params, $this); |
2226 | 2226 | } |
2227 | 2227 | } |
@@ -2231,7 +2231,7 @@ discard block |
||
2231 | 2231 | if ($postfilter === false) { |
2232 | 2232 | unset($this->_plugins['postfilter'][$filter_name]); |
2233 | 2233 | $_params = array('plugins' => array(array('postfilter', $filter_name, null, null, false))); |
2234 | - require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); |
|
2234 | + require_once(SMARTY_CORE_DIR.'core.load_plugins.php'); |
|
2235 | 2235 | smarty_core_load_plugins($_params, $this); |
2236 | 2236 | } |
2237 | 2237 | } |
@@ -2258,7 +2258,7 @@ discard block |
||
2258 | 2258 | * @param string $file |
2259 | 2259 | * @param integer $line |
2260 | 2260 | */ |
2261 | - function _syntax_error($error_msg, $error_type = E_USER_ERROR, $file=null, $line=null) |
|
2261 | + function _syntax_error($error_msg, $error_type = E_USER_ERROR, $file = null, $line = null) |
|
2262 | 2262 | { |
2263 | 2263 | $this->_trigger_fatal_error("syntax error: $error_msg", $this->_current_file, $this->_current_line_no, $file, $line, $error_type); |
2264 | 2264 | } |
@@ -2273,10 +2273,10 @@ discard block |
||
2273 | 2273 | function _push_cacheable_state($type, $name) { |
2274 | 2274 | $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; |
2275 | 2275 | if ($_cacheable |
2276 | - || 0<$this->_cacheable_state++) return ''; |
|
2276 | + || 0 < $this->_cacheable_state++) return ''; |
|
2277 | 2277 | if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty')); |
2278 | 2278 | $_ret = 'if ($this->caching && !$this->_cache_including): echo \'{nocache:' |
2279 | - . $this->_cache_serial . '#' . $this->_nocache_count |
|
2279 | + . $this->_cache_serial.'#'.$this->_nocache_count |
|
2280 | 2280 | . '}\'; endif;'; |
2281 | 2281 | return $_ret; |
2282 | 2282 | } |
@@ -2291,9 +2291,9 @@ discard block |
||
2291 | 2291 | function _pop_cacheable_state($type, $name) { |
2292 | 2292 | $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; |
2293 | 2293 | if ($_cacheable |
2294 | - || --$this->_cacheable_state>0) return ''; |
|
2294 | + || --$this->_cacheable_state > 0) return ''; |
|
2295 | 2295 | return 'if ($this->caching && !$this->_cache_including): echo \'{/nocache:' |
2296 | - . $this->_cache_serial . '#' . ($this->_nocache_count++) |
|
2296 | + . $this->_cache_serial.'#'.($this->_nocache_count++) |
|
2297 | 2297 | . '}\'; endif;'; |
2298 | 2298 | } |
2299 | 2299 | |
@@ -2316,12 +2316,12 @@ discard block |
||
2316 | 2316 | function _pop_tag($close_tag) |
2317 | 2317 | { |
2318 | 2318 | $message = ''; |
2319 | - if (count($this->_tag_stack)>0) { |
|
2319 | + if (count($this->_tag_stack) > 0) { |
|
2320 | 2320 | list($_open_tag, $_line_no) = array_pop($this->_tag_stack); |
2321 | 2321 | if ($close_tag == $_open_tag) { |
2322 | 2322 | return $_open_tag; |
2323 | 2323 | } |
2324 | - if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif' )) { |
|
2324 | + if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif')) { |
|
2325 | 2325 | return $this->_pop_tag($close_tag); |
2326 | 2326 | } |
2327 | 2327 | if ($close_tag == 'section' && $_open_tag == 'sectionelse') { |
@@ -2357,10 +2357,10 @@ discard block |
||
2357 | 2357 | */ |
2358 | 2358 | function _smarty_sort_length($a, $b) |
2359 | 2359 | { |
2360 | - if($a == $b) |
|
2360 | + if ($a == $b) |
|
2361 | 2361 | return 0; |
2362 | 2362 | |
2363 | - if(strlen($a) == strlen($b)) |
|
2363 | + if (strlen($a) == strlen($b)) |
|
2364 | 2364 | return ($a > $b) ? -1 : 1; |
2365 | 2365 | |
2366 | 2366 | return (strlen($a) > strlen($b)) ? -1 : 1; |
@@ -243,7 +243,9 @@ discard block |
||
243 | 243 | // run template source through prefilter functions |
244 | 244 | if (count($this->_plugins['prefilter']) > 0) { |
245 | 245 | foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { |
246 | - if ($prefilter === false) continue; |
|
246 | + if ($prefilter === false) { |
|
247 | + continue; |
|
248 | + } |
|
247 | 249 | if ($prefilter[3] || is_callable($prefilter[0])) { |
248 | 250 | $source_content = call_user_func_array($prefilter[0], |
249 | 251 | array($source_content, &$this)); |
@@ -385,7 +387,9 @@ discard block |
||
385 | 387 | // run compiled template through postfilter functions |
386 | 388 | if (count($this->_plugins['postfilter']) > 0) { |
387 | 389 | foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { |
388 | - if ($postfilter === false) continue; |
|
390 | + if ($postfilter === false) { |
|
391 | + continue; |
|
392 | + } |
|
389 | 393 | if ($postfilter[3] || is_callable($postfilter[0])) { |
390 | 394 | $compiled_content = call_user_func_array($postfilter[0], |
391 | 395 | array($compiled_content, &$this)); |
@@ -435,8 +439,9 @@ discard block |
||
435 | 439 | function _compile_tag($template_tag) |
436 | 440 | { |
437 | 441 | /* Matched comment. */ |
438 | - if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*') |
|
439 | - return ''; |
|
442 | + if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*') { |
|
443 | + return ''; |
|
444 | + } |
|
440 | 445 | |
441 | 446 | /* Split tag into two three parts: command, command modifiers and the arguments. */ |
442 | 447 | if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp |
@@ -474,18 +479,21 @@ discard block |
||
474 | 479 | |
475 | 480 | case 'else': |
476 | 481 | list($_open_tag) = end($this->_tag_stack); |
477 | - if ($_open_tag != 'if' && $_open_tag != 'elseif') |
|
478 | - $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__); |
|
479 | - else |
|
480 | - $this->_push_tag('else'); |
|
482 | + if ($_open_tag != 'if' && $_open_tag != 'elseif') { |
|
483 | + $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__); |
|
484 | + } else { |
|
485 | + $this->_push_tag('else'); |
|
486 | + } |
|
481 | 487 | return '<?php else: ?>'; |
482 | 488 | |
483 | 489 | case 'elseif': |
484 | 490 | list($_open_tag) = end($this->_tag_stack); |
485 | - if ($_open_tag != 'if' && $_open_tag != 'elseif') |
|
486 | - $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__); |
|
487 | - if ($_open_tag == 'if') |
|
488 | - $this->_push_tag('elseif'); |
|
491 | + if ($_open_tag != 'if' && $_open_tag != 'elseif') { |
|
492 | + $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__); |
|
493 | + } |
|
494 | + if ($_open_tag == 'if') { |
|
495 | + $this->_push_tag('elseif'); |
|
496 | + } |
|
489 | 497 | return $this->_compile_if_tag($tag_args, true); |
490 | 498 | |
491 | 499 | case '/if': |
@@ -515,10 +523,11 @@ discard block |
||
515 | 523 | |
516 | 524 | case '/section': |
517 | 525 | $_open_tag = $this->_pop_tag('section'); |
518 | - if ($_open_tag == 'sectionelse') |
|
519 | - return "<?php endif; ?>"; |
|
520 | - else |
|
521 | - return "<?php endfor; endif; ?>"; |
|
526 | + if ($_open_tag == 'sectionelse') { |
|
527 | + return "<?php endif; ?>"; |
|
528 | + } else { |
|
529 | + return "<?php endfor; endif; ?>"; |
|
530 | + } |
|
522 | 531 | |
523 | 532 | case 'foreach': |
524 | 533 | $this->_push_tag('foreach'); |
@@ -531,10 +540,11 @@ discard block |
||
531 | 540 | |
532 | 541 | case '/foreach': |
533 | 542 | $_open_tag = $this->_pop_tag('foreach'); |
534 | - if ($_open_tag == 'foreachelse') |
|
535 | - return "<?php endif; unset(\$_from); ?>"; |
|
536 | - else |
|
537 | - return "<?php endforeach; endif; unset(\$_from); ?>"; |
|
543 | + if ($_open_tag == 'foreachelse') { |
|
544 | + return "<?php endif; unset(\$_from); ?>"; |
|
545 | + } else { |
|
546 | + return "<?php endforeach; endif; unset(\$_from); ?>"; |
|
547 | + } |
|
538 | 548 | break; |
539 | 549 | |
540 | 550 | case 'strip': |
@@ -677,8 +687,9 @@ discard block |
||
677 | 687 | if (substr($tag_command, 0, 1) == '/') { |
678 | 688 | $start_tag = false; |
679 | 689 | $tag_command = substr($tag_command, 1); |
680 | - } else |
|
681 | - $start_tag = true; |
|
690 | + } else { |
|
691 | + $start_tag = true; |
|
692 | + } |
|
682 | 693 | |
683 | 694 | $found = false; |
684 | 695 | $have_function = true; |
@@ -728,10 +739,11 @@ discard block |
||
728 | 739 | */ |
729 | 740 | $this->_add_plugin('block', $tag_command); |
730 | 741 | |
731 | - if ($start_tag) |
|
732 | - $this->_push_tag($tag_command); |
|
733 | - else |
|
734 | - $this->_pop_tag($tag_command); |
|
742 | + if ($start_tag) { |
|
743 | + $this->_push_tag($tag_command); |
|
744 | + } else { |
|
745 | + $this->_pop_tag($tag_command); |
|
746 | + } |
|
735 | 747 | |
736 | 748 | if ($start_tag) { |
737 | 749 | $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command); |
@@ -856,8 +868,9 @@ discard block |
||
856 | 868 | unset($attrs['assign']); |
857 | 869 | continue; |
858 | 870 | } |
859 | - if (is_bool($arg_value)) |
|
860 | - $arg_value = $arg_value ? 'true' : 'false'; |
|
871 | + if (is_bool($arg_value)) { |
|
872 | + $arg_value = $arg_value ? 'true' : 'false'; |
|
873 | + } |
|
861 | 874 | $arg_list[] = "'$arg_name' => $arg_value"; |
862 | 875 | } |
863 | 876 | } |
@@ -948,8 +961,9 @@ discard block |
||
948 | 961 | } |
949 | 962 | |
950 | 963 | foreach ($attrs as $arg_name => $arg_value) { |
951 | - if (is_bool($arg_value)) |
|
952 | - $arg_value = $arg_value ? 'true' : 'false'; |
|
964 | + if (is_bool($arg_value)) { |
|
965 | + $arg_value = $arg_value ? 'true' : 'false'; |
|
966 | + } |
|
953 | 967 | $arg_list[] = "'$arg_name' => $arg_value"; |
954 | 968 | } |
955 | 969 | |
@@ -987,13 +1001,15 @@ discard block |
||
987 | 1001 | $theme_template = $arg_value; |
988 | 1002 | continue; |
989 | 1003 | } |
990 | - if (is_bool($arg_value)) |
|
991 | - $arg_value = $arg_value ? 'true' : 'false'; |
|
1004 | + if (is_bool($arg_value)) { |
|
1005 | + $arg_value = $arg_value ? 'true' : 'false'; |
|
1006 | + } |
|
992 | 1007 | $arg_list[] = "'$arg_name' => $arg_value"; |
993 | 1008 | } |
994 | 1009 | |
995 | - if ( $theme_template == 'true' ) |
|
996 | - $include_file = '"'.SugarThemeRegistry::current()->getTemplate(str_replace(array('"',"'"),'',$include_file)).'"'; |
|
1010 | + if ( $theme_template == 'true' ) { |
|
1011 | + $include_file = '"'.SugarThemeRegistry::current()->getTemplate(str_replace(array('"',"'"),'',$include_file)).'"'; |
|
1012 | + } |
|
997 | 1013 | |
998 | 1014 | $output = '<?php '; |
999 | 1015 | |
@@ -1040,8 +1056,9 @@ discard block |
||
1040 | 1056 | $arg_list = array(); |
1041 | 1057 | foreach($attrs as $arg_name => $arg_value) { |
1042 | 1058 | if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { |
1043 | - if(is_bool($arg_value)) |
|
1044 | - $arg_value = $arg_value ? 'true' : 'false'; |
|
1059 | + if(is_bool($arg_value)) { |
|
1060 | + $arg_value = $arg_value ? 'true' : 'false'; |
|
1061 | + } |
|
1045 | 1062 | $arg_list[] = "'$arg_name' => $arg_value"; |
1046 | 1063 | } |
1047 | 1064 | } |
@@ -1079,10 +1096,11 @@ discard block |
||
1079 | 1096 | break; |
1080 | 1097 | |
1081 | 1098 | case 'show': |
1082 | - if (is_bool($attr_value)) |
|
1083 | - $show_attr_value = $attr_value ? 'true' : 'false'; |
|
1084 | - else |
|
1085 | - $show_attr_value = "(bool)$attr_value"; |
|
1099 | + if (is_bool($attr_value)) { |
|
1100 | + $show_attr_value = $attr_value ? 'true' : 'false'; |
|
1101 | + } else { |
|
1102 | + $show_attr_value = "(bool)$attr_value"; |
|
1103 | + } |
|
1086 | 1104 | $output .= "{$section_props}['show'] = $show_attr_value;\n"; |
1087 | 1105 | break; |
1088 | 1106 | |
@@ -1105,24 +1123,28 @@ discard block |
||
1105 | 1123 | } |
1106 | 1124 | } |
1107 | 1125 | |
1108 | - if (!isset($attrs['show'])) |
|
1109 | - $output .= "{$section_props}['show'] = true;\n"; |
|
1126 | + if (!isset($attrs['show'])) { |
|
1127 | + $output .= "{$section_props}['show'] = true;\n"; |
|
1128 | + } |
|
1110 | 1129 | |
1111 | - if (!isset($attrs['loop'])) |
|
1112 | - $output .= "{$section_props}['loop'] = 1;\n"; |
|
1130 | + if (!isset($attrs['loop'])) { |
|
1131 | + $output .= "{$section_props}['loop'] = 1;\n"; |
|
1132 | + } |
|
1113 | 1133 | |
1114 | - if (!isset($attrs['max'])) |
|
1115 | - $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; |
|
1116 | - else |
|
1117 | - $output .= "if ({$section_props}['max'] < 0)\n" . |
|
1134 | + if (!isset($attrs['max'])) { |
|
1135 | + $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; |
|
1136 | + } else { |
|
1137 | + $output .= "if ({$section_props}['max'] < 0)\n" . |
|
1118 | 1138 | " {$section_props}['max'] = {$section_props}['loop'];\n"; |
1139 | + } |
|
1119 | 1140 | |
1120 | - if (!isset($attrs['step'])) |
|
1121 | - $output .= "{$section_props}['step'] = 1;\n"; |
|
1141 | + if (!isset($attrs['step'])) { |
|
1142 | + $output .= "{$section_props}['step'] = 1;\n"; |
|
1143 | + } |
|
1122 | 1144 | |
1123 | - if (!isset($attrs['start'])) |
|
1124 | - $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; |
|
1125 | - else { |
|
1145 | + if (!isset($attrs['start'])) { |
|
1146 | + $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; |
|
1147 | + } else { |
|
1126 | 1148 | $output .= "if ({$section_props}['start'] < 0)\n" . |
1127 | 1149 | " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . |
1128 | 1150 | "else\n" . |
@@ -1377,8 +1399,9 @@ discard block |
||
1377 | 1399 | $is_arg_start--; |
1378 | 1400 | } |
1379 | 1401 | } |
1380 | - } else |
|
1381 | - $is_arg_start = $i-1; |
|
1402 | + } else { |
|
1403 | + $is_arg_start = $i-1; |
|
1404 | + } |
|
1382 | 1405 | /* Construct the argument for 'is' expression, so it knows |
1383 | 1406 | what to operate on. */ |
1384 | 1407 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
@@ -1420,10 +1443,11 @@ discard block |
||
1420 | 1443 | } |
1421 | 1444 | } |
1422 | 1445 | |
1423 | - if ($elseif) |
|
1424 | - return '<?php elseif ('.implode(' ', $tokens).'): ?>'; |
|
1425 | - else |
|
1426 | - return '<?php if ('.implode(' ', $tokens).'): ?>'; |
|
1446 | + if ($elseif) { |
|
1447 | + return '<?php elseif ('.implode(' ', $tokens).'): ?>'; |
|
1448 | + } else { |
|
1449 | + return '<?php if ('.implode(' ', $tokens).'): ?>'; |
|
1450 | + } |
|
1427 | 1451 | } |
1428 | 1452 | |
1429 | 1453 | |
@@ -1447,10 +1471,12 @@ discard block |
||
1447 | 1471 | } |
1448 | 1472 | |
1449 | 1473 | foreach ($attrs as $arg_name => $arg_value) { |
1450 | - if (is_bool($arg_value)) |
|
1451 | - $arg_value = $arg_value ? 'true' : 'false'; |
|
1452 | - if (is_null($arg_value)) |
|
1453 | - $arg_value = 'null'; |
|
1474 | + if (is_bool($arg_value)) { |
|
1475 | + $arg_value = $arg_value ? 'true' : 'false'; |
|
1476 | + } |
|
1477 | + if (is_null($arg_value)) { |
|
1478 | + $arg_value = 'null'; |
|
1479 | + } |
|
1454 | 1480 | if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) { |
1455 | 1481 | $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)"; |
1456 | 1482 | } else { |
@@ -1475,8 +1501,9 @@ discard block |
||
1475 | 1501 | if (($first_token = array_shift($tokens)) == 'not') { |
1476 | 1502 | $negate_expr = true; |
1477 | 1503 | $expr_type = array_shift($tokens); |
1478 | - } else |
|
1479 | - $expr_type = $first_token; |
|
1504 | + } else { |
|
1505 | + $expr_type = $first_token; |
|
1506 | + } |
|
1480 | 1507 | |
1481 | 1508 | switch ($expr_type) { |
1482 | 1509 | case 'even': |
@@ -1484,8 +1511,9 @@ discard block |
||
1484 | 1511 | $expr_end++; |
1485 | 1512 | $expr_arg = $tokens[$expr_end++]; |
1486 | 1513 | $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; |
1487 | - } else |
|
1488 | - $expr = "!(1 & $is_arg)"; |
|
1514 | + } else { |
|
1515 | + $expr = "!(1 & $is_arg)"; |
|
1516 | + } |
|
1489 | 1517 | break; |
1490 | 1518 | |
1491 | 1519 | case 'odd': |
@@ -1493,8 +1521,9 @@ discard block |
||
1493 | 1521 | $expr_end++; |
1494 | 1522 | $expr_arg = $tokens[$expr_end++]; |
1495 | 1523 | $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; |
1496 | - } else |
|
1497 | - $expr = "(1 & $is_arg)"; |
|
1524 | + } else { |
|
1525 | + $expr = "(1 & $is_arg)"; |
|
1526 | + } |
|
1498 | 1527 | break; |
1499 | 1528 | |
1500 | 1529 | case 'div': |
@@ -1553,16 +1582,18 @@ discard block |
||
1553 | 1582 | if (preg_match('~^\w+$~', $token)) { |
1554 | 1583 | $attr_name = $token; |
1555 | 1584 | $state = 1; |
1556 | - } else |
|
1557 | - $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__); |
|
1585 | + } else { |
|
1586 | + $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__); |
|
1587 | + } |
|
1558 | 1588 | break; |
1559 | 1589 | |
1560 | 1590 | case 1: |
1561 | 1591 | /* If the token is '=', then we go to state 2. */ |
1562 | 1592 | if ($token == '=') { |
1563 | 1593 | $state = 2; |
1564 | - } else |
|
1565 | - $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); |
|
1594 | + } else { |
|
1595 | + $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); |
|
1596 | + } |
|
1566 | 1597 | break; |
1567 | 1598 | |
1568 | 1599 | case 2: |
@@ -1586,8 +1617,9 @@ discard block |
||
1586 | 1617 | |
1587 | 1618 | $attrs[$attr_name] = $token; |
1588 | 1619 | $state = 0; |
1589 | - } else |
|
1590 | - $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__); |
|
1620 | + } else { |
|
1621 | + $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__); |
|
1622 | + } |
|
1591 | 1623 | break; |
1592 | 1624 | } |
1593 | 1625 | $last_token = $token; |
@@ -1649,32 +1681,27 @@ discard block |
||
1649 | 1681 | $this->_parse_modifiers($return, $match[2]); |
1650 | 1682 | } |
1651 | 1683 | return $return; |
1652 | - } |
|
1653 | - elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1684 | + } elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1654 | 1685 | // numerical constant |
1655 | 1686 | preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); |
1656 | 1687 | if($match[2] != '') { |
1657 | 1688 | $this->_parse_modifiers($match[1], $match[2]); |
1658 | 1689 | return $match[1]; |
1659 | 1690 | } |
1660 | - } |
|
1661 | - elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1691 | + } elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1662 | 1692 | // single quoted text |
1663 | 1693 | preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); |
1664 | 1694 | if($match[2] != '') { |
1665 | 1695 | $this->_parse_modifiers($match[1], $match[2]); |
1666 | 1696 | return $match[1]; |
1667 | 1697 | } |
1668 | - } |
|
1669 | - elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1698 | + } elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1670 | 1699 | // config var |
1671 | 1700 | return $this->_parse_conf_var($val); |
1672 | - } |
|
1673 | - elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1701 | + } elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { |
|
1674 | 1702 | // section var |
1675 | 1703 | return $this->_parse_section_prop($val); |
1676 | - } |
|
1677 | - elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) { |
|
1704 | + } elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) { |
|
1678 | 1705 | // literal string |
1679 | 1706 | return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"'); |
1680 | 1707 | } |
@@ -1737,8 +1764,9 @@ discard block |
||
1737 | 1764 | // just output the math operator to php |
1738 | 1765 | $_output .= $_math_var; |
1739 | 1766 | |
1740 | - if(empty($_first_var)) |
|
1741 | - $_first_var = $_complete_var; |
|
1767 | + if(empty($_first_var)) { |
|
1768 | + $_first_var = $_complete_var; |
|
1769 | + } |
|
1742 | 1770 | |
1743 | 1771 | $_complete_var = ""; |
1744 | 1772 | } else { |
@@ -1747,8 +1775,9 @@ discard block |
||
1747 | 1775 | } |
1748 | 1776 | } |
1749 | 1777 | if($_has_math) { |
1750 | - if(!empty($_complete_var) || is_numeric($_complete_var)) |
|
1751 | - $_output .= $this->_parse_var($_complete_var); |
|
1778 | + if(!empty($_complete_var) || is_numeric($_complete_var)) { |
|
1779 | + $_output .= $this->_parse_var($_complete_var); |
|
1780 | + } |
|
1752 | 1781 | |
1753 | 1782 | // get the modifiers working (only the last var from math + modifier is left) |
1754 | 1783 | $var_expr = $_complete_var; |
@@ -1756,10 +1785,11 @@ discard block |
||
1756 | 1785 | } |
1757 | 1786 | |
1758 | 1787 | // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit) |
1759 | - if(is_numeric(substr($var_expr, 0, 1))) |
|
1760 | - $_var_ref = $var_expr; |
|
1761 | - else |
|
1762 | - $_var_ref = substr($var_expr, 1); |
|
1788 | + if(is_numeric(substr($var_expr, 0, 1))) { |
|
1789 | + $_var_ref = $var_expr; |
|
1790 | + } else { |
|
1791 | + $_var_ref = substr($var_expr, 1); |
|
1792 | + } |
|
1763 | 1793 | |
1764 | 1794 | if(!$_has_math) { |
1765 | 1795 | |
@@ -1812,10 +1842,11 @@ discard block |
||
1812 | 1842 | $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]"; |
1813 | 1843 | } |
1814 | 1844 | } else if (substr($_index, 0, 1) == '.') { |
1815 | - if (substr($_index, 1, 1) == '$') |
|
1816 | - $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]"; |
|
1817 | - else |
|
1818 | - $_output .= "['" . substr($_index, 1) . "']"; |
|
1845 | + if (substr($_index, 1, 1) == '$') { |
|
1846 | + $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]"; |
|
1847 | + } else { |
|
1848 | + $_output .= "['" . substr($_index, 1) . "']"; |
|
1849 | + } |
|
1819 | 1850 | } else if (substr($_index,0,2) == '->') { |
1820 | 1851 | if(substr($_index,2,2) == '__') { |
1821 | 1852 | $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__); |
@@ -1956,10 +1987,11 @@ discard block |
||
1956 | 1987 | $_modifier_args[0] = '@' . $_modifier_args[0]; |
1957 | 1988 | } |
1958 | 1989 | } |
1959 | - if (count($_modifier_args) > 0) |
|
1960 | - $_modifier_args = ', '.implode(', ', $_modifier_args); |
|
1961 | - else |
|
1962 | - $_modifier_args = ''; |
|
1990 | + if (count($_modifier_args) > 0) { |
|
1991 | + $_modifier_args = ', '.implode(', ', $_modifier_args); |
|
1992 | + } else { |
|
1993 | + $_modifier_args = ''; |
|
1994 | + } |
|
1963 | 1995 | |
1964 | 1996 | if ($_map_array) { |
1965 | 1997 | $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))"; |
@@ -2273,8 +2305,12 @@ discard block |
||
2273 | 2305 | function _push_cacheable_state($type, $name) { |
2274 | 2306 | $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; |
2275 | 2307 | if ($_cacheable |
2276 | - || 0<$this->_cacheable_state++) return ''; |
|
2277 | - if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty')); |
|
2308 | + || 0<$this->_cacheable_state++) { |
|
2309 | + return ''; |
|
2310 | + } |
|
2311 | + if (!isset($this->_cache_serial)) { |
|
2312 | + $this->_cache_serial = md5(uniqid('Smarty')); |
|
2313 | + } |
|
2278 | 2314 | $_ret = 'if ($this->caching && !$this->_cache_including): echo \'{nocache:' |
2279 | 2315 | . $this->_cache_serial . '#' . $this->_nocache_count |
2280 | 2316 | . '}\'; endif;'; |
@@ -2291,7 +2327,9 @@ discard block |
||
2291 | 2327 | function _pop_cacheable_state($type, $name) { |
2292 | 2328 | $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; |
2293 | 2329 | if ($_cacheable |
2294 | - || --$this->_cacheable_state>0) return ''; |
|
2330 | + || --$this->_cacheable_state>0) { |
|
2331 | + return ''; |
|
2332 | + } |
|
2295 | 2333 | return 'if ($this->caching && !$this->_cache_including): echo \'{/nocache:' |
2296 | 2334 | . $this->_cache_serial . '#' . ($this->_nocache_count++) |
2297 | 2335 | . '}\'; endif;'; |
@@ -2357,11 +2395,13 @@ discard block |
||
2357 | 2395 | */ |
2358 | 2396 | function _smarty_sort_length($a, $b) |
2359 | 2397 | { |
2360 | - if($a == $b) |
|
2361 | - return 0; |
|
2398 | + if($a == $b) { |
|
2399 | + return 0; |
|
2400 | + } |
|
2362 | 2401 | |
2363 | - if(strlen($a) == strlen($b)) |
|
2364 | - return ($a > $b) ? -1 : 1; |
|
2402 | + if(strlen($a) == strlen($b)) { |
|
2403 | + return ($a > $b) ? -1 : 1; |
|
2404 | + } |
|
2365 | 2405 | |
2366 | 2406 | return (strlen($a) > strlen($b)) ? -1 : 1; |
2367 | 2407 | } |