@@ -28,8 +28,9 @@ |
||
| 28 | 28 | $blockid_list = '('; |
| 29 | 29 | for ($i = 0; $i < $noofrows; $i++) { |
| 30 | 30 | $blockid = $adb->query_result($result, $i, "blockid"); |
| 31 | - if ($i != 0) |
|
| 32 | - $blockid_list .= ', '; |
|
| 31 | + if ($i != 0) { |
|
| 32 | + $blockid_list .= ', '; |
|
| 33 | + } |
|
| 33 | 34 | $blockid_list .= $blockid; |
| 34 | 35 | $block_label[$blockid] = $adb->query_result($result, $i, "blocklabel"); |
| 35 | 36 | } |
@@ -69,8 +69,9 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | $this->dayofweek_to_rpt = $repeat_arr['dayofweek_to_repeat']; |
| 71 | 71 | $this->repeat_monthby = $repeat_arr['repeatmonth_type']; |
| 72 | - if (isset($repeat_arr['repeatmonth_date'])) |
|
| 73 | - $this->rptmonth_datevalue = $repeat_arr['repeatmonth_date']; |
|
| 72 | + if (isset($repeat_arr['repeatmonth_date'])) { |
|
| 73 | + $this->rptmonth_datevalue = $repeat_arr['repeatmonth_date']; |
|
| 74 | + } |
|
| 74 | 75 | $this->rptmonth_daytype = $repeat_arr['repeatmonth_daytype']; |
| 75 | 76 | |
| 76 | 77 | $this->recurringdates = $this->_getRecurringDates(); |
@@ -409,13 +410,13 @@ discard block |
||
| 409 | 410 | if ($this->rptmonth_datevalue <= $date) { |
| 410 | 411 | $index = $this->rptmonth_datevalue - 1; |
| 411 | 412 | $day = $this->rptmonth_datevalue; |
| 412 | - if (isset($this->recur_freq)) |
|
| 413 | - $month = $month + $this->recur_freq; |
|
| 414 | - else |
|
| 415 | - $month = $month + 1; |
|
| 413 | + if (isset($this->recur_freq)) { |
|
| 414 | + $month = $month + $this->recur_freq; |
|
| 415 | + } else { |
|
| 416 | + $month = $month + 1; |
|
| 417 | + } |
|
| 416 | 418 | $tempdateObj = $tempdateObj->getThismonthDaysbyIndex($index, $day, $month, $year); |
| 417 | - } |
|
| 418 | - else { |
|
| 419 | + } else { |
|
| 419 | 420 | $index = $this->rptmonth_datevalue - 1; |
| 420 | 421 | $day = $this->rptmonth_datevalue; |
| 421 | 422 | $tempdateObj = $tempdateObj->getThismonthDaysbyIndex($index, $day, $month, $year); |
@@ -430,10 +431,11 @@ discard block |
||
| 430 | 431 | $tempdateObj = new vt_DateTime($date_arr, true); |
| 431 | 432 | $firstdayofmonthObj = $this->getFistdayofmonth($this->dayofweek_to_rpt[0], $tempdateObj); |
| 432 | 433 | if ($firstdayofmonthObj->get_DB_formatted_date() <= $tempdate) { |
| 433 | - if (isset($this->recur_freq)) |
|
| 434 | - $month = $firstdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 435 | - else |
|
| 436 | - $month = $firstdayofmonthObj->getMonth() + 1; |
|
| 434 | + if (isset($this->recur_freq)) { |
|
| 435 | + $month = $firstdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 436 | + } else { |
|
| 437 | + $month = $firstdayofmonthObj->getMonth() + 1; |
|
| 438 | + } |
|
| 437 | 439 | $dateObj = $firstdayofmonthObj->getThismonthDaysbyIndex(0, 1, $month, $firstdayofmonthObj->getYear()); |
| 438 | 440 | $nextmonthObj = $this->getFistdayofmonth($this->dayofweek_to_rpt[0], $dateObj); |
| 439 | 441 | $tempdateObj = $nextmonthObj; |
@@ -449,16 +451,16 @@ discard block |
||
| 449 | 451 | $tempdateObj = new vt_DateTime($date_arr, true); |
| 450 | 452 | $lastdayofmonthObj = $this->getLastdayofmonth($this->dayofweek_to_rpt[0], $tempdateObj); |
| 451 | 453 | if ($lastdayofmonthObj->get_DB_formatted_date() <= $tempdate) { |
| 452 | - if (isset($this->recur_freq)) |
|
| 453 | - $month = $lastdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 454 | - else |
|
| 455 | - $month = $lastdayofmonthObj->getMonth() + 1; |
|
| 454 | + if (isset($this->recur_freq)) { |
|
| 455 | + $month = $lastdayofmonthObj->getMonth() + $this->recur_freq; |
|
| 456 | + } else { |
|
| 457 | + $month = $lastdayofmonthObj->getMonth() + 1; |
|
| 458 | + } |
|
| 456 | 459 | $dateObj = $lastdayofmonthObj->getThismonthDaysbyIndex(0, 1, $month, $lastdayofmonthObj->getYear()); |
| 457 | 460 | $dateObj = $dateObj->getThismonthDaysbyIndex($dateObj->getDaysInMonth() - 1, $dateObj->getDaysInMonth(), $month, $lastdayofmonthObj->getYear()); |
| 458 | 461 | $nextmonthObj = $this->getLastdayofmonth($this->dayofweek_to_rpt[0], $dateObj); |
| 459 | 462 | $tempdateObj = $nextmonthObj; |
| 460 | - } |
|
| 461 | - else { |
|
| 463 | + } else { |
|
| 462 | 464 | $tempdateObj = $lastdayofmonthObj; |
| 463 | 465 | } |
| 464 | 466 | } |
@@ -476,10 +478,11 @@ discard block |
||
| 476 | 478 | } |
| 477 | 479 | } elseif ($this->recur_type == 'Yearly') { |
| 478 | 480 | |
| 479 | - if (isset($this->recur_freq)) |
|
| 480 | - $index = $year + $this->recur_freq; |
|
| 481 | - else |
|
| 482 | - $index = $year + 1; |
|
| 481 | + if (isset($this->recur_freq)) { |
|
| 482 | + $index = $year + $this->recur_freq; |
|
| 483 | + } else { |
|
| 484 | + $index = $year + 1; |
|
| 485 | + } |
|
| 483 | 486 | if ($index > 2037 || $index < 1970) { |
| 484 | 487 | print("<font color='red'>" . \includes\Language::translate('LBL_CAL_LIMIT_MSG') . "</font>"); |
| 485 | 488 | exit; |
@@ -534,10 +537,11 @@ discard block |
||
| 534 | 537 | if ($dayofweek == $dateObj->dayofweek) { |
| 535 | 538 | return $dateObj; |
| 536 | 539 | } else { |
| 537 | - if ($dayofweek > $dateObj->dayofweek) |
|
| 538 | - $day = $dateObj->day - 7 + ($dayofweek - $dateObj->dayofweek); |
|
| 539 | - else |
|
| 540 | - $day = $dateObj->day - ($dateObj->dayofweek - $dayofweek); |
|
| 540 | + if ($dayofweek > $dateObj->dayofweek) { |
|
| 541 | + $day = $dateObj->day - 7 + ($dayofweek - $dateObj->dayofweek); |
|
| 542 | + } else { |
|
| 543 | + $day = $dateObj->day - ($dateObj->dayofweek - $dayofweek); |
|
| 544 | + } |
|
| 541 | 545 | $index = $day - 1; |
| 542 | 546 | $month = $dateObj->month; |
| 543 | 547 | $year = $dateObj->year; |
@@ -1401,7 +1401,7 @@ |
||
| 1401 | 1401 | function isRecordExists($recordId, $cache = true) |
| 1402 | 1402 | { |
| 1403 | 1403 | $recordMetaData = vtlib\Functions::getCRMRecordMetadata($recordId); |
| 1404 | - return (isset($recordMetaData) && $recordMetaData['deleted'] == 0 ) ? true : false; |
|
| 1404 | + return (isset($recordMetaData) && $recordMetaData['deleted'] == 0) ? true : false; |
|
| 1405 | 1405 | } |
| 1406 | 1406 | |
| 1407 | 1407 | /** Function to set date values compatible to database (YY_MM_DD) |
@@ -367,6 +367,7 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Function to find the UI type of a field based on the uitype id |
| 370 | + * @param string $reqtype |
|
| 370 | 371 | */ |
| 371 | 372 | function is_uitype($uitype, $reqtype) |
| 372 | 373 | { |
@@ -752,6 +753,8 @@ discard block |
||
| 752 | 753 | |
| 753 | 754 | /** |
| 754 | 755 | * Function to get the approximate difference between two date time values as string |
| 756 | + * @param integer $d1 |
|
| 757 | + * @param integer $d2 |
|
| 755 | 758 | */ |
| 756 | 759 | function dateDiffAsString($d1, $d2) |
| 757 | 760 | { |
@@ -289,13 +289,15 @@ discard block |
||
| 289 | 289 | while (($i--) > 0) { |
| 290 | 290 | if ($data != ($a = $data % ($p = pow(64, $i)))) { |
| 291 | 291 | $ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p)); |
| 292 | - for ($i; $i > 0; $i--) |
|
| 293 | - $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); |
|
| 292 | + for ($i; $i > 0; $i--) { |
|
| 293 | + $ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p)); |
|
| 294 | + } |
|
| 294 | 295 | break; |
| 295 | 296 | } |
| 296 | 297 | } |
| 297 | - } else |
|
| 298 | - $ret = "&#$data;"; |
|
| 298 | + } else { |
|
| 299 | + $ret = "&#$data;"; |
|
| 300 | + } |
|
| 299 | 301 | return $ret; |
| 300 | 302 | } |
| 301 | 303 | |
@@ -344,8 +346,9 @@ discard block |
||
| 344 | 346 | */ |
| 345 | 347 | function escape_single_quotes($value) |
| 346 | 348 | { |
| 347 | - if (isset($value)) |
|
| 348 | - $value = str_replace("'", "\'", $value); |
|
| 349 | + if (isset($value)) { |
|
| 350 | + $value = str_replace("'", "\'", $value); |
|
| 351 | + } |
|
| 349 | 352 | return $value; |
| 350 | 353 | } |
| 351 | 354 | |
@@ -366,10 +369,11 @@ discard block |
||
| 366 | 369 | $str = str_replace('_', '\_', $str); |
| 367 | 370 | if ($flag == 0) { |
| 368 | 371 | // If value what to search is null then we should not add % which will fail |
| 369 | - if (empty($str)) |
|
| 370 | - $str = '' . $str . ''; |
|
| 371 | - else |
|
| 372 | - $str = '%' . $str . '%'; |
|
| 372 | + if (empty($str)) { |
|
| 373 | + $str = '' . $str . ''; |
|
| 374 | + } else { |
|
| 375 | + $str = '%' . $str . '%'; |
|
| 376 | + } |
|
| 373 | 377 | } elseif ($flag == 1) { |
| 374 | 378 | $str = '%' . $str; |
| 375 | 379 | } elseif ($flag == 2) { |
@@ -402,8 +406,9 @@ discard block |
||
| 402 | 406 | |
| 403 | 407 | $ret_str .= " ifnull($tbl_name.$col_name,'null') = ifnull(temp.$col_name,'null')"; |
| 404 | 408 | |
| 405 | - if (count($field_array) != $i) |
|
| 406 | - $ret_str .= " and "; |
|
| 409 | + if (count($field_array) != $i) { |
|
| 410 | + $ret_str .= " and "; |
|
| 411 | + } |
|
| 407 | 412 | $i++; |
| 408 | 413 | } |
| 409 | 414 | return $ret_str; |
@@ -430,8 +435,9 @@ discard block |
||
| 430 | 435 | foreach ($name as $module) { |
| 431 | 436 | $focus = CRMEntity::getInstance($module); |
| 432 | 437 | $query = $focus->buildSearchQueryForFieldTypes(11, $number); |
| 433 | - if (empty($query)) |
|
| 434 | - return; |
|
| 438 | + if (empty($query)) { |
|
| 439 | + return; |
|
| 440 | + } |
|
| 435 | 441 | |
| 436 | 442 | $result = $adb->pquery($query, []); |
| 437 | 443 | if ($adb->num_rows($result) > 0) { |
@@ -569,8 +575,9 @@ discard block |
||
| 569 | 575 | //require_once('modules/com_vtiger_workflow/VTEntityCache.php'); |
| 570 | 576 | $em = new VTEventsManager($adb); |
| 571 | 577 | $em->initTriggerCache(); |
| 572 | - if (!is_array($destinationRecordIds)) |
|
| 573 | - $destinationRecordIds = [$destinationRecordIds]; |
|
| 578 | + if (!is_array($destinationRecordIds)) { |
|
| 579 | + $destinationRecordIds = [$destinationRecordIds]; |
|
| 580 | + } |
|
| 574 | 581 | |
| 575 | 582 | $data = []; |
| 576 | 583 | $data['CRMEntity'] = $focus; |
@@ -626,20 +633,23 @@ discard block |
||
| 626 | 633 | $delim = array('/', '.'); |
| 627 | 634 | foreach ($delim as $delimiter) { |
| 628 | 635 | $x = strpos($value, $delimiter); |
| 629 | - if ($x === false) |
|
| 630 | - continue; |
|
| 631 | - else { |
|
| 636 | + if ($x === false) { |
|
| 637 | + continue; |
|
| 638 | + } else { |
|
| 632 | 639 | $value = str_replace($delimiter, '-', $value); |
| 633 | 640 | break; |
| 634 | 641 | } |
| 635 | 642 | } |
| 636 | 643 | list($y, $m, $d) = explode('-', $value); |
| 637 | - if (strlen($y) == 1) |
|
| 638 | - $y = '0' . $y; |
|
| 639 | - if (strlen($m) == 1) |
|
| 640 | - $m = '0' . $m; |
|
| 641 | - if (strlen($d) == 1) |
|
| 642 | - $d = '0' . $d; |
|
| 644 | + if (strlen($y) == 1) { |
|
| 645 | + $y = '0' . $y; |
|
| 646 | + } |
|
| 647 | + if (strlen($m) == 1) { |
|
| 648 | + $m = '0' . $m; |
|
| 649 | + } |
|
| 650 | + if (strlen($d) == 1) { |
|
| 651 | + $d = '0' . $d; |
|
| 652 | + } |
|
| 643 | 653 | $value = implode('-', array($y, $m, $d)); |
| 644 | 654 | |
| 645 | 655 | if (strlen($y) < 4) { |
@@ -61,8 +61,9 @@ |
||
| 61 | 61 | self::$modules[$module] = $CONFIG; |
| 62 | 62 | switch ($argsLength) { |
| 63 | 63 | case 2: |
| 64 | - if (!isset($CONFIG[$key])) |
|
| 65 | - return false; |
|
| 64 | + if (!isset($CONFIG[$key])) { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 66 | 67 | return $CONFIG[$key]; |
| 67 | 68 | break; |
| 68 | 69 | default: |
@@ -16,11 +16,17 @@ discard block |
||
| 16 | 16 | protected static $sounds = []; |
| 17 | 17 | protected static $search = []; |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $key |
|
| 21 | + */ |
|
| 19 | 22 | public static function load($key, $config) |
| 20 | 23 | { |
| 21 | 24 | self::$$key = $config; |
| 22 | 25 | } |
| 23 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $key |
|
| 29 | + */ |
|
| 24 | 30 | public static function main($key, $value = false) |
| 25 | 31 | { |
| 26 | 32 | if (isset(self::$main[$key])) { |
@@ -75,11 +81,17 @@ discard block |
||
| 75 | 81 | } |
| 76 | 82 | } |
| 77 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $key |
|
| 86 | + */ |
|
| 78 | 87 | public static function api($key, $defvalue = false) |
| 79 | 88 | { |
| 80 | 89 | return self::$api[$key]; |
| 81 | 90 | } |
| 82 | 91 | |
| 92 | + /** |
|
| 93 | + * @param string $key |
|
| 94 | + */ |
|
| 83 | 95 | public static function debug($key, $defvalue = false) |
| 84 | 96 | { |
| 85 | 97 | if (empty(self::$debug)) { |
@@ -89,6 +101,9 @@ discard block |
||
| 89 | 101 | return self::$debug[$key]; |
| 90 | 102 | } |
| 91 | 103 | |
| 104 | + /** |
|
| 105 | + * @param string $key |
|
| 106 | + */ |
|
| 92 | 107 | public static function developer($key, $defvalue = false) |
| 93 | 108 | { |
| 94 | 109 | if (empty(self::$developer)) { |
@@ -98,6 +113,9 @@ discard block |
||
| 98 | 113 | return self::$developer[$key]; |
| 99 | 114 | } |
| 100 | 115 | |
| 116 | + /** |
|
| 117 | + * @param string $key |
|
| 118 | + */ |
|
| 101 | 119 | public static function security($key, $defvalue = false) |
| 102 | 120 | { |
| 103 | 121 | if (empty(self::$security)) { |
@@ -107,6 +125,9 @@ discard block |
||
| 107 | 125 | return self::$security[$key]; |
| 108 | 126 | } |
| 109 | 127 | |
| 128 | + /** |
|
| 129 | + * @param string $key |
|
| 130 | + */ |
|
| 110 | 131 | public static function securityKeys($key, $defvalue = false) |
| 111 | 132 | { |
| 112 | 133 | if (empty(self::$securityKeys)) { |
@@ -116,6 +137,11 @@ discard block |
||
| 116 | 137 | return self::$securityKeys[$key]; |
| 117 | 138 | } |
| 118 | 139 | |
| 140 | + /** |
|
| 141 | + * @param string $key |
|
| 142 | + * |
|
| 143 | + * @return integer |
|
| 144 | + */ |
|
| 119 | 145 | public static function performance($key, $defvalue = false) |
| 120 | 146 | { |
| 121 | 147 | if (empty(self::$performance)) { |
@@ -125,6 +151,9 @@ discard block |
||
| 125 | 151 | return self::$performance[$key]; |
| 126 | 152 | } |
| 127 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $key |
|
| 156 | + */ |
|
| 128 | 157 | public static function relation($key, $defvalue = false) |
| 129 | 158 | { |
| 130 | 159 | if (empty(self::$relation)) { |
@@ -147,6 +176,9 @@ discard block |
||
| 147 | 176 | return self::$sounds[$key]; |
| 148 | 177 | } |
| 149 | 178 | |
| 179 | + /** |
|
| 180 | + * @param string $key |
|
| 181 | + */ |
|
| 150 | 182 | public static function search($key, $defvalue = false) |
| 151 | 183 | { |
| 152 | 184 | if (empty(self::$search)) { |
@@ -156,6 +188,10 @@ discard block |
||
| 156 | 188 | return self::$search[$key]; |
| 157 | 189 | } |
| 158 | 190 | |
| 191 | + /** |
|
| 192 | + * @param string $key |
|
| 193 | + * @param integer $value |
|
| 194 | + */ |
|
| 159 | 195 | public static function iniSet($key, $value) |
| 160 | 196 | { |
| 161 | 197 | @ini_set($key, $value); |
@@ -73,14 +73,16 @@ discard block |
||
| 73 | 73 | $modulesInformation = $modulesDetails["information"]; |
| 74 | 74 | |
| 75 | 75 | foreach ($modulesInformation as $moduleName => $entityInformation) { |
| 76 | - if ($entityInformation["isEntity"]) |
|
| 77 | - $entityModules[] = $moduleName; |
|
| 76 | + if ($entityInformation["isEntity"]) { |
|
| 77 | + $entityModules[] = $moduleName; |
|
| 78 | + } |
|
| 78 | 79 | } |
| 79 | 80 | if (!$typed) { |
| 80 | 81 | $accessableModules = $entityModules; |
| 81 | 82 | } else { |
| 82 | - if (!in_array($elementType, $entityModules)) |
|
| 83 | - throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied"); |
|
| 83 | + if (!in_array($elementType, $entityModules)) { |
|
| 84 | + throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied"); |
|
| 85 | + } |
|
| 84 | 86 | $accessableModules[] = $elementType; |
| 85 | 87 | } |
| 86 | 88 | |
@@ -101,15 +103,17 @@ discard block |
||
| 101 | 103 | if ($elementType == "Calendar" || $elementType == "Events") { |
| 102 | 104 | $baseCRMTable = getSyncQueryBaseTable($elementType); |
| 103 | 105 | } |
| 104 | - } else |
|
| 105 | - $baseCRMTable = " vtiger_crmentity "; |
|
| 106 | + } else { |
|
| 107 | + $baseCRMTable = " vtiger_crmentity "; |
|
| 108 | + } |
|
| 106 | 109 | |
| 107 | 110 | //modifiedtime - next token |
| 108 | 111 | $q = "SELECT modifiedtime FROM $baseCRMTable WHERE modifiedtime>? and setype IN(" . generateQuestionMarks($accessableModules) . ") "; |
| 109 | 112 | $params = array($datetime); |
| 110 | 113 | foreach ($accessableModules as $entityModule) { |
| 111 | - if ($entityModule == "Events") |
|
| 112 | - $entityModule = "Calendar"; |
|
| 114 | + if ($entityModule == "Events") { |
|
| 115 | + $entityModule = "Calendar"; |
|
| 116 | + } |
|
| 113 | 117 | $params[] = $entityModule; |
| 114 | 118 | } |
| 115 | 119 | if (!$applicationSync) { |
@@ -159,10 +163,11 @@ discard block |
||
| 159 | 163 | $selectClause .=", " . $table_fieldName; |
| 160 | 164 | } |
| 161 | 165 | } |
| 162 | - if ($elementType == "Emails") |
|
| 163 | - $fromClause = vtws_getEmailFromClause(); |
|
| 164 | - else |
|
| 165 | - $fromClause = $queryGenerator->getFromClause(); |
|
| 166 | + if ($elementType == "Emails") { |
|
| 167 | + $fromClause = vtws_getEmailFromClause(); |
|
| 168 | + } else { |
|
| 169 | + $fromClause = $queryGenerator->getFromClause(); |
|
| 170 | + } |
|
| 166 | 171 | |
| 167 | 172 | $fromClause .= " INNER JOIN (select modifiedtime, crmid,deleted,setype FROM $baseCRMTable WHERE setype=? and modifiedtime >? and modifiedtime<=?"; |
| 168 | 173 | if (!$applicationSync) { |
@@ -201,8 +206,9 @@ discard block |
||
| 201 | 206 | $params = array($maxModifiedTime); |
| 202 | 207 | |
| 203 | 208 | foreach ($accessableModules as $entityModule) { |
| 204 | - if ($entityModule == "Events") |
|
| 205 | - $entityModule = "Calendar"; |
|
| 209 | + if ($entityModule == "Events") { |
|
| 210 | + $entityModule = "Calendar"; |
|
| 211 | + } |
|
| 206 | 212 | $params[] = $entityModule; |
| 207 | 213 | } |
| 208 | 214 | if (!$applicationSync) { |
@@ -285,10 +291,11 @@ discard block |
||
| 285 | 291 | |
| 286 | 292 | function getCalendarTypeCondition($elementType) |
| 287 | 293 | { |
| 288 | - if ($elementType == "Events") |
|
| 289 | - $activityCondition = "vtiger_activity.activitytype !='Task' and vtiger_activity.activitytype !='Emails'"; |
|
| 290 | - else |
|
| 291 | - $activityCondition = "vtiger_activity.activitytype ='Task'"; |
|
| 294 | + if ($elementType == "Events") { |
|
| 295 | + $activityCondition = "vtiger_activity.activitytype !='Task' and vtiger_activity.activitytype !='Emails'"; |
|
| 296 | + } else { |
|
| 297 | + $activityCondition = "vtiger_activity.activitytype ='Task'"; |
|
| 298 | + } |
|
| 292 | 299 | return $activityCondition; |
| 293 | 300 | } |
| 294 | 301 | |
@@ -13,6 +13,9 @@ discard block |
||
| 13 | 13 | require_once 'include/utils/CommonUtils.php'; |
| 14 | 14 | require_once 'include/Webservices/DescribeObject.php'; |
| 15 | 15 | |
| 16 | +/** |
|
| 17 | + * @param string $syncType |
|
| 18 | + */ |
|
| 16 | 19 | function vtws_sync($mtime, $elementType, $syncType, $user) |
| 17 | 20 | { |
| 18 | 21 | return 'Currently not supported'; |
@@ -246,6 +249,9 @@ discard block |
||
| 246 | 249 | return strtotime($mtimeString); |
| 247 | 250 | } |
| 248 | 251 | |
| 252 | +/** |
|
| 253 | + * @param string[] $deletedValues |
|
| 254 | + */ |
|
| 249 | 255 | function vtws_isRecordDeleted($recordDetails, $deleteColumnDetails, $deletedValues) |
| 250 | 256 | { |
| 251 | 257 | $deletedRecord = false; |
@@ -294,6 +300,9 @@ discard block |
||
| 294 | 300 | return $activityCondition; |
| 295 | 301 | } |
| 296 | 302 | |
| 303 | +/** |
|
| 304 | + * @param Users $user |
|
| 305 | + */ |
|
| 297 | 306 | function getSelectClauseFields($module, $moduleMeta, $user) |
| 298 | 307 | { |
| 299 | 308 | $moduleFieldNames = $moduleMeta->getModuleFields(); |
@@ -212,8 +212,9 @@ discard block |
||
| 212 | 212 | $adb = PearDatabase::getInstance(); |
| 213 | 213 | |
| 214 | 214 | // administrator's have assign privilege |
| 215 | - if (\vtlib\Functions::userIsAdministrator($this->user)) |
|
| 216 | - return true; |
|
| 215 | + if (\vtlib\Functions::userIsAdministrator($this->user)) { |
|
| 216 | + return true; |
|
| 217 | + } |
|
| 217 | 218 | |
| 218 | 219 | $idComponents = vtws_getIdComponents($webserviceId); |
| 219 | 220 | $userId = $idComponents[1]; |
@@ -353,8 +354,9 @@ discard block |
||
| 353 | 354 | $theme = vtws_preserveGlobal('theme', $this->user->theme); |
| 354 | 355 | $default_language = AppConfig::main('default_language'); |
| 355 | 356 | $current_language = vglobal('current_language'); |
| 356 | - if (empty($current_language)) |
|
| 357 | - $current_language = $default_language; |
|
| 357 | + if (empty($current_language)) { |
|
| 358 | + $current_language = $default_language; |
|
| 359 | + } |
|
| 358 | 360 | $current_language = vtws_preserveGlobal('current_language', $current_language); |
| 359 | 361 | |
| 360 | 362 | $this->computeAccess(); |
@@ -31,8 +31,9 @@ discard block |
||
| 31 | 31 | $page = empty($element['page']) ? 0 : intval($element['page']); // Page to start |
| 32 | 32 | |
| 33 | 33 | $acrossAllModule = false; |
| 34 | - if ($moduleName == 'Home') |
|
| 35 | - $acrossAllModule = true; |
|
| 34 | + if ($moduleName == 'Home') { |
|
| 35 | + $acrossAllModule = true; |
|
| 36 | + } |
|
| 36 | 37 | |
| 37 | 38 | // Pre-condition check |
| 38 | 39 | if (empty($moduleName)) { |
@@ -71,8 +72,10 @@ discard block |
||
| 71 | 72 | |
| 72 | 73 | // Get most recently tracked changes with limit |
| 73 | 74 | $start = $page * $MAXLIMIT; |
| 74 | - if ($start > 0) |
|
| 75 | - $start = $start + 1; // Adjust the start range |
|
| 75 | + if ($start > 0) { |
|
| 76 | + $start = $start + 1; |
|
| 77 | + } |
|
| 78 | + // Adjust the start range |
|
| 76 | 79 | $sql .= sprintf(' ORDER BY vtiger_modtracker_basic.id DESC LIMIT %s,%s', $start, $MAXLIMIT); |
| 77 | 80 | |
| 78 | 81 | $result = $adb->pquery($sql, $params); |
@@ -52,8 +52,9 @@ discard block |
||
| 52 | 52 | generateQuestionMarks($fieldTypeList) . ')'; |
| 53 | 53 | $params = []; |
| 54 | 54 | $params[] = $user->id; |
| 55 | - foreach ($fieldTypeList as $fieldType) |
|
| 56 | - $params[] = $fieldType; |
|
| 55 | + foreach ($fieldTypeList as $fieldType) { |
|
| 56 | + $params[] = $fieldType; |
|
| 57 | + } |
|
| 57 | 58 | $result = $db->pquery($sql, $params); |
| 58 | 59 | $it = new SqlResultIterator($db, $result); |
| 59 | 60 | $moduleList = []; |
@@ -107,8 +108,9 @@ discard block |
||
| 107 | 108 | |
| 108 | 109 | $default_language = VTWS_PreserveGlobal::getGlobal('default_language'); |
| 109 | 110 | $current_language = vglobal('current_language'); |
| 110 | - if (empty($current_language)) |
|
| 111 | - $current_language = $default_language; |
|
| 111 | + if (empty($current_language)) { |
|
| 112 | + $current_language = $default_language; |
|
| 113 | + } |
|
| 112 | 114 | $current_language = vtws_preserveGlobal('current_language', $current_language); |
| 113 | 115 | |
| 114 | 116 | $appStrings = return_application_language($current_language); |
@@ -37,419 +37,419 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | class SmartyBC extends Smarty |
| 39 | 39 | { |
| 40 | - /** |
|
| 41 | - * Smarty 2 BC |
|
| 42 | - * |
|
| 43 | - * @var string |
|
| 44 | - */ |
|
| 45 | - public $_version = self::SMARTY_VERSION; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * This is an array of directories where trusted php scripts reside. |
|
| 49 | - * |
|
| 50 | - * @var array |
|
| 51 | - */ |
|
| 52 | - public $trusted_dir = array(); |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Initialize new SmartyBC object |
|
| 56 | - * |
|
| 57 | - */ |
|
| 58 | - public function __construct() |
|
| 59 | - { |
|
| 60 | - parent::__construct(); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * wrapper for assign_by_ref |
|
| 65 | - * |
|
| 66 | - * @param string $tpl_var the template variable name |
|
| 67 | - * @param mixed &$value the referenced value to assign |
|
| 68 | - */ |
|
| 69 | - public function assign_by_ref($tpl_var, &$value) |
|
| 70 | - { |
|
| 71 | - $this->assignByRef($tpl_var, $value); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * wrapper for append_by_ref |
|
| 76 | - * |
|
| 77 | - * @param string $tpl_var the template variable name |
|
| 78 | - * @param mixed &$value the referenced value to append |
|
| 79 | - * @param boolean $merge flag if array elements shall be merged |
|
| 80 | - */ |
|
| 81 | - public function append_by_ref($tpl_var, &$value, $merge = false) |
|
| 82 | - { |
|
| 83 | - $this->appendByRef($tpl_var, $value, $merge); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * clear the given assigned template variable. |
|
| 88 | - * |
|
| 89 | - * @param string $tpl_var the template variable to clear |
|
| 90 | - */ |
|
| 91 | - public function clear_assign($tpl_var) |
|
| 92 | - { |
|
| 93 | - $this->clearAssign($tpl_var); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Registers custom function to be used in templates |
|
| 98 | - * |
|
| 99 | - * @param string $function the name of the template function |
|
| 100 | - * @param string $function_impl the name of the PHP function to register |
|
| 101 | - * @param bool $cacheable |
|
| 102 | - * @param mixed $cache_attrs |
|
| 103 | - */ |
|
| 104 | - public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null) |
|
| 105 | - { |
|
| 106 | - $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Unregister custom function |
|
| 111 | - * |
|
| 112 | - * @param string $function name of template function |
|
| 113 | - */ |
|
| 114 | - public function unregister_function($function) |
|
| 115 | - { |
|
| 116 | - $this->unregisterPlugin('function', $function); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - /** |
|
| 120 | - * Registers object to be used in templates |
|
| 121 | - * |
|
| 122 | - * @param string $object name of template object |
|
| 123 | - * @param object $object_impl the referenced PHP object to register |
|
| 124 | - * @param array $allowed list of allowed methods (empty = all) |
|
| 125 | - * @param boolean $smarty_args smarty argument format, else traditional |
|
| 126 | - * @param array $block_methods list of methods that are block format |
|
| 127 | - * |
|
| 128 | - * @throws SmartyException |
|
| 129 | - * @internal param array $block_functs list of methods that are block format |
|
| 130 | - */ |
|
| 131 | - public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, |
|
| 132 | - $block_methods = array()) |
|
| 133 | - { |
|
| 134 | - settype($allowed, 'array'); |
|
| 135 | - settype($smarty_args, 'boolean'); |
|
| 136 | - $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Unregister object |
|
| 141 | - * |
|
| 142 | - * @param string $object name of template object |
|
| 143 | - */ |
|
| 144 | - public function unregister_object($object) |
|
| 145 | - { |
|
| 146 | - $this->unregisterObject($object); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * Registers block function to be used in templates |
|
| 151 | - * |
|
| 152 | - * @param string $block name of template block |
|
| 153 | - * @param string $block_impl PHP function to register |
|
| 154 | - * @param bool $cacheable |
|
| 155 | - * @param mixed $cache_attrs |
|
| 156 | - */ |
|
| 157 | - public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null) |
|
| 158 | - { |
|
| 159 | - $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Unregister block function |
|
| 164 | - * |
|
| 165 | - * @param string $block name of template function |
|
| 166 | - */ |
|
| 167 | - public function unregister_block($block) |
|
| 168 | - { |
|
| 169 | - $this->unregisterPlugin('block', $block); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * Registers compiler function |
|
| 174 | - * |
|
| 175 | - * @param string $function name of template function |
|
| 176 | - * @param string $function_impl name of PHP function to register |
|
| 177 | - * @param bool $cacheable |
|
| 178 | - */ |
|
| 179 | - public function register_compiler_function($function, $function_impl, $cacheable = true) |
|
| 180 | - { |
|
| 181 | - $this->registerPlugin('compiler', $function, $function_impl, $cacheable); |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * Unregister compiler function |
|
| 186 | - * |
|
| 187 | - * @param string $function name of template function |
|
| 188 | - */ |
|
| 189 | - public function unregister_compiler_function($function) |
|
| 190 | - { |
|
| 191 | - $this->unregisterPlugin('compiler', $function); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Registers modifier to be used in templates |
|
| 196 | - * |
|
| 197 | - * @param string $modifier name of template modifier |
|
| 198 | - * @param string $modifier_impl name of PHP function to register |
|
| 199 | - */ |
|
| 200 | - public function register_modifier($modifier, $modifier_impl) |
|
| 201 | - { |
|
| 202 | - $this->registerPlugin('modifier', $modifier, $modifier_impl); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Unregister modifier |
|
| 207 | - * |
|
| 208 | - * @param string $modifier name of template modifier |
|
| 209 | - */ |
|
| 210 | - public function unregister_modifier($modifier) |
|
| 211 | - { |
|
| 212 | - $this->unregisterPlugin('modifier', $modifier); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * Registers a resource to fetch a template |
|
| 217 | - * |
|
| 218 | - * @param string $type name of resource |
|
| 219 | - * @param array $functions array of functions to handle resource |
|
| 220 | - */ |
|
| 221 | - public function register_resource($type, $functions) |
|
| 222 | - { |
|
| 223 | - $this->registerResource($type, $functions); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Unregister a resource |
|
| 228 | - * |
|
| 229 | - * @param string $type name of resource |
|
| 230 | - */ |
|
| 231 | - public function unregister_resource($type) |
|
| 232 | - { |
|
| 233 | - $this->unregisterResource($type); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * Registers a prefilter function to apply |
|
| 238 | - * to a template before compiling |
|
| 239 | - * |
|
| 240 | - * @param callable $function |
|
| 241 | - */ |
|
| 242 | - public function register_prefilter($function) |
|
| 243 | - { |
|
| 244 | - $this->registerFilter('pre', $function); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * Unregister a prefilter function |
|
| 249 | - * |
|
| 250 | - * @param callable $function |
|
| 251 | - */ |
|
| 252 | - public function unregister_prefilter($function) |
|
| 253 | - { |
|
| 254 | - $this->unregisterFilter('pre', $function); |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * Registers a postfilter function to apply |
|
| 259 | - * to a compiled template after compilation |
|
| 260 | - * |
|
| 261 | - * @param callable $function |
|
| 262 | - */ |
|
| 263 | - public function register_postfilter($function) |
|
| 264 | - { |
|
| 265 | - $this->registerFilter('post', $function); |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * Unregister a postfilter function |
|
| 270 | - * |
|
| 271 | - * @param callable $function |
|
| 272 | - */ |
|
| 273 | - public function unregister_postfilter($function) |
|
| 274 | - { |
|
| 275 | - $this->unregisterFilter('post', $function); |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Registers an output filter function to apply |
|
| 280 | - * to a template output |
|
| 281 | - * |
|
| 282 | - * @param callable $function |
|
| 283 | - */ |
|
| 284 | - public function register_outputfilter($function) |
|
| 285 | - { |
|
| 286 | - $this->registerFilter('output', $function); |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * Unregister an outputfilter function |
|
| 291 | - * |
|
| 292 | - * @param callable $function |
|
| 293 | - */ |
|
| 294 | - public function unregister_outputfilter($function) |
|
| 295 | - { |
|
| 296 | - $this->unregisterFilter('output', $function); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * load a filter of specified type and name |
|
| 301 | - * |
|
| 302 | - * @param string $type filter type |
|
| 303 | - * @param string $name filter name |
|
| 304 | - */ |
|
| 305 | - public function load_filter($type, $name) |
|
| 306 | - { |
|
| 307 | - $this->loadFilter($type, $name); |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - /** |
|
| 311 | - * clear cached content for the given template and cache id |
|
| 312 | - * |
|
| 313 | - * @param string $tpl_file name of template file |
|
| 314 | - * @param string $cache_id name of cache_id |
|
| 315 | - * @param string $compile_id name of compile_id |
|
| 316 | - * @param string $exp_time expiration time |
|
| 317 | - * |
|
| 318 | - * @return boolean |
|
| 319 | - */ |
|
| 320 | - public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) |
|
| 321 | - { |
|
| 322 | - return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time); |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - /** |
|
| 326 | - * clear the entire contents of cache (all templates) |
|
| 327 | - * |
|
| 328 | - * @param string $exp_time expire time |
|
| 329 | - * |
|
| 330 | - * @return boolean |
|
| 331 | - */ |
|
| 332 | - public function clear_all_cache($exp_time = null) |
|
| 333 | - { |
|
| 334 | - return $this->clearCache(null, null, null, $exp_time); |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - /** |
|
| 338 | - * test to see if valid cache exists for this template |
|
| 339 | - * |
|
| 340 | - * @param string $tpl_file name of template file |
|
| 341 | - * @param string $cache_id |
|
| 342 | - * @param string $compile_id |
|
| 343 | - * |
|
| 344 | - * @return boolean |
|
| 345 | - */ |
|
| 346 | - public function is_cached($tpl_file, $cache_id = null, $compile_id = null) |
|
| 347 | - { |
|
| 348 | - return $this->isCached($tpl_file, $cache_id, $compile_id); |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - /** |
|
| 352 | - * clear all the assigned template variables. |
|
| 353 | - */ |
|
| 354 | - public function clear_all_assign() |
|
| 355 | - { |
|
| 356 | - $this->clearAllAssign(); |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * clears compiled version of specified template resource, |
|
| 361 | - * or all compiled template files if one is not specified. |
|
| 362 | - * This function is for advanced use only, not normally needed. |
|
| 363 | - * |
|
| 364 | - * @param string $tpl_file |
|
| 365 | - * @param string $compile_id |
|
| 366 | - * @param string $exp_time |
|
| 367 | - * |
|
| 368 | - * @return boolean results of {@link smarty_core_rm_auto()} |
|
| 369 | - */ |
|
| 370 | - public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) |
|
| 371 | - { |
|
| 372 | - return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * Checks whether requested template exists. |
|
| 377 | - * |
|
| 378 | - * @param string $tpl_file |
|
| 379 | - * |
|
| 380 | - * @return boolean |
|
| 381 | - */ |
|
| 382 | - public function template_exists($tpl_file) |
|
| 383 | - { |
|
| 384 | - return $this->templateExists($tpl_file); |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * Returns an array containing template variables |
|
| 389 | - * |
|
| 390 | - * @param string $name |
|
| 391 | - * |
|
| 392 | - * @return array |
|
| 393 | - */ |
|
| 394 | - public function get_template_vars($name = null) |
|
| 395 | - { |
|
| 396 | - return $this->getTemplateVars($name); |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - /** |
|
| 400 | - * Returns an array containing config variables |
|
| 401 | - * |
|
| 402 | - * @param string $name |
|
| 403 | - * |
|
| 404 | - * @return array |
|
| 405 | - */ |
|
| 406 | - public function get_config_vars($name = null) |
|
| 407 | - { |
|
| 408 | - return $this->getConfigVars($name); |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * load configuration values |
|
| 413 | - * |
|
| 414 | - * @param string $file |
|
| 415 | - * @param string $section |
|
| 416 | - * @param string $scope |
|
| 417 | - */ |
|
| 418 | - public function config_load($file, $section = null, $scope = 'global') |
|
| 419 | - { |
|
| 420 | - $this->ConfigLoad($file, $section, $scope); |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - /** |
|
| 424 | - * return a reference to a registered object |
|
| 425 | - * |
|
| 426 | - * @param string $name |
|
| 427 | - * |
|
| 428 | - * @return object |
|
| 429 | - */ |
|
| 430 | - public function get_registered_object($name) |
|
| 431 | - { |
|
| 432 | - return $this->getRegisteredObject($name); |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - /** |
|
| 436 | - * clear configuration values |
|
| 437 | - * |
|
| 438 | - * @param string $var |
|
| 439 | - */ |
|
| 440 | - public function clear_config($var = null) |
|
| 441 | - { |
|
| 442 | - $this->clearConfig($var); |
|
| 443 | - } |
|
| 444 | - |
|
| 445 | - /** |
|
| 446 | - * trigger Smarty error |
|
| 447 | - * |
|
| 448 | - * @param string $error_msg |
|
| 449 | - * @param integer $error_type |
|
| 450 | - */ |
|
| 451 | - public function trigger_error($error_msg, $error_type = E_USER_WARNING) |
|
| 452 | - { |
|
| 453 | - trigger_error("Smarty error: $error_msg", $error_type); |
|
| 454 | - } |
|
| 40 | + /** |
|
| 41 | + * Smarty 2 BC |
|
| 42 | + * |
|
| 43 | + * @var string |
|
| 44 | + */ |
|
| 45 | + public $_version = self::SMARTY_VERSION; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * This is an array of directories where trusted php scripts reside. |
|
| 49 | + * |
|
| 50 | + * @var array |
|
| 51 | + */ |
|
| 52 | + public $trusted_dir = array(); |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Initialize new SmartyBC object |
|
| 56 | + * |
|
| 57 | + */ |
|
| 58 | + public function __construct() |
|
| 59 | + { |
|
| 60 | + parent::__construct(); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * wrapper for assign_by_ref |
|
| 65 | + * |
|
| 66 | + * @param string $tpl_var the template variable name |
|
| 67 | + * @param mixed &$value the referenced value to assign |
|
| 68 | + */ |
|
| 69 | + public function assign_by_ref($tpl_var, &$value) |
|
| 70 | + { |
|
| 71 | + $this->assignByRef($tpl_var, $value); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * wrapper for append_by_ref |
|
| 76 | + * |
|
| 77 | + * @param string $tpl_var the template variable name |
|
| 78 | + * @param mixed &$value the referenced value to append |
|
| 79 | + * @param boolean $merge flag if array elements shall be merged |
|
| 80 | + */ |
|
| 81 | + public function append_by_ref($tpl_var, &$value, $merge = false) |
|
| 82 | + { |
|
| 83 | + $this->appendByRef($tpl_var, $value, $merge); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * clear the given assigned template variable. |
|
| 88 | + * |
|
| 89 | + * @param string $tpl_var the template variable to clear |
|
| 90 | + */ |
|
| 91 | + public function clear_assign($tpl_var) |
|
| 92 | + { |
|
| 93 | + $this->clearAssign($tpl_var); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Registers custom function to be used in templates |
|
| 98 | + * |
|
| 99 | + * @param string $function the name of the template function |
|
| 100 | + * @param string $function_impl the name of the PHP function to register |
|
| 101 | + * @param bool $cacheable |
|
| 102 | + * @param mixed $cache_attrs |
|
| 103 | + */ |
|
| 104 | + public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null) |
|
| 105 | + { |
|
| 106 | + $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Unregister custom function |
|
| 111 | + * |
|
| 112 | + * @param string $function name of template function |
|
| 113 | + */ |
|
| 114 | + public function unregister_function($function) |
|
| 115 | + { |
|
| 116 | + $this->unregisterPlugin('function', $function); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + /** |
|
| 120 | + * Registers object to be used in templates |
|
| 121 | + * |
|
| 122 | + * @param string $object name of template object |
|
| 123 | + * @param object $object_impl the referenced PHP object to register |
|
| 124 | + * @param array $allowed list of allowed methods (empty = all) |
|
| 125 | + * @param boolean $smarty_args smarty argument format, else traditional |
|
| 126 | + * @param array $block_methods list of methods that are block format |
|
| 127 | + * |
|
| 128 | + * @throws SmartyException |
|
| 129 | + * @internal param array $block_functs list of methods that are block format |
|
| 130 | + */ |
|
| 131 | + public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, |
|
| 132 | + $block_methods = array()) |
|
| 133 | + { |
|
| 134 | + settype($allowed, 'array'); |
|
| 135 | + settype($smarty_args, 'boolean'); |
|
| 136 | + $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Unregister object |
|
| 141 | + * |
|
| 142 | + * @param string $object name of template object |
|
| 143 | + */ |
|
| 144 | + public function unregister_object($object) |
|
| 145 | + { |
|
| 146 | + $this->unregisterObject($object); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * Registers block function to be used in templates |
|
| 151 | + * |
|
| 152 | + * @param string $block name of template block |
|
| 153 | + * @param string $block_impl PHP function to register |
|
| 154 | + * @param bool $cacheable |
|
| 155 | + * @param mixed $cache_attrs |
|
| 156 | + */ |
|
| 157 | + public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null) |
|
| 158 | + { |
|
| 159 | + $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Unregister block function |
|
| 164 | + * |
|
| 165 | + * @param string $block name of template function |
|
| 166 | + */ |
|
| 167 | + public function unregister_block($block) |
|
| 168 | + { |
|
| 169 | + $this->unregisterPlugin('block', $block); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * Registers compiler function |
|
| 174 | + * |
|
| 175 | + * @param string $function name of template function |
|
| 176 | + * @param string $function_impl name of PHP function to register |
|
| 177 | + * @param bool $cacheable |
|
| 178 | + */ |
|
| 179 | + public function register_compiler_function($function, $function_impl, $cacheable = true) |
|
| 180 | + { |
|
| 181 | + $this->registerPlugin('compiler', $function, $function_impl, $cacheable); |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * Unregister compiler function |
|
| 186 | + * |
|
| 187 | + * @param string $function name of template function |
|
| 188 | + */ |
|
| 189 | + public function unregister_compiler_function($function) |
|
| 190 | + { |
|
| 191 | + $this->unregisterPlugin('compiler', $function); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Registers modifier to be used in templates |
|
| 196 | + * |
|
| 197 | + * @param string $modifier name of template modifier |
|
| 198 | + * @param string $modifier_impl name of PHP function to register |
|
| 199 | + */ |
|
| 200 | + public function register_modifier($modifier, $modifier_impl) |
|
| 201 | + { |
|
| 202 | + $this->registerPlugin('modifier', $modifier, $modifier_impl); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Unregister modifier |
|
| 207 | + * |
|
| 208 | + * @param string $modifier name of template modifier |
|
| 209 | + */ |
|
| 210 | + public function unregister_modifier($modifier) |
|
| 211 | + { |
|
| 212 | + $this->unregisterPlugin('modifier', $modifier); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * Registers a resource to fetch a template |
|
| 217 | + * |
|
| 218 | + * @param string $type name of resource |
|
| 219 | + * @param array $functions array of functions to handle resource |
|
| 220 | + */ |
|
| 221 | + public function register_resource($type, $functions) |
|
| 222 | + { |
|
| 223 | + $this->registerResource($type, $functions); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Unregister a resource |
|
| 228 | + * |
|
| 229 | + * @param string $type name of resource |
|
| 230 | + */ |
|
| 231 | + public function unregister_resource($type) |
|
| 232 | + { |
|
| 233 | + $this->unregisterResource($type); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * Registers a prefilter function to apply |
|
| 238 | + * to a template before compiling |
|
| 239 | + * |
|
| 240 | + * @param callable $function |
|
| 241 | + */ |
|
| 242 | + public function register_prefilter($function) |
|
| 243 | + { |
|
| 244 | + $this->registerFilter('pre', $function); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * Unregister a prefilter function |
|
| 249 | + * |
|
| 250 | + * @param callable $function |
|
| 251 | + */ |
|
| 252 | + public function unregister_prefilter($function) |
|
| 253 | + { |
|
| 254 | + $this->unregisterFilter('pre', $function); |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * Registers a postfilter function to apply |
|
| 259 | + * to a compiled template after compilation |
|
| 260 | + * |
|
| 261 | + * @param callable $function |
|
| 262 | + */ |
|
| 263 | + public function register_postfilter($function) |
|
| 264 | + { |
|
| 265 | + $this->registerFilter('post', $function); |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * Unregister a postfilter function |
|
| 270 | + * |
|
| 271 | + * @param callable $function |
|
| 272 | + */ |
|
| 273 | + public function unregister_postfilter($function) |
|
| 274 | + { |
|
| 275 | + $this->unregisterFilter('post', $function); |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Registers an output filter function to apply |
|
| 280 | + * to a template output |
|
| 281 | + * |
|
| 282 | + * @param callable $function |
|
| 283 | + */ |
|
| 284 | + public function register_outputfilter($function) |
|
| 285 | + { |
|
| 286 | + $this->registerFilter('output', $function); |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * Unregister an outputfilter function |
|
| 291 | + * |
|
| 292 | + * @param callable $function |
|
| 293 | + */ |
|
| 294 | + public function unregister_outputfilter($function) |
|
| 295 | + { |
|
| 296 | + $this->unregisterFilter('output', $function); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * load a filter of specified type and name |
|
| 301 | + * |
|
| 302 | + * @param string $type filter type |
|
| 303 | + * @param string $name filter name |
|
| 304 | + */ |
|
| 305 | + public function load_filter($type, $name) |
|
| 306 | + { |
|
| 307 | + $this->loadFilter($type, $name); |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * clear cached content for the given template and cache id |
|
| 312 | + * |
|
| 313 | + * @param string $tpl_file name of template file |
|
| 314 | + * @param string $cache_id name of cache_id |
|
| 315 | + * @param string $compile_id name of compile_id |
|
| 316 | + * @param string $exp_time expiration time |
|
| 317 | + * |
|
| 318 | + * @return boolean |
|
| 319 | + */ |
|
| 320 | + public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) |
|
| 321 | + { |
|
| 322 | + return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time); |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + /** |
|
| 326 | + * clear the entire contents of cache (all templates) |
|
| 327 | + * |
|
| 328 | + * @param string $exp_time expire time |
|
| 329 | + * |
|
| 330 | + * @return boolean |
|
| 331 | + */ |
|
| 332 | + public function clear_all_cache($exp_time = null) |
|
| 333 | + { |
|
| 334 | + return $this->clearCache(null, null, null, $exp_time); |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + /** |
|
| 338 | + * test to see if valid cache exists for this template |
|
| 339 | + * |
|
| 340 | + * @param string $tpl_file name of template file |
|
| 341 | + * @param string $cache_id |
|
| 342 | + * @param string $compile_id |
|
| 343 | + * |
|
| 344 | + * @return boolean |
|
| 345 | + */ |
|
| 346 | + public function is_cached($tpl_file, $cache_id = null, $compile_id = null) |
|
| 347 | + { |
|
| 348 | + return $this->isCached($tpl_file, $cache_id, $compile_id); |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + /** |
|
| 352 | + * clear all the assigned template variables. |
|
| 353 | + */ |
|
| 354 | + public function clear_all_assign() |
|
| 355 | + { |
|
| 356 | + $this->clearAllAssign(); |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * clears compiled version of specified template resource, |
|
| 361 | + * or all compiled template files if one is not specified. |
|
| 362 | + * This function is for advanced use only, not normally needed. |
|
| 363 | + * |
|
| 364 | + * @param string $tpl_file |
|
| 365 | + * @param string $compile_id |
|
| 366 | + * @param string $exp_time |
|
| 367 | + * |
|
| 368 | + * @return boolean results of {@link smarty_core_rm_auto()} |
|
| 369 | + */ |
|
| 370 | + public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) |
|
| 371 | + { |
|
| 372 | + return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * Checks whether requested template exists. |
|
| 377 | + * |
|
| 378 | + * @param string $tpl_file |
|
| 379 | + * |
|
| 380 | + * @return boolean |
|
| 381 | + */ |
|
| 382 | + public function template_exists($tpl_file) |
|
| 383 | + { |
|
| 384 | + return $this->templateExists($tpl_file); |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * Returns an array containing template variables |
|
| 389 | + * |
|
| 390 | + * @param string $name |
|
| 391 | + * |
|
| 392 | + * @return array |
|
| 393 | + */ |
|
| 394 | + public function get_template_vars($name = null) |
|
| 395 | + { |
|
| 396 | + return $this->getTemplateVars($name); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + /** |
|
| 400 | + * Returns an array containing config variables |
|
| 401 | + * |
|
| 402 | + * @param string $name |
|
| 403 | + * |
|
| 404 | + * @return array |
|
| 405 | + */ |
|
| 406 | + public function get_config_vars($name = null) |
|
| 407 | + { |
|
| 408 | + return $this->getConfigVars($name); |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * load configuration values |
|
| 413 | + * |
|
| 414 | + * @param string $file |
|
| 415 | + * @param string $section |
|
| 416 | + * @param string $scope |
|
| 417 | + */ |
|
| 418 | + public function config_load($file, $section = null, $scope = 'global') |
|
| 419 | + { |
|
| 420 | + $this->ConfigLoad($file, $section, $scope); |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + /** |
|
| 424 | + * return a reference to a registered object |
|
| 425 | + * |
|
| 426 | + * @param string $name |
|
| 427 | + * |
|
| 428 | + * @return object |
|
| 429 | + */ |
|
| 430 | + public function get_registered_object($name) |
|
| 431 | + { |
|
| 432 | + return $this->getRegisteredObject($name); |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + /** |
|
| 436 | + * clear configuration values |
|
| 437 | + * |
|
| 438 | + * @param string $var |
|
| 439 | + */ |
|
| 440 | + public function clear_config($var = null) |
|
| 441 | + { |
|
| 442 | + $this->clearConfig($var); |
|
| 443 | + } |
|
| 444 | + |
|
| 445 | + /** |
|
| 446 | + * trigger Smarty error |
|
| 447 | + * |
|
| 448 | + * @param string $error_msg |
|
| 449 | + * @param integer $error_type |
|
| 450 | + */ |
|
| 451 | + public function trigger_error($error_msg, $error_type = E_USER_WARNING) |
|
| 452 | + { |
|
| 453 | + trigger_error("Smarty error: $error_msg", $error_type); |
|
| 454 | + } |
|
| 455 | 455 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @param string $compile_id name of compile_id |
| 316 | 316 | * @param string $exp_time expiration time |
| 317 | 317 | * |
| 318 | - * @return boolean |
|
| 318 | + * @return integer |
|
| 319 | 319 | */ |
| 320 | 320 | public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) |
| 321 | 321 | { |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @param string $exp_time expire time |
| 329 | 329 | * |
| 330 | - * @return boolean |
|
| 330 | + * @return integer |
|
| 331 | 331 | */ |
| 332 | 332 | public function clear_all_cache($exp_time = null) |
| 333 | 333 | { |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * @param string $compile_id |
| 366 | 366 | * @param string $exp_time |
| 367 | 367 | * |
| 368 | - * @return boolean results of {@link smarty_core_rm_auto()} |
|
| 368 | + * @return integer results of {@link smarty_core_rm_auto()} |
|
| 369 | 369 | */ |
| 370 | 370 | public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) |
| 371 | 371 | { |