@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | if (isset($_POST['id'])) |
| 60 | - sugar_die("Unauthorized access to administration."); |
|
| 60 | + sugar_die("Unauthorized access to administration."); |
|
| 61 | 61 | if (isset($_POST['record']) && !is_admin($current_user) |
| 62 | 62 | && !$GLOBALS['current_user']->isAdminForModule('Users') |
| 63 | 63 | && $_POST['record'] != $current_user->id) |
@@ -115,39 +115,39 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | - $portal=array("user_name","last_name","status","portal_only"); |
|
| 119 | - $group=array("user_name","last_name","status","is_group"); |
|
| 120 | - if(isset($_POST['portal_only']) && ($_POST['portal_only']=='1' || $focus->portal_only)){ |
|
| 121 | - foreach($portal as $field){ |
|
| 122 | - if(isset($_POST[$field])) |
|
| 123 | - { |
|
| 124 | - $value = $_POST[$field]; |
|
| 125 | - $focus->$field = $value; |
|
| 118 | + $portal=array("user_name","last_name","status","portal_only"); |
|
| 119 | + $group=array("user_name","last_name","status","is_group"); |
|
| 120 | + if(isset($_POST['portal_only']) && ($_POST['portal_only']=='1' || $focus->portal_only)){ |
|
| 121 | + foreach($portal as $field){ |
|
| 122 | + if(isset($_POST[$field])) |
|
| 123 | + { |
|
| 124 | + $value = $_POST[$field]; |
|
| 125 | + $focus->$field = $value; |
|
| 126 | 126 | |
| 127 | - } |
|
| 128 | - } |
|
| 129 | - } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - if(isset($_POST['is_group']) && ($_POST['is_group']=='1' || $focus->is_group)){ |
|
| 132 | - foreach($group as $field){ |
|
| 133 | - if(isset($_POST[$field])) |
|
| 134 | - { |
|
| 135 | - $value = $_POST[$field]; |
|
| 136 | - $focus->$field = $value; |
|
| 131 | + if(isset($_POST['is_group']) && ($_POST['is_group']=='1' || $focus->is_group)){ |
|
| 132 | + foreach($group as $field){ |
|
| 133 | + if(isset($_POST[$field])) |
|
| 134 | + { |
|
| 135 | + $value = $_POST[$field]; |
|
| 136 | + $focus->$field = $value; |
|
| 137 | 137 | |
| 138 | - } |
|
| 139 | - } |
|
| 140 | - } |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | - // copy the group or portal user name over. We renamed the field in order to ensure auto-complete would not change the value |
|
| 144 | - if(isset($_POST['user_name'])) |
|
| 145 | - { |
|
| 146 | - $focus->user_name = $_POST['user_name']; |
|
| 147 | - } |
|
| 143 | + // copy the group or portal user name over. We renamed the field in order to ensure auto-complete would not change the value |
|
| 144 | + if(isset($_POST['user_name'])) |
|
| 145 | + { |
|
| 146 | + $focus->user_name = $_POST['user_name']; |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - // if the user saved is a Regular User |
|
| 150 | - if(!$focus->is_group && !$focus->portal_only){ |
|
| 149 | + // if the user saved is a Regular User |
|
| 150 | + if(!$focus->is_group && !$focus->portal_only){ |
|
| 151 | 151 | |
| 152 | 152 | foreach ($focus->column_fields as $fieldName) |
| 153 | 153 | { |
@@ -178,63 +178,63 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $focus->is_group=0; |
|
| 182 | - $focus->portal_only=0; |
|
| 181 | + $focus->is_group=0; |
|
| 182 | + $focus->portal_only=0; |
|
| 183 | 183 | |
| 184 | - if(isset($_POST['status']) && $_POST['status']== "Inactive") $focus->employee_status = "Terminated"; //bug49972 |
|
| 184 | + if(isset($_POST['status']) && $_POST['status']== "Inactive") $focus->employee_status = "Terminated"; //bug49972 |
|
| 185 | 185 | |
| 186 | - if(isset($_POST['user_name'])) |
|
| 187 | - { |
|
| 188 | - $focus->user_name = $_POST['user_name']; |
|
| 189 | - } |
|
| 190 | - if((isset($_POST['is_admin']) && ($_POST['is_admin'] == 'on' || $_POST['is_admin'] == '1')) || |
|
| 186 | + if(isset($_POST['user_name'])) |
|
| 187 | + { |
|
| 188 | + $focus->user_name = $_POST['user_name']; |
|
| 189 | + } |
|
| 190 | + if((isset($_POST['is_admin']) && ($_POST['is_admin'] == 'on' || $_POST['is_admin'] == '1')) || |
|
| 191 | 191 | (isset($_POST['UserType']) && $_POST['UserType'] == "Administrator")) $focus->is_admin = 1; |
| 192 | - elseif(isset($_POST['is_admin']) && empty($_POST['is_admin'])) $focus->is_admin = 0; |
|
| 193 | - //if(empty($_POST['portal_only']) || !empty($_POST['is_admin'])) $focus->portal_only = 0; |
|
| 194 | - //if(empty($_POST['is_group']) || !empty($_POST['is_admin'])) $focus->is_group = 0; |
|
| 195 | - if(empty($_POST['receive_notifications'])) $focus->receive_notifications = 0; |
|
| 196 | - |
|
| 197 | - if(isset($_POST['mailmerge_on']) && !empty($_POST['mailmerge_on'])) { |
|
| 198 | - $focus->setPreference('mailmerge_on','on', 0, 'global'); |
|
| 199 | - } else { |
|
| 200 | - $focus->setPreference('mailmerge_on','off', 0, 'global'); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - if(isset($_POST['user_swap_last_viewed'])) |
|
| 204 | - { |
|
| 205 | - $focus->setPreference('swap_last_viewed', $_POST['user_swap_last_viewed'], 0, 'global'); |
|
| 206 | - } |
|
| 207 | - else |
|
| 208 | - { |
|
| 209 | - $focus->setPreference('swap_last_viewed', '', 0, 'global'); |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - if(isset($_POST['user_swap_shortcuts'])) |
|
| 213 | - { |
|
| 214 | - $focus->setPreference('swap_shortcuts', $_POST['user_swap_shortcuts'], 0, 'global'); |
|
| 215 | - } |
|
| 216 | - else |
|
| 217 | - { |
|
| 218 | - $focus->setPreference('swap_shortcuts', '', 0, 'global'); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - if(isset($_POST['use_group_tabs'])) |
|
| 222 | - { |
|
| 223 | - $focus->setPreference('navigation_paradigm', $_POST['use_group_tabs'], 0, 'global'); |
|
| 224 | - } |
|
| 225 | - else |
|
| 226 | - { |
|
| 227 | - $focus->setPreference('navigation_paradigm', 'gm', 0, 'global'); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - if(isset($_POST['user_subpanel_tabs'])) |
|
| 231 | - { |
|
| 232 | - $focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global'); |
|
| 233 | - } |
|
| 234 | - else |
|
| 235 | - { |
|
| 236 | - $focus->setPreference('subpanel_tabs', '', 0, 'global'); |
|
| 237 | - } |
|
| 192 | + elseif(isset($_POST['is_admin']) && empty($_POST['is_admin'])) $focus->is_admin = 0; |
|
| 193 | + //if(empty($_POST['portal_only']) || !empty($_POST['is_admin'])) $focus->portal_only = 0; |
|
| 194 | + //if(empty($_POST['is_group']) || !empty($_POST['is_admin'])) $focus->is_group = 0; |
|
| 195 | + if(empty($_POST['receive_notifications'])) $focus->receive_notifications = 0; |
|
| 196 | + |
|
| 197 | + if(isset($_POST['mailmerge_on']) && !empty($_POST['mailmerge_on'])) { |
|
| 198 | + $focus->setPreference('mailmerge_on','on', 0, 'global'); |
|
| 199 | + } else { |
|
| 200 | + $focus->setPreference('mailmerge_on','off', 0, 'global'); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + if(isset($_POST['user_swap_last_viewed'])) |
|
| 204 | + { |
|
| 205 | + $focus->setPreference('swap_last_viewed', $_POST['user_swap_last_viewed'], 0, 'global'); |
|
| 206 | + } |
|
| 207 | + else |
|
| 208 | + { |
|
| 209 | + $focus->setPreference('swap_last_viewed', '', 0, 'global'); |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + if(isset($_POST['user_swap_shortcuts'])) |
|
| 213 | + { |
|
| 214 | + $focus->setPreference('swap_shortcuts', $_POST['user_swap_shortcuts'], 0, 'global'); |
|
| 215 | + } |
|
| 216 | + else |
|
| 217 | + { |
|
| 218 | + $focus->setPreference('swap_shortcuts', '', 0, 'global'); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + if(isset($_POST['use_group_tabs'])) |
|
| 222 | + { |
|
| 223 | + $focus->setPreference('navigation_paradigm', $_POST['use_group_tabs'], 0, 'global'); |
|
| 224 | + } |
|
| 225 | + else |
|
| 226 | + { |
|
| 227 | + $focus->setPreference('navigation_paradigm', 'gm', 0, 'global'); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + if(isset($_POST['user_subpanel_tabs'])) |
|
| 231 | + { |
|
| 232 | + $focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global'); |
|
| 233 | + } |
|
| 234 | + else |
|
| 235 | + { |
|
| 236 | + $focus->setPreference('subpanel_tabs', '', 0, 'global'); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | if(isset($_POST['user_theme'])) |
| 240 | 240 | { |
@@ -243,37 +243,37 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | if(isset($_POST['user_module_favicon'])) |
| 246 | - { |
|
| 247 | - $focus->setPreference('module_favicon', $_POST['user_module_favicon'], 0, 'global'); |
|
| 248 | - } |
|
| 249 | - else |
|
| 250 | - { |
|
| 251 | - $focus->setPreference('module_favicon', '', 0, 'global'); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - $tabs = new TabController(); |
|
| 255 | - if(isset($_POST['display_tabs'])) |
|
| 256 | - $tabs->set_user_tabs($DISPLAY_ARR['display_tabs'], $focus, 'display'); |
|
| 257 | - if(isset($HIDE_ARR['hide_tabs'])){ |
|
| 258 | - $tabs->set_user_tabs($HIDE_ARR['hide_tabs'], $focus, 'hide'); |
|
| 259 | - |
|
| 260 | - }else{ |
|
| 261 | - $tabs->set_user_tabs(array(), $focus, 'hide'); |
|
| 262 | - } |
|
| 263 | - if(is_admin($current_user)){ |
|
| 264 | - if(isset($REMOVE_ARR['remove_tabs'])){ |
|
| 265 | - $tabs->set_user_tabs($REMOVE_ARR['remove_tabs'], $focus, 'remove'); |
|
| 266 | - }else{ |
|
| 267 | - $tabs->set_user_tabs(array(), $focus, 'remove'); |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - if(isset($_POST['no_opps'])) { |
|
| 272 | - $focus->setPreference('no_opps',$_POST['no_opps'], 0, 'global'); |
|
| 273 | - } |
|
| 274 | - else { |
|
| 275 | - $focus->setPreference('no_opps','off', 0, 'global'); |
|
| 276 | - } |
|
| 246 | + { |
|
| 247 | + $focus->setPreference('module_favicon', $_POST['user_module_favicon'], 0, 'global'); |
|
| 248 | + } |
|
| 249 | + else |
|
| 250 | + { |
|
| 251 | + $focus->setPreference('module_favicon', '', 0, 'global'); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + $tabs = new TabController(); |
|
| 255 | + if(isset($_POST['display_tabs'])) |
|
| 256 | + $tabs->set_user_tabs($DISPLAY_ARR['display_tabs'], $focus, 'display'); |
|
| 257 | + if(isset($HIDE_ARR['hide_tabs'])){ |
|
| 258 | + $tabs->set_user_tabs($HIDE_ARR['hide_tabs'], $focus, 'hide'); |
|
| 259 | + |
|
| 260 | + }else{ |
|
| 261 | + $tabs->set_user_tabs(array(), $focus, 'hide'); |
|
| 262 | + } |
|
| 263 | + if(is_admin($current_user)){ |
|
| 264 | + if(isset($REMOVE_ARR['remove_tabs'])){ |
|
| 265 | + $tabs->set_user_tabs($REMOVE_ARR['remove_tabs'], $focus, 'remove'); |
|
| 266 | + }else{ |
|
| 267 | + $tabs->set_user_tabs(array(), $focus, 'remove'); |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + if(isset($_POST['no_opps'])) { |
|
| 272 | + $focus->setPreference('no_opps',$_POST['no_opps'], 0, 'global'); |
|
| 273 | + } |
|
| 274 | + else { |
|
| 275 | + $focus->setPreference('no_opps','off', 0, 'global'); |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | 278 | // if(isset($_POST['reminder_checked']) && $_POST['reminder_checked'] == '1' && isset($_POST['reminder_checked'])){ |
| 279 | 279 | // $focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global'); |
@@ -289,129 +289,129 @@ discard block |
||
| 289 | 289 | // $focus->setPreference('email_reminder_time', -1, 0, 'global'); |
| 290 | 290 | // } |
| 291 | 291 | |
| 292 | - $focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global'); |
|
| 293 | - $focus->setPreference('email_reminder_time', $_POST['email_reminder_time'], 0, 'global'); |
|
| 294 | - $focus->setPreference('reminder_checked', $_POST['reminder_checked'], 0, 'global'); |
|
| 295 | - $focus->setPreference('email_reminder_checked', $_POST['email_reminder_checked'], 0, 'global'); |
|
| 292 | + $focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global'); |
|
| 293 | + $focus->setPreference('email_reminder_time', $_POST['email_reminder_time'], 0, 'global'); |
|
| 294 | + $focus->setPreference('reminder_checked', $_POST['reminder_checked'], 0, 'global'); |
|
| 295 | + $focus->setPreference('email_reminder_checked', $_POST['email_reminder_checked'], 0, 'global'); |
|
| 296 | 296 | |
| 297 | - if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global'); |
|
| 298 | - if(isset($_POST['ut'])) $focus->setPreference('ut', '0', 0, 'global'); |
|
| 299 | - else $focus->setPreference('ut', '1', 0, 'global'); |
|
| 300 | - if(isset($_POST['currency'])) $focus->setPreference('currency',$_POST['currency'], 0, 'global'); |
|
| 301 | - if(isset($_POST['default_currency_significant_digits'])) $focus->setPreference('default_currency_significant_digits',$_POST['default_currency_significant_digits'], 0, 'global'); |
|
| 302 | - if(isset($_POST['num_grp_sep'])) $focus->setPreference('num_grp_sep', $_POST['num_grp_sep'], 0, 'global'); |
|
| 303 | - if(isset($_POST['dec_sep'])) $focus->setPreference('dec_sep', $_POST['dec_sep'], 0, 'global'); |
|
| 297 | + if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global'); |
|
| 298 | + if(isset($_POST['ut'])) $focus->setPreference('ut', '0', 0, 'global'); |
|
| 299 | + else $focus->setPreference('ut', '1', 0, 'global'); |
|
| 300 | + if(isset($_POST['currency'])) $focus->setPreference('currency',$_POST['currency'], 0, 'global'); |
|
| 301 | + if(isset($_POST['default_currency_significant_digits'])) $focus->setPreference('default_currency_significant_digits',$_POST['default_currency_significant_digits'], 0, 'global'); |
|
| 302 | + if(isset($_POST['num_grp_sep'])) $focus->setPreference('num_grp_sep', $_POST['num_grp_sep'], 0, 'global'); |
|
| 303 | + if(isset($_POST['dec_sep'])) $focus->setPreference('dec_sep', $_POST['dec_sep'], 0, 'global'); |
|
| 304 | 304 | if(isset($_POST['fdow'])) $focus->setPreference('fdow', $_POST['fdow'], 0, 'global'); |
| 305 | - if(isset($_POST['dateformat'])) $focus->setPreference('datef',$_POST['dateformat'], 0, 'global'); |
|
| 306 | - if(isset($_POST['timeformat'])) $focus->setPreference('timef',$_POST['timeformat'], 0, 'global'); |
|
| 307 | - if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global'); |
|
| 308 | - if(isset($_POST['mail_fromname'])) $focus->setPreference('mail_fromname',$_POST['mail_fromname'], 0, 'global'); |
|
| 309 | - if(isset($_POST['mail_fromaddress'])) $focus->setPreference('mail_fromaddress',$_POST['mail_fromaddress'], 0, 'global'); |
|
| 310 | - if(isset($_POST['mail_sendtype'])) $focus->setPreference('mail_sendtype', $_POST['mail_sendtype'], 0, 'global'); |
|
| 311 | - if(isset($_POST['mail_smtpserver'])) $focus->setPreference('mail_smtpserver',$_POST['mail_smtpserver'], 0, 'global'); |
|
| 312 | - if(isset($_POST['mail_smtpport'])) $focus->setPreference('mail_smtpport',$_POST['mail_smtpport'], 0, 'global'); |
|
| 313 | - if(isset($_POST['mail_smtpuser'])) $focus->setPreference('mail_smtpuser',$_POST['mail_smtpuser'], 0, 'global'); |
|
| 314 | - if(isset($_POST['mail_smtppass'])) $focus->setPreference('mail_smtppass',$_POST['mail_smtppass'], 0, 'global'); |
|
| 315 | - if(isset($_POST['default_locale_name_format'])) $focus->setPreference('default_locale_name_format',$_POST['default_locale_name_format'], 0, 'global'); |
|
| 316 | - if(isset($_POST['export_delimiter'])) $focus->setPreference('export_delimiter', $_POST['export_delimiter'], 0, 'global'); |
|
| 317 | - if(isset($_POST['default_export_charset'])) $focus->setPreference('default_export_charset', $_POST['default_export_charset'], 0, 'global'); |
|
| 318 | - if(isset($_POST['use_real_names'])) { |
|
| 319 | - $focus->setPreference('use_real_names', 'on', 0, 'global'); |
|
| 320 | - } elseif(!isset($_POST['use_real_names']) && !isset($_POST['from_dcmenu'])) { |
|
| 321 | - // Make sure we're on the full form and not the QuickCreate. |
|
| 322 | - $focus->setPreference('use_real_names', 'off', 0, 'global'); |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - if(isset($_POST['mail_smtpauth_req'])) { |
|
| 326 | - $focus->setPreference('mail_smtpauth_req',$_POST['mail_smtpauth_req'] , 0, 'global'); |
|
| 327 | - } else { |
|
| 328 | - $focus->setPreference('mail_smtpauth_req','', 0, 'global'); |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - // SSL-enabled SMTP connection |
|
| 332 | - if(isset($_POST['mail_smtpssl'])) { |
|
| 333 | - $focus->setPreference('mail_smtpssl', 1, 0, 'global'); |
|
| 334 | - } else { |
|
| 335 | - $focus->setPreference('mail_smtpssl', 0, 0, 'global'); |
|
| 336 | - } |
|
| 337 | - /////////////////////////////////////////////////////////////////////////// |
|
| 338 | - //// PDF SETTINGS |
|
| 339 | - foreach($_POST as $k=>$v){ |
|
| 340 | - if(strpos($k,"sugarpdf_pdf") !== false){ |
|
| 341 | - $focus->setPreference($k, $v, 0, 'global'); |
|
| 342 | - } |
|
| 343 | - } |
|
| 344 | - //// PDF SETTINGS |
|
| 345 | - /////////////////////////////////////////////////////////////////////////// |
|
| 346 | - |
|
| 347 | - /////////////////////////////////////////////////////////////////////////// |
|
| 348 | - //// SIGNATURES |
|
| 349 | - if(isset($_POST['signature_id'])) |
|
| 350 | - $focus->setPreference('signature_default', $_POST['signature_id'], 0, 'global'); |
|
| 351 | - |
|
| 352 | - if(isset($_POST['signature_prepend'])) $focus->setPreference('signature_prepend',$_POST['signature_prepend'], 0, 'global'); |
|
| 353 | - //// END SIGNATURES |
|
| 354 | - /////////////////////////////////////////////////////////////////////////// |
|
| 355 | - |
|
| 356 | - |
|
| 357 | - if(isset($_POST['email_link_type'])) $focus->setPreference('email_link_type', $_REQUEST['email_link_type']); |
|
| 358 | - if(isset($_REQUEST['email_show_counts'])) { |
|
| 359 | - $focus->setPreference('email_show_counts', $_REQUEST['email_show_counts'], 0, 'global'); |
|
| 360 | - } else { |
|
| 361 | - $focus->setPreference('email_show_counts', 0, 0, 'global'); |
|
| 362 | - } |
|
| 363 | - if(isset($_REQUEST['email_editor_option'])) |
|
| 364 | - $focus->setPreference('email_editor_option', $_REQUEST['email_editor_option'], 0, 'global'); |
|
| 365 | - if(isset($_REQUEST['default_email_charset'])) |
|
| 366 | - $focus->setPreference('default_email_charset', $_REQUEST['default_email_charset'], 0, 'global'); |
|
| 367 | - |
|
| 368 | - if(isset($_POST['calendar_publish_key'])) $focus->setPreference('calendar_publish_key',$_POST['calendar_publish_key'], 0, 'global'); |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - if (!$focus->verify_data()) |
|
| 372 | - { |
|
| 373 | - header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string)); |
|
| 374 | - exit; |
|
| 375 | - } |
|
| 376 | - else |
|
| 377 | - { $GLOBALS['sugar_config']['disable_team_access_check'] = true; |
|
| 378 | - $focus->save(); |
|
| 379 | - $GLOBALS['sugar_config']['disable_team_access_check'] = false; |
|
| 380 | - $return_id = $focus->id; |
|
| 381 | - $ieVerified = true; |
|
| 382 | - |
|
| 383 | - global $new_pwd; |
|
| 384 | - $new_pwd=''; |
|
| 385 | - if((isset($_POST['old_password']) || $focus->portal_only) && |
|
| 386 | - (isset($_POST['new_password']) && !empty($_POST['new_password'])) && |
|
| 387 | - (isset($_POST['password_change']) && $_POST['password_change'] == 'true') ) { |
|
| 388 | - if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) { |
|
| 389 | - if((isset($_POST['page']) && $_POST['page'] == 'EditView')){ |
|
| 390 | - header("Location: index.php?action=EditView&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string)); |
|
| 391 | - exit; |
|
| 392 | - } |
|
| 393 | - if((isset($_POST['page']) && $_POST['page'] == 'Change')){ |
|
| 394 | - header("Location: index.php?action=ChangePassword&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string)); |
|
| 395 | - exit; |
|
| 396 | - } |
|
| 397 | - } |
|
| 398 | - else{ |
|
| 399 | - if ($newUser) |
|
| 400 | - $new_pwd='3'; |
|
| 401 | - else |
|
| 402 | - $new_pwd='1'; |
|
| 403 | - } |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - /////////////////////////////////////////////////////////////////////////// |
|
| 407 | - //// OUTBOUND EMAIL SAVES |
|
| 408 | - /////////////////////////////////////////////////////////////////////////// |
|
| 409 | - |
|
| 410 | - $sysOutboundAccunt = new OutboundEmail(); |
|
| 411 | - |
|
| 412 | - //If a user is not alloweed to use the default system outbound account then they will be |
|
| 413 | - //saving their own username/password for the system account |
|
| 414 | - if( ! $sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound() ) |
|
| 305 | + if(isset($_POST['dateformat'])) $focus->setPreference('datef',$_POST['dateformat'], 0, 'global'); |
|
| 306 | + if(isset($_POST['timeformat'])) $focus->setPreference('timef',$_POST['timeformat'], 0, 'global'); |
|
| 307 | + if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global'); |
|
| 308 | + if(isset($_POST['mail_fromname'])) $focus->setPreference('mail_fromname',$_POST['mail_fromname'], 0, 'global'); |
|
| 309 | + if(isset($_POST['mail_fromaddress'])) $focus->setPreference('mail_fromaddress',$_POST['mail_fromaddress'], 0, 'global'); |
|
| 310 | + if(isset($_POST['mail_sendtype'])) $focus->setPreference('mail_sendtype', $_POST['mail_sendtype'], 0, 'global'); |
|
| 311 | + if(isset($_POST['mail_smtpserver'])) $focus->setPreference('mail_smtpserver',$_POST['mail_smtpserver'], 0, 'global'); |
|
| 312 | + if(isset($_POST['mail_smtpport'])) $focus->setPreference('mail_smtpport',$_POST['mail_smtpport'], 0, 'global'); |
|
| 313 | + if(isset($_POST['mail_smtpuser'])) $focus->setPreference('mail_smtpuser',$_POST['mail_smtpuser'], 0, 'global'); |
|
| 314 | + if(isset($_POST['mail_smtppass'])) $focus->setPreference('mail_smtppass',$_POST['mail_smtppass'], 0, 'global'); |
|
| 315 | + if(isset($_POST['default_locale_name_format'])) $focus->setPreference('default_locale_name_format',$_POST['default_locale_name_format'], 0, 'global'); |
|
| 316 | + if(isset($_POST['export_delimiter'])) $focus->setPreference('export_delimiter', $_POST['export_delimiter'], 0, 'global'); |
|
| 317 | + if(isset($_POST['default_export_charset'])) $focus->setPreference('default_export_charset', $_POST['default_export_charset'], 0, 'global'); |
|
| 318 | + if(isset($_POST['use_real_names'])) { |
|
| 319 | + $focus->setPreference('use_real_names', 'on', 0, 'global'); |
|
| 320 | + } elseif(!isset($_POST['use_real_names']) && !isset($_POST['from_dcmenu'])) { |
|
| 321 | + // Make sure we're on the full form and not the QuickCreate. |
|
| 322 | + $focus->setPreference('use_real_names', 'off', 0, 'global'); |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + if(isset($_POST['mail_smtpauth_req'])) { |
|
| 326 | + $focus->setPreference('mail_smtpauth_req',$_POST['mail_smtpauth_req'] , 0, 'global'); |
|
| 327 | + } else { |
|
| 328 | + $focus->setPreference('mail_smtpauth_req','', 0, 'global'); |
|
| 329 | + } |
|
| 330 | + |
|
| 331 | + // SSL-enabled SMTP connection |
|
| 332 | + if(isset($_POST['mail_smtpssl'])) { |
|
| 333 | + $focus->setPreference('mail_smtpssl', 1, 0, 'global'); |
|
| 334 | + } else { |
|
| 335 | + $focus->setPreference('mail_smtpssl', 0, 0, 'global'); |
|
| 336 | + } |
|
| 337 | + /////////////////////////////////////////////////////////////////////////// |
|
| 338 | + //// PDF SETTINGS |
|
| 339 | + foreach($_POST as $k=>$v){ |
|
| 340 | + if(strpos($k,"sugarpdf_pdf") !== false){ |
|
| 341 | + $focus->setPreference($k, $v, 0, 'global'); |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | + //// PDF SETTINGS |
|
| 345 | + /////////////////////////////////////////////////////////////////////////// |
|
| 346 | + |
|
| 347 | + /////////////////////////////////////////////////////////////////////////// |
|
| 348 | + //// SIGNATURES |
|
| 349 | + if(isset($_POST['signature_id'])) |
|
| 350 | + $focus->setPreference('signature_default', $_POST['signature_id'], 0, 'global'); |
|
| 351 | + |
|
| 352 | + if(isset($_POST['signature_prepend'])) $focus->setPreference('signature_prepend',$_POST['signature_prepend'], 0, 'global'); |
|
| 353 | + //// END SIGNATURES |
|
| 354 | + /////////////////////////////////////////////////////////////////////////// |
|
| 355 | + |
|
| 356 | + |
|
| 357 | + if(isset($_POST['email_link_type'])) $focus->setPreference('email_link_type', $_REQUEST['email_link_type']); |
|
| 358 | + if(isset($_REQUEST['email_show_counts'])) { |
|
| 359 | + $focus->setPreference('email_show_counts', $_REQUEST['email_show_counts'], 0, 'global'); |
|
| 360 | + } else { |
|
| 361 | + $focus->setPreference('email_show_counts', 0, 0, 'global'); |
|
| 362 | + } |
|
| 363 | + if(isset($_REQUEST['email_editor_option'])) |
|
| 364 | + $focus->setPreference('email_editor_option', $_REQUEST['email_editor_option'], 0, 'global'); |
|
| 365 | + if(isset($_REQUEST['default_email_charset'])) |
|
| 366 | + $focus->setPreference('default_email_charset', $_REQUEST['default_email_charset'], 0, 'global'); |
|
| 367 | + |
|
| 368 | + if(isset($_POST['calendar_publish_key'])) $focus->setPreference('calendar_publish_key',$_POST['calendar_publish_key'], 0, 'global'); |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + if (!$focus->verify_data()) |
|
| 372 | + { |
|
| 373 | + header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string)); |
|
| 374 | + exit; |
|
| 375 | + } |
|
| 376 | + else |
|
| 377 | + { $GLOBALS['sugar_config']['disable_team_access_check'] = true; |
|
| 378 | + $focus->save(); |
|
| 379 | + $GLOBALS['sugar_config']['disable_team_access_check'] = false; |
|
| 380 | + $return_id = $focus->id; |
|
| 381 | + $ieVerified = true; |
|
| 382 | + |
|
| 383 | + global $new_pwd; |
|
| 384 | + $new_pwd=''; |
|
| 385 | + if((isset($_POST['old_password']) || $focus->portal_only) && |
|
| 386 | + (isset($_POST['new_password']) && !empty($_POST['new_password'])) && |
|
| 387 | + (isset($_POST['password_change']) && $_POST['password_change'] == 'true') ) { |
|
| 388 | + if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) { |
|
| 389 | + if((isset($_POST['page']) && $_POST['page'] == 'EditView')){ |
|
| 390 | + header("Location: index.php?action=EditView&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string)); |
|
| 391 | + exit; |
|
| 392 | + } |
|
| 393 | + if((isset($_POST['page']) && $_POST['page'] == 'Change')){ |
|
| 394 | + header("Location: index.php?action=ChangePassword&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string)); |
|
| 395 | + exit; |
|
| 396 | + } |
|
| 397 | + } |
|
| 398 | + else{ |
|
| 399 | + if ($newUser) |
|
| 400 | + $new_pwd='3'; |
|
| 401 | + else |
|
| 402 | + $new_pwd='1'; |
|
| 403 | + } |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + /////////////////////////////////////////////////////////////////////////// |
|
| 407 | + //// OUTBOUND EMAIL SAVES |
|
| 408 | + /////////////////////////////////////////////////////////////////////////// |
|
| 409 | + |
|
| 410 | + $sysOutboundAccunt = new OutboundEmail(); |
|
| 411 | + |
|
| 412 | + //If a user is not alloweed to use the default system outbound account then they will be |
|
| 413 | + //saving their own username/password for the system account |
|
| 414 | + if( ! $sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound() ) |
|
| 415 | 415 | { |
| 416 | 416 | $userOverrideOE = $sysOutboundAccunt->getUsersMailerForSystemOverride($focus->id); |
| 417 | 417 | if($userOverrideOE != null) |
@@ -430,29 +430,29 @@ discard block |
||
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | |
| 433 | - /////////////////////////////////////////////////////////////////////////// |
|
| 434 | - //// INBOUND EMAIL SAVES |
|
| 435 | - if(isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) { |
|
| 433 | + /////////////////////////////////////////////////////////////////////////// |
|
| 434 | + //// INBOUND EMAIL SAVES |
|
| 435 | + if(isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) { |
|
| 436 | 436 | |
| 437 | - $ie = new InboundEmail(); |
|
| 438 | - if(false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) { |
|
| 439 | - header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=".$return_id); |
|
| 440 | - die(); // die here, else the header redirect below takes over. |
|
| 441 | - } |
|
| 442 | - } elseif(isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) { |
|
| 443 | - // user is deleting their I-E |
|
| 437 | + $ie = new InboundEmail(); |
|
| 438 | + if(false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) { |
|
| 439 | + header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=".$return_id); |
|
| 440 | + die(); // die here, else the header redirect below takes over. |
|
| 441 | + } |
|
| 442 | + } elseif(isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) { |
|
| 443 | + // user is deleting their I-E |
|
| 444 | 444 | |
| 445 | - $ie = new InboundEmail(); |
|
| 446 | - $ie->deletePersonalEmailAccount($_REQUEST['ie_id'], $focus->user_name); |
|
| 447 | - } |
|
| 448 | - //// END INBOUND EMAIL SAVES |
|
| 449 | - /////////////////////////////////////////////////////////////////////////// |
|
| 450 | - if(($newUser) && !($focus->is_group) && !($focus->portal_only) && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){ |
|
| 451 | - $new_pwd='2'; |
|
| 452 | - require_once('modules/Users/GeneratePassword.php'); |
|
| 453 | - } |
|
| 445 | + $ie = new InboundEmail(); |
|
| 446 | + $ie->deletePersonalEmailAccount($_REQUEST['ie_id'], $focus->user_name); |
|
| 447 | + } |
|
| 448 | + //// END INBOUND EMAIL SAVES |
|
| 449 | + /////////////////////////////////////////////////////////////////////////// |
|
| 450 | + if(($newUser) && !($focus->is_group) && !($focus->portal_only) && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){ |
|
| 451 | + $new_pwd='2'; |
|
| 452 | + require_once('modules/Users/GeneratePassword.php'); |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | - } |
|
| 455 | + } |
|
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | //handle navigation from user wizard |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | //if this is an existing bean and the type is empty, then populate user type |
| 220 | 220 | if(!empty($this->bean->id) && empty($this->bean->user_type)) |
| 221 | - { |
|
| 221 | + { |
|
| 222 | 222 | $this->setUserType($this->bean); |
| 223 | 223 | $userType = $this->bean->user_type; |
| 224 | 224 | } else { |
@@ -414,26 +414,26 @@ discard block |
||
| 414 | 414 | $this->ss->assign('NO_OPPS', 'CHECKED'); |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - $reminder_time = $this->bean->getPreference('reminder_time'); |
|
| 418 | - if(empty($reminder_time)){ |
|
| 419 | - $reminder_time = -1; |
|
| 420 | - } |
|
| 421 | - $email_reminder_time = $this->bean->getPreference('email_reminder_time'); |
|
| 422 | - if(empty($email_reminder_time)){ |
|
| 423 | - $email_reminder_time = -1; |
|
| 424 | - } |
|
| 417 | + $reminder_time = $this->bean->getPreference('reminder_time'); |
|
| 418 | + if(empty($reminder_time)){ |
|
| 419 | + $reminder_time = -1; |
|
| 420 | + } |
|
| 421 | + $email_reminder_time = $this->bean->getPreference('email_reminder_time'); |
|
| 422 | + if(empty($email_reminder_time)){ |
|
| 423 | + $email_reminder_time = -1; |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | 426 | $this->ss->assign("REMINDER_TIME_OPTIONS", $app_list_strings['reminder_time_options']); |
| 427 | 427 | $this->ss->assign("EMAIL_REMINDER_TIME_OPTIONS", $app_list_strings['reminder_time_options']); |
| 428 | - $this->ss->assign("REMINDER_TIME", $reminder_time); |
|
| 429 | - $this->ss->assign("EMAIL_REMINDER_TIME", $email_reminder_time); |
|
| 428 | + $this->ss->assign("REMINDER_TIME", $reminder_time); |
|
| 429 | + $this->ss->assign("EMAIL_REMINDER_TIME", $email_reminder_time); |
|
| 430 | 430 | |
| 431 | 431 | $remindersDefaultPreferences = Reminder::loadRemindersDefaultValuesData(); |
| 432 | - $this->ss->assign("REMINDER_CHECKED", $remindersDefaultPreferences['popup']); |
|
| 433 | - $this->ss->assign("EMAIL_REMINDER_CHECKED", $remindersDefaultPreferences['email']); |
|
| 432 | + $this->ss->assign("REMINDER_CHECKED", $remindersDefaultPreferences['popup']); |
|
| 433 | + $this->ss->assign("EMAIL_REMINDER_CHECKED", $remindersDefaultPreferences['email']); |
|
| 434 | 434 | |
| 435 | - $this->ss->assign("REMINDER_TABINDEX", "12"); |
|
| 436 | - $publish_key = $this->bean->getPreference('calendar_publish_key' ); |
|
| 435 | + $this->ss->assign("REMINDER_TABINDEX", "12"); |
|
| 436 | + $publish_key = $this->bean->getPreference('calendar_publish_key' ); |
|
| 437 | 437 | $this->ss->assign('CALENDAR_PUBLISH_KEY', $publish_key); |
| 438 | 438 | |
| 439 | 439 | $publish_url = $sugar_config['site_url'].'/vcal_server.php'; |
@@ -156,9 +156,9 @@ discard block |
||
| 156 | 156 | if(strpos($server_software,'Microsoft-IIS') !== false) |
| 157 | 157 | { |
| 158 | 158 | installLog("calling handleWebConfig()"); |
| 159 | - handleWebConfig(); |
|
| 159 | + handleWebConfig(); |
|
| 160 | 160 | } else { |
| 161 | - installLog("calling handleHtaccess()"); |
|
| 161 | + installLog("calling handleHtaccess()"); |
|
| 162 | 162 | handleHtaccess(); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -228,27 +228,27 @@ discard block |
||
| 228 | 228 | * loop through all the Beans and create their tables |
| 229 | 229 | */ |
| 230 | 230 | installStatus($mod_strings['STAT_CREATE_DB']); |
| 231 | - installLog("looping through all the Beans and create their tables"); |
|
| 232 | - //start by clearing out the vardefs |
|
| 233 | - VardefManager::clearVardef(); |
|
| 231 | + installLog("looping through all the Beans and create their tables"); |
|
| 232 | + //start by clearing out the vardefs |
|
| 233 | + VardefManager::clearVardef(); |
|
| 234 | 234 | installerHook('pre_createAllModuleTables'); |
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | foreach( $beanFiles as $bean => $file ) { |
| 238 | - $doNotInit = array('Scheduler', 'SchedulersJob', 'ProjectTask','jjwg_Maps','jjwg_Address_Cache','jjwg_Areas','jjwg_Markers'); |
|
| 238 | + $doNotInit = array('Scheduler', 'SchedulersJob', 'ProjectTask','jjwg_Maps','jjwg_Address_Cache','jjwg_Areas','jjwg_Markers'); |
|
| 239 | 239 | |
| 240 | - if(in_array($bean, $doNotInit)) { |
|
| 241 | - $focus = new $bean(false); |
|
| 242 | - } else { |
|
| 243 | - $focus = new $bean(); |
|
| 244 | - } |
|
| 240 | + if(in_array($bean, $doNotInit)) { |
|
| 241 | + $focus = new $bean(false); |
|
| 242 | + } else { |
|
| 243 | + $focus = new $bean(); |
|
| 244 | + } |
|
| 245 | 245 | |
| 246 | - if ( $bean == 'Configurator' ) |
|
| 247 | - continue; |
|
| 246 | + if ( $bean == 'Configurator' ) |
|
| 247 | + continue; |
|
| 248 | 248 | |
| 249 | 249 | $table_name = $focus->table_name; |
| 250 | 250 | //installStatus(sprintf($mod_strings['STAT_CREATE_DB_TABLE'], $focus->table_name )); |
| 251 | - installLog("processing table ".$focus->table_name); |
|
| 251 | + installLog("processing table ".$focus->table_name); |
|
| 252 | 252 | // check to see if we have already setup this table |
| 253 | 253 | if(!in_array($table_name, $processed_tables)) { |
| 254 | 254 | if(!file_exists("modules/".$focus->module_dir."/vardefs.php")){ |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | continue; // support new vardef definitions |
| 261 | 261 | } |
| 262 | 262 | } else { |
| 263 | - continue; //no further processing needed for ignored beans. |
|
| 263 | + continue; //no further processing needed for ignored beans. |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // table has not been setup...we will do it now and remember that |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | installerHook('pre_createModuleTable', array('module' => $focus->getObjectName())); |
| 289 | 289 | SugarBean::createRelationshipMeta($focus->getObjectName(), $db, $table_name, $empty, $focus->module_dir); |
| 290 | 290 | installerHook('post_createModuleTable', array('module' => $focus->getObjectName())); |
| 291 | - echo "."; |
|
| 291 | + echo "."; |
|
| 292 | 292 | |
| 293 | 293 | } // end if() |
| 294 | 294 | } |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | //require_once('modules/Connectors/InstallDefaultConnectors.php'); |
| 422 | 422 | |
| 423 | - /////////////////////////////////////////////////////////////////////////////// |
|
| 424 | - //// INSTALL PASSWORD TEMPLATES |
|
| 423 | + /////////////////////////////////////////////////////////////////////////////// |
|
| 424 | + //// INSTALL PASSWORD TEMPLATES |
|
| 425 | 425 | include('install/seed_data/Advanced_Password_SeedData.php'); |
| 426 | 426 | |
| 427 | 427 | /////////////////////////////////////////////////////////////////////////////// |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | private function getFormItems($mod_strings, $app_list_strings, $sugarConfigDefaults, $drivers, $checked, $db, $errors, $supportedLanguages, |
| 224 | - $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) { |
|
| 224 | + $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) { |
|
| 225 | 225 | |
| 226 | 226 | |
| 227 | 227 | |
@@ -445,9 +445,9 @@ discard block |
||
| 445 | 445 | $_SESSION['email1'] = null; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if(!isset($_SESSION['setup_site_admin_user_name'])) { |
|
| 449 | - $_SESSION['setup_site_admin_user_name'] = null; |
|
| 450 | - } |
|
| 448 | + if(!isset($_SESSION['setup_site_admin_user_name'])) { |
|
| 449 | + $_SESSION['setup_site_admin_user_name'] = null; |
|
| 450 | + } |
|
| 451 | 451 | |
| 452 | 452 | $out .=<<<EOQ |
| 453 | 453 | <div class='install_block'> |
@@ -41,34 +41,34 @@ |
||
| 41 | 41 | define('PACKAGE_MANAGER_DOWNLOAD_PAGE', 'download.php'); |
| 42 | 42 | class PackageManagerDownloader{ |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Using curl we will download the file from the depot server |
|
| 46 | - * |
|
| 47 | - * @param session_id the session_id this file is queued for |
|
| 48 | - * @param file_name the file_name to download |
|
| 49 | - * @param save_dir (optional) if specified it will direct where to save the file once downloaded |
|
| 50 | - * @param download_sever (optional) if specified it will direct the url for the download |
|
| 51 | - * |
|
| 52 | - * @return the full path of the saved file |
|
| 53 | - */ |
|
| 54 | - function download($session_id, $file_name, $save_dir = '', $download_server = ''){ |
|
| 55 | - if(empty($save_dir)){ |
|
| 56 | - $save_dir = "upload://"; |
|
| 57 | - } |
|
| 58 | - if(empty($download_server)){ |
|
| 59 | - $download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER; |
|
| 60 | - } |
|
| 61 | - $download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE; |
|
| 62 | - $ch = curl_init($download_server . '?filename='. $file_name); |
|
| 63 | - $fp = sugar_fopen($save_dir . $file_name, 'w'); |
|
| 64 | - curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';'); |
|
| 65 | - curl_setopt($ch, CURLOPT_FILE, $fp); |
|
| 66 | - curl_setopt($ch, CURLOPT_HEADER, 0); |
|
| 67 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 68 | - curl_exec($ch); |
|
| 69 | - curl_close($ch); |
|
| 70 | - fclose($fp); |
|
| 71 | - return $save_dir . $file_name; |
|
| 72 | - } |
|
| 44 | + /** |
|
| 45 | + * Using curl we will download the file from the depot server |
|
| 46 | + * |
|
| 47 | + * @param session_id the session_id this file is queued for |
|
| 48 | + * @param file_name the file_name to download |
|
| 49 | + * @param save_dir (optional) if specified it will direct where to save the file once downloaded |
|
| 50 | + * @param download_sever (optional) if specified it will direct the url for the download |
|
| 51 | + * |
|
| 52 | + * @return the full path of the saved file |
|
| 53 | + */ |
|
| 54 | + function download($session_id, $file_name, $save_dir = '', $download_server = ''){ |
|
| 55 | + if(empty($save_dir)){ |
|
| 56 | + $save_dir = "upload://"; |
|
| 57 | + } |
|
| 58 | + if(empty($download_server)){ |
|
| 59 | + $download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER; |
|
| 60 | + } |
|
| 61 | + $download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE; |
|
| 62 | + $ch = curl_init($download_server . '?filename='. $file_name); |
|
| 63 | + $fp = sugar_fopen($save_dir . $file_name, 'w'); |
|
| 64 | + curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';'); |
|
| 65 | + curl_setopt($ch, CURLOPT_FILE, $fp); |
|
| 66 | + curl_setopt($ch, CURLOPT_HEADER, 0); |
|
| 67 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
|
| 68 | + curl_exec($ch); |
|
| 69 | + curl_close($ch); |
|
| 70 | + fclose($fp); |
|
| 71 | + return $save_dir . $file_name; |
|
| 72 | + } |
|
| 73 | 73 | } |
| 74 | 74 | ?> |
| 75 | 75 | \ No newline at end of file |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | class PackageManagerDisplay{ |
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * A Static method to Build the display for the package manager |
| 52 | 52 | * |
| 53 | 53 | * @param String form1 - the form to display for manual downloading |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * @return String - a string of html which will be used to display the forms |
| 59 | 59 | */ |
| 60 | 60 | static function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false){ |
| 61 | - global $current_language; |
|
| 61 | + global $current_language; |
|
| 62 | 62 | |
| 63 | 63 | $mod_strings = return_module_language($current_language, "Administration"); |
| 64 | 64 | global $app_strings; |
@@ -76,18 +76,18 @@ discard block |
||
| 76 | 76 | $show_login = $result['show_login']; |
| 77 | 77 | $mi_errors = ModuleInstaller::getErrors(); |
| 78 | 78 | $error_html = ""; |
| 79 | - if(!empty($mi_errors)){ |
|
| 80 | - $error_html = "<tr><td><span>"; |
|
| 81 | - foreach($mi_errors as $error){ |
|
| 82 | - $error_html .= "<font color='red'>".$error."</font><br>"; |
|
| 83 | - } |
|
| 84 | - $error_html .= "</span></td></tr>"; |
|
| 85 | - } |
|
| 79 | + if(!empty($mi_errors)){ |
|
| 80 | + $error_html = "<tr><td><span>"; |
|
| 81 | + foreach($mi_errors as $error){ |
|
| 82 | + $error_html .= "<font color='red'>".$error."</font><br>"; |
|
| 83 | + } |
|
| 84 | + $error_html .= "</span></td></tr>"; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | $form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>"; |
| 88 | 88 | $form2 .= $error_html; |
| 89 | 89 | if(!$isAlive) |
| 90 | - $form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>"; |
|
| 90 | + $form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>"; |
|
| 91 | 91 | $form2 .= "</table>"; |
| 92 | 92 | |
| 93 | 93 | $tree = null; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $form2 .= "<table class='tabForm' cellpadding='0' cellspacing='0' width='100%' border='0'>"; |
| 101 | 101 | $form2 .= "<tr><td></td><td align='left'>"; |
| 102 | 102 | if($isAlive){ |
| 103 | - $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>"; |
|
| 103 | + $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>"; |
|
| 104 | 104 | }else{ |
| 105 | 105 | $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'style='display:none;'>"; |
| 106 | 106 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | $form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div' style='display:none;'><img src='".SugarThemeRegistry::current()->getImageURL('basic_search.gif')."' width='8' height='8' border='0'> Collapse</span></a></slot>"; |
| 113 | 113 | } |
| 114 | 114 | $form2 .= "</td></tr></table>"; |
| 115 | - $form2 = ''; //Commenting out the form as part of sugar depot hiding. |
|
| 115 | + $form2 = ''; //Commenting out the form as part of sugar depot hiding. |
|
| 116 | 116 | $ss->assign('installation', ($install ? 'true' : 'false')); |
| 117 | 117 | |
| 118 | 118 | |
| 119 | - $mod_strings = return_module_language($current_language, "Administration"); |
|
| 119 | + $mod_strings = return_module_language($current_language, "Administration"); |
|
| 120 | 120 | |
| 121 | 121 | $ss->assign('MOD', $mod_strings); |
| 122 | - $ss->assign('module_load', 'true'); |
|
| 122 | + $ss->assign('module_load', 'true'); |
|
| 123 | 123 | if (UploadStream::getSuhosinStatus() == false) |
| 124 | 124 | { |
| 125 | 125 | $ss->assign('ERR_SUHOSIN', true); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | $ss->assign('scripts', PackageManagerDisplay::getDisplayScript($install)); |
| 130 | 130 | } |
| 131 | 131 | $show_login = false; //hiding install from sugar |
| 132 | - $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login)); |
|
| 133 | - $ss->assign('FORM_2_PLACE_HOLDER', $form2); |
|
| 132 | + $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login)); |
|
| 133 | + $ss->assign('FORM_2_PLACE_HOLDER', $form2); |
|
| 134 | 134 | $ss->assign('MOD', $mod_strings); |
| 135 | 135 | $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED']; |
| 136 | 136 | $ss->assign('INSTALLED_PACKAGES_HOLDER', PackageManagerDisplay::buildInstalledGrid($mod_strings, $types)); |
| 137 | 137 | |
| 138 | - $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl'); |
|
| 139 | - return $str; |
|
| 138 | + $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl'); |
|
| 139 | + return $str; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @return String - a string of html which will be used to display the forms |
| 151 | 151 | */ |
| 152 | 152 | function buildPatchDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1'){ |
| 153 | - global $current_language; |
|
| 153 | + global $current_language; |
|
| 154 | 154 | $mod_strings = return_module_language($current_language, "Administration"); |
| 155 | 155 | $ss = new Sugar_Smarty(); |
| 156 | 156 | $ss->assign('FORM_1_PLACE_HOLDER', $form1); |
@@ -169,43 +169,43 @@ discard block |
||
| 169 | 169 | //} |
| 170 | 170 | $form2 = "<table class='tabForm' width='100%' cellpadding='0' cellspacing='0' width='100%' border='0'>"; |
| 171 | 171 | if(!$isAlive) |
| 172 | - $form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>"; |
|
| 172 | + $form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>"; |
|
| 173 | 173 | $form2 .= "</table>"; |
| 174 | 174 | $form2 .= "<table width='100%'><tr><td align='left'>"; |
| 175 | 175 | if($show_login){ |
| 176 | - $form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>"; |
|
| 176 | + $form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>"; |
|
| 177 | 177 | } |
| 178 | 178 | $form2 .= "</td><td align='right'><div id='workingStatusDiv' style='display:none;'>".SugarThemeRegistry::current()->getImage("sqsWait","border='0' align='bottom'",null,null,'.gif',"Loading")."</div></td></tr><tr><td colspan='2'>"; |
| 179 | 179 | |
| 180 | 180 | $loginViewStyle = ($isAlive ? 'none' : 'block'); |
| 181 | - $selectViewStyle = ($isAlive ? 'block' : 'none'); |
|
| 182 | - $form2 .= "<div id='selectView' style='display:".$selectViewStyle."'>"; |
|
| 183 | - $form2 .= " <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: ".$display.";'></div>"; |
|
| 184 | - $form2 .= "</div>"; |
|
| 185 | - if(!$show_login) |
|
| 186 | - $loginViewStyle = 'none'; |
|
| 187 | - //$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>"; |
|
| 188 | - //$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive); |
|
| 189 | - //$form2 .= "</div>"; |
|
| 181 | + $selectViewStyle = ($isAlive ? 'block' : 'none'); |
|
| 182 | + $form2 .= "<div id='selectView' style='display:".$selectViewStyle."'>"; |
|
| 183 | + $form2 .= " <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: ".$display.";'></div>"; |
|
| 184 | + $form2 .= "</div>"; |
|
| 185 | + if(!$show_login) |
|
| 186 | + $loginViewStyle = 'none'; |
|
| 187 | + //$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>"; |
|
| 188 | + //$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive); |
|
| 189 | + //$form2 .= "</div>"; |
|
| 190 | 190 | |
| 191 | 191 | $form2 .= "</td></tr></table>"; |
| 192 | 192 | $form2 = ''; |
| 193 | 193 | $packages = array(); |
| 194 | 194 | $releases = array(); |
| 195 | 195 | if($isAlive){ |
| 196 | - $filter = array(); |
|
| 197 | - $count = count($types); |
|
| 198 | - $index = 1; |
|
| 199 | - $type_str = '"'; |
|
| 200 | - foreach($types as $type){ |
|
| 201 | - $type_str .= "'".$type."'"; |
|
| 202 | - if($index < $count) |
|
| 203 | - $type_str .= ","; |
|
| 204 | - $index++; |
|
| 205 | - } |
|
| 206 | - $type_str .= '"'; |
|
| 207 | - $filter = array('type' => $type_str); |
|
| 208 | - $filter = PackageManager::toNameValueList($filter); |
|
| 196 | + $filter = array(); |
|
| 197 | + $count = count($types); |
|
| 198 | + $index = 1; |
|
| 199 | + $type_str = '"'; |
|
| 200 | + foreach($types as $type){ |
|
| 201 | + $type_str .= "'".$type."'"; |
|
| 202 | + if($index < $count) |
|
| 203 | + $type_str .= ","; |
|
| 204 | + $index++; |
|
| 205 | + } |
|
| 206 | + $type_str .= '"'; |
|
| 207 | + $filter = array('type' => $type_str); |
|
| 208 | + $filter = PackageManager::toNameValueList($filter); |
|
| 209 | 209 | $pm = new PackageManager(); |
| 210 | 210 | /*if(in_array('patch', $types)){ |
| 211 | 211 | $releases = $pm->getReleases('3', '3', $filter); |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | }*/ |
| 215 | 215 | } |
| 216 | 216 | if($form_action == 'install.php' && (empty($releases) || count($releases['packages']) == 0)){ |
| 217 | - //return false; |
|
| 217 | + //return false; |
|
| 218 | 218 | } |
| 219 | 219 | $tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive); |
| 220 | 220 | $tree->tree_style= 'include/ytree/TreeView/css/check/tree.css'; |
| 221 | 221 | $ss->assign('TREEHEADER',$tree->generate_header()); |
| 222 | - $ss->assign('module_load', 'false'); |
|
| 223 | - $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login)); |
|
| 222 | + $ss->assign('module_load', 'false'); |
|
| 223 | + $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login)); |
|
| 224 | 224 | $ss->assign('FORM_2_PLACE_HOLDER', $form2); |
| 225 | 225 | $ss->assign('scripts', PackageManagerDisplay::getDisplayScript(false, 'patch', $releases, $types, $isAlive)); |
| 226 | 226 | $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl'); |
@@ -228,34 +228,34 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | static function buildInstalledGrid($mod_strings, $types = array('modules')){ |
| 231 | - $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED']; |
|
| 232 | - $output = '<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="left">'.$descItemsInstalled.'</td>'; |
|
| 233 | - $output .= '</td></tr></table>'; |
|
| 234 | - $output .= "<table width='100%'><tr><td ><div id='installed_grid' class='ygrid-mso' style='height:205px;'></div></td></tr></table>"; |
|
| 235 | - return $output; |
|
| 231 | + $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED']; |
|
| 232 | + $output = '<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="left">'.$descItemsInstalled.'</td>'; |
|
| 233 | + $output .= '</td></tr></table>'; |
|
| 234 | + $output .= "<table width='100%'><tr><td ><div id='installed_grid' class='ygrid-mso' style='height:205px;'></div></td></tr></table>"; |
|
| 235 | + return $output; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | function buildLoginPanel($mod_strings, $display_cancel){ |
| 239 | 239 | $credentials = PackageManager::getCredentials(); |
| 240 | - $output = "<div id='login_panel'><div class='hd'><b>".$mod_strings['HDR_LOGIN_PANEL']."</b></div>"; |
|
| 240 | + $output = "<div id='login_panel'><div class='hd'><b>".$mod_strings['HDR_LOGIN_PANEL']."</b></div>"; |
|
| 241 | 241 | $output .= "<div class='bd'><form><table><tr><td>".$mod_strings['LBL_USERNAME']."</td><td><input type='text' name='login_panel_username' id='login_panel_username' value='".$credentials['username']."'></td><td><a href='http://www.sugarcrm.com/crm/index.php?option=com_registration&task=register' target='blank'>".$mod_strings['LNK_NEW_ACCOUNT']."</a></td>"; |
| 242 | 242 | |
| 243 | 243 | $output .= "</tr><tr><td>".$mod_strings['LBL_PASSWORD']."</td><td><input type='password' name='login_panel_password' id='login_panel_password'></td><td><a href='http://www.sugarcrm.com/crm/component/option,com_registration/Itemid,0/task,lostPassword/' target='blank'>".$mod_strings['LNK_FORGOT_PASS']."</a></td>"; |
| 244 | 244 | |
| 245 | - $terms = PackageManager::getTermsAndConditions(); |
|
| 246 | - $output .= "</tr><tr><td colspan='6' valign='top'><b>".$mod_strings['LBL_TERMS_AND_CONDITIONS']."</b><br><textarea readonly cols=80 rows=8>" . $terms['terms'] . '</textarea></td>'; |
|
| 247 | - $_SESSION['SugarDepot_TermsVersion'] = (!empty($terms['version']) ? $terms['version'] : ''); |
|
| 245 | + $terms = PackageManager::getTermsAndConditions(); |
|
| 246 | + $output .= "</tr><tr><td colspan='6' valign='top'><b>".$mod_strings['LBL_TERMS_AND_CONDITIONS']."</b><br><textarea readonly cols=80 rows=8>" . $terms['terms'] . '</textarea></td>'; |
|
| 247 | + $_SESSION['SugarDepot_TermsVersion'] = (!empty($terms['version']) ? $terms['version'] : ''); |
|
| 248 | 248 | |
| 249 | - $output .= "</td></tr><tr><td colspan='6'><input class='checkbox' type='checkbox' name='cb_terms' id='cb_terms' onclick='if(this.checked){this.form.panel_login_button.disabled=false;}else{this.form.panel_login_button.disabled=true;}'>".$mod_strings['LBL_ACCEPT_TERMS']."</td></tr><tr>"; |
|
| 249 | + $output .= "</td></tr><tr><td colspan='6'><input class='checkbox' type='checkbox' name='cb_terms' id='cb_terms' onclick='if(this.checked){this.form.panel_login_button.disabled=false;}else{this.form.panel_login_button.disabled=true;}'>".$mod_strings['LBL_ACCEPT_TERMS']."</td></tr><tr>"; |
|
| 250 | 250 | $output .= "<td align='left'>"; |
| 251 | 251 | $output .= "<input type='button' id='panel_login_button' name='panel_login_button' value='Login' class='button' onClick='PackageManager.authenticate(this.form.login_panel_username.value, this.form.login_panel_password.value, \"\",\"" . $terms['version'] . "\");' disabled>"; |
| 252 | 252 | |
| 253 | 253 | if($display_cancel){ |
| 254 | - $output .= " <input type='button' id='panel_cancel_button' value='Cancel' class='button' onClick='PackageManager.showLoginDialog(false);'>"; |
|
| 254 | + $output .= " <input type='button' id='panel_cancel_button' value='Cancel' class='button' onClick='PackageManager.showLoginDialog(false);'>"; |
|
| 255 | 255 | } |
| 256 | 256 | $output .= "</td><td></td></tr>"; |
| 257 | - $output .= "<tr></td><td></td></tr>"; |
|
| 258 | - $output .= "</table></div>"; |
|
| 257 | + $output .= "<tr></td><td></td></tr>"; |
|
| 258 | + $output .= "</table></div>"; |
|
| 259 | 259 | $output .= "<div class='ft'></div></form></div>"; |
| 260 | 260 | return $output; |
| 261 | 261 | } |
@@ -267,48 +267,48 @@ discard block |
||
| 267 | 267 | * @param Array mod_strings - the local mod strings to display |
| 268 | 268 | * @return String - a string of html |
| 269 | 269 | */ |
| 270 | - static function buildGridOutput($tree, $mod_strings, $display = true, $show_login = true){ |
|
| 271 | - $output = "<div id='catview'>"; |
|
| 272 | - $loginViewStyle = ($display ? 'none' : 'block'); |
|
| 273 | - $selectViewStyle = ($display ? 'block' : 'none'); |
|
| 274 | - $output .= "<div id='selectView' style='display:".$selectViewStyle."'>"; |
|
| 275 | - //if($display){ |
|
| 276 | - $output .= "<table border=0 width='100%' class='moduleTitle'><tr><td width='100%' valign='top'>"; |
|
| 277 | - $output .= "<div id='treeview'>"; |
|
| 278 | - $output .= $tree->generate_nodes_array(); |
|
| 279 | - $output .= "</div>"; |
|
| 280 | - $output .= "</td></tr>"; |
|
| 270 | + static function buildGridOutput($tree, $mod_strings, $display = true, $show_login = true){ |
|
| 271 | + $output = "<div id='catview'>"; |
|
| 272 | + $loginViewStyle = ($display ? 'none' : 'block'); |
|
| 273 | + $selectViewStyle = ($display ? 'block' : 'none'); |
|
| 274 | + $output .= "<div id='selectView' style='display:".$selectViewStyle."'>"; |
|
| 275 | + //if($display){ |
|
| 276 | + $output .= "<table border=0 width='100%' class='moduleTitle'><tr><td width='100%' valign='top'>"; |
|
| 277 | + $output .= "<div id='treeview'>"; |
|
| 278 | + $output .= $tree->generate_nodes_array(); |
|
| 279 | + $output .= "</div>"; |
|
| 280 | + $output .= "</td></tr>"; |
|
| 281 | 281 | $output .= "<tr><td width='100%'>"; |
| 282 | - $output .= "<div id='tabs1'></div>"; |
|
| 282 | + $output .= "<div id='tabs1'></div>"; |
|
| 283 | 283 | $output .= "</td></tr>"; |
| 284 | 284 | $output .= "<tr><td width='100%' align='left'>"; |
| 285 | 285 | $output .= "<input type='button' class='button' value='Download Selected' onClick='PackageManager.download();'>"; |
| 286 | 286 | $output .= "</td></tr></table>"; |
| 287 | 287 | // } |
| 288 | - $output .= "</div>"; |
|
| 289 | - if(!$show_login) |
|
| 290 | - $loginViewStyle = 'none'; |
|
| 288 | + $output .= "</div>"; |
|
| 289 | + if(!$show_login) |
|
| 290 | + $loginViewStyle = 'none'; |
|
| 291 | 291 | // $output .= "<div id='loginView' style='display:".$loginViewStyle."'>"; |
| 292 | - // jchi ,#24296 :commented code because we are currently not using depot, in the future this may change so you can put this code back in. |
|
| 293 | - //$output .= PackageManagerDisplay::buildLoginPanel($mod_strings, $display); |
|
| 294 | - //$output .= "</div>"; |
|
| 295 | - //$output .= "<table width='100%' class='moduleTitle' border=1><tr><td><div id='patch_downloads' class='ygrid-mso' style='height:205px;'></div></td></tr></table>"; |
|
| 296 | - $output .= "</div>"; |
|
| 292 | + // jchi ,#24296 :commented code because we are currently not using depot, in the future this may change so you can put this code back in. |
|
| 293 | + //$output .= PackageManagerDisplay::buildLoginPanel($mod_strings, $display); |
|
| 294 | + //$output .= "</div>"; |
|
| 295 | + //$output .= "<table width='100%' class='moduleTitle' border=1><tr><td><div id='patch_downloads' class='ygrid-mso' style='height:205px;'></div></td></tr></table>"; |
|
| 296 | + $output .= "</div>"; |
|
| 297 | 297 | |
| 298 | - return $output; |
|
| 299 | - } |
|
| 298 | + return $output; |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - /** |
|
| 302 | - * A Static method used to build the initial treeview when the page is first displayed |
|
| 303 | - * |
|
| 304 | - * @param String div_id - this div in which to display the tree |
|
| 305 | - * @return Tree - the tree that is built |
|
| 306 | - */ |
|
| 301 | + /** |
|
| 302 | + * A Static method used to build the initial treeview when the page is first displayed |
|
| 303 | + * |
|
| 304 | + * @param String div_id - this div in which to display the tree |
|
| 305 | + * @return Tree - the tree that is built |
|
| 306 | + */ |
|
| 307 | 307 | static function buildTreeView($div_id, $isAlive = true){ |
| 308 | 308 | $tree = new Tree($div_id); |
| 309 | 309 | $nodes = array(); |
| 310 | 310 | if($isAlive) |
| 311 | - $nodes = PackageManager::getCategories(''); |
|
| 311 | + $nodes = PackageManager::getCategories(''); |
|
| 312 | 312 | |
| 313 | 313 | foreach($nodes as $arr_node){ |
| 314 | 314 | $node = new Node($arr_node['id'], $arr_node['label']); |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | * @return String - a form used to display the license |
| 336 | 336 | */ |
| 337 | 337 | function getLicenseDisplay($license_file, $form_action, $next_step, $zipFile, $type, $manifest, $modify_field){ |
| 338 | - global $current_language; |
|
| 338 | + global $current_language; |
|
| 339 | 339 | $mod_strings = return_module_language($current_language, "Administration"); |
| 340 | 340 | $contents = sugar_file_get_contents($license_file); |
| 341 | 341 | $div_id = urlencode($zipFile); |
@@ -372,11 +372,11 @@ discard block |
||
| 372 | 372 | return $display; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - /** |
|
| 376 | - * A Static method used to generate the javascript for the page |
|
| 377 | - * |
|
| 378 | - * @return String - the javascript required for the page |
|
| 379 | - */ |
|
| 375 | + /** |
|
| 376 | + * A Static method used to generate the javascript for the page |
|
| 377 | + * |
|
| 378 | + * @return String - the javascript required for the page |
|
| 379 | + */ |
|
| 380 | 380 | static function getDisplayScript($install = false, $type = 'module', $releases = null, $types = array(), $isAlive = true){ |
| 381 | 381 | global $sugar_version, $sugar_config; |
| 382 | 382 | global $current_language; |
@@ -387,72 +387,72 @@ discard block |
||
| 387 | 387 | if(!$install){ |
| 388 | 388 | $install = 0; |
| 389 | 389 | } |
| 390 | - $ss->assign('INSTALLATION', $install); |
|
| 390 | + $ss->assign('INSTALLATION', $install); |
|
| 391 | 391 | $ss->assign('WAIT_IMAGE', SugarThemeRegistry::current()->getImage("loading","border='0' align='bottom'",null,null,'.gif',"Loading")); |
| 392 | 392 | |
| 393 | 393 | $ss->assign('sugar_version', $sugar_version); |
| 394 | 394 | $ss->assign('js_custom_version', $sugar_config['js_custom_version']); |
| 395 | - $ss->assign('IS_ALIVE', $isAlive); |
|
| 395 | + $ss->assign('IS_ALIVE', $isAlive); |
|
| 396 | 396 | //if($type == 'patch' && $releases != null){ |
| 397 | 397 | if($type == 'patch'){ |
| 398 | 398 | $ss->assign('module_load', 'false'); |
| 399 | 399 | $patches = PackageManagerDisplay::createJavascriptPackageArray($releases); |
| 400 | 400 | $ss->assign('PATCHES', $patches); |
| 401 | - $ss->assign('GRID_TYPE', implode(',', $types)); |
|
| 401 | + $ss->assign('GRID_TYPE', implode(',', $types)); |
|
| 402 | 402 | }else{ |
| 403 | - $pm = new PackageManager(); |
|
| 404 | - $releases = $pm->getPackagesInStaging(); |
|
| 405 | - $patches = PackageManagerDisplay::createJavascriptModuleArray($releases); |
|
| 403 | + $pm = new PackageManager(); |
|
| 404 | + $releases = $pm->getPackagesInStaging(); |
|
| 405 | + $patches = PackageManagerDisplay::createJavascriptModuleArray($releases); |
|
| 406 | 406 | $ss->assign('PATCHES', $patches); |
| 407 | 407 | $installeds = $pm->getinstalledPackages(); |
| 408 | - $patches = PackageManagerDisplay::createJavascriptModuleArray($installeds, 'mti_installed_data'); |
|
| 408 | + $patches = PackageManagerDisplay::createJavascriptModuleArray($installeds, 'mti_installed_data'); |
|
| 409 | 409 | $ss->assign('INSTALLED_MODULES', $patches); |
| 410 | - $ss->assign('UPGARDE_WIZARD_URL', 'index.php?module=UpgradeWizard&action=index'); |
|
| 410 | + $ss->assign('UPGARDE_WIZARD_URL', 'index.php?module=UpgradeWizard&action=index'); |
|
| 411 | 411 | $ss->assign('module_load', 'true'); |
| 412 | 412 | } |
| 413 | 413 | if(!empty($GLOBALS['ML_STATUS_MESSAGE'])) |
| 414 | - $ss->assign('ML_STATUS_MESSAGE',$GLOBALS['ML_STATUS_MESSAGE']); |
|
| 414 | + $ss->assign('ML_STATUS_MESSAGE',$GLOBALS['ML_STATUS_MESSAGE']); |
|
| 415 | 415 | |
| 416 | 416 | //Bug 24064. Checking and Defining labels since these might not be cached during Upgrade |
| 417 | 417 | if(!isset($mod_strings['LBL_ML_INSTALL']) || empty($mod_strings['LBL_ML_INSTALL'])){ |
| 418 | - $mod_strings['LBL_ML_INSTALL'] = 'Install'; |
|
| 419 | - } |
|
| 420 | - if(!isset($mod_strings['LBL_ML_ENABLE_OR_DISABLE']) || empty($mod_strings['LBL_ML_ENABLE_OR_DISABLE'])) { |
|
| 421 | - $mod_strings['LBL_ML_ENABLE_OR_DISABLE'] = 'Enable/Disable'; |
|
| 422 | - } |
|
| 423 | - if(!isset($mod_strings['LBL_ML_DELETE'])|| empty($mod_strings['LBL_ML_DELETE'])){ |
|
| 424 | - $mod_strings['LBL_ML_DELETE'] = 'Delete'; |
|
| 425 | - } |
|
| 418 | + $mod_strings['LBL_ML_INSTALL'] = 'Install'; |
|
| 419 | + } |
|
| 420 | + if(!isset($mod_strings['LBL_ML_ENABLE_OR_DISABLE']) || empty($mod_strings['LBL_ML_ENABLE_OR_DISABLE'])) { |
|
| 421 | + $mod_strings['LBL_ML_ENABLE_OR_DISABLE'] = 'Enable/Disable'; |
|
| 422 | + } |
|
| 423 | + if(!isset($mod_strings['LBL_ML_DELETE'])|| empty($mod_strings['LBL_ML_DELETE'])){ |
|
| 424 | + $mod_strings['LBL_ML_DELETE'] = 'Delete'; |
|
| 425 | + } |
|
| 426 | 426 | //Add by jchi 6/23/2008 to fix the bug 21667 |
| 427 | - $filegrid_column_ary = array( |
|
| 428 | - 'Name' => $mod_strings['LBL_ML_NAME'], |
|
| 429 | - 'Install' => $mod_strings['LBL_ML_INSTALL'], |
|
| 430 | - 'Delete' => $mod_strings['LBL_ML_DELETE'], |
|
| 431 | - 'Type' => $mod_strings['LBL_ML_TYPE'], |
|
| 432 | - 'Version' => $mod_strings['LBL_ML_VERSION'], |
|
| 433 | - 'Published' => $mod_strings['LBL_ML_PUBLISHED'], |
|
| 434 | - 'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'], |
|
| 435 | - 'Description' => $mod_strings['LBL_ML_DESCRIPTION'] |
|
| 436 | - ); |
|
| 437 | - |
|
| 438 | - $filegridinstalled_column_ary = array( |
|
| 439 | - 'Name' => $mod_strings['LBL_ML_NAME'], |
|
| 440 | - 'Install' => $mod_strings['LBL_ML_INSTALL'], |
|
| 441 | - 'Action' => $mod_strings['LBL_ML_ACTION'], |
|
| 442 | - 'Enable_Or_Disable' => $mod_strings['LBL_ML_ENABLE_OR_DISABLE'], |
|
| 443 | - 'Type' => $mod_strings['LBL_ML_TYPE'], |
|
| 444 | - 'Version' => $mod_strings['LBL_ML_VERSION'], |
|
| 445 | - 'Date_Installed' => $mod_strings['LBL_ML_INSTALLED'], |
|
| 446 | - 'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'], |
|
| 447 | - 'Description' => $mod_strings['LBL_ML_DESCRIPTION'] |
|
| 448 | - ); |
|
| 449 | - |
|
| 450 | - $ss->assign('ML_FILEGRID_COLUMN',$filegrid_column_ary); |
|
| 451 | - $ss->assign('ML_FILEGRIDINSTALLED_COLUMN',$filegridinstalled_column_ary); |
|
| 452 | - //end |
|
| 453 | - |
|
| 454 | - $ss->assign('SHOW_IMG', SugarThemeRegistry::current()->getImage('advanced_search', 'border="0"', 8, 8, '.gif', 'Show')); |
|
| 455 | - $ss->assign('HIDE_IMG', SugarThemeRegistry::current()->getImage('basic_search', 'border="0"', 8, 8, '.gif', 'Hide')); |
|
| 427 | + $filegrid_column_ary = array( |
|
| 428 | + 'Name' => $mod_strings['LBL_ML_NAME'], |
|
| 429 | + 'Install' => $mod_strings['LBL_ML_INSTALL'], |
|
| 430 | + 'Delete' => $mod_strings['LBL_ML_DELETE'], |
|
| 431 | + 'Type' => $mod_strings['LBL_ML_TYPE'], |
|
| 432 | + 'Version' => $mod_strings['LBL_ML_VERSION'], |
|
| 433 | + 'Published' => $mod_strings['LBL_ML_PUBLISHED'], |
|
| 434 | + 'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'], |
|
| 435 | + 'Description' => $mod_strings['LBL_ML_DESCRIPTION'] |
|
| 436 | + ); |
|
| 437 | + |
|
| 438 | + $filegridinstalled_column_ary = array( |
|
| 439 | + 'Name' => $mod_strings['LBL_ML_NAME'], |
|
| 440 | + 'Install' => $mod_strings['LBL_ML_INSTALL'], |
|
| 441 | + 'Action' => $mod_strings['LBL_ML_ACTION'], |
|
| 442 | + 'Enable_Or_Disable' => $mod_strings['LBL_ML_ENABLE_OR_DISABLE'], |
|
| 443 | + 'Type' => $mod_strings['LBL_ML_TYPE'], |
|
| 444 | + 'Version' => $mod_strings['LBL_ML_VERSION'], |
|
| 445 | + 'Date_Installed' => $mod_strings['LBL_ML_INSTALLED'], |
|
| 446 | + 'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'], |
|
| 447 | + 'Description' => $mod_strings['LBL_ML_DESCRIPTION'] |
|
| 448 | + ); |
|
| 449 | + |
|
| 450 | + $ss->assign('ML_FILEGRID_COLUMN',$filegrid_column_ary); |
|
| 451 | + $ss->assign('ML_FILEGRIDINSTALLED_COLUMN',$filegridinstalled_column_ary); |
|
| 452 | + //end |
|
| 453 | + |
|
| 454 | + $ss->assign('SHOW_IMG', SugarThemeRegistry::current()->getImage('advanced_search', 'border="0"', 8, 8, '.gif', 'Show')); |
|
| 455 | + $ss->assign('HIDE_IMG', SugarThemeRegistry::current()->getImage('basic_search', 'border="0"', 8, 8, '.gif', 'Hide')); |
|
| 456 | 456 | $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl'); |
| 457 | 457 | return $str; |
| 458 | 458 | } |
@@ -462,15 +462,15 @@ discard block |
||
| 462 | 462 | $count = count($releases); |
| 463 | 463 | $index = 1; |
| 464 | 464 | if(!empty($releases['packages'])){ |
| 465 | - foreach($releases['packages'] as $release){ |
|
| 466 | - $release = PackageManager::fromNameValueList($release); |
|
| 467 | - $output .= "["; |
|
| 468 | - $output .= "'".$release['description']."', '".$release['version']."', '".$release['build_number']."', '".$release['id']."'"; |
|
| 469 | - $output .= "]"; |
|
| 470 | - if($index < $count) |
|
| 471 | - $output .= ","; |
|
| 472 | - $index++; |
|
| 473 | - } |
|
| 465 | + foreach($releases['packages'] as $release){ |
|
| 466 | + $release = PackageManager::fromNameValueList($release); |
|
| 467 | + $output .= "["; |
|
| 468 | + $output .= "'".$release['description']."', '".$release['version']."', '".$release['build_number']."', '".$release['id']."'"; |
|
| 469 | + $output .= "]"; |
|
| 470 | + if($index < $count) |
|
| 471 | + $output .= ","; |
|
| 472 | + $index++; |
|
| 473 | + } |
|
| 474 | 474 | } |
| 475 | 475 | $output .= "]\n;"; |
| 476 | 476 | return $output; |
@@ -481,30 +481,30 @@ discard block |
||
| 481 | 481 | $count = count($modules); |
| 482 | 482 | $index = 1; |
| 483 | 483 | if(!empty($modules)){ |
| 484 | - foreach($modules as $module){ |
|
| 485 | - $output .= "["; |
|
| 486 | - $output .= "'".$module['name']."', '".$module['file_install']."', '".$module['file']."', '"; |
|
| 487 | - if(!empty($module['enabled'])) |
|
| 488 | - $output .= $module['enabled'].'_'.$module['file']."', '"; |
|
| 489 | - |
|
| 490 | - $description = js_escape($module['description']); |
|
| 491 | - $output .= $module['type']."', '".$module['version']."', '".$module['published_date']."', '".$module['uninstallable']."', '".$description."'".(isset($module['upload_file'])?" , '".$module['upload_file']."']":"]"); |
|
| 492 | - if($index < $count) |
|
| 493 | - $output .= ","; |
|
| 494 | - $index++; |
|
| 495 | - } |
|
| 484 | + foreach($modules as $module){ |
|
| 485 | + $output .= "["; |
|
| 486 | + $output .= "'".$module['name']."', '".$module['file_install']."', '".$module['file']."', '"; |
|
| 487 | + if(!empty($module['enabled'])) |
|
| 488 | + $output .= $module['enabled'].'_'.$module['file']."', '"; |
|
| 489 | + |
|
| 490 | + $description = js_escape($module['description']); |
|
| 491 | + $output .= $module['type']."', '".$module['version']."', '".$module['published_date']."', '".$module['uninstallable']."', '".$description."'".(isset($module['upload_file'])?" , '".$module['upload_file']."']":"]"); |
|
| 492 | + if($index < $count) |
|
| 493 | + $output .= ","; |
|
| 494 | + $index++; |
|
| 495 | + } |
|
| 496 | 496 | |
| 497 | 497 | } |
| 498 | 498 | $output .= "]\n;"; |
| 499 | 499 | return $output; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - /** |
|
| 503 | - * This method is meant to be used to display the license agreement inline on the page |
|
| 504 | - * if the system would like to perform the installation on the same page via an Ajax call |
|
| 505 | - */ |
|
| 502 | + /** |
|
| 503 | + * This method is meant to be used to display the license agreement inline on the page |
|
| 504 | + * if the system would like to perform the installation on the same page via an Ajax call |
|
| 505 | + */ |
|
| 506 | 506 | function buildLicenseOutput($file){ |
| 507 | - global $current_language; |
|
| 507 | + global $current_language; |
|
| 508 | 508 | |
| 509 | 509 | $mod_strings = return_module_language($current_language, "Administration"); |
| 510 | 510 | $contents = ''; |
@@ -520,102 +520,102 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | static function getHeader(){ |
| 523 | - global $current_language; |
|
| 523 | + global $current_language; |
|
| 524 | 524 | |
| 525 | 525 | $mod_strings = return_module_language($current_language, "Administration"); |
| 526 | 526 | $header_text = ''; |
| 527 | 527 | $isAlive = false; |
| 528 | 528 | $show_login = false; |
| 529 | 529 | if(!function_exists('curl_init') && $show_login){ |
| 530 | - $header_text = "<font color='red'><b>".$mod_strings['ERR_ENABLE_CURL']."</b></font>"; |
|
| 531 | - $show_login = false; |
|
| 530 | + $header_text = "<font color='red'><b>".$mod_strings['ERR_ENABLE_CURL']."</b></font>"; |
|
| 531 | + $show_login = false; |
|
| 532 | 532 | }else{ |
| 533 | 533 | $credentials = PackageManager::getCredentials(); |
| 534 | 534 | if(empty($credentials['username']) || empty($credentials['password'])){ |
| 535 | - //$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>"; |
|
| 535 | + //$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>"; |
|
| 536 | 536 | } |
| 537 | 537 | else{ |
| 538 | - $result = PackageManagerComm::login(); |
|
| 539 | - if((is_array($result) && !empty($result['faultcode'])) || $result == false){ |
|
| 540 | - $header_text = "<font color='red'><b>".$result['faultstring']."</b></font>"; |
|
| 541 | - }else{ |
|
| 542 | - $header_text = PackageManager::getPromotion(); |
|
| 543 | - $isAlive = true; |
|
| 544 | - } |
|
| 538 | + $result = PackageManagerComm::login(); |
|
| 539 | + if((is_array($result) && !empty($result['faultcode'])) || $result == false){ |
|
| 540 | + $header_text = "<font color='red'><b>".$result['faultstring']."</b></font>"; |
|
| 541 | + }else{ |
|
| 542 | + $header_text = PackageManager::getPromotion(); |
|
| 543 | + $isAlive = true; |
|
| 544 | + } |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | return array('text' => $header_text, 'isAlive' => $isAlive, 'show_login' => $show_login); |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | function buildInstallGrid($view){ |
| 551 | - $uh = new UpgradeHistory(); |
|
| 552 | - $installeds = $uh->getAll(); |
|
| 553 | - $upgrades_installed = 0; |
|
| 554 | - $installed_objects = array(); |
|
| 555 | - foreach($installeds as $installed) |
|
| 556 | - { |
|
| 557 | - $filename = from_html($installed->filename); |
|
| 558 | - $date_entered = $installed->date_entered; |
|
| 559 | - $type = $installed->type; |
|
| 560 | - $version = $installed->version; |
|
| 561 | - $upgrades_installed++; |
|
| 562 | - $link = ""; |
|
| 563 | - |
|
| 564 | - switch($type) |
|
| 565 | - { |
|
| 566 | - case "theme": |
|
| 567 | - case "langpack": |
|
| 568 | - case "module": |
|
| 569 | - case "patch": |
|
| 570 | - $manifest_file = extractManifest($filename); |
|
| 571 | - require_once($manifest_file); |
|
| 572 | - |
|
| 573 | - $name = empty($manifest['name']) ? $filename : $manifest['name']; |
|
| 574 | - $description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description']; |
|
| 575 | - if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed)) |
|
| 576 | - && is_file($filename) && !empty($manifest['is_uninstallable'])) |
|
| 577 | - { |
|
| 578 | - $link = urlencode( $filename ); |
|
| 579 | - } |
|
| 580 | - else |
|
| 581 | - { |
|
| 582 | - $link = 'false'; |
|
| 583 | - } |
|
| 584 | - |
|
| 585 | - break; |
|
| 586 | - default: |
|
| 587 | - break; |
|
| 588 | - } |
|
| 589 | - |
|
| 590 | - if($view == 'default' && $type != 'patch') |
|
| 591 | - { |
|
| 592 | - continue; |
|
| 593 | - } |
|
| 594 | - |
|
| 595 | - if($view == 'module' |
|
| 596 | - && $type != 'module' && $type != 'theme' && $type != 'langpack') |
|
| 597 | - { |
|
| 598 | - continue; |
|
| 599 | - } |
|
| 600 | - |
|
| 601 | - $target_manifest = remove_file_extension( $filename ) . "-manifest.php"; |
|
| 602 | - require_once( "$target_manifest" ); |
|
| 603 | - |
|
| 604 | - if(isset($manifest['icon']) && $manifest['icon'] != "") |
|
| 605 | - { |
|
| 606 | - $manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : ""; |
|
| 607 | - $manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : ""; |
|
| 608 | - $manifest_icon = clean_path($manifest['icon']); |
|
| 609 | - $icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir)+1) : $manifest_icon ) . "\">"; |
|
| 610 | - } |
|
| 611 | - else |
|
| 612 | - { |
|
| 613 | - $icon = getImageForType( $manifest['type'] ); |
|
| 614 | - } |
|
| 615 | - $installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link); |
|
| 616 | - //print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" ); |
|
| 617 | - //print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" ); |
|
| 618 | - //print( "</form>\n" ); |
|
| 619 | - } |
|
| 551 | + $uh = new UpgradeHistory(); |
|
| 552 | + $installeds = $uh->getAll(); |
|
| 553 | + $upgrades_installed = 0; |
|
| 554 | + $installed_objects = array(); |
|
| 555 | + foreach($installeds as $installed) |
|
| 556 | + { |
|
| 557 | + $filename = from_html($installed->filename); |
|
| 558 | + $date_entered = $installed->date_entered; |
|
| 559 | + $type = $installed->type; |
|
| 560 | + $version = $installed->version; |
|
| 561 | + $upgrades_installed++; |
|
| 562 | + $link = ""; |
|
| 563 | + |
|
| 564 | + switch($type) |
|
| 565 | + { |
|
| 566 | + case "theme": |
|
| 567 | + case "langpack": |
|
| 568 | + case "module": |
|
| 569 | + case "patch": |
|
| 570 | + $manifest_file = extractManifest($filename); |
|
| 571 | + require_once($manifest_file); |
|
| 572 | + |
|
| 573 | + $name = empty($manifest['name']) ? $filename : $manifest['name']; |
|
| 574 | + $description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description']; |
|
| 575 | + if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed)) |
|
| 576 | + && is_file($filename) && !empty($manifest['is_uninstallable'])) |
|
| 577 | + { |
|
| 578 | + $link = urlencode( $filename ); |
|
| 579 | + } |
|
| 580 | + else |
|
| 581 | + { |
|
| 582 | + $link = 'false'; |
|
| 583 | + } |
|
| 584 | + |
|
| 585 | + break; |
|
| 586 | + default: |
|
| 587 | + break; |
|
| 588 | + } |
|
| 589 | + |
|
| 590 | + if($view == 'default' && $type != 'patch') |
|
| 591 | + { |
|
| 592 | + continue; |
|
| 593 | + } |
|
| 594 | + |
|
| 595 | + if($view == 'module' |
|
| 596 | + && $type != 'module' && $type != 'theme' && $type != 'langpack') |
|
| 597 | + { |
|
| 598 | + continue; |
|
| 599 | + } |
|
| 600 | + |
|
| 601 | + $target_manifest = remove_file_extension( $filename ) . "-manifest.php"; |
|
| 602 | + require_once( "$target_manifest" ); |
|
| 603 | + |
|
| 604 | + if(isset($manifest['icon']) && $manifest['icon'] != "") |
|
| 605 | + { |
|
| 606 | + $manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : ""; |
|
| 607 | + $manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : ""; |
|
| 608 | + $manifest_icon = clean_path($manifest['icon']); |
|
| 609 | + $icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir)+1) : $manifest_icon ) . "\">"; |
|
| 610 | + } |
|
| 611 | + else |
|
| 612 | + { |
|
| 613 | + $icon = getImageForType( $manifest['type'] ); |
|
| 614 | + } |
|
| 615 | + $installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link); |
|
| 616 | + //print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" ); |
|
| 617 | + //print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" ); |
|
| 618 | + //print( "</form>\n" ); |
|
| 619 | + } |
|
| 620 | + } |
|
| 620 | 621 | } |
| 621 | - } |
|
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | - require_once('include/ListView/ListViewSmarty.php'); |
|
| 40 | + require_once('include/ListView/ListViewSmarty.php'); |
|
| 41 | 41 | |
| 42 | 42 | class ListViewPackages extends ListViewSmarty{ |
| 43 | 43 | var $secondaryDisplayColumns; |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | - require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php'); |
|
| 41 | - require_once('ModuleInstall/PackageManager/PackageManager.php'); |
|
| 42 | - class PackageController{ |
|
| 40 | + require_once('ModuleInstall/PackageManager/PackageManagerDisplay.php'); |
|
| 41 | + require_once('ModuleInstall/PackageManager/PackageManager.php'); |
|
| 42 | + class PackageController{ |
|
| 43 | 43 | var $_pm; |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -47,17 +47,17 @@ discard block |
||
| 47 | 47 | * functionality on the server. |
| 48 | 48 | */ |
| 49 | 49 | function PackageController(){ |
| 50 | - $this->_pm = new PackageManager(); |
|
| 50 | + $this->_pm = new PackageManager(); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function performBasicSearch(){ |
| 54 | 54 | $json = getJSONobj(); |
| 55 | 55 | $search_term = ''; |
| 56 | 56 | $node_id = ''; |
| 57 | - if(isset($_REQUEST['search_term'])) { |
|
| 57 | + if(isset($_REQUEST['search_term'])) { |
|
| 58 | 58 | $search_term = nl2br($_REQUEST['search_term']); |
| 59 | 59 | } |
| 60 | - if(isset($_REQUEST['node_id'])) { |
|
| 60 | + if(isset($_REQUEST['node_id'])) { |
|
| 61 | 61 | $node_id = nl2br($_REQUEST['node_id']); |
| 62 | 62 | } |
| 63 | 63 | $xml = PackageManager::getPackages($node_id); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $json = getJSONobj(); |
| 77 | 77 | $category_id = ''; |
| 78 | 78 | |
| 79 | - if(isset($_REQUEST['category_id'])) { |
|
| 79 | + if(isset($_REQUEST['category_id'])) { |
|
| 80 | 80 | $category_id = nl2br($_REQUEST['category_id']); |
| 81 | 81 | } |
| 82 | 82 | $xml = PackageManager::getPackages($category_id); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | function getReleases(){ |
| 91 | 91 | $json = getJSONobj(); |
| 92 | 92 | $category_id = ''; |
| 93 | - $package_id = ''; |
|
| 94 | - $types = ''; |
|
| 93 | + $package_id = ''; |
|
| 94 | + $types = ''; |
|
| 95 | 95 | if(isset($_REQUEST['category_id'])) { |
| 96 | 96 | $category_id = nl2br($_REQUEST['category_id']); |
| 97 | 97 | } |
@@ -104,27 +104,27 @@ discard block |
||
| 104 | 104 | $types = explode(',', $types); |
| 105 | 105 | |
| 106 | 106 | $filter = array(); |
| 107 | - $count = count($types); |
|
| 108 | - $index = 1; |
|
| 109 | - $type_str = ''; |
|
| 110 | - foreach($types as $type){ |
|
| 111 | - $type_str .= "'".$type."'"; |
|
| 112 | - if($index < $count) |
|
| 113 | - $type_str .= ","; |
|
| 114 | - $index++; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - $filter = array('type' => $type_str); |
|
| 118 | - $filter = PackageManager::toNameValueList($filter); |
|
| 107 | + $count = count($types); |
|
| 108 | + $index = 1; |
|
| 109 | + $type_str = ''; |
|
| 110 | + foreach($types as $type){ |
|
| 111 | + $type_str .= "'".$type."'"; |
|
| 112 | + if($index < $count) |
|
| 113 | + $type_str .= ","; |
|
| 114 | + $index++; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + $filter = array('type' => $type_str); |
|
| 118 | + $filter = PackageManager::toNameValueList($filter); |
|
| 119 | 119 | $releases = PackageManager::getReleases($category_id, $package_id, $filter); |
| 120 | 120 | $nodes = array(); |
| 121 | 121 | $release_map = array(); |
| 122 | 122 | foreach($releases['packages'] as $release){ |
| 123 | - $release = PackageManager::fromNameValueList($release); |
|
| 124 | - $nodes[] = array('description' => $release['description'], 'version' => $release['version'], 'build_number' => $release['build_number'], 'id' => $release['id']); |
|
| 125 | - $release_map[$release['id']] = array('package_id' => $release['package_id'], 'category_id' => $release['category_id']); |
|
| 126 | - } |
|
| 127 | - $_SESSION['ML_PATCHES'] = $release_map; |
|
| 123 | + $release = PackageManager::fromNameValueList($release); |
|
| 124 | + $nodes[] = array('description' => $release['description'], 'version' => $release['version'], 'build_number' => $release['build_number'], 'id' => $release['id']); |
|
| 125 | + $release_map[$release['id']] = array('package_id' => $release['package_id'], 'category_id' => $release['category_id']); |
|
| 126 | + } |
|
| 127 | + $_SESSION['ML_PATCHES'] = $release_map; |
|
| 128 | 128 | echo 'result = ' . $json->encode(array('releases' => $nodes)); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -177,16 +177,16 @@ discard block |
||
| 177 | 177 | echo 'result = ' . $json->encode(array('success' => $success)); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Retrieve a list of categories that are subcategories to the selected category |
|
| 182 | - * |
|
| 183 | - * @param id - the id of the parent_category, -1 if this is the root |
|
| 184 | - * @return array - a list of categories/nodes which are underneath this node |
|
| 185 | - */ |
|
| 180 | + /** |
|
| 181 | + * Retrieve a list of categories that are subcategories to the selected category |
|
| 182 | + * |
|
| 183 | + * @param id - the id of the parent_category, -1 if this is the root |
|
| 184 | + * @return array - a list of categories/nodes which are underneath this node |
|
| 185 | + */ |
|
| 186 | 186 | function getCategories(){ |
| 187 | 187 | $json = getJSONobj(); |
| 188 | 188 | $node_id = ''; |
| 189 | - if(isset($_REQUEST['category_id'])) { |
|
| 189 | + if(isset($_REQUEST['category_id'])) { |
|
| 190 | 190 | $node_id = nl2br($_REQUEST['category_id']); |
| 191 | 191 | } |
| 192 | 192 | $GLOBALS['log']->debug("NODE ID: ".$node_id); |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | echo 'result = ' . $json->encode(array('nodes' => $nodes)); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - function getNodes(){ |
|
| 197 | + function getNodes(){ |
|
| 198 | 198 | $json = getJSONobj(); |
| 199 | 199 | $category_id = ''; |
| 200 | - if(isset($_REQUEST['category_id'])) { |
|
| 200 | + if(isset($_REQUEST['category_id'])) { |
|
| 201 | 201 | $category_id = nl2br($_REQUEST['category_id']); |
| 202 | 202 | } |
| 203 | 203 | $GLOBALS['log']->debug("CATEGORY ID: ".$category_id); |
@@ -214,31 +214,31 @@ discard block |
||
| 214 | 214 | function checkForUpdates(){ |
| 215 | 215 | $json = getJSONobj(); |
| 216 | 216 | $type = ''; |
| 217 | - if(isset($_REQUEST['type'])) { |
|
| 217 | + if(isset($_REQUEST['type'])) { |
|
| 218 | 218 | $type = nl2br($_REQUEST['type']); |
| 219 | 219 | } |
| 220 | 220 | $pm = new PackageManager(); |
| 221 | 221 | $updates = $pm->checkForUpdates(); |
| 222 | 222 | $nodes = array(); |
| 223 | - $release_map = array(); |
|
| 223 | + $release_map = array(); |
|
| 224 | 224 | if(!empty($updates)){ |
| 225 | - foreach($updates as $update){ |
|
| 226 | - $update = PackageManager::fromNameValueList($update); |
|
| 227 | - $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']); |
|
| 228 | - $release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']); |
|
| 229 | - } |
|
| 225 | + foreach($updates as $update){ |
|
| 226 | + $update = PackageManager::fromNameValueList($update); |
|
| 227 | + $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']); |
|
| 228 | + $release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']); |
|
| 229 | + } |
|
| 230 | 230 | } |
| 231 | - //patches |
|
| 232 | - $filter = array(array('name' => 'type', 'value' => "'patch'")); |
|
| 231 | + //patches |
|
| 232 | + $filter = array(array('name' => 'type', 'value' => "'patch'")); |
|
| 233 | 233 | $releases = $pm->getReleases('', '', $filter); |
| 234 | 234 | if(!empty($releases['packages'])){ |
| 235 | - foreach($releases['packages'] as $update){ |
|
| 236 | - $update = PackageManager::fromNameValueList($update); |
|
| 237 | - $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']); |
|
| 238 | - $release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']); |
|
| 239 | - } |
|
| 235 | + foreach($releases['packages'] as $update){ |
|
| 236 | + $update = PackageManager::fromNameValueList($update); |
|
| 237 | + $nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']); |
|
| 238 | + $release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']); |
|
| 239 | + } |
|
| 240 | 240 | } |
| 241 | - $_SESSION['ML_PATCHES'] = $release_map; |
|
| 241 | + $_SESSION['ML_PATCHES'] = $release_map; |
|
| 242 | 242 | echo 'result = ' . $json->encode(array('updates' => $nodes)); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -267,12 +267,12 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | function performInstall(){ |
| 269 | 269 | $file = ''; |
| 270 | - if(isset($_REQUEST['file'])) { |
|
| 270 | + if(isset($_REQUEST['file'])) { |
|
| 271 | 271 | $file = hashToFile($_REQUEST['file']); |
| 272 | 272 | } |
| 273 | - if(!empty($file)){ |
|
| 274 | - $this->_pm->performInstall($file); |
|
| 275 | - } |
|
| 273 | + if(!empty($file)){ |
|
| 274 | + $this->_pm->performInstall($file); |
|
| 275 | + } |
|
| 276 | 276 | $json = getJSONobj(); |
| 277 | 277 | |
| 278 | 278 | echo 'result = ' . $json->encode(array('result' => 'success')); |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | if(isset($_REQUEST['password'])) { |
| 291 | 291 | $password = nl2br($_REQUEST['password']); |
| 292 | 292 | } |
| 293 | - if(isset($_REQUEST['servername'])) { |
|
| 293 | + if(isset($_REQUEST['servername'])) { |
|
| 294 | 294 | $servername = $_REQUEST['servername']; |
| 295 | 295 | } |
| 296 | 296 | if(isset($_REQUEST['terms_checked'])) { |
| 297 | 297 | $terms_checked = $_REQUEST['terms_checked']; |
| 298 | 298 | if($terms_checked == 'on') |
| 299 | - $terms_checked = true; |
|
| 299 | + $terms_checked = true; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | if(!empty($username) && !empty($password)){ |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | function getDocumentation(){ |
| 317 | - $json = getJSONobj(); |
|
| 317 | + $json = getJSONobj(); |
|
| 318 | 318 | $package_id = ''; |
| 319 | 319 | $release_id = ''; |
| 320 | 320 | |
@@ -331,13 +331,13 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | function downloadedDocumentation(){ |
| 334 | - $json = getJSONobj(); |
|
| 334 | + $json = getJSONobj(); |
|
| 335 | 335 | $document_id = ''; |
| 336 | 336 | |
| 337 | 337 | if(isset($_REQUEST['document_id'])) { |
| 338 | 338 | $document_id = nl2br($_REQUEST['document_id']); |
| 339 | 339 | } |
| 340 | - $GLOBALS['log']->debug("Downloading Document: ".$document_id); |
|
| 340 | + $GLOBALS['log']->debug("Downloading Document: ".$document_id); |
|
| 341 | 341 | PackageManagerComm::downloadedDocumentation($document_id); |
| 342 | 342 | echo 'result = ' . $json->encode(array('result' => 'true')); |
| 343 | 343 | } |
@@ -356,21 +356,21 @@ discard block |
||
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - function remove(){ |
|
| 360 | - $json = getJSONobj(); |
|
| 359 | + function remove(){ |
|
| 360 | + $json = getJSONobj(); |
|
| 361 | 361 | $file = ''; |
| 362 | 362 | |
| 363 | 363 | if(isset($_REQUEST['file'])) { |
| 364 | - $file = urldecode(hashToFile($_REQUEST['file'])); |
|
| 364 | + $file = urldecode(hashToFile($_REQUEST['file'])); |
|
| 365 | 365 | } |
| 366 | 366 | $GLOBALS['log']->debug("FILE TO REMOVE: ".$file); |
| 367 | 367 | if(!empty($file)){ |
| 368 | - unlink($file); |
|
| 369 | - foreach(array("manifest", "icon") as $meta) { |
|
| 370 | - $this->rmMetaFile($file, $meta); |
|
| 371 | - } |
|
| 368 | + unlink($file); |
|
| 369 | + foreach(array("manifest", "icon") as $meta) { |
|
| 370 | + $this->rmMetaFile($file, $meta); |
|
| 371 | + } |
|
| 372 | 372 | } |
| 373 | 373 | echo 'result = ' . $json->encode(array('result' => 'true')); |
| 374 | 374 | } |
| 375 | - } |
|
| 375 | + } |
|
| 376 | 376 | ?> |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | define("ACTIVE_STATUS", "ACTIVE"); |
| 45 | 45 | |
| 46 | 46 | class PackageManagerComm{ |
| 47 | - /** |
|
| 48 | - * Initialize the soap client and store in the $GLOBALS object for use |
|
| 49 | - * |
|
| 50 | - * @param login designates whether we want to try to login after we initialize or not |
|
| 51 | - */ |
|
| 52 | - function initialize($login = true){ |
|
| 47 | + /** |
|
| 48 | + * Initialize the soap client and store in the $GLOBALS object for use |
|
| 49 | + * |
|
| 50 | + * @param login designates whether we want to try to login after we initialize or not |
|
| 51 | + */ |
|
| 52 | + function initialize($login = true){ |
|
| 53 | 53 | if(empty($GLOBALS['SugarDepot'])){ |
| 54 | 54 | $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT'); |
| 55 | 55 | $soap_client = new nusoapclient(HTTPS_URL, false); |
@@ -60,91 +60,91 @@ discard block |
||
| 60 | 60 | if($login && empty($_SESSION['SugarDepotSessionID'])){ |
| 61 | 61 | PackageManagerComm::login(); |
| 62 | 62 | } |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Check for errors in the response or error_str |
|
| 67 | - */ |
|
| 68 | - function errorCheck(){ |
|
| 69 | - if(!empty($GLOBALS['SugarDepot']->error_str)){ |
|
| 70 | - $GLOBALS['log']->fatal($GLOBALS['SugarDepot']->error_str); |
|
| 71 | - $GLOBALS['log']->fatal($GLOBALS['SugarDepot']->response); |
|
| 72 | - } |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * Check for errors in the response or error_str |
|
| 67 | + */ |
|
| 68 | + function errorCheck(){ |
|
| 69 | + if(!empty($GLOBALS['SugarDepot']->error_str)){ |
|
| 70 | + $GLOBALS['log']->fatal($GLOBALS['SugarDepot']->error_str); |
|
| 71 | + $GLOBALS['log']->fatal($GLOBALS['SugarDepot']->response); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Set the credentials for use during login |
|
| 77 | - * |
|
| 78 | - * @param username Mambo username |
|
| 79 | - * @param password Mambo password |
|
| 80 | - * @param download_key User's download key |
|
| 81 | - */ |
|
| 82 | - function setCredentials($username, $password, $download_key){ |
|
| 75 | + /** |
|
| 76 | + * Set the credentials for use during login |
|
| 77 | + * |
|
| 78 | + * @param username Mambo username |
|
| 79 | + * @param password Mambo password |
|
| 80 | + * @param download_key User's download key |
|
| 81 | + */ |
|
| 82 | + function setCredentials($username, $password, $download_key){ |
|
| 83 | 83 | $_SESSION['SugarDepotUsername'] = $username; |
| 84 | 84 | $_SESSION['SugarDepotPassword'] = $password; |
| 85 | 85 | $_SESSION['SugarDepotDownloadKey'] = $download_key; |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Clears out the session so we can reauthenticate. |
|
| 90 | - */ |
|
| 91 | - function clearSession(){ |
|
| 92 | - $_SESSION['SugarDepotSessionID'] = null; |
|
| 93 | - unset($_SESSION['SugarDepotSessionID']); |
|
| 94 | - } |
|
| 95 | - ///////////////////////////////////////////////////////// |
|
| 96 | - ////////// BEGIN: Base Functions for Communicating with the depot |
|
| 97 | - /** |
|
| 98 | - * Login to the depot |
|
| 99 | - * |
|
| 100 | - * @return true if successful, false otherwise |
|
| 101 | - */ |
|
| 102 | - function login($terms_checked = true){ |
|
| 103 | - if(empty($_SESSION['SugarDepotSessionID'])){ |
|
| 104 | - global $license; |
|
| 105 | - $GLOBALS['log']->debug("Begin SugarDepot Login"); |
|
| 106 | - PackageManagerComm::initialize(false); |
|
| 107 | - require('sugar_version.php'); |
|
| 108 | - require('config.php'); |
|
| 109 | - $credentials = PackageManager::getCredentials(); |
|
| 110 | - if(empty($license))loadLicense(); |
|
| 111 | - $info = sugarEncode('2813', serialize(getSystemInfo(true))); |
|
| 112 | - $pm = new PackageManager(); |
|
| 113 | - $installed = $pm->buildInstalledReleases(); |
|
| 114 | - $installed = base64_encode(serialize($installed)); |
|
| 115 | - $params = array('installed_modules' => $installed, 'terms_checked' => $terms_checked, 'system_name' => $credentials['system_name']); |
|
| 116 | - $terms_version = (!empty($_SESSION['SugarDepot_TermsVersion']) ? $_SESSION['SugarDepot_TermsVersion'] : ''); |
|
| 117 | - if(!empty($terms_version)) |
|
| 118 | - $params['terms_version'] = $terms_version; |
|
| 88 | + /** |
|
| 89 | + * Clears out the session so we can reauthenticate. |
|
| 90 | + */ |
|
| 91 | + function clearSession(){ |
|
| 92 | + $_SESSION['SugarDepotSessionID'] = null; |
|
| 93 | + unset($_SESSION['SugarDepotSessionID']); |
|
| 94 | + } |
|
| 95 | + ///////////////////////////////////////////////////////// |
|
| 96 | + ////////// BEGIN: Base Functions for Communicating with the depot |
|
| 97 | + /** |
|
| 98 | + * Login to the depot |
|
| 99 | + * |
|
| 100 | + * @return true if successful, false otherwise |
|
| 101 | + */ |
|
| 102 | + function login($terms_checked = true){ |
|
| 103 | + if(empty($_SESSION['SugarDepotSessionID'])){ |
|
| 104 | + global $license; |
|
| 105 | + $GLOBALS['log']->debug("Begin SugarDepot Login"); |
|
| 106 | + PackageManagerComm::initialize(false); |
|
| 107 | + require('sugar_version.php'); |
|
| 108 | + require('config.php'); |
|
| 109 | + $credentials = PackageManager::getCredentials(); |
|
| 110 | + if(empty($license))loadLicense(); |
|
| 111 | + $info = sugarEncode('2813', serialize(getSystemInfo(true))); |
|
| 112 | + $pm = new PackageManager(); |
|
| 113 | + $installed = $pm->buildInstalledReleases(); |
|
| 114 | + $installed = base64_encode(serialize($installed)); |
|
| 115 | + $params = array('installed_modules' => $installed, 'terms_checked' => $terms_checked, 'system_name' => $credentials['system_name']); |
|
| 116 | + $terms_version = (!empty($_SESSION['SugarDepot_TermsVersion']) ? $_SESSION['SugarDepot_TermsVersion'] : ''); |
|
| 117 | + if(!empty($terms_version)) |
|
| 118 | + $params['terms_version'] = $terms_version; |
|
| 119 | 119 | |
| 120 | - $result = $GLOBALS['SugarDepot']->call('depotLogin', array(array('user_name' => $credentials['username'], 'password' => $credentials['password']),'info'=>$info, 'params' => $params)); |
|
| 121 | - PackageManagerComm::errorCheck(); |
|
| 122 | - if(!is_array($result)) |
|
| 123 | - $_SESSION['SugarDepotSessionID'] = $result; |
|
| 124 | - $GLOBALS['log']->debug("End SugarDepot Login"); |
|
| 125 | - return $result; |
|
| 126 | - } |
|
| 127 | - else |
|
| 128 | - return $_SESSION['SugarDepotSessionID']; |
|
| 129 | - } |
|
| 120 | + $result = $GLOBALS['SugarDepot']->call('depotLogin', array(array('user_name' => $credentials['username'], 'password' => $credentials['password']),'info'=>$info, 'params' => $params)); |
|
| 121 | + PackageManagerComm::errorCheck(); |
|
| 122 | + if(!is_array($result)) |
|
| 123 | + $_SESSION['SugarDepotSessionID'] = $result; |
|
| 124 | + $GLOBALS['log']->debug("End SugarDepot Login"); |
|
| 125 | + return $result; |
|
| 126 | + } |
|
| 127 | + else |
|
| 128 | + return $_SESSION['SugarDepotSessionID']; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Logout from the depot |
|
| 133 | - */ |
|
| 134 | - function logout(){ |
|
| 131 | + /** |
|
| 132 | + * Logout from the depot |
|
| 133 | + */ |
|
| 134 | + function logout(){ |
|
| 135 | 135 | PackageManagerComm::initialize(); |
| 136 | 136 | $result = $GLOBALS['SugarDepot']->call('depotLogout', array('session_id' => $_SESSION['SugarDepotSessionID'])); |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Get all promotions from the depot |
|
| 141 | - */ |
|
| 142 | - function getPromotion(){ |
|
| 139 | + /** |
|
| 140 | + * Get all promotions from the depot |
|
| 141 | + */ |
|
| 142 | + function getPromotion(){ |
|
| 143 | 143 | PackageManagerComm::initialize(); |
| 144 | 144 | //check for fault first and then return |
| 145 | 145 | $name_value_list = $GLOBALS['SugarDepot']->call('depotGetPromotion', array('session_id' => $_SESSION['SugarDepotSessionID'])); |
| 146 | 146 | return $name_value_list; |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * A generic function which given a category_id some filter will |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | * @param filter a filter which will limit theh number of results returned |
| 155 | 155 | * @return categories_and_packages |
| 156 | 156 | * @see categories_and_packages |
| 157 | - */ |
|
| 157 | + */ |
|
| 158 | 158 | function getCategoryPackages($category_id, $filter = array()){ |
| 159 | 159 | PackageManagerComm::initialize(); |
| 160 | 160 | //check for fault |
| 161 | - return $GLOBALS['SugarDepot']->call('depotGetCategoriesPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter)); |
|
| 161 | + return $GLOBALS['SugarDepot']->call('depotGetCategoriesPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter)); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | * @param filter a filter which will limit theh number of results returned |
| 183 | 183 | * @return packages |
| 184 | 184 | * @see packages |
| 185 | - */ |
|
| 185 | + */ |
|
| 186 | 186 | function getPackages($category_id, $filter = array()){ |
| 187 | 187 | PackageManagerComm::initialize(); |
| 188 | 188 | //check for fault |
| 189 | - return $GLOBALS['SugarDepot']->call('depotGetPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter)); |
|
| 189 | + return $GLOBALS['SugarDepot']->call('depotGetPackages', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'filter' => $filter)); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | * @param package_id the package id which the release belongs to |
| 197 | 197 | * @return packages |
| 198 | 198 | * @see packages |
| 199 | - */ |
|
| 199 | + */ |
|
| 200 | 200 | function getReleases($category_id, $package_id, $filter = array()){ |
| 201 | 201 | PackageManagerComm::initialize(); |
| 202 | - //check for fault |
|
| 203 | - return $GLOBALS['SugarDepot']->call('depotGetReleases', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'filter' => $filter)); |
|
| 202 | + //check for fault |
|
| 203 | + return $GLOBALS['SugarDepot']->call('depotGetReleases', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'filter' => $filter)); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -211,11 +211,11 @@ discard block |
||
| 211 | 211 | * @param release_id the release we want to download |
| 212 | 212 | * @return download |
| 213 | 213 | * @see download |
| 214 | - */ |
|
| 214 | + */ |
|
| 215 | 215 | function download($category_id, $package_id, $release_id){ |
| 216 | 216 | PackageManagerComm::initialize(); |
| 217 | - //check for fault |
|
| 218 | - return $GLOBALS['SugarDepot']->call('depotDownloadRelease', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id)); |
|
| 217 | + //check for fault |
|
| 218 | + return $GLOBALS['SugarDepot']->call('depotDownloadRelease', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id)); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | function addDownload($category_id, $package_id, $release_id){ |
| 230 | 230 | PackageManagerComm::initialize(); |
| 231 | - //check for fault |
|
| 232 | - return $GLOBALS['SugarDepot']->call('depotAddDownload', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id, 'download_key' => '123')); |
|
| 231 | + //check for fault |
|
| 232 | + return $GLOBALS['SugarDepot']->call('depotAddDownload', array('session_id' => $_SESSION['SugarDepotSessionID'], 'category_id' => $category_id, 'package_id' => $package_id, 'release_id' => $release_id, 'download_key' => '123')); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | static public function performDownload($filename){ |
| 242 | 242 | PackageManagerComm::initialize(); |
| 243 | - //check for fault |
|
| 244 | - $GLOBALS['log']->debug("Performing download from depot: Session ID: ".$_SESSION['SugarDepotSessionID']." Filename: ".$filename); |
|
| 245 | - return PackageManagerDownloader::download($_SESSION['SugarDepotSessionID'], $filename); |
|
| 243 | + //check for fault |
|
| 244 | + $GLOBALS['log']->debug("Performing download from depot: Session ID: ".$_SESSION['SugarDepotSessionID']." Filename: ".$filename); |
|
| 245 | + return PackageManagerDownloader::download($_SESSION['SugarDepotSessionID'], $filename); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -254,14 +254,14 @@ discard block |
||
| 254 | 254 | * @return documents |
| 255 | 255 | */ |
| 256 | 256 | function getDocumentation($package_id, $release_id){ |
| 257 | - PackageManagerComm::initialize(); |
|
| 258 | - //check for fault |
|
| 259 | - return $GLOBALS['SugarDepot']->call('depotGetDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'package_id' => $package_id, 'release_id' => $release_id)); |
|
| 257 | + PackageManagerComm::initialize(); |
|
| 258 | + //check for fault |
|
| 259 | + return $GLOBALS['SugarDepot']->call('depotGetDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'package_id' => $package_id, 'release_id' => $release_id)); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | function getTermsAndConditions(){ |
| 263 | - PackageManagerComm::initialize(false); |
|
| 264 | - return $GLOBALS['SugarDepot']->call('depotTermsAndConditions',array()); |
|
| 263 | + PackageManagerComm::initialize(false); |
|
| 264 | + return $GLOBALS['SugarDepot']->call('depotTermsAndConditions',array()); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -270,32 +270,32 @@ discard block |
||
| 270 | 270 | * @param document_id the document the user has clicked on |
| 271 | 271 | */ |
| 272 | 272 | function downloadedDocumentation($document_id){ |
| 273 | - PackageManagerComm::initialize(); |
|
| 274 | - //check for fault |
|
| 275 | - $GLOBALS['log']->debug("Logging Document: ".$document_id); |
|
| 276 | - $GLOBALS['SugarDepot']->call('depotDownloadedDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'document_id' => $document_id)); |
|
| 273 | + PackageManagerComm::initialize(); |
|
| 274 | + //check for fault |
|
| 275 | + $GLOBALS['log']->debug("Logging Document: ".$document_id); |
|
| 276 | + $GLOBALS['SugarDepot']->call('depotDownloadedDocumentation', array('session_id' => $_SESSION['SugarDepotSessionID'], 'document_id' => $document_id)); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - /** |
|
| 280 | - * Send the list of installed objects, could be patches, or modules, .. to the depot and allow the depot to send back |
|
| 281 | - * a list of corresponding updates |
|
| 282 | - * |
|
| 283 | - * @param objects_to_check an array of name_value_lists which contain the appropriate values |
|
| 284 | - * which will allow the depot to check for updates |
|
| 285 | - * |
|
| 286 | - * @return array of name_value_lists of corresponding updates |
|
| 287 | - */ |
|
| 288 | - function checkForUpdates($objects_to_check){ |
|
| 289 | - PackageManagerComm::initialize(); |
|
| 290 | - //check for fault |
|
| 291 | - return $GLOBALS['SugarDepot']->call('depotCheckForUpdates', array('session_id' => $_SESSION['SugarDepotSessionID'], 'objects' => $objects_to_check)); |
|
| 292 | - } |
|
| 293 | - /** |
|
| 294 | - * Ping the server to determine if we have established proper communication |
|
| 279 | + /** |
|
| 280 | + * Send the list of installed objects, could be patches, or modules, .. to the depot and allow the depot to send back |
|
| 281 | + * a list of corresponding updates |
|
| 282 | + * |
|
| 283 | + * @param objects_to_check an array of name_value_lists which contain the appropriate values |
|
| 284 | + * which will allow the depot to check for updates |
|
| 295 | 285 | * |
| 296 | - * @return true if we can communicate with the server and false otherwise |
|
| 297 | - */ |
|
| 298 | - function isAlive(){ |
|
| 286 | + * @return array of name_value_lists of corresponding updates |
|
| 287 | + */ |
|
| 288 | + function checkForUpdates($objects_to_check){ |
|
| 289 | + PackageManagerComm::initialize(); |
|
| 290 | + //check for fault |
|
| 291 | + return $GLOBALS['SugarDepot']->call('depotCheckForUpdates', array('session_id' => $_SESSION['SugarDepotSessionID'], 'objects' => $objects_to_check)); |
|
| 292 | + } |
|
| 293 | + /** |
|
| 294 | + * Ping the server to determine if we have established proper communication |
|
| 295 | + * |
|
| 296 | + * @return true if we can communicate with the server and false otherwise |
|
| 297 | + */ |
|
| 298 | + function isAlive(){ |
|
| 299 | 299 | PackageManagerComm::initialize(false); |
| 300 | 300 | |
| 301 | 301 | $status = $GLOBALS['SugarDepot']->call('sugarPing', array()); |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | }else{ |
| 305 | 305 | return true; |
| 306 | 306 | } |
| 307 | - } |
|
| 308 | - ////////// END: Base Functions for Communicating with the depot |
|
| 309 | - //////////////////////////////////////////////////////// |
|
| 307 | + } |
|
| 308 | + ////////// END: Base Functions for Communicating with the depot |
|
| 309 | + //////////////////////////////////////////////////////// |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | ?> |