Advertisement
Guest User

Untitled

a guest
Jul 20th, 2016
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.55 KB | None | 0 0
  1. <?php
  2. // Needed for MantisBT 1.2.x.
  3. // Not needed for MantisBT 1.3.x
  4. require_once( config_get( 'class_path' ) . 'MantisPlugin.class.php' );
  5.  
  6. // New function in MantisBT 1.3.x
  7. // Included for compatibility with 1.2.x
  8. if ( !function_exists( 'plugin_require_api' ) )
  9. {
  10. /**
  11. * Allows a plugin page to require a plugin-specific API
  12. * @param string $p_file The API to be included.
  13. * @param string $p_basename Plugin's basename (defaults to current plugin).
  14. * @return void
  15. */
  16. function plugin_require_api( $p_file, $p_basename = null ) {
  17. if( is_null( $p_basename ) ) {
  18. $t_current = plugin_get_current();
  19. } else {
  20. $t_current = $p_basename;
  21. }
  22.  
  23. $t_path = config_get_global( 'plugin_path' ) . $t_current . '/';
  24.  
  25. require_once( $t_path . $p_file );
  26. }
  27. }
  28.  
  29. // New function in MantisBT 1.3.x
  30. // Included for compatibility with 1.2.x
  31. if ( !function_exists( 'require_api' ) )
  32. {
  33. /**
  34. * Define an API inclusion function to replace require_once
  35. *
  36. * @param string $p_api_name An API file name.
  37. * @return void
  38. */
  39. function require_api( $p_api_name ) {
  40. static $s_api_included;
  41. global $g_core_path;
  42. if( !isset( $s_api_included[$p_api_name] ) ) {
  43. require_once( $g_core_path . $p_api_name );
  44. $t_new_globals = array_diff_key( get_defined_vars(), $GLOBALS, array( 't_new_globals' => 0 ) );
  45. foreach ( $t_new_globals as $t_global_name => $t_global_value ) {
  46. $GLOBALS[$t_global_name] = $t_global_value;
  47. }
  48. $s_api_included[$p_api_name] = 1;
  49. }
  50. }
  51. }
  52.  
  53. class EmailReportingPlugin extends MantisPlugin
  54. {
  55. /**
  56. * A method that populates the plugin information and minimum requirements.
  57. */
  58. function register()
  59. {
  60. $this->name = plugin_lang_get( 'plugin_title' );
  61. $this->description = plugin_lang_get( 'plugin_description' );
  62. $this->page = 'manage_config';
  63.  
  64. $this->version = '0.9.2';
  65. $this->requires = array(
  66. 'MantisCore' => '1.2.6, <1.3.99',
  67. );
  68.  
  69. $this->author = plugin_lang_get( 'plugin_author' );
  70. $this->contact = '';
  71. $this->url = 'http://www.mantisbt.org/wiki/doku.php/mantisbt:emailreporting';
  72. }
  73.  
  74. /**
  75. * EmailReporting plugin configuration.
  76. */
  77. function config()
  78. {
  79. return array(
  80. 'reset_schema' => 0,
  81. 'config_version' => 0,
  82. 'schema' => -1,
  83. 'job_users' => array(),
  84.  
  85. # --- mail reporting settings -----
  86. # Empty default mailboxes array. This array will be used for all the mailbox
  87. # accounts
  88. 'mailboxes' => array(),
  89.  
  90. # Empty default rules array. This array will be used for all the rules
  91. 'rules' => array(),
  92.  
  93. # Is this plugin allowed to process and create new bug reports
  94. 'mail_add_bug_reports' => ON,
  95.  
  96. # Is this plugin allowed to process and add notes to existing issues
  97. 'mail_add_bugnotes' => ON,
  98.  
  99. # Add complete email into the attachments
  100. 'mail_add_complete_email' => OFF,
  101.  
  102. // Add users from Cc and To field in mail header
  103. 'mail_add_users_from_cc_to' => OFF,
  104.  
  105. # Signup new users automatically (possible security risk!)
  106. # Default is OFF, if mail_use_reporter is OFF and this is OFF then it will
  107. # fallback to the mail_reporter account above
  108. 'mail_auto_signup' => OFF,
  109.  
  110. # List of md5 hashes of attachments which will be blocked.
  111. 'mail_block_attachments_md5' => array(),
  112.  
  113. # Log blocked attachments in the rejected files list
  114. 'mail_block_attachments_logging'=> ON,
  115.  
  116. # Classify bug priorities
  117. 'mail_bug_priority' => array(
  118. '5 (lowest)' => '10',
  119. '4 (low)' => '20',
  120. '3 (normal)' => '30',
  121. '2 (high)' => '40',
  122. '1 (highest)' => '50',
  123. 5 => '20',
  124. 4 => '20',
  125. 3 => '30',
  126. 2 => '40',
  127. 1 => '50',
  128. 0 => '10',
  129. 'low' => '20',
  130. 'normal' => '30',
  131. 'high' => '40',
  132. '' => '30',
  133. '?' => '30',
  134. ),
  135.  
  136. # Used for debugging the system.
  137. # Use with care
  138. 'mail_debug' => OFF,
  139.  
  140. # Save mail contents to this directory if debug mode is ON
  141. 'mail_debug_directory' => '/tmp/mantis',
  142.  
  143. # Used for debugging the system.
  144. # Shows the memory usage in different stages of the debugging process
  145. 'mail_debug_show_memory_usage' => OFF,
  146.  
  147. # Delete incoming mail from POP3 server
  148. 'mail_delete' => ON,
  149.  
  150. # MantisBT always has the disposble email checker enabled. We needed an option to disable this in EmailReporting
  151. 'mail_disposable_email_checker' => ON,
  152.  
  153. # Should users always receive emails on actions they performed by email even though email_receive_own is OFF
  154. 'mail_email_receive_own' => OFF,
  155.  
  156. # Enable fallback to mail reporter
  157. 'mail_fallback_mail_reporter' => ON,
  158.  
  159. # Use the following text when the description is missing from the email
  160. 'mail_nodescription' => 'No description found',
  161.  
  162. # Use the following text when the subject is missing from the email
  163. 'mail_nosubject' => 'No subject found',
  164.  
  165. # Parse HTML mails
  166. 'mail_parse_html' => ON,
  167.  
  168. # Preferred username for new user creations
  169. 'mail_preferred_username' => 'name',
  170.  
  171. # Preferred realname for new user creations
  172. 'mail_preferred_realname' => 'name',
  173.  
  174. # Try to identify the original mantis email and remove it from the description
  175. 'mail_remove_mantis_email' => ON,
  176.  
  177. # Remove everything after and including the remove_replies_after text
  178. 'mail_remove_replies' => OFF,
  179.  
  180. # Text which decides after (and including) which all content needs to be removed
  181. 'mail_remove_replies_after' => '-----Original Message-----',
  182.  
  183. # Use the following text when part of the email has been removed
  184. 'mail_removed_reply_text' => '[EmailReporting -> Removed part identified as reply]',
  185.  
  186. # The account's id for mail reporting
  187. # Also used for fallback if a user is not found in database
  188. # Mail is just the default name which will be converted to a user id during installation
  189. 'mail_reporter_id' => 'Mail',
  190.  
  191. # Is the rule system enabled
  192. 'mail_rule_system' => OFF,
  193.  
  194. # Write the sender of the email into the issue report/note
  195. 'mail_save_from' => ON,
  196.  
  197. # Write the subject of the email in the note
  198. 'mail_save_subject_in_note' => OFF,
  199.  
  200. # Do you want to secure the EmailReporting script so that it cannot be run
  201. # via a webserver?
  202. 'mail_secured_script' => ON,
  203.  
  204. //Strip Gmail style replies from body of the message
  205. 'mail_strip_gmail_style_replies' => OFF,
  206.  
  207. #Removes the signature that are delimited by mail_strip_signature_delim
  208. 'mail_strip_signature' => OFF,
  209.  
  210. #Removes the signature that are delimited by --
  211. 'mail_strip_signature_delim' => '--',
  212.  
  213. # Which regex should be used for finding the issue id in the subject
  214. 'mail_subject_id_regex' => 'strict',
  215.  
  216. # Looks for priority header field
  217. 'mail_use_bug_priority' => ON,
  218.  
  219. # This tells Mantis to report all the Mail with only one account
  220. # ON = mail uses the reporter account in the setting below
  221. # OFF = it identifies the reporter using the email address of the sender
  222. 'mail_use_reporter' => ON,
  223.  
  224. // Whether to identify notes using Message-ID in the mail header
  225. 'mail_use_message_id' => ON,
  226. );
  227. }
  228.  
  229. /**
  230. * EmailReporting installation function.
  231. */
  232. function install()
  233. {
  234. // We need to load a default value since the function config() which sets
  235. // the defaults has not been run yet. On the other hand, configuration options
  236. // already present in the database will be available.
  237. $t_mail_reporter_id = plugin_config_get( 'mail_reporter_id', 'Mail' );
  238.  
  239. if ( $t_mail_reporter_id === 'Mail' )
  240. {
  241. // The plugin variable path_erp is not yet available. So path_erp cannot be used here
  242. plugin_require_api( 'core/config_api.php' );
  243.  
  244. # We need to allow blank emails for a sec
  245. ERP_set_temporary_overwrite( 'allow_blank_email', ON );
  246.  
  247. $t_rand = mt_rand( 1000, 99999 );
  248.  
  249. $t_username = $t_mail_reporter_id . $t_rand;
  250.  
  251. $t_email = '';
  252.  
  253. $t_seed = $t_email . $t_username;
  254.  
  255. # Create random password
  256. $t_password = auth_generate_random_password( $t_seed );
  257.  
  258. # create the user
  259. $t_result_user_create = user_create( $t_username, $t_password, $t_email, config_get_global( 'report_bug_threshold' ), FALSE, TRUE, 'Mail Reporter', plugin_lang_get( 'plugin_title' ) );
  260.  
  261. # Save these after the user has been created successfully
  262. if ( $t_result_user_create )
  263. {
  264. $t_user_id = user_get_id_by_name( $t_username );
  265.  
  266. plugin_config_set( 'mail_reporter_id', $t_user_id );
  267. }
  268.  
  269. // We need to set this here otherwise we mess up new installations with ERP_update_check
  270. plugin_config_set( 'reset_schema', 1 );
  271.  
  272. return( $t_result_user_create );
  273. }
  274.  
  275. return( TRUE );
  276. }
  277.  
  278. /**
  279. * EmailReporting uninstallation function.
  280. */
  281. function uninstall()
  282. {
  283. # User removal from the install function will not be done
  284. # The reason being thats its possibly connected to issues in the system
  285. return( TRUE );
  286. }
  287.  
  288. /**
  289. * EmailReporting initialization function.
  290. */
  291. function init()
  292. {
  293. $t_path = config_get_global( 'plugin_path' ) . plugin_get_current() . DIRECTORY_SEPARATOR . 'core_pear' . DIRECTORY_SEPARATOR;
  294.  
  295. if ( is_dir( $t_path ) )
  296. {
  297. set_include_path( get_include_path() . PATH_SEPARATOR . $t_path );
  298. }
  299. }
  300.  
  301. function events()
  302. {
  303. return array(
  304. 'EVENT_ERP_OUTPUT_MAILBOX_FIELDS' => EVENT_TYPE_OUTPUT,
  305.  
  306. // Keep in mind that this event is called BEFORE its MantisBT core counterpart
  307. // After the MantisBT core event is not possible since that one is integrated into the bugnote_add function
  308. 'EVENT_ERP_BUGNOTE_DATA' => EVENT_TYPE_CHAIN,
  309.  
  310. // Keep in mind that this event is called AFTER its MantisBT core counterpart
  311. 'EVENT_ERP_REPORT_BUG_DATA' => EVENT_TYPE_CHAIN,
  312. );
  313. }
  314.  
  315. /*
  316. * Database table to store the Message-ID to detect the replies
  317. * This is to implement #0016719
  318. */
  319. function schema()
  320. {
  321. return array(
  322. array( 'CreateTableSQL', array( plugin_table( 'msgids' ), "
  323. id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  324. issue_id I UNSIGNED NOTNULL,
  325. msg_id C(255) NOTNULL
  326. ", Array('mysql' => 'DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')
  327. )
  328. ),
  329. array( 'CreateIndexSQL', array( 'idx_erp_msgids_msgid', plugin_table( 'msgids' ), 'msg_id', array( 'UNIQUE' ) ) ),
  330. );
  331. }
  332.  
  333. /**
  334. * EmailReporting plugin hooks.
  335. */
  336. function hooks( )
  337. {
  338. $hooks = array(
  339. 'EVENT_MENU_MANAGE' => 'ERP_manage_emailreporting_menu',
  340. 'EVENT_CORE_READY' => 'ERP_core_ready',
  341. );
  342.  
  343. return $hooks;
  344. }
  345.  
  346. /**
  347. * EmailReporting plugin hooks - add emailreporting menu item.
  348. */
  349. function ERP_manage_emailreporting_menu( )
  350. {
  351. return array( '<a href="' . plugin_page( 'manage_mailbox' ) . '">' . plugin_lang_get( 'manage' ) . ' ' . plugin_lang_get( 'plugin_title' ) . '</a>', );
  352. }
  353.  
  354. /*
  355. * This function will run when the mantis core is ready
  356. */
  357. function ERP_core_ready( )
  358. {
  359. $this->ERP_update_check( );
  360.  
  361. $this->ERP_check_mantisbt_url( );
  362. }
  363.  
  364. /*
  365. * Since schema is not used anymore some corrections need to be applied
  366. * Schema will be completely reset by this just once
  367. *
  368. * The second part updates various configuration options and performs some cleaning
  369. * Further updates to the configuration options follow below
  370. *
  371. * Make sure that it is no problem if a user would delete the variable config_version
  372. * as it would cause all the patches below to be executed all over again.
  373. * New installations will have all of these patches executed as well.
  374. */
  375. function ERP_update_check( )
  376. {
  377. $t_config_version = plugin_config_get( 'config_version' );
  378.  
  379. if ( $t_config_version === 0 )
  380. {
  381. $t_username = plugin_config_get( 'mail_reporter', '' );
  382.  
  383. if ( strlen( $t_username ) > 0 )
  384. {
  385. $t_user_id = user_get_id_by_name( $t_username );
  386.  
  387. if ( $t_user_id !== FALSE )
  388. {
  389. $t_user_email = user_get_email( $t_user_id );
  390.  
  391. if ( $t_user_email === 'nomail' )
  392. {
  393. plugin_require_api( 'core/config_api.php' );
  394.  
  395. # We need to allow blank emails for a sec
  396. ERP_set_temporary_overwrite( 'allow_blank_email', ON );
  397.  
  398. user_set_email( $t_user_id, '' );
  399. }
  400. }
  401. }
  402.  
  403. $t_schema = plugin_config_get( 'schema' );
  404. $t_reset_schema = plugin_config_get( 'reset_schema' );
  405. if ( $t_schema !== -1 && $t_reset_schema === 0 )
  406. {
  407. plugin_config_set( 'schema', -1 );
  408. plugin_config_set( 'reset_schema', 1 );
  409. }
  410.  
  411. plugin_config_set( 'config_version', 1 );
  412. }
  413.  
  414. if ( $t_config_version <= 1 )
  415. {
  416. $t_mail_reporter = plugin_config_get( 'mail_reporter', '' );
  417.  
  418. if ( strlen( $t_mail_reporter ) > 0 )
  419. {
  420. $t_mail_reporter_id = user_get_id_by_name( $t_mail_reporter );
  421. plugin_config_set( 'mail_reporter_id', $t_mail_reporter_id );
  422. }
  423.  
  424. plugin_config_delete( 'mail_directory' );
  425. plugin_config_delete( 'mail_reporter' );
  426. plugin_config_delete( 'mail_additional' );
  427. plugin_config_delete( 'random_user_number' );
  428. plugin_config_delete( 'mail_bug_priority_default' );
  429.  
  430. plugin_config_set( 'config_version', 2 );
  431. }
  432.  
  433. if ( $t_config_version <= 2 )
  434. {
  435. plugin_config_delete( 'mail_cronjob_present' );
  436. plugin_config_delete( 'mail_check_timer' );
  437. plugin_config_delete( 'mail_last_check' );
  438.  
  439. plugin_config_set( 'config_version', 3 );
  440. }
  441.  
  442. if ( $t_config_version <= 3 )
  443. {
  444. $t_mailboxes = plugin_config_get( 'mailboxes', array() );
  445. $t_indexes = array(
  446. 'mailbox_project' => 'mailbox_project_id',
  447. 'mailbox_global_category' => 'mailbox_global_category_id',
  448. );
  449.  
  450. foreach ( $t_mailboxes AS $t_key => $t_array )
  451. {
  452. if ( isset( $t_array[ 'mailbox_hostname' ] ) )
  453. {
  454. # Correct the hostname if it is stored in an older format
  455. $t_hostname = $t_array[ 'mailbox_hostname' ];
  456.  
  457. if ( !is_array( $t_hostname ) )
  458. {
  459. // ipv6 also uses : so we need to work around that
  460. if ( substr_count( $t_hostname, ':' ) === 1 )
  461. {
  462. $t_hostname = explode( ':', $t_hostname, 2 );
  463. }
  464. else
  465. {
  466. $t_hostname = array( $t_hostname );
  467. }
  468.  
  469. $t_hostname = array(
  470. 'hostname' => $t_hostname[ 0 ],
  471. 'port' => ( ( isset( $t_hostname[ 1 ] ) ) ? $t_hostname[ 1 ] : '' ),
  472. );
  473.  
  474. $t_array[ 'mailbox_hostname' ] = $t_hostname;
  475. }
  476. }
  477.  
  478. $t_mailboxes[ $t_key ] = $this->ERP_update_indexes( $t_array, $t_indexes );
  479. }
  480.  
  481. plugin_config_set( 'mailboxes', $t_mailboxes );
  482.  
  483. plugin_config_set( 'config_version', 4 );
  484. }
  485.  
  486. if ( $t_config_version <= 4 )
  487. {
  488. $t_mail_remove_mantis_email = plugin_config_get( 'mail_remove_mantis_email', -1 );
  489. $t_mail_identify_reply = plugin_config_get( 'mail_identify_reply', $t_mail_remove_mantis_email );
  490.  
  491. if ( $t_mail_remove_mantis_email !== -1 && $t_mail_identify_reply !== $t_mail_remove_mantis_email )
  492. {
  493. plugin_config_set( 'mail_remove_mantis_email', $t_mail_identify_reply );
  494. }
  495.  
  496. plugin_config_delete( 'mail_identify_reply' );
  497.  
  498. plugin_config_set( 'config_version', 5 );
  499. }
  500.  
  501. if ( $t_config_version <= 5 )
  502. {
  503. plugin_config_delete( 'mail_parse_mime' );
  504.  
  505. plugin_config_set( 'config_version', 6 );
  506. }
  507.  
  508. if ( $t_config_version <= 6 )
  509. {
  510. $t_mailboxes = plugin_config_get( 'mailboxes', array() );
  511. $t_indexes = array(
  512. 'mailbox_enabled' => 'enabled',
  513. 'mailbox_description' => 'description',
  514. 'mailbox_type' => 'type',
  515. 'mailbox_hostname' => 'hostname',
  516. 'mailbox_encryption' => 'encryption',
  517. 'mailbox_username' => 'username',
  518. 'mailbox_password' => 'password',
  519. 'mailbox_auth_method' => 'auth_method',
  520. 'mailbox_project_id' => 'project_id',
  521. 'mailbox_global_category_id' => 'global_category_id',
  522. 'mailbox_basefolder' => 'basefolder',
  523. 'mailbox_createfolderstructure' => 'createfolderstructure',
  524. );
  525.  
  526. foreach ( $t_mailboxes AS $t_key => $t_array )
  527. {
  528. $t_mailboxes[ $t_key ] = $this->ERP_update_indexes( $t_array, $t_indexes );
  529. }
  530.  
  531. plugin_config_set( 'mailboxes', $t_mailboxes );
  532.  
  533. plugin_config_set( 'config_version', 7 );
  534. }
  535.  
  536. if ( $t_config_version <= 7 )
  537. {
  538. $t_mailboxes = plugin_config_get( 'mailboxes', array() );
  539.  
  540. foreach ( $t_mailboxes AS $t_key => $t_array )
  541. {
  542. if ( isset( $t_array[ 'hostname' ] ) )
  543. {
  544. $t_hostname = $t_array[ 'hostname' ];
  545.  
  546. if ( is_array( $t_hostname ) )
  547. {
  548. $t_array[ 'hostname' ] = $t_hostname[ 'hostname' ];
  549. $t_array[ 'port' ] = $t_hostname[ 'port' ];
  550. }
  551.  
  552. $t_mailboxes[ $t_key ] = $t_array;
  553. }
  554. }
  555.  
  556. plugin_config_set( 'mailboxes', $t_mailboxes );
  557.  
  558. plugin_config_set( 'config_version', 8 );
  559. }
  560.  
  561. if ( $t_config_version <= 8 )
  562. {
  563. plugin_config_delete( 'mail_tmp_directory' );
  564.  
  565. plugin_config_set( 'config_version', 9 );
  566. }
  567.  
  568. if ( $t_config_version <= 9 )
  569. {
  570. $t_mailboxes = plugin_config_get( 'mailboxes', array() );
  571. $t_indexes = array(
  572. 'type' => 'mailbox_type',
  573. 'basefolder' => 'imap_basefolder',
  574. 'createfolderstructure' => 'imap_createfolderstructure',
  575. );
  576.  
  577. foreach ( $t_mailboxes AS $t_key => $t_array )
  578. {
  579. $t_mailboxes[ $t_key ] = $this->ERP_update_indexes( $t_array, $t_indexes );
  580. }
  581.  
  582. plugin_config_set( 'mailboxes', $t_mailboxes );
  583.  
  584. plugin_config_set( 'config_version', 10 );
  585. }
  586.  
  587. if ( $t_config_version <= 10 )
  588. {
  589. plugin_config_delete( 'mail_rule_system' );
  590.  
  591. plugin_config_set( 'config_version', 11 );
  592. }
  593.  
  594. if ( $t_config_version <= 11 )
  595. {
  596. $t_mailboxes = plugin_config_get( 'mailboxes', array() );
  597. $t_indexes = array(
  598. 'username' => 'erp_username',
  599. 'password' => 'erp_password',
  600. );
  601.  
  602. foreach ( $t_mailboxes AS $t_key => $t_array )
  603. {
  604. $t_mailboxes[ $t_key ] = $this->ERP_update_indexes( $t_array, $t_indexes );
  605. }
  606.  
  607. plugin_config_set( 'mailboxes', $t_mailboxes );
  608.  
  609. plugin_config_delete( 'rules' );
  610. plugin_config_delete( 'mail_encoding' );
  611.  
  612. plugin_config_set( 'config_version', 12 );
  613. }
  614.  
  615. if ( $t_config_version <= 12 )
  616. {
  617. plugin_config_set( 'reset_schema', 1 );
  618.  
  619. plugin_config_set( 'config_version', 13 );
  620. }
  621.  
  622. if ( $t_config_version <= 13 )
  623. {
  624. plugin_config_delete( 'mail_fetch_max' );
  625.  
  626. plugin_config_set( 'config_version', 14 );
  627. }
  628.  
  629. if ( $t_config_version <= 14 )
  630. {
  631. $t_mail_reporter_id = plugin_config_get( 'mail_reporter_id', 'Mail' );
  632. $t_report_bug_threshold = config_get_global( 'report_bug_threshold' );
  633.  
  634. if ( $t_mail_reporter_id !== 'Mail' && user_exists( $t_mail_reporter_id ) )
  635. {
  636. if ( !access_has_global_level( $t_report_bug_threshold, $t_mail_reporter_id ) )
  637. {
  638. user_set_field( $t_mail_reporter_id, 'access_level', $t_report_bug_threshold );
  639. }
  640. }
  641.  
  642. plugin_config_set( 'config_version', 15 );
  643. }
  644. }
  645.  
  646. /*
  647. * Modifies indexes in an array based on given array
  648. */
  649. function ERP_update_indexes( $p_array, $p_indexes )
  650. {
  651. $t_array = $p_array;
  652.  
  653. foreach ( $p_indexes AS $t_old_index => $t_new_index )
  654. {
  655. if ( isset( $t_array[ $t_old_index ] ) )
  656. {
  657. $t_array[ $t_new_index ] = $t_array[ $t_old_index ];
  658. unset( $t_array[ $t_old_index ] );
  659. }
  660. }
  661.  
  662. return( $t_array );
  663. }
  664.  
  665. /*
  666. * Prepare mantisbt variable for use while bug_report_mail is running
  667. * This variable fixes the problem where when EmailReporting sends emails
  668. * that the url in the emails is incorrect
  669. */
  670. function ERP_check_mantisbt_url( )
  671. {
  672. if ( php_sapi_name() !== 'cli' && !isset( $GLOBALS[ 't_dir_emailreporting_adjust' ] ) )
  673. {
  674. $t_path = config_get_global( 'path' );
  675. $t_mail_mantisbt_url_fix = plugin_config_get( 'mail_mantisbt_url_fix', '' );
  676.  
  677. if ( strncasecmp( $t_path, 'http', 4 ) === 0 && $t_path !== $t_mail_mantisbt_url_fix )
  678. {
  679. plugin_config_set( 'mail_mantisbt_url_fix', $t_path );
  680. }
  681. }
  682. }
  683.  
  684. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement