@@ -11,6 +11,9 @@ discard block |
||
| 11 | 11 | class VTWorkflowApplication |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $action |
|
| 16 | + */ |
|
| 14 | 17 | function __construct($action) |
| 15 | 18 | { |
| 16 | 19 | $this->request; |
@@ -36,6 +39,9 @@ discard block |
||
| 36 | 39 | return $_SERVER["REQUEST_URI"]; |
| 37 | 40 | } |
| 38 | 41 | |
| 42 | + /** |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 39 | 45 | function returnUrl() |
| 40 | 46 | { |
| 41 | 47 | return $this->returnUrl; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | /** |
| 481 | 481 | * Function gets the next trigger for the workflows |
| 482 | 482 | * @global <String> $default_timezone |
| 483 | - * @return type |
|
| 483 | + * @return string|null |
|
| 484 | 484 | */ |
| 485 | 485 | function getNextTriggerTime() |
| 486 | 486 | { |
@@ -525,8 +525,8 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | /** |
| 527 | 527 | * get next trigger time for daily |
| 528 | - * @param type $schTime |
|
| 529 | - * @return time |
|
| 528 | + * @param type $scheduledTime |
|
| 529 | + * @return string |
|
| 530 | 530 | */ |
| 531 | 531 | function getNextTriggerTimeForDaily($scheduledTime) |
| 532 | 532 | { |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | module_name=?, summary=?, test=?, execution_condition=?, defaultworkflow=?, filtersavedinnew=?, |
| 42 | 42 | schtypeid=?, schtime=?, schdayofmonth=?, schdayofweek=?, schannualdates=?, nexttrigger_time=? where workflow_id=?", array($wf->moduleName, $wf->description, $wf->test, $wf->executionCondition, $wf->defaultworkflow, $wf->filtersavedinnew, |
| 43 | 43 | $wf->schtypeid, $wf->schtime, $wf->schdayofmonth, $wf->schdayofweek, $wf->schannualdates, $wf->nexttrigger_time, $wf->id)); |
| 44 | - }else { |
|
| 44 | + } else { |
|
| 45 | 45 | $workflowId = $adb->getUniqueID("com_vtiger_workflows"); |
| 46 | 46 | $workflow->id = $workflowId; |
| 47 | 47 | $wf = $workflow; |
@@ -35,18 +35,20 @@ discard block |
||
| 35 | 35 | $adb = $this->adb; |
| 36 | 36 | if (isset($workflow->id)) { |
| 37 | 37 | $wf = $workflow; |
| 38 | - if ($wf->filtersavedinnew == null) |
|
| 39 | - $wf->filtersavedinnew = 5; |
|
| 38 | + if ($wf->filtersavedinnew == null) { |
|
| 39 | + $wf->filtersavedinnew = 5; |
|
| 40 | + } |
|
| 40 | 41 | $adb->pquery("update com_vtiger_workflows set |
| 41 | 42 | module_name=?, summary=?, test=?, execution_condition=?, defaultworkflow=?, filtersavedinnew=?, |
| 42 | 43 | schtypeid=?, schtime=?, schdayofmonth=?, schdayofweek=?, schannualdates=?, nexttrigger_time=? where workflow_id=?", array($wf->moduleName, $wf->description, $wf->test, $wf->executionCondition, $wf->defaultworkflow, $wf->filtersavedinnew, |
| 43 | 44 | $wf->schtypeid, $wf->schtime, $wf->schdayofmonth, $wf->schdayofweek, $wf->schannualdates, $wf->nexttrigger_time, $wf->id)); |
| 44 | - }else { |
|
| 45 | + } else { |
|
| 45 | 46 | $workflowId = $adb->getUniqueID("com_vtiger_workflows"); |
| 46 | 47 | $workflow->id = $workflowId; |
| 47 | 48 | $wf = $workflow; |
| 48 | - if ($wf->filtersavedinnew == null) |
|
| 49 | - $wf->filtersavedinnew = 5; |
|
| 49 | + if ($wf->filtersavedinnew == null) { |
|
| 50 | + $wf->filtersavedinnew = 5; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | $result = $adb->getColumnNames("com_vtiger_workflows"); |
| 52 | 54 | if (in_array("type", $result)) { |
@@ -155,8 +157,9 @@ discard block |
||
| 155 | 157 | $workflow = $this->getWorkflowInstance($row->type); |
| 156 | 158 | $workflow->setup($row->data); |
| 157 | 159 | |
| 158 | - if (!is_a($workflow, 'Workflow')) |
|
| 159 | - continue; |
|
| 160 | + if (!is_a($workflow, 'Workflow')) { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 160 | 163 | |
| 161 | 164 | $workflows[$i++] = $workflow; |
| 162 | 165 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * Retrieve a template given it's id |
| 42 | 42 | * |
| 43 | 43 | * @param $templateId The id of the template |
| 44 | - * @return The template object |
|
| 44 | + * @return VTWorkflowTemplate template object |
|
| 45 | 45 | */ |
| 46 | 46 | public function retrieveTemplate($templateId) |
| 47 | 47 | { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * The new workflow will also be added to the database. |
| 64 | 64 | * |
| 65 | - * @param $template The template to use |
|
| 65 | + * @param VTWorkflowTemplate $template The template to use |
|
| 66 | 66 | * @return A workflow object. |
| 67 | 67 | */ |
| 68 | 68 | public function createWorkflow($template) |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * This can be used for exporting templates from one |
| 146 | 146 | * machine to another |
| 147 | 147 | * |
| 148 | - * @return The string dump of the templates. |
|
| 148 | + * @return string string dump of the templates. |
|
| 149 | 149 | */ |
| 150 | 150 | public function dumpAllTemplates() |
| 151 | 151 | { |
@@ -113,8 +113,7 @@ |
||
| 113 | 113 | $adb = $this->adb; |
| 114 | 114 | if (is_numeric($template->id)) {//How do I check whether a member exists in php? |
| 115 | 115 | $templateId = $template->id; |
| 116 | - $adb->pquery("update com_vtiger_workflowtemplates set title=?," + |
|
| 117 | - " module_name=?, template=? where template_id=?", array($template->title, $template->moduleName, |
|
| 116 | + $adb->pquery("update com_vtiger_workflowtemplates set title=?," +" module_name=?, template=? where template_id=?", array($template->title, $template->moduleName, |
|
| 118 | 117 | $template->template, $templateId)); |
| 119 | 118 | return $templateId; |
| 120 | 119 | } else { |
@@ -126,6 +126,9 @@ discard block |
||
| 126 | 126 | $scheduledWorkflows = null; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param QueryGenerator $queryGenerator |
|
| 131 | + */ |
|
| 129 | 132 | public function addWorkflowConditionsToQueryGenerator($queryGenerator, $conditions) |
| 130 | 133 | { |
| 131 | 134 | $conditionMapping = array( |
@@ -232,7 +235,7 @@ discard block |
||
| 232 | 235 | /** |
| 233 | 236 | * Function parse the value based on the condition |
| 234 | 237 | * @param <Array> $condition |
| 235 | - * @return <String> |
|
| 238 | + * @return string |
|
| 236 | 239 | */ |
| 237 | 240 | public function _parseValueForDate($condition) |
| 238 | 241 | { |
@@ -175,8 +175,9 @@ |
||
| 175 | 175 | $operation = $condition['operation']; |
| 176 | 176 | |
| 177 | 177 | //Cannot handle this condition for scheduled workflows |
| 178 | - if ($operation == 'has changed') |
|
| 179 | - continue; |
|
| 178 | + if ($operation == 'has changed') { |
|
| 179 | + continue; |
|
| 180 | + } |
|
| 180 | 181 | |
| 181 | 182 | $value = $condition['value']; |
| 182 | 183 | if (in_array($operation, $this->_specialDateTimeOperator())) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * Function to set the Module to which the record belongs |
| 69 | 69 | * @param <String> $moduleName |
| 70 | - * @return Vtiger_Record_Model or Module Specific Record Model instance |
|
| 70 | + * @return CustomView_Record_Model or Module Specific Record Model instance |
|
| 71 | 71 | */ |
| 72 | 72 | public function setModule($moduleName) |
| 73 | 73 | { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * Function to set the Module to which the record belongs from the Module model instance |
| 80 | 80 | * @param <Vtiger_Module_Model> $module |
| 81 | - * @return Vtiger_Record_Model or Module Specific Record Model instance |
|
| 81 | + * @return CustomView_Record_Model or Module Specific Record Model instance |
|
| 82 | 82 | */ |
| 83 | 83 | public function setModuleFromInstance($module) |
| 84 | 84 | { |
@@ -1057,7 +1057,6 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | /** |
| 1059 | 1059 | * function to check duplicates from database |
| 1060 | - * @param <type> $viewName |
|
| 1061 | 1060 | * @param <type> module name entity type in database |
| 1062 | 1061 | * @return <boolean> true/false |
| 1063 | 1062 | */ |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $lockFields = $crmEntityModel->getLockFields(); |
| 298 | 298 | if (is_array($lockFields)) { |
| 299 | 299 | foreach ($lockFields as $fieldName => $fieldValues) { |
| 300 | - $listQuery .=' && ' . $baseTableName . '.' . $fieldName . ' NOT IN (' . generateQuestionMarks($fieldValues) . ')'; |
|
| 300 | + $listQuery .= ' && ' . $baseTableName . '.' . $fieldName . ' NOT IN (' . generateQuestionMarks($fieldValues) . ')'; |
|
| 301 | 301 | $params = array_merge($params, $fieldValues); |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $temp_val = explode(",", $advFitlerValue); |
| 454 | - if (($fieldType == 'date' || ($fieldType == 'time' && $fieldName != 'time_start' && $fieldName != 'time_end') || ($fieldType == 'datetime')) && ($fieldType != '' && $advFitlerValue != '' )) { |
|
| 454 | + if (($fieldType == 'date' || ($fieldType == 'time' && $fieldName != 'time_start' && $fieldName != 'time_end') || ($fieldType == 'datetime')) && ($fieldType != '' && $advFitlerValue != '')) { |
|
| 455 | 455 | $val = Array(); |
| 456 | 456 | for ($x = 0; $x < count($temp_val); $x++) { |
| 457 | 457 | //if date and time given then we have to convert the date and |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | inner join vtiger_cvadvfilter on vtiger_cvadvfilter.cvid = vtiger_customview.cvid |
| 673 | 673 | left join vtiger_cvadvfilter_grouping on vtiger_cvadvfilter.cvid = vtiger_cvadvfilter_grouping.cvid |
| 674 | 674 | and vtiger_cvadvfilter.groupid = vtiger_cvadvfilter_grouping.groupid'; |
| 675 | - $ssql.= " where vtiger_customview.cvid = ? && vtiger_cvadvfilter.groupid = ? order by vtiger_cvadvfilter.columnindex"; |
|
| 675 | + $ssql .= " where vtiger_customview.cvid = ? && vtiger_cvadvfilter.groupid = ? order by vtiger_cvadvfilter.columnindex"; |
|
| 676 | 676 | |
| 677 | 677 | $result = $db->pquery($ssql, array($this->getId(), $groupId)); |
| 678 | 678 | $noOfColumns = $db->num_rows($result); |
@@ -413,15 +413,17 @@ discard block |
||
| 413 | 413 | $advFilterList = $this->get('advfilterlist'); |
| 414 | 414 | if (!empty($advFilterList)) { |
| 415 | 415 | foreach ($advFilterList as $groupIndex => $groupInfo) { |
| 416 | - if (empty($groupInfo)) |
|
| 417 | - continue; |
|
| 416 | + if (empty($groupInfo)) { |
|
| 417 | + continue; |
|
| 418 | + } |
|
| 418 | 419 | |
| 419 | 420 | $groupColumns = $groupInfo['columns']; |
| 420 | 421 | $groupCondition = $groupInfo['condition']; |
| 421 | 422 | |
| 422 | 423 | foreach ($groupColumns as $columnIndex => $columnCondition) { |
| 423 | - if (empty($columnCondition)) |
|
| 424 | - continue; |
|
| 424 | + if (empty($columnCondition)) { |
|
| 425 | + continue; |
|
| 426 | + } |
|
| 425 | 427 | |
| 426 | 428 | $advFilterColumn = $columnCondition['columnname']; |
| 427 | 429 | $advFilterComparator = $columnCondition['comparator']; |
@@ -494,8 +496,10 @@ discard block |
||
| 494 | 496 | } |
| 495 | 497 | |
| 496 | 498 | $groupConditionExpression = $advFilterList[$groupIndex]["conditionexpression"]; |
| 497 | - if (empty($groupConditionExpression)) |
|
| 498 | - continue; // Case when the group doesn't have any column criteria |
|
| 499 | + if (empty($groupConditionExpression)) { |
|
| 500 | + continue; |
|
| 501 | + } |
|
| 502 | + // Case when the group doesn't have any column criteria |
|
| 499 | 503 | |
| 500 | 504 | $db->insert('vtiger_cvadvfilter_grouping', [ |
| 501 | 505 | 'groupid' => $groupIndex, |
@@ -676,8 +680,9 @@ discard block |
||
| 676 | 680 | |
| 677 | 681 | $result = $db->pquery($ssql, array($this->getId(), $groupId)); |
| 678 | 682 | $noOfColumns = $db->num_rows($result); |
| 679 | - if ($noOfColumns <= 0) |
|
| 680 | - continue; |
|
| 683 | + if ($noOfColumns <= 0) { |
|
| 684 | + continue; |
|
| 685 | + } |
|
| 681 | 686 | |
| 682 | 687 | while ($relcriteriarow = $db->fetch_array($result)) { |
| 683 | 688 | $criteria = []; |
@@ -730,8 +735,9 @@ discard block |
||
| 730 | 735 | $i++; |
| 731 | 736 | } |
| 732 | 737 | // Clear the condition (and/or) for last group, if any. |
| 733 | - if (!empty($advft_criteria[$i - 1]['condition'])) |
|
| 734 | - $advft_criteria[$i - 1]['condition'] = ''; |
|
| 738 | + if (!empty($advft_criteria[$i - 1]['condition'])) { |
|
| 739 | + $advft_criteria[$i - 1]['condition'] = ''; |
|
| 740 | + } |
|
| 735 | 741 | return $advft_criteria; |
| 736 | 742 | } |
| 737 | 743 | |
@@ -2758,7 +2758,7 @@ |
||
| 2758 | 2758 | * @link http://www.php.net/manual/en/function.pathinfo.php#107461 |
| 2759 | 2759 | * @param string $path A filename or path, does not need to exist as a file |
| 2760 | 2760 | * @param integer|string $options Either a PATHINFO_* constant, or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 |
| 2761 | - * @return string|array |
|
| 2761 | + * @return string |
|
| 2762 | 2762 | * @static |
| 2763 | 2763 | */ |
| 2764 | 2764 | public static function mb_pathinfo($path, $options = null) |
@@ -1927,7 +1927,7 @@ |
||
| 1927 | 1927 | //If a filename contains any of these chars, it should be quoted, but not otherwise: RFC2183 & RFC2045 5.1 |
| 1928 | 1928 | //Fixes a warning in IETF's msglint MIME checker |
| 1929 | 1929 | // |
| 1930 | - // Allow for bypassing the Content-Disposition header totally |
|
| 1930 | + // Allow for bypassing the Content-Disposition header totally |
|
| 1931 | 1931 | if (!(empty($disposition))) { |
| 1932 | 1932 | if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $name)) { |
| 1933 | 1933 | $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE . $this->LE); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | const STOP_MESSAGE = 0; // message only, continue processing |
| 531 | 531 | const STOP_CONTINUE = 1; // message?, likely ok to continue processing |
| 532 | 532 | const STOP_CRITICAL = 2; // message, plus full stop, critical error reached |
| 533 | - const CRLF = "\r\n"; // SMTP RFC specified EOL |
|
| 533 | + const CRLF = "\r\n"; // SMTP RFC specified EOL |
|
| 534 | 534 | |
| 535 | 535 | ///////////////////////////////////////////////// |
| 536 | 536 | // METHODS, VARIABLES |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | $message = substr($message, 0, -$lelen); |
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | - $line = explode($this->LE, $message); // Magic. We know FixEOL uses $LE |
|
| 1304 | + $line = explode($this->LE, $message); // Magic. We know FixEOL uses $LE |
|
| 1305 | 1305 | $message = ''; |
| 1306 | 1306 | for ($i = 0; $i < count($line); $i++) { |
| 1307 | 1307 | $line_part = explode(' ', $line[$i]); |
@@ -1390,8 +1390,7 @@ discard block |
||
| 1390 | 1390 | if ($dec < 128) { // Single byte character. |
| 1391 | 1391 | // If the encoded char was found at pos 0, it will fit |
| 1392 | 1392 | // otherwise reduce maxLength to start of the encoded char |
| 1393 | - $maxLength = ($encodedCharPos == 0) ? $maxLength : |
|
| 1394 | - $maxLength - ($lookBack - $encodedCharPos); |
|
| 1393 | + $maxLength = ($encodedCharPos == 0) ? $maxLength : $maxLength - ($lookBack - $encodedCharPos); |
|
| 1395 | 1394 | $foundSplitPos = true; |
| 1396 | 1395 | } elseif ($dec >= 192) { // First byte of a multi byte character |
| 1397 | 1396 | // Reduce maxLength to split at start of character |
@@ -828,8 +828,9 @@ discard block |
||
| 828 | 828 | public function Send() |
| 829 | 829 | { |
| 830 | 830 | try { |
| 831 | - if (!$this->PreSend()) |
|
| 832 | - return false; |
|
| 831 | + if (!$this->PreSend()) { |
|
| 832 | + return false; |
|
| 833 | + } |
|
| 833 | 834 | return $this->PostSend(); |
| 834 | 835 | } catch (phpmailerException $e) { |
| 835 | 836 | $this->mailHeader = ''; |
@@ -1773,15 +1774,19 @@ discard block |
||
| 1773 | 1774 | protected function SetMessageType() |
| 1774 | 1775 | { |
| 1775 | 1776 | $this->message_type = array(); |
| 1776 | - if ($this->AlternativeExists()) |
|
| 1777 | - $this->message_type[] = "alt"; |
|
| 1778 | - if ($this->InlineImageExists()) |
|
| 1779 | - $this->message_type[] = "inline"; |
|
| 1780 | - if ($this->AttachmentExists()) |
|
| 1781 | - $this->message_type[] = "attach"; |
|
| 1777 | + if ($this->AlternativeExists()) { |
|
| 1778 | + $this->message_type[] = "alt"; |
|
| 1779 | + } |
|
| 1780 | + if ($this->InlineImageExists()) { |
|
| 1781 | + $this->message_type[] = "inline"; |
|
| 1782 | + } |
|
| 1783 | + if ($this->AttachmentExists()) { |
|
| 1784 | + $this->message_type[] = "attach"; |
|
| 1785 | + } |
|
| 1782 | 1786 | $this->message_type = implode("_", $this->message_type); |
| 1783 | - if ($this->message_type == "") |
|
| 1784 | - $this->message_type = "plain"; |
|
| 1787 | + if ($this->message_type == "") { |
|
| 1788 | + $this->message_type = "plain"; |
|
| 1789 | + } |
|
| 1785 | 1790 | } |
| 1786 | 1791 | |
| 1787 | 1792 | /** |
@@ -2019,8 +2024,9 @@ discard block |
||
| 2019 | 2024 | case '8bit': |
| 2020 | 2025 | $encoded = $this->FixEOL($str); |
| 2021 | 2026 | //Make sure it ends with a line break |
| 2022 | - if (substr($encoded, -(strlen($this->LE))) != $this->LE) |
|
| 2023 | - $encoded .= $this->LE; |
|
| 2027 | + if (substr($encoded, -(strlen($this->LE))) != $this->LE) { |
|
| 2028 | + $encoded .= $this->LE; |
|
| 2029 | + } |
|
| 2024 | 2030 | break; |
| 2025 | 2031 | case 'binary': |
| 2026 | 2032 | $encoded = $str; |
@@ -2950,8 +2956,9 @@ discard block |
||
| 2950 | 2956 | */ |
| 2951 | 2957 | public function DKIM_BodyC($body) |
| 2952 | 2958 | { |
| 2953 | - if ($body == '') |
|
| 2954 | - return "\r\n"; |
|
| 2959 | + if ($body == '') { |
|
| 2960 | + return "\r\n"; |
|
| 2961 | + } |
|
| 2955 | 2962 | // stabilize line endings |
| 2956 | 2963 | $body = str_replace("\r\n", "\n", $body); |
| 2957 | 2964 | $body = str_replace("\n", "\r\n", $body); |
@@ -111,6 +111,7 @@ discard block |
||
| 111 | 111 | * SMTP CODE SUCCESS: 220 |
| 112 | 112 | * SMTP CODE FAILURE: 421 |
| 113 | 113 | * @access public |
| 114 | + * @param string $host |
|
| 114 | 115 | * @return bool |
| 115 | 116 | */ |
| 116 | 117 | public function Connect($host, $port = 0, $tval = 30) |
@@ -210,6 +211,8 @@ discard block |
||
| 210 | 211 | * Performs SMTP authentication. Must be run after running the |
| 211 | 212 | * Hello() method. Returns true if successfully authenticated. |
| 212 | 213 | * @access public |
| 214 | + * @param string $username |
|
| 215 | + * @param string $password |
|
| 213 | 216 | * @return bool |
| 214 | 217 | */ |
| 215 | 218 | public function Authenticate($username, $password) |
@@ -325,6 +328,7 @@ discard block |
||
| 325 | 328 | * SMTP CODE FAILURE: 451,554 |
| 326 | 329 | * SMTP CODE ERROR : 500,501,503,421 |
| 327 | 330 | * @access public |
| 331 | + * @param string $msg_data |
|
| 328 | 332 | * @return bool |
| 329 | 333 | */ |
| 330 | 334 | public function Data($msg_data) |
@@ -491,6 +495,8 @@ discard block |
||
| 491 | 495 | /** |
| 492 | 496 | * Sends a HELO/EHLO command. |
| 493 | 497 | * @access private |
| 498 | + * @param string $hello |
|
| 499 | + * @param string $host |
|
| 494 | 500 | * @return bool |
| 495 | 501 | */ |
| 496 | 502 | private function SendHello($hello, $host) |
@@ -531,6 +537,7 @@ discard block |
||
| 531 | 537 | * SMTP CODE SUCCESS: 552,451,452 |
| 532 | 538 | * SMTP CODE SUCCESS: 500,501,421 |
| 533 | 539 | * @access public |
| 540 | + * @param string $from |
|
| 534 | 541 | * @return bool |
| 535 | 542 | */ |
| 536 | 543 | public function Mail($from) |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ///////////////////////////////////////////////// |
| 80 | 80 | |
| 81 | 81 | private $smtp_conn; // the socket to the server |
| 82 | - private $error; // error if any on the last call |
|
| 82 | + private $error; // error if any on the last call |
|
| 83 | 83 | private $helo_rply; // the reply the server sent to us for HELO |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $port, // the port to use |
| 135 | 135 | $errno, // error number if any |
| 136 | 136 | $errstr, // error message if any |
| 137 | - $tval); // give up after ? secs |
|
| 137 | + $tval); // give up after ? secs |
|
| 138 | 138 | // verify we connected properly |
| 139 | 139 | if (empty($this->smtp_conn)) { |
| 140 | 140 | $this->error = array("error" => "Failed to connect to server", |
@@ -148,8 +148,9 @@ |
||
| 148 | 148 | |
| 149 | 149 | // SMTP server can take longer to respond, give longer timeout for first read |
| 150 | 150 | // Windows does not have support for this timeout function |
| 151 | - if (substr(PHP_OS, 0, 3) != "WIN") |
|
| 152 | - socket_set_timeout($this->smtp_conn, $tval, 0); |
|
| 151 | + if (substr(PHP_OS, 0, 3) != "WIN") { |
|
| 152 | + socket_set_timeout($this->smtp_conn, $tval, 0); |
|
| 153 | + } |
|
| 153 | 154 | |
| 154 | 155 | // get any announcement |
| 155 | 156 | $announce = $this->get_lines(); |
@@ -103,6 +103,7 @@ discard block |
||
| 103 | 103 | /** Function to get the user Email id based on column name and column value |
| 104 | 104 | * $name -- column name of the vtiger_users vtiger_table |
| 105 | 105 | * $val -- column value |
| 106 | + * @param string $name |
|
| 106 | 107 | */ |
| 107 | 108 | function getUserEmailId($name, $val) |
| 108 | 109 | { |
@@ -162,6 +163,8 @@ discard block |
||
| 162 | 163 | * $attachment -- whether we want to attach the currently selected file or all vtiger_files. |
| 163 | 164 | [values = current,all] - optional |
| 164 | 165 | * $emailid -- id of the email object which will be used to get the vtiger_attachments - optional |
| 166 | + * @param PHPMailer $mail |
|
| 167 | + * @param string $to_email |
|
| 165 | 168 | */ |
| 166 | 169 | function setMailerProperties($mail, $subject, $contents, $fromEmail, $fromName, $to_email, $attachment = '', $emailid = '', $module = '', $logo = '') |
| 167 | 170 | { |
@@ -297,6 +300,7 @@ discard block |
||
| 297 | 300 | * $mail -- reference of the mail object |
| 298 | 301 | * $filename -- filename which is going to added with the mail |
| 299 | 302 | * $record -- id of the record - optional |
| 303 | + * @param string $record |
|
| 300 | 304 | */ |
| 301 | 305 | function addAttachment($mail, $filename, $record) |
| 302 | 306 | { |
@@ -313,6 +317,7 @@ discard block |
||
| 313 | 317 | /** Function to add all the vtiger_files as attachment with the mail object |
| 314 | 318 | * $mail -- reference of the mail object |
| 315 | 319 | * $record -- email id ie., record id which is used to get the all vtiger_attachments from database |
| 320 | + * @param string $record |
|
| 316 | 321 | */ |
| 317 | 322 | function addAllAttachments($mail, $record) |
| 318 | 323 | { |
@@ -347,6 +352,9 @@ discard block |
||
| 347 | 352 | * $mail -- reference of the mail object |
| 348 | 353 | * $cc_mod -- mode to set the address ie., cc or bcc |
| 349 | 354 | * $cc_val -- addresss with comma seperated to set as CC or BCC in the mail |
| 355 | + * @param PHPMailer $mail |
|
| 356 | + * @param string $cc_mod |
|
| 357 | + * @param string $cc_val |
|
| 350 | 358 | */ |
| 351 | 359 | function setCCAddress($mail, $cc_mod, $cc_val) |
| 352 | 360 | { |
@@ -375,6 +383,7 @@ discard block |
||
| 375 | 383 | |
| 376 | 384 | /** Function to send the mail which will be called after set all the mail object values |
| 377 | 385 | * $mail -- reference of the mail object |
| 386 | + * @param PHPMailer $mail |
|
| 378 | 387 | */ |
| 379 | 388 | function MailSend($mail) |
| 380 | 389 | { |
@@ -423,6 +432,7 @@ discard block |
||
| 423 | 432 | * $mail_status -- status of the mail which is sent or not |
| 424 | 433 | * $to -- the email address to whom we sent the mail and failes |
| 425 | 434 | * return -- Mail error occured during the mail sending process |
| 435 | + * @param PHPMailer $mail |
|
| 426 | 436 | */ |
| 427 | 437 | function getMailError($mail, $mail_status, $to) |
| 428 | 438 | { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $mail->Body = decode_html($contents); |
| 180 | 180 | $mail->AltBody = strip_tags(preg_replace(array("/<p>/i", "/<br>/i", "/<br \/>/i"), array("\n", "\n", "\n"), $contents)); |
| 181 | 181 | |
| 182 | - $mail->IsSMTP(); //set mailer to use SMTP |
|
| 182 | + $mail->IsSMTP(); //set mailer to use SMTP |
|
| 183 | 183 | |
| 184 | 184 | setMailServerProperties($mail); |
| 185 | 185 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | addAllAttachments($mail, $emailid); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $mail->IsHTML(true); // set email format to HTML |
|
| 233 | + $mail->IsHTML(true); // set email format to HTML |
|
| 234 | 234 | |
| 235 | 235 | return; |
| 236 | 236 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if ($smtp_auth) { |
| 279 | 279 | $mail->SMTPAuth = true; // turn on SMTP authentication |
| 280 | 280 | } |
| 281 | - $mail->Host = $server; // specify main and backup server |
|
| 281 | + $mail->Host = $server; // specify main and backup server |
|
| 282 | 282 | $mail->Username = $username; // SMTP username |
| 283 | 283 | $mail->Password = $password; // SMTP password |
| 284 | 284 | // To Support TLS |
@@ -525,8 +525,8 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | function isUserInitiated() |
| 527 | 527 | { |
| 528 | - return ( AppRequest::get('module') == 'Emails' && |
|
| 529 | - ( AppRequest::get('action') == 'mailsend' || AppRequest::get('action') == 'Save')); |
|
| 528 | + return (AppRequest::get('module') == 'Emails' && |
|
| 529 | + (AppRequest::get('action') == 'mailsend' || AppRequest::get('action') == 'Save')); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
@@ -245,27 +245,30 @@ discard block |
||
| 245 | 245 | $log->debug('Inside the function setMailServerProperties'); |
| 246 | 246 | |
| 247 | 247 | $res = $adb->pquery('select * from vtiger_systems where server_type=?', array('email')); |
| 248 | - if (AppRequest::has('server')) |
|
| 249 | - $server = AppRequest::get('server'); |
|
| 250 | - else |
|
| 251 | - $server = $adb->query_result_raw($res, 0, 'server'); |
|
| 252 | - if (AppRequest::has('server_username')) |
|
| 253 | - $username = AppRequest::get('server_username'); |
|
| 254 | - else |
|
| 255 | - $username = $adb->query_result_raw($res, 0, 'server_username'); |
|
| 256 | - |
|
| 257 | - if (AppRequest::has('server_password')) |
|
| 258 | - $password = AppRequest::get('server_password'); |
|
| 259 | - else |
|
| 260 | - $password = $adb->query_result_raw($res, 0, 'server_password'); |
|
| 248 | + if (AppRequest::has('server')) { |
|
| 249 | + $server = AppRequest::get('server'); |
|
| 250 | + } else { |
|
| 251 | + $server = $adb->query_result_raw($res, 0, 'server'); |
|
| 252 | + } |
|
| 253 | + if (AppRequest::has('server_username')) { |
|
| 254 | + $username = AppRequest::get('server_username'); |
|
| 255 | + } else { |
|
| 256 | + $username = $adb->query_result_raw($res, 0, 'server_username'); |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + if (AppRequest::has('server_password')) { |
|
| 260 | + $password = AppRequest::get('server_password'); |
|
| 261 | + } else { |
|
| 262 | + $password = $adb->query_result_raw($res, 0, 'server_password'); |
|
| 263 | + } |
|
| 261 | 264 | |
| 262 | 265 | // Define default state |
| 263 | 266 | $smtp_auth = false; |
| 264 | 267 | |
| 265 | 268 | // Prasad: First time read smtp_auth from the request |
| 266 | - if (AppRequest::get('smtp_auth') == 'on') |
|
| 267 | - $smtp_auth = true; |
|
| 268 | - else if (AppRequest::get('module') == 'Settings' && (!AppRequest::has('smtp_auth'))) { |
|
| 269 | + if (AppRequest::get('smtp_auth') == 'on') { |
|
| 270 | + $smtp_auth = true; |
|
| 271 | + } else if (AppRequest::get('module') == 'Settings' && (!AppRequest::has('smtp_auth'))) { |
|
| 269 | 272 | //added to avoid issue while editing the values in the outgoing mail server. |
| 270 | 273 | $smtp_auth = false; |
| 271 | 274 | } else { |
@@ -353,10 +356,12 @@ discard block |
||
| 353 | 356 | $log = LoggerManager::getInstance(); |
| 354 | 357 | $log->debug('Inside the functin setCCAddress'); |
| 355 | 358 | |
| 356 | - if ($cc_mod == 'cc') |
|
| 357 | - $method = 'AddCC'; |
|
| 358 | - if ($cc_mod == 'bcc') |
|
| 359 | - $method = 'AddBCC'; |
|
| 359 | + if ($cc_mod == 'cc') { |
|
| 360 | + $method = 'AddCC'; |
|
| 361 | + } |
|
| 362 | + if ($cc_mod == 'bcc') { |
|
| 363 | + $method = 'AddBCC'; |
|
| 364 | + } |
|
| 360 | 365 | if ($cc_val != '') { |
| 361 | 366 | $ccmail = explode(",", trim($cc_val, ",")); |
| 362 | 367 | for ($i = 0; $i < count($ccmail); $i++) { |
@@ -367,8 +372,9 @@ discard block |
||
| 367 | 372 | $cc_name = $name_addr_pair[0]; |
| 368 | 373 | $addr = trim($name_addr_pair[1], ">"); |
| 369 | 374 | } |
| 370 | - if ($ccmail[$i] != '') |
|
| 371 | - $mail->$method($addr, $cc_name); |
|
| 375 | + if ($ccmail[$i] != '') { |
|
| 376 | + $mail->$method($addr, $cc_name); |
|
| 377 | + } |
|
| 372 | 378 | } |
| 373 | 379 | } |
| 374 | 380 | } |
@@ -541,8 +547,9 @@ discard block |
||
| 541 | 547 | $userGroups = new GetGroupUsers(); |
| 542 | 548 | $userGroups->getAllUsersInGroup($groupId); |
| 543 | 549 | |
| 544 | - if (count($userGroups->group_users) == 0) |
|
| 545 | - return []; |
|
| 550 | + if (count($userGroups->group_users) == 0) { |
|
| 551 | + return []; |
|
| 552 | + } |
|
| 546 | 553 | |
| 547 | 554 | $query = sprintf('SELECT |
| 548 | 555 | email1 |
@@ -27,7 +27,6 @@ |
||
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Function returns Tickets grouped by Status |
| 30 | - * @param type $data |
|
| 31 | 30 | * @return <Array> |
| 32 | 31 | */ |
| 33 | 32 | public function getTicketsByStatus($owner) |
@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $listSearchParams = []; |
| 21 | 21 | $conditions = array(array('ticketstatus', 'e', $value)); |
| 22 | - if (!empty($assignedto)) |
|
| 23 | - array_push($conditions, array('assigned_user_id', 'e', $assignedto)); |
|
| 22 | + if (!empty($assignedto)) { |
|
| 23 | + array_push($conditions, array('assigned_user_id', 'e', $assignedto)); |
|
| 24 | + } |
|
| 24 | 25 | $listSearchParams[] = $conditions; |
| 25 | 26 | return '&viewname=All&search_params=' . json_encode($listSearchParams); |
| 26 | 27 | } |
@@ -62,8 +63,9 @@ discard block |
||
| 62 | 63 | $sql .= " && vtiger_troubletickets.status NOT IN ('$ticketStatusSearch')"; |
| 63 | 64 | $this->conditions = ['vtiger_troubletickets.status', "'$ticketStatusSearch'", 'nin', QueryGenerator::$AND]; |
| 64 | 65 | } |
| 65 | - if (!empty($securityParameter)) |
|
| 66 | - $sql .= $securityParameter; |
|
| 66 | + if (!empty($securityParameter)) { |
|
| 67 | + $sql .= $securityParameter; |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | |
| 69 | 71 | $sql .= ' GROUP BY statusvalue, priority ORDER BY vtiger_ticketstatus.sortorderid'; |
@@ -78,8 +80,9 @@ discard block |
||
| 78 | 80 | $priorities[$row['priority']] = $counter++; |
| 79 | 81 | $colors[$row['priority']] = $row['color']; |
| 80 | 82 | } |
| 81 | - if (!in_array($row['statusvalue'], $status)) |
|
| 82 | - $status[] = $row['statusvalue']; |
|
| 83 | + if (!in_array($row['statusvalue'], $status)) { |
|
| 84 | + $status[] = $row['statusvalue']; |
|
| 85 | + } |
|
| 83 | 86 | } |
| 84 | 87 | if (!empty($tickets)) { |
| 85 | 88 | $counter = 0; |
@@ -123,13 +126,15 @@ discard block |
||
| 123 | 126 | $data = $request->get('data'); |
| 124 | 127 | $createdTime = $request->get('createdtime'); |
| 125 | 128 | $widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId()); |
| 126 | - if (!$request->has('owner')) |
|
| 127 | - $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget, $moduleName); |
|
| 128 | - else |
|
| 129 | - $owner = $request->get('owner'); |
|
| 129 | + if (!$request->has('owner')) { |
|
| 130 | + $owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget, $moduleName); |
|
| 131 | + } else { |
|
| 132 | + $owner = $request->get('owner'); |
|
| 133 | + } |
|
| 130 | 134 | $ownerForwarded = $owner; |
| 131 | - if ($owner == 'all') |
|
| 132 | - $owner = ''; |
|
| 135 | + if ($owner == 'all') { |
|
| 136 | + $owner = ''; |
|
| 137 | + } |
|
| 133 | 138 | |
| 134 | 139 | //Date conversion from user to database format |
| 135 | 140 | if (!empty($createdTime)) { |