@@ -378,6 +378,11 @@ |
||
378 | 378 | * Returns an string value |
379 | 379 | */ |
380 | 380 | |
381 | +/** |
|
382 | + * @param string $url_qry |
|
383 | + * @param string $module |
|
384 | + * @param string $related_module |
|
385 | + */ |
|
381 | 386 | function getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $related_module, $recordid) |
382 | 387 | { |
383 | 388 | $log = LoggerManager::getInstance(); |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | |
195 | 195 | //added to fix #5135 |
196 | 196 | if (AppRequest::get('from_homepage') == 'upcoming_activities' || AppRequest::get('from_homepage') == 'pending_activities') { |
197 | - $query.=' LEFT OUTER JOIN vtiger_recurringevents ON vtiger_recurringevents.activityid=vtiger_activity.activityid'; |
|
197 | + $query .= ' LEFT OUTER JOIN vtiger_recurringevents ON vtiger_recurringevents.activityid=vtiger_activity.activityid'; |
|
198 | 198 | } |
199 | 199 | //end |
200 | 200 | $instance = CRMEntity::getInstance($module); |
201 | - $query.=" WHERE vtiger_crmentity.deleted = 0 && activitytype != 'Emails' "; |
|
201 | + $query .= " WHERE vtiger_crmentity.deleted = 0 && activitytype != 'Emails' "; |
|
202 | 202 | $securityParameter = $instance->getUserAccessConditionsQuerySR($module, $current_user); |
203 | 203 | if ($securityParameter != '') |
204 | - $query.= $securityParameter; |
|
205 | - $query.= ' ' . $where; |
|
204 | + $query .= $securityParameter; |
|
205 | + $query .= ' ' . $where; |
|
206 | 206 | break; |
207 | 207 | Case "Emails": |
208 | 208 | $query = "SELECT DISTINCT vtiger_crmentity.crmid, vtiger_crmentity.smownerid, |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | $chars = preg_split('/(&[^;\s]+;)|/', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE); |
617 | 617 | $html_length = count($chars); |
618 | 618 | // check if we can predict the return value and save some processing time |
619 | - if (($html_length === 0) || ( $start >= $html_length) || ( isset($length) && ( $length <= -$html_length))) |
|
619 | + if (($html_length === 0) || ($start >= $html_length) || (isset($length) && ($length <= -$html_length))) |
|
620 | 620 | return ""; |
621 | 621 | |
622 | 622 | //calculate start position |
@@ -200,8 +200,9 @@ discard block |
||
200 | 200 | $instance = CRMEntity::getInstance($module); |
201 | 201 | $query.=" WHERE vtiger_crmentity.deleted = 0 && activitytype != 'Emails' "; |
202 | 202 | $securityParameter = $instance->getUserAccessConditionsQuerySR($module, $current_user); |
203 | - if ($securityParameter != '') |
|
204 | - $query.= $securityParameter; |
|
203 | + if ($securityParameter != '') { |
|
204 | + $query.= $securityParameter; |
|
205 | + } |
|
205 | 206 | $query.= ' ' . $where; |
206 | 207 | break; |
207 | 208 | Case "Emails": |
@@ -355,18 +356,21 @@ discard block |
||
355 | 356 | $start = $_SESSION['rlvs'][$module][$related]['start']; |
356 | 357 | } |
357 | 358 | } |
358 | - if (AppRequest::has('viewname') && AppRequest::get('viewname') != '') |
|
359 | - $lv_array['viewname'] = AppRequest::get('viewname'); |
|
359 | + if (AppRequest::has('viewname') && AppRequest::get('viewname') != '') { |
|
360 | + $lv_array['viewname'] = AppRequest::get('viewname'); |
|
361 | + } |
|
360 | 362 | |
361 | - if ($related == '') |
|
362 | - $_SESSION['lvs'][AppRequest::get('module')] = $lv_array; |
|
363 | - else |
|
364 | - $_SESSION['rlvs'][$module][$related] = $lv_array; |
|
363 | + if ($related == '') { |
|
364 | + $_SESSION['lvs'][AppRequest::get('module')] = $lv_array; |
|
365 | + } else { |
|
366 | + $_SESSION['rlvs'][$module][$related] = $lv_array; |
|
367 | + } |
|
365 | 368 | |
366 | 369 | if ($start < ceil($noofrows / $max_ent) && $start != '') { |
367 | 370 | $start = ceil($noofrows / $max_ent); |
368 | - if ($related == '') |
|
369 | - $_SESSION['lvs'][$currentModule]['start'] = $start; |
|
371 | + if ($related == '') { |
|
372 | + $_SESSION['lvs'][$currentModule]['start'] = $start; |
|
373 | + } |
|
370 | 374 | } |
371 | 375 | } |
372 | 376 | /* * Function to get the table headers for related listview |
@@ -389,8 +393,9 @@ discard block |
||
389 | 393 | |
390 | 394 | $relatedListResult = $adb->pquery('SELECT * FROM vtiger_relatedlists WHERE tabid=? AND |
391 | 395 | related_tabid=?', array($tabid, $relatedTabId)); |
392 | - if (empty($relatedListResult)) |
|
393 | - return; |
|
396 | + if (empty($relatedListResult)) { |
|
397 | + return; |
|
398 | + } |
|
394 | 399 | $relatedListRow = $adb->fetchByAssoc($relatedListResult); |
395 | 400 | $header = $relatedListRow['label']; |
396 | 401 | $actions = $relatedListRow['actions']; |
@@ -439,11 +444,12 @@ discard block |
||
439 | 444 | } |
440 | 445 | $output .= '</td>'; |
441 | 446 | $log->debug("Exiting getTableHeaderNavigation method ..."); |
442 | - if ($navigation_array['first'] == '') |
|
443 | - return; |
|
444 | - else |
|
445 | - return $output; |
|
446 | -} |
|
447 | + if ($navigation_array['first'] == '') { |
|
448 | + return; |
|
449 | + } else { |
|
450 | + return $output; |
|
451 | + } |
|
452 | + } |
|
447 | 453 | /* Function to get the Entity Id of a given Entity Name */ |
448 | 454 | |
449 | 455 | function getEntityId($module, $entityName) |
@@ -473,23 +479,26 @@ discard block |
||
473 | 479 | $entityId = $adb->query_result($result, 0, $entityidfield); |
474 | 480 | } |
475 | 481 | } |
476 | - if (!empty($entityId)) |
|
477 | - return $entityId; |
|
478 | - else |
|
479 | - return 0; |
|
480 | -} |
|
482 | + if (!empty($entityId)) { |
|
483 | + return $entityId; |
|
484 | + } else { |
|
485 | + return 0; |
|
486 | + } |
|
487 | + } |
|
481 | 488 | |
482 | 489 | function decode_html($str) |
483 | 490 | { |
484 | 491 | $defaultCharset = AppConfig::main('default_charset'); |
485 | - if (empty($default_charset)) |
|
486 | - $defaultCharset = 'UTF-8'; |
|
492 | + if (empty($default_charset)) { |
|
493 | + $defaultCharset = 'UTF-8'; |
|
494 | + } |
|
487 | 495 | // Direct Popup action or Ajax Popup action should be treated the same. |
488 | - if (AppRequest::get('action') == 'Popup' || (AppRequest::has('action') && AppRequest::get('file') == 'Popup')) |
|
489 | - return html_entity_decode($str); |
|
490 | - else |
|
491 | - return html_entity_decode($str, ENT_QUOTES, $defaultCharset); |
|
492 | -} |
|
496 | + if (AppRequest::get('action') == 'Popup' || (AppRequest::has('action') && AppRequest::get('file') == 'Popup')) { |
|
497 | + return html_entity_decode($str); |
|
498 | + } else { |
|
499 | + return html_entity_decode($str, ENT_QUOTES, $defaultCharset); |
|
500 | + } |
|
501 | + } |
|
493 | 502 | |
494 | 503 | function popup_decode_html($str) |
495 | 504 | { |
@@ -602,22 +611,25 @@ discard block |
||
602 | 611 | |
603 | 612 | function html_substr($str, $start, $length = NULL) |
604 | 613 | { |
605 | - if ($length === 0) |
|
606 | - return ""; |
|
614 | + if ($length === 0) { |
|
615 | + return ""; |
|
616 | + } |
|
607 | 617 | //check if we can simply use the built-in functions |
608 | 618 | if (strpos($str, '&') === false) { //No entities. Use built-in functions |
609 | - if ($length === NULL) |
|
610 | - return substr($str, $start); |
|
611 | - else |
|
612 | - return substr($str, $start, $length); |
|
619 | + if ($length === NULL) { |
|
620 | + return substr($str, $start); |
|
621 | + } else { |
|
622 | + return substr($str, $start, $length); |
|
623 | + } |
|
613 | 624 | } |
614 | 625 | |
615 | 626 | // create our array of characters and html entities |
616 | 627 | $chars = preg_split('/(&[^;\s]+;)|/', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE); |
617 | 628 | $html_length = count($chars); |
618 | 629 | // check if we can predict the return value and save some processing time |
619 | - if (($html_length === 0) || ( $start >= $html_length) || ( isset($length) && ( $length <= -$html_length))) |
|
620 | - return ""; |
|
630 | + if (($html_length === 0) || ( $start >= $html_length) || ( isset($length) && ( $length <= -$html_length))) { |
|
631 | + return ""; |
|
632 | + } |
|
621 | 633 | |
622 | 634 | //calculate start position |
623 | 635 | if ($start >= 0) { |
@@ -626,9 +638,10 @@ discard block |
||
626 | 638 | $start = max($start, -$html_length); |
627 | 639 | $real_start = $chars[$html_length + $start][1]; |
628 | 640 | } |
629 | - if (!isset($length)) // no $length argument passed, return all remaining characters |
|
641 | + if (!isset($length)) { |
|
642 | + // no $length argument passed, return all remaining characters |
|
630 | 643 | return substr($str, $real_start); |
631 | - else if ($length > 0) { // copy $length chars |
|
644 | + } else if ($length > 0) { // copy $length chars |
|
632 | 645 | if ($start + $length >= $html_length) { // return all remaining characters |
633 | 646 | return substr($str, $real_start); |
634 | 647 | } else { //return $length characters |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | /** Function to update user to vtiger_role mapping based on the userid |
190 | 190 | * @param $roleid -- Role Id:: Type varchar |
191 | - * @param $userid User Id:: Type integer |
|
191 | + * @param integer $userid User Id:: Type integer |
|
192 | 192 | * |
193 | 193 | */ |
194 | 194 | function updateUser2RoleMapping($roleid, $userid) |
@@ -233,6 +233,7 @@ discard block |
||
233 | 233 | * @param $recordid -- Record Id:: Type integer |
234 | 234 | * @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user |
235 | 235 | * |
236 | + * @return string |
|
236 | 237 | */ |
237 | 238 | function isPermitted($module, $actionname, $record_id = '') |
238 | 239 | { |
@@ -450,6 +451,9 @@ discard block |
||
450 | 451 | return $permission; |
451 | 452 | } |
452 | 453 | |
454 | +/** |
|
455 | + * @return string |
|
456 | + */ |
|
453 | 457 | function isPermittedBySharing($module, $tabid, $actionid, $record_id) |
454 | 458 | { |
455 | 459 | $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); |
@@ -1525,6 +1529,9 @@ discard block |
||
1525 | 1529 | return $shareGrpList; |
1526 | 1530 | } |
1527 | 1531 | |
1532 | +/** |
|
1533 | + * @param string $data_type |
|
1534 | + */ |
|
1528 | 1535 | function constructList($array, $data_type) |
1529 | 1536 | { |
1530 | 1537 | $log = LoggerManager::getInstance(); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | if (\AppConfig::security('PERMITTED_BY_RECORD_HIERARCHY')) { |
406 | 406 | $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); |
407 | 407 | $role = $userPrivilegesModel->getRoleDetail(); |
408 | - if ((($actionid == 3 || $actionid == 4) && $role->get('previewrelatedrecord') != 0 ) || (($actionid == 0 || $actionid == 1) && $role->get('editrelatedrecord') != 0 )) { |
|
408 | + if ((($actionid == 3 || $actionid == 4) && $role->get('previewrelatedrecord') != 0) || (($actionid == 0 || $actionid == 1) && $role->get('editrelatedrecord') != 0)) { |
|
409 | 409 | $parentRecord = Users_Privileges_Model::getParentRecord($record_id, $module, $role->get('previewrelatedrecord'), $actionid); |
410 | 410 | if ($parentRecord) { |
411 | 411 | $recordMetaData = vtlib\Functions::getCRMRecordMetadata($parentRecord); |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | $query = sprintf("SELECT shareid FROM %s WHERE %s = ?", $tablename, $colNameArr[0]); |
1085 | 1085 | $params = array($grpId); |
1086 | 1086 | if (sizeof($colNameArr) > 1) { |
1087 | - $query .=" or " . $colNameArr[1] . "=?"; |
|
1087 | + $query .= " or " . $colNameArr[1] . "=?"; |
|
1088 | 1088 | array_push($params, $grpId); |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | $query = sprintf("SELECT shareid FROM %s WHERE %s = ?", $tablename, $colNameArr[0]); |
1121 | 1121 | $params = array($grpId); |
1122 | 1122 | if (sizeof($colNameArr) > 1) { |
1123 | - $query .=" or " . $colNameArr[1] . "=?"; |
|
1123 | + $query .= " or " . $colNameArr[1] . "=?"; |
|
1124 | 1124 | array_push($params, $grpId); |
1125 | 1125 | } |
1126 | 1126 |
@@ -1732,8 +1732,9 @@ discard block |
||
1732 | 1732 | $params = array($tabid, $fieldname); |
1733 | 1733 | } |
1734 | 1734 | //Postgres 8 fixes |
1735 | - if ($adb->isPostgres()) |
|
1736 | - $query = fixPostgresQuery($query, $log, 0); |
|
1735 | + if ($adb->isPostgres()) { |
|
1736 | + $query = fixPostgresQuery($query, $log, 0); |
|
1737 | + } |
|
1737 | 1738 | |
1738 | 1739 | |
1739 | 1740 | $result = $adb->pquery($query, $params); |
@@ -1741,8 +1742,9 @@ discard block |
||
1741 | 1742 | $log->debug('Exiting getFieldVisibilityPermission method ...'); |
1742 | 1743 | |
1743 | 1744 | // Returns value as a string |
1744 | - if ($adb->num_rows($result) == 0) |
|
1745 | - return '1'; |
|
1745 | + if ($adb->num_rows($result) == 0) { |
|
1746 | + return '1'; |
|
1747 | + } |
|
1746 | 1748 | return ($adb->query_result($result, "0", "visible") . ""); |
1747 | 1749 | } |
1748 | 1750 | } |
@@ -1867,8 +1869,9 @@ discard block |
||
1867 | 1869 | $adb = PearDatabase::getInstance(); |
1868 | 1870 | $sharingModuleArray = []; |
1869 | 1871 | |
1870 | - if (empty($eliminateModules)) |
|
1871 | - $eliminateModules = []; |
|
1872 | + if (empty($eliminateModules)) { |
|
1873 | + $eliminateModules = []; |
|
1874 | + } |
|
1872 | 1875 | |
1873 | 1876 | $query = 'SELECT name FROM vtiger_tab WHERE presence=0 && ownedby = 0 && isentitytype = 1'; |
1874 | 1877 | $query .= " && name NOT IN('" . implode("','", $eliminateModules) . "')"; |
@@ -395,6 +395,9 @@ discard block |
||
395 | 395 | /** Report module information based on used. */ |
396 | 396 | static $_reportmodule_infoperuser_cache = []; |
397 | 397 | |
398 | + /** |
|
399 | + * @param string $reportid |
|
400 | + */ |
|
398 | 401 | static function lookupReport_Info($userid, $reportid) |
399 | 402 | { |
400 | 403 | |
@@ -406,6 +409,9 @@ discard block |
||
406 | 409 | return false; |
407 | 410 | } |
408 | 411 | |
412 | + /** |
|
413 | + * @param string $reportid |
|
414 | + */ |
|
409 | 415 | static function updateReport_Info($userid, $reportid, $primarymodule, $secondarymodules, $reporttype, $reportname, $description, $folderid, $owner) |
410 | 416 | { |
411 | 417 | if (!isset(self::$_reportmodule_infoperuser_cache[$userid])) { |
@@ -428,6 +434,9 @@ discard block |
||
428 | 434 | /** Report module sub-ordinate users information. */ |
429 | 435 | static $_reportmodule_subordinateuserid_cache = []; |
430 | 436 | |
437 | + /** |
|
438 | + * @param string $reportid |
|
439 | + */ |
|
431 | 440 | static function lookupReport_SubordinateUsers($reportid) |
432 | 441 | { |
433 | 442 | if (isset(self::$_reportmodule_subordinateuserid_cache[$reportid])) { |
@@ -436,6 +445,9 @@ discard block |
||
436 | 445 | return false; |
437 | 446 | } |
438 | 447 | |
448 | + /** |
|
449 | + * @param string $reportid |
|
450 | + */ |
|
439 | 451 | static function updateReport_SubordinateUsers($reportid, $userids) |
440 | 452 | { |
441 | 453 | self::$_reportmodule_subordinateuserid_cache[$reportid] = $userids; |
@@ -444,6 +456,9 @@ discard block |
||
444 | 456 | /** Report module information based on used. */ |
445 | 457 | static $_reportmodule_scheduledinfoperuser_cache = []; |
446 | 458 | |
459 | + /** |
|
460 | + * @param string $reportid |
|
461 | + */ |
|
447 | 462 | static function lookupReport_ScheduledInfo($userid, $reportid) |
448 | 463 | { |
449 | 464 | |
@@ -455,6 +470,10 @@ discard block |
||
455 | 470 | return false; |
456 | 471 | } |
457 | 472 | |
473 | + /** |
|
474 | + * @param string $reportid |
|
475 | + * @param boolean $isScheduled |
|
476 | + */ |
|
458 | 477 | static function updateReport_ScheduledInfo($userid, $reportid, $isScheduled, $scheduledFormat, $scheduledInterval, $scheduledRecipients, $scheduledTime) |
459 | 478 | { |
460 | 479 | if (!isset(self::$_reportmodule_scheduledinfoperuser_cache[$userid])) { |
@@ -479,6 +498,9 @@ discard block |
||
479 | 498 | self::$_userSignature[$userName] = $signature; |
480 | 499 | } |
481 | 500 | |
501 | + /** |
|
502 | + * @return string |
|
503 | + */ |
|
482 | 504 | public static function getUserSignature($userName) |
483 | 505 | { |
484 | 506 | return self::$_userSignature[$userName]; |
@@ -491,6 +513,9 @@ discard block |
||
491 | 513 | self::$_userFullName[$userName] = $fullName; |
492 | 514 | } |
493 | 515 | |
516 | + /** |
|
517 | + * @return string |
|
518 | + */ |
|
494 | 519 | public static function getUserFullName($userName) |
495 | 520 | { |
496 | 521 | return self::$_userFullName[$userName]; |
@@ -503,6 +528,9 @@ discard block |
||
503 | 528 | return self::$_report_field_bylabel[$module][$label]; |
504 | 529 | } |
505 | 530 | |
531 | + /** |
|
532 | + * @param string $label |
|
533 | + */ |
|
506 | 534 | public static function setReportFieldByLabel($module, $label, $fieldInfo) |
507 | 535 | { |
508 | 536 | self::$_report_field_bylabel[$module][$label] = $fieldInfo; |
@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | $__cache_vtiger_imagepath = []; |
19 | 19 | } |
20 | 20 | |
21 | +/** |
|
22 | + * @param string $imagename |
|
23 | + */ |
|
21 | 24 | function vtiger_imageurl($imagename, $themename) |
22 | 25 | { |
23 | 26 | global $__cache_vtiger_imagepath; |
@@ -200,6 +203,9 @@ discard block |
||
200 | 203 | } |
201 | 204 | } |
202 | 205 | |
206 | +/** |
|
207 | + * @param string $varname |
|
208 | + */ |
|
203 | 209 | function __vtlib_get_modulevar_value($module, $varname) |
204 | 210 | { |
205 | 211 | $mod_var_mapping = Array( |
@@ -497,7 +503,6 @@ discard block |
||
497 | 503 | /** |
498 | 504 | * Purify (Cleanup) malicious snippets of code from the input |
499 | 505 | * |
500 | - * @param String $value |
|
501 | 506 | * @param Boolean $ignore Skip cleaning of the input |
502 | 507 | * @return String |
503 | 508 | */ |
@@ -156,10 +156,11 @@ discard block |
||
156 | 156 | $old_dieOnError = $adb->dieOnError; |
157 | 157 | $adb->dieOnError = false; |
158 | 158 | |
159 | - if ($enable_disable === true) |
|
160 | - $enable_disable = 1; |
|
161 | - else if ($enable_disable === false) |
|
162 | - $enable_disable = 0; |
|
159 | + if ($enable_disable === true) { |
|
160 | + $enable_disable = 1; |
|
161 | + } else if ($enable_disable === false) { |
|
162 | + $enable_disable = 0; |
|
163 | + } |
|
163 | 164 | |
164 | 165 | $adb->pquery('UPDATE vtiger_language set active = ? WHERE prefix = ?', Array($enable_disable, $langprefix)); |
165 | 166 | |
@@ -195,8 +196,9 @@ discard block |
||
195 | 196 | |
196 | 197 | $checkfor = Array('table_name', 'table_index', 'related_tables', 'popup_fields', 'IsCustomModule'); |
197 | 198 | foreach ($checkfor as $check) { |
198 | - if (!isset($focus->$check)) |
|
199 | - $focus->$check = __vtlib_get_modulevar_value($module, $check); |
|
199 | + if (!isset($focus->$check)) { |
|
200 | + $focus->$check = __vtlib_get_modulevar_value($module, $check); |
|
201 | + } |
|
200 | 202 | } |
201 | 203 | } |
202 | 204 | |
@@ -356,8 +358,9 @@ discard block |
||
356 | 358 | function vtlib_tosingular($text) |
357 | 359 | { |
358 | 360 | $lastpos = strripos($text, 's'); |
359 | - if ($lastpos == strlen($text) - 1) |
|
360 | - return substr($text, 0, -1); |
|
361 | + if ($lastpos == strlen($text) - 1) { |
|
362 | + return substr($text, 0, -1); |
|
363 | + } |
|
361 | 364 | return $text; |
362 | 365 | } |
363 | 366 | |
@@ -377,8 +380,9 @@ discard block |
||
377 | 380 | $roleresCount = $adb->num_rows($roleres); |
378 | 381 | $allroles = []; |
379 | 382 | if ($roleresCount) { |
380 | - for ($index = 0; $index < $roleresCount; ++$index) |
|
381 | - $allroles[] = $adb->query_result($roleres, $index, 'roleid'); |
|
383 | + for ($index = 0; $index < $roleresCount; ++$index) { |
|
384 | + $allroles[] = $adb->query_result($roleres, $index, 'roleid'); |
|
385 | + } |
|
382 | 386 | } |
383 | 387 | sort($allroles); |
384 | 388 | |
@@ -401,8 +405,9 @@ discard block |
||
401 | 405 | foreach ($picklistval_roles as $picklistval => $pickvalroles) { |
402 | 406 | sort($pickvalroles); |
403 | 407 | $diff = array_diff($pickvalroles, $allroles); |
404 | - if (empty($diff)) |
|
405 | - $allrolevalues[] = $picklistval; |
|
408 | + if (empty($diff)) { |
|
409 | + $allrolevalues[] = $picklistval; |
|
410 | + } |
|
406 | 411 | } |
407 | 412 | |
408 | 413 | $log->debug('Exiting ' . __METHOD__ . ' method ...'); |
@@ -479,8 +484,9 @@ discard block |
||
479 | 484 | $tmpfile = 'vtiger' . time() . '-' . rand(1, 1000) . '.tmp'; |
480 | 485 | // Continue the loop unless we find a name that does not exists already. |
481 | 486 | $usefilename = "$dirpath/$tmpfile"; |
482 | - if (!file_exists($usefilename)) |
|
483 | - break; |
|
487 | + if (!file_exists($usefilename)) { |
|
488 | + break; |
|
489 | + } |
|
484 | 490 | } while (true); |
485 | 491 | $fh = @fopen($usefilename, 'a'); |
486 | 492 | if ($fh) { |
@@ -522,8 +528,9 @@ discard block |
||
522 | 528 | if (!$ignore) { |
523 | 529 | // Initialize the instance if it has not yet done |
524 | 530 | if ($__htmlpurifier_instance == false) { |
525 | - if (empty($use_charset)) |
|
526 | - $use_charset = 'UTF-8'; |
|
531 | + if (empty($use_charset)) { |
|
532 | + $use_charset = 'UTF-8'; |
|
533 | + } |
|
527 | 534 | |
528 | 535 | include_once ('libraries/htmlpurifier/library/HTMLPurifier.auto.php'); |
529 | 536 | |
@@ -590,8 +597,9 @@ discard block |
||
590 | 597 | if (!$ignore) { |
591 | 598 | // Initialize the instance if it has not yet done |
592 | 599 | if ($htmlPurifierForHtml == false) { |
593 | - if (empty($use_charset)) |
|
594 | - $use_charset = 'UTF-8'; |
|
600 | + if (empty($use_charset)) { |
|
601 | + $use_charset = 'UTF-8'; |
|
602 | + } |
|
595 | 603 | |
596 | 604 | include_once ('libraries/htmlpurifier/library/HTMLPurifier.auto.php'); |
597 | 605 |
@@ -48,6 +48,9 @@ |
||
48 | 48 | return $row; |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param boolean $t |
|
53 | + */ |
|
51 | 54 | public static function sanitizeData($newRow, $meta, $t = null) |
52 | 55 | { |
53 | 56 |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | $fieldColumnMapping = $meta->getFieldColumnMapping(); |
25 | 25 | $columnFieldMapping = array_flip($fieldColumnMapping); |
26 | 26 | foreach ($row as $col => $val) { |
27 | - if (array_key_exists($col, $columnFieldMapping)) |
|
28 | - $newRow[$columnFieldMapping[$col]] = $val; |
|
27 | + if (array_key_exists($col, $columnFieldMapping)) { |
|
28 | + $newRow[$columnFieldMapping[$col]] = $val; |
|
29 | + } |
|
29 | 30 | } |
30 | 31 | $newRow = DataTransform::sanitizeData($newRow, $meta, true); |
31 | 32 | return $newRow; |
@@ -149,8 +150,9 @@ discard block |
||
149 | 150 | $allFields = $meta->getFieldColumnMapping(); |
150 | 151 | $newRow = []; |
151 | 152 | foreach ($allFields as $field => $col) { |
152 | - if (isset($row[$field])) |
|
153 | - $newRow[$field] = $row[$field]; |
|
153 | + if (isset($row[$field])) { |
|
154 | + $newRow[$field] = $row[$field]; |
|
155 | + } |
|
154 | 156 | } |
155 | 157 | if (isset($row[$recordString])) { |
156 | 158 | $newRow[$recordString] = $row[$recordString]; |
@@ -41,6 +41,9 @@ |
||
41 | 41 | $$name; |
42 | 42 | } |
43 | 43 | |
44 | + /** |
|
45 | + * @param string $name |
|
46 | + */ |
|
44 | 47 | static function getGlobal($name) |
45 | 48 | { |
46 | 49 | global $$name; |
@@ -10,6 +10,9 @@ |
||
10 | 10 | |
11 | 11 | require_once("include/Webservices/QueryParser.php"); |
12 | 12 | |
13 | +/** |
|
14 | + * @param string $q |
|
15 | + */ |
|
13 | 16 | function vtws_query($q, $user) |
14 | 17 | { |
15 | 18 |
@@ -21,8 +21,9 @@ |
||
21 | 21 | // Cache the instance for re-use |
22 | 22 | $moduleRegex = "/[fF][rR][Oo][Mm]\s+([^\s;]+)/"; |
23 | 23 | $moduleName = ''; |
24 | - if (preg_match($moduleRegex, $q, $m)) |
|
25 | - $moduleName = trim($m[1]); |
|
24 | + if (preg_match($moduleRegex, $q, $m)) { |
|
25 | + $moduleName = trim($m[1]); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | if (!isset($vtws_create_cache[$moduleName]['webserviceobject'])) { |
28 | 29 | $webserviceObject = VtigerWebserviceObject::fromQuery($adb, $q); |
@@ -12,6 +12,9 @@ |
||
12 | 12 | include_once 'include/Webservices/Query.php'; |
13 | 13 | include_once 'include/Webservices/RelatedTypes.php'; |
14 | 14 | |
15 | +/** |
|
16 | + * @param string $query |
|
17 | + */ |
|
15 | 18 | function vtws_query_related($query, $id, $relatedLabel, $user, $filterClause = null) |
16 | 19 | { |
17 | 20 |
@@ -71,7 +71,7 @@ |
||
71 | 71 | if (!empty($filterClause)) { |
72 | 72 | $query .= " " . $filterClause; |
73 | 73 | } |
74 | - $query.=";"; |
|
74 | + $query .= ";"; |
|
75 | 75 | $relatedRecords = vtws_query($query, $user); |
76 | 76 | } |
77 | 77 |
@@ -46,6 +46,9 @@ |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | + /** |
|
50 | + * @param integer $relationId |
|
51 | + */ |
|
49 | 52 | private function getRelationMetaInfo($relationId) |
50 | 53 | { |
51 | 54 | return [ |