Passed
Push — scrutinizer-code-quality ( 27193c...09f5a1 )
by Adam
51:28
created
modules/Project/metadata/quickcreatedefs.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,34 +40,34 @@
 block discarded – undo
40 40
 
41 41
 
42 42
 $viewdefs['Project']['QuickCreate'] = array(
43
-					'templateMeta' => array('maxColumns' => '2', 
43
+                    'templateMeta' => array('maxColumns' => '2', 
44 44
                         'widths' => array(
45 45
                                         array('label' => '10', 'field' => '30'), 
46 46
                                         array('label' => '10', 'field' => '30')
47 47
                                         ),
48
-                       ),
48
+                        ),
49 49
 'panels' =>
50 50
 
51 51
 array (
52 52
   
53
-  array (
53
+    array (
54 54
     'name',
55 55
     'status'
56
-  ),
56
+    ),
57 57
   
58
-  array (
58
+    array (
59 59
     'estimated_start_date',
60 60
     'estimated_end_date'
61
-  ),
61
+    ),
62 62
   
63
-  array('priority',),
64
-  array('assigned_user_name',
65
-  ),
66
-  array (
63
+    array('priority',),
64
+    array('assigned_user_name',
65
+    ),
66
+    array (
67 67
     array (
68
-      'name' => 'description',
68
+        'name' => 'description',
69
+    ),
69 70
     ),
70
-  ),
71 71
 
72 72
 ),
73 73
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
                        ),
49 49
 'panels' =>
50 50
 
