@@ -23,6 +23,9 @@ |
||
23 | 23 | protected $user; |
24 | 24 | protected $module; |
25 | 25 | |
26 | + /** |
|
27 | + * @param Link $link |
|
28 | + */ |
|
26 | 29 | public function __construct($link, $user, $input = null) |
27 | 30 | { |
28 | 31 | $this->link = $link; |
@@ -25,6 +25,7 @@ |
||
25 | 25 | * @param String URL of the site |
26 | 26 | * Example: |
27 | 27 | * $client = new Vtiger_New_Client('http://www.vtiger.com'); |
28 | + * @param string|false $url |
|
28 | 29 | */ |
29 | 30 | public function __construct($url) |
30 | 31 | { |
@@ -77,14 +77,16 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function doGet($params = false, $timeout = null) |
79 | 79 | { |
80 | - if ($timeout) |
|
81 | - $this->client->_timeout = $timeout; |
|
80 | + if ($timeout) { |
|
81 | + $this->client->_timeout = $timeout; |
|
82 | + } |
|
82 | 83 | $this->client->setURL($this->url); |
83 | 84 | $this->client->setMethod(HTTP_REQUEST_METHOD_GET); |
84 | 85 | |
85 | 86 | if ($params) { |
86 | - foreach ($params as $key => $value) |
|
87 | - $this->client->addQueryString($key, $value); |
|
87 | + foreach ($params as $key => $value) { |
|
88 | + $this->client->addQueryString($key, $value); |
|
89 | + } |
|
88 | 90 | } |
89 | 91 | $this->response = $this->client->sendRequest(); |
90 | 92 | |
@@ -103,17 +105,19 @@ discard block |
||
103 | 105 | */ |
104 | 106 | public function doPost($params = false, $timeout = null) |
105 | 107 | { |
106 | - if ($timeout) |
|
107 | - $this->client->_timeout = $timeout; |
|
108 | + if ($timeout) { |
|
109 | + $this->client->_timeout = $timeout; |
|
110 | + } |
|
108 | 111 | $this->client->setURL($this->url); |
109 | 112 | $this->client->setMethod(HTTP_REQUEST_METHOD_POST); |
110 | 113 | |
111 | 114 | if ($params) { |
112 | - if (is_string($params)) |
|
113 | - $this->client->addRawPostData($params); |
|
114 | - else { |
|
115 | - foreach ($params as $key => $value) |
|
116 | - $this->client->addPostData($key, $value); |
|
115 | + if (is_string($params)) { |
|
116 | + $this->client->addRawPostData($params); |
|
117 | + } else { |
|
118 | + foreach ($params as $key => $value) { |
|
119 | + $this->client->addPostData($key, $value); |
|
120 | + } |
|
117 | 121 | } |
118 | 122 | } |
119 | 123 | $this->response = $this->client->sendRequest(); |
@@ -53,6 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | /** |
55 | 55 | * Get type of package (as specified in manifest) |
56 | + * @return string |
|
56 | 57 | */ |
57 | 58 | public function type() |
58 | 59 | { |
@@ -393,6 +394,7 @@ discard block |
||
393 | 394 | /** |
394 | 395 | * Cache the field instance for re-use |
395 | 396 | * @access private |
397 | + * @param Field $fieldInstance |
|
396 | 398 | */ |
397 | 399 | public function __AddModuleFieldToCache($moduleInstance, $fieldname, $fieldInstance) |
398 | 400 | { |
@@ -674,6 +676,8 @@ discard block |
||
674 | 676 | /** |
675 | 677 | * Import Blocks of the module |
676 | 678 | * @access private |
679 | + * @param \SimpleXMLElement $modulenode |
|
680 | + * @param Module $moduleInstance |
|
677 | 681 | */ |
678 | 682 | public function import_Blocks($modulenode, $moduleInstance) |
679 | 683 | { |
@@ -717,6 +721,7 @@ discard block |
||
717 | 721 | /** |
718 | 722 | * Import Fields of the module |
719 | 723 | * @access private |
724 | + * @param Block $blockInstance |
|
720 | 725 | */ |
721 | 726 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
722 | 727 | { |
@@ -807,6 +812,8 @@ discard block |
||
807 | 812 | /** |
808 | 813 | * Import Custom views of the module |
809 | 814 | * @access private |
815 | + * @param \SimpleXMLElement $modulenode |
|
816 | + * @param Module $moduleInstance |
|
810 | 817 | */ |
811 | 818 | public function import_CustomViews($modulenode, $moduleInstance) |
812 | 819 | { |
@@ -851,6 +858,8 @@ discard block |
||
851 | 858 | /** |
852 | 859 | * Import Sharing Access of the module |
853 | 860 | * @access private |
861 | + * @param \SimpleXMLElement $modulenode |
|
862 | + * @param Module $moduleInstance |
|
854 | 863 | */ |
855 | 864 | public function import_SharingAccess($modulenode, $moduleInstance) |
856 | 865 | { |
@@ -867,6 +876,8 @@ discard block |
||
867 | 876 | /** |
868 | 877 | * Import Events of the module |
869 | 878 | * @access private |
879 | + * @param \SimpleXMLElement $modulenode |
|
880 | + * @param Module $moduleInstance |
|
870 | 881 | */ |
871 | 882 | public function import_Events($modulenode, $moduleInstance) |
872 | 883 | { |
@@ -899,6 +910,8 @@ discard block |
||
899 | 910 | /** |
900 | 911 | * Import actions of the module |
901 | 912 | * @access private |
913 | + * @param \SimpleXMLElement $modulenode |
|
914 | + * @param Module $moduleInstance |
|
902 | 915 | */ |
903 | 916 | public function import_Actions($modulenode, $moduleInstance) |
904 | 917 | { |
@@ -925,6 +938,8 @@ discard block |
||
925 | 938 | /** |
926 | 939 | * Import related lists of the module |
927 | 940 | * @access private |
941 | + * @param \SimpleXMLElement $modulenode |
|
942 | + * @param Module $moduleInstance |
|
928 | 943 | */ |
929 | 944 | public function import_RelatedLists($modulenode, $moduleInstance) |
930 | 945 | { |
@@ -1004,6 +1019,7 @@ discard block |
||
1004 | 1019 | /** |
1005 | 1020 | * Import cron jobs of the module. |
1006 | 1021 | * @access private |
1022 | + * @param \SimpleXMLElement $modulenode |
|
1007 | 1023 | */ |
1008 | 1024 | public function import_CronTasks($modulenode) |
1009 | 1025 | { |
@@ -1022,6 +1038,9 @@ discard block |
||
1022 | 1038 | } |
1023 | 1039 | } |
1024 | 1040 | |
1041 | + /** |
|
1042 | + * @param \SimpleXMLElement $modulenode |
|
1043 | + */ |
|
1025 | 1044 | public function import_update($modulenode) |
1026 | 1045 | { |
1027 | 1046 | $dirName = 'cache/updates'; |
@@ -101,8 +101,9 @@ discard block |
||
101 | 101 | { |
102 | 102 | $xpathres = $this->xpath($path); |
103 | 103 | foreach ($xpathres as $pathkey => $pathvalue) { |
104 | - if ($pathkey == $path) |
|
105 | - return $pathvalue; |
|
104 | + if ($pathkey == $path) { |
|
105 | + return $pathvalue; |
|
106 | + } |
|
106 | 107 | } |
107 | 108 | return false; |
108 | 109 | } |
@@ -121,13 +122,15 @@ discard block |
||
121 | 122 | |
122 | 123 | if ($packagetype) { |
123 | 124 | $lcasetype = strtolower($packagetype); |
124 | - if ($lcasetype == 'language') |
|
125 | - return true; |
|
125 | + if ($lcasetype == 'language') { |
|
126 | + return true; |
|
127 | + } |
|
126 | 128 | } |
127 | 129 | if ($packagetype) { |
128 | 130 | $lcasetype = strtolower($packagetype); |
129 | - if ($lcasetype == 'layout') |
|
130 | - return true; |
|
131 | + if ($lcasetype == 'layout') { |
|
132 | + return true; |
|
133 | + } |
|
131 | 134 | } |
132 | 135 | return false; |
133 | 136 | } |
@@ -146,8 +149,9 @@ discard block |
||
146 | 149 | |
147 | 150 | if ($packagetype) { |
148 | 151 | $lcasetype = strtolower($packagetype); |
149 | - if ($lcasetype == 'extension') |
|
150 | - return true; |
|
152 | + if ($lcasetype == 'extension') { |
|
153 | + return true; |
|
154 | + } |
|
151 | 155 | } |
152 | 156 | return false; |
153 | 157 | } |
@@ -163,8 +167,9 @@ discard block |
||
163 | 167 | |
164 | 168 | if ($packagetype) { |
165 | 169 | $lcasetype = strtolower($packagetype); |
166 | - if ($lcasetype == 'update') |
|
167 | - return true; |
|
170 | + if ($lcasetype == 'update') { |
|
171 | + return true; |
|
172 | + } |
|
168 | 173 | } |
169 | 174 | return false; |
170 | 175 | } |
@@ -183,8 +188,9 @@ discard block |
||
183 | 188 | |
184 | 189 | if ($packagetype) { |
185 | 190 | $lcasetype = strtolower($packagetype); |
186 | - if ($lcasetype == 'layout') |
|
187 | - return true; |
|
191 | + if ($lcasetype == 'layout') { |
|
192 | + return true; |
|
193 | + } |
|
188 | 194 | } |
189 | 195 | return false; |
190 | 196 | } |
@@ -227,8 +233,9 @@ discard block |
||
227 | 233 | public function getParameters() |
228 | 234 | { |
229 | 235 | $parameters = []; |
230 | - if (empty($this->_modulexml->parameters)) |
|
231 | - return $parameters; |
|
236 | + if (empty($this->_modulexml->parameters)) { |
|
237 | + return $parameters; |
|
238 | + } |
|
232 | 239 | foreach ($this->_modulexml->parameters->parameter as $parameter) { |
233 | 240 | $parameters[] = $parameter; |
234 | 241 | } |
@@ -338,17 +345,21 @@ discard block |
||
338 | 345 | } |
339 | 346 | |
340 | 347 | $validzip = false; |
341 | - if ($manifestxml_found && $languagefile_found && $moduleVersionFound) |
|
342 | - $validzip = true; |
|
348 | + if ($manifestxml_found && $languagefile_found && $moduleVersionFound) { |
|
349 | + $validzip = true; |
|
350 | + } |
|
343 | 351 | |
344 | - if ($manifestxml_found && $layoutfile_found && $moduleVersionFound) |
|
345 | - $validzip = true; |
|
352 | + if ($manifestxml_found && $layoutfile_found && $moduleVersionFound) { |
|
353 | + $validzip = true; |
|
354 | + } |
|
346 | 355 | |
347 | - if ($manifestxml_found && $languagefile_found && $extensionfile_found && $moduleVersionFound) |
|
348 | - $validzip = true; |
|
356 | + if ($manifestxml_found && $languagefile_found && $extensionfile_found && $moduleVersionFound) { |
|
357 | + $validzip = true; |
|
358 | + } |
|
349 | 359 | |
350 | - if ($manifestxml_found && $updatefile_found && $moduleVersionFound) |
|
351 | - $validzip = true; |
|
360 | + if ($manifestxml_found && $updatefile_found && $moduleVersionFound) { |
|
361 | + $validzip = true; |
|
362 | + } |
|
352 | 363 | |
353 | 364 | if ($validzip) { |
354 | 365 | if (!empty($this->_modulexml->license)) { |
@@ -365,8 +376,9 @@ discard block |
||
365 | 376 | } |
366 | 377 | } |
367 | 378 | } |
368 | - if ($unzip) |
|
369 | - $unzip->close(); |
|
379 | + if ($unzip) { |
|
380 | + $unzip->close(); |
|
381 | + } |
|
370 | 382 | return $validzip; |
371 | 383 | } |
372 | 384 | |
@@ -376,8 +388,9 @@ discard block |
||
376 | 388 | */ |
377 | 389 | public function getModuleNameFromZip($zipfile) |
378 | 390 | { |
379 | - if (!$this->checkZip($zipfile)) |
|
380 | - return null; |
|
391 | + if (!$this->checkZip($zipfile)) { |
|
392 | + return null; |
|
393 | + } |
|
381 | 394 | return (string) $this->_modulexml->name; |
382 | 395 | } |
383 | 396 | |
@@ -453,8 +466,9 @@ discard block |
||
453 | 466 | $unzip->unzip("$module.png", 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . "/skins/images/$module.png"); |
454 | 467 | } |
455 | 468 | |
456 | - if ($unzip) |
|
457 | - $unzip->close(); |
|
469 | + if ($unzip) { |
|
470 | + $unzip->close(); |
|
471 | + } |
|
458 | 472 | } |
459 | 473 | return $module; |
460 | 474 | } |
@@ -642,8 +656,9 @@ discard block |
||
642 | 656 | */ |
643 | 657 | public function import_Tables($modulenode) |
644 | 658 | { |
645 | - if (empty($modulenode->tables) || empty($modulenode->tables->table)) |
|
646 | - return; |
|
659 | + if (empty($modulenode->tables) || empty($modulenode->tables->table)) { |
|
660 | + return; |
|
661 | + } |
|
647 | 662 | $adb = \PearDatabase::getInstance(); |
648 | 663 | $adb->query('SET FOREIGN_KEY_CHECKS = 0;'); |
649 | 664 | |
@@ -677,8 +692,9 @@ discard block |
||
677 | 692 | */ |
678 | 693 | public function import_Blocks($modulenode, $moduleInstance) |
679 | 694 | { |
680 | - if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) |
|
681 | - return; |
|
695 | + if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) { |
|
696 | + return; |
|
697 | + } |
|
682 | 698 | foreach ($modulenode->blocks->block as $blocknode) { |
683 | 699 | $blockInstance = $this->import_Block($modulenode, $moduleInstance, $blocknode); |
684 | 700 | $this->import_Fields($blocknode, $blockInstance, $moduleInstance); |
@@ -697,8 +713,9 @@ discard block |
||
697 | 713 | $blockInstance->label = $blocklabel; |
698 | 714 | if (isset($blocknode->sequence) && isset($blocknode->display_status)) { |
699 | 715 | $blockInstance->sequence = strval($blocknode->sequence); |
700 | - if ($blockInstance->sequence = "") |
|
701 | - $blockInstance->sequence = NULL; |
|
716 | + if ($blockInstance->sequence = "") { |
|
717 | + $blockInstance->sequence = NULL; |
|
718 | + } |
|
702 | 719 | $blockInstance->showtitle = strval($blocknode->show_title); |
703 | 720 | $blockInstance->visible = strval($blocknode->visible); |
704 | 721 | $blockInstance->increateview = strval($blocknode->create_view); |
@@ -720,8 +737,9 @@ discard block |
||
720 | 737 | */ |
721 | 738 | public function import_Fields($blocknode, $blockInstance, $moduleInstance) |
722 | 739 | { |
723 | - if (empty($blocknode->fields) || empty($blocknode->fields->field)) |
|
724 | - return; |
|
740 | + if (empty($blocknode->fields) || empty($blocknode->fields->field)) { |
|
741 | + return; |
|
742 | + } |
|
725 | 743 | |
726 | 744 | foreach ($blocknode->fields->field as $fieldnode) { |
727 | 745 | $fieldInstance = $this->import_Field($blocknode, $blockInstance, $moduleInstance, $fieldnode); |
@@ -752,17 +770,21 @@ discard block |
||
752 | 770 | $fieldInstance->displaytype = $fieldnode->displaytype; |
753 | 771 | $fieldInstance->info_type = $fieldnode->info_type; |
754 | 772 | |
755 | - if (!empty($fieldnode->fieldparams)) |
|
756 | - $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
773 | + if (!empty($fieldnode->fieldparams)) { |
|
774 | + $fieldInstance->fieldparams = $fieldnode->fieldparams; |
|
775 | + } |
|
757 | 776 | |
758 | - if (!empty($fieldnode->helpinfo)) |
|
759 | - $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
777 | + if (!empty($fieldnode->helpinfo)) { |
|
778 | + $fieldInstance->helpinfo = $fieldnode->helpinfo; |
|
779 | + } |
|
760 | 780 | |
761 | - if (isset($fieldnode->masseditable)) |
|
762 | - $fieldInstance->masseditable = $fieldnode->masseditable; |
|
781 | + if (isset($fieldnode->masseditable)) { |
|
782 | + $fieldInstance->masseditable = $fieldnode->masseditable; |
|
783 | + } |
|
763 | 784 | |
764 | - if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) |
|
765 | - $fieldInstance->columntype = strval($fieldnode->columntype); |
|
785 | + if (isset($fieldnode->columntype) && !empty($fieldnode->columntype)) { |
|
786 | + $fieldInstance->columntype = strval($fieldnode->columntype); |
|
787 | + } |
|
766 | 788 | |
767 | 789 | if (!empty($fieldnode->tree_template)) { |
768 | 790 | $templateid = $fieldInstance->setTreeTemplate($fieldnode->tree_template, $moduleInstance); |
@@ -810,8 +832,9 @@ discard block |
||
810 | 832 | */ |
811 | 833 | public function import_CustomViews($modulenode, $moduleInstance) |
812 | 834 | { |
813 | - if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) |
|
814 | - return; |
|
835 | + if (empty($modulenode->customviews) || empty($modulenode->customviews->customview)) { |
|
836 | + return; |
|
837 | + } |
|
815 | 838 | foreach ($modulenode->customviews->customview as $customviewnode) { |
816 | 839 | $this->import_CustomView($modulenode, $moduleInstance, $customviewnode); |
817 | 840 | } |
@@ -854,8 +877,9 @@ discard block |
||
854 | 877 | */ |
855 | 878 | public function import_SharingAccess($modulenode, $moduleInstance) |
856 | 879 | { |
857 | - if (empty($modulenode->sharingaccess)) |
|
858 | - return; |
|
880 | + if (empty($modulenode->sharingaccess)) { |
|
881 | + return; |
|
882 | + } |
|
859 | 883 | |
860 | 884 | if (!empty($modulenode->sharingaccess->default)) { |
861 | 885 | foreach ($modulenode->sharingaccess->default as $defaultnode) { |
@@ -885,8 +909,9 @@ discard block |
||
885 | 909 | */ |
886 | 910 | public function import_Actions($modulenode, $moduleInstance) |
887 | 911 | { |
888 | - if (empty($modulenode->actions) || empty($modulenode->actions->action)) |
|
889 | - return; |
|
912 | + if (empty($modulenode->actions) || empty($modulenode->actions->action)) { |
|
913 | + return; |
|
914 | + } |
|
890 | 915 | foreach ($modulenode->actions->action as $actionnode) { |
891 | 916 | $this->import_Action($modulenode, $moduleInstance, $actionnode); |
892 | 917 | } |
@@ -899,10 +924,11 @@ discard block |
||
899 | 924 | public function import_Action($modulenode, $moduleInstance, $actionnode) |
900 | 925 | { |
901 | 926 | $actionstatus = $actionnode->status; |
902 | - if ($actionstatus == 'enabled') |
|
903 | - $moduleInstance->enableTools($actionnode->name); |
|
904 | - else |
|
905 | - $moduleInstance->disableTools($actionnode->name); |
|
927 | + if ($actionstatus == 'enabled') { |
|
928 | + $moduleInstance->enableTools($actionnode->name); |
|
929 | + } else { |
|
930 | + $moduleInstance->disableTools($actionnode->name); |
|
931 | + } |
|
906 | 932 | } |
907 | 933 | |
908 | 934 | /** |
@@ -967,8 +993,9 @@ discard block |
||
967 | 993 | */ |
968 | 994 | public function import_CustomLinks($modulenode, $moduleInstance) |
969 | 995 | { |
970 | - if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) |
|
971 | - return; |
|
996 | + if (empty($modulenode->customlinks) || empty($modulenode->customlinks->customlink)) { |
|
997 | + return; |
|
998 | + } |
|
972 | 999 | |
973 | 1000 | foreach ($modulenode->customlinks->customlink as $customlinknode) { |
974 | 1001 | $handlerInfo = null; |
@@ -990,8 +1017,9 @@ discard block |
||
990 | 1017 | */ |
991 | 1018 | public function import_CronTasks($modulenode) |
992 | 1019 | { |
993 | - if (empty($modulenode->crons) || empty($modulenode->crons->cron)) |
|
994 | - return; |
|
1020 | + if (empty($modulenode->crons) || empty($modulenode->crons->cron)) { |
|
1021 | + return; |
|
1022 | + } |
|
995 | 1023 | foreach ($modulenode->crons->cron as $cronTask) { |
996 | 1024 | if (empty($cronTask->status)) { |
997 | 1025 | $cronTask->status = Cron::$STATUS_DISABLED; |
@@ -1052,8 +1080,9 @@ discard block |
||
1052 | 1080 | */ |
1053 | 1081 | public function importInventory() |
1054 | 1082 | { |
1055 | - if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) |
|
1056 | - return false; |
|
1083 | + if (empty($this->_modulexml->inventory) || empty($this->_modulexml->inventory->fields->field)) { |
|
1084 | + return false; |
|
1085 | + } |
|
1057 | 1086 | $module = (string) $this->moduleInstance->name; |
1058 | 1087 | |
1059 | 1088 | $inventoryInstance = \Vtiger_Inventory_Model::getInstance($module); |
@@ -28,6 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * Initialize Import |
30 | 30 | * @access private |
31 | + * @param boolean $overwrite |
|
31 | 32 | */ |
32 | 33 | public function initImport($zipfile, $overwrite) |
33 | 34 | { |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | foreach ($filelist as $filename => $fileinfo) { |
85 | 85 | if (!$unzip->isdir($filename)) { |
86 | 86 | |
87 | - if (strpos($filename, '/') === false) |
|
88 | - continue; |
|
87 | + if (strpos($filename, '/') === false) { |
|
88 | + continue; |
|
89 | + } |
|
89 | 90 | |
90 | 91 | $targetdir = substr($filename, 0, strripos($filename, '/')); |
91 | 92 | $targetfile = basename($filename); |
@@ -146,8 +147,9 @@ discard block |
||
146 | 147 | } |
147 | 148 | } |
148 | 149 | } |
149 | - if ($unzip) |
|
150 | - $unzip->close(); |
|
150 | + if ($unzip) { |
|
151 | + $unzip->close(); |
|
152 | + } |
|
151 | 153 | |
152 | 154 | self::register($prefix, $label, $name); |
153 | 155 |
@@ -112,6 +112,7 @@ |
||
112 | 112 | /** |
113 | 113 | * Clean up the input to be used as a regex |
114 | 114 | * @access private |
115 | + * @param string $value |
|
115 | 116 | */ |
116 | 117 | public function __formatAsRegex($value) |
117 | 118 | { |
@@ -70,8 +70,9 @@ discard block |
||
70 | 70 | unset($this->tplvars); |
71 | 71 | |
72 | 72 | $this->tplvars = []; |
73 | - foreach ($restorevars as $key => $val) |
|
74 | - $this->assign($key, $val); |
|
73 | + foreach ($restorevars as $key => $val) { |
|
74 | + $this->assign($key, $val); |
|
75 | + } |
|
75 | 76 | } |
76 | 77 | |
77 | 78 | /** |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | */ |
83 | 84 | public function merge($instring, $avoidLookup = false) |
84 | 85 | { |
85 | - if (empty($instring)) |
|
86 | - return $instring; |
|
86 | + if (empty($instring)) { |
|
87 | + return $instring; |
|
88 | + } |
|
87 | 89 | |
88 | 90 | if (!$avoidLookup) { |
89 | 91 |
@@ -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); |
@@ -98,7 +98,6 @@ |
||
98 | 98 | * @param string $pubkey A public key for reCAPTCHA |
99 | 99 | * @param string $error The error given by reCAPTCHA (optional, default is null) |
100 | 100 | * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) |
101 | - |
|
102 | 101 | * @return string - The HTML to be embedded in the user's form. |
103 | 102 | */ |
104 | 103 | function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) |
@@ -77,7 +77,7 @@ |
||
77 | 77 | $http_request .= $req; |
78 | 78 | |
79 | 79 | $response = ''; |
80 | - if (false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) )) { |
|
80 | + if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { |
|
81 | 81 | die('Could not open socket'); |
82 | 82 | } |
83 | 83 |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | function _recaptcha_qsencode($data) |
48 | 48 | { |
49 | 49 | $req = ""; |
50 | - foreach ($data as $key => $value) |
|
51 | - $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
50 | + foreach ($data as $key => $value) { |
|
51 | + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | // Cut the last '&' |
54 | 55 | $req = substr($req, 0, strlen($req) - 1); |
@@ -83,8 +84,10 @@ discard block |
||
83 | 84 | |
84 | 85 | fwrite($fs, $http_request); |
85 | 86 | |
86 | - while (!feof($fs)) |
|
87 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
87 | + while (!feof($fs)) { |
|
88 | + $response .= fgets($fs, 1160); |
|
89 | + } |
|
90 | + // One TCP-IP packet |
|
88 | 91 | fclose($fs); |
89 | 92 | $response = explode("\r\n\r\n", $response, 2); |
90 | 93 |
@@ -206,6 +206,9 @@ discard block |
||
206 | 206 | } |
207 | 207 | /* Mailhide related code */ |
208 | 208 | |
209 | +/** |
|
210 | + * @param string $ky |
|
211 | + */ |
|
209 | 212 | function _recaptcha_aes_encrypt($val, $ky) |
210 | 213 | { |
211 | 214 | if (!function_exists("mcrypt_encrypt")) { |
@@ -217,6 +220,9 @@ discard block |
||
217 | 220 | return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); |
218 | 221 | } |
219 | 222 | |
223 | +/** |
|
224 | + * @param string $x |
|
225 | + */ |
|
220 | 226 | function _recaptcha_mailhide_urlbase64($x) |
221 | 227 | { |
222 | 228 | return strtr(base64_encode($x), '+/', '-_'); |
@@ -124,8 +124,9 @@ |
||
124 | 124 | $secondFallBackModuleDir = $secondFallBackModuleClassPath = $actualModule; |
125 | 125 | if ($actualModule != 'Users') { |
126 | 126 | $baseModule = $moduleHierarchyParts[0]; |
127 | - if ($baseModule == 'Settings') |
|
128 | - $baseModule = 'Settings:Vtiger'; |
|
127 | + if ($baseModule == 'Settings') { |
|
128 | + $baseModule = 'Settings:Vtiger'; |
|
129 | + } |
|
129 | 130 | $firstFallBackDir = str_replace(':', '.', $baseModule); |
130 | 131 | $firstFallBackClassPath = str_replace(':', '_', $baseModule); |
131 | 132 | } |