@@ -16,9 +16,9 @@ |
||
| 16 | 16 | /** |
| 17 | 17 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 18 | 18 | */ |
| 19 | - function ProspectsJjwg_MapsLogicHook(){ |
|
| 19 | + function ProspectsJjwg_MapsLogicHook() { |
|
| 20 | 20 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 21 | - if(isset($GLOBALS['log'])) { |
|
| 21 | + if (isset($GLOBALS['log'])) { |
|
| 22 | 22 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 23 | 23 | } |
| 24 | 24 | else { |
@@ -1,7 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('sugarEntry') || !sugarEntry) |
|
| 3 | +if (!defined('sugarEntry') || !sugarEntry) { |
|
| 4 | 4 | die('Not A Valid Entry Point'); |
| 5 | +} |
|
| 5 | 6 | |
| 6 | 7 | class OpportunitiesJjwg_MapsLogicHook { |
| 7 | 8 | |
@@ -17,8 +18,7 @@ discard block |
||
| 17 | 18 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 18 | 19 | if(isset($GLOBALS['log'])) { |
| 19 | 20 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 20 | - } |
|
| 21 | - else { |
|
| 21 | + } else { |
|
| 22 | 22 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 23 | 23 | } |
| 24 | 24 | self::__construct(); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | var $object_name = 'AM_ProjectTemplates'; |
| 48 | 48 | var $table_name = 'am_projecttemplates'; |
| 49 | 49 | var $importable = false; |
| 50 | - var $disable_row_level_security = true ; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO |
|
| 50 | + var $disable_row_level_security = true; // to ensure that modules created and deployed under CE will continue to function under team security if the instance is upgraded to PRO |
|
| 51 | 51 | var $id; |
| 52 | 52 | var $name; |
| 53 | 53 | var $date_entered; |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | var $status; |
| 67 | 67 | var $priority; |
| 68 | 68 | |
| 69 | - public function __construct(){ |
|
| 69 | + public function __construct() { |
|
| 70 | 70 | parent::__construct(); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 75 | 75 | */ |
| 76 | - public function AM_ProjectTemplates_sugar(){ |
|
| 76 | + public function AM_ProjectTemplates_sugar() { |
|
| 77 | 77 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 78 | - if(isset($GLOBALS['log'])) { |
|
| 78 | + if (isset($GLOBALS['log'])) { |
|
| 79 | 79 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 80 | 80 | } |
| 81 | 81 | else { |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | - function bean_implements($interface){ |
|
| 89 | - switch($interface){ |
|
| 88 | + function bean_implements($interface) { |
|
| 89 | + switch ($interface) { |
|
| 90 | 90 | case 'ACL': return true; |
| 91 | 91 | } |
| 92 | 92 | return false; |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -40,16 +40,16 @@ |
||
| 40 | 40 | require_once('modules/AM_ProjectTemplates/AM_ProjectTemplates_sugar.php'); |
| 41 | 41 | class AM_ProjectTemplates extends AM_ProjectTemplates_sugar { |
| 42 | 42 | |
| 43 | - public function __construct(){ |
|
| 43 | + public function __construct() { |
|
| 44 | 44 | parent::__construct(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 49 | 49 | */ |
| 50 | - public function AM_ProjectTemplates(){ |
|
| 50 | + public function AM_ProjectTemplates() { |
|
| 51 | 51 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 52 | - if(isset($GLOBALS['log'])) { |
|
| 52 | + if (isset($GLOBALS['log'])) { |
|
| 53 | 53 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 54 | 54 | } |
| 55 | 55 | else { |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | require_once('modules/AM_TaskTemplates/AM_TaskTemplates_sugar.php'); |
| 41 | 41 | class AM_TaskTemplates extends AM_TaskTemplates_sugar { |
| 42 | 42 | |
| 43 | - public function __construct(){ |
|
| 44 | - parent::__construct(); |
|
| 45 | - } |
|
| 43 | + public function __construct(){ |
|
| 44 | + parent::__construct(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -92,9 +92,9 @@ |
||
| 92 | 92 | /** |
| 93 | 93 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 94 | 94 | */ |
| 95 | - function AOS_Products_Quotes_sugar(){ |
|
| 95 | + function AOS_Products_Quotes_sugar() { |
|
| 96 | 96 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 97 | - if(isset($GLOBALS['log'])) { |
|
| 97 | + if (isset($GLOBALS['log'])) { |
|
| 98 | 98 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 99 | 99 | } |
| 100 | 100 | else { |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 53 | 53 | */ |
| 54 | - function AOS_Products_Quotes(){ |
|
| 54 | + function AOS_Products_Quotes() { |
|
| 55 | 55 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 56 | - if(isset($GLOBALS['log'])) { |
|
| 56 | + if (isset($GLOBALS['log'])) { |
|
| 57 | 57 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 58 | 58 | } |
| 59 | 59 | else { |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | function save_lines($post_data, $parent, $groups = array(), $key = '') |
| 67 | 67 | { |
| 68 | 68 | |
| 69 | - $line_count = isset($post_data[$key . 'name']) ? count($post_data[$key . 'name']) : 0; |
|
| 69 | + $line_count = isset($post_data[$key.'name']) ? count($post_data[$key.'name']) : 0; |
|
| 70 | 70 | $j = 0; |
| 71 | 71 | for ($i = 0; $i < $line_count; ++$i) { |
| 72 | 72 | |
| 73 | - if ($post_data[$key . 'deleted'][$i] == 1) { |
|
| 74 | - $this->mark_deleted($post_data[$key . 'id'][$i]); |
|
| 73 | + if ($post_data[$key.'deleted'][$i] == 1) { |
|
| 74 | + $this->mark_deleted($post_data[$key.'id'][$i]); |
|
| 75 | 75 | } else { |
| 76 | 76 | $product_quote = new AOS_Products_Quotes(); |
| 77 | 77 | foreach ($this->field_defs as $field_def) { |
| 78 | 78 | $field_name = $field_def['name']; |
| 79 | - if (isset($post_data[$key . $field_name][$i])) { |
|
| 80 | - $product_quote->$field_name = $post_data[$key . $field_name][$i]; |
|
| 79 | + if (isset($post_data[$key.$field_name][$i])) { |
|
| 80 | + $product_quote->$field_name = $post_data[$key.$field_name][$i]; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - if (isset($post_data[$key . 'group_number'][$i])) { |
|
| 84 | - $product_quote->group_id = $groups[$post_data[$key . 'group_number'][$i]]; |
|
| 83 | + if (isset($post_data[$key.'group_number'][$i])) { |
|
| 84 | + $product_quote->group_id = $groups[$post_data[$key.'group_number'][$i]]; |
|
| 85 | 85 | } |
| 86 | 86 | if (trim($product_quote->product_id) != '' && trim($product_quote->name) != '' && trim($product_quote->product_unit_price) != '') { |
| 87 | 87 | $product_quote->number = ++$j; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $product_quote->currency_id = $parent->currency_id; |
| 91 | 91 | $product_quote->parent_type = $parent->object_name; |
| 92 | 92 | $product_quote->save(); |
| 93 | - $_POST[$key . 'id'][$i] = $product_quote->id; |
|
| 93 | + $_POST[$key.'id'][$i] = $product_quote->id; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -4,16 +4,16 @@ discard block |
||
| 4 | 4 | class SecurityGroup extends SecurityGroup_sugar { |
| 5 | 5 | |
| 6 | 6 | |
| 7 | - public function __construct(){ |
|
| 7 | + public function __construct() { |
|
| 8 | 8 | parent::__construct(); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 13 | 13 | */ |
| 14 | - public function SecurityGroup(){ |
|
| 14 | + public function SecurityGroup() { |
|
| 15 | 15 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 16 | - if(isset($GLOBALS['log'])) { |
|
| 16 | + if (isset($GLOBALS['log'])) { |
|
| 17 | 17 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 18 | 18 | } |
| 19 | 19 | else { |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | * @param GUID $user_id |
| 35 | 35 | * @return STRING |
| 36 | 36 | */ |
| 37 | - function getGroupWhere($table_name,$module,$user_id) |
|
| 37 | + function getGroupWhere($table_name, $module, $user_id) |
|
| 38 | 38 | { |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | //need a different query if doing a securitygroups check |
| 42 | - if($module == "SecurityGroups") { |
|
| 42 | + if ($module == "SecurityGroups") { |
|
| 43 | 43 | return " $table_name.id in ( |
| 44 | 44 | select secg.id from securitygroups secg |
| 45 | 45 | inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0 |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | * @param GUID $user_id |
| 106 | 106 | * @return STRING |
| 107 | 107 | */ |
| 108 | - function getGroupJoin($table_name,$module,$user_id) |
|
| 108 | + function getGroupJoin($table_name, $module, $user_id) |
|
| 109 | 109 | { |
| 110 | 110 | |
| 111 | 111 | //need a different query if doing a securitygroups check |
| 112 | - if($module == "SecurityGroups") { |
|
| 112 | + if ($module == "SecurityGroups") { |
|
| 113 | 113 | return " LEFT JOIN (select distinct secg.id from securitygroups secg |
| 114 | 114 | inner join securitygroups_users secu on secg.id = secu.securitygroup_id and secu.deleted = 0 |
| 115 | 115 | and secu.user_id = '".$user_id."' |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | /** |
| 148 | 148 | * @returns true if group is assigned to the record |
| 149 | 149 | */ |
| 150 | - static function groupHasAccess($module,$id, $action = '') |
|
| 150 | + static function groupHasAccess($module, $id, $action = '') |
|
| 151 | 151 | { |
| 152 | - if(!isset($id) || $id == '[SELECT_ID_LIST]') |
|
| 152 | + if (!isset($id) || $id == '[SELECT_ID_LIST]') |
|
| 153 | 153 | { |
| 154 | 154 | return true; //means that this is a listview and everybody is an owner of the listview |
| 155 | 155 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | ."inner join securitygroups_records on securitygroups.id = securitygroups_records.securitygroup_id and securitygroups_records.deleted = 0 " |
| 164 | 164 | ." and securitygroups_records.record_id = '$id' " |
| 165 | 165 | ." and securitygroups_records.module = '$module' "; |
| 166 | - if(!empty($action) && isset($sugar_config['securitysuite_strict_rights']) && $sugar_config['securitysuite_strict_rights'] == true) { |
|
| 166 | + if (!empty($action) && isset($sugar_config['securitysuite_strict_rights']) && $sugar_config['securitysuite_strict_rights'] == true) { |
|
| 167 | 167 | $query .= " inner join securitygroups_acl_roles on securitygroups.id = securitygroups_acl_roles.securitygroup_id and securitygroups_acl_roles.deleted = 0" |
| 168 | 168 | ." inner join acl_roles_actions on securitygroups_acl_roles.role_id = acl_roles_actions.role_id and acl_roles_actions.deleted = 0 " |
| 169 | 169 | ." inner join acl_actions on acl_actions.id = acl_roles_actions.action_id and acl_actions.deleted = 0 " |
@@ -172,28 +172,28 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | $query .= "where securitygroups.deleted = 0 "; |
| 174 | 174 | |
| 175 | - if(!empty($action) && isset($sugar_config['securitysuite_strict_rights']) && $sugar_config['securitysuite_strict_rights'] == true) { |
|
| 175 | + if (!empty($action) && isset($sugar_config['securitysuite_strict_rights']) && $sugar_config['securitysuite_strict_rights'] == true) { |
|
| 176 | 176 | $query .= " and acl_roles_actions.access_override = 80 "; |
| 177 | 177 | } |
| 178 | 178 | $GLOBALS['log']->debug("SecuritySuite: groupHasAccess $query"); |
| 179 | 179 | $result = $db->query($query); |
| 180 | 180 | $row = $db->fetchByAssoc($result); |
| 181 | - if(isset($row) && $row['results']>0) return true; |
|
| 181 | + if (isset($row) && $row['results'] > 0) return true; |
|
| 182 | 182 | |
| 183 | 183 | return false; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - static function inherit(&$focus,$isUpdate) |
|
| 186 | + static function inherit(&$focus, $isUpdate) |
|
| 187 | 187 | { |
| 188 | 188 | global $sugar_config; |
| 189 | - SecurityGroup::assign_default_groups($focus,$isUpdate); //this must be first because it does not check for dups |
|
| 189 | + SecurityGroup::assign_default_groups($focus, $isUpdate); //this must be first because it does not check for dups |
|
| 190 | 190 | |
| 191 | - SecurityGroup::inherit_assigned($focus,$isUpdate); |
|
| 192 | - SecurityGroup::inherit_parent($focus,$isUpdate); |
|
| 191 | + SecurityGroup::inherit_assigned($focus, $isUpdate); |
|
| 192 | + SecurityGroup::inherit_parent($focus, $isUpdate); |
|
| 193 | 193 | |
| 194 | 194 | //don't do creator inheritance if popup selector method is chosen and a user is making the request... |
| 195 | 195 | //don't if saving from a popup (subpanel_field_name check. Save2 is the action but to be safe use the subpanel check) |
| 196 | - if( |
|
| 196 | + if ( |
|
| 197 | 197 | (isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true |
| 198 | 198 | && isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save') |
| 199 | 199 | || (!empty($_REQUEST['subpanel_field_name'])) |
@@ -202,64 +202,64 @@ discard block |
||
| 202 | 202 | //Otherwise, this is taken on the edit view on create now |
| 203 | 203 | $groupFocus = new SecurityGroup(); |
| 204 | 204 | $security_modules = $groupFocus->getSecurityModules(); |
| 205 | - if(in_array($focus->module_dir,array_keys($security_modules))) { |
|
| 205 | + if (in_array($focus->module_dir, array_keys($security_modules))) { |
|
| 206 | 206 | //check if user is in more than 1 group. If so then set the session var otherwise inherit it's only group |
| 207 | 207 | global $current_user; |
| 208 | 208 | |
| 209 | 209 | $memberships = $groupFocus->getMembershipCount($current_user->id); |
| 210 | - if($memberships > 1) { |
|
| 210 | + if ($memberships > 1) { |
|
| 211 | 211 | return; |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | - SecurityGroup::inherit_creator($focus,$isUpdate); |
|
| 215 | + SecurityGroup::inherit_creator($focus, $isUpdate); |
|
| 216 | 216 | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - static function assign_default_groups(&$focus,$isUpdate) |
|
| 219 | + static function assign_default_groups(&$focus, $isUpdate) |
|
| 220 | 220 | { |
| 221 | 221 | global $sugar_config; |
| 222 | 222 | global $current_user; |
| 223 | - if(!$isUpdate) { |
|
| 223 | + if (!$isUpdate) { |
|
| 224 | 224 | //inherit only for those that support Security Groups |
| 225 | 225 | $groupFocus = new SecurityGroup(); |
| 226 | 226 | $security_modules = $groupFocus->getSecurityModules(); |
| 227 | - if(!in_array($focus->module_dir,array_keys($security_modules))) { |
|
| 227 | + if (!in_array($focus->module_dir, array_keys($security_modules))) { |
|
| 228 | 228 | return; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | $defaultGroups = $groupFocus->retrieveDefaultGroups(); |
| 232 | - foreach($defaultGroups as $default_id => $defaultGroup) { |
|
| 232 | + foreach ($defaultGroups as $default_id => $defaultGroup) { |
|
| 233 | 233 | |
| 234 | - if($defaultGroup['module'] == "All" || $defaultGroup['module'] == $focus->module_dir) { |
|
| 235 | - if($focus->module_dir == "Users") { |
|
| 234 | + if ($defaultGroup['module'] == "All" || $defaultGroup['module'] == $focus->module_dir) { |
|
| 235 | + if ($focus->module_dir == "Users") { |
|
| 236 | 236 | $query = "insert into securitygroups_users(id,date_modified,deleted,securitygroup_id,user_id,noninheritable) " |
| 237 | - ."select distinct '".create_guid()."',".db_convert('','today').",0,g.id,'$focus->id',1 " |
|
| 237 | + ."select distinct '".create_guid()."',".db_convert('', 'today').",0,g.id,'$focus->id',1 " |
|
| 238 | 238 | ."from securitygroups g " |
| 239 | 239 | ."left join securitygroups_users d on d.securitygroup_id = g.id and d.user_id = '$focus->id' and d.deleted = 0 " |
| 240 | 240 | ."where d.id is null and g.id = '".$defaultGroup['securitygroup_id']."' and g.deleted = 0 "; |
| 241 | 241 | } else { |
| 242 | 242 | $query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " |
| 243 | - ."select distinct '".create_guid()."',g.id,'$focus->id','$focus->module_dir',".db_convert('','today').",0 " |
|
| 243 | + ."select distinct '".create_guid()."',g.id,'$focus->id','$focus->module_dir',".db_convert('', 'today').",0 " |
|
| 244 | 244 | ."from securitygroups g " |
| 245 | 245 | ."left join securitygroups_records d on d.securitygroup_id = g.id and d.record_id = '$focus->id' and d.module = '$focus->module_dir' and d.deleted = 0 " |
| 246 | 246 | ."where d.id is null and g.id = '".$defaultGroup['securitygroup_id']."' and g.deleted = 0 "; |
| 247 | 247 | } |
| 248 | 248 | $GLOBALS['log']->debug("SecuritySuite: Assign Default Groups: $query"); |
| 249 | - $focus->db->query($query,true); |
|
| 249 | + $focus->db->query($query, true); |
|
| 250 | 250 | } |
| 251 | 251 | } //end foreach default group |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - static function inherit_creator(&$focus,$isUpdate) |
|
| 256 | + static function inherit_creator(&$focus, $isUpdate) |
|
| 257 | 257 | { |
| 258 | 258 | global $sugar_config; |
| 259 | 259 | global $current_user; |
| 260 | - if(!$isUpdate && isset($sugar_config['securitysuite_inherit_creator']) && $sugar_config['securitysuite_inherit_creator'] == true) { |
|
| 260 | + if (!$isUpdate && isset($sugar_config['securitysuite_inherit_creator']) && $sugar_config['securitysuite_inherit_creator'] == true) { |
|
| 261 | 261 | |
| 262 | - if(isset($_SESSION['portal_id']) && isset($_SESSION['user_id'])) { |
|
| 262 | + if (isset($_SESSION['portal_id']) && isset($_SESSION['user_id'])) { |
|
| 263 | 263 | return; //don't inherit if from portal |
| 264 | 264 | } |
| 265 | 265 | |
@@ -267,73 +267,73 @@ discard block |
||
| 267 | 267 | $groupFocus = new SecurityGroup(); |
| 268 | 268 | $security_modules = $groupFocus->getSecurityModules(); |
| 269 | 269 | //if(in_array($focus->module_dir,$security_modules)) { |
| 270 | - if(in_array($focus->module_dir,array_keys($security_modules))) {//rost fix2 |
|
| 270 | + if (in_array($focus->module_dir, array_keys($security_modules))) {//rost fix2 |
|
| 271 | 271 | |
| 272 | 272 | //test to see if works for creating a note for a case from the portal...this may need to be handled slightly differently |
| 273 | 273 | //inherits portal users groups? Could be an interesting twist... |
| 274 | 274 | $query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " |
| 275 | 275 | ."select distinct "; |
| 276 | - if($focus->db->dbType == 'mysql') { |
|
| 276 | + if ($focus->db->dbType == 'mysql') { |
|
| 277 | 277 | $query .= " uuid() "; |
| 278 | - } else if($focus->db->dbType == 'mssql') { |
|
| 278 | + } else if ($focus->db->dbType == 'mssql') { |
|
| 279 | 279 | $query .= " lower(newid()) "; |
| 280 | 280 | } |
| 281 | 281 | $currentUserId = isset($current_user->id) ? $current_user->id : null; |
| 282 | - $query .= ",u.securitygroup_id,'$focus->id','$focus->module_dir',".db_convert('','today').",0 " |
|
| 282 | + $query .= ",u.securitygroup_id,'$focus->id','$focus->module_dir',".db_convert('', 'today').",0 " |
|
| 283 | 283 | ."from securitygroups_users u " |
| 284 | 284 | ."inner join securitygroups g on u.securitygroup_id = g.id and g.deleted = 0 and (g.noninheritable is null or g.noninheritable <> 1) " |
| 285 | 285 | ."left join securitygroups_records d on d.securitygroup_id = u.securitygroup_id and d.record_id = '$focus->id' and d.module = '$focus->module_dir' and d.deleted = 0 " |
| 286 | 286 | ."where d.id is null and u.user_id = '$currentUserId' and u.deleted = 0 and (u.noninheritable is null or u.noninheritable <> 1)"; |
| 287 | 287 | $GLOBALS['log']->debug("SecuritySuite: Inherit from Creator: $query"); |
| 288 | - $focus->db->query($query,true); |
|
| 288 | + $focus->db->query($query, true); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - static function inherit_assigned(&$focus,$isUpdate) |
|
| 294 | + static function inherit_assigned(&$focus, $isUpdate) |
|
| 295 | 295 | { |
| 296 | 296 | global $sugar_config; |
| 297 | 297 | global $current_user; |
| 298 | - if(isset($sugar_config['securitysuite_inherit_assigned']) && $sugar_config['securitysuite_inherit_assigned'] == true) { |
|
| 298 | + if (isset($sugar_config['securitysuite_inherit_assigned']) && $sugar_config['securitysuite_inherit_assigned'] == true) { |
|
| 299 | 299 | |
| 300 | - if(!empty($focus->assigned_user_id)) { |
|
| 300 | + if (!empty($focus->assigned_user_id)) { |
|
| 301 | 301 | $assigned_user_id = $focus->assigned_user_id; |
| 302 | 302 | //inherit only for those that support Security Groups |
| 303 | 303 | $groupFocus = new SecurityGroup(); |
| 304 | 304 | $security_modules = $groupFocus->getSecurityModules(); |
| 305 | 305 | //if(in_array($focus->module_dir,$security_modules)) { |
| 306 | - if(in_array($focus->module_dir,array_keys($security_modules))) {//rost fix2 |
|
| 306 | + if (in_array($focus->module_dir, array_keys($security_modules))) {//rost fix2 |
|
| 307 | 307 | |
| 308 | 308 | //test to see if works for creating a note for a case from the portal...this may need to be handled slightly differently |
| 309 | 309 | //inherits portal users groups? Could be an interesting twist... |
| 310 | 310 | $query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " |
| 311 | 311 | ."select distinct "; |
| 312 | - if($focus->db->dbType == 'mysql') { |
|
| 312 | + if ($focus->db->dbType == 'mysql') { |
|
| 313 | 313 | $query .= " uuid() "; |
| 314 | - } else if($focus->db->dbType == 'mssql') { |
|
| 314 | + } else if ($focus->db->dbType == 'mssql') { |
|
| 315 | 315 | $query .= " lower(newid()) "; |
| 316 | 316 | } |
| 317 | - $query .= ",u.securitygroup_id,'$focus->id','$focus->module_dir',".db_convert('','today').",0 " |
|
| 317 | + $query .= ",u.securitygroup_id,'$focus->id','$focus->module_dir',".db_convert('', 'today').",0 " |
|
| 318 | 318 | ."from securitygroups_users u " |
| 319 | 319 | ."inner join securitygroups g on u.securitygroup_id = g.id and g.deleted = 0 and (g.noninheritable is null or g.noninheritable <> 1) " |
| 320 | 320 | ."left join securitygroups_records d on d.securitygroup_id = u.securitygroup_id and d.record_id = '$focus->id' and d.module = '$focus->module_dir' and d.deleted = 0 " |
| 321 | 321 | ."where d.id is null and u.user_id = '$assigned_user_id' and u.deleted = 0 and (u.noninheritable is null or u.noninheritable <> 1)"; |
| 322 | 322 | $GLOBALS['log']->debug("SecuritySuite: Inherit from Assigned: $query"); |
| 323 | - $focus->db->query($query,true); |
|
| 323 | + $focus->db->query($query, true); |
|
| 324 | 324 | } |
| 325 | 325 | } //if !empty assigned_user_id |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - static function inherit_parent(&$focus,$isUpdate) |
|
| 330 | + static function inherit_parent(&$focus, $isUpdate) |
|
| 331 | 331 | { |
| 332 | 332 | global $sugar_config; |
| 333 | 333 | //new record or if update from soap api for cases or bugs |
| 334 | 334 | //TEST FOR PORTAL NOTES |
| 335 | 335 | //if((!$isUpdate || ($isUpdate && !empty($focus->note_id) && ($focus->object_name == "Case" || $focus->object_name == "Bug"))) |
| 336 | - if(!$isUpdate |
|
| 336 | + if (!$isUpdate |
|
| 337 | 337 | && isset($sugar_config['securitysuite_inherit_parent']) && $sugar_config['securitysuite_inherit_parent'] == true) { |
| 338 | 338 | |
| 339 | 339 | $focus_module_dir = $focus->module_dir; |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $groupFocus = new SecurityGroup(); |
| 344 | 344 | $security_modules = $groupFocus->getSecurityModules(); |
| 345 | 345 | //if(!in_array($focus_module_dir,$security_modules)) { |
| 346 | - if(!in_array($focus_module_dir,array_keys($security_modules))) {//rost fix2 |
|
| 346 | + if (!in_array($focus_module_dir, array_keys($security_modules))) {//rost fix2 |
|
| 347 | 347 | return; //don't inherit for this module |
| 348 | 348 | } |
| 349 | 349 | |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | $parent_type = ""; |
| 353 | 353 | $parent_id = ""; |
| 354 | 354 | |
| 355 | - if(isset($_REQUEST['relate_to']) && isset($_REQUEST['relate_id'])) { |
|
| 355 | + if (isset($_REQUEST['relate_to']) && isset($_REQUEST['relate_id'])) { |
|
| 356 | 356 | //relate_to is not guaranteed to be a module name anymore. |
| 357 | 357 | //if it isn't load the relationship and find the module name that way |
| 358 | - if(!in_array($_REQUEST['relate_to'],array_keys($security_modules))) { |
|
| 358 | + if (!in_array($_REQUEST['relate_to'], array_keys($security_modules))) { |
|
| 359 | 359 | //check to see if relate_to is the relationship name |
| 360 | 360 | require_once('modules/Relationships/Relationship.php'); |
| 361 | 361 | $rel_module = Relationship::get_other_module($_REQUEST['relate_to'], $focus_module_dir, $focus->db); |
| 362 | - if(isset($rel)) { |
|
| 362 | + if (isset($rel)) { |
|
| 363 | 363 | $parent_type = $rel_module; |
| 364 | 364 | $parent_id = $_REQUEST['relate_id']; |
| 365 | 365 | } |
@@ -369,19 +369,19 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if(isset($_SESSION['portal_id'])) { |
|
| 372 | + if (isset($_SESSION['portal_id'])) { |
|
| 373 | 373 | $parent_id = $_SESSION['user_id']; //soap stores contact id in user_id field |
| 374 | 374 | $parent_type = "Contacts"; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | //from activity type creation |
| 378 | - if((empty($parent_type) || empty($parent_id)) && isset($_REQUEST['parent_type']) && isset($_REQUEST['parent_id'])) { |
|
| 378 | + if ((empty($parent_type) || empty($parent_id)) && isset($_REQUEST['parent_type']) && isset($_REQUEST['parent_id'])) { |
|
| 379 | 379 | $parent_type = $_REQUEST['parent_type']; |
| 380 | 380 | $parent_id = $_REQUEST['parent_id']; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | //full form from subpanel |
| 384 | - if((empty($parent_type) || empty($parent_id)) && isset($_REQUEST['return_module']) && isset($_REQUEST['return_id'])) { |
|
| 384 | + if ((empty($parent_type) || empty($parent_id)) && isset($_REQUEST['return_module']) && isset($_REQUEST['return_id'])) { |
|
| 385 | 385 | $parent_type = $_REQUEST['return_module']; |
| 386 | 386 | $parent_id = $_REQUEST['return_id']; |
| 387 | 387 | } |
@@ -389,17 +389,17 @@ discard block |
||
| 389 | 389 | /** need to find relate fields...for example for Cases look to see if account_id is set */ |
| 390 | 390 | //allow inheritance for all relate field types....iterate through and inherit each related field |
| 391 | 391 | //if(empty($parent_type) || empty($parent_id)) { |
| 392 | - foreach($focus->field_name_map as $name=>$def) { |
|
| 392 | + foreach ($focus->field_name_map as $name=>$def) { |
|
| 393 | 393 | |
| 394 | - if($def['type']=='relate' && isset($def['id_name']) |
|
| 395 | - && isset($def['module']) && strtolower($def['module']) != "users" ) { |
|
| 394 | + if ($def['type'] == 'relate' && isset($def['id_name']) |
|
| 395 | + && isset($def['module']) && strtolower($def['module']) != "users") { |
|
| 396 | 396 | |
| 397 | - if(isset($_REQUEST[$def['id_name']])) { |
|
| 397 | + if (isset($_REQUEST[$def['id_name']])) { |
|
| 398 | 398 | $relate_parent_id = $_REQUEST[$def['id_name']]; |
| 399 | 399 | $relate_parent_type = $def['module']; |
| 400 | 400 | |
| 401 | - SecurityGroup::inherit_parentQuery($focus,$relate_parent_type, $relate_parent_id, $focus_id, $focus_module_dir); |
|
| 402 | - } else if(isset($_SESSION['portal_id']) && isset($_SESSION[$def['id_name']])) { //catch soap account |
|
| 401 | + SecurityGroup::inherit_parentQuery($focus, $relate_parent_type, $relate_parent_id, $focus_id, $focus_module_dir); |
|
| 402 | + } else if (isset($_SESSION['portal_id']) && isset($_SESSION[$def['id_name']])) { //catch soap account |
|
| 403 | 403 | $relate_parent_id = $_SESSION[$def['id_name']]; |
| 404 | 404 | $relate_parent_type = $def['module']; |
| 405 | 405 | |
@@ -409,36 +409,36 @@ discard block |
||
| 409 | 409 | } |
| 410 | 410 | //} |
| 411 | 411 | |
| 412 | - if(!empty($parent_type) && !empty($parent_id)) { // && $parent_type != "Emails" && $parent_type != "Meetings") { |
|
| 412 | + if (!empty($parent_type) && !empty($parent_id)) { // && $parent_type != "Emails" && $parent_type != "Meetings") { |
|
| 413 | 413 | SecurityGroup::inherit_parentQuery($focus, $parent_type, $parent_id, $focus_id, $focus_module_dir); |
| 414 | 414 | } //end if parent type/id |
| 415 | 415 | } //end if new record |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | static function inherit_parentQuery(&$focus, $parent_type, $parent_id, $focus_id, $focus_module_dir) { |
| 419 | - if(empty($parent_type) || empty($parent_id)) return; //no info passed |
|
| 419 | + if (empty($parent_type) || empty($parent_id)) return; //no info passed |
|
| 420 | 420 | |
| 421 | 421 | /** can speed this up by doing one query */ |
| 422 | 422 | //should be just one query but need a unique guid for each insert |
| 423 | 423 | //WE NEED A UNIQUE GUID SO USE THE BUILT IN SQL GUID METHOD |
| 424 | 424 | $query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " |
| 425 | 425 | ."select distinct "; |
| 426 | - if($focus->db->dbType == 'mysql') { |
|
| 426 | + if ($focus->db->dbType == 'mysql') { |
|
| 427 | 427 | $query .= " uuid() "; |
| 428 | - } else if($focus->db->dbType == 'mssql') { |
|
| 428 | + } else if ($focus->db->dbType == 'mssql') { |
|
| 429 | 429 | $query .= " lower(newid()) "; |
| 430 | 430 | } |
| 431 | - $query .= ",r.securitygroup_id,'$focus_id','$focus_module_dir',".db_convert('','today').",0 " |
|
| 431 | + $query .= ",r.securitygroup_id,'$focus_id','$focus_module_dir',".db_convert('', 'today').",0 " |
|
| 432 | 432 | ."from securitygroups_records r " |
| 433 | 433 | ."inner join securitygroups g on r.securitygroup_id = g.id and g.deleted = 0 and (g.noninheritable is null or g.noninheritable <> 1) " |
| 434 | - ."left join securitygroups_records d on d.securitygroup_id = r.securitygroup_id and d.record_id = '" .$focus->db->quote($focus_id) . "' and d.module = '" .$focus->db->quote($focus_module_dir) . "' and d.deleted = 0 " |
|
| 435 | - ."where d.id is null and r.module = '" .$focus->db->quote($parent_type) . "' " |
|
| 436 | - ."and r.record_id = '" .$focus->db->quote($parent_id) ."' " |
|
| 434 | + ."left join securitygroups_records d on d.securitygroup_id = r.securitygroup_id and d.record_id = '".$focus->db->quote($focus_id)."' and d.module = '".$focus->db->quote($focus_module_dir)."' and d.deleted = 0 " |
|
| 435 | + ."where d.id is null and r.module = '".$focus->db->quote($parent_type)."' " |
|
| 436 | + ."and r.record_id = '".$focus->db->quote($parent_id)."' " |
|
| 437 | 437 | ."and r.deleted = 0 "; |
| 438 | 438 | //using left join instead |
| 439 | 439 | //and not exists (select top 1 s.id from securitygroups_records s where s.deleted = 0 and s.record_id = '$focus_id' and s.securitygroup_id = r.securitygroup_id and s.module = '$focus_module_dir') "; |
| 440 | 440 | $GLOBALS['log']->debug("SecuritySuite: Inherit from Parent: $query"); |
| 441 | - $focus->db->query($query,true); |
|
| 441 | + $focus->db->query($query, true); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -458,16 +458,16 @@ discard block |
||
| 458 | 458 | $GLOBALS['log']->debug("SecuritySuite: Inherit One Pre-Check Qualifier: $query"); |
| 459 | 459 | $result = $db->query($query); |
| 460 | 460 | $row = $db->fetchByAssoc($result); |
| 461 | - if(isset($row) && $row['results'] == 1) { |
|
| 461 | + if (isset($row) && $row['results'] == 1) { |
|
| 462 | 462 | |
| 463 | 463 | $query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " |
| 464 | - ."select distinct '".create_guid()."',u.securitygroup_id,'$record_id','$module',".db_convert('','today').",0 " |
|
| 464 | + ."select distinct '".create_guid()."',u.securitygroup_id,'$record_id','$module',".db_convert('', 'today').",0 " |
|
| 465 | 465 | ."from securitygroups_users u " |
| 466 | 466 | ."inner join securitygroups g on u.securitygroup_id = g.id and g.deleted = 0 and (g.noninheritable is null or g.noninheritable <> 1) " |
| 467 | 467 | ."left join securitygroups_records d on d.securitygroup_id = u.securitygroup_id and d.record_id = '$record_id' and d.module = '$module' and d.deleted = 0 " |
| 468 | 468 | ."where d.id is null and u.user_id = '$user_id' and u.deleted = 0 and (u.noninheritable is null or u.noninheritable <> 1)"; |
| 469 | 469 | $GLOBALS['log']->debug("SecuritySuite: Inherit One: $query"); |
| 470 | - $db->query($query,true); |
|
| 470 | + $db->query($query, true); |
|
| 471 | 471 | return true; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | function getMembershipCount($user_id) { |
| 483 | 483 | global $db; |
| 484 | 484 | |
| 485 | - if(!isset($_SESSION['securitygroup_count'])) { |
|
| 485 | + if (!isset($_SESSION['securitygroup_count'])) { |
|
| 486 | 486 | $query = "select count(securitygroups.id) as results from securitygroups " |
| 487 | 487 | ."inner join securitygroups_users on securitygroups.id = securitygroups_users.securitygroup_id " |
| 488 | 488 | ." and securitygroups_users.deleted = 0 " |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | $GLOBALS['log']->debug("SecuritySuite: Inherit One Pre-Check Qualifier: $query"); |
| 493 | 493 | $result = $db->query($query); |
| 494 | 494 | $row = $db->fetchByAssoc($result); |
| 495 | - if(isset($row)) { |
|
| 495 | + if (isset($row)) { |
|
| 496 | 496 | $_SESSION['securitygroup_count'] = $row['results']; |
| 497 | 497 | } |
| 498 | 498 | } |
@@ -510,8 +510,8 @@ discard block |
||
| 510 | 510 | ."where securitygroups_default.deleted = 0 and securitygroups.deleted = 0"; |
| 511 | 511 | $GLOBALS['log']->debug("SecuritySuite: Retrieve Default Groups: $query"); |
| 512 | 512 | $result = $db->query($query); |
| 513 | - while(($row=$db->fetchByAssoc($result)) != null) { |
|
| 514 | - $default_groups[$row['id']] = array('group'=>$row['name'],'module'=>$row['module'],'securitygroup_id'=>$row['securitygroup_id']); |
|
| 513 | + while (($row = $db->fetchByAssoc($result)) != null) { |
|
| 514 | + $default_groups[$row['id']] = array('group'=>$row['name'], 'module'=>$row['module'], 'securitygroup_id'=>$row['securitygroup_id']); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | return $default_groups; |
@@ -520,18 +520,18 @@ discard block |
||
| 520 | 520 | function saveDefaultGroup($group_id, $module) { |
| 521 | 521 | $query = "INSERT INTO securitygroups_default (id, securitygroup_id, module, date_modified, deleted) " |
| 522 | 522 | ."VALUES ( "; |
| 523 | - if($this->db->dbType == 'mysql') { |
|
| 523 | + if ($this->db->dbType == 'mysql') { |
|
| 524 | 524 | $query .= " uuid() "; |
| 525 | - } else if($this->db->dbType == 'mssql') { |
|
| 525 | + } else if ($this->db->dbType == 'mssql') { |
|
| 526 | 526 | $query .= " lower(newid()) "; |
| 527 | 527 | } |
| 528 | - $query .= ",'" . htmlspecialchars($group_id , ENT_QUOTES) ."', '" . htmlspecialchars($group_id , ENT_QUOTES) . "',".db_convert('','today').",0 )"; |
|
| 528 | + $query .= ",'".htmlspecialchars($group_id, ENT_QUOTES)."', '".htmlspecialchars($group_id, ENT_QUOTES)."',".db_convert('', 'today').",0 )"; |
|
| 529 | 529 | $GLOBALS['log']->debug("SecuritySuite: Save Default Group: $query"); |
| 530 | 530 | $this->db->query($query); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | function removeDefaultGroup($default_id) { |
| 534 | - $query = "delete from securitygroups_default where id = '" . htmlspecialchars($default_id) ."' "; |
|
| 534 | + $query = "delete from securitygroups_default where id = '".htmlspecialchars($default_id)."' "; |
|
| 535 | 535 | $this->db->query($query); |
| 536 | 536 | } |
| 537 | 537 | |
@@ -548,29 +548,29 @@ discard block |
||
| 548 | 548 | |
| 549 | 549 | //https://www.sugaroutfitters.com/support/securitysuite/496 |
| 550 | 550 | //There are some modules that shouldn't ever inherit groups... |
| 551 | - $module_blacklist = array('SchedulersJobs','Schedulers','Trackers'); |
|
| 551 | + $module_blacklist = array('SchedulersJobs', 'Schedulers', 'Trackers'); |
|
| 552 | 552 | |
| 553 | 553 | require_once('modules/Relationships/Relationship.php'); |
| 554 | 554 | $rs = new Relationship(); |
| 555 | - $query = "SELECT lhs_module, rhs_module FROM $rs->table_name WHERE deleted=0 AND (lhs_module = 'SecurityGroups' OR rhs_module='SecurityGroups')"; |
|
| 555 | + $query = "SELECT lhs_module, rhs_module FROM $rs->table_name WHERE deleted=0 AND (lhs_module = 'SecurityGroups' OR rhs_module='SecurityGroups')"; |
|
| 556 | 556 | $GLOBALS['log']->debug("SecuritySuite: Get SecuritySuite Enabled Modules: $query"); |
| 557 | 557 | $result = $rs->db->query($query); |
| 558 | - while(($row=$rs->db->fetchByAssoc($result)) != null) { |
|
| 558 | + while (($row = $rs->db->fetchByAssoc($result)) != null) { |
|
| 559 | 559 | |
| 560 | - if($row['lhs_module'] == 'SecurityGroups') { |
|
| 561 | - if(in_array($row['rhs_module'],$module_blacklist)) { |
|
| 560 | + if ($row['lhs_module'] == 'SecurityGroups') { |
|
| 561 | + if (in_array($row['rhs_module'], $module_blacklist)) { |
|
| 562 | 562 | continue; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | //$security_modules[$row['rhs_module']] = $row['rhs_module']; |
| 566 | - $security_modules[$row['rhs_module']] = $app_list_strings['moduleList'][$row['rhs_module']];//rost fix |
|
| 566 | + $security_modules[$row['rhs_module']] = $app_list_strings['moduleList'][$row['rhs_module']]; //rost fix |
|
| 567 | 567 | } else { |
| 568 | - if(in_array($row['lhs_module'],$module_blacklist)) { |
|
| 568 | + if (in_array($row['lhs_module'], $module_blacklist)) { |
|
| 569 | 569 | continue; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | //$security_modules[$row['lhs_module']] = $row['lhs_module']; |
| 573 | - $security_modules[$row['lhs_module']] = $app_list_strings['moduleList'][$row['lhs_module']];//rost fix |
|
| 573 | + $security_modules[$row['lhs_module']] = $app_list_strings['moduleList'][$row['lhs_module']]; //rost fix |
|
| 574 | 574 | |
| 575 | 575 | } |
| 576 | 576 | } |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | function getLinkName($this_module, $rel_module) { |
| 583 | 583 | $GLOBALS['log']->debug("SecurityGroup->getLinkName this_module: $this_module rel_module: $rel_module"); |
| 584 | 584 | include_once('modules/Relationships/RelationshipHandler.php'); |
| 585 | - $rh = new RelationshipHandler($GLOBALS['db'],$this_module); |
|
| 585 | + $rh = new RelationshipHandler($GLOBALS['db'], $this_module); |
|
| 586 | 586 | $rh->process_by_rel_bean($rel_module); |
| 587 | 587 | $rh->build_info(); |
| 588 | 588 | $rh->get_rel1_vardef_field_base($rh->base_bean->field_defs); |
@@ -594,28 +594,28 @@ discard block |
||
| 594 | 594 | * Add a Security Group to a record |
| 595 | 595 | */ |
| 596 | 596 | function addGroupToRecord($module, $record_id, $securitygroup_id) { |
| 597 | - if(empty($module) || empty($record_id) || empty($securitygroup_id)) { |
|
| 597 | + if (empty($module) || empty($record_id) || empty($securitygroup_id)) { |
|
| 598 | 598 | return; //missing data |
| 599 | 599 | } |
| 600 | 600 | global $db; |
| 601 | 601 | $query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " |
| 602 | - ."values( '".create_guid()."','".$securitygroup_id."','$record_id','$module',".db_convert('','today').",0) "; |
|
| 602 | + ."values( '".create_guid()."','".$securitygroup_id."','$record_id','$module',".db_convert('', 'today').",0) "; |
|
| 603 | 603 | $GLOBALS['log']->debug("SecuritySuite: addGroupToRecord: $query"); |
| 604 | - $db->query($query,true); |
|
| 604 | + $db->query($query, true); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | /** |
| 608 | 608 | * Remove a Security Group from a record |
| 609 | 609 | */ |
| 610 | 610 | function removeGroupFromRecord($module, $record_id, $securitygroup_id) { |
| 611 | - if(empty($module) || empty($record_id) || empty($securitygroup_id)) { |
|
| 611 | + if (empty($module) || empty($record_id) || empty($securitygroup_id)) { |
|
| 612 | 612 | return; //missing data |
| 613 | 613 | } |
| 614 | 614 | global $db; |
| 615 | - $query = "update securitygroups_records set deleted = 1, date_modified = ".db_convert('','today')." " |
|
| 615 | + $query = "update securitygroups_records set deleted = 1, date_modified = ".db_convert('', 'today')." " |
|
| 616 | 616 | ."where securitygroup_id = '".$securitygroup_id."' and record_id = '$record_id' and module = '$module'"; |
| 617 | 617 | $GLOBALS['log']->debug("SecuritySuite: addGroupToRecord: $query"); |
| 618 | - $db->query($query,true); |
|
| 618 | + $db->query($query, true); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
@@ -629,11 +629,11 @@ discard block |
||
| 629 | 629 | ." and securitygroups.deleted = 0 " |
| 630 | 630 | ."where securitygroups_users.user_id='$user_id' and securitygroups_users.deleted = 0 " |
| 631 | 631 | ."order by securitygroups.name asc "; |
| 632 | - $result = $db->query($query,true,"Error finding the full membership list for a user: "); |
|
| 632 | + $result = $db->query($query, true, "Error finding the full membership list for a user: "); |
|
| 633 | 633 | |
| 634 | 634 | $group_array = Array(); |
| 635 | 635 | $result = $db->query($query); |
| 636 | - while(($row=$db->fetchByAssoc($result)) != null) { |
|
| 636 | + while (($row = $db->fetchByAssoc($result)) != null) { |
|
| 637 | 637 | $group_array[$row['id']] = $row; |
| 638 | 638 | } |
| 639 | 639 | |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | $query = "select id, name from securitygroups " |
| 650 | 650 | ."where securitygroups.deleted = 0 " |
| 651 | 651 | ."order by name"; |
| 652 | - $result = $db->query($query,true,"Error finding the full membership list for a user: "); |
|
| 652 | + $result = $db->query($query, true, "Error finding the full membership list for a user: "); |
|
| 653 | 653 | |
| 654 | 654 | $group_array = Array(); |
| 655 | 655 | $result = $db->query($query); |
| 656 | - while(($row=$db->fetchByAssoc($result)) != null) { |
|
| 656 | + while (($row = $db->fetchByAssoc($result)) != null) { |
|
| 657 | 657 | $group_array[$row['id']] = $row; |
| 658 | 658 | } |
| 659 | 659 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $GLOBALS['log']->debug("SecuritySuite: getMembers: $query"); |
| 679 | 679 | $user_array = Array(); |
| 680 | 680 | $result = $db->query($query); |
| 681 | - while(($row=$db->fetchByAssoc($result)) != null) { |
|
| 681 | + while (($row = $db->fetchByAssoc($result)) != null) { |
|
| 682 | 682 | $user_array[$row['id']] = $row; |
| 683 | 683 | } |
| 684 | 684 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $primary_group_id = null; |
| 696 | 696 | global $db, $current_user; |
| 697 | 697 | $query = "select "; |
| 698 | - if($db->dbType == 'mssql') { |
|
| 698 | + if ($db->dbType == 'mssql') { |
|
| 699 | 699 | $query .= " top 1 "; |
| 700 | 700 | } |
| 701 | 701 | $query .= "securitygroups.id from securitygroups_users |
@@ -703,12 +703,12 @@ discard block |
||
| 703 | 703 | and securitygroups.deleted = 0 |
| 704 | 704 | where securitygroups_users.user_id='".$current_user->id."' and securitygroups_users.deleted = 0 |
| 705 | 705 | order by securitygroups_users.primary_group desc "; |
| 706 | - if($db->dbType == 'mysql') { |
|
| 706 | + if ($db->dbType == 'mysql') { |
|
| 707 | 707 | $query .= " limit 0,1 "; |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $result = $db->query($query,true,"Error finding the current users primary group: "); |
|
| 711 | - if(($row=$db->fetchByAssoc($result)) != null) { |
|
| 710 | + $result = $db->query($query, true, "Error finding the current users primary group: "); |
|
| 711 | + if (($row = $db->fetchByAssoc($result)) != null) { |
|
| 712 | 712 | $primary_group_id = $row['id']; |
| 713 | 713 | } |
| 714 | 714 | |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 16 | 16 | if(isset($GLOBALS['log'])) { |
| 17 | 17 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 18 | - } |
|
| 19 | - else { |
|
| 18 | + } else { |
|
| 20 | 19 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 21 | 20 | } |
| 22 | 21 | self::__construct(); |
@@ -178,7 +177,9 @@ discard block |
||
| 178 | 177 | $GLOBALS['log']->debug("SecuritySuite: groupHasAccess $query"); |
| 179 | 178 | $result = $db->query($query); |
| 180 | 179 | $row = $db->fetchByAssoc($result); |
| 181 | - if(isset($row) && $row['results']>0) return true; |
|
| 180 | + if(isset($row) && $row['results']>0) { |
|
| 181 | + return true; |
|
| 182 | + } |
|
| 182 | 183 | |
| 183 | 184 | return false; |
| 184 | 185 | } |
@@ -416,7 +417,10 @@ discard block |
||
| 416 | 417 | } |
| 417 | 418 | |
| 418 | 419 | static function inherit_parentQuery(&$focus, $parent_type, $parent_id, $focus_id, $focus_module_dir) { |
| 419 | - if(empty($parent_type) || empty($parent_id)) return; //no info passed |
|
| 420 | + if(empty($parent_type) || empty($parent_id)) { |
|
| 421 | + return; |
|
| 422 | + } |
|
| 423 | + //no info passed |
|
| 420 | 424 | |
| 421 | 425 | /** can speed this up by doing one query */ |
| 422 | 426 | //should be just one query but need a unique guid for each insert |
@@ -2,43 +2,43 @@ discard block |
||
| 2 | 2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
| 3 | 3 | |
| 4 | 4 | class SecurityGroupMessage extends Basic { |
| 5 | - var $new_schema = true; |
|
| 6 | - var $module_dir = 'SecurityGroups'; |
|
| 7 | - var $object_name = 'SecurityGroupMessage'; |
|
| 8 | - var $table_name = 'securitygroups_message'; |
|
| 9 | - var $importable = false; |
|
| 10 | - |
|
| 11 | - var $id; |
|
| 12 | - var $name; |
|
| 13 | - var $date_entered; |
|
| 14 | - var $date_modified; |
|
| 15 | - var $modified_user_id; |
|
| 16 | - var $modified_by_name; |
|
| 17 | - var $created_by; |
|
| 18 | - var $created_by_name; |
|
| 19 | - var $description; |
|
| 20 | - var $deleted; |
|
| 21 | - var $created_by_link; |
|
| 22 | - var $modified_user_link; |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - var $additional_column_fields = Array(); |
|
| 26 | - var $field_defs = array ( |
|
| 27 | - 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
|
| 28 | - , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', ) |
|
| 29 | - , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime') |
|
| 30 | - , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
| 31 | - , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',) |
|
| 32 | - , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',) |
|
| 33 | - , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',) |
|
| 34 | - , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
|
| 35 | - , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',) |
|
| 5 | + var $new_schema = true; |
|
| 6 | + var $module_dir = 'SecurityGroups'; |
|
| 7 | + var $object_name = 'SecurityGroupMessage'; |
|
| 8 | + var $table_name = 'securitygroups_message'; |
|
| 9 | + var $importable = false; |
|
| 10 | + |
|
| 11 | + var $id; |
|
| 12 | + var $name; |
|
| 13 | + var $date_entered; |
|
| 14 | + var $date_modified; |
|
| 15 | + var $modified_user_id; |
|
| 16 | + var $modified_by_name; |
|
| 17 | + var $created_by; |
|
| 18 | + var $created_by_name; |
|
| 19 | + var $description; |
|
| 20 | + var $deleted; |
|
| 21 | + var $created_by_link; |
|
| 22 | + var $modified_user_link; |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + var $additional_column_fields = Array(); |
|
| 26 | + var $field_defs = array ( |
|
| 27 | + 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
|
| 28 | + , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', ) |
|
| 29 | + , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime') |
|
| 30 | + , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
| 31 | + , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',) |
|
| 32 | + , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',) |
|
| 33 | + , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',) |
|
| 34 | + , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
|
| 35 | + , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',) |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - function __construct(){ |
|
| 40 | - parent::__construct(); |
|
| 41 | - } |
|
| 39 | + function __construct(){ |
|
| 40 | + parent::__construct(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -56,130 +56,130 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - function get_list_view_data(){ |
|
| 60 | - $data = parent::get_list_view_data(); |
|
| 61 | - $delete = ''; |
|
| 62 | - |
|
| 63 | - $group_owner = false; |
|
| 64 | - $securitygroup_name = ""; |
|
| 65 | - if(empty($data['SECURITYGROUP_ID'])) { |
|
| 66 | - $securitygroup_name = "All"; |
|
| 67 | - } else { |
|
| 68 | - require_once('modules/SecurityGroups/SecurityGroup.php'); |
|
| 69 | - $securitygroup = new SecurityGroup(); |
|
| 70 | - $securitygroup->retrieve($data['SECURITYGROUP_ID']); |
|
| 71 | - $securitygroup_name = $securitygroup->name; |
|
| 72 | - |
|
| 73 | - if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
|
| 74 | - $group_owner = true; |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
|
| 79 | - $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif',''); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - $username = ""; |
|
| 83 | - if(empty($data['CREATED_BY'])) { |
|
| 84 | - $username = "Unknown"; |
|
| 85 | - } else { |
|
| 86 | - require_once('modules/Users/User.php'); |
|
| 87 | - $user = new User(); |
|
| 88 | - $user->retrieve($data['CREATED_BY']); |
|
| 89 | - $username = $user->user_name; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - $data['NAME'] = $data['DESCRIPTION']; |
|
| 93 | - $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']); |
|
| 59 | + function get_list_view_data(){ |
|
| 60 | + $data = parent::get_list_view_data(); |
|
| 61 | + $delete = ''; |
|
| 62 | + |
|
| 63 | + $group_owner = false; |
|
| 64 | + $securitygroup_name = ""; |
|
| 65 | + if(empty($data['SECURITYGROUP_ID'])) { |
|
| 66 | + $securitygroup_name = "All"; |
|
| 67 | + } else { |
|
| 68 | + require_once('modules/SecurityGroups/SecurityGroup.php'); |
|
| 69 | + $securitygroup = new SecurityGroup(); |
|
| 70 | + $securitygroup->retrieve($data['SECURITYGROUP_ID']); |
|
| 71 | + $securitygroup_name = $securitygroup->name; |
|
| 72 | + |
|
| 73 | + if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
|
| 74 | + $group_owner = true; |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
|
| 79 | + $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif',''); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + $username = ""; |
|
| 83 | + if(empty($data['CREATED_BY'])) { |
|
| 84 | + $username = "Unknown"; |
|
| 85 | + } else { |
|
| 86 | + require_once('modules/Users/User.php'); |
|
| 87 | + $user = new User(); |
|
| 88 | + $user->retrieve($data['CREATED_BY']); |
|
| 89 | + $username = $user->user_name; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + $data['NAME'] = $data['DESCRIPTION']; |
|
| 93 | + $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']); |
|
| 94 | 94 | $data['NAME'] .= '<div class="byLineBox" style="padding-top: 2px"><span class="byLineLeft">'.$username.' ['.$securitygroup_name.']'; |
| 95 | - $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '. $this->getTimeLapse($data['DATE_ENTERED']) . ' ' .$delete. '</span></div>'; |
|
| 96 | - return $data ; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - static function saveMessage($text, $securitygroup_id) { |
|
| 101 | - //if no security group id then must be admin. Otherwise, make sure the user is a member of the group |
|
| 102 | - global $current_user; |
|
| 103 | - if(empty($securitygroup_id) && !is_admin($current_user)) { |
|
| 104 | - return; |
|
| 105 | - } else if(empty($securitygroup_id)) { |
|
| 106 | - $securitygroup_id = null; //6.4.0 |
|
| 107 | - } |
|
| 108 | - $message = new SecurityGroupMessage(); |
|
| 109 | - if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
| 110 | - |
|
| 111 | - $text = strip_tags($text); |
|
| 112 | - $message->name = ''; |
|
| 113 | - $message->description = $text; |
|
| 114 | - $message->securitygroup_id = $securitygroup_id; |
|
| 115 | - $message->save(); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - function getTimeLapse($startDate) |
|
| 119 | - { |
|
| 120 | - $startDate = $GLOBALS['timedate']->to_db($startDate); |
|
| 121 | - $start = array(); |
|
| 122 | - preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start); |
|
| 123 | - $end = gmdate('Y-m-d H:i:s'); |
|
| 124 | - $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] ); |
|
| 125 | - $seconds = time()- $start_time; |
|
| 126 | - $minutes = $seconds/60; |
|
| 127 | - $seconds = $seconds % 60; |
|
| 128 | - $hours = floor( $minutes / 60); |
|
| 129 | - $minutes = $minutes % 60; |
|
| 130 | - $days = floor( $hours / 24); |
|
| 131 | - $hours = $hours % 24; |
|
| 132 | - $weeks = floor( $days / 7); |
|
| 133 | - $days = $days % 7; |
|
| 134 | - $result = ''; |
|
| 135 | - if($weeks == 1){ |
|
| 136 | - $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
|
| 137 | - return $result; |
|
| 138 | - }else if($weeks > 1){ |
|
| 139 | - $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
|
| 140 | - if($days > 0) { |
|
| 95 | + $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '. $this->getTimeLapse($data['DATE_ENTERED']) . ' ' .$delete. '</span></div>'; |
|
| 96 | + return $data ; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + static function saveMessage($text, $securitygroup_id) { |
|
| 101 | + //if no security group id then must be admin. Otherwise, make sure the user is a member of the group |
|
| 102 | + global $current_user; |
|
| 103 | + if(empty($securitygroup_id) && !is_admin($current_user)) { |
|
| 104 | + return; |
|
| 105 | + } else if(empty($securitygroup_id)) { |
|
| 106 | + $securitygroup_id = null; //6.4.0 |
|
| 107 | + } |
|
| 108 | + $message = new SecurityGroupMessage(); |
|
| 109 | + if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
| 110 | + |
|
| 111 | + $text = strip_tags($text); |
|
| 112 | + $message->name = ''; |
|
| 113 | + $message->description = $text; |
|
| 114 | + $message->securitygroup_id = $securitygroup_id; |
|
| 115 | + $message->save(); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + function getTimeLapse($startDate) |
|
| 119 | + { |
|
| 120 | + $startDate = $GLOBALS['timedate']->to_db($startDate); |
|
| 121 | + $start = array(); |
|
| 122 | + preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start); |
|
| 123 | + $end = gmdate('Y-m-d H:i:s'); |
|
| 124 | + $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] ); |
|
| 125 | + $seconds = time()- $start_time; |
|
| 126 | + $minutes = $seconds/60; |
|
| 127 | + $seconds = $seconds % 60; |
|
| 128 | + $hours = floor( $minutes / 60); |
|
| 129 | + $minutes = $minutes % 60; |
|
| 130 | + $days = floor( $hours / 24); |
|
| 131 | + $hours = $hours % 24; |
|
| 132 | + $weeks = floor( $days / 7); |
|
| 133 | + $days = $days % 7; |
|
| 134 | + $result = ''; |
|
| 135 | + if($weeks == 1){ |
|
| 136 | + $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
|
| 137 | + return $result; |
|
| 138 | + }else if($weeks > 1){ |
|
| 139 | + $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
|
| 140 | + if($days > 0) { |
|
| 141 | 141 | $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' '; |
| 142 | 142 | } |
| 143 | - }else{ |
|
| 144 | - if($days == 1){ |
|
| 145 | - $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
|
| 146 | - return $result; |
|
| 147 | - }else if($days > 1){ |
|
| 148 | - $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
|
| 149 | - }else{ |
|
| 150 | - if($hours == 1) { |
|
| 143 | + }else{ |
|
| 144 | + if($days == 1){ |
|
| 145 | + $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
|
| 146 | + return $result; |
|
| 147 | + }else if($days > 1){ |
|
| 148 | + $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
|
| 149 | + }else{ |
|
| 150 | + if($hours == 1) { |
|
| 151 | 151 | $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' '; |
| 152 | 152 | } else { |
| 153 | 153 | $result .= $hours . ' '.translate('LBL_TIME_HOURS','SugarFeed').' '; |
| 154 | 154 | } |
| 155 | - if($hours < 6){ |
|
| 156 | - if($minutes == 1) { |
|
| 155 | + if($hours < 6){ |
|
| 156 | + if($minutes == 1) { |
|
| 157 | 157 | $result .= $minutes . ' ' . translate('LBL_TIME_MINUTE','SugarFeed'). ' '; |
| 158 | 158 | } else { |
| 159 | 159 | $result .= $minutes . ' ' . translate('LBL_TIME_MINUTES','SugarFeed'). ' '; |
| 160 | 160 | } |
| 161 | - } |
|
| 162 | - if($hours == 0 && $minutes == 0) { |
|
| 161 | + } |
|
| 162 | + if($hours == 0 && $minutes == 0) { |
|
| 163 | 163 | if($seconds == 1 ) { |
| 164 | 164 | $result = $seconds . ' ' . translate('LBL_TIME_SECOND','SugarFeed'); |
| 165 | 165 | } else { |
| 166 | 166 | $result = $seconds . ' ' . translate('LBL_TIME_SECONDS','SugarFeed'); |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | - } |
|
| 170 | - } |
|
| 171 | - return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed'); |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | + return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed'); |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - function bean_implements($interface){ |
|
| 178 | - switch($interface){ |
|
| 179 | - case 'ACL':return false; |
|
| 180 | - } |
|
| 181 | - return false; |
|
| 182 | - } |
|
| 177 | + function bean_implements($interface){ |
|
| 178 | + switch($interface){ |
|
| 179 | + case 'ACL':return false; |
|
| 180 | + } |
|
| 181 | + return false; |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | 184 | } |
| 185 | 185 | ?> |
| 186 | 186 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 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 | class SecurityGroupMessage extends Basic { |
| 5 | 5 | var $new_schema = true; |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | var $additional_column_fields = Array(); |
| 26 | - var $field_defs = array ( |
|
| 26 | + var $field_defs = array( |
|
| 27 | 27 | 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
| 28 | - , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255', ) |
|
| 29 | - , 'date_entered'=>array ('name' => 'date_entered','type' => 'datetime') |
|
| 30 | - , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
| 28 | + , 'name'=>array('name' =>'name', 'type' =>'varchar', 'len'=>'255',) |
|
| 29 | + , 'date_entered'=>array('name' => 'date_entered', 'type' => 'datetime') |
|
| 30 | + , 'date_modified'=>array('name' => 'date_modified', 'type' => 'datetime') |
|
| 31 | 31 | , 'modified_user_id'=>array('name' =>'modified_user_id', 'type' =>'char', 'len'=>'36',) |
| 32 | 32 | , 'created_by'=>array('name' =>'created_by', 'type' =>'char', 'len'=>'36',) |
| 33 | 33 | , 'description'=>array('name' =>'description', 'type' =>'text', 'len'=>'',) |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - function __construct(){ |
|
| 39 | + function __construct() { |
|
| 40 | 40 | parent::__construct(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 45 | 45 | */ |
| 46 | - function SecurityGroupMessage(){ |
|
| 46 | + function SecurityGroupMessage() { |
|
| 47 | 47 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 48 | - if(isset($GLOBALS['log'])) { |
|
| 48 | + if (isset($GLOBALS['log'])) { |
|
| 49 | 49 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 50 | 50 | } |
| 51 | 51 | else { |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - function get_list_view_data(){ |
|
| 59 | + function get_list_view_data() { |
|
| 60 | 60 | $data = parent::get_list_view_data(); |
| 61 | 61 | $delete = ''; |
| 62 | 62 | |
| 63 | 63 | $group_owner = false; |
| 64 | 64 | $securitygroup_name = ""; |
| 65 | - if(empty($data['SECURITYGROUP_ID'])) { |
|
| 65 | + if (empty($data['SECURITYGROUP_ID'])) { |
|
| 66 | 66 | $securitygroup_name = "All"; |
| 67 | 67 | } else { |
| 68 | 68 | require_once('modules/SecurityGroups/SecurityGroup.php'); |
@@ -70,17 +70,17 @@ discard block |
||
| 70 | 70 | $securitygroup->retrieve($data['SECURITYGROUP_ID']); |
| 71 | 71 | $securitygroup_name = $securitygroup->name; |
| 72 | 72 | |
| 73 | - if($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
|
| 73 | + if ($securitygroup->assigned_user_id == $GLOBALS['current_user']->id) { |
|
| 74 | 74 | $group_owner = true; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if(is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
|
| 79 | - $delete = SugarThemeRegistry::current()->getImage( 'delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'. $data['ID'] . '", "{this.id}")\'',null,null,'.gif',''); |
|
| 78 | + if (is_admin($GLOBALS['current_user']) || $data['CREATED_BY'] == $GLOBALS['current_user']->id || $group_owner) { |
|
| 79 | + $delete = SugarThemeRegistry::current()->getImage('delete_inline', 'width="12" height="12" border="0" align="absmiddle" style="vertical-align: bottom;" onclick=\'Message.deleteMessage("'.$data['ID'].'", "{this.id}")\'', null, null, '.gif', ''); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $username = ""; |
| 83 | - if(empty($data['CREATED_BY'])) { |
|
| 83 | + if (empty($data['CREATED_BY'])) { |
|
| 84 | 84 | $username = "Unknown"; |
| 85 | 85 | } else { |
| 86 | 86 | require_once('modules/Users/User.php'); |
@@ -90,23 +90,23 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $data['NAME'] = $data['DESCRIPTION']; |
| 93 | - $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">' . html_entity_decode($data['NAME']); |
|
| 93 | + $data['NAME'] = '<div class="list view" style="padding:5px;border:none;">'.html_entity_decode($data['NAME']); |
|
| 94 | 94 | $data['NAME'] .= '<div class="byLineBox" style="padding-top: 2px"><span class="byLineLeft">'.$username.' ['.$securitygroup_name.']'; |
| 95 | - $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '. $this->getTimeLapse($data['DATE_ENTERED']) . ' ' .$delete. '</span></div>'; |
|
| 96 | - return $data ; |
|
| 95 | + $data['NAME'] .= ' </span><span style="cursor: pointer;" class="byLineRight"> '.$this->getTimeLapse($data['DATE_ENTERED']).' '.$delete.'</span></div>'; |
|
| 96 | + return $data; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | static function saveMessage($text, $securitygroup_id) { |
| 101 | 101 | //if no security group id then must be admin. Otherwise, make sure the user is a member of the group |
| 102 | 102 | global $current_user; |
| 103 | - if(empty($securitygroup_id) && !is_admin($current_user)) { |
|
| 103 | + if (empty($securitygroup_id) && !is_admin($current_user)) { |
|
| 104 | 104 | return; |
| 105 | - } else if(empty($securitygroup_id)) { |
|
| 105 | + } else if (empty($securitygroup_id)) { |
|
| 106 | 106 | $securitygroup_id = null; //6.4.0 |
| 107 | 107 | } |
| 108 | 108 | $message = new SecurityGroupMessage(); |
| 109 | - if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
| 109 | + if (empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
| 110 | 110 | |
| 111 | 111 | $text = strip_tags($text); |
| 112 | 112 | $message->name = ''; |
@@ -121,61 +121,61 @@ discard block |
||
| 121 | 121 | $start = array(); |
| 122 | 122 | preg_match('/(\d+)\-(\d+)\-(\d+) (\d+)\:(\d+)\:(\d+)/', $startDate, $start); |
| 123 | 123 | $end = gmdate('Y-m-d H:i:s'); |
| 124 | - $start_time = gmmktime($start[4],$start[5], $start[6], $start[2], $start[3], $start[1] ); |
|
| 125 | - $seconds = time()- $start_time; |
|
| 126 | - $minutes = $seconds/60; |
|
| 124 | + $start_time = gmmktime($start[4], $start[5], $start[6], $start[2], $start[3], $start[1]); |
|
| 125 | + $seconds = time() - $start_time; |
|
| 126 | + $minutes = $seconds / 60; |
|
| 127 | 127 | $seconds = $seconds % 60; |
| 128 | - $hours = floor( $minutes / 60); |
|
| 128 | + $hours = floor($minutes / 60); |
|
| 129 | 129 | $minutes = $minutes % 60; |
| 130 | - $days = floor( $hours / 24); |
|
| 130 | + $days = floor($hours / 24); |
|
| 131 | 131 | $hours = $hours % 24; |
| 132 | - $weeks = floor( $days / 7); |
|
| 132 | + $weeks = floor($days / 7); |
|
| 133 | 133 | $days = $days % 7; |
| 134 | 134 | $result = ''; |
| 135 | - if($weeks == 1){ |
|
| 136 | - $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
|
| 135 | + if ($weeks == 1) { |
|
| 136 | + $result = translate('LBL_TIME_LAST_WEEK', 'SugarFeed').' '; |
|
| 137 | 137 | return $result; |
| 138 | - }else if($weeks > 1){ |
|
| 139 | - $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
|
| 140 | - if($days > 0) { |
|
| 141 | - $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' '; |
|
| 138 | + } else if ($weeks > 1) { |
|
| 139 | + $result .= $weeks.' '.translate('LBL_TIME_WEEKS', 'SugarFeed').' '; |
|
| 140 | + if ($days > 0) { |
|
| 141 | + $result .= $days.' '.translate('LBL_TIME_DAYS', 'SugarFeed').' '; |
|
| 142 | 142 | } |
| 143 | - }else{ |
|
| 144 | - if($days == 1){ |
|
| 145 | - $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
|
| 143 | + } else { |
|
| 144 | + if ($days == 1) { |
|
| 145 | + $result = translate('LBL_TIME_YESTERDAY', 'SugarFeed').' '; |
|
| 146 | 146 | return $result; |
| 147 | - }else if($days > 1){ |
|
| 148 | - $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
|
| 149 | - }else{ |
|
| 150 | - if($hours == 1) { |
|
| 151 | - $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' '; |
|
| 147 | + } else if ($days > 1) { |
|
| 148 | + $result .= $days.' '.translate('LBL_TIME_DAYS', 'SugarFeed').' '; |
|
| 149 | + } else { |
|
| 150 | + if ($hours == 1) { |
|
| 151 | + $result .= $hours.' '.translate('LBL_TIME_HOUR', 'SugarFeed').' '; |
|
| 152 | 152 | } else { |
| 153 | - $result .= $hours . ' '.translate('LBL_TIME_HOURS','SugarFeed').' '; |
|
| 153 | + $result .= $hours.' '.translate('LBL_TIME_HOURS', 'SugarFeed').' '; |
|
| 154 | 154 | } |
| 155 | - if($hours < 6){ |
|
| 156 | - if($minutes == 1) { |
|
| 157 | - $result .= $minutes . ' ' . translate('LBL_TIME_MINUTE','SugarFeed'). ' '; |
|
| 155 | + if ($hours < 6) { |
|
| 156 | + if ($minutes == 1) { |
|
| 157 | + $result .= $minutes.' '.translate('LBL_TIME_MINUTE', 'SugarFeed').' '; |
|
| 158 | 158 | } else { |
| 159 | - $result .= $minutes . ' ' . translate('LBL_TIME_MINUTES','SugarFeed'). ' '; |
|
| 159 | + $result .= $minutes.' '.translate('LBL_TIME_MINUTES', 'SugarFeed').' '; |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | - if($hours == 0 && $minutes == 0) { |
|
| 163 | - if($seconds == 1 ) { |
|
| 164 | - $result = $seconds . ' ' . translate('LBL_TIME_SECOND','SugarFeed'); |
|
| 162 | + if ($hours == 0 && $minutes == 0) { |
|
| 163 | + if ($seconds == 1) { |
|
| 164 | + $result = $seconds.' '.translate('LBL_TIME_SECOND', 'SugarFeed'); |
|
| 165 | 165 | } else { |
| 166 | - $result = $seconds . ' ' . translate('LBL_TIME_SECONDS','SugarFeed'); |
|
| 166 | + $result = $seconds.' '.translate('LBL_TIME_SECONDS', 'SugarFeed'); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - return $result . ' ' . translate('LBL_TIME_AGO','SugarFeed'); |
|
| 171 | + return $result.' '.translate('LBL_TIME_AGO', 'SugarFeed'); |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - function bean_implements($interface){ |
|
| 178 | - switch($interface){ |
|
| 177 | + function bean_implements($interface) { |
|
| 178 | + switch ($interface) { |
|
| 179 | 179 | case 'ACL':return false; |
| 180 | 180 | } |
| 181 | 181 | return false; |
@@ -1,5 +1,7 @@ discard block |
||
| 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 | class SecurityGroupMessage extends Basic { |
| 5 | 7 | var $new_schema = true; |
@@ -47,8 +49,7 @@ discard block |
||
| 47 | 49 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 48 | 50 | if(isset($GLOBALS['log'])) { |
| 49 | 51 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 50 | - } |
|
| 51 | - else { |
|
| 52 | + } else { |
|
| 52 | 53 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 53 | 54 | } |
| 54 | 55 | self::__construct(); |
@@ -106,7 +107,10 @@ discard block |
||
| 106 | 107 | $securitygroup_id = null; //6.4.0 |
| 107 | 108 | } |
| 108 | 109 | $message = new SecurityGroupMessage(); |
| 109 | - if(empty($text)) return; // || !$feed->ACLAccess('save', true) )return; |
|
| 110 | + if(empty($text)) { |
|
| 111 | + return; |
|
| 112 | + } |
|
| 113 | + // || !$feed->ACLAccess('save', true) )return; |
|
| 110 | 114 | |
| 111 | 115 | $text = strip_tags($text); |
| 112 | 116 | $message->name = ''; |
@@ -135,18 +139,18 @@ discard block |
||
| 135 | 139 | if($weeks == 1){ |
| 136 | 140 | $result = translate('LBL_TIME_LAST_WEEK','SugarFeed').' '; |
| 137 | 141 | return $result; |
| 138 | - }else if($weeks > 1){ |
|
| 142 | + } else if($weeks > 1){ |
|
| 139 | 143 | $result .= $weeks . ' '.translate('LBL_TIME_WEEKS','SugarFeed').' '; |
| 140 | 144 | if($days > 0) { |
| 141 | 145 | $result .= $days . ' '.translate('LBL_TIME_DAYS','SugarFeed').' '; |
| 142 | 146 | } |
| 143 | - }else{ |
|
| 147 | + } else{ |
|
| 144 | 148 | if($days == 1){ |
| 145 | 149 | $result = translate('LBL_TIME_YESTERDAY','SugarFeed').' '; |
| 146 | 150 | return $result; |
| 147 | - }else if($days > 1){ |
|
| 151 | + } else if($days > 1){ |
|
| 148 | 152 | $result .= $days . ' '. translate('LBL_TIME_DAYS','SugarFeed').' '; |
| 149 | - }else{ |
|
| 153 | + } else{ |
|
| 150 | 154 | if($hours == 1) { |
| 151 | 155 | $result .= $hours . ' '.translate('LBL_TIME_HOUR','SugarFeed').' '; |
| 152 | 156 | } else { |
@@ -2,33 +2,33 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | class SecurityGroup_sugar extends Basic { |
| 5 | - var $new_schema = true; |
|
| 6 | - var $module_dir = 'SecurityGroups'; |
|
| 7 | - var $object_name = 'SecurityGroup'; |
|
| 8 | - var $table_name = 'securitygroups'; |
|
| 9 | - var $id; |
|
| 10 | - var $name; |
|
| 11 | - var $date_entered; |
|
| 12 | - var $date_modified; |
|
| 13 | - var $modified_user_id; |
|
| 14 | - var $modified_by_name; |
|
| 15 | - var $created_by; |
|
| 16 | - var $created_by_name; |
|
| 17 | - var $description; |
|
| 18 | - var $deleted; |
|
| 19 | - var $created_by_link; |
|
| 20 | - var $modified_user_link; |
|
| 21 | - var $assigned_user_id; |
|
| 22 | - var $assigned_user_name; |
|
| 23 | - var $assigned_user_link; |
|
| 24 | - |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - |
|
| 29 | - public function __construct(){ |
|
| 30 | - parent::__construct(); |
|
| 31 | - } |
|
| 5 | + var $new_schema = true; |
|
| 6 | + var $module_dir = 'SecurityGroups'; |
|
| 7 | + var $object_name = 'SecurityGroup'; |
|
| 8 | + var $table_name = 'securitygroups'; |
|
| 9 | + var $id; |
|
| 10 | + var $name; |
|
| 11 | + var $date_entered; |
|
| 12 | + var $date_modified; |
|
| 13 | + var $modified_user_id; |
|
| 14 | + var $modified_by_name; |
|
| 15 | + var $created_by; |
|
| 16 | + var $created_by_name; |
|
| 17 | + var $description; |
|
| 18 | + var $deleted; |
|
| 19 | + var $created_by_link; |
|
| 20 | + var $modified_user_link; |
|
| 21 | + var $assigned_user_id; |
|
| 22 | + var $assigned_user_name; |
|
| 23 | + var $assigned_user_link; |
|
| 24 | + |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + |
|
| 29 | + public function __construct(){ |
|
| 30 | + parent::__construct(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - function bean_implements($interface){ |
|
| 49 | - switch($interface){ |
|
| 50 | - case 'ACL': return true; |
|
| 51 | - } |
|
| 52 | - return false; |
|
| 48 | + function bean_implements($interface){ |
|
| 49 | + switch($interface){ |
|
| 50 | + case 'ACL': return true; |
|
| 51 | + } |
|
| 52 | + return false; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | } |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | - public function __construct(){ |
|
| 29 | + public function __construct() { |
|
| 30 | 30 | parent::__construct(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 35 | 35 | */ |
| 36 | - public function SecurityGroup_sugar(){ |
|
| 36 | + public function SecurityGroup_sugar() { |
|
| 37 | 37 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 38 | - if(isset($GLOBALS['log'])) { |
|
| 38 | + if (isset($GLOBALS['log'])) { |
|
| 39 | 39 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 40 | 40 | } |
| 41 | 41 | else { |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - function bean_implements($interface){ |
|
| 49 | - switch($interface){ |
|
| 48 | + function bean_implements($interface) { |
|
| 49 | + switch ($interface) { |
|
| 50 | 50 | case 'ACL': return true; |
| 51 | 51 | } |
| 52 | 52 | return false; |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 24 | 24 | if(isset($GLOBALS['log'])) { |
| 25 | 25 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 26 | - } |
|
| 27 | - else { |
|
| 26 | + } else { |
|
| 28 | 27 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 29 | 28 | } |
| 30 | 29 | self::__construct($seed, $module, $subPanel, $options); |
@@ -1,5 +1,5 @@ discard block |
||
| 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 | |
| 5 | 5 | require_once('data/SugarBean.php'); |
@@ -31,29 +31,29 @@ discard block |
||
| 31 | 31 | var $new_schema = true; |
| 32 | 32 | |
| 33 | 33 | var $additional_column_fields = Array(); |
| 34 | - var $field_defs = array ( |
|
| 34 | + var $field_defs = array( |
|
| 35 | 35 | 'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'') |
| 36 | - , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36', ) |
|
| 36 | + , 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36',) |
|
| 37 | 37 | , 'user_id'=>array('name' =>'user_id', 'type' =>'char', 'len'=>'36',) |
| 38 | 38 | , 'noninheritable'=>array('name' =>'noninheritable', 'type' =>'bool', 'len'=>'1') |
| 39 | 39 | , 'primary_group'=>array('name' =>'primary_group', 'type' =>'bool', 'len'=>'1') |
| 40 | - , 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime') |
|
| 40 | + , 'date_modified'=>array('name' => 'date_modified', 'type' => 'datetime') |
|
| 41 | 41 | , 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true) |
| 42 | 42 | ); |
| 43 | 43 | function __construct() { |
| 44 | 44 | $this->db = DBManagerFactory::getInstance(); |
| 45 | 45 | $this->dbManager = DBManagerFactory::getInstance(); |
| 46 | 46 | |
| 47 | - $this->disable_row_level_security =true; |
|
| 47 | + $this->disable_row_level_security = true; |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 53 | 53 | */ |
| 54 | - function SecurityGroupUserRelationship(){ |
|
| 54 | + function SecurityGroupUserRelationship() { |
|
| 55 | 55 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 56 | - if(isset($GLOBALS['log'])) { |
|
| 56 | + if (isset($GLOBALS['log'])) { |
|
| 57 | 57 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 58 | 58 | } |
| 59 | 59 | else { |
@@ -65,27 +65,27 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | function fill_in_additional_detail_fields() |
| 67 | 67 | { |
| 68 | - if(isset($this->securitygroup_id) && $this->securitygroup_id != "") |
|
| 68 | + if (isset($this->securitygroup_id) && $this->securitygroup_id != "") |
|
| 69 | 69 | { |
| 70 | 70 | $query = "SELECT name from securitygroups where id='$this->securitygroup_id' AND deleted=0"; |
| 71 | - $result =$this->db->query($query,true," Error filling in additional detail fields: "); |
|
| 71 | + $result = $this->db->query($query, true, " Error filling in additional detail fields: "); |
|
| 72 | 72 | // Get the id and the name. |
| 73 | 73 | $row = $this->db->fetchByAssoc($result); |
| 74 | 74 | |
| 75 | - if($row != null) |
|
| 75 | + if ($row != null) |
|
| 76 | 76 | { |
| 77 | 77 | $this->securitygroup_name = $row['name']; |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if(isset($this->user_id) && $this->user_id != "") |
|
| 81 | + if (isset($this->user_id) && $this->user_id != "") |
|
| 82 | 82 | { |
| 83 | 83 | $query = "SELECT user_name from users where id='$this->user_id' AND deleted=0"; |
| 84 | - $result =$this->db->query($query,true," Error filling in additional detail fields: "); |
|
| 84 | + $result = $this->db->query($query, true, " Error filling in additional detail fields: "); |
|
| 85 | 85 | // Get the id and the name. |
| 86 | 86 | $row = $this->db->fetchByAssoc($result); |
| 87 | 87 | |
| 88 | - if($row != null) |
|
| 88 | + if ($row != null) |
|
| 89 | 89 | { |
| 90 | 90 | $this->user_name = $row['user_name']; |
| 91 | 91 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $query = "SELECT id, first_name, last_name, user_name FROM users "; |
| 99 | 99 | $where_auto = "deleted=0"; |
| 100 | 100 | |
| 101 | - if($where != "") |
|
| 101 | + if ($where != "") |
|
| 102 | 102 | $query .= "where $where AND ".$where_auto; |
| 103 | 103 | else |
| 104 | 104 | $query .= "where ".$where_auto; |
@@ -1,5 +1,7 @@ discard block |
||
| 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 | |
| 5 | 7 | require_once('data/SugarBean.php'); |
@@ -55,8 +57,7 @@ discard block |
||
| 55 | 57 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 56 | 58 | if(isset($GLOBALS['log'])) { |
| 57 | 59 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 58 | - } |
|
| 59 | - else { |
|
| 60 | + } else { |
|
| 60 | 61 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 61 | 62 | } |
| 62 | 63 | self::__construct(); |
@@ -98,10 +99,11 @@ discard block |
||
| 98 | 99 | $query = "SELECT id, first_name, last_name, user_name FROM users "; |
| 99 | 100 | $where_auto = "deleted=0"; |
| 100 | 101 | |
| 101 | - if($where != "") |
|
| 102 | - $query .= "where $where AND ".$where_auto; |
|
| 103 | - else |
|
| 104 | - $query .= "where ".$where_auto; |
|
| 102 | + if($where != "") { |
|
| 103 | + $query .= "where $where AND ".$where_auto; |
|
| 104 | + } else { |
|
| 105 | + $query .= "where ".$where_auto; |
|
| 106 | + } |
|
| 105 | 107 | |
| 106 | 108 | $query .= " ORDER BY last_name, first_name"; |
| 107 | 109 | |