@@ -20,6 +20,7 @@ discard block |
||
| 20 | 20 | * Helper function to log messages |
| 21 | 21 | * @param String Message to log |
| 22 | 22 | * @param Boolean true appends linebreak, false to avoid it |
| 23 | + * @param string $message |
|
| 23 | 24 | * @access private |
| 24 | 25 | */ |
| 25 | 26 | static function log($message, $delim = true) |
@@ -30,6 +31,7 @@ discard block |
||
| 30 | 31 | /** |
| 31 | 32 | * Initialize webservice for the given module |
| 32 | 33 | * @param Module Instance of the module. |
| 34 | + * @param Module $moduleInstance |
|
| 33 | 35 | */ |
| 34 | 36 | static function initialize($moduleInstance) |
| 35 | 37 | { |
@@ -45,6 +47,7 @@ discard block |
||
| 45 | 47 | /** |
| 46 | 48 | * Initialize webservice for the given module |
| 47 | 49 | * @param Module Instance of the module. |
| 50 | + * @param Module $moduleInstance |
|
| 48 | 51 | */ |
| 49 | 52 | static function uninitialize($moduleInstance) |
| 50 | 53 | { |
@@ -69,6 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Normalize the directory path separators. |
| 72 | + * @param string $path |
|
| 72 | 73 | */ |
| 73 | 74 | public function __normalizePath($path) |
| 74 | 75 | { |
@@ -79,6 +80,7 @@ discard block |
||
| 79 | 80 | |
| 80 | 81 | /** |
| 81 | 82 | * Copy the directory on the disk into zip file. |
| 83 | + * @param string $zipdirname |
|
| 82 | 84 | */ |
| 83 | 85 | public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null) |
| 84 | 86 | { |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | if ($search_index === 0) { |
| 51 | 51 | $startindex = strlen($base_realpath) + 1; |
| 52 | 52 | // On windows $base_realpath ends with / and On Linux it will not have / at end! |
| 53 | - if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) |
|
| 54 | - $startindex -= 1; |
|
| 53 | + if (strrpos($base_realpath, '/') == strlen($base_realpath) - 1) { |
|
| 54 | + $startindex -= 1; |
|
| 55 | + } |
|
| 55 | 56 | $relpath = substr($src_realpath, $startindex); |
| 56 | 57 | } |
| 57 | 58 | return $relpath; |
@@ -62,8 +63,9 @@ discard block |
||
| 62 | 63 | */ |
| 63 | 64 | public function __fixDirSeparator($path) |
| 64 | 65 | { |
| 65 | - if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) |
|
| 66 | - $path .= '/'; |
|
| 66 | + if ($path != '' && (strripos($path, '/') != strlen($path) - 1)) { |
|
| 67 | + $path .= '/'; |
|
| 68 | + } |
|
| 67 | 69 | return $path; |
| 68 | 70 | } |
| 69 | 71 | |
@@ -72,8 +74,9 @@ discard block |
||
| 72 | 74 | */ |
| 73 | 75 | public function __normalizePath($path) |
| 74 | 76 | { |
| 75 | - if ($path && strpos($path, '\\') !== false) |
|
| 76 | - $path = preg_replace("/\\\\/", "/", $path); |
|
| 77 | + if ($path && strpos($path, '\\') !== false) { |
|
| 78 | + $path = preg_replace("/\\\\/", "/", $path); |
|
| 79 | + } |
|
| 77 | 80 | return $path; |
| 78 | 81 | } |
| 79 | 82 | |
@@ -83,18 +86,21 @@ discard block |
||
| 83 | 86 | public function copyDirectoryFromDisk($dirname, $zipdirname = null, $excludeList = null, $basedirname = null) |
| 84 | 87 | { |
| 85 | 88 | $dir = opendir($dirname); |
| 86 | - if (strripos($dirname, '/') != strlen($dirname) - 1) |
|
| 87 | - $dirname .= '/'; |
|
| 89 | + if (strripos($dirname, '/') != strlen($dirname) - 1) { |
|
| 90 | + $dirname .= '/'; |
|
| 91 | + } |
|
| 88 | 92 | |
| 89 | - if ($basedirname == null) |
|
| 90 | - $basedirname = realpath($dirname); |
|
| 93 | + if ($basedirname == null) { |
|
| 94 | + $basedirname = realpath($dirname); |
|
| 95 | + } |
|
| 91 | 96 | |
| 92 | 97 | while (false !== ($file = readdir($dir))) { |
| 93 | 98 | if ($file != '.' && $file != '..' && |
| 94 | 99 | $file != '.svn' && $file != 'CVS') { |
| 95 | 100 | // Exclude the file/directory |
| 96 | - if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) |
|
| 97 | - continue; |
|
| 101 | + if (!empty($excludeList) && in_array("$dirname$file", $excludeList)) { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 98 | 104 | |
| 99 | 105 | if (is_dir("$dirname$file")) { |
| 100 | 106 | $this->copyDirectoryFromDisk("$dirname$file", $zipdirname, $excludeList, $basedirname); |
@@ -11,38 +11,38 @@ |
||
| 11 | 11 | require_once 'config/api.php'; |
| 12 | 12 | $service = $_REQUEST['service']; |
| 13 | 13 | |
| 14 | -if(isset($service)) |
|
| 14 | +if (isset($service)) |
|
| 15 | 15 | { |
| 16 | - if(!in_array($service,$enabledServices)){ |
|
| 17 | - die($service.' - Service is not active'); |
|
| 16 | + if (!in_array($service, $enabledServices)) { |
|
| 17 | + die($service . ' - Service is not active'); |
|
| 18 | 18 | } |
| 19 | - if($service == "customerportal") |
|
| 19 | + if ($service == "customerportal") |
|
| 20 | 20 | { |
| 21 | 21 | include("api/customerportal.php"); |
| 22 | 22 | } |
| 23 | - elseif($service == "mobile") |
|
| 23 | + elseif ($service == "mobile") |
|
| 24 | 24 | { |
| 25 | 25 | include("api/mobile.php"); |
| 26 | 26 | } |
| 27 | - elseif($service == "yetiportal") |
|
| 27 | + elseif ($service == "yetiportal") |
|
| 28 | 28 | { |
| 29 | 29 | include("api/yetiportal.php"); |
| 30 | 30 | } |
| 31 | - elseif($service == "firefox") |
|
| 31 | + elseif ($service == "firefox") |
|
| 32 | 32 | { |
| 33 | 33 | include("api/firefoxtoolbar.php"); |
| 34 | 34 | } |
| 35 | - elseif($service == "wordplugin") |
|
| 35 | + elseif ($service == "wordplugin") |
|
| 36 | 36 | { |
| 37 | 37 | include("api/wordplugin.php"); |
| 38 | 38 | } |
| 39 | - elseif($service == "thunderbird") |
|
| 39 | + elseif ($service == "thunderbird") |
|
| 40 | 40 | { |
| 41 | 41 | include("api/thunderbirdplugin.php"); |
| 42 | 42 | } |
| 43 | 43 | else |
| 44 | 44 | { |
| 45 | - echo "No Service Configured for ". strip_tags($service); |
|
| 45 | + echo "No Service Configured for " . strip_tags($service); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | else |
@@ -19,33 +19,26 @@ |
||
| 19 | 19 | if($service == "customerportal") |
| 20 | 20 | { |
| 21 | 21 | include("api/customerportal.php"); |
| 22 | - } |
|
| 23 | - elseif($service == "mobile") |
|
| 22 | + } elseif($service == "mobile") |
|
| 24 | 23 | { |
| 25 | 24 | include("api/mobile.php"); |
| 26 | - } |
|
| 27 | - elseif($service == "yetiportal") |
|
| 25 | + } elseif($service == "yetiportal") |
|
| 28 | 26 | { |
| 29 | 27 | include("api/yetiportal.php"); |
| 30 | - } |
|
| 31 | - elseif($service == "firefox") |
|
| 28 | + } elseif($service == "firefox") |
|
| 32 | 29 | { |
| 33 | 30 | include("api/firefoxtoolbar.php"); |
| 34 | - } |
|
| 35 | - elseif($service == "wordplugin") |
|
| 31 | + } elseif($service == "wordplugin") |
|
| 36 | 32 | { |
| 37 | 33 | include("api/wordplugin.php"); |
| 38 | - } |
|
| 39 | - elseif($service == "thunderbird") |
|
| 34 | + } elseif($service == "thunderbird") |
|
| 40 | 35 | { |
| 41 | 36 | include("api/thunderbirdplugin.php"); |
| 42 | - } |
|
| 43 | - else |
|
| 37 | + } else |
|
| 44 | 38 | { |
| 45 | 39 | echo "No Service Configured for ". strip_tags($service); |
| 46 | 40 | } |
| 47 | -} |
|
| 48 | -else |
|
| 41 | +} else |
|
| 49 | 42 | { |
| 50 | 43 | echo "<h1>YetiForceCRM API Services</h1>"; |
| 51 | 44 | echo "<li>YetiForceCRM Yeti Portal EndPoint URL -- Click <a href='api.php?service=yetiportal'>here</a></li>"; |
@@ -16,10 +16,11 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $entity = false; |
| 18 | 18 | if ($mixed) { |
| 19 | - if (is_numeric($mixed)) |
|
| 20 | - $entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false; |
|
| 21 | - else |
|
| 22 | - $entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false; |
|
| 19 | + if (is_numeric($mixed)) { |
|
| 20 | + $entity = isset(self::$moduleEntityCacheById[$mixed]) ? self::$moduleEntityCacheById[$mixed] : false; |
|
| 21 | + } else { |
|
| 22 | + $entity = isset(self::$moduleEntityCacheByName[$mixed]) ? self::$moduleEntityCacheByName[$mixed] : false; |
|
| 23 | + } |
|
| 23 | 24 | } |
| 24 | 25 | if (!$entity) { |
| 25 | 26 | $adb = \PearDatabase::getInstance(); |
@@ -31,10 +32,11 @@ discard block |
||
| 31 | 32 | self::$moduleEntityCacheById[$row['tabid']] = $row; |
| 32 | 33 | } |
| 33 | 34 | if ($mixed) { |
| 34 | - if (is_numeric($mixed)) |
|
| 35 | - return self::$moduleEntityCacheById[$mixed]; |
|
| 36 | - else |
|
| 37 | - return self::$moduleEntityCacheByName[$mixed]; |
|
| 35 | + if (is_numeric($mixed)) { |
|
| 36 | + return self::$moduleEntityCacheById[$mixed]; |
|
| 37 | + } else { |
|
| 38 | + return self::$moduleEntityCacheByName[$mixed]; |
|
| 39 | + } |
|
| 38 | 40 | } |
| 39 | 41 | } |
| 40 | 42 | return $entity; |
@@ -31,6 +31,9 @@ |
||
| 31 | 31 | file_put_contents(self::$usersFile, '<?php return ' . \vtlib\Functions::varExportMin($users) . ';'); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | + /** |
|
| 35 | + * @param string $type |
|
| 36 | + */ |
|
| 34 | 37 | public static function getUser($type) |
| 35 | 38 | { |
| 36 | 39 | if (self::$usersFileCache === false) { |
@@ -464,8 +464,9 @@ discard block |
||
| 464 | 464 | $this->checkError('Missing table name'); |
| 465 | 465 | return false; |
| 466 | 466 | } |
| 467 | - if ($where != '') |
|
| 468 | - $where = sprintf('WHERE %s', $where); |
|
| 467 | + if ($where != '') { |
|
| 468 | + $where = sprintf('WHERE %s', $where); |
|
| 469 | + } |
|
| 469 | 470 | if (count($params) === 0) { |
| 470 | 471 | $this->query(sprintf('DELETE FROM %s %s', $table, $where)); |
| 471 | 472 | } else { |
@@ -558,10 +559,12 @@ discard block |
||
| 558 | 559 | //TODO DEPRECATED |
| 559 | 560 | public function flatten_array($input, $output = null) |
| 560 | 561 | { |
| 561 | - if ($input == null) |
|
| 562 | - return null; |
|
| 563 | - if ($output == null) |
|
| 564 | - $output = []; |
|
| 562 | + if ($input == null) { |
|
| 563 | + return null; |
|
| 564 | + } |
|
| 565 | + if ($output == null) { |
|
| 566 | + $output = []; |
|
| 567 | + } |
|
| 565 | 568 | foreach ($input as $value) { |
| 566 | 569 | if (is_array($value)) { |
| 567 | 570 | $output = $this->flatten_array($value, $output); |
@@ -634,15 +637,17 @@ discard block |
||
| 634 | 637 | { |
| 635 | 638 | if (isset($result) && $rowNum < 0) { |
| 636 | 639 | $row = $this->getRow($result); |
| 637 | - if ($encode && is_array($row)) |
|
| 638 | - return array_map('to_html', $row); |
|
| 640 | + if ($encode && is_array($row)) { |
|
| 641 | + return array_map('to_html', $row); |
|
| 642 | + } |
|
| 639 | 643 | return $row; |
| 640 | 644 | } |
| 641 | 645 | if ($this->getRowCount($result) > $rowNum) { |
| 642 | 646 | $row = $this->raw_query_result_rowdata($result, $rowNum); |
| 643 | 647 | } |
| 644 | - if ($encode && is_array($row)) |
|
| 645 | - return array_map('to_html', $row); |
|
| 648 | + if ($encode && is_array($row)) { |
|
| 649 | + return array_map('to_html', $row); |
|
| 650 | + } |
|
| 646 | 651 | return $row; |
| 647 | 652 | } |
| 648 | 653 | |
@@ -787,8 +792,9 @@ discard block |
||
| 787 | 792 | $this->log('sqlExprDatalist: empty arrays not allowed', 'error'); |
| 788 | 793 | $this->checkError('sqlExprDatalist: empty arrays not allowed'); |
| 789 | 794 | } |
| 790 | - foreach ($array as $key => $val) |
|
| 791 | - $l .= ($l ? ',' : '') . $this->quote($val); |
|
| 795 | + foreach ($array as $key => $val) { |
|
| 796 | + $l .= ($l ? ',' : '') . $this->quote($val); |
|
| 797 | + } |
|
| 792 | 798 | return ' ( ' . $l . ' ) '; |
| 793 | 799 | } |
| 794 | 800 | |
@@ -803,8 +809,9 @@ discard block |
||
| 803 | 809 | { |
| 804 | 810 | $result = $this->query($sql, $dieOnError, $msg); |
| 805 | 811 | |
| 806 | - if ($this->getRowCount($result) == 1) |
|
| 807 | - return $result; |
|
| 812 | + if ($this->getRowCount($result) == 1) { |
|
| 813 | + return $result; |
|
| 814 | + } |
|
| 808 | 815 | $this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error'); |
| 809 | 816 | $this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError); |
| 810 | 817 | return ''; |
@@ -816,8 +823,9 @@ discard block |
||
| 816 | 823 | { |
| 817 | 824 | $result = $this->pquery($sql, $params, $dieOnError, $msg); |
| 818 | 825 | |
| 819 | - if ($this->getRowCount($result) == 1) |
|
| 820 | - return $result; |
|
| 826 | + if ($this->getRowCount($result) == 1) { |
|
| 827 | + return $result; |
|
| 828 | + } |
|
| 821 | 829 | $this->log('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, 'error'); |
| 822 | 830 | $this->checkError('Rows Returned:' . $this->getRowCount($result) . ' More than 1 row returned for ' . $sql, $dieOnError); |
| 823 | 831 | return ''; |
@@ -881,8 +889,9 @@ discard block |
||
| 881 | 889 | if (isset($_SERVER['REQUEST_METHOD'])) { |
| 882 | 890 | $uri = $_SERVER['REQUEST_URI']; |
| 883 | 891 | $qmarkIndex = strpos($_SERVER['REQUEST_URI'], '?'); |
| 884 | - if ($qmarkIndex !== false) |
|
| 885 | - $uri = substr($uri, 0, $qmarkIndex); |
|
| 892 | + if ($qmarkIndex !== false) { |
|
| 893 | + $uri = substr($uri, 0, $qmarkIndex); |
|
| 894 | + } |
|
| 886 | 895 | $data = $uri . '?' . http_build_query($_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST); |
| 887 | 896 | } |
| 888 | 897 | $stmt = $db->database->prepare($logQuery); |
@@ -917,10 +926,12 @@ discard block |
||
| 917 | 926 | } |
| 918 | 927 | $args = rtrim($args, ','); |
| 919 | 928 | } |
| 920 | - if (!empty($callerfunc)) |
|
| 921 | - $callerfunc = " ($callerfunc)"; |
|
| 922 | - if (!empty($args)) |
|
| 923 | - $callerfunc .= "[$args] "; |
|
| 929 | + if (!empty($callerfunc)) { |
|
| 930 | + $callerfunc = " ($callerfunc)"; |
|
| 931 | + } |
|
| 932 | + if (!empty($args)) { |
|
| 933 | + $callerfunc .= "[$args] "; |
|
| 934 | + } |
|
| 924 | 935 | } |
| 925 | 936 | $data[] = 'CALLER: (' . $callers[$calleridx]['line'] . ') ' . $callers[$calleridx]['file'] . $callerfunc; |
| 926 | 937 | } |
@@ -118,6 +118,14 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | + /** |
|
| 122 | + * @param string $dbtype |
|
| 123 | + * @param string $host |
|
| 124 | + * @param string $dbname |
|
| 125 | + * @param string $username |
|
| 126 | + * @param string $passwd |
|
| 127 | + * @param integer $port |
|
| 128 | + */ |
|
| 121 | 129 | protected function loadDBConfig($dbtype, $host, $dbname, $username, $passwd, $port) |
| 122 | 130 | { |
| 123 | 131 | if ($host == '_SERVER_') { |
@@ -211,6 +219,9 @@ discard block |
||
| 211 | 219 | $this->dieOnError = $value; |
| 212 | 220 | } |
| 213 | 221 | |
| 222 | + /** |
|
| 223 | + * @param boolean $value |
|
| 224 | + */ |
|
| 214 | 225 | public function setAttribute($attribute, $value) |
| 215 | 226 | { |
| 216 | 227 | $this->database->setAttribute($attribute, $value); |
@@ -590,6 +601,12 @@ discard block |
||
| 590 | 601 | return $columns; |
| 591 | 602 | } |
| 592 | 603 | |
| 604 | + /** |
|
| 605 | + * @param string $table |
|
| 606 | + * @param string $column |
|
| 607 | + * @param null|string $val |
|
| 608 | + * @param string $where |
|
| 609 | + */ |
|
| 593 | 610 | public function updateBlob($table, $column, $val, $where) |
| 594 | 611 | { |
| 595 | 612 | $this->log("Update Blob: $table, $column, $val, $where, $blobtype"); |
@@ -795,6 +812,9 @@ discard block |
||
| 795 | 812 | return ''; |
| 796 | 813 | } |
| 797 | 814 | |
| 815 | + /** |
|
| 816 | + * @param integer $col |
|
| 817 | + */ |
|
| 798 | 818 | public function columnMeta(&$result, $col) |
| 799 | 819 | { |
| 800 | 820 | $meta = $result->getColumnMeta($col); |
@@ -833,6 +853,9 @@ discard block |
||
| 833 | 853 | protected $logSqlTimeID = false; |
| 834 | 854 | protected $logSqlTimeGroup = 1; |
| 835 | 855 | |
| 856 | + /** |
|
| 857 | + * @param double $endat |
|
| 858 | + */ |
|
| 836 | 859 | public function logSqlTime($startat, $endat, $sql, $params = false) |
| 837 | 860 | { |
| 838 | 861 | if (!AppConfig::performance('SQL_LOG_INCLUDE_CALLER')) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $x = ""; |
| 57 | 57 | for ($j = 0; $j < count($val); $j++) { |
| 58 | 58 | if ($j != $n) { |
| 59 | - $x .=" " . $val[$j]; |
|
| 59 | + $x .= " " . $val[$j]; |
|
| 60 | 60 | } else { |
| 61 | 61 | $x .= "@#" . $val[$j]; |
| 62 | 62 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $x = ""; |
| 241 | 241 | for ($j = 0; $j < count($val); $j++) { |
| 242 | 242 | if ($j != $n) { |
| 243 | - $x .=" " . $val[$j]; |
|
| 243 | + $x .= " " . $val[$j]; |
|
| 244 | 244 | } else { |
| 245 | 245 | $x .= "@#" . $val[$j]; |
| 246 | 246 | } |
@@ -32,14 +32,18 @@ discard block |
||
| 32 | 32 | } else { |
| 33 | 33 | $cache_file_name = $cachedFileName; |
| 34 | 34 | } |
| 35 | - if (empty($width)) |
|
| 36 | - $width = '400'; |
|
| 37 | - if (empty($height)) |
|
| 38 | - $height = '300'; |
|
| 39 | - if ($target === false) |
|
| 40 | - $target = []; |
|
| 41 | - if (empty($color)) |
|
| 42 | - $color = 'black'; |
|
| 35 | + if (empty($width)) { |
|
| 36 | + $width = '400'; |
|
| 37 | + } |
|
| 38 | + if (empty($height)) { |
|
| 39 | + $height = '300'; |
|
| 40 | + } |
|
| 41 | + if ($target === false) { |
|
| 42 | + $target = []; |
|
| 43 | + } |
|
| 44 | + if (empty($color)) { |
|
| 45 | + $color = 'black'; |
|
| 46 | + } |
|
| 43 | 47 | |
| 44 | 48 | $alts = []; |
| 45 | 49 | $temp = []; |
@@ -48,8 +52,9 @@ discard block |
||
| 48 | 52 | $pos = substr_count($name, " "); |
| 49 | 53 | $alts[] = $name; |
| 50 | 54 | //If the daatx value of a string is greater, adding '\n' to it so that it'll cme inh 2nd line |
| 51 | - if (strlen($name) >= 14) |
|
| 52 | - $name = substr($name, 0, 44); |
|
| 55 | + if (strlen($name) >= 14) { |
|
| 56 | + $name = substr($name, 0, 44); |
|
| 57 | + } |
|
| 53 | 58 | if ($pos >= 2) { |
| 54 | 59 | $val = explode(" ", $name); |
| 55 | 60 | $n = count($val) - 1; |
@@ -102,8 +107,9 @@ discard block |
||
| 102 | 107 | |
| 103 | 108 | for ($i = 0; $i < count($yaxisData); $i++) { |
| 104 | 109 | $x = 1 + $i; |
| 105 | - if ($yaxisData[$i] >= $max) |
|
| 106 | - $max = $yaxisData[$i]; |
|
| 110 | + if ($yaxisData[$i] >= $max) { |
|
| 111 | + $max = $yaxisData[$i]; |
|
| 112 | + } |
|
| 107 | 113 | $dataset->addPoint( |
| 108 | 114 | $x, $yaxisData[$i], array( |
| 109 | 115 | 'url' => $target[$i], |
@@ -125,8 +131,9 @@ discard block |
||
| 125 | 131 | $bplot->setFillStyle($fill); |
| 126 | 132 | |
| 127 | 133 | //You can change the width of the bars if you like |
| 128 | - if (!empty($xaxisData)) |
|
| 129 | - $bplot->setBarWidth($barwidth / count($xaxisData), "%"); |
|
| 134 | + if (!empty($xaxisData)) { |
|
| 135 | + $bplot->setBarWidth($barwidth / count($xaxisData), "%"); |
|
| 136 | + } |
|
| 130 | 137 | $bplot->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL, 'white', 'white'))); |
| 131 | 138 | $xaxis = & $plotarea->getAxis(IMAGE_GRAPH_AXIS_X); |
| 132 | 139 | $yaxis = & $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); |
@@ -150,8 +157,9 @@ discard block |
||
| 150 | 157 | $ticks = get_tickspacing(round(($max * 1.1) + 0.5)); |
| 151 | 158 | |
| 152 | 159 | // First make the labels look right |
| 153 | - if ($charttype == 'horizontal') |
|
| 154 | - $yaxis->setFontAngle('vertical'); |
|
| 160 | + if ($charttype == 'horizontal') { |
|
| 161 | + $yaxis->setFontAngle('vertical'); |
|
| 162 | + } |
|
| 155 | 163 | $yaxis->setLabelInterval($ticks[0]); |
| 156 | 164 | $yaxis->setTickOptions(-5, 0); |
| 157 | 165 | $yaxis->setLabelInterval($ticks[1], 2); |
@@ -165,8 +173,9 @@ discard block |
||
| 165 | 173 | $xaxis->setDataPreprocessor($array_data); |
| 166 | 174 | $xaxis->forceMinimum(0.5); |
| 167 | 175 | $xaxis->forceMaximum(0.5 + count($yaxisData)); |
| 168 | - if ($charttype == 'vertical') |
|
| 169 | - $xaxis->setFontAngle('vertical'); |
|
| 176 | + if ($charttype == 'vertical') { |
|
| 177 | + $xaxis->setFontAngle('vertical'); |
|
| 178 | + } |
|
| 170 | 179 | $xaxis->setLabelInterval(1); |
| 171 | 180 | $xaxis->setTickOptions(0, 0); |
| 172 | 181 | $xaxis->setLabelInterval(2, 2); |
@@ -218,12 +227,15 @@ discard block |
||
| 218 | 227 | $cache_file_name = $cachedFileName; |
| 219 | 228 | } |
| 220 | 229 | |
| 221 | - if (empty($width)) |
|
| 222 | - $width = '500'; |
|
| 223 | - if (empty($height)) |
|
| 224 | - $height = '400'; |
|
| 225 | - if ($target === false) |
|
| 226 | - $target = []; |
|
| 230 | + if (empty($width)) { |
|
| 231 | + $width = '500'; |
|
| 232 | + } |
|
| 233 | + if (empty($height)) { |
|
| 234 | + $height = '400'; |
|
| 235 | + } |
|
| 236 | + if ($target === false) { |
|
| 237 | + $target = []; |
|
| 238 | + } |
|
| 227 | 239 | |
| 228 | 240 | $alts = []; |
| 229 | 241 | $temp = []; |
@@ -232,8 +244,9 @@ discard block |
||
| 232 | 244 | $pos = substr_count($name, " "); |
| 233 | 245 | $alts[] = $name; |
| 234 | 246 | //If the datax value of a string is greater, adding '\n' to it so that it'll come in 2nd line |
| 235 | - if (strlen($name) >= 14) |
|
| 236 | - $name = substr($name, 0, 34); |
|
| 247 | + if (strlen($name) >= 14) { |
|
| 248 | + $name = substr($name, 0, 34); |
|
| 249 | + } |
|
| 237 | 250 | if ($pos >= 2) { |
| 238 | 251 | $val = explode(" ", $name); |
| 239 | 252 | $n = count($val) - 1; |
@@ -297,8 +310,9 @@ discard block |
||
| 297 | 310 | $pcvalues[$yaxisData[$i]] = sprintf('%0.1f%%', 100 * $yaxisData[$i] / $sum); |
| 298 | 311 | $fills->addColor($colors[$i]); |
| 299 | 312 | } |
| 300 | - if ($sum == 0) |
|
| 301 | - return null; |
|
| 313 | + if ($sum == 0) { |
|
| 314 | + return null; |
|
| 315 | + } |
|
| 302 | 316 | // create the pie chart and associate the filling colours |
| 303 | 317 | $gbplot = & $plotarea->addNew('pie', $dataset); |
| 304 | 318 | $plotarea->setPadding(array('top' => 0, 'bottom' => 0, 'left' => 0, 'right' => ($width / 20))); |
@@ -361,8 +375,9 @@ discard block |
||
| 361 | 375 | $restrictedModules = false; |
| 362 | 376 | foreach ($reportModules as $mod) { |
| 363 | 377 | if (isPermitted($mod, 'index') != 'yes' || \includes\Modules::isModuleActive($mod) == false) { |
| 364 | - if (!is_array($restrictedModules)) |
|
| 365 | - $restrictedModules = []; |
|
| 378 | + if (!is_array($restrictedModules)) { |
|
| 379 | + $restrictedModules = []; |
|
| 380 | + } |
|
| 366 | 381 | $restrictedModules[] = $mod; |
| 367 | 382 | } |
| 368 | 383 | } |
@@ -409,12 +424,12 @@ discard block |
||
| 409 | 424 | $groupFieldValue = $valueComp[1]; |
| 410 | 425 | } |
| 411 | 426 | if ($dateField) { |
| 412 | - if (!empty($groupFieldValue)) |
|
| 413 | - $groupByFields[] = CustomReportUtils::getXAxisDateFieldValue($groupFieldValue, $criteria); |
|
| 414 | - else |
|
| 415 | - $groupByFields[] = "Null"; |
|
| 416 | - } |
|
| 417 | - else if (in_array($fieldname, array_keys($referenceFields))) { |
|
| 427 | + if (!empty($groupFieldValue)) { |
|
| 428 | + $groupByFields[] = CustomReportUtils::getXAxisDateFieldValue($groupFieldValue, $criteria); |
|
| 429 | + } else { |
|
| 430 | + $groupByFields[] = "Null"; |
|
| 431 | + } |
|
| 432 | + } else if (in_array($fieldname, array_keys($referenceFields))) { |
|
| 418 | 433 | if (count($referenceFields[$fieldname]) > 1) { |
| 419 | 434 | $refenceModule = CustomReportUtils::getEntityTypeFromName($decodedGroupFieldValue, $referenceFields[$fieldname]); |
| 420 | 435 | } else { |
@@ -443,10 +458,10 @@ discard block |
||
| 443 | 458 | $advanceSearchCondition = CustomReportUtils::getAdvanceSearchCondition($fieldDetails, $criteria, $groupFieldValue); |
| 444 | 459 | if ($module == 'Calendar') { |
| 445 | 460 | $link_val = "index.php?module=" . $module . "&query=true&action=ListView&" . $advanceSearchCondition; |
| 446 | - } else |
|
| 447 | - $link_val = "index.php?module=" . $module . "&query=true&action=index&" . $advanceSearchCondition; |
|
| 448 | - } |
|
| 449 | - else { |
|
| 461 | + } else { |
|
| 462 | + $link_val = "index.php?module=" . $module . "&query=true&action=index&" . $advanceSearchCondition; |
|
| 463 | + } |
|
| 464 | + } else { |
|
| 450 | 465 | $cvid = \vtlib\Deprecated::getIdOfCustomViewByNameAll($module); |
| 451 | 466 | $esc_search_str = urlencode($decodedGroupFieldValue); |
| 452 | 467 | if ($single == 'DT') { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $moduleTableIndexList = $meta->getEntityTableIndexList(); |
| 121 | 121 | foreach ($tableList as $index => $tableName) { |
| 122 | 122 | if ($tableName != $tableList[0]) { |
| 123 | - $sql .=' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' . |
|
| 123 | + $sql .= ' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' . |
|
| 124 | 124 | $moduleTableIndexList[$tableList[0]] . '=' . $tableName . '.' . |
| 125 | 125 | $moduleTableIndexList[$tableName]; |
| 126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | //If module is Leads and if you are not selected any leads fields then query failure is happening. |
| 129 | 129 | //By default we are checking where condition on base table. |
| 130 | 130 | if ($module == 'Leads' && !in_array('vtiger_leaddetails', $tableList)) { |
| 131 | - $sql .=' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid'; |
|
| 131 | + $sql .= ' INNER JOIN vtiger_leaddetails ON vtiger_leaddetails.leadid = vtiger_crmentity.crmid'; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | $sql .= ' WHERE'; |
@@ -209,8 +209,9 @@ discard block |
||
| 209 | 209 | $needle = '$' . strtolower($this->module) . '-' . $parentFieldColumnMapping[$params['field']] . ':' . $column . '$'; |
| 210 | 210 | $this->processedDescription = str_replace($needle, $values[array_search($column, $fieldColumnMapping)], $this->processedDescription); |
| 211 | 211 | } |
| 212 | - if (!$params['owner']) |
|
| 213 | - $this->processedmodules[$module] = true; |
|
| 212 | + if (!$params['owner']) { |
|
| 213 | + $this->processedmodules[$module] = true; |
|
| 214 | + } |
|
| 214 | 215 | } |
| 215 | 216 | } |
| 216 | 217 | } |
@@ -253,7 +254,8 @@ discard block |
||
| 253 | 254 | $rows = $adb->num_rows($res); |
| 254 | 255 | if ($rows > 0) { |
| 255 | 256 | return true; |
| 256 | - } else |
|
| 257 | - return false; |
|
| 257 | + } else { |
|
| 258 | + return false; |
|
| 259 | + } |
|
| 258 | 260 | } |
| 259 | 261 | } |
@@ -37,8 +37,9 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function setConfig($key, $value) |
| 39 | 39 | { |
| 40 | - if (empty($key)) |
|
| 41 | - return; |
|
| 40 | + if (empty($key)) { |
|
| 41 | + return; |
|
| 42 | + } |
|
| 42 | 43 | $this->properties[$key] = $value; |
| 43 | 44 | //not neccessary for php5.x versions |
| 44 | 45 | self::$propertiesCache[$this->name] = $this->properties; |
@@ -46,8 +47,9 @@ discard block |
||
| 46 | 47 | |
| 47 | 48 | public function getConfig($key) |
| 48 | 49 | { |
| 49 | - if (empty($key)) |
|
| 50 | - return ''; |
|
| 50 | + if (empty($key)) { |
|
| 51 | + return ''; |
|
| 52 | + } |
|
| 51 | 53 | return $this->properties[$key]; |
| 52 | 54 | } |
| 53 | 55 | } |
@@ -15,6 +15,10 @@ discard block |
||
| 15 | 15 | protected $name; |
| 16 | 16 | static $propertiesCache = []; |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @param string $path |
|
| 20 | + * @param string $name |
|
| 21 | + */ |
|
| 18 | 22 | public function __construct($path, $name, $force = false) |
| 19 | 23 | { |
| 20 | 24 | $this->load($path, $name, $force); |
@@ -41,6 +45,9 @@ discard block |
||
| 41 | 45 | self::$propertiesCache[$this->name] = $this->properties; |
| 42 | 46 | } |
| 43 | 47 | |
| 48 | + /** |
|
| 49 | + * @param string $key |
|
| 50 | + */ |
|
| 44 | 51 | public function getConfig($key) |
| 45 | 52 | { |
| 46 | 53 | if (empty($key)) |
@@ -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 | } |