51
-array (
51
+array(
52 52
   
53
-  array (
53
+  array(
54 54
     'name',
55 55
     'status'
56 56
   ),
57 57
   
58
-  array (
58
+  array(
59 59
     'estimated_start_date',
60 60
     'estimated_end_date'
61 61
   ),
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
   array('priority',),
64 64
   array('assigned_user_name',
65 65
   ),
66
-  array (
67
-    array (
66
+  array(
67
+    array(
68 68
       'name' => 'description',
69 69
     ),
70 70
   ),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Project/metadata/metafiles.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@
 block discarded – undo
38 38
  ********************************************************************************/
39 39
 
40 40
 
41
- $metafiles['Project'] = array(
42
-	'detailviewdefs'  => 	'modules/Project/metadata/detailviewdefs.php', 	
43
-	'editviewdefs'    => 	'modules/Project/metadata/editviewdefs.php',
44
- 	'listviewdefs'    => 	'modules/Project/metadata/listviewdefs.php',
45
- 	'searchdefs'      =>    'modules/Project/metadata/searchdefs.php',
46
- 	'popupdefs'	      =>    'modules/Project/metadata/popupdefs.php',
47
- 	'searchfields'	  =>    'modules/Project/metadata/SearchFields.php',
41
+    $metafiles['Project'] = array(
42
+    'detailviewdefs'  => 	'modules/Project/metadata/detailviewdefs.php', 	
43
+    'editviewdefs'    => 	'modules/Project/metadata/editviewdefs.php',
44
+        'listviewdefs'    => 	'modules/Project/metadata/listviewdefs.php',
45
+        'searchdefs'      =>    'modules/Project/metadata/searchdefs.php',
46
+        'popupdefs'	      =>    'modules/Project/metadata/popupdefs.php',
47
+        'searchfields'	  =>    'modules/Project/metadata/SearchFields.php',
48 48
 
49
- );
49
+    );
50 50
 ?>
Please login to merge, or discard this patch.
modules/Project/metadata/listviewdefs.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,48 +43,48 @@
 block discarded – undo
43 43
 
44 44
 $listViewDefs ['Project'] =
45 45
 array (
46
-  'NAME' => 
47
-  array (
46
+    'NAME' => 
47
+    array (
48 48
     'width' => '25%',
49 49
     'label' => 'LBL_LIST_NAME',
50 50
     'link' => true,
51 51
     'default' => true,
52
-  ),
53
-  'PRIORITY' => 
54
-  array (
52
+    ),
53
+    'PRIORITY' => 
54
+    array (
55 55
     'type' => 'enum',
56 56
     'label' => 'LBL_PRIORITY',
57 57
     'width' => '10%',
58 58
     'default' => true,
59
-  ),
60
-  'STATUS' => 
61
-  array (
59
+    ),
60
+    'STATUS' => 
61
+    array (
62 62
     'width' => '10%',
63 63
     'label' => 'LBL_STATUS',
64 64
     'link' => false,
65 65
     'default' => true,
66
-  ),
67
-  'ESTIMATED_START_DATE' => 
68
-  array (
66
+    ),
67
+    'ESTIMATED_START_DATE' => 
68
+    array (
69 69
     'width' => '10%',
70 70
     'label' => 'LBL_DATE_START',
71 71
     'link' => false,
72 72
     'default' => true,
73
-  ),
74
-  'ASSIGNED_USER_NAME' => 
75
-  array (
73
+    ),
74
+    'ASSIGNED_USER_NAME' => 
75
+    array (
76 76
     'width' => '10%',
77 77
     'label' => 'LBL_LIST_ASSIGNED_USER_ID',
78 78
     'module' => 'Employees',
79 79
     'id' => 'ASSIGNED_USER_ID',
80 80
     'default' => true,
81
-  ),
82
-  'ESTIMATED_END_DATE' => 
83
-  array (
81
+    ),
82
+    'ESTIMATED_END_DATE' => 
83
+    array (
84 84
     'width' => '10%',
85 85
     'label' => 'LBL_DATE_END',
86 86
     'link' => false,
87 87
     'default' => true,
88
-  ),
88
+    ),
89 89
 );
90 90
 ?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,37 +42,37 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 $listViewDefs ['Project'] =
45
-array (
45
+array(
46 46
   'NAME' => 
47
-  array (
47
+  array(
48 48
     'width' => '25%',
49 49
     'label' => 'LBL_LIST_NAME',
50 50
     'link' => true,
51 51
     'default' => true,
52 52
   ),
53 53
   'PRIORITY' => 
54
-  array (
54
+  array(
55 55
     'type' => 'enum',
56 56
     'label' => 'LBL_PRIORITY',
57 57
     'width' => '10%',
58 58
     'default' => true,
59 59
   ),
60 60
   'STATUS' => 
61
-  array (
61
+  array(
62 62
     'width' => '10%',
63 63
     'label' => 'LBL_STATUS',
64 64
     'link' => false,
65 65
     'default' => true,
66 66
   ),
67 67
   'ESTIMATED_START_DATE' => 
68
-  array (
68
+  array(
69 69
     'width' => '10%',
70 70
     'label' => 'LBL_DATE_START',
71 71
     'link' => false,
72 72
     'default' => true,
73 73
   ),
74 74
   'ASSIGNED_USER_NAME' => 
75
-  array (
75
+  array(
76 76
     'width' => '10%',
77 77
     'label' => 'LBL_LIST_ASSIGNED_USER_ID',
78 78
     'module' => 'Employees',
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     'default' => true,
81 81
   ),
82 82
   'ESTIMATED_END_DATE' => 
83
-  array (
83
+  array(
84 84
     'width' => '10%',
85 85
     'label' => 'LBL_DATE_END',
86 86
     'link' => false,
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/SugarFeed/Dashlets/SugarFeedDashlet/SugarFeedDashlet.meta.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@
 block discarded – undo
49 49
 global $app_strings;
50 50
 
51 51
 $dashletMeta['SugarFeedDashlet'] = array('module'		=> 'SugarFeed',
52
-										  'title'       => translate('LBL_HOMEPAGE_TITLE', 'SugarFeed'), 
53
-                                          'description' => 'A customizable view into Sugar_Feed',
54
-                                          'icon'        => 'themes/default/images/icon_SugarFeed_32.gif',
55
-                                          'dynamic_hide' => true,
56
-                                          'category'    => 'Tools');
57 52
\ No newline at end of file
53
+                                            'title'       => translate('LBL_HOMEPAGE_TITLE', 'SugarFeed'), 
54
+                                            'description' => 'A customizable view into Sugar_Feed',
55
+                                            'icon'        => 'themes/default/images/icon_SugarFeed_32.gif',
56
+                                            'dynamic_hide' => true,
57
+                                            'category'    => 'Tools');
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/SugarFeed/Dashlets/SugarFeedDashlet/SugarFeedDashlet.php 4 patches
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 
54 54
 
55 55
     function SugarFeedDashlet($id, $def = null) {
56
-		global $current_user, $app_strings, $app_list_strings;
56
+        global $current_user, $app_strings, $app_list_strings;
57 57
 
58
-		require_once('modules/SugarFeed/metadata/dashletviewdefs.php');
59
-		$this->myItemsOnly = false;
58
+        require_once('modules/SugarFeed/metadata/dashletviewdefs.php');
59
+        $this->myItemsOnly = false;
60 60
         parent::DashletGeneric($id, $def);
61
-		$this->myItemsOnly = false;
62
-		$this->isConfigurable = true;
63
-		$this->hasScript = true;
64
-		$pattern = array();
65
-		$pattern[] = "/-/";
66
-		$pattern[] = "/[0-9]/";
67
-		$replacements = array();
68
-		$replacements[] = '';
69
-		$replacements[] = '';
70
-		$this->idjs = preg_replace($pattern,$replacements,$this->id);
61
+        $this->myItemsOnly = false;
62
+        $this->isConfigurable = true;
63
+        $this->hasScript = true;
64
+        $pattern = array();
65
+        $pattern[] = "/-/";
66
+        $pattern[] = "/[0-9]/";
67
+        $replacements = array();
68
+        $replacements[] = '';
69
+        $replacements[] = '';
70
+        $this->idjs = preg_replace($pattern,$replacements,$this->id);
71 71
         // Add in some default categories.
72 72
         $this->categories['ALL'] = translate('LBL_ALL','SugarFeed');
73 73
         // Need to get the rest of the active SugarFeed modules
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 
94 94
 
95 95
         if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
96
-		if(!empty($def['rows']))$this->displayRows = $def['rows'];
97
-		if(!empty($def['categories']))$this->selectedCategories = $def['categories'];
98
-		if(!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created'];
96
+        if(!empty($def['rows']))$this->displayRows = $def['rows'];
97
+        if(!empty($def['categories']))$this->selectedCategories = $def['categories'];
98
+        if(!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created'];
99 99
         $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields'];
100 100
         $this->columns = $dashletData['SugarFeedDashlet']['columns'];
101 101
 
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
             $this->categories["Twitter"] = "Twitter";
111 111
         }
112 112
 
113
-		$catCount = count($this->categories);
114
-		ACLController::filterModuleList($this->categories, false);
115
-		if(count($this->categories) < $catCount){
116
-			if(!empty($this->selectedCategories)){
117
-				ACLController::filterModuleList($this->selectedCategories, true);
118
-			}else{
119
-				$this->selectedCategories = array_keys($this->categories);
120
-				unset($this->selectedCategories[0]);
121
-			}
122
-		}
113
+        $catCount = count($this->categories);
114
+        ACLController::filterModuleList($this->categories, false);
115
+        if(count($this->categories) < $catCount){
116
+            if(!empty($this->selectedCategories)){
117
+                ACLController::filterModuleList($this->selectedCategories, true);
118
+            }else{
119
+                $this->selectedCategories = array_keys($this->categories);
120
+                unset($this->selectedCategories[0]);
121
+            }
122
+        }
123 123
         $this->seedBean = new SugarFeed();
124 124
     }
125 125
 
126
-	function process($lvsParams = array()) {
126
+    function process($lvsParams = array()) {
127 127
         global $current_user;
128 128
 
129 129
         $currentSearchFields = array();
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         $this->lvs->export = false;
141 141
         $this->lvs->multiSelect = false;
142
-		$this->lvs->quickViewLinks = false;
142
+        $this->lvs->quickViewLinks = false;
143 143
         // columns
144 144
     foreach($this->columns as $name => $val) {
145 145
                 if(!empty($val['default']) && $val['default']) {
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
         $owner_modules = array();
171 171
         $regular_modules = array();
172 172
         foreach($mod_list as $module => $ignore) {
173
-			// Handle the UserFeed differently
174
-			if ( $module == 'UserFeed') {
175
-				$regular_modules[] = 'UserFeed';
176
-				continue;
177
-			}
173
+            // Handle the UserFeed differently
174
+            if ( $module == 'UserFeed') {
175
+                $regular_modules[] = 'UserFeed';
176
+                continue;
177
+            }
178 178
             if($module == 'Facebook'){
179 179
                 $regular_modules[] = "Facebook";
180 180
                 continue;
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
             if ( in_array($module,$this->externalAPIList) ) {
188 188
                 $external_modules[] = $module;
189 189
             }
190
-			if (ACLAction::getUserAccessLevel($current_user->id,$module,'view') <= ACL_ALLOW_NONE ) {
191
-				// Not enough access to view any records, don't add it to any lists
192
-				continue;
193
-			}
194
-			if ( ACLAction::getUserAccessLevel($current_user->id,$module,'view') == ACL_ALLOW_OWNER ) {
195
-				$owner_modules[] = $module;
190
+            if (ACLAction::getUserAccessLevel($current_user->id,$module,'view') <= ACL_ALLOW_NONE ) {
191
+                // Not enough access to view any records, don't add it to any lists
192
+                continue;
193
+            }
194
+            if ( ACLAction::getUserAccessLevel($current_user->id,$module,'view') == ACL_ALLOW_OWNER ) {
195
+                $owner_modules[] = $module;
196 196
             } else {
197 197
                 $regular_modules[] = $module;
198 198
             }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
         if(!empty($this->displayTpl))
205 205
         {
206
-        	//MFH BUG #14296
206
+            //MFH BUG #14296
207 207
             $where = '';
208 208
             if(!empty($whereArray)){
209 209
                 $where = '(' . implode(') AND (', $whereArray) . ')';
@@ -213,35 +213,35 @@  discard block
 block discarded – undo
213 213
             $additional_where = '';
214 214
 
215 215
 
216
-			$module_limiter = " sugarfeed.related_module in ('" . implode("','", $regular_modules) . "')";
216
+            $module_limiter = " sugarfeed.related_module in ('" . implode("','", $regular_modules) . "')";
217 217
 
218
-			if( is_admin($GLOBALS['current_user'] ) )
218
+            if( is_admin($GLOBALS['current_user'] ) )
219 219
             {
220 220
                 $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules);
221 221
                 $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')";
222 222
             }
223 223
             else if ( count($owner_modules) > 0
224
-				) {
224
+                ) {
225 225
                 $module_limiter = " ((sugarfeed.related_module IN ('".implode("','", $regular_modules)."') "
226
-					.") ";
227
-				if ( count($owner_modules) > 0 ) {
228
-					$module_limiter .= "OR (sugarfeed.related_module IN('".implode("','", $owner_modules)."') AND sugarfeed.assigned_user_id = '".$current_user->id."' "
229
-						.") ";
230
-				}
231
-				$module_limiter .= ")";
226
+                    .") ";
227
+                if ( count($owner_modules) > 0 ) {
228
+                    $module_limiter .= "OR (sugarfeed.related_module IN('".implode("','", $owner_modules)."') AND sugarfeed.assigned_user_id = '".$current_user->id."' "
229
+                        .") ";
230
+                }
231
+                $module_limiter .= ")";
232 232
             }
233
-			if(!empty($where)) { $where .= ' AND '; }
233
+            if(!empty($where)) { $where .= ' AND '; }
234 234
 
235 235
 
236
-			$where .= $module_limiter;
236
+            $where .= $module_limiter;
237 237
 
238 238
             $this->lvs->setup($this->seedBean, $this->displayTpl, $where , $lvsParams, 0, $this->displayRows,
239
-                              array('name',
239
+                                array('name',
240 240
                                     'description',
241 241
                                     'date_entered',
242 242
                                     'created_by',
243 243
                                     /* BEGIN - SECURITY GROUPS */
244
-									//related_module now included but keep this here just in case
244
+                                    //related_module now included but keep this here just in case
245 245
                                     'related_module', 
246 246
                                     'related_id', 
247 247
                                     /* END - SECURITY GROUPS */
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
             // assign a baseURL w/ the action set as DisplayDashlet
279 279
             foreach($this->lvs->data['pageData']['urls'] as $type => $url) {
280
-            	// awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
280
+                // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
281 281
                 $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet';
282 282
                 if($type != 'orderBy')
283 283
                     $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id;
@@ -335,58 +335,58 @@  discard block
 block discarded – undo
335 335
         $this->lvs->data['data'] = $resortQueue;
336 336
     }
337 337
 
338
-	  function deleteUserFeed() {
339
-    	if(!empty($_REQUEST['record'])) {
340
-			$feed = new SugarFeed();
341
-			$feed->retrieve($_REQUEST['record']);
342
-			if(is_admin($GLOBALS['current_user']) || $feed->created_by == $GLOBALS['current_user']->id){
343
-            	$feed->mark_deleted($_REQUEST['record']);
338
+        function deleteUserFeed() {
339
+        if(!empty($_REQUEST['record'])) {
340
+            $feed = new SugarFeed();
341
+            $feed->retrieve($_REQUEST['record']);
342
+            if(is_admin($GLOBALS['current_user']) || $feed->created_by == $GLOBALS['current_user']->id){
343
+                $feed->mark_deleted($_REQUEST['record']);
344 344
 
345
-			}
345
+            }
346 346
         }
347 347
     }
348
-	 function pushUserFeed() {
349
-    	if(!empty($_REQUEST['text']) || (!empty($_REQUEST['link_url']) && !empty($_REQUEST['link_type']))) {
350
-			$text = htmlspecialchars($_REQUEST['text']);
351
-			//allow for bold and italic user tags
352
-			$text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i','<$1>', $text);
348
+        function pushUserFeed() {
349
+        if(!empty($_REQUEST['text']) || (!empty($_REQUEST['link_url']) && !empty($_REQUEST['link_type']))) {
350
+            $text = htmlspecialchars($_REQUEST['text']);
351
+            //allow for bold and italic user tags
352
+            $text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i','<$1>', $text);
353 353
             SugarFeed::pushFeed($text, 'UserFeed', $GLOBALS['current_user']->id,
354
-								$GLOBALS['current_user']->id,
354
+                                $GLOBALS['current_user']->id,
355 355
                                 $_REQUEST['link_type'], $_REQUEST['link_url']
356 356
                                 );
357 357
         }
358 358
 
359 359
     }
360 360
 
361
-	 function pushUserFeedReply( ) {
362
-         if(!empty($_REQUEST['text'])&&!empty($_REQUEST['parentFeed'])) {
363
-			$text = htmlspecialchars($_REQUEST['text']);
364
-			//allow for bold and italic user tags
365
-			$text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i','<$1>', $text);
361
+        function pushUserFeedReply( ) {
362
+            if(!empty($_REQUEST['text'])&&!empty($_REQUEST['parentFeed'])) {
363
+            $text = htmlspecialchars($_REQUEST['text']);
364
+            //allow for bold and italic user tags
365
+            $text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i','<$1>', $text);
366 366
             SugarFeed::pushFeed($text, 'SugarFeed', $_REQUEST['parentFeed'],
367
-								$GLOBALS['current_user']->id,
367
+                                $GLOBALS['current_user']->id,
368 368
                                 '', ''
369 369
                                 );
370 370
         }
371 371
 
372 372
     }
373 373
 
374
-	  function displayOptions() {
374
+        function displayOptions() {
375 375
         global $app_strings;
376 376
         global $app_list_strings;
377 377
         $ss = new Sugar_Smarty();
378 378
         $ss->assign('titleLBL', translate('LBL_TITLE', 'SugarFeed'));
379
-		$ss->assign('categoriesLBL', translate('LBL_CATEGORIES', 'SugarFeed'));
380
-		$ss->assign('autenticationPendingLBL', translate('LBL_AUTHENTICATION_PENDING', 'SugarFeed'));
379
+        $ss->assign('categoriesLBL', translate('LBL_CATEGORIES', 'SugarFeed'));
380
+        $ss->assign('autenticationPendingLBL', translate('LBL_AUTHENTICATION_PENDING', 'SugarFeed'));
381 381
         $ss->assign('rowsLBL', translate('LBL_ROWS', 'SugarFeed'));
382 382
         $ss->assign('saveLBL', $app_strings['LBL_SAVE_BUTTON_LABEL']);
383 383
         $ss->assign('clearLBL', $app_strings['LBL_CLEAR_BUTTON_LABEL']);
384 384
         $ss->assign('title', $this->title);
385
-		$ss->assign('categories', $this->categories);
385
+        $ss->assign('categories', $this->categories);
386 386
         if ( empty($this->selectedCategories) ) {
387 387
             $this->selectedCategories['ALL'] = 'ALL';
388 388
         }
389
-		$ss->assign('selectedCategories', $this->selectedCategories);
389
+        $ss->assign('selectedCategories', $this->selectedCategories);
390 390
         $ss->assign('rows', $this->displayRows);
391 391
         $externalApis = array();
392 392
         foreach ( $this->externalAPIList as $apiObj => $apiName ) {
@@ -399,58 +399,58 @@  discard block
 block discarded – undo
399 399
         $ss->assign('authenticateLBL', translate('LBL_AUTHENTICATE', 'SugarFeed'));
400 400
         $ss->assign('id', $this->id);
401 401
         if($this->isAutoRefreshable()) {
402
-       		$ss->assign('isRefreshable', true);
403
-			$ss->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
404
-			$ss->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
405
-			$ss->assign('autoRefreshSelect', $this->autoRefresh);
406
-		}
402
+                $ss->assign('isRefreshable', true);
403
+            $ss->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
404
+            $ss->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
405
+            $ss->assign('autoRefreshSelect', $this->autoRefresh);
406
+        }
407 407
 
408 408
         return  $ss->fetch('custom/modules/SugarFeed/Dashlets/SugarFeedDashlet/Options.tpl');
409 409
     }
410 410
 
411
-	/**
412
-	 * creats the values
413
-	 * @return
414
-	 * @param $req Object
415
-	 */
416
-	  function saveOptions($req) {
411
+    /**
412
+     * creats the values
413
+     * @return
414
+     * @param $req Object
415
+     */
416
+        function saveOptions($req) {
417 417
         global $sugar_config, $timedate, $current_user, $theme;
418 418
         $options = array();
419 419
         $options['title'] = $req['title'];
420
-		$rows = intval($_REQUEST['rows']);
420
+        $rows = intval($_REQUEST['rows']);
421 421
         if($rows <= 0) {
422 422
             $rows = 15;
423 423
         }
424
-		if($rows > 100){
425
-			$rows = 100;
426
-		}
424
+        if($rows > 100){
425
+            $rows = 100;
426
+        }
427 427
         if ( isset($req['autoRefresh']) )
428 428
             $options['autoRefresh'] = $req['autoRefresh'];
429 429
         $options['rows'] = $rows;
430
-		$options['categories'] = $req['categories'];
431
-		foreach($options['categories'] as $cat){
432
-			if($cat == 'ALL'){
433
-				unset($options['categories']);
434
-			}
435
-		}
430
+        $options['categories'] = $req['categories'];
431
+        foreach($options['categories'] as $cat){
432
+            if($cat == 'ALL'){
433
+                unset($options['categories']);
434
+            }
435
+        }
436 436
 
437 437
 
438 438
         return $options;
439 439
     }
440 440
 
441 441
 
442
-      function sugarFeedDisplayScript() {
443
-          // Forces the quicksearch to reload anytime the dashlet gets refreshed
444
-          return '<script type="text/javascript">
442
+        function sugarFeedDisplayScript() {
443
+            // Forces the quicksearch to reload anytime the dashlet gets refreshed
444
+            return '<script type="text/javascript">
445 445
 enableQS(false);
446 446
 </script>';
447
-      }
448
-	/**
449
-	 *
450
-	 * @return javascript including QuickSearch for SugarFeeds
451
-	 */
452
-	 function displayScript() {
453
-	 	require_once('include/QuickSearchDefaults.php');
447
+        }
448
+    /**
449
+     *
450
+     * @return javascript including QuickSearch for SugarFeeds
451
+     */
452
+        function displayScript() {
453
+            require_once('include/QuickSearchDefaults.php');
454 454
         $ss = new Sugar_Smarty();
455 455
         $ss->assign('saving', translate('LBL_SAVING', 'SugarFeed'));
456 456
         $ss->assign('saved', translate('LBL_SAVED', 'SugarFeed'));
@@ -461,15 +461,15 @@  discard block
 block discarded – undo
461 461
         return $str; // return parent::display for title and such
462 462
     }
463 463
 
464
-	/**
465
-	 *
466
-	 * @return the fully rendered dashlet
467
-	 */
468
-	function display(){
464
+    /**
465
+     *
466
+     * @return the fully rendered dashlet
467
+     */
468
+    function display(){
469 469
 
470
-		$listview = parent::display();
471
-		$GLOBALS['current_sugarfeed'] = $this;
472
-		$listview = preg_replace_callback('/\{([^\^ }]+)\.([^\}]+)\}/', create_function(
470
+        $listview = parent::display();
471
+        $GLOBALS['current_sugarfeed'] = $this;
472
+        $listview = preg_replace_callback('/\{([^\^ }]+)\.([^\}]+)\}/', create_function(
473 473
             '$matches',
474 474
             'if($matches[1] == "this"){$var = $matches[2]; return $GLOBALS[\'current_sugarfeed\']->$var;}else{return translate($matches[2], $matches[1]);}'
475 475
         ),$listview);
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         preg_match_all('/\[(\w+)\:/', $listview, $alt_modules);
480 480
 
481 481
         //now process each token to create the proper url and image tags in feed, leaving a string for the alt to be replaced in next step
482
-		$listview = preg_replace('/\[(\w+)\:([\w\-\d]*)\:([^\]]*)\]/', '<a href="index.php?module=$1&action=DetailView&record=$2"><img src="themes/default/images/$1.gif" border=0 REPLACE_ALT>$3</a>', $listview); /*SKIP_IMAGE_TAG*/
482
+        $listview = preg_replace('/\[(\w+)\:([\w\-\d]*)\:([^\]]*)\]/', '<a href="index.php?module=$1&action=DetailView&record=$2"><img src="themes/default/images/$1.gif" border=0 REPLACE_ALT>$3</a>', $listview); /*SKIP_IMAGE_TAG*/
483 483
 
484 484
 
485 485
         //process each module for the singular version so we can populate the alt tag on the image
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
 
494 494
 
495 495
 
496
-		return $listview.'</div></div>';
497
-	}
496
+        return $listview.'</div></div>';
497
+    }
498 498
 
499 499
 
500
-	/**
501
-	 *
502
-	 * @return the title and the user post form
503
-	 * @param $text Object
504
-	 */
505
-	function getHeader($text='') {
506
-		return parent::getHeader($text) . $this->getPostForm().$this->getDisabledWarning().$this->sugarFeedDisplayScript().'<div class="sugarFeedDashlet"><div id="contentScroller'.$this->idjs.'">';
507
-	}
500
+    /**
501
+     *
502
+     * @return the title and the user post form
503
+     * @param $text Object
504
+     */
505
+    function getHeader($text='') {
506
+        return parent::getHeader($text) . $this->getPostForm().$this->getDisabledWarning().$this->sugarFeedDisplayScript().'<div class="sugarFeedDashlet"><div id="contentScroller'.$this->idjs.'">';
507
+    }
508 508
 
509 509
 
510
-	/**
511
-	 *
512
-	 * @return a warning message if the sugar feed system is not enabled currently
513
-	 */
514
-	function getDisabledWarning(){
510
+    /**
511
+     *
512
+     * @return a warning message if the sugar feed system is not enabled currently
513
+     */
514
+    function getDisabledWarning(){
515 515
         /* Check to see if the sugar feed system is enabled */
516 516
         if ( ! $this->shouldDisplay() ) {
517 517
             // The Sugar Feeds are disabled, populate the warning message
@@ -521,29 +521,29 @@  discard block
 block discarded – undo
521 521
         }
522 522
     }
523 523
 
524
-	/**
525
-	 *
526
-	 * @return the form for users posting custom messages to the feed stream
527
-	 */
528
-	function getPostForm(){
524
+    /**
525
+     *
526
+     * @return the form for users posting custom messages to the feed stream
527
+     */
528
+    function getPostForm(){
529 529
         global $current_user;
530 530
 
531 531
         if ( (!empty($this->selectedCategories) && !in_array('UserFeed',$this->selectedCategories))
532
-			) {
532
+            ) {
533 533
             // The user feed system isn't enabled, don't let them post notes
534 534
             return '';
535 535
         }
536
-		$user_name = ucfirst($GLOBALS['current_user']->user_name);
537
-		$moreimg = SugarThemeRegistry::current()->getImage('advanced_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_SHOW_MORE_OPTIONS','SugarFeed'));
538
-		$lessimg = SugarThemeRegistry::current()->getImage('basic_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_HIDE_OPTIONS','SugarFeed'));
539
-		$ss = new Sugar_Smarty();
540
-		$ss->assign('LBL_TO', translate('LBL_TO', 'SugarFeed'));
541
-		$ss->assign('LBL_POST', translate('LBL_POST', 'SugarFeed'));
542
-		$ss->assign('LBL_SELECT', translate('LBL_SELECT', 'SugarFeed'));
543
-		$ss->assign('LBL_IS', translate('LBL_IS', 'SugarFeed'));
544
-		$ss->assign('id', $this->id);
545
-		$ss->assign('more_img', $moreimg);
546
-		$ss->assign('less_img', $lessimg);
536
+        $user_name = ucfirst($GLOBALS['current_user']->user_name);
537
+        $moreimg = SugarThemeRegistry::current()->getImage('advanced_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_SHOW_MORE_OPTIONS','SugarFeed'));
538
+        $lessimg = SugarThemeRegistry::current()->getImage('basic_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_HIDE_OPTIONS','SugarFeed'));
539
+        $ss = new Sugar_Smarty();
540
+        $ss->assign('LBL_TO', translate('LBL_TO', 'SugarFeed'));
541
+        $ss->assign('LBL_POST', translate('LBL_POST', 'SugarFeed'));
542
+        $ss->assign('LBL_SELECT', translate('LBL_SELECT', 'SugarFeed'));
543
+        $ss->assign('LBL_IS', translate('LBL_IS', 'SugarFeed'));
544
+        $ss->assign('id', $this->id);
545
+        $ss->assign('more_img', $moreimg);
546
+        $ss->assign('less_img', $lessimg);
547 547
 
548 548
         include_once("include/social/get_feed_data.php");
549 549
         $ss->assign('facebook', $html );
@@ -559,12 +559,12 @@  discard block
 block discarded – undo
559 559
         foreach ( $linkTypesIn as $key => $value ) {
560 560
             $linkTypes[$key] = translate('LBL_LINK_TYPE_'.$value,'SugarFeed');
561 561
         }
562
-		$ss->assign('link_types', $linkTypes);
562
+        $ss->assign('link_types', $linkTypes);
563 563
 
564 564
         $userPostFormTplFile = 'modules/SugarFeed/Dashlets/SugarFeedDashlet/UserPostForm.tpl';
565 565
         $fetch = $ss->fetch(get_custom_file_if_exists($userPostFormTplFile));
566 566
         return $fetch;
567
-	}
567
+    }
568 568
 
569 569
     // This is called from the include/MySugar/DashletsDialog/DashletsDialog.php and determines if we should display the SugarFeed dashlet as an option or not
570 570
     static function shouldDisplay() {
Please login to merge, or discard this patch.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -67,55 +67,55 @@  discard block
 block discarded – undo
67 67
 		$replacements = array();
68 68
 		$replacements[] = '';
69 69
 		$replacements[] = '';
70
-		$this->idjs = preg_replace($pattern,$replacements,$this->id);
70
+		$this->idjs = preg_replace($pattern, $replacements, $this->id);
71 71
         // Add in some default categories.
72
-        $this->categories['ALL'] = translate('LBL_ALL','SugarFeed');
72
+        $this->categories['ALL'] = translate('LBL_ALL', 'SugarFeed');
73 73
         // Need to get the rest of the active SugarFeed modules
74 74
         $module_list = SugarFeed::getActiveFeedModules();
75 75
         
76 76
         // Translate the category names
77
-        if ( ! is_array($module_list) ) { $module_list = array(); }
78
-        foreach ( $module_list as $module ) {
79
-            if ( $module == 'UserFeed' ) {
77
+        if (!is_array($module_list)) { $module_list = array(); }
78
+        foreach ($module_list as $module) {
79
+            if ($module == 'UserFeed') {
80 80
                 // Fake module, need to translate specially
81
-                $this->categories[$module] = translate('LBL_USER_FEED','SugarFeed');
81
+                $this->categories[$module] = translate('LBL_USER_FEED', 'SugarFeed');
82 82
             } else {
83 83
                 $this->categories[$module] = $app_list_strings['moduleList'][$module];
84 84
             }
85 85
         }
86 86
 
87 87
         // Need to add the external api's here
88
-        $this->externalAPIList = ExternalAPIFactory::getModuleDropDown('SugarFeed',true);
89
-        if ( !is_array($this->externalAPIList) ) { $this->externalAPIList = array(); }
90
-        foreach ( $this->externalAPIList as $apiObj => $apiName ) {
88
+        $this->externalAPIList = ExternalAPIFactory::getModuleDropDown('SugarFeed', true);
89
+        if (!is_array($this->externalAPIList)) { $this->externalAPIList = array(); }
90
+        foreach ($this->externalAPIList as $apiObj => $apiName) {
91 91
             $this->categories[$apiObj] = $apiName;
92 92
         }
93 93
 
94 94
 
95
-        if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
96
-		if(!empty($def['rows']))$this->displayRows = $def['rows'];
97
-		if(!empty($def['categories']))$this->selectedCategories = $def['categories'];
98
-		if(!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created'];
95
+        if (empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
96
+		if (!empty($def['rows']))$this->displayRows = $def['rows'];
97
+		if (!empty($def['categories']))$this->selectedCategories = $def['categories'];
98
+		if (!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created'];
99 99
         $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields'];
100 100
         $this->columns = $dashletData['SugarFeedDashlet']['columns'];
101 101
 
102 102
         $twitter_enabled = $this->check_enabled('twitter');
103 103
         $facebook_enabled = $this->check_enabled('facebook');
104 104
 
105
-        if($facebook_enabled){
105
+        if ($facebook_enabled) {
106 106
             $this->categories["Facebook"] = "Facebook";
107 107
         }
108 108
 
109
-        if($twitter_enabled){
109
+        if ($twitter_enabled) {
110 110
             $this->categories["Twitter"] = "Twitter";
111 111
         }
112 112
 
113 113
 		$catCount = count($this->categories);
114 114
 		ACLController::filterModuleList($this->categories, false);
115
-		if(count($this->categories) < $catCount){
116
-			if(!empty($this->selectedCategories)){
115
+		if (count($this->categories) < $catCount) {
116
+			if (!empty($this->selectedCategories)) {
117 117
 				ACLController::filterModuleList($this->selectedCategories, true);
118
-			}else{
118
+			} else {
119 119
 				$this->selectedCategories = array_keys($this->categories);
120 120
 				unset($this->selectedCategories[0]);
121 121
 			}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $lvsParams['massupdate'] = false;
134 134
 
135 135
         // apply filters
136
-        if(isset($this->filters) || $this->myItemsOnly) {
136
+        if (isset($this->filters) || $this->myItemsOnly) {
137 137
             $whereArray = $this->buildWhere();
138 138
         }
139 139
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
         $this->lvs->multiSelect = false;
142 142
 		$this->lvs->quickViewLinks = false;
143 143
         // columns
144
-    foreach($this->columns as $name => $val) {
145
-                if(!empty($val['default']) && $val['default']) {
144
+    foreach ($this->columns as $name => $val) {
145
+                if (!empty($val['default']) && $val['default']) {
146 146
                     $displayColumns[strtoupper($name)] = $val;
147 147
                     $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':');
148 148
                 }
@@ -159,39 +159,39 @@  discard block
 block discarded – undo
159 159
 
160 160
 
161 161
         // Get the real module list
162
-        if (empty($this->selectedCategories)){
162
+        if (empty($this->selectedCategories)) {
163 163
             $mod_list = $this->categories;
164 164
         } else {
165
-            $mod_list = array_flip($this->selectedCategories);//27949, here the key of $this->selectedCategories is not module name, the value is module name, so array_flip it.
165
+            $mod_list = array_flip($this->selectedCategories); //27949, here the key of $this->selectedCategories is not module name, the value is module name, so array_flip it.
166 166
         }
167 167
 
168 168
         $external_modules = array();
169 169
         $admin_modules = array();
170 170
         $owner_modules = array();
171 171
         $regular_modules = array();
172
-        foreach($mod_list as $module => $ignore) {
172
+        foreach ($mod_list as $module => $ignore) {
173 173
 			// Handle the UserFeed differently
174
-			if ( $module == 'UserFeed') {
174
+			if ($module == 'UserFeed') {
175 175
 				$regular_modules[] = 'UserFeed';
176 176
 				continue;
177 177
 			}
178
-            if($module == 'Facebook'){
178
+            if ($module == 'Facebook') {
179 179
                 $regular_modules[] = "Facebook";
180 180
                 continue;
181 181
             }
182
-            if($module == 'Twitter'){
182
+            if ($module == 'Twitter') {
183 183
                 $regular_modules[] = 'Twitter';
184 184
                 continue;
185 185
             }
186 186
 
187
-            if ( in_array($module,$this->externalAPIList) ) {
187
+            if (in_array($module, $this->externalAPIList)) {
188 188
                 $external_modules[] = $module;
189 189
             }
190
-			if (ACLAction::getUserAccessLevel($current_user->id,$module,'view') <= ACL_ALLOW_NONE ) {
190
+			if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') <= ACL_ALLOW_NONE) {
191 191
 				// Not enough access to view any records, don't add it to any lists
192 192
 				continue;
193 193
 			}
194
-			if ( ACLAction::getUserAccessLevel($current_user->id,$module,'view') == ACL_ALLOW_OWNER ) {
194
+			if (ACLAction::getUserAccessLevel($current_user->id, $module, 'view') == ACL_ALLOW_OWNER) {
195 195
 				$owner_modules[] = $module;
196 196
             } else {
197 197
                 $regular_modules[] = $module;
@@ -201,41 +201,41 @@  discard block
 block discarded – undo
201 201
 
202 202
 
203 203
 
204
-        if(!empty($this->displayTpl))
204
+        if (!empty($this->displayTpl))
205 205
         {
206 206
         	//MFH BUG #14296
207 207
             $where = '';
208
-            if(!empty($whereArray)){
209
-                $where = '(' . implode(') AND (', $whereArray) . ')';
208
+            if (!empty($whereArray)) {
209
+                $where = '('.implode(') AND (', $whereArray).')';
210 210
 
211 211
             }
212 212
 
213 213
             $additional_where = '';
214 214
 
215 215
 
216
-			$module_limiter = " sugarfeed.related_module in ('" . implode("','", $regular_modules) . "')";
216
+			$module_limiter = " sugarfeed.related_module in ('".implode("','", $regular_modules)."')";
217 217
 
218
-			if( is_admin($GLOBALS['current_user'] ) )
218
+			if (is_admin($GLOBALS['current_user']))
219 219
             {
220 220
                 $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules);
221
-                $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')";
221
+                $module_limiter = " sugarfeed.related_module in ('".implode("','", $all_modules)."')";
222 222
             }
223
-            else if ( count($owner_modules) > 0
223
+            else if (count($owner_modules) > 0
224 224
 				) {
225 225
                 $module_limiter = " ((sugarfeed.related_module IN ('".implode("','", $regular_modules)."') "
226 226
 					.") ";
227
-				if ( count($owner_modules) > 0 ) {
227
+				if (count($owner_modules) > 0) {
228 228
 					$module_limiter .= "OR (sugarfeed.related_module IN('".implode("','", $owner_modules)."') AND sugarfeed.assigned_user_id = '".$current_user->id."' "
229 229
 						.") ";
230 230
 				}
231 231
 				$module_limiter .= ")";
232 232
             }
233
-			if(!empty($where)) { $where .= ' AND '; }
233
+			if (!empty($where)) { $where .= ' AND '; }
234 234
 
235 235
 
236 236
 			$where .= $module_limiter;
237 237
 
238
-            $this->lvs->setup($this->seedBean, $this->displayTpl, $where , $lvsParams, 0, $this->displayRows,
238
+            $this->lvs->setup($this->seedBean, $this->displayTpl, $where, $lvsParams, 0, $this->displayRows,
239 239
                               array('name',
240 240
                                     'description',
241 241
                                     'date_entered',
@@ -252,35 +252,35 @@  discard block
 block discarded – undo
252 252
                                     'link_url',
253 253
                                     'link_type'));
254 254
 
255
-            foreach($this->lvs->data['data'] as $row => $data) {
255
+            foreach ($this->lvs->data['data'] as $row => $data) {
256 256
 
257
-                    $this->lvs->data['data'][$row]['NAME'] = str_replace("{this.CREATED_BY}",get_assigned_user_name($this->lvs->data['data'][$row]['CREATED_BY']),$data['NAME']);
257
+                    $this->lvs->data['data'][$row]['NAME'] = str_replace("{this.CREATED_BY}", get_assigned_user_name($this->lvs->data['data'][$row]['CREATED_BY']), $data['NAME']);
258 258
 
259 259
                     //Translate the SugarFeeds labels if necessary.
260
-                    preg_match('/\{([^\^ }]+)\.([^\}]+)\}/', $this->lvs->data['data'][$row]['NAME'] ,$modStringMatches );
261
-                    if(count($modStringMatches) == 3 && $modStringMatches[1] == 'SugarFeed' && !empty($data['RELATED_MODULE']) )
260
+                    preg_match('/\{([^\^ }]+)\.([^\}]+)\}/', $this->lvs->data['data'][$row]['NAME'], $modStringMatches);
261
+                    if (count($modStringMatches) == 3 && $modStringMatches[1] == 'SugarFeed' && !empty($data['RELATED_MODULE']))
262 262
                     {
263 263
                         $modKey = $modStringMatches[2];
264 264
                         $modString = translate($modKey, $modStringMatches[1]);
265
-                        if( strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]) )
265
+                        if (strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]))
266 266
                             continue;
267 267
 
268 268
                         $modStringSingular = $GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']];
269
-                        $modString = string_format($modString, array($modStringSingular) );
270
-                        $this->lvs->data['data'][$row]['NAME'] = preg_replace('/' . $modStringMatches[0] . '/', strtolower($modString), $this->lvs->data['data'][$row]['NAME']);
269
+                        $modString = string_format($modString, array($modStringSingular));
270
+                        $this->lvs->data['data'][$row]['NAME'] = preg_replace('/'.$modStringMatches[0].'/', strtolower($modString), $this->lvs->data['data'][$row]['NAME']);
271 271
                     }
272 272
                 //if social then unless the user is the assigned user it wont show. IJD1986
273
-                if(($data['RELATED_MODULE'] == "facebook" || $data['RELATED_MODULE'] == "twitter" ) && $data['ASSIGNED_USER_ID'] != $current_user->id){
273
+                if (($data['RELATED_MODULE'] == "facebook" || $data['RELATED_MODULE'] == "twitter") && $data['ASSIGNED_USER_ID'] != $current_user->id) {
274 274
                     unset($this->lvs->data['data'][$row]);
275 275
                 }
276 276
             }
277 277
 
278 278
             // assign a baseURL w/ the action set as DisplayDashlet
279
-            foreach($this->lvs->data['pageData']['urls'] as $type => $url) {
279
+            foreach ($this->lvs->data['pageData']['urls'] as $type => $url) {
280 280
             	// awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
281 281
                 $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet';
282
-                if($type != 'orderBy')
283
-                    $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id;
282
+                if ($type != 'orderBy')
283
+                    $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id='.$this->id;
284 284
             }
285 285
 
286 286
             $this->lvs->ss->assign('dashletId', $this->id);
@@ -295,27 +295,27 @@  discard block
 block discarded – undo
295 295
 
296 296
         $fetchRecordCount = $this->displayRows + $this->lvs->data['pageData']['offsets']['current'];
297 297
 
298
-        foreach ( $external_modules as $apiName ) {
298
+        foreach ($external_modules as $apiName) {
299 299
             $api = ExternalAPIFactory::loadAPI($apiName);
300
-            if ( $api !== FALSE ) {
300
+            if ($api !== FALSE) {
301 301
                 // FIXME: Actually calculate the oldest sugar feed we can see, once we get an API that supports this sort of filter.
302
-                $reply = $api->getLatestUpdates(0,$fetchRecordCount);
303
-                if ( $reply['success'] && count($reply['messages']) > 0 ) {
302
+                $reply = $api->getLatestUpdates(0, $fetchRecordCount);
303
+                if ($reply['success'] && count($reply['messages']) > 0) {
304 304
                     array_splice($resortQueue, count($resortQueue), 0, $reply['messages']);
305
-                } else if ( !$reply['success'] ) {
305
+                } else if (!$reply['success']) {
306 306
                     $feedErrors[] = $reply['errorMessage'];
307 307
                 }
308 308
             }
309 309
         }
310 310
 
311
-        if ( count($feedErrors) > 0 ) {
312
-            $this->lvs->ss->assign('feedErrors',$feedErrors);
311
+        if (count($feedErrors) > 0) {
312
+            $this->lvs->ss->assign('feedErrors', $feedErrors);
313 313
         }
314 314
 
315 315
         // If we need to resort, get to work!
316
-        foreach ( $this->lvs->data['data'] as $normalMessage ) {
317
-            list($user_date,$user_time) = explode(' ',$normalMessage['DATE_ENTERED']);
318
-            list($db_date,$db_time) = $td->to_db_date_time($user_date,$user_time);
316
+        foreach ($this->lvs->data['data'] as $normalMessage) {
317
+            list($user_date, $user_time) = explode(' ', $normalMessage['DATE_ENTERED']);
318
+            list($db_date, $db_time) = $td->to_db_date_time($user_date, $user_time);
319 319
 
320 320
             $unix_timestamp = strtotime($db_date.' '.$db_time);
321 321
 
@@ -325,31 +325,31 @@  discard block
 block discarded – undo
325 325
             $resortQueue[] = $normalMessage;
326 326
         }
327 327
 
328
-        usort($resortQueue,create_function('$a,$b','return $a["sort_key"]<$b["sort_key"];'));
328
+        usort($resortQueue, create_function('$a,$b', 'return $a["sort_key"]<$b["sort_key"];'));
329 329
 
330 330
         // Trim it down to the necessary number of records
331 331
         $numRecords = count($resortQueue);
332 332
         $numRecords = $numRecords - $this->lvs->data['pageData']['offsets']['current'];
333
-        $numRecords = min($this->displayRows,$numRecords);
333
+        $numRecords = min($this->displayRows, $numRecords);
334 334
 
335 335
         $this->lvs->data['data'] = $resortQueue;
336 336
     }
337 337
 
338 338
 	  function deleteUserFeed() {
339
-    	if(!empty($_REQUEST['record'])) {
339
+    	if (!empty($_REQUEST['record'])) {
340 340
 			$feed = new SugarFeed();
341 341
 			$feed->retrieve($_REQUEST['record']);
342
-			if(is_admin($GLOBALS['current_user']) || $feed->created_by == $GLOBALS['current_user']->id){
342
+			if (is_admin($GLOBALS['current_user']) || $feed->created_by == $GLOBALS['current_user']->id) {
343 343
             	$feed->mark_deleted($_REQUEST['record']);
344 344
 
345 345
 			}
346 346
         }
347 347
     }
348 348
 	 function pushUserFeed() {
349
-    	if(!empty($_REQUEST['text']) || (!empty($_REQUEST['link_url']) && !empty($_REQUEST['link_type']))) {
349
+    	if (!empty($_REQUEST['text']) || (!empty($_REQUEST['link_url']) && !empty($_REQUEST['link_type']))) {
350 350
 			$text = htmlspecialchars($_REQUEST['text']);
351 351
 			//allow for bold and italic user tags
352
-			$text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i','<$1>', $text);
352
+			$text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i', '<$1>', $text);
353 353
             SugarFeed::pushFeed($text, 'UserFeed', $GLOBALS['current_user']->id,
354 354
 								$GLOBALS['current_user']->id,
355 355
                                 $_REQUEST['link_type'], $_REQUEST['link_url']
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
     }
360 360
 
361 361
 	 function pushUserFeedReply( ) {
362
-         if(!empty($_REQUEST['text'])&&!empty($_REQUEST['parentFeed'])) {
362
+         if (!empty($_REQUEST['text']) && !empty($_REQUEST['parentFeed'])) {
363 363
 			$text = htmlspecialchars($_REQUEST['text']);
364 364
 			//allow for bold and italic user tags
365
-			$text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i','<$1>', $text);
365
+			$text = preg_replace('/&amp;lt;(\/*[bi])&amp;gt;/i', '<$1>', $text);
366 366
             SugarFeed::pushFeed($text, 'SugarFeed', $_REQUEST['parentFeed'],
367 367
 								$GLOBALS['current_user']->id,
368 368
                                 '', ''
@@ -383,22 +383,22 @@  discard block
 block discarded – undo
383 383
         $ss->assign('clearLBL', $app_strings['LBL_CLEAR_BUTTON_LABEL']);
384 384
         $ss->assign('title', $this->title);
385 385
 		$ss->assign('categories', $this->categories);
386
-        if ( empty($this->selectedCategories) ) {
386
+        if (empty($this->selectedCategories)) {
387 387
             $this->selectedCategories['ALL'] = 'ALL';
388 388
         }
389 389
 		$ss->assign('selectedCategories', $this->selectedCategories);
390 390
         $ss->assign('rows', $this->displayRows);
391 391
         $externalApis = array();
392
-        foreach ( $this->externalAPIList as $apiObj => $apiName ) {
392
+        foreach ($this->externalAPIList as $apiObj => $apiName) {
393 393
             //only show external APis that the user has not created
394
-            if ( ! EAPM::getLoginInfo($apiName) ) {
394
+            if (!EAPM::getLoginInfo($apiName)) {
395 395
                 $externalApis[] = $apiObj;
396 396
             }
397 397
         }
398 398
         $ss->assign('externalApiList', JSON::encode($externalApis));
399 399
         $ss->assign('authenticateLBL', translate('LBL_AUTHENTICATE', 'SugarFeed'));
400 400
         $ss->assign('id', $this->id);
401
-        if($this->isAutoRefreshable()) {
401
+        if ($this->isAutoRefreshable()) {
402 402
        		$ss->assign('isRefreshable', true);
403 403
 			$ss->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
404 404
 			$ss->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
@@ -418,18 +418,18 @@  discard block
 block discarded – undo
418 418
         $options = array();
419 419
         $options['title'] = $req['title'];
420 420
 		$rows = intval($_REQUEST['rows']);
421
-        if($rows <= 0) {
421
+        if ($rows <= 0) {
422 422
             $rows = 15;
423 423
         }
424
-		if($rows > 100){
424
+		if ($rows > 100) {
425 425
 			$rows = 100;
426 426
 		}
427
-        if ( isset($req['autoRefresh']) )
427
+        if (isset($req['autoRefresh']))
428 428
             $options['autoRefresh'] = $req['autoRefresh'];
429 429
         $options['rows'] = $rows;
430 430
 		$options['categories'] = $req['categories'];
431
-		foreach($options['categories'] as $cat){
432
-			if($cat == 'ALL'){
431
+		foreach ($options['categories'] as $cat) {
432
+			if ($cat == 'ALL') {
433 433
 				unset($options['categories']);
434 434
 			}
435 435
 		}
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 	 *
466 466
 	 * @return the fully rendered dashlet
467 467
 	 */
468
-	function display(){
468
+	function display() {
469 469
 
470 470
 		$listview = parent::display();
471 471
 		$GLOBALS['current_sugarfeed'] = $this;
472 472
 		$listview = preg_replace_callback('/\{([^\^ }]+)\.([^\}]+)\}/', create_function(
473 473
             '$matches',
474 474
             'if($matches[1] == "this"){$var = $matches[2]; return $GLOBALS[\'current_sugarfeed\']->$var;}else{return translate($matches[2], $matches[1]);}'
475
-        ),$listview);
475
+        ), $listview);
476 476
 
477 477
 
478 478
         //grab each token and store the module for later processing
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
 
485 485
         //process each module for the singular version so we can populate the alt tag on the image
486 486
         $altStrings = array();
487
-        foreach($alt_modules[1] as $alt){
487
+        foreach ($alt_modules[1] as $alt) {
488 488
             //create the alt string and replace the alt token
489
-            $altString = 'alt="'.translate('LBL_VIEW','SugarFeed').' '.$GLOBALS['app_list_strings']['moduleListSingular'][$alt].'"';
490
-            $listview = preg_replace('/REPLACE_ALT/', $altString, $listview,1);
489
+            $altString = 'alt="'.translate('LBL_VIEW', 'SugarFeed').' '.$GLOBALS['app_list_strings']['moduleListSingular'][$alt].'"';
490
+            $listview = preg_replace('/REPLACE_ALT/', $altString, $listview, 1);
491 491
         }
492 492
 
493 493
 
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
 	 * @return the title and the user post form
503 503
 	 * @param $text Object
504 504
 	 */
505
-	function getHeader($text='') {
506
-		return parent::getHeader($text) . $this->getPostForm().$this->getDisabledWarning().$this->sugarFeedDisplayScript().'<div class="sugarFeedDashlet"><div id="contentScroller'.$this->idjs.'">';
505
+	function getHeader($text = '') {
506
+		return parent::getHeader($text).$this->getPostForm().$this->getDisabledWarning().$this->sugarFeedDisplayScript().'<div class="sugarFeedDashlet"><div id="contentScroller'.$this->idjs.'">';
507 507
 	}
508 508
 
509 509
 
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return a warning message if the sugar feed system is not enabled currently
513 513
 	 */
514
-	function getDisabledWarning(){
514
+	function getDisabledWarning() {
515 515
         /* Check to see if the sugar feed system is enabled */
516
-        if ( ! $this->shouldDisplay() ) {
516
+        if (!$this->shouldDisplay()) {
517 517
             // The Sugar Feeds are disabled, populate the warning message
518
-            return translate('LBL_DASHLET_DISABLED','SugarFeed');
518
+            return translate('LBL_DASHLET_DISABLED', 'SugarFeed');
519 519
         } else {
520 520
             return '';
521 521
         }
@@ -525,17 +525,17 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @return the form for users posting custom messages to the feed stream
527 527
 	 */
528
-	function getPostForm(){
528
+	function getPostForm() {
529 529
         global $current_user;
530 530
 
531
-        if ( (!empty($this->selectedCategories) && !in_array('UserFeed',$this->selectedCategories))
531
+        if ((!empty($this->selectedCategories) && !in_array('UserFeed', $this->selectedCategories))
532 532
 			) {
533 533
             // The user feed system isn't enabled, don't let them post notes
534 534
             return '';
535 535
         }
536 536
 		$user_name = ucfirst($GLOBALS['current_user']->user_name);
537
-		$moreimg = SugarThemeRegistry::current()->getImage('advanced_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_SHOW_MORE_OPTIONS','SugarFeed'));
538
-		$lessimg = SugarThemeRegistry::current()->getImage('basic_search' , 'onclick="toggleDisplay(\'more_' . $this->id . '\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"',null,null,'.gif',translate('LBL_HIDE_OPTIONS','SugarFeed'));
537
+		$moreimg = SugarThemeRegistry::current()->getImage('advanced_search', 'onclick="toggleDisplay(\'more_'.$this->id.'\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"', null, null, '.gif', translate('LBL_SHOW_MORE_OPTIONS', 'SugarFeed'));
538
+		$lessimg = SugarThemeRegistry::current()->getImage('basic_search', 'onclick="toggleDisplay(\'more_'.$this->id.'\'); toggleDisplay(\'more_img_'.$this->id.'\'); toggleDisplay(\'less_img_'.$this->id.'\');"', null, null, '.gif', translate('LBL_HIDE_OPTIONS', 'SugarFeed'));
539 539
 		$ss = new Sugar_Smarty();
540 540
 		$ss->assign('LBL_TO', translate('LBL_TO', 'SugarFeed'));
541 541
 		$ss->assign('LBL_POST', translate('LBL_POST', 'SugarFeed'));
@@ -546,9 +546,9 @@  discard block
 block discarded – undo
546 546
 		$ss->assign('less_img', $lessimg);
547 547
 
548 548
         include_once("include/social/get_feed_data.php");
549
-        $ss->assign('facebook', $html );
549
+        $ss->assign('facebook', $html);
550 550
 
551
-        if($current_user->getPreference('use_real_names') == 'on'){
551
+        if ($current_user->getPreference('use_real_names') == 'on') {
552 552
             $ss->assign('user_name', $current_user->full_name);
553 553
         }
554 554
         else {
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
         }
557 557
         $linkTypesIn = SugarFeed::getLinkTypes();
558 558
         $linkTypes = array();
559
-        foreach ( $linkTypesIn as $key => $value ) {
560
-            $linkTypes[$key] = translate('LBL_LINK_TYPE_'.$value,'SugarFeed');
559
+        foreach ($linkTypesIn as $key => $value) {
560
+            $linkTypes[$key] = translate('LBL_LINK_TYPE_'.$value, 'SugarFeed');
561 561
         }
562 562
 		$ss->assign('link_types', $linkTypes);
563 563
 
@@ -572,16 +572,16 @@  discard block
 block discarded – undo
572 572
         $admin = new Administration();
573 573
         $admin->retrieveSettings();
574 574
 
575
-        if ( !isset($admin->settings['sugarfeed_enabled']) || $admin->settings['sugarfeed_enabled'] != '1' ) {
575
+        if (!isset($admin->settings['sugarfeed_enabled']) || $admin->settings['sugarfeed_enabled'] != '1') {
576 576
             return false;
577 577
         } else {
578 578
             return true;
579 579
         }
580 580
     }
581 581
 
582
-    function check_enabled($type){
582
+    function check_enabled($type) {
583 583
         global $db;
584
-        $query = "SELECT * FROM config where name = 'module_" .$type . "' and value =  1;";
584
+        $query = "SELECT * FROM config where name = 'module_".$type."' and value =  1;";
585 585
         $results = $db->query($query);
586 586
 
587 587
         while ($row = $db->fetchByAssoc($results)) {
Please login to merge, or discard this patch.
Braces   +27 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -92,10 +94,18 @@  discard block
 block discarded – undo
92 94
         }
93 95
 
94 96
 
95
-        if(empty($def['title'])) $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
96
-		if(!empty($def['rows']))$this->displayRows = $def['rows'];
97
-		if(!empty($def['categories']))$this->selectedCategories = $def['categories'];
98
-		if(!empty($def['userfeed_created'])) $this->userfeed_created = $def['userfeed_created'];
97
+        if(empty($def['title'])) {
98
+            $this->title = translate('LBL_HOMEPAGE_TITLE', 'SugarFeed');
99
+        }
100
+		if(!empty($def['rows'])) {
101
+		    $this->displayRows = $def['rows'];
102
+		}
103
+		if(!empty($def['categories'])) {
104
+		    $this->selectedCategories = $def['categories'];
105
+		}
106
+		if(!empty($def['userfeed_created'])) {
107
+		    $this->userfeed_created = $def['userfeed_created'];
108
+		}
99 109
         $this->searchFields = $dashletData['SugarFeedDashlet']['searchFields'];
100 110
         $this->columns = $dashletData['SugarFeedDashlet']['columns'];
101 111
 
@@ -115,7 +125,7 @@  discard block
 block discarded – undo
115 125
 		if(count($this->categories) < $catCount){
116 126
 			if(!empty($this->selectedCategories)){
117 127
 				ACLController::filterModuleList($this->selectedCategories, true);
118
-			}else{
128
+			} else{
119 129
 				$this->selectedCategories = array_keys($this->categories);
120 130
 				unset($this->selectedCategories[0]);
121 131
 			}
@@ -219,8 +229,7 @@  discard block
 block discarded – undo
219 229
             {
220 230
                 $all_modules = array_merge($regular_modules, $owner_modules, $admin_modules);
221 231
                 $module_limiter = " sugarfeed.related_module in ('" . implode("','", $all_modules) . "')";
222
-            }
223
-            else if ( count($owner_modules) > 0
232
+            } else if ( count($owner_modules) > 0
224 233
 				) {
225 234
                 $module_limiter = " ((sugarfeed.related_module IN ('".implode("','", $regular_modules)."') "
226 235
 					.") ";
@@ -262,8 +271,9 @@  discard block
 block discarded – undo
262 271
                     {
263 272
                         $modKey = $modStringMatches[2];
264 273
                         $modString = translate($modKey, $modStringMatches[1]);
265
-                        if( strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]) )
266
-                            continue;
274
+                        if( strpos($modString, '{0}') === FALSE || !isset($GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']]) ) {
275
+                                                    continue;
276
+                        }
267 277
 
268 278
                         $modStringSingular = $GLOBALS['app_list_strings']['moduleListSingular'][$data['RELATED_MODULE']];
269 279
                         $modString = string_format($modString, array($modStringSingular) );
@@ -279,8 +289,9 @@  discard block
 block discarded – undo
279 289
             foreach($this->lvs->data['pageData']['urls'] as $type => $url) {
280 290
             	// awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
281 291
                 $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet';
282
-                if($type != 'orderBy')
283
-                    $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id;
292
+                if($type != 'orderBy') {
293
+                                    $this->lvs->data['pageData']['urls'][$type] = $url.'&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&id=' . $this->id;
294
+                }
284 295
             }
285 296
 
286 297
             $this->lvs->ss->assign('dashletId', $this->id);
@@ -424,8 +435,9 @@  discard block
 block discarded – undo
424 435
 		if($rows > 100){
425 436
 			$rows = 100;
426 437
 		}
427
-        if ( isset($req['autoRefresh']) )
428
-            $options['autoRefresh'] = $req['autoRefresh'];
438
+        if ( isset($req['autoRefresh']) ) {
439
+                    $options['autoRefresh'] = $req['autoRefresh'];
440
+        }
429 441
         $options['rows'] = $rows;
430 442
 		$options['categories'] = $req['categories'];
431 443
 		foreach($options['categories'] as $cat){
@@ -550,8 +562,7 @@  discard block
 block discarded – undo
550 562
 
551 563
         if($current_user->getPreference('use_real_names') == 'on'){
552 564
             $ss->assign('user_name', $current_user->full_name);
553
-        }
554
-        else {
565
+        } else {
555 566
             $ss->assign('user_name', $user_name);
556 567
         }
557 568
         $linkTypesIn = SugarFeed::getLinkTypes();
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
 	/**
465 465
 	 *
466
-	 * @return the fully rendered dashlet
466
+	 * @return string fully rendered dashlet
467 467
 	 */
468 468
 	function display(){
469 469
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
 	/**
501 501
 	 *
502
-	 * @return the title and the user post form
502
+	 * @return string title and the user post form
503 503
 	 * @param $text Object
504 504
 	 */
505 505
 	function getHeader($text='') {
@@ -579,6 +579,9 @@  discard block
 block discarded – undo
579 579
         }
580 580
     }
581 581
 
582
+    /**
583
+     * @param string $type
584
+     */
582 585
     function check_enabled($type){
583 586
         global $db;
584 587
         $query = "SELECT * FROM config where name = 'module_" .$type . "' and value =  1;";
Please login to merge, or discard this patch.
modules/ProjectTask/updateDependencies.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -40,26 +40,26 @@  discard block
 block discarded – undo
40 40
 
41 41
 class updateDependencies {
42 42
 
43
-    function update_dependency(&$bean, $event, $arguments){
43
+    function update_dependency(&$bean, $event, $arguments) {
44 44
         //Get all tasks that are dependant on the current task being saved.
45 45
         $Task = BeanFactory::getBean('ProjectTask');
46 46
         $tasks = $Task->get_full_list("", "project_task.project_id = '".$bean->project_id."' AND project_task.predecessors = '".$bean->project_task_id."'");
47 47
 
48
-        if($bean->date_finish != $bean->fetched_row['date_finish']){ //if the end date of a current task is changed
48
+        if ($bean->date_finish != $bean->fetched_row['date_finish']) { //if the end date of a current task is changed
49 49
 
50 50
             $diff = $this->count_days($bean->date_finish, $bean->fetched_row['date_finish']); //Gets the difference in days
51 51
 
52
-            foreach($tasks as $task){ //loop through all dependant tasks
52
+            foreach ($tasks as $task) { //loop through all dependant tasks
53 53
 
54
-                $rel_type = $task->relationship_type;//Determine their dependency type
54
+                $rel_type = $task->relationship_type; //Determine their dependency type
55 55
 
56
-                if($rel_type == 'FS'){//if its a Finish to start
56
+                if ($rel_type == 'FS') {//if its a Finish to start
57 57
                     //Modify the task's start and end date dependant on the difference in days
58 58
                     $start = new DateTime($task->date_start);
59 59
                     $start = $start->modify($diff);
60 60
                     $startdate = $start->format('Y-m-d');
61 61
 
62
-                    $duration = $task->duration - 1;//take one off to maintain correct gantt bar length
62
+                    $duration = $task->duration - 1; //take one off to maintain correct gantt bar length
63 63
 
64 64
                     $enddate = $start->modify('+'.$duration.' days');
65 65
                     $enddate = $enddate->format('Y-m-d');
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
                     $task->save();
70 70
 
71 71
                 }
72
-                else if($rel_type == 'SS'){//if its a start to start
72
+                else if ($rel_type == 'SS') {//if its a start to start
73 73
                     //check if the tasks duration has not been changed so that it does not update when the parent tasks duration is changed
74
-                    if($bean->fetched_row['duration'] == $bean->duration){
74
+                    if ($bean->fetched_row['duration'] == $bean->duration) {
75 75
 
76 76
                         $start = new DateTime($task->date_start);
77 77
                         $start = $start->modify($diff);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     }
97 97
 
98 98
     //Gets the difference in days between two dates
99
-    function count_days($start_date, $end_date){
99
+    function count_days($start_date, $end_date) {
100 100
 
101 101
         $d1 = new DateTime($start_date);
102 102
         $d2 = new DateTime($end_date);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if ($difference->invert == 1) {
105 105
             return '+'.$difference->d.' days'; //returns positive days
106 106
         } else {
107
-            return -$difference->d.' days';//returns negative days
107
+            return -$difference->d.' days'; //returns negative days
108 108
         }
109 109
 
110 110
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -68,8 +70,7 @@  discard block
 block discarded – undo
68 70
                     $task->date_finish = $enddate;
69 71
                     $task->save();
70 72
 
71
-                }
72
-                else if($rel_type == 'SS'){//if its a start to start
73
+                } else if($rel_type == 'SS'){//if its a start to start
73 74
                     //check if the tasks duration has not been changed so that it does not update when the parent tasks duration is changed
74 75
                     if($bean->fetched_row['duration'] == $bean->duration){
75 76
 
Please login to merge, or discard this patch.
modules/ProjectTask/ProjectTaskQuickCreate.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -75,29 +75,29 @@
 block discarded – undo
75 75
 ///
76 76
 /// SETUP PARENT POPUP
77 77
 
78
-	$popup_request_data = array(
79
-		'call_back_function' => 'set_return',
80
-		'form_name' => 'projectTypeQuickCreate',
81
-		'field_to_name_array' => array(
82
-			'id' => 'parent_id',
83
-			'name' => 'parent_name',
84
-			),
85
-		);
78
+    $popup_request_data = array(
79
+        'call_back_function' => 'set_return',
80
+        'form_name' => 'projectTypeQuickCreate',
81
+        'field_to_name_array' => array(
82
+            'id' => 'parent_id',
83
+            'name' => 'parent_name',
84
+            ),
85
+        );
86 86
 
87
-	$encoded_parent_popup_request_data = $json->encode($popup_request_data);
88
-	$this->ss->assign('encoded_parent_popup_request_data', $encoded_parent_popup_request_data);        
87
+    $encoded_parent_popup_request_data = $json->encode($popup_request_data);
88
+    $this->ss->assign('encoded_parent_popup_request_data', $encoded_parent_popup_request_data);        
89 89
         
90
-		$popup_request_data = array(
91
-			'call_back_function' => 'set_return',
92
-			'form_name' => 'projectTaskQuickCreate',
93
-			'field_to_name_array' => array(
94
-				'id' => 'account_id',
95
-				'name' => 'account_name',
96
-			),
97
-		);
90
+        $popup_request_data = array(
91
+            'call_back_function' => 'set_return',
92
+            'form_name' => 'projectTaskQuickCreate',
93
+            'field_to_name_array' => array(
94
+                'id' => 'account_id',
95
+                'name' => 'account_name',
96
+            ),
97
+        );
98 98
 	
99
-		$encoded_popup_request_data = $json->encode($popup_request_data);
100
-		$this->ss->assign('encoded_popup_request_data', $encoded_popup_request_data);        
99
+        $encoded_popup_request_data = $json->encode($popup_request_data);
100
+        $this->ss->assign('encoded_popup_request_data', $encoded_popup_request_data);        
101 101
 
102 102
         
103 103
     }   
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
   
56 56
         $this->ss->assign("SALUTATION_OPTIONS", get_select_options_with_id($app_list_strings['salutation_dom'], ''));
57 57
 
58
-        if($this->viaAJAX) { // override for ajax call
58
+        if ($this->viaAJAX) { // override for ajax call
59 59
             $this->ss->assign('saveOnclick', "onclick='if(check_form(\"contactsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"contacts\"); else return false;'");
60 60
             $this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_contacts\")';");
61 61
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/ProjectTask/MyProjectTasks.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -59,19 +59,19 @@
 block discarded – undo
59 59
 $ListView = new ListView();
60 60
 $seedProjectTask = new ProjectTask();
61 61
 $where = "project_task.assigned_user_id='{$current_user->id}'"
62
-	. " AND (project_task.status IS NULL OR (project_task.status!='Completed' AND project_task.status!='Deferred'))"
63
-	. " AND (project_task.date_start IS NULL OR project_task.date_start <= '$today')";
62
+    . " AND (project_task.status IS NULL OR (project_task.status!='Completed' AND project_task.status!='Deferred'))"
63
+    . " AND (project_task.date_start IS NULL OR project_task.date_start <= '$today')";
64 64
 $ListView->initNewXTemplate('modules/ProjectTask/MyProjectTasks.html',
65
-	$current_module_strings);
65
+    $current_module_strings);
66 66
 $header_text = '';
67 67
 
68 68
 if(is_admin($current_user)
69
-	&& $_REQUEST['module'] != 'DynamicLayout'
70
-	&& !empty($_SESSION['editinplace']))
69
+    && $_REQUEST['module'] != 'DynamicLayout'
70
+    && !empty($_SESSION['editinplace']))
71 71
 {	
72
-	$header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&from_action=MyTasks&from_module=Tasks'>"
73
-		. SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDITLAYOUT'])
74
-		. '</a>';
72
+    $header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&from_action=MyTasks&from_module=Tasks'>"
73
+        . SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDITLAYOUT'])
74
+        . '</a>';
75 75
 }
76 76
 $ListView->setHeaderTitle($current_module_strings['LBL_LIST_MY_PROJECT_TASKS'].$header_text);
77 77
 $ListView->setQuery($where, "", "date_due,priority desc", "PROJECT_TASK");
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	$current_module_strings);
66 66
 $header_text = '';
67 67
 
68
-if(is_admin($current_user)
68
+if (is_admin($current_user)
69 69
 	&& $_REQUEST['module'] != 'DynamicLayout'
70 70
 	&& !empty($_SESSION['editinplace']))
71 71
 {	
72 72
 	$header_text = "&nbsp;<a href='index.php?action=index&module=DynamicLayout&from_action=MyTasks&from_module=Tasks'>"
73
-		. SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDITLAYOUT'])
73
+		. SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDITLAYOUT'])
74 74
 		. '</a>';
75 75
 }
76 76
 $ListView->setHeaderTitle($current_module_strings['LBL_LIST_MY_PROJECT_TASKS'].$header_text);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/ProjectTask/metadata/additionalDetails.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -42,31 +42,31 @@
 block discarded – undo
42 42
 
43 43
 
44 44
 function additionalDetailsProjectTask($fields) {
45
-	static $mod_strings;
46
-	if(empty($mod_strings)) {
47
-		global $current_language;
48
-		$mod_strings = return_module_language($current_language, 'ProjectTask');
49
-	}
45
+    static $mod_strings;
46
+    if(empty($mod_strings)) {
47
+        global $current_language;
48
+        $mod_strings = return_module_language($current_language, 'ProjectTask');
49
+    }
50 50
 		
51
-	$overlib_string = '';
52
-	if(!empty($fields['PRIORITY'])) $overlib_string .= '<b>' . $mod_strings['LBL_PRIORITY'] . '</b> ' . $fields['PRIORITY'] . '<br>';
53
-	if(!empty($fields['PERCENT_COMPLETE'])) $overlib_string .= '<b>' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</b> ' . $fields['PERCENT_COMPLETE'] . '%<br>';	
54
-	if(!empty($fields['ESTIMATED_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ESTIMATED_EFFORT'] . '</b> ' . $fields['ESTIMATED_EFFORT'] . '<br>';	
55
-	if(!empty($fields['ACTUAL_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ACTUAL_EFFORT'] . '</b> ' . $fields['ACTUAL_EFFORT'] . '<br>';
56
-	if(!empty($fields['TASK_NUMBER'])) $overlib_string .= '<b>' . $mod_strings['LBL_TASK_NUMBER'] . '</b> ' . $fields['TASK_NUMBER'] . '<br>';
57
-	if(!empty($fields['DATE_START'])) $overlib_string .= '<b>' . $mod_strings['LBL_DATE_START'] . '</b> ' . $fields['DATE_START'] . ' ' . $fields['TIME_START'] . '<br>';
51
+    $overlib_string = '';
52
+    if(!empty($fields['PRIORITY'])) $overlib_string .= '<b>' . $mod_strings['LBL_PRIORITY'] . '</b> ' . $fields['PRIORITY'] . '<br>';
53
+    if(!empty($fields['PERCENT_COMPLETE'])) $overlib_string .= '<b>' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</b> ' . $fields['PERCENT_COMPLETE'] . '%<br>';	
54
+    if(!empty($fields['ESTIMATED_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ESTIMATED_EFFORT'] . '</b> ' . $fields['ESTIMATED_EFFORT'] . '<br>';	
55
+    if(!empty($fields['ACTUAL_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ACTUAL_EFFORT'] . '</b> ' . $fields['ACTUAL_EFFORT'] . '<br>';
56
+    if(!empty($fields['TASK_NUMBER'])) $overlib_string .= '<b>' . $mod_strings['LBL_TASK_NUMBER'] . '</b> ' . $fields['TASK_NUMBER'] . '<br>';
57
+    if(!empty($fields['DATE_START'])) $overlib_string .= '<b>' . $mod_strings['LBL_DATE_START'] . '</b> ' . $fields['DATE_START'] . ' ' . $fields['TIME_START'] . '<br>';
58 58
 		
59
-	if(!empty($fields['DESCRIPTION'])) {
60
-		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
61
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
62
-	}	
59
+    if(!empty($fields['DESCRIPTION'])) {
60
+        $overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
61
+        if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
62
+    }	
63 63
 
64
-	return array('fieldToAddTo' => 'NAME', 
65
-				 'string' => $overlib_string, 
66
-				 'editLink' => "index.php?action=EditView&module=ProjectTask&return_module=ProjectTask&record={$fields['ID']}", 
67
-				 'viewLink' => "index.php?action=DetailView&module=ProjectTask&return_module=ProjectTask&record={$fields['ID']}");
64
+    return array('fieldToAddTo' => 'NAME', 
65
+                    'string' => $overlib_string, 
66
+                    'editLink' => "index.php?action=EditView&module=ProjectTask&return_module=ProjectTask&record={$fields['ID']}", 
67
+                    'viewLink' => "index.php?action=DetailView&module=ProjectTask&return_module=ProjectTask&record={$fields['ID']}");
68 68
 }
69 69
  
70
- ?>
70
+    ?>
71 71
  
72 72
  
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
 
44 44
 function additionalDetailsProjectTask($fields) {
45 45
 	static $mod_strings;
46
-	if(empty($mod_strings)) {
46
+	if (empty($mod_strings)) {
47 47
 		global $current_language;
48 48
 		$mod_strings = return_module_language($current_language, 'ProjectTask');
49 49
 	}
50 50
 		
51 51
 	$overlib_string = '';
52
-	if(!empty($fields['PRIORITY'])) $overlib_string .= '<b>' . $mod_strings['LBL_PRIORITY'] . '</b> ' . $fields['PRIORITY'] . '<br>';
53
-	if(!empty($fields['PERCENT_COMPLETE'])) $overlib_string .= '<b>' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</b> ' . $fields['PERCENT_COMPLETE'] . '%<br>';	
54
-	if(!empty($fields['ESTIMATED_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ESTIMATED_EFFORT'] . '</b> ' . $fields['ESTIMATED_EFFORT'] . '<br>';	
55
-	if(!empty($fields['ACTUAL_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ACTUAL_EFFORT'] . '</b> ' . $fields['ACTUAL_EFFORT'] . '<br>';
56
-	if(!empty($fields['TASK_NUMBER'])) $overlib_string .= '<b>' . $mod_strings['LBL_TASK_NUMBER'] . '</b> ' . $fields['TASK_NUMBER'] . '<br>';
57
-	if(!empty($fields['DATE_START'])) $overlib_string .= '<b>' . $mod_strings['LBL_DATE_START'] . '</b> ' . $fields['DATE_START'] . ' ' . $fields['TIME_START'] . '<br>';
52
+	if (!empty($fields['PRIORITY'])) $overlib_string .= '<b>'.$mod_strings['LBL_PRIORITY'].'</b> '.$fields['PRIORITY'].'<br>';
53
+	if (!empty($fields['PERCENT_COMPLETE'])) $overlib_string .= '<b>'.$mod_strings['LBL_PERCENT_COMPLETE'].'</b> '.$fields['PERCENT_COMPLETE'].'%<br>';	
54
+	if (!empty($fields['ESTIMATED_EFFORT'])) $overlib_string .= '<b>'.$mod_strings['LBL_ESTIMATED_EFFORT'].'</b> '.$fields['ESTIMATED_EFFORT'].'<br>';	
55
+	if (!empty($fields['ACTUAL_EFFORT'])) $overlib_string .= '<b>'.$mod_strings['LBL_ACTUAL_EFFORT'].'</b> '.$fields['ACTUAL_EFFORT'].'<br>';
56
+	if (!empty($fields['TASK_NUMBER'])) $overlib_string .= '<b>'.$mod_strings['LBL_TASK_NUMBER'].'</b> '.$fields['TASK_NUMBER'].'<br>';
57
+	if (!empty($fields['DATE_START'])) $overlib_string .= '<b>'.$mod_strings['LBL_DATE_START'].'</b> '.$fields['DATE_START'].' '.$fields['TIME_START'].'<br>';
58 58
 		
59
-	if(!empty($fields['DESCRIPTION'])) {
60
-		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
61
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
59
+	if (!empty($fields['DESCRIPTION'])) {
60
+		$overlib_string .= '<b>'.$mod_strings['LBL_DESCRIPTION'].'</b> '.substr($fields['DESCRIPTION'], 0, 300);
61
+		if (strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
62 62
 	}	
63 63
 
64 64
 	return array('fieldToAddTo' => 'NAME', 
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -49,16 +51,30 @@  discard block
 block discarded – undo
49 51
 	}
50 52
 		
51 53
 	$overlib_string = '';
52
-	if(!empty($fields['PRIORITY'])) $overlib_string .= '<b>' . $mod_strings['LBL_PRIORITY'] . '</b> ' . $fields['PRIORITY'] . '<br>';
53
-	if(!empty($fields['PERCENT_COMPLETE'])) $overlib_string .= '<b>' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</b> ' . $fields['PERCENT_COMPLETE'] . '%<br>';	
54
-	if(!empty($fields['ESTIMATED_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ESTIMATED_EFFORT'] . '</b> ' . $fields['ESTIMATED_EFFORT'] . '<br>';	
55
-	if(!empty($fields['ACTUAL_EFFORT'])) $overlib_string .= '<b>' . $mod_strings['LBL_ACTUAL_EFFORT'] . '</b> ' . $fields['ACTUAL_EFFORT'] . '<br>';
56
-	if(!empty($fields['TASK_NUMBER'])) $overlib_string .= '<b>' . $mod_strings['LBL_TASK_NUMBER'] . '</b> ' . $fields['TASK_NUMBER'] . '<br>';
57
-	if(!empty($fields['DATE_START'])) $overlib_string .= '<b>' . $mod_strings['LBL_DATE_START'] . '</b> ' . $fields['DATE_START'] . ' ' . $fields['TIME_START'] . '<br>';
54
+	if(!empty($fields['PRIORITY'])) {
55
+	    $overlib_string .= '<b>' . $mod_strings['LBL_PRIORITY'] . '</b> ' . $fields['PRIORITY'] . '<br>';
56
+	}
57
+	if(!empty($fields['PERCENT_COMPLETE'])) {
58
+	    $overlib_string .= '<b>' . $mod_strings['LBL_PERCENT_COMPLETE'] . '</b> ' . $fields['PERCENT_COMPLETE'] . '%<br>';
59
+	}
60
+	if(!empty($fields['ESTIMATED_EFFORT'])) {
61
+	    $overlib_string .= '<b>' . $mod_strings['LBL_ESTIMATED_EFFORT'] . '</b> ' . $fields['ESTIMATED_EFFORT'] . '<br>';
62
+	}
63
+	if(!empty($fields['ACTUAL_EFFORT'])) {
64
+	    $overlib_string .= '<b>' . $mod_strings['LBL_ACTUAL_EFFORT'] . '</b> ' . $fields['ACTUAL_EFFORT'] . '<br>';
65
+	}
66
+	if(!empty($fields['TASK_NUMBER'])) {
67
+	    $overlib_string .= '<b>' . $mod_strings['LBL_TASK_NUMBER'] . '</b> ' . $fields['TASK_NUMBER'] . '<br>';
68
+	}
69
+	if(!empty($fields['DATE_START'])) {
70
+	    $overlib_string .= '<b>' . $mod_strings['LBL_DATE_START'] . '</b> ' . $fields['DATE_START'] . ' ' . $fields['TIME_START'] . '<br>';
71
+	}
58 72
 		
59 73
 	if(!empty($fields['DESCRIPTION'])) {
60 74
 		$overlib_string .= '<b>'. $mod_strings['LBL_DESCRIPTION'] . '</b> ' . substr($fields['DESCRIPTION'], 0, 300);
61
-		if(strlen($fields['DESCRIPTION']) > 300) $overlib_string .= '...';
75
+		if(strlen($fields['DESCRIPTION']) > 300) {
76
+		    $overlib_string .= '...';
77
+		}
62 78
 	}	
63 79
 
64 80
 	return array('fieldToAddTo' => 'NAME', 
Please login to merge, or discard this patch.