View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004286 | Plugin - EmailReporting | General | public | 2004-08-06 09:51 | 2016-07-21 15:17 |
Reporter | indy | Assigned To | SL-Gundam | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Summary | 0004286: Solution for reporting via E-Mail | ||||
Description | Maybe somebody is interested in, I have written a script for receiving bug reports through a POP3 E-Mail account. | ||||
Tags | admin, email | ||||
Attached Files | mantis-working.patch (23,038 bytes)
diff -rNu mantis.orig/README.bug_report_mail mantis/README.bug_report_mail --- mantis.orig/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis/README.bug_report_mail Mon Aug 9 23:26:21 2004 @@ -0,0 +1,54 @@ +The current version of bug_report_mail only support plain text e-mails +and POP3 Mailaccounts with PEAR's Net_POP3 packge. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter you projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/user_api.php + manage_proj_edit_page.php + config_inc.php.sample +These files are new: + core/mail_api.php + sql/bug_report_mail.php + bug_report_mail.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the +project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php + +This line uses lynx to fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same condition as Mantis itself. + +Gerrit Beine, August 2004 diff -rNu mantis.orig/bug_report_mail.php mantis/bug_report_mail.php --- mantis.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis/bug_report_mail.php Mon Aug 9 23:24:27 2004 @@ -0,0 +1,37 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # Copyright (C) 2004 pitcom GmbH, Plauen, Germany + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- +?> +<?php + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); +?> +<?php + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'string_api.php' ); + require_once( $t_core_path.'bug_api.php' ); + require_once( $t_core_path.'mail_api.php' ); +?> +<?php + $t_projects = mail_project_get_all_rows(); + foreach ($t_projects as $t_project) { + $t_mails = mail_get_all_mails($t_project); + foreach ($t_mails as $t_mail) + { + mail_add_bug($t_mail, $t_project); + } + } +?> + diff -rNu mantis.orig/config_inc.php mantis/config_inc.php --- mantis.orig/config_inc.php Thu Jan 1 01:00:00 1970 +++ mantis/config_inc.php Mon Aug 9 22:27:31 2004 @@ -0,0 +1,78 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id: config_inc.php.sample,v 1.12 2004/02/08 13:16:57 vboctor Exp $ + # -------------------------------------------------------- + + # This sample file contains the essential files that you MUST + # configure to your specific settings. You may override settings + # from config_defaults_inc.php by assigning new values in this file + + # Rename this file to config_inc.php after configuration. + + ########################################################################### + # CONFIGURATION VARIABLES + ########################################################################### + + # In general the value OFF means the feature is disabled and ON means the + # feature is enabled. Any other cases will have an explanation. + + # Look in http://www.mantisbt.org/manual or config_defaults_inc.php for more + # detailed comments. + + # --- database variables --------- + + # set these values to match your setup + $g_hostname = "localhost"; + $g_port = 3306; # 3306 is default + $g_db_username = "root"; + $g_db_password = "root"; + $g_database_name = "mantis"; + + # --- email variables ------------- + $g_administrator_email = 'administrator@example.com'; + $g_webmaster_email = 'webmaster@example.com'; + + # the "From: " field in emails + $g_from_email = 'noreply@example.com'; + + # the "To: " address all emails are sent. This can be a mailing list or archive address. + # Actual users are emailed via the bcc: fields + $g_to_email = 'nobody@example.com'; + + # the return address for bounced mail + $g_return_path_email = 'admin@example.com'; + + # --- login method ---------------- + # CRYPT or PLAIN or MD5 or LDAP or BASIC_AUTH + $g_login_method = MD5; + + # --- email vars ------------------ + # set to OFF to disable email check + # These should be OFF for Windows installations + $g_validate_email = OFF; + $g_check_mx_record = OFF; + + # --- file upload settings -------- + # This is the master setting to disable *all* file uploading functionality + # + # The default value is ON but you must make sure file uploading is enabled + # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini. + $g_allow_file_upload = ON; + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = OFF; + + # The account's name for mail reporting + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, only works if mail_use_reporter is OFF + $g_mail_auto_signup = ON; +?> diff -rNu mantis.orig/config_inc.php.sample mantis/config_inc.php.sample --- mantis.orig/config_inc.php.sample Sun Feb 8 14:16:56 2004 +++ mantis/config_inc.php.sample Mon Aug 9 18:32:00 2004 @@ -64,4 +64,15 @@ # The default value is ON but you must make sure file uploading is enabled # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini. $g_allow_file_upload = ON; + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, only works if mail_use_reporter is OFF + $g_mail_auto_signup = OFF; ?> diff -rNu mantis.orig/core/mail_api.php mantis/core/mail_api.php --- mantis.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis/core/mail_api.php Mon Aug 9 23:22:29 2004 @@ -0,0 +1,212 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # Copyright (C) 2004 pitcom GmbH, Plauen, Germany + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); +?> +<?php + # This page receives an E-Mail via POP3 and generates an Report +?> +<?php + require_once( 'Net/POP3.php' ); + + # -------------------- + # Update the mail account data + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_pop3_host = db_prepare_string( $p_pop3_host ); + $c_pop3_user = db_prepare_string( $p_pop3_user ); + $c_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$c_pop3_host', + pop3_user='$c_pop3_user', + pop3_pass='$c_pop3_pass' + WHERE id='$c_project_id'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data + function mail_delete( $p_project_id ) { + $c_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$c_project_id'"; + db_query( $query ); + return true; + } + + #=================================== + # Data Access + #=================================== + + # -------------------- + # Return all versions for the specified project + function mail_get_account_data( $p_project_id ) { + $c_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_table + WHERE id='$c_project_id'"; + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $m_projects = array(); + $t_projects = project_get_all_rows(); + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host']) { + array_push($m_projects, $t_project); + } + } + return $m_projects; + } + + # -------------------- + # return all mails for a project + # return an empty array if there are no new mails + function mail_get_all_mails($p_project) { + $t_mails = array(); + $pop3 = &new Net_POP3(); + $t_pop3_host = $p_project['pop3_host']; + $t_pop3_user = $p_project['pop3_user']; + $t_pop3_password = $p_project['pop3_pass']; + $pop3->connect($t_pop3_host, 110); + $pop3->login($t_pop3_user, $t_pop3_password); + for ($i = 1; $i <= $pop3->numMsg(); $i++) { + $mail = $pop3->getParsedHeaders($i); + $mail['X-Mantis-Body'] = $pop3->getBody($i); + $mail['X-Mantis-Complete'] = $pop3->getMsg($i); + array_push($t_mails, $mail); + $pop3->deleteMsg($i); + } + $pop3->disconnect(); + return $t_mails; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ($p_mailaddress) { + $t_mailaddress = $p_mailaddress; + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $t_mailaddress = $matches[1]; + } + return preg_replace("/[@\.-]/",'_',$t_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ($p_subject) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ($p_subject) { + preg_match("/\[([A-Za-z0-9-_\.]*\s([0-9]{7}?))\]/", $p_subject, $matches); + return $matches[2]; + } + # -------------------- + # return the user id for the mail reporting user + # return false if no username can be found + function mail_get_user ($p_mail) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + if ($t_mail_use_reporter) { + $t_mail_reporter = config_get( 'mail_reporter' ); + $t_reporter_id = user_get_id_by_name($t_mail_reporter); + } + else { + $t_user_name = mail_user_name_from_address($p_mail['From']); + $t_reporter_id = user_get_id_by_name($t_user_name); + if (!$t_reporter_id) { // try to get the user's id searching for mail address + $t_reporter_id = user_get_id_by_mail($p_mail['From']); + } + if (!$t_reporter_id && $t_mail_auto_signup) { // try to signup the user + user_signup($t_user_name, $p_mail['From']); + $t_reporter_id = user_get_id_by_name($t_user_name); + } + } + return $t_reporter_id; + } + + # -------------------- + # Adds a bug reported via email + # Todo: If there is already a bug, add it as a bug note + function mail_add_bug($p_mail, $p_project) { + $f_build = gpc_get_string( 'build', '' ); + $f_platform = gpc_get_string( 'platform', '' ); + $f_os = gpc_get_string( 'os', '' ); + $f_os_build = gpc_get_string( 'os_build', '' ); + $f_product_version = gpc_get_string( 'product_version', '' ); + $f_profile_id = gpc_get_int( 'profile_id', 0 ); + $f_handler_id = gpc_get_int( 'handler_id', 0 ); + $f_view_state = gpc_get_int( 'view_state', 0 ); + + $f_category = gpc_get_string( 'category', '' ); + $f_priority = gpc_get_int( 'priority', NORMAL ); + $f_steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + + $f_reproducibility = 10; + $f_severity = 50; + $f_summary = $p_mail['Subject']; + $f_description = $p_mail['X-Mantis-Body']; + $f_additional_info = $p_mail['X-Mantis-Complete']; + $f_project_id = $p_project['id']; + $t_reporter_id = mail_get_user($p_mail); + + if (mail_is_a_bugnote($p_mail['Subject'])) + { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject($p_mail['Subject']); + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + else + { + # Create the bug + $t_bug_id = bug_create( $f_project_id, + $t_reporter_id, $f_handler_id, + $f_priority, + $f_severity, $f_reproducibility, + $f_category, + $f_os, $f_os_build, + $f_platform, $f_product_version, + $f_build, + $f_profile_id, $f_summary, $f_view_state, + $f_description, $f_steps_to_reproduce, $f_additional_info ); + email_new_bug( $t_bug_id ); + } + + } + +?> diff -rNu mantis.orig/core/user_api.php mantis/core/user_api.php --- mantis.orig/core/user_api.php Sun Jan 11 08:16:10 2004 +++ mantis/core/user_api.php Sun Aug 8 20:08:38 2004 @@ -413,6 +413,26 @@ } # -------------------- + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailadress ) { + $c_mailadress = db_prepare_string( $p_mailadress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailadress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + + # -------------------- # return all data associated with a particular user name # return false if the username does not exist function user_get_row_by_name( $p_username ) { diff -rNu mantis.orig/manage_proj_edit_page.php mantis/manage_proj_edit_page.php --- mantis.orig/manage_proj_edit_page.php Sun Jan 11 08:16:06 2004 +++ mantis/manage_proj_edit_page.php Mon Aug 9 21:37:44 2004 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -524,6 +526,57 @@ } # end for ?> </table> +</div> + +<!-- MAIL ACCOUNT RESET --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> </div> <?php html_page_bottom1( __FILE__ ) ?> diff -rNu mantis.orig/manage_proj_mail_delete.php mantis/manage_proj_mail_delete.php --- mantis.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_mail_delete.php Mon Aug 9 21:25:02 2004 @@ -0,0 +1,45 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- +?> +<?php + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'mail_api.php' ); +?> +<?php + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; +?> +<?php + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -rNu mantis.orig/manage_proj_mail_update.php mantis/manage_proj_mail_update.php --- mantis.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_mail_update.php Mon Aug 9 21:35:44 2004 @@ -0,0 +1,60 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- +?> +<?php + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'mail_api.php' ); +?> +<?php + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; +?> +<?php + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -rNu mantis.orig/sql/bug_report_mail.sql mantis/sql/bug_report_mail.sql --- mantis.orig/sql/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis/sql/bug_report_mail.sql Fri Aug 6 15:14:24 2004 @@ -0,0 +1,5 @@ + +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; diff -rNu mantis.orig/sql/db_generate.sql mantis/sql/db_generate.sql --- mantis.orig/sql/db_generate.sql Fri Feb 6 20:44:24 2004 +++ mantis/sql/db_generate.sql Mon Aug 9 18:16:44 2004 @@ -306,6 +306,9 @@ access_min int(2) NOT NULL default '10', file_path varchar(250) NOT NULL default '', description text NOT NULL, + pop3_host varchar(255) default NULL, + pop3_user varchar(255) default NULL, + pop3_pass varchar(255) default NULL, PRIMARY KEY (id), UNIQUE KEY name (name), KEY id (id) mantis-0.19.0.patch (42,781 bytes)
diff -Nru mantis-0.19.0.orig/bug_report_mail.php mantis-0.19.0/bug_report_mail.php --- mantis-0.19.0.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/bug_report_mail.php Wed Sep 15 17:29:41 2004 @@ -0,0 +1,33 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + $t_mails = mail_get_all_mails($t_project); + foreach ($t_mails as $t_mail) + { + mail_add_bug($t_mail, $t_project); + } + } +?> + diff -Nru mantis-0.19.0.orig/config_defaults_inc.php mantis-0.19.0/config_defaults_inc.php --- mantis-0.19.0.orig/config_defaults_inc.php Sun Sep 12 14:12:30 2004 +++ mantis-0.19.0/config_defaults_inc.php Wed Sep 15 17:27:55 2004 @@ -1335,4 +1335,20 @@ # Enable support for bug relationships where a bug can be a related, dependent on, or duplicate of another. # See relationship_api.php for more details. $g_enable_relationship = ON; + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; ?> diff -Nru mantis-0.19.0.orig/config_inc.php mantis-0.19.0/config_inc.php --- mantis-0.19.0.orig/config_inc.php Sun Sep 12 16:03:14 2004 +++ mantis-0.19.0/config_inc.php Wed Sep 15 17:28:04 2004 @@ -49,4 +49,17 @@ # The default value is ON but you must make sure file uploading is enabled # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini. $g_allow_file_upload = ON; + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = OFF; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = ON; + ?> diff -Nru mantis-0.19.0.orig/core/mail_api.php mantis-0.19.0/core/mail_api.php --- mantis-0.19.0.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/core/mail_api.php Wed Sep 15 17:20:27 2004 @@ -0,0 +1,222 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + + # -------------------- + # Update the mail account data + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return all versions for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all mails for a project + # return an empty array if there are no new mails + function mail_get_all_mails( $p_project ) { + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_project['pop3_host']; + $t_pop3_user = $p_project['pop3_user']; + $t_pop3_password = $p_project['pop3_pass']; + + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + for ($i = 1; $i <= $t_pop3->numMsg(); $i++) { + $t_mail = $t_pop3->getParsedHeaders($i); + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + $t_mail['X-Mantis-Complete'] = $t_pop3->getMsg($i); + array_push($v_mails, $t_mail); + #$t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $c_mailaddress = $matches[1]; + } + + return $c_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ($p_mail_subject) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject) { + preg_match("/\[([A-Za-z0-9-_\.]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $c_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $c_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $c_mailaddress ); + user_signup($t_user_name, $c_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + return $t_reporter_id; + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug( $p_mail, $p_project ) { + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + $t_bug_data->category = gpc_get_string( 'category', '' ); + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + $t_bug_data->description = $p_mail['X-Mantis-Body']; + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_project['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if (mail_is_a_bugnote($p_mail['Subject'])) + { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } + else + { + # Create the bug + #$t_bug_id = bug_create( $t_bug_data ); + #email_new_bug( $t_bug_id ); + } + + } + +?> diff -Nru mantis-0.19.0.orig/core/user_api.php mantis-0.19.0/core/user_api.php --- mantis-0.19.0.orig/core/user_api.php Mon Aug 23 16:13:34 2004 +++ mantis-0.19.0/core/user_api.php Wed Sep 15 17:20:36 2004 @@ -478,6 +478,27 @@ } # -------------------- + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + + $c_mailaddress = db_prepare_string( $p_mailaddress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + + # -------------------- # return all data associated with a particular user name # return false if the username does not exist function user_get_row_by_name( $p_username ) { diff -Nru mantis-0.19.0.orig/doc/README.bug_report_mail mantis-0.19.0/doc/README.bug_report_mail --- mantis-0.19.0.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/doc/README.bug_report_mail Wed Sep 15 17:32:01 2004 @@ -0,0 +1,53 @@ +The current version of bug_report_mail only support plain text e-mails +and POP3 Mailaccounts with PEAR's Net_POP3 packge. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/user_api.php + manage_proj_edit_page.php + config_default_inc.php +These files are new: + core/mail_api.php + sql/bug_report_mail.sql + bug_report_mail.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php + +This line uses lynx to fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same condition as Mantis itself. + +Gerrit Beine, August 2004 diff -Nru mantis-0.19.0.orig/doc/README.bug_report_mail~ mantis-0.19.0/doc/README.bug_report_mail~ --- mantis-0.19.0.orig/doc/README.bug_report_mail~ Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/doc/README.bug_report_mail~ Mon Aug 9 23:26:21 2004 @@ -0,0 +1,54 @@ +The current version of bug_report_mail only support plain text e-mails +and POP3 Mailaccounts with PEAR's Net_POP3 packge. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter you projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/user_api.php + manage_proj_edit_page.php + config_inc.php.sample +These files are new: + core/mail_api.php + sql/bug_report_mail.php + bug_report_mail.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the +project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php + +This line uses lynx to fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same condition as Mantis itself. + +Gerrit Beine, August 2004 diff -Nru mantis-0.19.0.orig/manage_proj_edit_page.php mantis-0.19.0/manage_proj_edit_page.php --- mantis-0.19.0.orig/manage_proj_edit_page.php Thu Jul 15 00:16:34 2004 +++ mantis-0.19.0/manage_proj_edit_page.php Wed Sep 15 17:30:05 2004 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,8 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); + ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -534,4 +537,55 @@ </table> </div> + +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> <?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_edit_page.php~ mantis-0.19.0/manage_proj_edit_page.php~ --- mantis-0.19.0.orig/manage_proj_edit_page.php~ Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_edit_page.php~ Wed Sep 15 16:40:53 2004 @@ -0,0 +1,591 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id: manage_proj_edit_page.php,v 1.79 2004/07/14 22:16:34 vboctor Exp $ + # -------------------------------------------------------- +?> +<?php + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'category_api.php' ); + require_once( $t_core_path . 'version_api.php' ); + require_once( $t_core_path . 'custom_field_api.php' ); + require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path.'mail_api.php' ); +?> +<?php + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); + +?> +<?php html_page_top1() ?> +<?php html_page_top2() ?> + +<?php print_manage_menu( 'manage_proj_edit_page.php' ) ?> + +<br /> + + +<!-- PROJECT PROPERTIES --> +<div align="center"> +<form method="post" action="manage_proj_update.php"> +<table class="width75" cellspacing="1"> + +<!-- Title --> +<tr> + <td class="form-title" colspan="2"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <?php echo lang_get( 'edit_project_title' ) ?> + </td> +</tr> + +<!-- Name --> +<tr <?php echo helper_alternate_class() ?>> + <td class="category" width="25%"> + <?php echo lang_get( 'project_name' ) ?> + </td> + <td width="75%"> + <input type="text" name="name" size="50" maxlength="128" value="<?php echo string_attribute( $row['name'] ) ?>" /> + </td> +</tr> + +<!-- Status --> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'status' ) ?> + </td> + <td> + <select name="status"> + <?php print_enum_string_option_list( 'project_status', $row['status'] ) ?> + </select> + </td> +</tr> + +<!-- Enabled --> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'enabled' ) ?> + </td> + <td> + <input type="checkbox" name="enabled" <?php check_checked( $row['enabled'], ON ); ?> /> + </td> +</tr> + +<!-- View Status (public/private) --> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'view_status' ) ?> + </td> + <td> + <select name="view_state"> + <?php print_enum_string_option_list( 'view_state', $row['view_state']) ?> + </select> + </td> +</tr> + +<!-- File upload path (if uploading is enabled) --> +<?php if ( file_is_uploading_enabled() ) { ?> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'upload_file_path' ) ?> + </td> + <td> + <input type="text" name="file_path" size="50" maxlength="250" value="<?php echo string_attribute( $row['file_path'] ) ?>" /> + </td> +</tr> +<?php } ?> + +<!-- Description --> +<tr <?php echo helper_alternate_class() ?>> + <td class="category"> + <?php echo lang_get( 'description' ) ?> + </td> + <td> + <textarea name="description" cols="60" rows="5" wrap="virtual"><?php echo string_textarea( $row['description'] ) ?></textarea> + </td> +</tr> + +<!-- Submit Button --> +<tr> + <td> </td> + <td> + <input type="submit" class="button" value="<?php echo lang_get( 'update_project_button' ) ?>" /> + </td> +</tr> +</table> +</form> +</div> + +<br /> + +<!-- PROJECT DELETE --> +<?php +# You must have global permissions to delete projects +if ( access_has_global_level ( config_get( 'delete_project_threshold' ) ) ) { ?> +<div class="border-center"> + <form method="post" action="manage_proj_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" class="button" value="<?php echo lang_get( 'delete_project_button' ) ?>" /> + </form> +</div> +<?php } ?> + +<br /> + +<?php + # reset the class counter + helper_alternate_class( 0 ); +?> + +<!-- PROJECT CATEGORIES --> +<div align="center"> +<table class="width75" cellspacing="1"> + +<!-- Title --> +<tr> + <td class="form-title" colspan="3"> + <?php echo lang_get( 'categories' ) ?> + </td> +</tr> +<?php + $t_categories = category_get_all_rows( $f_project_id ); + + if ( count( $t_categories ) > 0 ) { +?> + <tr class="row-category"> + <td> + <?php echo lang_get( 'category' ) ?> + </td> + <td> + <?php echo lang_get( 'assign_to' ) ?> + </td> + <td class="center"> + <?php echo lang_get( 'actions' ) ?> + </td> + </tr> +<?php + } + + foreach ( $t_categories as $t_category ) { + $t_name = $t_category['category']; + + if ( NO_USER != $t_category['user_id'] && user_exists( $t_category['user_id'] )) { + $t_user_name = user_get_name( $t_category['user_id'] ); + } else { + $t_user_name = ''; + } +?> +<!-- Repeated Info Row --> + <tr <?php echo helper_alternate_class() ?>> + <td> + <?php echo string_display( $t_name ) ?> + </td> + <td> + <?php echo $t_user_name ?> + </td> + <td class="center"> + <?php + $t_name = urlencode( $t_name ); + + print_bracket_link( 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $t_name, lang_get( 'edit_link' ) ); + echo ' '; + print_bracket_link( 'manage_proj_cat_delete.php?project_id=' . $f_project_id . '&category=' . $t_name, lang_get( 'delete_link' ) ); + ?> + </td> + </tr> +<?php + } # end for loop +?> + +<!-- Add Category Form --> +<tr> + <td class="left" colspan="3"> + <form method="post" action="manage_proj_cat_add.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="text" name="category" size="32" maxlength="64" /> + <input type="submit" class="button" value="<?php echo lang_get( 'add_category_button' ) ?>" /> + </form> + </td> +</tr> + +<!-- Copy Categories Form --> +<tr> + <td class="left" colspan="3"> + <form method="post" action="manage_proj_cat_copy.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <select name="other_project_id"> + <?php print_project_option_list( null, false ) ?> + </select> + <input type="submit" name="copy_from" class="button" value="<?php echo lang_get( 'copy_categories_from' ) ?>" /> + <input type="submit" name="copy_to" class="button" value="<?php echo lang_get( 'copy_categories_to' ) ?>" /> + </form> + </td> +</tr> +</table> + +<br /> + +<?php + # reset the class counter + helper_alternate_class( 0 ); +?> + +<!-- PROJECT VERSIONS --> +<table class="width75" cellspacing="1"> + +<!-- Title --> +<tr> + <td class="form-title" colspan="3"> + <?php echo lang_get( 'versions' ) ?> + </td> +</tr> +<?php + $t_versions = version_get_all_rows( $f_project_id ); + + if ( count( $t_versions ) > 0 ) { +?> + <tr class="row-category"> + <td> + <?php echo lang_get( 'version' ) ?> + </td> + <td class="center"> + <?php echo lang_get( 'timestamp' ) ?> + </td> + <td class="center"> + <?php echo lang_get( 'actions' ) ?> + </td> + </tr> +<?php + } + + foreach ( $t_versions as $t_version ) { + $t_name = $t_version['version']; + $t_date_order = $t_version['date_order']; + $t_date_formatted = string_format_complete_date( $t_version['date_order'] ); +?> +<!-- Repeated Info Rows --> + <tr <?php echo helper_alternate_class() ?>> + <td> + <?php echo string_display( $t_name ) ?> + </td> + <td class="center"> + <?php echo $t_date_formatted ?> + </td> + <td class="center"> + <?php + $t_version_id = version_get_id( $t_name, $f_project_id ); + + print_bracket_link( 'manage_proj_ver_edit_page.php?version_id=' . $t_version_id, lang_get( 'edit_link' ) ); + echo ' '; + print_bracket_link( 'manage_proj_ver_delete.php?version_id=' . $t_version_id, lang_get( 'delete_link' ) ); + ?> + </td> + </tr> +<?php + } # end for loop +?> + +<!-- Version Add Form --> +<tr> + <td class="left" colspan="3"> + <form method="post" action="manage_proj_ver_add.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="text" name="version" size="32" maxlength="64" /> + <input type="submit" class="button" value="<?php echo lang_get( 'add_version_button' ) ?>" /> + </form> + </td> +</tr> +</table> +</div> + + +<?php + # reset the class counter + helper_alternate_class( 0 ); +?> + +<!-- PROJECT CUSTOM FIELD --> +<?php +# You need either global permissions or project-specific permissions to link +# custom fields +if ( access_has_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ) && + ( count( custom_field_get_ids() ) > 0 ) ) { +?> + <br /> + <div align="center"> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="3"> + <?php echo lang_get( 'custom_fields_setup' ) ?> + </td> + </tr> + <?php + $t_custom_fields = custom_field_get_linked_ids( $f_project_id ); + + if ( count( $t_custom_fields ) > 0 ) { + ?> + <tr class="row-category"> + <td width="50%"> + <?php echo lang_get( 'custom_field' ) ?> + </td> + <td width="25%"> + <?php echo lang_get( 'custom_field_sequence' ) ?> + </td> + <td class="center" width="25%"> + <?php echo lang_get( 'actions' ); ?> + </td> + </tr> + <?php + } + + foreach( $t_custom_fields as $t_field_id ) { + $t_desc = custom_field_get_definition( $t_field_id ); + ?> + <tr <?php echo helper_alternate_class() ?>> + <td> + <?php echo $t_desc['name'] ?> + </td> + <td> +<form method="post" action="manage_proj_custom_field_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="field_id" value="<?php echo $t_field_id ?>" /> + <input type="text" name="sequence" value="<?php echo custom_field_get_sequence( $t_field_id, $f_project_id ) ?>" size="2" /> + <input type="submit" class="button" value="<?php echo lang_get( 'update' ) ?>" /> +</form> + </td> + <td class="center"> + <?php + # You need global permissions to edit custom field defs + print_bracket_link( "manage_proj_custom_field_remove.php?field_id=$t_field_id&project_id=$f_project_id", lang_get( 'remove_link' ) ); + ?> + </td> + </tr> + <?php + } # end for loop + ?> + <tr> + <td class="left" colspan="3"> + <form method="post" action="manage_proj_custom_field_add_existing.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <select name="field_id"> + <?php + $t_custom_fields = custom_field_get_ids(); + + foreach( $t_custom_fields as $t_field_id ) + { + if( !custom_field_is_linked( $t_field_id, $f_project_id ) ) { + $t_desc = custom_field_get_definition( $t_field_id ); + echo "<option value=\"$t_field_id\">" . string_attribute( $t_desc['name'] ) . '</option>' ; + } + } + ?> + </select> + <input type="submit" class="button" value="<?php echo lang_get( 'add_existing_custom_field' ) ?>" /> + </form> + </td> + </tr> + </table> + </div> +<?php +} +?> + + +<!-- PROJECT VIEW STATUS --> +<br /> +<div align="center"> + <table class="width75" cellspacing="1"> + <tr> + <td class="center"> + <?php + if ( VS_PUBLIC == project_get_field( $f_project_id, 'view_state' ) ) { + echo lang_get( 'public_project_msg' ); + } else { + echo lang_get( 'private_project_msg' ); + } + ?> + </td> + </tr> + </table> +</div> + + +<!-- USER MANAGEMENT (ADD) --> +<?php +# We want to allow people with global permissions and people with high enough +# permissions on the project we are editing +if ( access_has_project_level( config_get( 'project_user_threshold' ), $f_project_id ) ) { +?> +<br /> +<div align="center"> + <form method="post" action="manage_proj_user_add.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="5"> + <?php echo lang_get( 'add_user_title' ) ?> + </td> + </tr> + <tr class="row-1" valign="top"> + <td class="category"> + <?php echo lang_get( 'username' ) ?> + </td> + <td class="category"> + <?php echo lang_get( 'access_level' ) ?> + </td> + <td class="category"> </td> + </tr> + <tr class="row-1" valign="top"> + <td> + <select name="user_id[]" multiple="multiple" size="10"> + <?php print_project_user_list_option_list( $f_project_id ) ?> + </select> + </td> + <td> + <select name="access_level"> + <?php # No administrator choice ?> + <?php print_project_access_levels_option_list( config_get( 'default_new_account_access_level' ) ) ?> + </select> + </td> + <td> + <input type="submit" class="button" value="<?php echo lang_get( 'add_user_button' ) ?>" /> + </td> + </tr> + </table> + </form> +</div> +<?php +} +?> + + +<!-- LIST OF USERS --> +<br /> +<div align="center"> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo lang_get( 'manage_accounts_title' ) ?> + </td> + </tr> + <tr class="row-category"> + <td> + <?php echo lang_get( 'username' ) ?> + </td> + <td> + <?php echo lang_get( 'email' ) ?> + </td> + <td> + <?php echo lang_get( 'access_level' ) ?> + </td> + <td class="center"> + <?php echo lang_get( 'actions' ) ?> + </td> + </tr> +<?php + $t_users = project_get_all_user_rows( $f_project_id ); + + # reset the class counter + helper_alternate_class( 0 ); + + foreach ( $t_users as $t_user ) { +?> + <tr <?php echo helper_alternate_class() ?>> + <td> + <?php + echo $t_user['username']; + if ( isset( $t_user['realname'] ) && $t_user['realname'] > "" ) { + echo " (" . $t_user['realname'] . ")"; + } + ?> + </td> + <td> + <?php + $t_email = user_get_email( $t_user['id'] ); + print_email_link( $t_email, $t_email ); + ?> + </td> + <td> + <?php echo get_enum_element( 'access_levels', $t_user['access_level'] ) ?> + </td> + <td class="center"> + <?php + # You need global or project-specific permissions to remove users + # from this project + if ( access_has_project_level( config_get( 'project_user_threshold' ), $f_project_id ) ) { + if ( project_includes_user( $f_project_id, $t_user['id'] ) ) { + print_bracket_link( 'manage_proj_user_remove.php?project_id=' . $f_project_id . '&user_id=' . $t_user['id'], lang_get( 'remove_link' ) ); + } + } + ?> + </td> + </tr> +<?php + } # end for +?> + </table> +</div> + + +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_delete.php mantis-0.19.0/manage_proj_mail_delete.php --- mantis-0.19.0.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_delete.php Wed Sep 15 17:29:59 2004 @@ -0,0 +1,42 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_delete.php~ mantis-0.19.0/manage_proj_mail_delete.php~ --- mantis-0.19.0.orig/manage_proj_mail_delete.php~ Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_delete.php~ Wed Sep 15 16:35:39 2004 @@ -0,0 +1,42 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_update.php mantis-0.19.0/manage_proj_mail_update.php --- mantis-0.19.0.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_update.php Wed Sep 15 17:29:54 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_update.php~ mantis-0.19.0/manage_proj_mail_update.php~ --- mantis-0.19.0.orig/manage_proj_mail_update.php~ Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_update.php~ Wed Sep 15 16:37:50 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/sql/bug_report_mail.sql mantis-0.19.0/sql/bug_report_mail.sql --- mantis-0.19.0.orig/sql/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/sql/bug_report_mail.sql Wed Sep 15 17:24:06 2004 @@ -0,0 +1,4 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; diff -Nru mantis-0.19.0.orig/sql/db_generate.sql mantis-0.19.0/sql/db_generate.sql --- mantis-0.19.0.orig/sql/db_generate.sql Sun Sep 12 14:19:24 2004 +++ mantis-0.19.0/sql/db_generate.sql Wed Sep 15 17:24:02 2004 @@ -377,6 +377,9 @@ access_min int(2) NOT NULL default '10', file_path varchar(250) NOT NULL default '', description text NOT NULL, + pop3_host varchar( 255 ) default NULL , + pop3_user varchar( 255 ) default NULL , + pop3_pass varchar( 255 ) default NULL , PRIMARY KEY (id), UNIQUE KEY name (name), KEY id (id) mantis-0.19.0.patch (34,447 bytes)
diff -Nru mantis-0.19.0.orig/bug_report_mail.php mantis-0.19.0/bug_report_mail.php --- mantis-0.19.0.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/bug_report_mail.php Wed Sep 15 18:59:59 2004 @@ -0,0 +1,33 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nru mantis-0.19.0.orig/config_defaults_inc.php mantis-0.19.0/config_defaults_inc.php --- mantis-0.19.0.orig/config_defaults_inc.php Sun Sep 12 14:12:30 2004 +++ mantis-0.19.0/config_defaults_inc.php Wed Sep 15 17:27:55 2004 @@ -1335,4 +1335,20 @@ # Enable support for bug relationships where a bug can be a related, dependent on, or duplicate of another. # See relationship_api.php for more details. $g_enable_relationship = ON; + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; ?> diff -Nru mantis-0.19.0.orig/config_inc.php mantis-0.19.0/config_inc.php --- mantis-0.19.0.orig/config_inc.php Sun Sep 12 16:03:14 2004 +++ mantis-0.19.0/config_inc.php Wed Sep 15 17:28:04 2004 @@ -49,4 +49,17 @@ # The default value is ON but you must make sure file uploading is enabled # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini. $g_allow_file_upload = ON; + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = OFF; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = ON; + ?> diff -Nru mantis-0.19.0.orig/core/category_api.php mantis-0.19.0/core/category_api.php --- mantis-0.19.0.orig/core/category_api.php Thu Apr 8 20:04:52 2004 +++ mantis-0.19.0/core/category_api.php Wed Sep 15 18:52:45 2004 @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; diff -Nru mantis-0.19.0.orig/core/mail_api.php mantis-0.19.0/core/mail_api.php --- mantis-0.19.0.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/core/mail_api.php Wed Sep 15 19:00:09 2004 @@ -0,0 +1,341 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the Mail per Category feature for a project + function mail_categories( $p_project_id , $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$c_project_id' AND category='$c_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + $c_pop3_host = db_prepare_string( $p_pop3_host ); + $c_pop3_user = db_prepare_string( $p_pop3_user ); + $c_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$c_pop3_host', + pop3_user='$c_pop3_user', + pop3_pass='$c_pop3_pass' + WHERE project_id='$c_project_id' AND category='$c_category'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$c_project_id' AND category='$c_category'"; + + db_query( $query ); + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['pop3_categories'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + for ($i = 1; $i <= $t_pop3->numMsg(); $i++) { + $t_mail = $t_pop3->getParsedHeaders($i); + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + $t_mail['X-Mantis-Complete'] = $t_pop3->getMsg($i); + array_push($v_mails, $t_mail); + $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $c_mailaddress = $matches[1]; + } + + return $c_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ($p_mail_subject) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject) { + preg_match("/\[([A-Za-z0-9-_\.]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $c_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $c_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $c_mailaddress ); + user_signup($t_user_name, $c_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + return $t_reporter_id; + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug( $p_mail, $p_account ) { + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + $t_bug_data->description = $p_mail['X-Mantis-Body']; + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if (mail_is_a_bugnote($p_mail['Subject'])) + { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } + else + { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + + } + +?> diff -Nru mantis-0.19.0.orig/core/user_api.php mantis-0.19.0/core/user_api.php --- mantis-0.19.0.orig/core/user_api.php Mon Aug 23 16:13:34 2004 +++ mantis-0.19.0/core/user_api.php Wed Sep 15 17:20:36 2004 @@ -478,6 +478,27 @@ } # -------------------- + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + + $c_mailaddress = db_prepare_string( $p_mailaddress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + + # -------------------- # return all data associated with a particular user name # return false if the username does not exist function user_get_row_by_name( $p_username ) { diff -Nru mantis-0.19.0.orig/doc/README.bug_report_mail mantis-0.19.0/doc/README.bug_report_mail --- mantis-0.19.0.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/doc/README.bug_report_mail Wed Sep 15 19:01:55 2004 @@ -0,0 +1,58 @@ +The current version of bug_report_mail only support plain text e-mails +and POP3 Mailaccounts with PEAR's Net_POP3 packge. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/user_api.php + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + sql/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php + +This line uses lynx to fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same condition as Mantis itself. + +Gerrit Beine, August 2004 diff -Nru mantis-0.19.0.orig/manage_proj_cat_edit_page.php mantis-0.19.0/manage_proj_cat_edit_page.php --- mantis-0.19.0.orig/manage_proj_cat_edit_page.php Mon Apr 12 23:04:34 2004 +++ mantis-0.19.0/manage_proj_cat_edit_page.php Wed Sep 15 18:26:32 2004 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,12 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + print_r($t_category_mail); + } + ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -83,5 +90,60 @@ <input type="submit" class="button" value="<?php echo lang_get( 'delete_category_button' ) ?>" /> </form> </div> + +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_cat_mail_delete.php mantis-0.19.0/manage_proj_cat_mail_delete.php --- mantis-0.19.0.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_cat_mail_delete.php Wed Sep 15 18:26:08 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_cat_mail_update.php mantis-0.19.0/manage_proj_cat_mail_update.php --- mantis-0.19.0.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_cat_mail_update.php Wed Sep 15 18:14:39 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_edit_page.php mantis-0.19.0/manage_proj_edit_page.php --- mantis-0.19.0.orig/manage_proj_edit_page.php Thu Jul 15 00:16:34 2004 +++ mantis-0.19.0/manage_proj_edit_page.php Wed Sep 15 18:27:49 2004 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,8 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); + ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -534,4 +537,74 @@ </table> </div> +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_categories.php mantis-0.19.0/manage_proj_mail_categories.php --- mantis-0.19.0.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_categories.php Wed Sep 15 18:03:32 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_delete.php mantis-0.19.0/manage_proj_mail_delete.php --- mantis-0.19.0.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_delete.php Wed Sep 15 17:50:34 2004 @@ -0,0 +1,42 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/manage_proj_mail_update.php mantis-0.19.0/manage_proj_mail_update.php --- mantis-0.19.0.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/manage_proj_mail_update.php Wed Sep 15 17:50:31 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nru mantis-0.19.0.orig/sql/bug_report_mail.sql mantis-0.19.0/sql/bug_report_mail.sql --- mantis-0.19.0.orig/sql/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-0.19.0/sql/bug_report_mail.sql Wed Sep 15 18:13:15 2004 @@ -0,0 +1,12 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + + diff -Nru mantis-0.19.0.orig/sql/db_generate.sql mantis-0.19.0/sql/db_generate.sql --- mantis-0.19.0.orig/sql/db_generate.sql Sun Sep 12 14:19:24 2004 +++ mantis-0.19.0/sql/db_generate.sql Wed Sep 15 18:30:43 2004 @@ -328,6 +328,10 @@ project_id int(7) unsigned NOT NULL default '0', category varchar(64) NOT NULL default '', user_id int(7) unsigned NOT NULL default '0', + pop3_host varchar( 255 ) default NULL , + pop3_user varchar( 255 ) default NULL , + pop3_pass varchar( 255 ) default NULL , + pop3_pass varchar( 255 ) default NULL , PRIMARY KEY (project_id,category) ) TYPE=MyISAM; @@ -377,6 +381,11 @@ access_min int(2) NOT NULL default '10', file_path varchar(250) NOT NULL default '', description text NOT NULL, + pop3_host varchar( 255 ) default NULL , + pop3_user varchar( 255 ) default NULL , + pop3_pass varchar( 255 ) default NULL , + pop3_pass varchar( 255 ) default NULL , + pop3_categories enum( '0','1' ) NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY name (name), KEY id (id) mantis-0.19.1.patch (29,263 bytes)
diff -Nur mantis-0.19.1.orig/bug_report_mail.php mantis-0.19.1/bug_report_mail.php --- mantis-0.19.1.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/bug_report_mail.php Wed Sep 15 18:59:59 2004 @@ -0,0 +1,33 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-0.19.1.orig/config_defaults_inc.php mantis-0.19.1/config_defaults_inc.php --- mantis-0.19.1.orig/config_defaults_inc.php Sat Nov 6 12:54:14 2004 +++ mantis-0.19.1/config_defaults_inc.php Sat Nov 6 19:59:13 2004 @@ -1470,4 +1470,20 @@ # NOTE: These are meaningless under Windows! Just ignore them! $g_dot_tool = '/usr/bin/dot'; $g_neato_tool = '/usr/bin/neato'; + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; ?> diff -Nur mantis-0.19.1.orig/core/category_api.php mantis-0.19.1/core/category_api.php --- mantis-0.19.1.orig/core/category_api.php Thu Apr 8 21:04:52 2004 +++ mantis-0.19.1/core/category_api.php Sat Nov 6 19:41:45 2004 @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; diff -Nur mantis-0.19.1.orig/core/mail_api.php mantis-0.19.1/core/mail_api.php --- mantis-0.19.1.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/core/mail_api.php Sat Nov 6 18:27:31 2004 @@ -0,0 +1,341 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the Mail per Category feature for a project + function mail_categories( $p_project_id , $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$c_project_id' AND category='$c_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + $c_pop3_host = db_prepare_string( $p_pop3_host ); + $c_pop3_user = db_prepare_string( $p_pop3_user ); + $c_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$c_pop3_host', + pop3_user='$c_pop3_user', + pop3_pass='$c_pop3_pass' + WHERE project_id='$c_project_id' AND category='$c_category'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$c_project_id' AND category='$c_category'"; + + db_query( $query ); + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + for ($i = 1; $i <= $t_pop3->numMsg(); $i++) { + $t_mail = $t_pop3->getParsedHeaders($i); + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + $t_mail['X-Mantis-Complete'] = $t_pop3->getMsg($i); + array_push($v_mails, $t_mail); + $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $c_mailaddress = $matches[1]; + } + + return $c_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ($p_mail_subject) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject) { + preg_match("/\[([A-Za-z0-9-_\.]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $c_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $c_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $c_mailaddress ); + user_signup($t_user_name, $c_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + return $t_reporter_id; + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug( $p_mail, $p_account ) { + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + $t_bug_data->description = $p_mail['X-Mantis-Body']; + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if (mail_is_a_bugnote($p_mail['Subject'])) + { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } + else + { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + + } + +?> diff -Nur mantis-0.19.1.orig/core/user_api.php mantis-0.19.1/core/user_api.php --- mantis-0.19.1.orig/core/user_api.php Mon Aug 23 17:13:34 2004 +++ mantis-0.19.1/core/user_api.php Sat Nov 6 19:43:10 2004 @@ -477,6 +477,27 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + + $c_mailaddress = db_prepare_string( $p_mailaddress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + + # -------------------- # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-0.19.1.orig/manage_proj_cat_edit_page.php mantis-0.19.1/manage_proj_cat_edit_page.php --- mantis-0.19.1.orig/manage_proj_cat_edit_page.php Tue Apr 13 00:04:34 2004 +++ mantis-0.19.1/manage_proj_cat_edit_page.php Sat Nov 6 19:55:07 2004 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -83,5 +88,60 @@ <input type="submit" class="button" value="<?php echo lang_get( 'delete_category_button' ) ?>" /> </form> </div> + +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_cat_mail_delete.php mantis-0.19.1/manage_proj_cat_mail_delete.php --- mantis-0.19.1.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_cat_mail_delete.php Wed Sep 15 18:26:08 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_cat_mail_update.php mantis-0.19.1/manage_proj_cat_mail_update.php --- mantis-0.19.1.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_cat_mail_update.php Wed Sep 15 18:14:39 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_edit_page.php mantis-0.19.1/manage_proj_edit_page.php --- mantis-0.19.1.orig/manage_proj_edit_page.php Wed Sep 22 13:15:32 2004 +++ mantis-0.19.1/manage_proj_edit_page.php Sat Nov 6 19:54:10 2004 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -551,4 +553,74 @@ </table> </div> +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_mail_categories.php mantis-0.19.1/manage_proj_mail_categories.php --- mantis-0.19.1.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_mail_categories.php Wed Sep 15 18:03:32 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_mail_delete.php mantis-0.19.1/manage_proj_mail_delete.php --- mantis-0.19.1.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_mail_delete.php Wed Sep 15 17:50:34 2004 @@ -0,0 +1,42 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_mail_update.php mantis-0.19.1/manage_proj_mail_update.php --- mantis-0.19.1.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_mail_update.php Wed Sep 15 17:50:31 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> mantis-0.19.1-mime.patch (38,514 bytes)
diff -Nur mantis-0.19.1.orig/bug_report_mail.php mantis-0.19.1/bug_report_mail.php --- mantis-0.19.1.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/bug_report_mail.php Sun Nov 21 18:19:31 2004 @@ -0,0 +1,33 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + $GLOBALS['g_cache_current_user_id'] = mail_get_user( $t_mail['From'] ); + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-0.19.1.orig/config_defaults_inc.php mantis-0.19.1/config_defaults_inc.php --- mantis-0.19.1.orig/config_defaults_inc.php Sat Nov 6 12:54:14 2004 +++ mantis-0.19.1/config_defaults_inc.php Sat Nov 6 19:59:13 2004 @@ -1470,4 +1470,20 @@ # NOTE: These are meaningless under Windows! Just ignore them! $g_dot_tool = '/usr/bin/dot'; $g_neato_tool = '/usr/bin/neato'; + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; ?> diff -Nur mantis-0.19.1.orig/config_inc.php mantis-0.19.1/config_inc.php --- mantis-0.19.1.orig/config_inc.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/config_inc.php Sun Sep 12 15:23:34 2004 @@ -0,0 +1,52 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id: config_inc.php.sample,v 1.14 2004/09/12 12:23:35 vboctor Exp $ + # -------------------------------------------------------- + + # This sample file contains the essential files that you MUST + # configure to your specific settings. You may override settings + # from config_defaults_inc.php by assigning new values in this file + + # Rename this file to config_inc.php after configuration. + + ########################################################################### + # CONFIGURATION VARIABLES + ########################################################################### + + # In general the value OFF means the feature is disabled and ON means the + # feature is enabled. Any other cases will have an explanation. + + # Look in http://www.mantisbt.org/manual or config_defaults_inc.php for more + # detailed comments. + + # --- database variables --------- + + # set these values to match your setup + $g_hostname = "localhost"; + $g_db_username = "root"; + $g_db_password = ""; + $g_database_name = "bugtracker"; + + # --- email variables ------------- + $g_administrator_email = 'administrator@example.com'; + $g_webmaster_email = 'webmaster@example.com'; + + # the "From: " field in emails + $g_from_email = 'noreply@example.com'; + + # the return address for bounced mail + $g_return_path_email = 'admin@example.com'; + + # --- file upload settings -------- + # This is the master setting to disable *all* file uploading functionality + # + # The default value is ON but you must make sure file uploading is enabled + # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini. + $g_allow_file_upload = ON; +?> \ No newline at end of file diff -Nur mantis-0.19.1.orig/core/category_api.php mantis-0.19.1/core/category_api.php --- mantis-0.19.1.orig/core/category_api.php Thu Apr 8 21:04:52 2004 +++ mantis-0.19.1/core/category_api.php Sat Nov 6 19:41:45 2004 @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; diff -Nur mantis-0.19.1.orig/core/mail_api.php mantis-0.19.1/core/mail_api.php --- mantis-0.19.1.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/core/mail_api.php Sun Nov 21 18:39:10 2004 @@ -0,0 +1,409 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + require_once( $t_core_dir . 'file_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + require_once( 'Mail/mimeDecode.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the Mail per Category feature for a project + function mail_categories( $p_project_id , $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$c_project_id' AND category='$c_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + $c_pop3_host = db_prepare_string( $p_pop3_host ); + $c_pop3_user = db_prepare_string( $p_pop3_user ); + $c_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$c_pop3_host', + pop3_user='$c_pop3_user', + pop3_pass='$c_pop3_pass' + WHERE project_id='$c_project_id' AND category='$c_category'"; + db_query( $query ); + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $c_project_id = db_prepare_int( $p_project_id ); + $c_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$c_project_id' AND category='$c_category'"; + + db_query( $query ); + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + for ($i = 1; $i <= $t_pop3->numMsg(); $i++) { + $t_mail = mail_parse_content( $t_pop3->getMsg($i) ); + array_push($v_mails, $t_mail); +# $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_content ( $p_mail ) { + $t_mail = array (); + $t_decoder = new Mail_mimeDecode($p_mail); + $t_params['include_bodies'] = true; + $t_params['decode_bodies'] = true; + $t_params['decode_headers'] = true; + $t_structure = $t_decoder->decode($t_params); + $t_mail['To'] = $t_structure->headers['to']; + $t_mail['From'] = $t_structure->headers['from']; + $t_mail['Subject'] = $t_structure->headers['subject']; + if (is_array($t_structure->parts)) + { + $t_parts = mail_parse_parts( $t_structure->parts ); + } + else + { + $t_parts = array ( mail_parse_part( $t_structure ) ); + } + if ($t_parts[0]['Content-Type'] == 'text/plain') { + $t_body = array_shift($t_parts); + } + else + { + $t_body['Body'] = "It seems, there is no text... :-o"; + } + $t_mail['X-Mantis-Parts'] = $t_parts; + $t_mail['X-Mantis-Body'] = $t_body['Body']; + $t_mail['X-Mantis-Complete'] = $p_mail; + + return $t_mail; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_parts ( $p_parts ) { + $t_parts = array (); + foreach ( $p_parts as $t_part ) { + array_push($t_parts, mail_parse_part( $t_part )); + } + + return $t_parts; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_part ( $p_part ) { + $t_part = array (); + $t_part['Content-Type'] = $p_part->ctype_primary."/".$p_part->ctype_secondary; + $t_part['Name'] = $p_part->ctype_parameters['name']; + $t_part['Body'] = $p_part->body; + + return $t_part; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $c_mailaddress = $matches[1]; + } + + return $c_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ($p_mail_subject) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject) { + preg_match("/\[([A-Za-z0-9-_\.]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $c_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $c_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $c_mailaddress ); + user_signup($t_user_name, $c_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + return $t_reporter_id; + } + + # -------------------- + # Adds a file to a bug. Very dirty + function mail_add_file( $p_bug_id, $p_part ) { + $GLOBALS['_mail_file_'] = $p_part['Name']; + $t_file_name = '/tmp/'.$p_part['Name']; + file_put_contents($t_file_name, $p_part['Body']); + file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug'); + unlink($t_file_name); + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug( $p_mail, $p_account ) { + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + $t_bug_data->description = $p_mail['X-Mantis-Body']; + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if (mail_is_a_bugnote($p_mail['Subject'])) + { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } + else + { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + # Add files + foreach ($p_mail['X-Mantis-Parts'] as $part) { + mail_add_file ( $t_bug_id, $part ); + } + + } + +?> diff -Nur mantis-0.19.1.orig/core/user_api.php mantis-0.19.1/core/user_api.php --- mantis-0.19.1.orig/core/user_api.php Mon Aug 23 17:13:34 2004 +++ mantis-0.19.1/core/user_api.php Sat Nov 6 19:43:10 2004 @@ -477,6 +477,27 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + + $c_mailaddress = db_prepare_string( $p_mailaddress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + + # -------------------- # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-0.19.1.orig/doc/README.bug_report_mail mantis-0.19.1/doc/README.bug_report_mail --- mantis-0.19.1.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/doc/README.bug_report_mail Sun Nov 21 18:46:44 2004 @@ -0,0 +1,58 @@ +The current version of bug_report_mail only support plain text e-mails +and POP3 Mailaccounts with PEAR's Net_POP3 packge. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/user_api.php + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + sql/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php + +This line uses lynx to fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same condition as Mantis itself. + +Gerrit Beine, August 2004 diff -Nur mantis-0.19.1.orig/manage_proj_cat_edit_page.php mantis-0.19.1/manage_proj_cat_edit_page.php --- mantis-0.19.1.orig/manage_proj_cat_edit_page.php Tue Apr 13 00:04:34 2004 +++ mantis-0.19.1/manage_proj_cat_edit_page.php Sat Nov 6 19:55:07 2004 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -83,5 +88,60 @@ <input type="submit" class="button" value="<?php echo lang_get( 'delete_category_button' ) ?>" /> </form> </div> + +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_cat_mail_delete.php mantis-0.19.1/manage_proj_cat_mail_delete.php --- mantis-0.19.1.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_cat_mail_delete.php Wed Sep 15 18:26:08 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_cat_mail_update.php mantis-0.19.1/manage_proj_cat_mail_update.php --- mantis-0.19.1.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_cat_mail_update.php Wed Sep 15 18:14:39 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_edit_page.php mantis-0.19.1/manage_proj_edit_page.php --- mantis-0.19.1.orig/manage_proj_edit_page.php Wed Sep 22 13:15:32 2004 +++ mantis-0.19.1/manage_proj_edit_page.php Sat Nov 6 19:54:10 2004 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -551,4 +553,74 @@ </table> </div> +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_mail_categories.php mantis-0.19.1/manage_proj_mail_categories.php --- mantis-0.19.1.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_mail_categories.php Wed Sep 15 18:03:32 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_mail_delete.php mantis-0.19.1/manage_proj_mail_delete.php --- mantis-0.19.1.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_mail_delete.php Wed Sep 15 17:50:34 2004 @@ -0,0 +1,42 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/manage_proj_mail_update.php mantis-0.19.1/manage_proj_mail_update.php --- mantis-0.19.1.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/manage_proj_mail_update.php Wed Sep 15 17:50:31 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.1.orig/sql/bug_report_mail.sql mantis-0.19.1/sql/bug_report_mail.sql --- mantis-0.19.1.orig/sql/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-0.19.1/sql/bug_report_mail.sql Sun Nov 21 18:45:09 2004 @@ -0,0 +1,11 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + diff -Nur mantis-0.19.1.orig/sql/db_generate.sql mantis-0.19.1/sql/db_generate.sql --- mantis-0.19.1.orig/sql/db_generate.sql Sat Nov 6 13:07:30 2004 +++ mantis-0.19.1/sql/db_generate.sql Sun Nov 21 18:43:25 2004 @@ -330,6 +330,9 @@ project_id int(7) unsigned NOT NULL default '0', category varchar(64) NOT NULL default '', user_id int(7) unsigned NOT NULL default '0', + pop3_host varchar( 255 ) default NULL, + pop3_user varchar( 255 ) default NULL, + pop3_pass varchar( 255 ) default NULL, PRIMARY KEY (project_id,category) ) TYPE=MyISAM; @@ -379,6 +382,10 @@ access_min int(2) NOT NULL default '10', file_path varchar(250) NOT NULL default '', description text NOT NULL, + pop3_host varchar( 255 ) default NULL, + pop3_user varchar( 255 ) default NULL, + pop3_pass varchar( 255 ) default NULL, + pop3_cateories enum( '0', '1' ) NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY name (name), KEY id (id) mantis-0.19.2.patch (39,297 bytes)
diff -Nur mantis-0.19.2.orig/bug_report_mail.php mantis-0.19.2/bug_report_mail.php --- mantis-0.19.2.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/bug_report_mail.php Tue Dec 21 17:45:44 2004 @@ -0,0 +1,33 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + $GLOBALS['g_cache_current_user_id'] = mail_get_user( $t_mail['From'] ); + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-0.19.2.orig/config_defaults_inc.php mantis-0.19.2/config_defaults_inc.php --- mantis-0.19.2.orig/config_defaults_inc.php Sat Dec 11 08:21:52 2004 +++ mantis-0.19.2/config_defaults_inc.php Sat Dec 25 14:54:13 2004 @@ -1474,4 +1474,30 @@ # NOTE: These are meaningless under Windows! Just ignore them! $g_dot_tool = '/usr/bin/dot'; $g_neato_tool = '/usr/bin/neato'; -?> \ No newline at end of file + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; + + # Write complete mail into the "Additional Information" + $g_mail_additional = OFF; + + # Parse MIME mails (may require a lot of memory) + $g_mail_parse_mime = OFF; + + # How many mails should be fetched at the same time + # If big mails with attachments should be received, specify only one + $g_mail_fetch_max = 1; +?> diff -Nur mantis-0.19.2.orig/core/category_api.php mantis-0.19.2/core/category_api.php --- mantis-0.19.2.orig/core/category_api.php Thu Apr 8 20:04:54 2004 +++ mantis-0.19.2/core/category_api.php Tue Dec 21 17:45:44 2004 @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; @@ -221,4 +221,4 @@ return $rows; } -?> \ No newline at end of file +?> diff -Nur mantis-0.19.2.orig/core/file_api.php mantis-0.19.2/core/file_api.php --- mantis-0.19.2.orig/core/file_api.php Sun Oct 17 03:58:58 2004 +++ mantis-0.19.2/core/file_api.php Tue Dec 21 17:45:44 2004 @@ -509,7 +509,7 @@ trigger_error( ERROR_DUPLICATE_FILE, ERROR ); } - if ( is_uploaded_file( $p_tmp_file ) ) { + if ( is_uploaded_file( $p_tmp_file ) || $GLOBALS['_mail_file_'] == $p_file_name ) { if ( 'bug' == $p_table ) { $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); $t_bug_id = bug_format_id( $p_bug_id ); diff -Nur mantis-0.19.2.orig/core/mail_api.php mantis-0.19.2/core/mail_api.php --- mantis-0.19.2.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/core/mail_api.php Sat Dec 25 14:48:34 2004 @@ -0,0 +1,435 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + require_once( $t_core_dir . 'file_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + require_once( 'Mail/mimeDecode.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a project + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data from a project + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the 'Mail per Category' feature for a project + function mail_categories( $p_project_id, $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$v_project_id' AND category='$v_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all categories from a project with valid data for mail access + # return an empty array if there are no such categories + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $t_mail_parse_mime = config_get( 'mail_parse_mime' ); + $t_mail_fetch_max = config_get( 'mail_fetch_max' ); + $t_mail_additional = config_get( 'mail_additional' ); + + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + if (0 == $t_pop3->numMsg()) { + return $v_mails; + } + for ($i = 1; $i <= $t_mail_fetch_max; $i++) { + $t_headers = $t_pop3->getParsedHeaders($i); + $t_msg = $t_pop3->getMsg($i); + + if (true == $t_mail_parse_mime && + true == isset( $t_headers['MIME-Version'] ) ) { + $t_mail = mail_parse_content( $t_msg ); + } else { + $t_mail = $t_headers; + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + } + + if (true == $t_mail_additional) { + $t_mail['X-Mantis-Complete'] = $t_msg; + } + + array_push($v_mails, $t_mail); + $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_content ( $p_mail ) { + $v_mail = array (); + $t_decoder = new Mail_mimeDecode($p_mail); + $t_params['include_bodies'] = true; + $t_params['decode_bodies'] = true; + $t_params['decode_headers'] = true; + $t_structure = $t_decoder->decode($t_params); + $v_mail['To'] = $t_structure->headers['to']; + $v_mail['From'] = $t_structure->headers['from']; + $v_mail['Subject'] = $t_structure->headers['subject']; + if (is_array($t_structure->parts)) + { + $t_parts = mail_parse_parts( $t_structure->parts ); + } + else + { + $t_parts = array ( mail_parse_part( $t_structure ) ); + } + if ($t_parts[0]['Content-Type'] == 'text/plain') { + $t_body = array_shift($t_parts); + } + else + { + $t_body['Body'] = "It seems, there is no text... :-o"; + } + $v_mail['X-Mantis-Parts'] = $t_parts; + $v_mail['X-Mantis-Body'] = $t_body['Body']; + + return $v_mail; + } + + # -------------------- + # return the parsed parts from the mail + function mail_parse_parts ( $p_parts ) { + $v_parts = array (); + foreach ( $p_parts as $t_part ) { + array_push($v_parts, mail_parse_part( $t_part )); + } + + return $v_parts; + } + + # -------------------- + # return one parsed part + function mail_parse_part ( $p_part ) { + $v_part = array (); + $v_part['Content-Type'] = $p_part->ctype_primary."/".$p_part->ctype_secondary; + $v_part['Name'] = $p_part->ctype_parameters['name']; + $v_part['Body'] = $p_part->body; + + return $v_part; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $v_mailaddress = $matches[1]; + } + + return $v_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ( $p_mail_subject ) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject ) { + preg_match("/\[([A-Za-z0-9-_\.]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $v_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $v_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $v_mailaddress ); + user_signup($t_user_name, $v_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + // dirty: Set the identified user's id + // required if bug_report_mail is run via command line + $GLOBAL['g_cache_current_user_id'] = $t_reporter_id; + + return $t_reporter_id; + } + + # -------------------- + # Very dirty: Adds a file to a bug. + function mail_add_file( $p_bug_id, $p_part ) { + $GLOBALS['_mail_file_'] = $p_part['Name']; + $t_file_name = '/tmp/'.$p_part['Name']; + file_put_contents($t_file_name, $p_part['Body']); + file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug'); + unlink($t_file_name); + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug( $p_mail, $p_account ) { + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + $t_bug_data->description = $p_mail['X-Mantis-Body']; + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if (mail_is_a_bugnote($p_mail['Subject'])) { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } else { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + # Add files + foreach ($p_mail['X-Mantis-Parts'] as $part) { + mail_add_file ( $t_bug_id, $part ); + } + + } + +?> diff -Nur mantis-0.19.2.orig/core/user_api.php mantis-0.19.2/core/user_api.php --- mantis-0.19.2.orig/core/user_api.php Fri Nov 19 13:29:00 2004 +++ mantis-0.19.2/core/user_api.php Tue Dec 21 17:45:44 2004 @@ -477,6 +477,27 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + + $c_mailaddress = db_prepare_string( $p_mailaddress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + + # -------------------- # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-0.19.2.orig/doc/README.bug_report_mail mantis-0.19.2/doc/README.bug_report_mail --- mantis-0.19.2.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/doc/README.bug_report_mail Sun Dec 26 14:33:20 2004 @@ -0,0 +1,92 @@ +The current version of bug_report_mail support plain text and MIME +encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/file_api.php + core/user_api.php + sql/db_generate.sql + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + doc/README.bug_report_mail + sql/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +If you like to parse MIME encoded mails, you have to install the PEAR +Mail_Mime package and set + $g_mail_parse_mime = OFF; +from OFF to ON. + +For debugging controls there is the switch + $g_mail_additional = OFF; +which puts the complete message into the Additional Information field, +if it is activated. + +In this case you should decrease the amount of fetched messages via + $g_mail_fetch_max = 1; +because the mime decoding needs a lot of memory. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php +or via command line interface +*/5 * * * * /usr/local/bin/php /path/to/mantis/bug_report_mail.php + +This line fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same conditions as Mantis itself. + +Gerrit Beine, August 2004 + +Changelog: +Dec 2004: + - update to Mantis 0.19.2 + - add config: g_mail_parse_mime + - add config: g_mail_additional + - add config: g_mail_fetch_max + - make it working via CLI +Nov 2004: + - update to Mantis 0.19.1 + - add support for MIME decoding +Sep 2004: + - update to Mantis 0.19.0 +Aug 2004: + - create patch for Mantis 0.18.3 diff -Nur mantis-0.19.2.orig/manage_proj_cat_edit_page.php mantis-0.19.2/manage_proj_cat_edit_page.php --- mantis-0.19.2.orig/manage_proj_cat_edit_page.php Mon Apr 12 23:04:36 2004 +++ mantis-0.19.2/manage_proj_cat_edit_page.php Tue Dec 21 17:45:44 2004 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -83,5 +88,60 @@ <input type="submit" class="button" value="<?php echo lang_get( 'delete_category_button' ) ?>" /> </form> </div> + +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/manage_proj_cat_mail_delete.php mantis-0.19.2/manage_proj_cat_mail_delete.php --- mantis-0.19.2.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/manage_proj_cat_mail_delete.php Tue Dec 21 17:45:44 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/manage_proj_cat_mail_update.php mantis-0.19.2/manage_proj_cat_mail_update.php --- mantis-0.19.2.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/manage_proj_cat_mail_update.php Tue Dec 21 17:45:44 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/manage_proj_edit_page.php mantis-0.19.2/manage_proj_edit_page.php --- mantis-0.19.2.orig/manage_proj_edit_page.php Wed Sep 22 12:15:34 2004 +++ mantis-0.19.2/manage_proj_edit_page.php Tue Dec 21 17:45:44 2004 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -551,4 +553,74 @@ </table> </div> +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/manage_proj_mail_categories.php mantis-0.19.2/manage_proj_mail_categories.php --- mantis-0.19.2.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/manage_proj_mail_categories.php Tue Dec 21 17:45:44 2004 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/manage_proj_mail_delete.php mantis-0.19.2/manage_proj_mail_delete.php --- mantis-0.19.2.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/manage_proj_mail_delete.php Tue Dec 21 17:45:44 2004 @@ -0,0 +1,42 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/manage_proj_mail_update.php mantis-0.19.2/manage_proj_mail_update.php --- mantis-0.19.2.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/manage_proj_mail_update.php Tue Dec 21 17:45:44 2004 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.2.orig/sql/bug_report_mail.sql mantis-0.19.2/sql/bug_report_mail.sql --- mantis-0.19.2.orig/sql/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-0.19.2/sql/bug_report_mail.sql Sat Dec 25 17:05:41 2004 @@ -0,0 +1,11 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + diff -Nur mantis-0.19.2.orig/sql/db_generate.sql mantis-0.19.2/sql/db_generate.sql --- mantis-0.19.2.orig/sql/db_generate.sql Sat Nov 6 12:07:30 2004 +++ mantis-0.19.2/sql/db_generate.sql Sat Dec 25 17:05:18 2004 @@ -330,6 +330,9 @@ project_id int(7) unsigned NOT NULL default '0', category varchar(64) NOT NULL default '', user_id int(7) unsigned NOT NULL default '0', + pop3_host varchar( 255 ) default NULL, + pop3_user varchar( 255 ) default NULL, + pop3_pass varchar( 255 ) default NULL, PRIMARY KEY (project_id,category) ) TYPE=MyISAM; @@ -379,6 +382,10 @@ access_min int(2) NOT NULL default '10', file_path varchar(250) NOT NULL default '', description text NOT NULL, + pop3_host varchar( 255 ) default NULL, + pop3_user varchar( 255 ) default NULL, + pop3_pass varchar( 255 ) default NULL, + pop3_categories enum( '0', '1' ) NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY name (name), KEY id (id) @@ -881,3 +888,5 @@ # INSERT INTO mantis_user_table VALUES (1, 'administrator', '', 'admin', '63a9f0ea7bb98050796b649e85481845', '2003-02-16 02:03:48', '2004-07-08 23:59:22', 1, 1, 90, 3, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); +INSERT INTO mantis_user_table VALUES (2, 'Mail', 'Mail Reporter', 'nomail', 'a268462c3c679a9027658c5aa723f97c', '2004-12-25 15:41:49', '2004-12-25 15:41:49', 1, 0, 25, 0, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); + mantis-0.19.2-additional-fixes.patch (1,416 bytes)
diff -uNr mantis-0.19.2/core/mail_api.php mantis.new/core/mail_api.php --- mantis-0.19.2/core/mail_api.php 2005-02-12 14:02:17.591258328 +0100 +++ mantis.new/core/mail_api.php 2005-02-12 14:20:29.676236176 +0100 @@ -235,7 +235,8 @@ $t_msg = $t_pop3->getMsg($i); if (true == $t_mail_parse_mime && - true == isset( $t_headers['MIME-Version'] ) ) { + true == isset( $t_headers['MIME-Version'] ) && + 'multipart' == strtolower(substr($t_headers['Content-Type'],0,9) ) ) { $t_mail = mail_parse_content( $t_msg ); } else { $t_mail = $t_headers; @@ -274,7 +275,7 @@ { $t_parts = array ( mail_parse_part( $t_structure ) ); } - if ($t_parts[0]['Content-Type'] == 'text/plain') { + if (strtolower($t_parts[0]['Content-Type']) == 'text/plain') { $t_body = array_shift($t_parts); } else @@ -405,7 +406,7 @@ $t_bug_data->severity = 50; $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); $t_bug_data->summary = $p_mail['Subject']; - $t_bug_data->description = $p_mail['X-Mantis-Body']; + $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body']; $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; mantis-1.0.0rc1.patch (44,881 bytes)
diff -Nur mantis-1.0.0rc1/admin/bug_report_mail.sql mantis/admin/bug_report_mail.sql --- mantis-1.0.0rc1/admin/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis/admin/bug_report_mail.sql Sun Aug 7 10:48:26 2005 @@ -0,0 +1,11 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + diff -Nur mantis-1.0.0rc1/admin/schema.php mantis/admin/schema.php --- mantis-1.0.0rc1/admin/schema.php Wed Jul 6 01:48:48 2005 +++ mantis/admin/schema.php Sun Aug 7 10:55:13 2005 @@ -192,7 +192,10 @@ $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_category_table')," project_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', category C(64) NOTNULL PRIMARY DEFAULT \" '' \", - user_id I UNSIGNED NOTNULL DEFAULT '0' + user_id I UNSIGNED NOTNULL DEFAULT '0', + pop3_host C( 255 ) NULL, + pop3_user C( 255 ) NULL, + pop3_pass C( 255 ) NULL ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS'))); $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_file_table')," @@ -222,7 +225,11 @@ view_state I2 NOTNULL DEFAULT '10', access_min I2 NOTNULL DEFAULT '10', file_path C(250) NOTNULL DEFAULT \" '' \", - description XS NOTNULL + description XS NOTNULL, + pop3_host C( 255 ) NULL, + pop3_user C( 255 ) NULL, + pop3_pass C( 255 ) NULL, + pop3_categories L NOTNULL DEFAULT '0' ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS'))); $upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',config_get('mantis_project_table'),'id')); $upgrade[] = Array('CreateIndexSQL',Array('idx_project_name',config_get('mantis_project_table'),'name',Array('UNIQUE'))); diff -Nur mantis-1.0.0rc1/bug_report_mail.php mantis/bug_report_mail.php --- mantis-1.0.0rc1/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis/bug_report_mail.php Sun Aug 7 10:13:09 2005 @@ -0,0 +1,33 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + $GLOBALS['g_cache_current_user_id'] = mail_get_user( $t_mail['From'] ); + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-1.0.0rc1/config_defaults_inc.php mantis/config_defaults_inc.php --- mantis-1.0.0rc1/config_defaults_inc.php Sat Jul 23 01:37:06 2005 +++ mantis/config_defaults_inc.php Sun Aug 7 10:14:42 2005 @@ -1611,4 +1611,33 @@ # ) # ); $g_custom_group_actions = array(); + + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; + + # Write complete mail into the "Additional Information" + $g_mail_additional = OFF; + + # Parse MIME mails (may require a lot of memory) + $g_mail_parse_mime = OFF; + + # How many mails should be fetched at the same time + # If big mails with attachments should be received, specify only one + $g_mail_fetch_max = 1; + ?> + diff -Nur mantis-1.0.0rc1/config_inc.php mantis/config_inc.php --- mantis-1.0.0rc1/config_inc.php Thu Jan 1 01:00:00 1970 +++ mantis/config_inc.php Fri Apr 29 15:24:10 2005 @@ -0,0 +1,53 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2005 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id: config_inc.php.sample,v 1.16 2005/04/29 13:24:10 vboctor Exp $ + # -------------------------------------------------------- + + # This sample file contains the essential files that you MUST + # configure to your specific settings. You may override settings + # from config_defaults_inc.php by assigning new values in this file + + # Rename this file to config_inc.php after configuration. + + ########################################################################### + # CONFIGURATION VARIABLES + ########################################################################### + + # In general the value OFF means the feature is disabled and ON means the + # feature is enabled. Any other cases will have an explanation. + + # Look in http://manual.mantisbt.org/ or config_defaults_inc.php for more + # detailed comments. + + # --- database variables --------- + + # set these values to match your setup + $g_hostname = "localhost"; + $g_db_username = "root"; + $g_db_password = ""; + $g_database_name = "bugtracker"; + $g_db_type = "mysql"; + + # --- email variables ------------- + $g_administrator_email = 'administrator@example.com'; + $g_webmaster_email = 'webmaster@example.com'; + + # the "From: " field in emails + $g_from_email = 'noreply@example.com'; + + # the return address for bounced mail + $g_return_path_email = 'admin@example.com'; + + # --- file upload settings -------- + # This is the master setting to disable *all* file uploading functionality + # + # The default value is ON but you must make sure file uploading is enabled + # in PHP as well. You may need to add "file_uploads = TRUE" to your php.ini. + $g_allow_file_upload = ON; +?> \ No newline at end of file diff -Nur mantis-1.0.0rc1/core/category_api.php mantis/core/category_api.php --- mantis-1.0.0rc1/core/category_api.php Sat Feb 12 21:01:10 2005 +++ mantis/core/category_api.php Sun Aug 7 10:05:49 2005 @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; diff -Nur mantis-1.0.0rc1/core/mail_api.php mantis/core/mail_api.php --- mantis-1.0.0rc1/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis/core/mail_api.php Sun Aug 7 11:11:44 2005 @@ -0,0 +1,441 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + require_once( $t_core_dir . 'file_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + require_once( 'Mail/mimeDecode.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a project + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data from a project + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the 'Mail per Category' feature for a project + function mail_categories( $p_project_id, $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$v_project_id' AND category='$v_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all categories from a project with valid data for mail access + # return an empty array if there are no such categories + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $t_mail_parse_mime = config_get( 'mail_parse_mime' ); + $t_mail_fetch_max = config_get( 'mail_fetch_max' ); + $t_mail_additional = config_get( 'mail_additional' ); + + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + if (0 == $t_pop3->numMsg()) { + return $v_mails; + } + for ($i = 1; $i <= $t_mail_fetch_max; $i++) { + $t_headers = $t_pop3->getParsedHeaders($i); + $t_msg = $t_pop3->getMsg($i); + + if (true == $t_mail_parse_mime && + true == isset( $t_headers['MIME-Version'] ) && + 'multipart' == strtolower(substr($t_headers['Content-type'],0,9) ) ) { + $t_mail = mail_parse_content( $t_msg ); + } else { + $t_mail = $t_headers; + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + } + + if (true == $t_mail_additional) { + $t_mail['X-Mantis-Complete'] = $t_msg; + } + + array_push($v_mails, $t_mail); + $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_content ( $p_mail ) { + $v_mail = array (); + $t_decoder = new Mail_mimeDecode($p_mail); + $t_params['include_bodies'] = true; + $t_params['decode_bodies'] = true; + $t_params['decode_headers'] = true; + $t_structure = $t_decoder->decode($t_params); + $v_mail['To'] = $t_structure->headers['to']; + $v_mail['From'] = $t_structure->headers['from']; + $v_mail['Subject'] = $t_structure->headers['subject']; + if (is_array($t_structure->parts)) + { + $t_parts = mail_parse_parts( $t_structure->parts ); + } + else + { + $t_parts = array ( mail_parse_part( $t_structure ) ); + } + if (strtolower($t_parts[0]['Content-Type']) == 'text/plain' || + strtolower($t_parts[0]['Content-Type']) == 'text/html' ) { + # $t_body = array_shift($t_parts); + $t_body['Body'] = $t_parts[0]['Body']; + } + else + { + $t_body['Body'] = "It seems, there is no text... :-o"; + } + $v_mail['X-Mantis-Parts'] = $t_parts; + $v_mail['X-Mantis-Body'] = $t_body['Body']; + + return $v_mail; + } + + # -------------------- + # return the parsed parts from the mail + function mail_parse_parts ( $p_parts ) { + $v_parts = array (); + foreach ( $p_parts as $t_part ) { + array_push($v_parts, mail_parse_part( $t_part )); + } + + return $v_parts; + } + + # -------------------- + # return one parsed part + function mail_parse_part ( $p_part ) { + $v_part = array (); + $v_part['Content-Type'] = $p_part->ctype_primary."/".$p_part->ctype_secondary; + $v_part['Name'] = $p_part->ctype_parameters['name']; + $v_part['Body'] = $p_part->body; + + return $v_part; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $v_mailaddress = $matches[1]; + } + + return $v_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ( $p_mail_subject ) { + return preg_match("/\[([A-Za-z0-9-_\.]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject ) { + preg_match("/\[([A-Za-z0-9-_\. ]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $v_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $v_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $v_mailaddress ); + user_signup($t_user_name, $v_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + // dirty: Set the identified user's id + // required if bug_report_mail is run via command line + $GLOBAL['g_cache_current_user_id'] = $t_reporter_id; + + return $t_reporter_id; + } + + # -------------------- + # Very dirty: Adds a file to a bug. + function mail_add_file( $p_bug_id, $p_part ) { + $GLOBALS['_mail_file_'] = $p_part['Name']; + if ( 0 < strlen($p_part['Name']) ) { + $t_file_name = '/tmp/'.$p_part['Name']; + file_put_contents($t_file_name, $p_part['Body']); + file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug'); + unlink($t_file_name); + } + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug ( $p_mail, $p_account ) { + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body']; + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if (mail_is_a_bugnote($p_mail['Subject'])) { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } else { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + # Add files + foreach ($p_mail['X-Mantis-Parts'] as $part) { + mail_add_file ( $t_bug_id, $part ); + } + + } + +?> + diff -Nur mantis-1.0.0rc1/core/user_api.php mantis/core/user_api.php --- mantis-1.0.0rc1/core/user_api.php Fri Jul 22 17:34:02 2005 +++ mantis/core/user_api.php Sun Aug 7 10:09:36 2005 @@ -526,6 +526,26 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + + $c_mailaddress = db_prepare_string( $p_mailaddress ); + + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-1.0.0rc1/doc/README.bug_report_mail mantis/doc/README.bug_report_mail --- mantis-1.0.0rc1/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis/doc/README.bug_report_mail Sun Aug 7 11:13:18 2005 @@ -0,0 +1,104 @@ +The current version of bug_report_mail support plain text and MIME +encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/file_api.php + core/user_api.php + admin/schema.php + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + doc/README.bug_report_mail + admin/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +If you like to parse MIME encoded mails, you have to install the PEAR +Mail_Mime package and set + $g_mail_parse_mime = OFF; +from OFF to ON. + +For debugging controls there is the switch + $g_mail_additional = OFF; +which puts the complete message into the Additional Information field, +if it is activated. + +In this case you should decrease the amount of fetched messages via + $g_mail_fetch_max = 1; +because the mime decoding needs a lot of memory. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php +or via command line interface +*/5 * * * * /usr/local/bin/php /path/to/mantis/bug_report_mail.php + +This line fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same conditions as Mantis itself. + +Gerrit Beine, August 2004 + +Changelog: +Aug 2005: + - update to Mantis 1.0.0rc1 + - include the additional patches submitted by + - gernot (Fixed MIME handling and save the mail's sender) + mail_get_all_mails in core/mail_api.php + mail_parse_content in core/mail_api.php + mail_add_bug in core/mail_api.php + - stevenc (Fixed MIME handling) + mail_parse_content in core/mail_api.php + - rainman (Fixed empty files bug and regex for finding a bug id) + mail_add_file in core/mail_api.php + mail_get_bug_id_from_subject in core/mail_api.php +Dec 2004: + - update to Mantis 0.19.2 + - add config: g_mail_parse_mime + - add config: g_mail_additional + - add config: g_mail_fetch_max + - make it working via CLI +Nov 2004: + - update to Mantis 0.19.1 + - add support for MIME decoding +Sep 2004: + - update to Mantis 0.19.0 +Aug 2004: + - create patch for Mantis 0.18.3 diff -Nur mantis-1.0.0rc1/doc/README.bug_report_mail~ mantis/doc/README.bug_report_mail~ --- mantis-1.0.0rc1/doc/README.bug_report_mail~ Thu Jan 1 01:00:00 1970 +++ mantis/doc/README.bug_report_mail~ Sun Aug 7 10:20:58 2005 @@ -0,0 +1,98 @@ +The current version of bug_report_mail support plain text and MIME +encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/file_api.php + core/user_api.php + sql/db_generate.sql + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + doc/README.bug_report_mail + sql/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +If you like to parse MIME encoded mails, you have to install the PEAR +Mail_Mime package and set + $g_mail_parse_mime = OFF; +from OFF to ON. + +For debugging controls there is the switch + $g_mail_additional = OFF; +which puts the complete message into the Additional Information field, +if it is activated. + +In this case you should decrease the amount of fetched messages via + $g_mail_fetch_max = 1; +because the mime decoding needs a lot of memory. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php +or via command line interface +*/5 * * * * /usr/local/bin/php /path/to/mantis/bug_report_mail.php + +This line fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same conditions as Mantis itself. + +Gerrit Beine, August 2004 + +Changelog: +Aug 2005: + - update to Mantis 1.0.0rc1 + - include the additional patches submitted by + - gernot + - stevenc + - rainman +Dec 2004: + - update to Mantis 0.19.2 + - add config: g_mail_parse_mime + - add config: g_mail_additional + - add config: g_mail_fetch_max + - make it working via CLI +Nov 2004: + - update to Mantis 0.19.1 + - add support for MIME decoding +Sep 2004: + - update to Mantis 0.19.0 +Aug 2004: + - create patch for Mantis 0.18.3 diff -Nur mantis-1.0.0rc1/manage_proj_cat_edit_page.php mantis/manage_proj_cat_edit_page.php --- mantis-1.0.0rc1/manage_proj_cat_edit_page.php Sat Feb 12 21:01:06 2005 +++ mantis/manage_proj_cat_edit_page.php Sun Aug 7 10:23:56 2005 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -84,4 +89,59 @@ </form> </div> +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> + <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-1.0.0rc1/manage_proj_cat_mail_delete.php mantis/manage_proj_cat_mail_delete.php --- mantis-1.0.0rc1/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_cat_mail_delete.php Sun Aug 7 10:24:56 2005 @@ -0,0 +1,44 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc1/manage_proj_cat_mail_update.php mantis/manage_proj_cat_mail_update.php --- mantis-1.0.0rc1/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_cat_mail_update.php Sun Aug 7 10:25:59 2005 @@ -0,0 +1,59 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc1/manage_proj_edit_page.php mantis/manage_proj_edit_page.php --- mantis-1.0.0rc1/manage_proj_edit_page.php Tue Jul 19 15:42:48 2005 +++ mantis/manage_proj_edit_page.php Sun Aug 7 10:41:35 2005 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -690,4 +692,76 @@ </table> </div> +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> + <?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc1/manage_proj_mail_categories.php mantis/manage_proj_mail_categories.php --- mantis-1.0.0rc1/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_mail_categories.php Sun Aug 7 10:30:02 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc1/manage_proj_mail_delete.php mantis/manage_proj_mail_delete.php --- mantis-1.0.0rc1/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_mail_delete.php Sun Aug 7 10:31:01 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc1/manage_proj_mail_update.php mantis/manage_proj_mail_update.php --- mantis-1.0.0rc1/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis/manage_proj_mail_update.php Sun Aug 7 10:32:15 2005 @@ -0,0 +1,59 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + echo $f_project_id; + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + mantis-1.0.0rc2.patch (41,283 bytes)
diff -Nur mantis-1.0.0rc2.orig/admin/schema.php mantis-1.0.0rc2/admin/schema.php --- mantis-1.0.0rc2.orig/admin/schema.php Wed Aug 3 16:20:34 2005 +++ mantis-1.0.0rc2/admin/schema.php Mon Oct 31 11:15:02 2005 @@ -192,7 +192,10 @@ $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_category_table')," project_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', category C(64) NOTNULL PRIMARY DEFAULT \" '' \", - user_id I UNSIGNED NOTNULL DEFAULT '0' + user_id I UNSIGNED NOTNULL DEFAULT '0', + pop3_host C(250) NULL, + pop3_user C(250) NULL, + pop3_pass C(250) NULL ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS'))); $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_file_table')," @@ -222,7 +225,11 @@ view_state I2 NOTNULL DEFAULT '10', access_min I2 NOTNULL DEFAULT '10', file_path C(250) NOTNULL DEFAULT \" '' \", - description XS NOTNULL + description XS NOTNULL, + pop3_host C(250) NULL, + pop3_user C(250) NULL, + pop3_pass C(250) NULL, + pop3_categories L NOTNULL DEFAULT '0' ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS'))); $upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',config_get('mantis_project_table'),'id')); $upgrade[] = Array('CreateIndexSQL',Array('idx_project_name',config_get('mantis_project_table'),'name',Array('UNIQUE'))); @@ -340,5 +347,9 @@ $upgrade[] = Array('InsertData', Array( config_get('mantis_user_table'), "(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES ('administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', " . db_now() . ", " . db_now() . ", 1, 0, 90, 3, 0, 0, '" . + md5( mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ) ) . md5( time() ) . "')" ) ); +$upgrade[] = Array('InsertData', Array( config_get('mantis_user_table'), + "(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES + ('mail', 'Mail Reporter', 'root@nomail@localhost', 'a268462c3c679a9027658c5aa723f97c', " . db_now() . ", " . db_now() . ", 1, 0, 25, 0, 0, 0, '" . md5( mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ) ) . md5( time() ) . "')" ) ); ?> diff -Nur mantis-1.0.0rc2.orig/bug_report_mail.php mantis-1.0.0rc2/bug_report_mail.php --- mantis-1.0.0rc2.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/bug_report_mail.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,39 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + if ( config_get( 'mail_debug' ) ) { + print_r($t_mailaccounts); + } + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + if ( config_get( 'mail_debug' ) ) { + print_r($t_mail); + } + $GLOBALS['g_cache_current_user_id'] = mail_get_user( $t_mail['From'] ); + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-1.0.0rc2.orig/config_defaults_inc.php mantis-1.0.0rc2/config_defaults_inc.php --- mantis-1.0.0rc2.orig/config_defaults_inc.php Sun Sep 11 13:24:08 2005 +++ mantis-1.0.0rc2/config_defaults_inc.php Mon Oct 31 11:15:02 2005 @@ -1617,4 +1617,37 @@ # ) # ); $g_custom_group_actions = array(); + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; + + # Write complete mail into the "Additional Information" + $g_mail_additional = OFF; + + # Write sender of the message into the bug report + $g_mail_save_from = OFF; + + # Parse MIME mails (may require a lot of memory) + $g_mail_parse_mime = OFF; + + # How many mails should be fetched at the same time + # If big mails with attachments should be received, specify only one + $g_mail_fetch_max = 1; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_debug = OFF; ?> diff -Nur mantis-1.0.0rc2.orig/core/category_api.php mantis-1.0.0rc2/core/category_api.php --- mantis-1.0.0rc2.orig/core/category_api.php Sat Feb 12 21:01:10 2005 +++ mantis-1.0.0rc2/core/category_api.php Mon Oct 31 11:15:22 2005 @@ -186,7 +186,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' AND category='$c_category'"; @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; diff -Nur mantis-1.0.0rc2.orig/core/mail_api.php mantis-1.0.0rc2/core/mail_api.php --- mantis-1.0.0rc2.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/core/mail_api.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,443 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + require_once( $t_core_dir . 'file_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + require_once( 'Mail/mimeDecode.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a project + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data from a project + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the 'Mail per Category' feature for a project + function mail_categories( $p_project_id, $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$v_project_id' AND category='$v_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all categories from a project with valid data for mail access + # return an empty array if there are no such categories + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $t_mail_parse_mime = config_get( 'mail_parse_mime' ); + $t_mail_fetch_max = config_get( 'mail_fetch_max' ); + $t_mail_additional = config_get( 'mail_additional' ); + + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + if ( 0 == $t_pop3->numMsg() ) { + return $v_mails; + } + for ($i = 1; $i <= $t_mail_fetch_max; $i++) { + $t_headers = $t_pop3->getParsedHeaders($i); + $t_msg = $t_pop3->getMsg($i); + if (true == $t_mail_parse_mime && + true == isset( $t_headers['MIME-Version'] ) && + 'multipart' == strtolower ( substr( $t_headers['Content-Type'], 0, 9 ) ) ) { + $t_mail = mail_parse_content( $t_msg ); + } else { + $t_mail = $t_headers; + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + } + + if (true == $t_mail_additional) { + $t_mail['X-Mantis-Complete'] = $t_msg; + } + + array_push($v_mails, $t_mail); + $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_content ( $p_mail ) { + $v_mail = array (); + $t_decoder = new Mail_mimeDecode($p_mail); + $t_params['include_bodies'] = true; + $t_params['decode_bodies'] = true; + $t_params['decode_headers'] = true; + $t_structure = $t_decoder->decode($t_params); + $v_mail['To'] = $t_structure->headers['to']; + $v_mail['From'] = $t_structure->headers['from']; + $v_mail['Subject'] = $t_structure->headers['subject']; + if (is_array($t_structure->parts)) { + $t_parts = mail_parse_parts( $t_structure->parts ); + } else { + $t_parts = array ( mail_parse_part( $t_structure ) ); + } + if (strtolower($t_parts[0]['Content-Type']) == 'text/plain' || + strtolower($t_parts[0]['Content-Type']) == 'text/html' ) { + $t_body['Body'] = $t_parts[0]['Body']; + } else { + $t_body['Body'] = "It seems, there is no text... :-o"; + } + $v_mail['X-Mantis-Parts'] = $t_parts; + $v_mail['X-Mantis-Body'] = $t_body['Body']; + + return $v_mail; + } + + # -------------------- + # return the parsed parts from the mail + function mail_parse_parts ( $p_parts ) { + $v_parts = array (); + foreach ( $p_parts as $t_part ) { + array_push($v_parts, mail_parse_part( $t_part )); + } + + return $v_parts; + } + + # -------------------- + # return one parsed part + function mail_parse_part ( $p_part ) { + $v_part = array (); + $v_part['Content-Type'] = $p_part->ctype_primary."/".$p_part->ctype_secondary; + $v_part['Name'] = $p_part->ctype_parameters['name']; + $v_part['Body'] = $p_part->body; + + return $v_part; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $v_mailaddress = $matches[1]; + } + + return $v_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ( $p_mail_subject ) { + return preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject ) { + preg_match("/\[([A-Za-z0-9-_\. ]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $v_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $v_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $v_mailaddress ); + user_signup($t_user_name, $v_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + // dirty: Set the identified user's id + // required if bug_report_mail is run via command line + $GLOBAL['g_cache_current_user_id'] = $t_reporter_id; + + return $t_reporter_id; + } + + # -------------------- + # Very dirty: Adds a file to a bug. + function mail_add_file( $p_bug_id, $p_part ) { + $GLOBALS['_mail_file_'] = $p_part['Name']; + if ( 0 < strlen($p_part['Name']) ) { + $t_file_name = '/tmp/'.$p_part['Name']; + file_put_contents($t_file_name, $p_part['Body']); + file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug'); + unlink($t_file_name); + } + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug ( $p_mail, $p_account ) { + $t_mail_save_from = config_get( 'mail_save_from' ); + + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + if ( $t_mail_save_from ) { + $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body']; + } + else { + $t_bug_data->description = $p_mail['X-Mantis-Body']; + } + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if ( mail_is_a_bugnote( $p_mail['Subject'] ) ) { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } else { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + # Add files + if ( null != $p_mail['X-Mantis-Parts'] ) { + foreach ($p_mail['X-Mantis-Parts'] as $part) { + mail_add_file ( $t_bug_id, $part ); + } + } + + } + +?> + diff -Nur mantis-1.0.0rc2.orig/core/user_api.php mantis-1.0.0rc2/core/user_api.php --- mantis-1.0.0rc2.orig/core/user_api.php Fri Jul 22 17:34:02 2005 +++ mantis-1.0.0rc2/core/user_api.php Mon Oct 31 11:15:02 2005 @@ -526,6 +526,24 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + $c_mailaddress = db_prepare_string( $p_mailaddress ); + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-1.0.0rc2.orig/doc/README.bug_report_mail mantis-1.0.0rc2/doc/README.bug_report_mail --- mantis-1.0.0rc2.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/doc/README.bug_report_mail Mon Oct 31 11:17:22 2005 @@ -0,0 +1,113 @@ +The current version of bug_report_mail support plain text and MIME +encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/user_api.php + admin/schema.php + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + doc/README.bug_report_mail + doc/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +If you like to parse MIME encoded mails, you have to install the PEAR +Mail_Mime package and set + $g_mail_parse_mime = OFF; +from OFF to ON. + +For debugging controls there is the switch + $g_mail_additional = OFF; +which puts the complete message into the Additional Information field, +if it is activated. + +In this case you should decrease the amount of fetched messages via + $g_mail_fetch_max = 1; +because the mime decoding needs a lot of memory. + +If you'd like to use the Mail Reporter but don't save the whole message for +making the sender's address available, set + $g_mail_save_from = OFF; +to ON. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php +or via command line interface +*/5 * * * * /usr/local/bin/php /path/to/mantis/bug_report_mail.php + +This line fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same conditions as Mantis itself. + +Gerrit Beine, August 2004 + +Changelog: +Sep 2005: + - update to Mantis 1.0.0rc2 + - fixed a bug in getting all categories for a project + category_get_all_rows in core/category_api.php +Aug 2005: + - update to Mantis 1.0.0rc1 + - include the additional patches submitted by + - gernot (Fixed MIME handling and save the mail's sender) + mail_get_all_mails in core/mail_api.php + mail_parse_content in core/mail_api.php + mail_add_bug in core/mail_api.php + - stevenc (Fixed MIME handling) + mail_parse_content in core/mail_api.php + - rainman (Fixed empty files bug and regex for finding a bug id) + mail_add_file in core/mail_api.php + mail_get_bug_id_from_subject in core/mail_api.php +Dec 2004: + - update to Mantis 0.19.2 + - add config: g_mail_parse_mime + - add config: g_mail_additional + - add config: g_mail_fetch_max + - make it working via CLI +Nov 2004: + - update to Mantis 0.19.1 + - add support for MIME decoding +Sep 2004: + - update to Mantis 0.19.0 +Aug 2004: + - create patch for Mantis 0.18.3 + diff -Nur mantis-1.0.0rc2.orig/doc/bug_report_mail.sql mantis-1.0.0rc2/doc/bug_report_mail.sql --- mantis-1.0.0rc2.orig/doc/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/doc/bug_report_mail.sql Mon Oct 31 11:15:02 2005 @@ -0,0 +1,12 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + +INSERT INTO mantis_user_table (username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES ('Mail', 'Mail Reporter', 'nomail', 'a268462c3c679a9027658c5aa723f97c', '2004-12-25 15:41:49', '2004-12-25 15:41:49', 1, 0, 25, 0, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); diff -Nur mantis-1.0.0rc2.orig/manage_proj_cat_edit_page.php mantis-1.0.0rc2/manage_proj_cat_edit_page.php --- mantis-1.0.0rc2.orig/manage_proj_cat_edit_page.php Sat Feb 12 21:01:06 2005 +++ mantis-1.0.0rc2/manage_proj_cat_edit_page.php Mon Oct 31 11:15:02 2005 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -84,4 +89,59 @@ </form> </div> +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> + <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-1.0.0rc2.orig/manage_proj_cat_mail_delete.php mantis-1.0.0rc2/manage_proj_cat_mail_delete.php --- mantis-1.0.0rc2.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/manage_proj_cat_mail_delete.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,44 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc2.orig/manage_proj_cat_mail_update.php mantis-1.0.0rc2/manage_proj_cat_mail_update.php --- mantis-1.0.0rc2.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/manage_proj_cat_mail_update.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,59 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc2.orig/manage_proj_edit_page.php mantis-1.0.0rc2/manage_proj_edit_page.php --- mantis-1.0.0rc2.orig/manage_proj_edit_page.php Tue Jul 26 14:41:02 2005 +++ mantis-1.0.0rc2/manage_proj_edit_page.php Mon Oct 31 11:15:02 2005 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -689,5 +691,76 @@ </tr> </table> </div> + +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-1.0.0rc2.orig/manage_proj_mail_categories.php mantis-1.0.0rc2/manage_proj_mail_categories.php --- mantis-1.0.0rc2.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/manage_proj_mail_categories.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc2.orig/manage_proj_mail_delete.php mantis-1.0.0rc2/manage_proj_mail_delete.php --- mantis-1.0.0rc2.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/manage_proj_mail_delete.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc2.orig/manage_proj_mail_update.php mantis-1.0.0rc2/manage_proj_mail_update.php --- mantis-1.0.0rc2.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc2/manage_proj_mail_update.php Mon Oct 31 11:15:02 2005 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + mantis-0.19.3.patch (40,912 bytes)
diff -Nur mantis-0.19.3.orig/bug_report_mail.php mantis-0.19.3/bug_report_mail.php --- mantis-0.19.3.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/bug_report_mail.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,39 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + if ( config_get( 'mail_debug' ) ) { + print_r($t_mailaccounts); + } + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + if ( config_get( 'mail_debug' ) ) { + print_r($t_mail); + } + $GLOBALS['g_cache_current_user_id'] = mail_get_user( $t_mail['From'] ); + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-0.19.3.orig/config_defaults_inc.php mantis-0.19.3/config_defaults_inc.php --- mantis-0.19.3.orig/config_defaults_inc.php Tue Oct 11 14:00:54 2005 +++ mantis-0.19.3/config_defaults_inc.php Mon Oct 31 11:22:28 2005 @@ -1474,4 +1474,37 @@ # NOTE: These are meaningless under Windows! Just ignore them! $g_dot_tool = '/usr/bin/dot'; $g_neato_tool = '/usr/bin/neato'; -?> \ No newline at end of file + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; + + # Write complete mail into the "Additional Information" + $g_mail_additional = OFF; + + # Write sender of the message into the bug report + $g_mail_save_from = OFF; + + # Parse MIME mails (may require a lot of memory) + $g_mail_parse_mime = OFF; + + # How many mails should be fetched at the same time + # If big mails with attachments should be received, specify only one + $g_mail_fetch_max = 1; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_debug = OFF; +?> diff -Nur mantis-0.19.3.orig/core/category_api.php mantis-0.19.3/core/category_api.php --- mantis-0.19.3.orig/core/category_api.php Thu Apr 8 20:04:52 2004 +++ mantis-0.19.3/core/category_api.php Mon Oct 31 11:22:49 2005 @@ -186,7 +186,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' AND category='$c_category'"; @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; @@ -221,4 +221,4 @@ return $rows; } -?> \ No newline at end of file +?> diff -Nur mantis-0.19.3.orig/core/file_api.php mantis-0.19.3/core/file_api.php --- mantis-0.19.3.orig/core/file_api.php Sun Oct 17 03:58:56 2004 +++ mantis-0.19.3/core/file_api.php Mon Oct 31 11:22:28 2005 @@ -509,7 +509,7 @@ trigger_error( ERROR_DUPLICATE_FILE, ERROR ); } - if ( is_uploaded_file( $p_tmp_file ) ) { + if ( is_uploaded_file( $p_tmp_file ) || $GLOBALS['_mail_file_'] == $p_file_name ) { if ( 'bug' == $p_table ) { $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); $t_bug_id = bug_format_id( $p_bug_id ); diff -Nur mantis-0.19.3.orig/core/mail_api.php mantis-0.19.3/core/mail_api.php --- mantis-0.19.3.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/core/mail_api.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,443 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + require_once( $t_core_dir . 'file_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + require_once( 'Mail/mimeDecode.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a project + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data from a project + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the 'Mail per Category' feature for a project + function mail_categories( $p_project_id, $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$v_project_id' AND category='$v_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all categories from a project with valid data for mail access + # return an empty array if there are no such categories + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $t_mail_parse_mime = config_get( 'mail_parse_mime' ); + $t_mail_fetch_max = config_get( 'mail_fetch_max' ); + $t_mail_additional = config_get( 'mail_additional' ); + + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + if ( 0 == $t_pop3->numMsg() ) { + return $v_mails; + } + for ($i = 1; $i <= $t_mail_fetch_max; $i++) { + $t_headers = $t_pop3->getParsedHeaders($i); + $t_msg = $t_pop3->getMsg($i); + if (true == $t_mail_parse_mime && + true == isset( $t_headers['MIME-Version'] ) && + 'multipart' == strtolower ( substr( $t_headers['Content-Type'], 0, 9 ) ) ) { + $t_mail = mail_parse_content( $t_msg ); + } else { + $t_mail = $t_headers; + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + } + + if (true == $t_mail_additional) { + $t_mail['X-Mantis-Complete'] = $t_msg; + } + + array_push($v_mails, $t_mail); + $t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_content ( $p_mail ) { + $v_mail = array (); + $t_decoder = new Mail_mimeDecode($p_mail); + $t_params['include_bodies'] = true; + $t_params['decode_bodies'] = true; + $t_params['decode_headers'] = true; + $t_structure = $t_decoder->decode($t_params); + $v_mail['To'] = $t_structure->headers['to']; + $v_mail['From'] = $t_structure->headers['from']; + $v_mail['Subject'] = $t_structure->headers['subject']; + if (is_array($t_structure->parts)) { + $t_parts = mail_parse_parts( $t_structure->parts ); + } else { + $t_parts = array ( mail_parse_part( $t_structure ) ); + } + if (strtolower($t_parts[0]['Content-Type']) == 'text/plain' || + strtolower($t_parts[0]['Content-Type']) == 'text/html' ) { + $t_body['Body'] = $t_parts[0]['Body']; + } else { + $t_body['Body'] = "It seems, there is no text... :-o"; + } + $v_mail['X-Mantis-Parts'] = $t_parts; + $v_mail['X-Mantis-Body'] = $t_body['Body']; + + return $v_mail; + } + + # -------------------- + # return the parsed parts from the mail + function mail_parse_parts ( $p_parts ) { + $v_parts = array (); + foreach ( $p_parts as $t_part ) { + array_push($v_parts, mail_parse_part( $t_part )); + } + + return $v_parts; + } + + # -------------------- + # return one parsed part + function mail_parse_part ( $p_part ) { + $v_part = array (); + $v_part['Content-Type'] = $p_part->ctype_primary."/".$p_part->ctype_secondary; + $v_part['Name'] = $p_part->ctype_parameters['name']; + $v_part['Body'] = $p_part->body; + + return $v_part; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $v_mailaddress = $matches[1]; + } + + return $v_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ( $p_mail_subject ) { + return preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject ) { + preg_match("/\[([A-Za-z0-9-_\. ]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $v_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $v_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $v_mailaddress ); + user_signup($t_user_name, $v_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + // dirty: Set the identified user's id + // required if bug_report_mail is run via command line + $GLOBAL['g_cache_current_user_id'] = $t_reporter_id; + + return $t_reporter_id; + } + + # -------------------- + # Very dirty: Adds a file to a bug. + function mail_add_file( $p_bug_id, $p_part ) { + $GLOBALS['_mail_file_'] = $p_part['Name']; + if ( 0 < strlen($p_part['Name']) ) { + $t_file_name = '/tmp/'.$p_part['Name']; + file_put_contents($t_file_name, $p_part['Body']); + file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug'); + unlink($t_file_name); + } + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug ( $p_mail, $p_account ) { + $t_mail_save_from = config_get( 'mail_save_from' ); + + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + if ( $t_mail_save_from ) { + $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body']; + } + else { + $t_bug_data->description = $p_mail['X-Mantis-Body']; + } + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if ( mail_is_a_bugnote( $p_mail['Subject'] ) ) { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } else { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + # Add files + if ( null != $p_mail['X-Mantis-Parts'] ) { + foreach ($p_mail['X-Mantis-Parts'] as $part) { + mail_add_file ( $t_bug_id, $part ); + } + } + + } + +?> + diff -Nur mantis-0.19.3.orig/core/user_api.php mantis-0.19.3/core/user_api.php --- mantis-0.19.3.orig/core/user_api.php Fri Nov 19 13:29:00 2004 +++ mantis-0.19.3/core/user_api.php Mon Oct 31 11:22:28 2005 @@ -477,6 +477,24 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + $c_mailaddress = db_prepare_string( $p_mailaddress ); + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-0.19.3.orig/doc/README.bug_report_mail mantis-0.19.3/doc/README.bug_report_mail --- mantis-0.19.3.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/doc/README.bug_report_mail Mon Oct 31 11:23:39 2005 @@ -0,0 +1,116 @@ +The current version of bug_report_mail support plain text and MIME +encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/file_api.php + core/user_api.php + sql/db_generate.sql + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + doc/README.bug_report_mail + sql/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +If you like to parse MIME encoded mails, you have to install the PEAR +Mail_Mime package and set + $g_mail_parse_mime = OFF; +from OFF to ON. + +For debugging controls there is the switch + $g_mail_additional = OFF; +which puts the complete message into the Additional Information field, +if it is activated. + +In this case you should decrease the amount of fetched messages via + $g_mail_fetch_max = 1; +because the mime decoding needs a lot of memory. + +If you'd like to use the Mail Reporter but don't save the whole message for +making the sender's address available, set + $g_mail_save_from = OFF; +to ON. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php +or via command line interface +*/5 * * * * /usr/local/bin/php /path/to/mantis/bug_report_mail.php + +This line fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same conditions as Mantis itself. + +Gerrit Beine, August 2004 + +Changelog: +Oct 2005 + - update to Mantis 0.19.3 +Sep 2005: + - update to Mantis 1.0.0rc2 + - fixed a bug in getting all categories for a project + category_get_all_rows in core/category_api.php +Aug 2005: + - update to Mantis 1.0.0rc1 + - include the additional patches submitted by + - gernot (Fixed MIME handling and save the mail's sender) + mail_get_all_mails in core/mail_api.php + mail_parse_content in core/mail_api.php + mail_add_bug in core/mail_api.php + - stevenc (Fixed MIME handling) + mail_parse_content in core/mail_api.php + - rainman (Fixed empty files bug and regex for finding a bug id) + mail_add_file in core/mail_api.php + mail_get_bug_id_from_subject in core/mail_api.php +Dec 2004: + - update to Mantis 0.19.2 + - add config: g_mail_parse_mime + - add config: g_mail_additional + - add config: g_mail_fetch_max + - make it working via CLI +Nov 2004: + - update to Mantis 0.19.1 + - add support for MIME decoding +Sep 2004: + - update to Mantis 0.19.0 +Aug 2004: + - create patch for Mantis 0.18.3 + diff -Nur mantis-0.19.3.orig/manage_proj_cat_edit_page.php mantis-0.19.3/manage_proj_cat_edit_page.php --- mantis-0.19.3.orig/manage_proj_cat_edit_page.php Mon Apr 12 23:04:34 2004 +++ mantis-0.19.3/manage_proj_cat_edit_page.php Mon Oct 31 11:22:28 2005 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -84,4 +89,59 @@ </form> </div> +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> + <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.3.orig/manage_proj_cat_mail_delete.php mantis-0.19.3/manage_proj_cat_mail_delete.php --- mantis-0.19.3.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/manage_proj_cat_mail_delete.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,44 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-0.19.3.orig/manage_proj_cat_mail_update.php mantis-0.19.3/manage_proj_cat_mail_update.php --- mantis-0.19.3.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/manage_proj_cat_mail_update.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,59 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-0.19.3.orig/manage_proj_edit_page.php mantis-0.19.3/manage_proj_edit_page.php --- mantis-0.19.3.orig/manage_proj_edit_page.php Wed Sep 22 12:15:32 2004 +++ mantis-0.19.3/manage_proj_edit_page.php Mon Oct 31 11:22:28 2005 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -550,5 +552,77 @@ </tr> </table> </div> + +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> + <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-0.19.3.orig/manage_proj_mail_categories.php mantis-0.19.3/manage_proj_mail_categories.php --- mantis-0.19.3.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/manage_proj_mail_categories.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-0.19.3.orig/manage_proj_mail_delete.php mantis-0.19.3/manage_proj_mail_delete.php --- mantis-0.19.3.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/manage_proj_mail_delete.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-0.19.3.orig/manage_proj_mail_update.php mantis-0.19.3/manage_proj_mail_update.php --- mantis-0.19.3.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/manage_proj_mail_update.php Mon Oct 31 11:22:28 2005 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-0.19.3.orig/sql/bug_report_mail.sql mantis-0.19.3/sql/bug_report_mail.sql --- mantis-0.19.3.orig/sql/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-0.19.3/sql/bug_report_mail.sql Mon Oct 31 11:22:28 2005 @@ -0,0 +1,12 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + +INSERT INTO mantis_user_table (username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_in_progress_count, failed_login_count, cookie_string) VALUES ('Mail', 'Mail Reporter', 'nomail', 'a268462c3c679a9027658c5aa723f97c', '2004-12-25 15:41:49', '2004-12-25 15:41:49', 1, 0, 25, 0, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); diff -Nur mantis-0.19.3.orig/sql/db_generate.sql mantis-0.19.3/sql/db_generate.sql --- mantis-0.19.3.orig/sql/db_generate.sql Sat Nov 6 12:07:30 2004 +++ mantis-0.19.3/sql/db_generate.sql Mon Oct 31 11:22:28 2005 @@ -330,6 +330,9 @@ project_id int(7) unsigned NOT NULL default '0', category varchar(64) NOT NULL default '', user_id int(7) unsigned NOT NULL default '0', + pop3_host varchar( 255 ) default NULL, + pop3_user varchar( 255 ) default NULL, + pop3_pass varchar( 255 ) default NULL, PRIMARY KEY (project_id,category) ) TYPE=MyISAM; @@ -379,6 +382,10 @@ access_min int(2) NOT NULL default '10', file_path varchar(250) NOT NULL default '', description text NOT NULL, + pop3_host varchar( 255 ) default NULL, + pop3_user varchar( 255 ) default NULL, + pop3_pass varchar( 255 ) default NULL, + pop3_categories enum( '0', '1' ) NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY name (name), KEY id (id) @@ -881,3 +888,5 @@ # INSERT INTO mantis_user_table VALUES (1, 'administrator', '', 'admin', '63a9f0ea7bb98050796b649e85481845', '2003-02-16 02:03:48', '2004-07-08 23:59:22', 1, 1, 90, 3, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); +INSERT INTO mantis_user_table VALUES (2, 'Mail', 'Mail Reporter', 'nomail', 'a268462c3c679a9027658c5aa723f97c', '2004-12-25 15:41:49', '2004-12-25 15:41:49', 1, 0, 25, 0, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); + mantis-1.0.0rc3.patch (41,385 bytes)
diff -Nur mantis-1.0.0rc3.orig/admin/schema.php mantis-1.0.0rc3/admin/schema.php --- mantis-1.0.0rc3.orig/admin/schema.php Wed Aug 3 16:20:34 2005 +++ mantis-1.0.0rc3/admin/schema.php Mon Oct 31 11:18:41 2005 @@ -192,7 +192,10 @@ $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_category_table')," project_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', category C(64) NOTNULL PRIMARY DEFAULT \" '' \", - user_id I UNSIGNED NOTNULL DEFAULT '0' + user_id I UNSIGNED NOTNULL DEFAULT '0', + pop3_host C(250) NULL, + pop3_user C(250) NULL, + pop3_pass C(250) NULL ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS'))); $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project_file_table')," @@ -222,7 +225,11 @@ view_state I2 NOTNULL DEFAULT '10', access_min I2 NOTNULL DEFAULT '10', file_path C(250) NOTNULL DEFAULT \" '' \", - description XS NOTNULL + description XS NOTNULL, + pop3_host C(250) NULL, + pop3_user C(250) NULL, + pop3_pass C(250) NULL, + pop3_categories L NOTNULL DEFAULT '0' ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS'))); $upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',config_get('mantis_project_table'),'id')); $upgrade[] = Array('CreateIndexSQL',Array('idx_project_name',config_get('mantis_project_table'),'name',Array('UNIQUE'))); @@ -340,5 +347,9 @@ $upgrade[] = Array('InsertData', Array( config_get('mantis_user_table'), "(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES ('administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', " . db_now() . ", " . db_now() . ", 1, 0, 90, 3, 0, 0, '" . + md5( mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ) ) . md5( time() ) . "')" ) ); +$upgrade[] = Array('InsertData', Array( config_get('mantis_user_table'), + "(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES + ('mail', 'Mail Reporter', 'root@nomail@localhost', 'a268462c3c679a9027658c5aa723f97c', " . db_now() . ", " . db_now() . ", 1, 0, 25, 0, 0, 0, '" . md5( mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ) ) . md5( time() ) . "')" ) ); ?> diff -Nur mantis-1.0.0rc3.orig/bug_report_mail.php mantis-1.0.0rc3/bug_report_mail.php --- mantis-1.0.0rc3.orig/bug_report_mail.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/bug_report_mail.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,40 @@ +<?php +error_reporting(E_ALL); + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + # This page receives an E-Mail via POP3 and generates an Report + header("Content-type: text/plain"); + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'string_api.php' ); + require_once( $t_core_path . 'bug_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); + + $t_mailaccounts = mail_get_accounts(); + + foreach ($t_mailaccounts as $t_mailaccount) { + if ( config_get( 'mail_debug' ) ) { + print_r($t_mailaccounts); + } + $t_mails = mail_get_all_mails($t_mailaccount); + foreach ($t_mails as $t_mail) + { + if ( config_get( 'mail_debug' ) ) { + print_r($t_mail); + } + $GLOBALS['g_cache_current_user_id'] = mail_get_user( $t_mail['From'] ); + mail_add_bug($t_mail, $t_mailaccount); + } + } +?> + diff -Nur mantis-1.0.0rc3.orig/config_defaults_inc.php mantis-1.0.0rc3/config_defaults_inc.php --- mantis-1.0.0rc3.orig/config_defaults_inc.php Sat Oct 29 01:36:32 2005 +++ mantis-1.0.0rc3/config_defaults_inc.php Mon Oct 31 11:18:41 2005 @@ -1617,4 +1617,37 @@ # ) # ); $g_custom_group_actions = array(); + + ###################### + # Mail Reporting + ###################### + + # --- mail reporting settings ----- + # This tells Mantis to report all the Mail with only one account + $g_mail_use_reporter = ON; + + # The account's name for mail reporting + # Also used for fallback if a user is not found in database + $g_mail_reporter = 'Mail'; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_auto_signup = OFF; + + # Write complete mail into the "Additional Information" + $g_mail_additional = OFF; + + # Write sender of the message into the bug report + $g_mail_save_from = OFF; + + # Parse MIME mails (may require a lot of memory) + $g_mail_parse_mime = OFF; + + # How many mails should be fetched at the same time + # If big mails with attachments should be received, specify only one + $g_mail_fetch_max = 1; + + # Signup new users automatically (possible security risk!) + # Default is OFF, ignored if mail_use_reporter is ON + $g_mail_debug = OFF; ?> diff -Nur mantis-1.0.0rc3.orig/core/category_api.php mantis-1.0.0rc3/core/category_api.php --- mantis-1.0.0rc3.orig/core/category_api.php Sat Feb 12 21:01:10 2005 +++ mantis-1.0.0rc3/core/category_api.php Mon Oct 31 11:18:41 2005 @@ -186,7 +186,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' AND category='$c_category'"; @@ -206,7 +206,7 @@ $t_project_category_table = config_get( 'mantis_project_category_table' ); - $query = "SELECT category, user_id + $query = "SELECT category, user_id, pop3_host, pop3_user, pop3_pass FROM $t_project_category_table WHERE project_id='$c_project_id' ORDER BY category"; diff -Nur mantis-1.0.0rc3.orig/core/mail_api.php mantis-1.0.0rc3/core/mail_api.php --- mantis-1.0.0rc3.orig/core/mail_api.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/core/mail_api.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,443 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + $t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR; + + require_once( $t_core_dir . 'bug_api.php' ); + require_once( $t_core_dir . 'bugnote_api.php' ); + require_once( $t_core_dir . 'user_api.php' ); + require_once( $t_core_dir . 'project_api.php' ); + require_once( $t_core_dir . 'file_api.php' ); + + # This page receives an E-Mail via POP3 and generates an Report + + require_once( 'Net/POP3.php' ); + require_once( 'Mail/mimeDecode.php' ); + + # -------------------- + # Return mail account data for the specified project + function mail_get_account_data( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass, pop3_categories + FROM $t_project_table + WHERE id='$v_project_id'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a project + function mail_update( $p_project_id, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data from a project + function mail_delete( $p_project_id ) { + $v_project_id = db_prepare_int( $p_project_id ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Activate the 'Mail per Category' feature for a project + function mail_categories( $p_project_id, $p_active ) { + $v_project_id = db_prepare_int( $p_project_id ); + + if ($p_active == 'On') { + $v_active = 1; + } else { + $v_active = 0; + } + + $t_project_table = config_get( 'mantis_project_table' ); + + $query = "UPDATE $t_project_table + SET pop3_categories='$v_active' + WHERE id='$v_project_id'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Return mail account data for the specified project and category + function mail_category_get_account_data( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "SELECT pop3_host, pop3_user, pop3_pass + FROM $t_project_category_table + WHERE project_id='$v_project_id' AND category='$v_category'"; + + $result = db_query( $query ); + + return db_fetch_array( $result ); + } + + # -------------------- + # Update the mail account data for a category + function mail_category_update( $p_project_id, $p_category, $p_pop3_host, $p_pop3_user, $p_pop3_pass ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + $v_pop3_host = db_prepare_string( $p_pop3_host ); + $v_pop3_user = db_prepare_string( $p_pop3_user ); + $v_pop3_pass = db_prepare_string( $p_pop3_pass ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host='$v_pop3_host', + pop3_user='$v_pop3_user', + pop3_pass='$v_pop3_pass' + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # Removes the mail account data for a category + function mail_category_delete( $p_project_id, $p_category ) { + $v_project_id = db_prepare_int( $p_project_id ); + $v_category = db_prepare_string( $p_category ); + + $t_project_table = config_get( 'mantis_project_table' ); + + $t_project_category_table = config_get( 'mantis_project_category_table' ); + + $query = "UPDATE $t_project_category_table + SET pop3_host=NULL, + pop3_user=NULL, + pop3_pass=NULL + WHERE project_id='$v_project_id' AND category='$v_category'"; + + db_query( $query ); + + return true; + } + + # -------------------- + # return all mailaccounts + # return an empty array if there are no + function mail_get_accounts() { + $v_accounts = array(); + $t_projects = mail_project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_categories']) { echo 1; + $v_categories = mail_categories_get_all_rows( $t_project['id'] ); + $v_accounts = array_merge($v_accounts, $v_categories); + } else { + array_push($v_accounts, $t_project); + } + } + + return $v_accounts; + } + + # -------------------- + # return all projects with valid data for mail access + # return an empty array if there are no such projects + function mail_project_get_all_rows() { + $v_projects = array(); + $t_projects = project_get_all_rows(); + + foreach ($t_projects as $t_project) { + if ($t_project['pop3_host'] || $t_project['pop3_categories']) { + array_push($v_projects, $t_project); + } + } + + return $v_projects; + } + + # -------------------- + # return all categories from a project with valid data for mail access + # return an empty array if there are no such categories + function mail_categories_get_all_rows( $p_project_id ) { + $v_categories = array(); + $t_categories = category_get_all_rows( $p_project_id ); + + foreach ($t_categories as $t_category) { + if ($t_category['pop3_host']) { + $t_category['id'] = $p_project_id; + array_push($v_categories, $t_category); + } + } + + return $v_categories; + } + + # -------------------- + # return all mails for an account + # return an empty array if there are no new mails + function mail_get_all_mails( $p_account ) { + $t_mail_parse_mime = config_get( 'mail_parse_mime' ); + $t_mail_fetch_max = config_get( 'mail_fetch_max' ); + $t_mail_additional = config_get( 'mail_additional' ); + + $v_mails = array(); + $t_pop3 = &new Net_POP3(); + $t_pop3_host = $p_account['pop3_host']; + $t_pop3_user = $p_account['pop3_user']; + $t_pop3_password = $p_account['pop3_pass']; + $t_pop3->connect($t_pop3_host, 110); + $t_pop3->login($t_pop3_user, $t_pop3_password); + + if ( 0 == $t_pop3->numMsg() ) { + return $v_mails; + } + for ($i = 1; $i <= $t_mail_fetch_max; $i++) { + $t_headers = $t_pop3->getParsedHeaders($i); + $t_msg = $t_pop3->getMsg($i); + if (true == $t_mail_parse_mime && + true == isset( $t_headers['MIME-Version'] ) && + 'multipart' == strtolower ( substr( $t_headers['Content-Type'], 0, 9 ) ) ) { + $t_mail = mail_parse_content( $t_msg ); + } else { + $t_mail = $t_headers; + $t_mail['X-Mantis-Body'] = $t_pop3->getBody($i); + } + + if (true == $t_mail_additional) { + $t_mail['X-Mantis-Complete'] = $t_msg; + } + + array_push($v_mails, $t_mail); + #$t_pop3->deleteMsg($i); + } + + $t_pop3->disconnect(); + return $v_mails; + } + + # -------------------- + # return the mail parsed for Mantis + function mail_parse_content ( $p_mail ) { + $v_mail = array (); + $t_decoder = new Mail_mimeDecode($p_mail); + $t_params['include_bodies'] = true; + $t_params['decode_bodies'] = true; + $t_params['decode_headers'] = true; + $t_structure = $t_decoder->decode($t_params); + $v_mail['To'] = $t_structure->headers['to']; + $v_mail['From'] = $t_structure->headers['from']; + $v_mail['Subject'] = $t_structure->headers['subject']; + if (is_array($t_structure->parts)) { + $t_parts = mail_parse_parts( $t_structure->parts ); + } else { + $t_parts = array ( mail_parse_part( $t_structure ) ); + } + if (strtolower($t_parts[0]['Content-Type']) == 'text/plain' || + strtolower($t_parts[0]['Content-Type']) == 'text/html' ) { + $t_body['Body'] = $t_parts[0]['Body']; + } else { + $t_body['Body'] = "It seems, there is no text... :-o"; + } + $v_mail['X-Mantis-Parts'] = $t_parts; + $v_mail['X-Mantis-Body'] = $t_body['Body']; + + return $v_mail; + } + + # -------------------- + # return the parsed parts from the mail + function mail_parse_parts ( $p_parts ) { + $v_parts = array (); + foreach ( $p_parts as $t_part ) { + array_push($v_parts, mail_parse_part( $t_part )); + } + + return $v_parts; + } + + # -------------------- + # return one parsed part + function mail_parse_part ( $p_part ) { + $v_part = array (); + $v_part['Content-Type'] = $p_part->ctype_primary."/".$p_part->ctype_secondary; + $v_part['Name'] = $p_part->ctype_parameters['name']; + $v_part['Body'] = $p_part->body; + + return $v_part; + } + + # -------------------- + # return the mailadress from the mail's 'From' + function mail_parse_address ( $p_mailaddress ) { + if (preg_match("/<(.*?)>/", $p_mailaddress, $matches)) { + $v_mailaddress = $matches[1]; + } + + return $v_mailaddress; + } + + # -------------------- + # return the a valid username from an email address + function mail_user_name_from_address ( $p_mailaddress ) { + return preg_replace("/[@\.-]/", '_', $p_mailaddress); + } + + # -------------------- + # return true if there is a valid mantis bug referernce in subject + function mail_is_a_bugnote ( $p_mail_subject ) { + return preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{7})\]/", $p_mail_subject); + } + + # -------------------- + # return the bug's id from the subject + function mail_get_bug_id_from_subject ( $p_mail_subject ) { + preg_match("/\[([A-Za-z0-9-_\. ]*\s([0-9]{7}?))\]/", $p_mail_subject, $v_matches); + + return $v_matches[2]; + } + + # -------------------- + # return the user id for the mail reporting user + function mail_get_user ($p_mailaddress) { + $t_mail_use_reporter = config_get( 'mail_use_reporter' ); + $t_mail_auto_signup = config_get( 'mail_auto_signup' ); + $t_mail_reporter = config_get( 'mail_reporter' ); + + $v_mailaddress = mail_parse_address( $p_mailaddress ); + + if ( $t_mail_use_reporter ) { + // Always report as mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } else { + // Try to get the reporting users id + $t_reporter_id = user_get_id_by_mail ( $v_mailaddress ); + if ( ! $t_reporter_id && $t_mail_auto_signup ) { + // So, we've to sign up a new user... + $t_user_name = mail_user_name_from_address ( $v_mailaddress ); + user_signup($t_user_name, $v_mailaddress); + $t_reporter_id = user_get_id_by_name($t_user_name); + } elseif ( ! $t_reporter_id ) { + // Fall back to the default mail_reporter + $t_reporter_id = user_get_id_by_name( $t_mail_reporter ); + } + } + + // dirty: Set the identified user's id + // required if bug_report_mail is run via command line + $GLOBAL['g_cache_current_user_id'] = $t_reporter_id; + + return $t_reporter_id; + } + + # -------------------- + # Very dirty: Adds a file to a bug. + function mail_add_file( $p_bug_id, $p_part ) { + $GLOBALS['_mail_file_'] = $p_part['Name']; + if ( 0 < strlen($p_part['Name']) ) { + $t_file_name = '/tmp/'.$p_part['Name']; + file_put_contents($t_file_name, $p_part['Body']); + file_add($p_bug_id, $t_file_name, $p_part['Name'], $p_part['Content-Type'], 'bug'); + unlink($t_file_name); + } + } + + # -------------------- + # Adds a bug which is reported via email + # Taken from bug_report.php and + function mail_add_bug ( $p_mail, $p_account ) { + $t_mail_save_from = config_get( 'mail_save_from' ); + + $t_bug_data = new BugData; + $t_bug_data->build = gpc_get_string( 'build', '' ); + $t_bug_data->platform = gpc_get_string( 'platform', '' ); + $t_bug_data->os = gpc_get_string( 'os', '' ); + $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); + $t_bug_data->version = gpc_get_string( 'product_version', '' ); + $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); + $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); + $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); + + if ( $p_account['category']) { + $t_bug_data->category = gpc_get_string( 'category', $p_account['category'] ); + } else { + $t_bug_data->category = gpc_get_string( 'category', '' ); + } + $t_bug_data->reproducibility = 10; + $t_bug_data->severity = 50; + $t_bug_data->priority = gpc_get_int( 'priority', NORMAL ); + $t_bug_data->summary = $p_mail['Subject']; + if ( $t_mail_save_from ) { + $t_bug_data->description = "Report from: ".$p_mail['From']."\n\n".$p_mail['X-Mantis-Body']; + } + else { + $t_bug_data->description = $p_mail['X-Mantis-Body']; + } + $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' ); + $t_bug_data->additional_information = $p_mail['X-Mantis-Complete']; + + $t_bug_data->project_id = $p_account['id']; + + $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); + + if ( mail_is_a_bugnote( $p_mail['Subject'] ) ) { + # Add a bug note + $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if ( ! bug_is_readonly( $t_bug_id ) ) { + bugnote_add ( $t_bug_id, $p_mail['X-Mantis-Body'] ); + email_bugnote_add ( $t_bug_id ); + } + } else { + # Create the bug + $t_bug_id = bug_create( $t_bug_data ); + email_new_bug( $t_bug_id ); + } + # Add files + if ( null != $p_mail['X-Mantis-Parts'] ) { + foreach ($p_mail['X-Mantis-Parts'] as $part) { + mail_add_file ( $t_bug_id, $part ); + } + } + + } + +?> + diff -Nur mantis-1.0.0rc3.orig/core/user_api.php mantis-1.0.0rc3/core/user_api.php --- mantis-1.0.0rc3.orig/core/user_api.php Fri Jul 22 17:34:02 2005 +++ mantis-1.0.0rc3/core/user_api.php Mon Oct 31 11:18:41 2005 @@ -526,6 +526,24 @@ } } + # get a user id from an mail address + # return false if the mail address does not exist + function user_get_id_by_mail( $p_mailaddress ) { + $c_mailaddress = db_prepare_string( $p_mailaddress ); + $t_user_table = config_get( 'mantis_user_table' ); + + $query = "SELECT id + FROM $t_user_table + WHERE email='$c_mailaddress'"; + $result = db_query( $query ); + + if ( 0 == db_num_rows( $result ) ) { + return false; + } else { + return db_result( $result ); + } + } + # -------------------- # return all data associated with a particular user name # return false if the username does not exist diff -Nur mantis-1.0.0rc3.orig/doc/README.bug_report_mail mantis-1.0.0rc3/doc/README.bug_report_mail --- mantis-1.0.0rc3.orig/doc/README.bug_report_mail Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/doc/README.bug_report_mail Mon Oct 31 11:19:12 2005 @@ -0,0 +1,116 @@ +The current version of bug_report_mail support plain text and MIME +encoded e-mails via POP3 Mailaccounts with PEAR's Net_POP3 package. + +bug_report_mail is able to recognize if mail is a reply to an already opened +bug and adds the content as a bugnote. + +If you are alway running Mantis you have to alter your projects table +with the sql/bug_report_mail.sql script. +If not, you can create the database tables in the way described in +the doc/INSTALL file. + +This patch changes the following files: + core/category_api.php + core/user_api.php + admin/schema.php + config_defaults_inc.php + manage_proj_cat_edit_page.php + manage_proj_edit_page.php +These files are new: + core/mail_api.php + doc/README.bug_report_mail + doc/bug_report_mail.sql + bug_report_mail.php + manage_proj_cat_mail_delete.php + manage_proj_cat_mail_update.php + manage_proj_mail_categories.php + manage_proj_mail_delete.php + manage_proj_mail_update.php + +After installing this patch, you can add a POP3 server's hostname +and authentication data for each of your projects with the project edit form. + +There are two ways to receive mail with bug_report_mail: +The secure (and default) way is to use a standard reporting user: +You have to create a reporter account, for example 'Mail'. +The name for this reporter account you have to write in your config_inc.php file: + $g_mail_reporter = "Mail"; +and then, bug_report_mail must be informed to behave like this: + $g_mail_use_reporter = ON; + +The other way is to signup new user accounts automatically. +For using this, you have to change this + $g_mail_auto_signup = OFF; +from OFF to ON. +Now, bug_report_mail will look for an user named like the mail's sender +or an user which mail adress is identical. +If no user is found, then a new account will be created. +The new user's name will be the mail address. + +This could be used for attacks, but there is no other way in the moment. + +If you like to parse MIME encoded mails, you have to install the PEAR +Mail_Mime package and set + $g_mail_parse_mime = OFF; +from OFF to ON. + +For debugging controls there is the switch + $g_mail_additional = OFF; +which puts the complete message into the Additional Information field, +if it is activated. + +In this case you should decrease the amount of fetched messages via + $g_mail_fetch_max = 1; +because the mime decoding needs a lot of memory. + +If you'd like to use the Mail Reporter but don't save the whole message for +making the sender's address available, set + $g_mail_save_from = OFF; +to ON. + +After this, bug_report_mail can be used via cron like this: + +*/5 * * * * lynx --dump http://mantis.homepage.com/bug_report_mail.php +or via command line interface +*/5 * * * * /usr/local/bin/php /path/to/mantis/bug_report_mail.php + +This line fetch bug reports from via POP3 every 5 minutes. + +This addon is distributed under the same conditions as Mantis itself. + +Gerrit Beine, August 2004 + +Changelog: +Oct 2005 + - update to Mantis 1.0.0rc3 + - update to Mantis 0.19.3 +Sep 2005: + - update to Mantis 1.0.0rc2 + - fixed a bug in getting all categories for a project + category_get_all_rows in core/category_api.php +Aug 2005: + - update to Mantis 1.0.0rc1 + - include the additional patches submitted by + - gernot (Fixed MIME handling and save the mail's sender) + mail_get_all_mails in core/mail_api.php + mail_parse_content in core/mail_api.php + mail_add_bug in core/mail_api.php + - stevenc (Fixed MIME handling) + mail_parse_content in core/mail_api.php + - rainman (Fixed empty files bug and regex for finding a bug id) + mail_add_file in core/mail_api.php + mail_get_bug_id_from_subject in core/mail_api.php +Dec 2004: + - update to Mantis 0.19.2 + - add config: g_mail_parse_mime + - add config: g_mail_additional + - add config: g_mail_fetch_max + - make it working via CLI +Nov 2004: + - update to Mantis 0.19.1 + - add support for MIME decoding +Sep 2004: + - update to Mantis 0.19.0 +Aug 2004: + - create patch for Mantis 0.18.3 + diff -Nur mantis-1.0.0rc3.orig/doc/bug_report_mail.sql mantis-1.0.0rc3/doc/bug_report_mail.sql --- mantis-1.0.0rc3.orig/doc/bug_report_mail.sql Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/doc/bug_report_mail.sql Mon Oct 31 11:18:41 2005 @@ -0,0 +1,12 @@ +ALTER TABLE `mantis_project_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_categories` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ; + +ALTER TABLE `mantis_project_category_table` +ADD `pop3_host` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_user` VARCHAR( 255 ) DEFAULT NULL , +ADD `pop3_pass` VARCHAR( 255 ) DEFAULT NULL ; + +INSERT INTO mantis_user_table (username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES ('Mail', 'Mail Reporter', 'nomail', 'a268462c3c679a9027658c5aa723f97c', '2004-12-25 15:41:49', '2004-12-25 15:41:49', 1, 0, 25, 0, 0, 0, CONCAT(MD5(RAND()),MD5(NOW()))); diff -Nur mantis-1.0.0rc3.orig/manage_proj_cat_edit_page.php mantis-1.0.0rc3/manage_proj_cat_edit_page.php --- mantis-1.0.0rc3.orig/manage_proj_cat_edit_page.php Sat Feb 12 21:01:06 2005 +++ mantis-1.0.0rc3/manage_proj_cat_edit_page.php Mon Oct 31 11:18:41 2005 @@ -15,6 +15,7 @@ $t_core_path = config_get( 'core_path' ); require_once( $t_core_path.'category_api.php' ); + require_once( $t_core_path.'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -24,6 +25,10 @@ $t_row = category_get_row( $f_project_id, $f_category ); $t_assigned_to = $t_row['user_id']; + $t_mail = mail_get_account_data( $f_project_id ); + if ( $t_mail['pop3_categories'] ) { + $t_category_mail = mail_category_get_account_data( $f_project_id, $f_category ); + } ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -84,4 +89,59 @@ </form> </div> +<?php if ( $t_mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_cat_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Category Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $t_category_mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_cat_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="category" value="<?php echo string_attribute( $f_category ) ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<?php } ?> + <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-1.0.0rc3.orig/manage_proj_cat_mail_delete.php mantis-1.0.0rc3/manage_proj_cat_mail_delete.php --- mantis-1.0.0rc3.orig/manage_proj_cat_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/manage_proj_cat_mail_delete.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,44 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_category_delete( $f_project_id, $f_category ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc3.orig/manage_proj_cat_mail_update.php mantis-1.0.0rc3/manage_proj_cat_mail_update.php --- mantis-1.0.0rc3.orig/manage_proj_cat_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/manage_proj_cat_mail_update.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,59 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + $f_category = gpc_get_string( 'category' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_category_update( $f_project_id, $f_category, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_cat_edit_page.php?project_id=' . $f_project_id . '&category=' . $f_category; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc3.orig/manage_proj_edit_page.php mantis-1.0.0rc3/manage_proj_edit_page.php --- mantis-1.0.0rc3.orig/manage_proj_edit_page.php Tue Jul 26 14:41:02 2005 +++ mantis-1.0.0rc3/manage_proj_edit_page.php Mon Oct 31 11:18:41 2005 @@ -18,6 +18,7 @@ require_once( $t_core_path . 'version_api.php' ); require_once( $t_core_path . 'custom_field_api.php' ); require_once( $t_core_path . 'icon_api.php' ); + require_once( $t_core_path . 'mail_api.php' ); ?> <?php $f_project_id = gpc_get_int( 'project_id' ); @@ -25,6 +26,7 @@ access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); $row = project_get_row( $f_project_id ); + $mail = mail_get_account_data( $f_project_id ); ?> <?php html_page_top1() ?> <?php html_page_top2() ?> @@ -689,5 +691,76 @@ </tr> </table> </div> + +<?php if ( ! $mail['pop3_categories'] ) { ?> +<!-- MAIL ACCOUNT CHANGE --> +<br /> +<div align="center"> + <form method="post" action="manage_proj_mail_update.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <table class="width75" cellspacing="1"> + <tr> + <td class="form-title" colspan="4"> + <?php echo 'Mail Account Settings' ?> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Host"?> + </td> + <td width="75%"> + <input type="text" name="pop3_host" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_host'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 User"?> + </td> + <td width="75%"> + <input type="text" name="pop3_user" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_user'] ) ?>" /> + </td> + </tr> + <tr class="row-1"> + <td class="category" width="25%"> + <?php echo "POP3 Password"?> + </td> + <td width="75%"> + <input type="text" name="pop3_pass" size="64" maxlength="255" value="<?php echo string_attribute( $mail['pop3_pass'] ) ?>" /> + </td> + </tr> + <tr> + <td colspan="2"> + <input type="submit" value="<?php echo 'Set Mail Account Data' ?>" /> + </td> + </tr> + </table> + </form> +</div> +<!-- MAIL ACCOUNT RESET --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_delete.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="submit" value="<?php echo 'Delete Mail Account Data' ?>" /> + </form> +</div> +<br /> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="On" /> + <input type="submit" value="<?php echo 'Activate Mail Account per Category' ?>" /> + </form> +</div> +<?php } else { ?> +<!-- MAIL ACCOUNT CATEGORIES --> +<div class="border-center"> + <form method="post" action="manage_proj_mail_categories.php"> + <input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" /> + <input type="hidden" name="categories" value="Off" /> + <input type="submit" value="<?php echo 'Deactivate Mail Account per Category' ?>" /> + </form> +</div> +<?php } ?> <?php html_page_bottom1( __FILE__ ) ?> diff -Nur mantis-1.0.0rc3.orig/manage_proj_mail_categories.php mantis-1.0.0rc3/manage_proj_mail_categories.php --- mantis-1.0.0rc3.orig/manage_proj_mail_categories.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/manage_proj_mail_categories.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_activate = gpc_get_string( 'categories' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_categories( $f_project_id, $f_activate ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc3.orig/manage_proj_mail_delete.php mantis-1.0.0rc3/manage_proj_mail_delete.php --- mantis-1.0.0rc3.orig/manage_proj_mail_delete.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/manage_proj_mail_delete.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,43 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + mail_delete( $f_project_id ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + diff -Nur mantis-1.0.0rc3.orig/manage_proj_mail_update.php mantis-1.0.0rc3/manage_proj_mail_update.php --- mantis-1.0.0rc3.orig/manage_proj_mail_update.php Thu Jan 1 01:00:00 1970 +++ mantis-1.0.0rc3/manage_proj_mail_update.php Mon Oct 31 11:18:41 2005 @@ -0,0 +1,58 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # Copyright (C) 2004 Gerrit Beine - gerrit.beine@pitcom.de + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id$ + # -------------------------------------------------------- + + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path . 'mail_api.php' ); + + $f_project_id = gpc_get_int( 'project_id' ); + $f_pop3_host = gpc_get_string( 'pop3_host' ); + $f_pop3_user = gpc_get_string( 'pop3_user' ); + $f_pop3_pass = gpc_get_string( 'pop3_pass' ); + + access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); + + if ( is_blank( $f_pop3_host ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + else { + if ( is_blank( $f_pop3_user ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + if ( is_blank( $f_pop3_pass ) ) { + trigger_error( ERROR_EMPTY_FIELD, ERROR ); + } + } + + mail_update( $f_project_id, $f_pop3_host, $f_pop3_user, $f_pop3_pass ); + + $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; + + html_page_top1(); + + html_meta_redirect( $t_redirect_url ); + + html_page_top2(); +?> + +<br /> +<div align="center"> +<?php + echo lang_get( 'operation_successful' ) . '<br />'; + + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); +?> +</div> + +<?php html_page_bottom1( __FILE__ ) ?> + Parser.php (5,175 bytes)
<?php require_once( 'Mail/mimeDecode.php' ); class Mail_Parser { private $_parse_html = false; private $_parse_mime = false; private $_htmlparser = "/usr/bin/w3m -T text/html -dump"; private $_htmltmpdir = "/tmp"; private $_file; private $_content; private $_from; private $_subject; private $_transferencoding; private $_body; private $_parts = array ( ); private $_ctype = array ( ); function __construct( $options = array() ) { $this->_parse_mime = $options['parse_mime']; $this->_parse_html = $options['parse_html']; $this->_htmlparser = $options['htmlparser']; $this->_htmltmpdir = $options['htmltmpdir']; } public function setInputString ( $content ) { $this->_content = $content; } public function setInputFile( $file ) { $this->_file = $file; $this->_content = file_get_contents( $this->_file ); } public function parse() { $decoder = new Mail_mimeDecode( $this->_content ); $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; $structure = $decoder->decode( $params ); $this->parseStructure( $structure ); unset( $this->_content ); } public function from() { return $this->_from; } public function subject() { return $this->_subject; } public function priority() { return $this->_priority; } public function body() { return $this->_body; } public function parts() { return $this->_parts; } private function parseStructure( $structure ) { $this->setFrom( $structure->headers['from'] ); $this->setSubject( $structure->headers['subject'] ); $this->setContentType( $structure->ctype_primary, $structure->ctype_secondary ); if ( isset( $structure->headers['x-priority'] ) ) { $this->setPriority( $structure->headers['x-priority'] ); } if ( isset( $structure->headers['content-transfer-encoding'] ) ) { $this->setTransferEncoding( $structure->headers['content-transfer-encoding'] ); } if ( isset( $structure->body ) ) { $this->setBody( $structure->body ); } if ( $this->_parse_mime && isset( $structure->parts ) ) { $this->setParts( $structure->parts ); } } private function setFrom( $from ) { $this->_from = quoted_printable_decode( $from ); } private function setSubject( $subject ) { $this->_subject = quoted_printable_decode( $subject ); } private function setPriority( $priority ) { $this->_priority = $priority; } private function setTransferEncoding( $transferencoding ) { $this->_transferencoding = $transferencoding; } private function setContentType( $primary, $secondary ) { $this->_ctype['primary'] = $primary; $this->_ctype['secondary'] = $secondary; } private function setBody( $body ) { if ( 0 == strlen( $body ) || 0 != strlen( $this->_body ) ) { return; } if ( 'text' == $this->_ctype['primary'] && 'plain' == $this->_ctype['secondary'] ) { switch ( $this->_transferencoding ) { case 'base64': case '8bit': case 'quoted-printable': $this->_body = quoted_printable_decode( $body ); break; default: $this->_body = $body; break; } } elseif ( $this->_parse_html && 'text' == $this->_ctype['primary'] && 'html' == $this->_ctype['secondary'] ) { $file = $this->_htmltmpdir . "/" . md5 ( $body ); file_put_contents( $file, $body ); // (brody): // unix/piped: $this->_body = shell_exec("cat " . $file . " | " . $this->_htmlparser); // windows and parameter: $this->_body = shell_exec($this->_htmlparser . " " . $file); unlink($file); } } private function setParts( &$parts) { $i = 0; if ( 'multipart' == $parts[$i]->ctype_primary ) { $this->setParts( $parts[$i]->parts ); $i++; } // FIX(brody): use parts of type (text/plain,html) as body , if not classified as attachment (disposition) if ( 'text' == $parts[$i]->ctype_primary && in_array( $parts[$i]->ctype_secondary, array( 'plain', 'html' ) ) && (! isset ($parts[$i]->disposition)) ) { $this->setContentType( $parts[$i]->ctype_primary, $parts[$i]->ctype_secondary ); $this->setTransferEncoding( $parts[$i]->headers['content-transfer-encoding'] ); $this->setBody( $parts[$i]->body ); $i++; } if ( isset( $parts[$i] ) && 'text' == $parts[$i]->ctype_primary && 'html' == $parts[$i]->ctype_secondary ) { $i++; } for ( $i; $i < count( $parts ); $i++ ) { $this->addPart( $parts[$i] ); } } private function addPart( &$part ) { $p['ctype'] = $part->ctype_primary . "/" . $part->ctype_secondary; if ( isset( $part->ctype_parameters['name'] ) ) { $p['name'] = $part->ctype_parameters['name']; } $p['body'] = $part->body; $this->_parts[] = $p; } } ?> Parser.php.patch (801 bytes)
128c128 < $ this ->_body = shell_exec( " cat " . $file . " | " . $this->_htmlparser) ; --- > / / ( brody ) : 128a129,131 > // unix/piped: $this->_body = shell_exec("cat " . $file . " | " . $this->_htmlparser); > // windows and parameter: > $this->_body = shell_exec($this->_htmlparser . " " . $file); 133c136 < private function setParts( &$parts ) { $i = 0; --- > private function setParts( &$parts) { $i = 0; 137a141 > // FIX(brody): use parts of type (text/plain,html) as body , if not classified as attachment (disposition) 139c143 < in_array( $parts[$i]->ctype_secondary, array( 'plain', 'html' ) ) ) { --- > in_array( $parts[$i]->ctype_secondary, array( 'plain', 'html' ) ) && (! isset ($parts[$i]->disposition)) ) { mail_api.php.patch (2,517 bytes)
220a221 > $t_mail_debug = config_get( 'mail_debug' ); 221a223,224 > // get stamp of (prev) last processed mail > $t_mail_last_processed = config_get( 'pop3_last_mail_ds',null ,null ,$p_account['id']); 251a255 > if ( null == $t_mail_last_processed || $t_mail['Datestamp'] > $t_mail_last_processed ) { 253a258,263 > $t_mail_last_processed = $t_mail['Datestamp']; > } else { > if ( $t_mail_debug ) { > echo "\nMail skipped - to old against last checked mail!\n"; > } > } 261a272,273 > // save stamp of last processed mail > config_set( 'pop3_last_mail_ds', $t_mail_last_processed , null, $p_account['id']); 287a300,301 > $t_mail['Datestamp'] = strtotime($t_mp->date()); > 302c316 < if ( true == $t_mail_use_bug_priority ) { --- > / / FIXED( wb ) 302a317 > if ( $t_mail_use_bug_priority ) { 308,309c323,324 < if ( true == $t_mail_additional ) { < $ t_mail [ ' X-Mantis-Complete'] = $t_msg; --- > / / FIXED( wb ) > if ( $ t_mail_additional ) { 309a325 > $t_mail['X-Mantis-Complete'] = $p_mail; 383c401 < function mail_add_file( $p_bug_id, $p_part, $number ) { --- > function mail_add_file( $p_bug_id, $p_part, $number = 0 ) { 384a403,405 > $t_attachment_directory = config_get( 'mail_tmp_directory' ); > > if ( is_dir($t_attachment_directory) && is_writeable($t_attachment_directory) ) { 386c407 < $t_file_name = ' /tmp/'.$p_part['name']; --- > $t_file_name = $t_attachment_directory . ' /'.$p_part['name']; 388c409 < file_add($ p_bug_id, $t_file_name, $number . " -".$p_part['name'], $p_part['ctype'], 'bug') ; --- > if($ number > 0 ) { 388a410,413 > file_add($p_bug_id, $t_file_name, $number."_".$p_part['name'], $p_part['ctype'], 'bug'); > } else { > file_add($p_bug_id, $t_file_name, $p_part['name'], $p_part['ctype'], 'bug'); > } 391a417 > } 395c421 < $t_mail_directory = config_get( 'mail_directory' ); --- > $t_mail_directory = config_get( 'mail_tmp_directory' ); 443a470,473 > # FIX(wb) Wo made (optionally) the note (From) > if ( $t_mail_save_from ) { > bugnote_add ( $t_bug_id, "(<b>".$p_mail['From']."</b>):\n".$p_mail['X-Mantis-Body'] ); > } else { 444a475 > } 456c487 < # Add files --- > # Add files, number removed 458c489 < $number = 1; --- > # $number = 1; 460c491 < mail_add_file ( $t_bug_id, $part, $number ); --- > mail_add_file ( $t_bug_id, $part ); 1202890957da93014a9e1d86b8b0fc26e66b637721 (12,353 bytes)
Received: from dapozzom01 ([10.221.4.105]) by servpro.lispa.it (Lotus Domino Release 7.0.2FP2) with ESMTP id 2008021309202397-6980 ; Wed, 13 Feb 2008 09:20:23 +0100 From: "Marco Da Pozzo" <marco.dapozzo@lombardia-servizi.it> To: "mantisLoto" <mantis.Loto@lombardia-servizi.it> Subject: oggetto Date: Wed, 13 Feb 2008 09:22:25 +0100 MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AchuGY7No6xm4wacSNy1ptxAWPileA== X-MIMETrack: Itemize by SMTP Server on SERVPRO/Lombardia Informatica/IT(Release 7.0.2FP2|May 14, 2007) at 13/02/2008 09:20:24, Serialize by Router on SERVPRO/Lombardia Informatica/IT(Release 7.0.2FP2|May 14, 2007) at 13/02/2008 09:20:25, Serialize complete at 13/02/2008 09:20:25, Itemize by Router on SERVPRO/Lombardia Informatica/IT(Release 7.0.2FP2|May 14, 2007) at 13/02/2008 09:20:25, Serialize by POP3 Server on SERVPRO/Lombardia Informatica/IT(Release 7.0.2FP2|May 14, 2007) at 13/02/2008 09:20:36, Serialize complete at 13/02/2008 09:20:36 Message-ID: <OFA1C24376.35B8287E-ONC12573EE.002DD070@lispa.it> Content-Type: multipart/mixed; boundary="----=_NextPart_000_00BE_01C86E21.F267BC80" ------=_NextPart_000_00BE_01C86E21.F267BC80 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Corpo mail Corpo mail Corpo mail Corpo mailCorpo mail Corpo mailCorpo mail Corpo mailCorpo mail Corpo mailCorpo mail Corpo mailCorpo mail Corpo mailCorpo mail Corpo mailCorpo mail Corpo mail ------=_NextPart_000_00BE_01C86E21.F267BC80 Content-Type: application/octet-stream; name="README.bug_report_mail" Content-Disposition: attachment; filename="README.bug_report_mail" Content-Transfer-Encoding: base64 VGhlIGN1cnJlbnQgdmVyc2lvbiBvZiBidWdfcmVwb3J0X21haWwgc3VwcG9ydCBwbGFpbiB0ZXh0 IGFuZCBNSU1FDQplbmNvZGVkIGUtbWFpbHMgdmlhIFBPUDMgTWFpbGFjY291bnRzIHdpdGggUEVB UidzIE5ldF9QT1AzIHBhY2thZ2UuDQoNCmJ1Z19yZXBvcnRfbWFpbCBpcyBhYmxlIHRvIHJlY29n bml6ZSBpZiBtYWlsIGlzIGEgcmVwbHkgdG8gYW4gYWxyZWFkeSBvcGVuZWQNCmJ1ZyBhbmQgYWRk cyB0aGUgY29udGVudCBhcyBhIGJ1Z25vdGUuDQoNCklmIHlvdSBhcmUgYWx3YXkgcnVubmluZyBN YW50aXMgeW91IGhhdmUgdG8gYWx0ZXIgeW91ciBwcm9qZWN0cyB0YWJsZQ0Kd2l0aCB0aGUgc3Fs L2J1Z19yZXBvcnRfbWFpbC5zcWwgc2NyaXB0Lg0KSWYgbm90LCB5b3UgY2FuIGNyZWF0ZSB0aGUg ZGF0YWJhc2UgdGFibGVzIGluIHRoZSB3YXkgZGVzY3JpYmVkIGluDQp0aGUgZG9jL0lOU1RBTEwg ZmlsZS4NCg0KVGhpcyBwYXRjaCBjaGFuZ2VzIHRoZSBmb2xsb3dpbmcgZmlsZXM6DQogICAgY29y ZS9jYXRlZ29yeV9hcGkucGhwDQogICAgY29yZS9maWxlX2FwaS5waHANCiAgICBjb3JlL3VzZXJf YXBpLnBocA0KICAgIGFkbWluL3NjaGVtYS5waHANCiAgICBjb25maWdfZGVmYXVsdHNfaW5jLnBo cA0KICAgIG1hbmFnZV9wcm9qX2NhdF9lZGl0X3BhZ2UucGhwDQogICAgbWFuYWdlX3Byb2pfZWRp dF9wYWdlLnBocA0KVGhlc2UgZmlsZXMgYXJlIG5ldzoNCiAgICBNYWlsL21pbWUucGhwDQogICAg TWFpbC9taW1lRGVjb2RlLnBocA0KICAgIE1haWwvbWltZVBhcnQucGhwDQogICAgTWFpbC9QYXJz ZXIucGhwDQogICAgTmV0L1BPUDMucGhwDQogICAgTmV0L1NvY2tldC5waHANCiAgICBjb3JlL21h aWxfYXBpLnBocA0KICAgIGRvYy9SRUFETUUuYnVnX3JlcG9ydF9tYWlsDQogICAgZG9jL2J1Z19y ZXBvcnRfbWFpbC5zcWwNCiAgICBQRUFSLnBocA0KICAgIGJ1Z19yZXBvcnRfbWFpbC5waHANCiAg ICBtYW5hZ2VfcHJval9jYXRfbWFpbF9kZWxldGUucGhwDQogICAgbWFuYWdlX3Byb2pfY2F0X21h aWxfdXBkYXRlLnBocA0KICAgIG1hbmFnZV9wcm9qX21haWxfY2F0ZWdvcmllcy5waHANCiAgICBt YW5hZ2VfcHJval9tYWlsX2RlbGV0ZS5waHANCiAgICBtYW5hZ2VfcHJval9tYWlsX3VwZGF0ZS5w aHANCg0KQWZ0ZXIgaW5zdGFsbGluZyB0aGlzIHBhdGNoLCB5b3UgY2FuIGFkZCBhIFBPUDMgc2Vy dmVyJ3MgaG9zdG5hbWUNCmFuZCBhdXRoZW50aWNhdGlvbiBkYXRhIGZvciBlYWNoIG9mIHlvdXIg cHJvamVjdHMgd2l0aCB0aGUgcHJvamVjdCBlZGl0IGZvcm0uDQoNClRoZXJlIGFyZSB0d28gd2F5 cyB0byByZWNlaXZlIG1haWwgd2l0aCBidWdfcmVwb3J0X21haWw6DQpUaGUgc2VjdXJlIChhbmQg ZGVmYXVsdCkgd2F5IGlzIHRvIHVzZSBhIHN0YW5kYXJkIHJlcG9ydGluZyB1c2VyOg0KWW91IGhh dmUgdG8gY3JlYXRlIGEgcmVwb3J0ZXIgYWNjb3VudCwgZm9yIGV4YW1wbGUgJ01haWwnLg0KVGhl IG5hbWUgZm9yIHRoaXMgcmVwb3J0ZXIgYWNjb3VudCB5b3UgaGF2ZSB0byB3cml0ZSBpbiB5b3Vy IGNvbmZpZ19pbmMucGhwIGZpbGU6DQoJJGdfbWFpbF9yZXBvcnRlciA9ICJNYWlsIjsNCmFuZCB0 aGVuLCBidWdfcmVwb3J0X21haWwgbXVzdCBiZSBpbmZvcm1lZCB0byBiZWhhdmUgbGlrZSB0aGlz Og0KCSRnX21haWxfdXNlX3JlcG9ydGVyID0gT047DQoNClRoZSBvdGhlciB3YXkgaXMgdG8gc2ln bnVwIG5ldyB1c2VyIGFjY291bnRzIGF1dG9tYXRpY2FsbHkuDQpGb3IgdXNpbmcgdGhpcywgeW91 IGhhdmUgdG8gY2hhbmdlIHRoaXMNCgkkZ19tYWlsX2F1dG9fc2lnbnVwICAgICA9IE9GRjsNCmZy b20gT0ZGIHRvIE9OLg0KTm93LCBidWdfcmVwb3J0X21haWwgd2lsbCBsb29rIGZvciBhbiB1c2Vy IG5hbWVkIGxpa2UgdGhlIG1haWwncyBzZW5kZXINCm9yIGFuIHVzZXIgd2hpY2ggbWFpbCBhZHJl c3MgaXMgaWRlbnRpY2FsLg0KSWYgbm8gdXNlciBpcyBmb3VuZCwgdGhlbiBhIG5ldyBhY2NvdW50 IHdpbGwgYmUgY3JlYXRlZC4NClRoZSBuZXcgdXNlcidzIG5hbWUgd2lsbCBiZSB0aGUgbWFpbCBh ZGRyZXNzLg0KDQpUaGlzIGNvdWxkIGJlIHVzZWQgZm9yIGF0dGFja3MsIGJ1dCB0aGVyZSBpcyBu byBvdGhlciB3YXkgaW4gdGhlIG1vbWVudC4NCg0KSWYgeW91IGxpa2UgdG8gcGFyc2UgTUlNRSBl bmNvZGVkIG1haWxzLCB5b3UgaGF2ZSB0byBpbnN0YWxsIHRoZSBQRUFSDQpNYWlsX01pbWUgcGFj a2FnZSBhbmQgc2V0DQoJJGdfbWFpbF9wYXJzZV9taW1lCT0gT0ZGOw0KZnJvbSBPRkYgdG8gT04u DQoNCkZvciBwYXJzaW5nIEhUTUwgbWFpbHMsIHNldCANCgkkZ19tYWlsX3BhcnNlX2h0bWwJPSBP TjsNCmFuZCBzZXQgDQoJJGdfbWFpbF9odG1sX3BhcnNlcg0KdG8gYSB2YWxpZCB0b29sIGZvciBk dW1waW5nIEhUTUwgY29udGVudHMgKCIvdXNyL2Jpbi93M20gLVQgdGV4dC9odG1sIC1kdW1wIikN CkFsc28sIA0KCSRnX21haWxfdG1wX2RpcmVjdG9yeQ0KaGFzIHRvIGJlIGEgdmFsaWQgZGlyZWN0 b3J5IHRvIGhhbmRsZSB3cml0ZSB0aGUgdGVtcG9yYXJ5IEhUTUwgZmlsZXMuDQoNCkZvciBkZWJ1 Z2dpbmcgY29udHJvbHMgdGhlcmUgaXMgdGhlIHN3aXRjaA0KCSRnX21haWxfYWRkaXRpb25hbAk9 IE9GRjsNCndoaWNoIHB1dHMgdGhlIGNvbXBsZXRlIG1lc3NhZ2UgaW50byB0aGUgQWRkaXRpb25h bCBJbmZvcm1hdGlvbiBmaWVsZCwNCmlmIGl0IGlzIGFjdGl2YXRlZC4NCg0KSWYgeW91IGxpa2Ug dG8gc2VlIHdoYXQgYnVnX3JlcG9ydF9tYWlsLnBocCBpcyBkb2luZywgc2V0DQoJJGdfbWFpbF9k ZWJ1ZyA9IE9OOw0KDQpJZiAkZ19tYWlsX2RpcmVjdG9yeSBpcyBhIHZhbGlkIGRpcmVjdG9yeSBh bmQgYWxzbyB3cml0ZWFibGUsDQp0aGUgY29tcGxldGUgbWFpbHMgd2lsbCBiZSBzYXZlZCB0byB0 aGlzIGRpcmVjdG9yeS4NCg0KSW4gdGhpcyBjYXNlIHlvdSBzaG91bGQgZGVjcmVhc2UgdGhlIGFt b3VudCBvZiBmZXRjaGVkIG1lc3NhZ2VzIHZpYQ0KCSRnX21haWxfZmV0Y2hfbWF4CT0gMTsNCmJl Y2F1c2UgdGhlIG1pbWUgZGVjb2RpbmcgbmVlZHMgYSBsb3Qgb2YgbWVtb3J5Lg0KDQpJZiB5b3Un ZCBsaWtlIHRvIHVzZSB0aGUgTWFpbCBSZXBvcnRlciBidXQgZG9uJ3Qgc2F2ZSB0aGUgd2hvbGUg bWVzc2FnZSBmb3INCm1ha2luZyB0aGUgc2VuZGVyJ3MgYWRkcmVzcyBhdmFpbGFibGUsIHNldA0K CSRnX21haWxfc2F2ZV9mcm9tCT0gT0ZGOw0KdG8gT04uDQoNCklmIHlvdSBkb24ndCB3YW50IGJ1 Z19yZXBvcnRfbWFpbC5waHAgdG8gZGVsZXRlIHRoZSBtYWlscyBmcm9tIHlvdXIgUE9QMw0Kc2Vy dmVyIHNldA0KCSRnX21haWxfZGVsZXRlID0gT0ZGOw0KVXNlIHRoaXMgY2FyZWZ1bGx5IQ0KDQpX aXRoIA0KCSRnX21haWxfYXV0aF9tZXRob2QNCnlvdSBtYXkgc2V0IHRoZSBBVVRIIG1ldGhvZCBm b3IgeW91ciBQT1AzIHNlcnZlci4gRGVmYXVsdCBpcyAnVVNFUicsDQpidXQgJ0RJR0VTVC1NRDUn LCdDUkFNLU1ENScsJ0xPR0lOJywnUExBSU4nLCdBUE9QJyBhcmUgYWxzbyBwb3NzaWJsZQ0KDQpG b3IgdXNpbmcgdGhlIHByaW9yaXR5IG9mIHRoZSBtYWlscyBmb3IgdGhlIGJ1ZyBwcmlvcml0eSwg c2V0DQoJJGdfbWFpbF91c2VfYnVnX3ByaW9yaXR5ID0gT047DQpUaGUNCgkkZ19tYWlsX2J1Z19w cmlvcml0eV9kZWZhdWx0ID0gTk9STUFMOw0KaXMgdGhlIGRlZmF1bHQgdmFsdWUgZm9yIHRoZSBw cmlvcml0eSBvZiBuZXcgYnVnIGVudHJpZXMuDQoNCkRlZmF1bHQgYnVnIGNhdGVnb3J5IGZvciBt YWlsIHJlcG9ydGVkIGJ1Z3MgKERlZmF1bHRzIHRvICJkZWZhdWx0X2J1Z19jYXRlZ29yeSIpDQpC ZWNhdXNlIGluIE1hbnRpcyAxLjEuMGEzIGEgY2F0ZWdvcnkgaXMgcmVxdWlyZWQsIHdlIG5lZWQg YSBkZWZhdWx0IGNhdGVnb3J5IGZvciBpc3N1ZXMgcmVwb3J0ZWQgYnkgZW1haWwuDQpNYWtlIHN1 cmUgdGhlIGNhdGVnb3J5IGV4aXN0cyBhbmQgaXQgaGFzIGJlZW4gY29uZmlndXJlZCBjb3JyZWN0 bHkNCgkkZ19tYWlsX2RlZmF1bHRfYnVnX2NhdGVnb3J5ID0gJyVkZWZhdWx0X2J1Z19jYXRlZ29y eSUnOw0KDQpBZnRlciB0aGlzLCBidWdfcmVwb3J0X21haWwgY2FuIGJlIHVzZWQgdmlhIGNyb24g bGlrZSB0aGlzOg0KDQoqLzUgKiAgICogICAqICAgKiBseW54IC0tZHVtcCBodHRwOi8vbWFudGlz LmhvbWVwYWdlLmNvbS9idWdfcmVwb3J0X21haWwucGhwDQpvciB2aWEgY29tbWFuZCBsaW5lIGlu dGVyZmFjZQ0KKi81ICogICAqICAgKiAgICogL3Vzci9sb2NhbC9iaW4vcGhwIC9wYXRoL3RvL21h bnRpcy9idWdfcmVwb3J0X21haWwucGhwDQoNClRoaXMgbGluZSBmZXRjaCBidWcgcmVwb3J0cyBm cm9tIHZpYSBQT1AzIGV2ZXJ5IDUgbWludXRlcy4gDQoNClRoaXMgYWRkb24gaXMgZGlzdHJpYnV0 ZWQgdW5kZXIgdGhlIHNhbWUgY29uZGl0aW9ucyBhcyBNYW50aXMgaXRzZWxmLg0KDQpHZXJyaXQg QmVpbmUsIEF1Z3VzdCAyMDA0DQoNCkNoYW5nZWxvZzoNCkp1biAyMDA3DQoJLSB1cGRhdGUgdG8g TWFudGlzIDEuMS4wYTMNCgktIFN1cHBvcnQgZm9yIFBIUCA0ICggfjEzODA1ICkNCgktIEZpeGVk IGEgYnVnIHdpdGggcHJvY2Vzc2luZyBwcmlvcml0eSdzIG9mIGVtYWlscyAocHJpb3JpdHkgY2xh c3MgdmFyaWFibGUgZGlkbid0IGV4aXN0IGluIE1haWwvUGFyc2VyLnBocCkNCgktIFVwZGF0ZXMg dG8gdGhlIGxhdGVzdCBQRUFSIHBhY2thZ2VzDQoJLSBwcmludF9yIGNoYW5nZWQgdG8gdmFyX2R1 bXAncyAoV29ya3MgYmV0dGVyIGlmIHlvdSBoYXZlIHhkZWJ1ZyBleHRlbnNpb24gaW5zdGFsbGVk KQ0KCS0gTmV3IGNvbmZpZyBzZXR0aW5nIGNhbGxlZDoNCgkJIyBEZWZhdWx0IGJ1ZyBjYXRlZ29y eSBmb3IgbWFpbCByZXBvcnRlZCBidWdzIChEZWZhdWx0cyB0byAiZGVmYXVsdF9idWdfY2F0ZWdv cnkiKQ0KCQkjIEJlY2F1c2UgaW4gTWFudGlzIDEuMS4wYTMgYSBjYXRlZ29yeSBpcyByZXF1aXJl ZCwgd2UgbmVlZCBhIGRlZmF1bHQgY2F0ZWdvcnkgZm9yIGlzc3VlcyByZXBvcnRlZCBieSBlbWFp bC4NCgkJIyBNYWtlIHN1cmUgdGhlIGNhdGVnb3J5IGV4aXN0cyBhbmQgaXQgaGFzIGJlZW4gY29u ZmlndXJlZCBjb3JyZWN0bHkNCgkJJGdfbWFpbF9kZWZhdWx0X2J1Z19jYXRlZ29yeSA9ICclZGVm YXVsdF9idWdfY2F0ZWdvcnklJzsNCgktIEZpeGVkIGEgbWlzc2luZyB2YXJpYWJsZSBpbiB0aGUg ZnVuY3Rpb246ICJtYWlsX3Byb2Nlc3NfYWxsX21haWxzIg0KCQkkdF9tYWlsX2RlYnVnIHdhcyBu b3Qgc2V0IGFuZCB3b3VsZCBjYXVzZSBub3RpY2UgbGV2ZWwgZXJyb3JzIGFuZCBkZWJ1ZyBtb2Rl IGluIHRoaXMgZnVuY3Rpb24gd291bGRuJ3Qgd29yayAoIH4xMzg1NCApDQoJLSBFbWFpbHMgYXJl IG5vdyBub3QgYWxsd2F5cyBzYXZlZCB0byBkaXNrICggfjEzODU0ICkNCgktIE1hZGUgc3VyZSAk dF9tYWlsWydYLU1hbnRpcy1Db21wbGV0ZSddIHdvdWxkIGFsbHdheXMgYmUgcG9wdWxhdGVkICgg d2l0aCBudWxsIHZhbHVlIGlmIHRoZSBjb25maWcgIm1haWxfYWRkaXRpb25hbCIgd2FzIGRpc2Fi bGVkICkNCgktIEFkZGluZyBhdHRhY2htZW50cyB0byBidWcgaXRlbXMgbm93IGFsc28gd29ya3Mg b24gV2luZG93cyBzeXN0ZW1zIChSZW1vdmVkIGhhcmRjb2RlZCBkaXJlY3RvcnkgcGFydCAiL3Rt cC8iKS4NCgktIFRoZSBzdWJqZWN0IG9mIGFuIGVtYWlsIGlzIG5vdyBhbHNvIHRyaW1tZWQgYmVm b3JlIHN0b3JpbmcgaXQgaW4gJHRfYnVnX2RhdGEtPnN1bW1hcnkuIExpa2UgaXQgaXMgaW4gYnVn X3JlcG9ydC5waHANCgktIEZpeGVkIHByb2JsZW0gd2l0aCBkdXBsaWNhdGUgYXR0YWNobWVudHMg KCB+MTQyNTUgYW5kIH4xNDI1NiApDQpBdWcgMjAwNg0KCS0gdXBkYXRlIHRvIE1hbnRpcyAxLjAu NQ0KCS0gbWFpbCBwYXJzaW5nIGNvbXBsZXRlbHkgcmV3cml0dGVuDQoJLSBpbmNsdWRlIGFkZGl0 aW9uYWwgcGF0Y2hlcyBzdWJtaXR0ZWQgYnkNCgkJLSBjYXMgKGhhbmRsaW5nIG9mIGF0dGFjaG1l bnRzIGFuZCBlbXB0eSBmaWVsZHMpDQoJCSAgbWFpbF9hZGRfZmlsZSBpbiBjb3JlL21haWwuYXBp DQoJCSAgbWFpbF9hZGRfYnVnIGluIGNvcmUvbWFpbC5hcGkNCk1heSAyMDA2DQoJLSB1cGRhdGUg dG8gTWFudGlzIDEuMC4zDQoJLSBhZGRlZCBzdXBwb3J0IGZvciBIVE1MIG1haWwNCgktIGFkZGVk IHN1cHBvcnQgZm9yIGVuY29kZWQgbWFpbCBib2RpZXMgYW5kIHN1YmplY3RzDQoJLSBjaGFuZ2Vk IGhhbmRsaW5nIG9mIG1haWwNCgktIHRoZSBnbG9iYWwgbWFpbF9kZWJ1ZyBjb25maWd1cmF0aW9u IG9wdGlvbiBpcyBub3cgc2V0IE9GRiBieSBkZWZhdWx0DQoJLSBpbmNsdWRlIHRoZSBhZGRpdGlv bmFsIHBhdGNoZXMgc3VibWl0dGVkIGJ5DQoJCS0gRUJZIChzdXBwb3J0IGZvciBwcmlvcml0aWVz IGFuZCBmaWxlIHVwbG9hZHMpDQoJCSAgZmlsZV9hZGQgaW4gY29yZS9maWxlX2FwaS5waHANCgkJ ICBtYWlsX3BhcnNlX2NvbnRlbnQgaW4gY29yZS9tYWlsX2FwaS5waHANCgkJICBjb25maWdfZGVm YXVsdHNfaW5jLnBocA0KRGVjIDIwMDUNCgktIHVwZGF0ZSB0byBNYW50aXMgMS4wLjByYzQNCgkt IHVwZGF0ZSB0byBNYW50aXMgMC4xOS40DQpPY3QgMjAwNQ0KCS0gdXBkYXRlIHRvIE1hbnRpcyAx LjAuMHJjMw0KCS0gdXBkYXRlIHRvIE1hbnRpcyAwLjE5LjMNClNlcCAyMDA1Og0KCS0gdXBkYXRl IHRvIE1hbnRpcyAxLjAuMHJjMg0KCS0gZml4ZWQgYSBidWcgaW4gZ2V0dGluZyBhbGwgY2F0ZWdv cmllcyBmb3IgYSBwcm9qZWN0DQoJCWNhdGVnb3J5X2dldF9hbGxfcm93cyBpbiBjb3JlL2NhdGVn b3J5X2FwaS5waHANCkF1ZyAyMDA1Og0KCS0gdXBkYXRlIHRvIE1hbnRpcyAxLjAuMHJjMQ0KCS0g aW5jbHVkZSB0aGUgYWRkaXRpb25hbCBwYXRjaGVzIHN1Ym1pdHRlZCBieSAgICAgIA0KCQktIGdl cm5vdCAoRml4ZWQgTUlNRSBoYW5kbGluZyBhbmQgc2F2ZSB0aGUgbWFpbCdzIHNlbmRlcikNCgkJ ICBtYWlsX2dldF9hbGxfbWFpbHMgaW4gY29yZS9tYWlsX2FwaS5waHANCgkJICBtYWlsX3BhcnNl X2NvbnRlbnQgaW4gY29yZS9tYWlsX2FwaS5waHANCgkJICBtYWlsX2FkZF9idWcgaW4gY29yZS9t YWlsX2FwaS5waHANCgkJLSBzdGV2ZW5jIChGaXhlZCBNSU1FIGhhbmRsaW5nKQ0KCQkgIG1haWxf cGFyc2VfY29udGVudCBpbiBjb3JlL21haWxfYXBpLnBocA0KCQktIHJhaW5tYW4gKEZpeGVkIGVt cHR5IGZpbGVzIGJ1ZyBhbmQgcmVnZXggZm9yIGZpbmRpbmcgYSBidWcgaWQpDQoJCSAgbWFpbF9h ZGRfZmlsZSBpbiBjb3JlL21haWxfYXBpLnBocA0KCQkgIG1haWxfZ2V0X2J1Z19pZF9mcm9tX3N1 YmplY3QgaW4gY29yZS9tYWlsX2FwaS5waHANCkRlYyAyMDA0Og0KCS0gdXBkYXRlIHRvIE1hbnRp cyAwLjE5LjINCgktIGFkZCBjb25maWc6IGdfbWFpbF9wYXJzZV9taW1lDQoJLSBhZGQgY29uZmln OiBnX21haWxfYWRkaXRpb25hbA0KCS0gYWRkIGNvbmZpZzogZ19tYWlsX2ZldGNoX21heA0KCS0g bWFrZSBpdCB3b3JraW5nIHZpYSBDTEkNCk5vdiAyMDA0Og0KCS0gdXBkYXRlIHRvIE1hbnRpcyAw LjE5LjENCgktIGFkZCBzdXBwb3J0IGZvciBNSU1FIGRlY29kaW5nDQpTZXAgMjAwNDoNCgktIHVw ZGF0ZSB0byBNYW50aXMgMC4xOS4wDQpBdWcgMjAwNDoNCgktIGNyZWF0ZSBwYXRjaCBmb3IgTWFu dGlzIDAuMTguMw0KDQo= ------=_NextPart_000_00BE_01C86E21.F267BC80-- recmail.patch (3,954 bytes)
diff -ur Recmail-orig/pages/recmail_add.php Recmail/pages/recmail_add.php --- Recmail-orig/pages/recmail_add.php 2009-02-10 16:58:06.000000000 +0530 +++ Recmail/pages/recmail_add.php 2009-02-10 16:59:40.000000000 +0530 @@ -1,6 +1,6 @@ <?php $t_plugin_path = config_get( 'plugin_path' ); -require_once( $t_plugin_path . 'Recmail\api\mail_api.php' ); +require_once( $t_plugin_path . 'Recmail/api/mail_api.php' ); # Update mailbox $f_mailbox_name = gpc_get_string( 'mailbox_name' ); $f_pop3_host = gpc_get_string( 'mail_pop3_host' ); @@ -29,4 +29,4 @@ echo '</div>'; html_page_bottom1(); } -?> \ No newline at end of file +?> diff -ur Recmail-orig/pages/recmail_delete.php Recmail/pages/recmail_delete.php --- Recmail-orig/pages/recmail_delete.php 2009-02-10 16:58:06.000000000 +0530 +++ Recmail/pages/recmail_delete.php 2009-02-10 17:00:20.000000000 +0530 @@ -1,8 +1,8 @@ <?php $t_plugin_path = config_get( 'plugin_path' ); -require_once( $t_plugin_path . 'Recmail\api\mail_api.php' ); +require_once( $t_plugin_path . 'Recmail/api/mail_api.php' ); $f_box_id = gpc_get_int( 'mailbox_id' ); $query = "delete from $g_mantis_recmail_table where mailbox_id=$f_box_id limit 1 "; $result = db_query( $query ); print_successful_redirect( plugin_page( 'setpop',TRUE ) ); -?> \ No newline at end of file +?> diff -ur Recmail-orig/pages/recmail_edit_page.php Recmail/pages/recmail_edit_page.php --- Recmail-orig/pages/recmail_edit_page.php 2009-02-10 16:58:06.000000000 +0530 +++ Recmail/pages/recmail_edit_page.php 2009-02-10 16:59:00.000000000 +0530 @@ -18,7 +18,7 @@ html_page_top2(); $t_plugin_path = config_get( 'plugin_path' ); -require_once( $t_plugin_path . 'Recmail\api\mail_api.php' ); +require_once( $t_plugin_path . 'Recmail/api/mail_api.php' ); print_manage_menu(); diff -ur Recmail-orig/pages/recmail_update.php Recmail/pages/recmail_update.php --- Recmail-orig/pages/recmail_update.php 2009-02-10 16:58:06.000000000 +0530 +++ Recmail/pages/recmail_update.php 2009-02-10 16:58:34.000000000 +0530 @@ -1,6 +1,6 @@ <?php $t_plugin_path = config_get( 'plugin_path' ); -require_once( $t_plugin_path . 'Recmail\api\mail_api.php' ); +require_once( $t_plugin_path . 'Recmail/api/mail_api.php' ); # Update mailbox $f_mailbox_name = gpc_get_string( 'mailbox_name' ); $f_pop3_host = gpc_get_string( 'pop3_host' ); @@ -10,4 +10,4 @@ $query = "update $g_mantis_recmail_table set mailbox_name='$f_mailbox_name', pop3_host='$f_pop3_host', pop3_user='$f_pop3_user', pop3_pass='$f_pop3_pass' where mailbox_id=$f_box_id"; $results = mysql_query( $query ); print_successful_redirect( plugin_page( 'setpop',TRUE ) ); -?> \ No newline at end of file +?> diff -ur Recmail-orig/pages/recmail_verify.php Recmail/pages/recmail_verify.php --- Recmail-orig/pages/recmail_verify.php 2009-02-10 16:58:06.000000000 +0530 +++ Recmail/pages/recmail_verify.php 2009-02-10 17:00:47.000000000 +0530 @@ -1,6 +1,6 @@ <?php $t_plugin_path = config_get( 'plugin_path' ); -require_once( $t_plugin_path . 'Recmail\api\mail_api.php' ); +require_once( $t_plugin_path . 'Recmail/api/mail_api.php' ); $f_mailbox_id = gpc_get_int( 'mailbox_id' ); @@ -44,4 +44,4 @@ } else{ print_successful_redirect( plugin_page( 'setpop',TRUE ) ); } -?> \ No newline at end of file +?> diff -ur Recmail-orig/pages/setpop.php Recmail/pages/setpop.php --- Recmail-orig/pages/setpop.php 2009-02-10 16:58:06.000000000 +0530 +++ Recmail/pages/setpop.php 2009-02-10 17:00:02.000000000 +0530 @@ -5,7 +5,7 @@ html_page_top2(); $t_plugin_path = config_get( 'plugin_path' ); -require_once( $t_plugin_path . 'Recmail\api\mail_api.php' ); +require_once( $t_plugin_path . 'Recmail/api/mail_api.php' ); print_manage_menu(); ?> @@ -147,4 +147,4 @@ </div> <?php # Edit/Delete ext_db Form END ?> -<?php html_page_bottom1( __FILE__ ) ?> \ No newline at end of file +<?php html_page_bottom1( __FILE__ ) ?> recmail_reply_attach.patch (1,725 bytes)
diff -ubr Recmail/api/mail_api.php Recmail.new/api/mail_api.php --- Recmail/api/mail_api.php 2009-01-21 20:34:52.000000000 -0500 +++ Recmail.new/api/mail_api.php 2009-02-18 21:32:22.000000000 -0500 @@ -162,12 +162,15 @@ # -------------------- # return true if there is a valid mantis bug referernce in subject function mail_is_a_bugnote ( $p_mail_subject ) { - if ( preg_match("/\[([A-Za-z0-9-_\. ]*\s[0-9]{1,7})\]/", $p_mail_subject) && bug_exists( $t_bug_id )){ - $t_bug_id = mail_get_bug_id_from_subject( $p_mail['Subject'] ); + if (preg_match("/\[([A-Za-z0-9-_\. ]*\s([0-9]{1,7}))\]/", $p_mail_subject, $v_matches)) { + $t_bug_title = $v_matches[1]; + $t_bug_id = $v_matches[2]; + if (bug_exists( $t_bug_id )) { + return true; + //$t_bug_id = mail_get_bug_id_from_subject( $p_mail_['Subject'] ); } - else{ - return false; } + return false; } # -------------------- @@ -223,7 +226,8 @@ # Handle the file upload $GLOBALS['_mail_file_'] = $p_part['name']; if ( 0 < strlen($p_part['name']) ) { - $t_file_name = ini_get( 'upload_tmp_dir' ) . '/' . $p_part['name']; + #$t_file_name = ini_get( 'upload_tmp_dir' ) . '/' . $p_part['name']; + $t_file_name = plugin_config_get( 'mail_tmp_directory' ) . '/' . $p_part['name']; $t_method = config_get( 'file_upload_method' ); file_put_contents($t_file_name, $p_part['body']); mail_file_add($p_bug_id, realpath( $t_file_name ), $number."-".$p_part['name'], $p_part['ctype'], 'bug'); @@ -298,10 +302,7 @@ } } else { # Create the bug - - $t_bug_id = bug_create( $t_bug_data ); - email_new_bug( $t_bug_id ); } reject-mail.patch (6,313 bytes)
diff -rb Recmail095a/Recmail.php Recmail.new/Recmail.php 24c24 < 'mail_auto_signup' => OFF, --- > 'mail_unknown_address' => 'fallback', 36a37 > 'mail_rejection_notice' => lang_get( 'mail_rejection_notice_default' ), diff -rb Recmail095a/Recmail_api.php Recmail.new/Recmail_api.php 68c68,77 < mail_add_bug( $t_mail, $proj,$cat ); --- > > $t_reporter_id = mail_get_user( $t_mail['From'] ); > if ($t_reporter_id == 0) { > // Reject the unknown sender > mail_reject_unknown( $t_mail ); > } else { > // Proceed normally > mail_add_bug( $t_mail, $proj, $cat, $t_reporter_id ); > } > 179c188,190 < $t_mail_auto_signup = plugin_config_get( 'mail_auto_signup' ); --- > $t_mail_auto_signup = (plugin_config_get( 'mail_unknown_address' ) == 'signup'); > $t_mail_auto_fallback = (plugin_config_get( 'mail_unknown_address' ) == 'fallback'); > $t_mail_auto_reject = (plugin_config_get( 'mail_unknown_address' ) == 'reject'); 199a211,215 > } elseif ( ! $t_reporter_id && $t_mail_auto_reject ) { > // Reject the unknown mail > echo "Rejected unknown sender: $v_mailaddress<br />"; > return 0; > 243c259,265 < function mail_add_bug ( &$p_mail,$proj ,$cat ) { --- > function mail_add_bug ( &$p_mail,$proj, $cat, $reporter_id = -1 ) { > if ($reporter_id == -1) { > $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); > } else { > $t_bug_data->reporter_id = $reporter_id; > } > 280,281d301 < $t_bug_data->reporter_id = mail_get_user( $p_mail['From'] ); < 287c307,308 < email_bugnote_add ( $t_bug_id ); --- > //// bugnote_add() already sent the email > //email_bugnote_add ( $t_bug_id ); 442a464,476 > > > # Send a rejection notice to the unrecognized sender. > function mail_reject_unknown( $p_mail ) { > $t_recipient = mail_parse_address($p_mail['From']); > $t_subject = 're: '.$p_mail['Subject']; > $t_message = plugin_config_get( 'mail_rejection_notice' ); > $t_message = str_replace('#address#', $t_recipient, $t_message); > > email_store( $t_recipient, $t_subject, $t_message ); > } > > diff -rb Recmail095a/lang/strings_english.txt Recmail.new/lang/strings_english.txt 7a8 > $s_mail_unknown_address = 'How to handle mail from unknown addresses (see Doc)'; 8a10,11 > $s_mail_auto_fallback = 'Use default reporting account'; > $s_mail_auto_reject = 'Reject'; 41a45,46 > $s_mail_rejection_notice = 'Mail Rejection Notice'; > $s_mail_rejection_notice_default= 'Our Mantis bug tracking system has received an email from your address. Normally the system would automatically add a new bug report using the email, but we are sorry that we do not recognize your email address of #address#. It is necessary that you use the same address that is in your Mantis user account. You may log in to our Mantis website and update your email address there, so that the system can properly accept emails from you in the future. Thank you.'; \ No newline at end of file diff -rb Recmail095a/pages/bug_report_mail.php Recmail.new/pages/bug_report_mail.php 17c17 < header("Content-type: text/plain"); --- > //header("Content-type: text/plain"); 23a24,26 > > plugin_push_current( 'Recmail' ); > diff -rb Recmail095a/pages/checkuser.php Recmail.new/pages/checkuser.php 13c13 < $mail .="@recmail.com"; --- > $mail .="@example.com"; diff -rb Recmail095a/pages/config.php Recmail.new/pages/config.php 59,63c59 < <?php echo lang_get( 'mail_auto_signup' ) ?> < </td> < <td class="center" width="20%"> < <label><input type="radio" name="mail_auto_signup" value="1" <?php echo ( ON == plugin_config_get( 'mail_auto_signup' ) ) ? 'checked="checked" ' : ''?>/> < <?php echo lang_get( 'mail_format_enabled' ) ?></label> --- > <?php echo lang_get( 'mail_unknown_address' ) ?> 64a61 > 66,67c63,88 < <label><input type="radio" name="mail_auto_signup" value="0" <?php echo ( OFF == plugin_config_get( 'mail_auto_signup' ) ) ? 'checked="checked" ' : ''?>/> < <?php echo lang_get( 'mail_format_disabled' ) ?></label> --- > <?php > if (!$t_mail_auto_signup_default = plugin_config_get('mail_unknown_address')) { > if (ON == plugin_config_get( 'mail_auto_signup' )) { > $t_mail_auto_signup_default = 'signup'; > } else { > $t_mail_auto_signup_default = 'fallback'; > } > } > $t_options = array( > 'signup' => lang_get( 'mail_auto_signup' ), > 'fallback' => lang_get( 'mail_auto_fallback' ), > 'reject' => lang_get( 'mail_auto_reject' ), > ); > ?> > <label><select name="mail_unknown_address"> > <?php > foreach ($t_options as $t_key => $t_val) { > echo '<option value="'.$t_key.'"'; > if ($t_key == $t_mail_auto_signup_default) { > echo ' selected'; > } > echo '>'.$t_val.'</option>'; > } > ?> > </select></label> > 68a90 > <td></td> 287c309,318 < --- > <tr <?php echo helper_alternate_class() ?>> > <td class="category" width="60%"> > <?php echo lang_get( 'mail_rejection_notice' ) ?> > </td> > <td class="center" colspan="2"> > <textarea name="mail_rejection_notice" rows="10" cols="60"><?php > echo str_replace('"', '"', plugin_config_get( 'mail_rejection_notice' )); > ?></textarea> > </td> > </tr> diff -rb Recmail095a/pages/config_edit.php Recmail.new/pages/config_edit.php 7c7 < $f_mail_auto_signup = gpc_get_int('mail_auto_signup', OFF); --- > $f_mail_unknown_address = gpc_get_string('mail_unknown_address', 'fallback'); 19a20 > $f_mail_rejection_notice = gpc_get_string('mail_rejection_notice', lang_get('mail_rejection_notice_default')); 28c29,30 < plugin_config_set('mail_auto_signup' , $f_mail_auto_signup); --- > //plugin_config_set('mail_auto_signup' , $f_mail_auto_signup); > plugin_config_set('mail_unknown_address' , $f_mail_unknown_address); 40a43 > plugin_config_set('mail_rejection_notice' , $f_mail_rejection_notice); Only in Recmail.new/pages: error_log diff -rb Recmail095a/pages/setpop.php Recmail.new/pages/setpop.php 76c76 < <input type="text" name="mail_pop3_host" size="30" maxlength="30" /> --- > <input type="text" name="mail_pop3_host" size="30" maxlength="50" /> obones_feature_branch.patch (21,367 bytes)
From 316d2b9ed4390660d1a9a59da213a3c17840f3a9 Mon Sep 17 00:00:00 2001 From: unknown <o.sannier@.siege.ldlc.com> Date: Wed, 24 Mar 2010 10:18:53 +0100 Subject: [PATCH 1/4] Add the "category by subject" management --- core/mail_api.php | 10 +++ lang/strings_english.txt | 1 + pages/maintainmailbox.php | 34 +++++++++++ pages/maintainmailbox_edit.php | 127 ++++++++++++++++++++++++---------------- 4 files changed, 122 insertions(+), 50 deletions(-) diff --git a/core/mail_api.php b/core/mail_api.php index cc76985..c36f8f8 100644 --- a/core/mail_api.php +++ b/core/mail_api.php @@ -724,6 +724,16 @@ $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); $t_bug_data->category_id = gpc_get_int( 'category_id', $p_mailbox[ 'mailbox_global_category' ] ); + + foreach ($p_mailbox[ 'mailbox_keyword_categories' ] as $expression_pair) + { + if (preg_match($expression_pair[ 'expression' ], $p_mail[ 'Subject' ]) == 1) + { + $t_bug_data->category_id = $expression_pair[ 'category' ]; + } + } + + $t_bug_data->reproducibility = config_get( 'default_bug_reproducibility', 10 ); $t_bug_data->severity = config_get( 'default_bug_severity', 50 ); $t_bug_data->priority = $p_mail[ 'Priority' ]; diff --git a/lang/strings_english.txt b/lang/strings_english.txt index f6a2809..7e60b90 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -61,6 +61,7 @@ $s_plugin_EmailReporting_mailbox_basefolder = 'Mailbox basefolder (IMAP)'; $s_plugin_EmailReporting_mailbox_createfolderstructure = 'Create project subfolder structure (IMAP)'; $s_plugin_EmailReporting_mailbox_project = 'Select a project (N/A if above is set to "yes")'; $s_plugin_EmailReporting_mailbox_global_category = 'Select a global category'; +$s_plugin_EmailReporting_mailbox_keyword_categories = 'Indicate your regular expression / category pairs (see <a href="http://www.php.net/manual/en/function.preg-match.php">preg_match</a> for details)'; $s_plugin_EmailReporting_unknown_setting = 'Unknown setting encountered. Setting ignored'; $s_plugin_EmailReporting_missing_reporter = 'Please select a user account'; diff --git a/pages/maintainmailbox.php b/pages/maintainmailbox.php index 1b7ce01..076ce38 100644 --- a/pages/maintainmailbox.php +++ b/pages/maintainmailbox.php @@ -84,6 +84,11 @@ $t_config_array = array( 'type' => 'dropdown_global_categories', 'value' => '', ), + array( + 'name' => 'mailbox_keyword_categories', + 'type' => 'list_keywords_categories', + 'value' => '', + ) ); foreach( $t_config_array AS $t_config ) @@ -233,6 +238,35 @@ foreach( $t_config_array AS $t_config ) </tr> <?php break; + + case 'list_keywords_categories': +?> +<tr <?php echo helper_alternate_class( )?>> + <td class="category" width="60%"> + <?php echo plugin_lang_get( $t_config[ 'name' ] )?> + </td> + <td class="center" width="40%" colspan="2"> + <?php + if (is_array($t_config[ 'value' ])) + { + $i = 0; + foreach ($t_config[ 'value' ] as $expression_pair) + { + echo "<label><input type=\"text\" size=\"25\" maxlength=\"50\" name=\"".$t_config[ 'name' ]."_expression_".$i."\" value=\"". $expression_pair[ 'expression' ]."\"/></label>"; + echo "<label><select name=\"".$t_config[ 'name' ]."_category_".$i."\"> "; + print_category_option_list( $expression_pair[ 'category' ], ALL_PROJECTS ); + echo "</select></label>\n"; + ++$i; + } + } + ?> + + <label><input type="text" size="25" maxlength="50" name="<?php echo $t_config[ 'name' ] ?>_expression_new" value=""/></label><label><select name="<?php echo $t_config[ 'name' ] ?>_category_new"> <?php print_category_option_list('', ALL_PROJECTS ) ?></select></label> + </td> +</tr> +<?php + break; + default: echo '<tr><td colspan="3">' . plugin_lang_get( 'unknown_setting' ) . '</td></tr>'; } } diff --git a/pages/maintainmailbox_edit.php b/pages/maintainmailbox_edit.php index 9f57174..94fa9f3 100644 --- a/pages/maintainmailbox_edit.php +++ b/pages/maintainmailbox_edit.php @@ -9,81 +9,108 @@ $t_mailboxes = plugin_config_get( 'mailboxes' ); if ( $f_mailbox_action === 'add' || ( ( $f_mailbox_action === 'edit' || $f_mailbox_action === 'test' ) && $f_select_mailbox >= 0 ) ) { - $t_mailbox = array( - 'mailbox_description' => gpc_get_string( 'mailbox_description' ), - 'mailbox_type' => gpc_get_string( 'mailbox_type', 'POP3' ), - 'mailbox_hostname' => gpc_get_string( 'mailbox_hostname' ), - 'mailbox_encryption' => gpc_get_string( 'mailbox_encryption', 'None' ), - 'mailbox_username' => gpc_get_string( 'mailbox_username' ), - 'mailbox_password' => base64_encode( gpc_get_string( 'mailbox_password' ) ), - 'mailbox_auth_method' => gpc_get_string( 'mailbox_auth_method', 'USER' ), - 'mailbox_basefolder' => trim( str_replace( '\\', '/', gpc_get_string( 'mailbox_basefolder', '' ) ), '/ ' ), - 'mailbox_createfolderstructure' => gpc_get_bool( 'mailbox_createfolderstructure', OFF ), - 'mailbox_project' => gpc_get_int( 'mailbox_project' ), - 'mailbox_global_category' => gpc_get_int( 'mailbox_global_category' ), - ); + $t_mailbox = array( + 'mailbox_description' => gpc_get_string( 'mailbox_description' ), + 'mailbox_type' => gpc_get_string( 'mailbox_type', 'POP3' ), + 'mailbox_hostname' => gpc_get_string( 'mailbox_hostname' ), + 'mailbox_encryption' => gpc_get_string( 'mailbox_encryption', 'None' ), + 'mailbox_username' => gpc_get_string( 'mailbox_username' ), + 'mailbox_password' => base64_encode( gpc_get_string( 'mailbox_password' ) ), + 'mailbox_auth_method' => gpc_get_string( 'mailbox_auth_method', 'USER' ), + 'mailbox_basefolder' => trim( str_replace( '\\', '/', gpc_get_string( 'mailbox_basefolder', '' ) ), '/ ' ), + 'mailbox_createfolderstructure' => gpc_get_bool( 'mailbox_createfolderstructure', OFF ), + 'mailbox_project' => gpc_get_int( 'mailbox_project' ), + 'mailbox_global_category' => gpc_get_int( 'mailbox_global_category' ), + 'mailbox_keyword_categories' => array(), + ); + + // Add existing pairs, only if they are filled in + $i = 0; + while (gpc_get_string('mailbox_keyword_categories_expression_'.$i, null) != null) + { + $expression = gpc_get_string('mailbox_keyword_categories_expression_'.$i); + if (!empty($expression)) + { + array_push($t_mailbox['mailbox_keyword_categories'], array('expression' => $expression, + 'category' => gpc_get_int('mailbox_keyword_categories_category_'.$i) + ) + ); + } + + ++$i; + } + + // Add a new pair, if filled in + $expression = gpc_get_string('mailbox_keyword_categories_expression_new'); + if (!empty($expression)) + { + array_push($t_mailbox['mailbox_keyword_categories'], array('expression' => $expression, + 'category' => gpc_get_int('mailbox_keyword_categories_category_new') + ) + ); + } } if ( $f_mailbox_action === 'add' ) { - array_push( $t_mailboxes, $t_mailbox ); + array_push( $t_mailboxes, $t_mailbox ); } elseif ( $f_mailbox_action === 'edit' && $f_select_mailbox >= 0 ) { - $t_mailboxes[ $f_select_mailbox ] = $t_mailbox; + $t_mailboxes[ $f_select_mailbox ] = $t_mailbox; } elseif ( $f_mailbox_action === 'delete' && $f_select_mailbox >= 0 ) { - unset( $t_mailboxes[ $f_select_mailbox ] ); + unset( $t_mailboxes[ $f_select_mailbox ] ); } elseif ( $f_mailbox_action === 'test' && $f_select_mailbox >= 0 ) { - # Verify mailbox - from Recmail by Cas Nuy - require_once( 'mail_api.php' ); + # Verify mailbox - from Recmail by Cas Nuy + require_once( 'mail_api.php' ); - $t_result = mail_process_all_mails( $t_mailbox, true ); + $t_result = mail_process_all_mails( $t_mailbox, true ); - if ( ( is_array( $t_result ) && $t_result[ 'ERROR_TYPE' ] === 'NON-PEAR-ERROR' ) || PEAR::isError( $t_result ) ) - { - $t_no_redirect = true; + if ( ( is_array( $t_result ) && $t_result[ 'ERROR_TYPE' ] === 'NON-PEAR-ERROR' ) || PEAR::isError( $t_result ) ) + { + $t_no_redirect = true; - html_page_top1(); - html_page_top2(); + html_page_top1(); + html_page_top2(); ?> <br /><div class="center"> - <?php echo plugin_lang_get( 'test_failure' ); ?> - <br><br> - <?php echo plugin_lang_get( 'mailbox_description' ) . ': ' . $t_mailbox[ 'mailbox_description' ]; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_type' ) . ': ' . $t_mailbox[ 'mailbox_type' ]; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_hostname' ) . ': ' . $t_mailbox[ 'mailbox_hostname' ]; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_encryption' ) . ': ' . $t_mailbox[ 'mailbox_encryption' ]; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_username' ) . ': ' . $t_mailbox[ 'mailbox_username' ]; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_password' ) . ': ******'; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_auth_method' ) . ': ' . $t_mailbox[ 'mailbox_auth_method' ]; ?> - <br> - <?php echo plugin_lang_get( 'mailbox_basefolder' ) . ': ' . $t_mailbox[ 'mailbox_basefolder' ]; ?> - <br><br> - <?php echo ( ( is_array( $t_result ) && $t_result[ 'ERROR_TYPE' ] === 'NON-PEAR-ERROR' ) ? $t_result[ 'ERROR_MESSAGE' ] : $t_result->toString() ); ?> - <br><br> - <?php print_bracket_link( plugin_page( 'maintainmailbox', TRUE ), lang_get( 'proceed' ) ); ?> + <?php echo plugin_lang_get( 'test_failure' ); ?> + <br><br> + <?php echo plugin_lang_get( 'mailbox_description' ) . ': ' . $t_mailbox[ 'mailbox_description' ]; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_type' ) . ': ' . $t_mailbox[ 'mailbox_type' ]; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_hostname' ) . ': ' . $t_mailbox[ 'mailbox_hostname' ]; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_encryption' ) . ': ' . $t_mailbox[ 'mailbox_encryption' ]; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_username' ) . ': ' . $t_mailbox[ 'mailbox_username' ]; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_password' ) . ': ******'; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_auth_method' ) . ': ' . $t_mailbox[ 'mailbox_auth_method' ]; ?> + <br> + <?php echo plugin_lang_get( 'mailbox_basefolder' ) . ': ' . $t_mailbox[ 'mailbox_basefolder' ]; ?> + <br><br> + <?php echo ( ( is_array( $t_result ) && $t_result[ 'ERROR_TYPE' ] === 'NON-PEAR-ERROR' ) ? $t_result[ 'ERROR_MESSAGE' ] : $t_result->toString() ); ?> + <br><br> + <?php print_bracket_link( plugin_page( 'maintainmailbox', TRUE ), lang_get( 'proceed' ) ); ?> </div> <?php - html_page_bottom1(); - } + html_page_bottom1(); + } } if( plugin_config_get( 'mailboxes' ) != $t_mailboxes && ( $f_mailbox_action === 'add' || ( ( $f_mailbox_action === 'edit' || $f_mailbox_action === 'delete' ) && $f_select_mailbox >= 0 ) ) ) { - plugin_config_set( 'mailboxes', $t_mailboxes ); + plugin_config_set( 'mailboxes', $t_mailboxes ); } if ( !isset( $t_no_redirect ) ) { - print_successful_redirect( plugin_page( 'maintainmailbox', true ) ); -} + print_successful_redirect( plugin_page( 'maintainmailbox', true ) ); +} \ No newline at end of file -- 1.7.0.2.msysgit.0 From 4d401197225df12e5b64131c0a9b7bd5121de6d1 Mon Sep 17 00:00:00 2001 From: unknown <o.sannier@.siege.ldlc.com> Date: Mon, 29 Mar 2010 10:59:44 +0200 Subject: [PATCH 2/4] Better Regex for accented characters in project names --- core/mail_api.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/mail_api.php b/core/mail_api.php index c36f8f8..e29fcc0 100644 --- a/core/mail_api.php +++ b/core/mail_api.php @@ -454,7 +454,7 @@ # -------------------- # return true if there is a valid mantis bug refererence in subject or return false if not found function mail_is_a_bugnote ( $p_mail_subject ) { - if ( preg_match( "/\[([A-Za-z0-9-_\. ]*\s[0-9]{1,7})\]/", $p_mail_subject ) ){ + if ( preg_match( "/\[([[:alnum:]\p{L}-_\. ]*\s[0-9]{1,7})\]/iu", $p_mail_subject ) ){ $t_bug_id = mail_get_bug_id_from_subject( $p_mail_subject ); if ( bug_exists( $t_bug_id ) && !bug_is_readonly( $t_bug_id ) ){ return true; @@ -467,7 +467,7 @@ # -------------------- # return the bug's id from the subject function mail_get_bug_id_from_subject ( $p_mail_subject ) { - preg_match( "/\[([A-Za-z0-9-_\. ]*\s([0-9]{1,7}?))\]/", $p_mail_subject, $v_matches ); + preg_match( "/\[([[:alnum:]\p{L}-_\. ]*\s([0-9]{1,7}?))\]/iu", $p_mail_subject, $v_matches ); return $v_matches[ 2 ]; } -- 1.7.0.2.msysgit.0 From 3cc04e323a8a692d357d2a4bab4c776f7c0f79dc Mon Sep 17 00:00:00 2001 From: unknown <o.sannier@.siege.ldlc.com> Date: Tue, 6 Apr 2010 12:05:23 +0200 Subject: [PATCH 3/4] Can now use the email as the username (optionally stripping the domain name) and use the previous username as the realname. --- EmailReporting.php | 9 ++++++++- core/mail_api.php | 37 ++++++++++++++++++++++++++++++++----- lang/strings_english.txt | 2 ++ pages/config.php | 8 ++++++++ pages/config_edit.php | 10 ++++++++++ 5 files changed, 60 insertions(+), 6 deletions(-) diff --git a/EmailReporting.php b/EmailReporting.php index 604bd61..3c2bb5e 100644 --- a/EmailReporting.php +++ b/EmailReporting.php @@ -10,7 +10,7 @@ class EmailReportingPlugin extends MantisPlugin { $this->description = plugin_lang_get( 'description' ); $this->page = 'config'; - $this->version = '0.7.9'; + $this->version = '0.7.9-DEV'; $this->requires = array( 'MantisCore' => '1.2', ); @@ -50,6 +50,13 @@ class EmailReportingPlugin extends MantisPlugin { # Default is OFF, if mail_use_reporter is OFF and this is OFF then it will # fallback to the mail_reporter account above 'mail_auto_signup' => OFF, + + # Use the email as a username if auto signing up + 'mail_use_email_as_username' => OFF, + + # Strip the domain name (the part after the @) when using the email as a + # username and auto signing up + 'mail_strip_domain_from_username' => OFF, # How many mails should be fetched at the same time # If big mails with attachments should be received, specify only one diff --git a/core/mail_api.php b/core/mail_api.php index e29fcc0..3c7202a 100644 --- a/core/mail_api.php +++ b/core/mail_api.php @@ -286,7 +286,8 @@ if ( $t_mail_delete ) { - $p_mailbox_connection->deleteMsg( $p_i ); + if (!$p_mailbox_connection->deleteMsg( $p_i )) + echo 'deleteMsg failed'; } } @@ -423,17 +424,33 @@ { $v_mailaddress = array( 'username' => trim( $matches[ 1 ], '"\' ' ), + 'realname' => '', 'email' => trim( $matches[ 2 ] ), ); + + $t_mail_use_email_as_username = plugin_config_get( 'mail_use_email_as_username' ); + $t_mail_strip_domain_from_username = plugin_config_get( 'mail_strip_domain_from_username' ); + + if ($t_mail_use_email_as_username) + { + $v_mailaddress['realname'] = $v_mailaddress['username']; + $email = $v_mailaddress['email']; + + if ($t_mail_strip_domain_from_username) + $v_mailaddress['username'] = substr($email, 0, strpos($email, '@')); + else + $v_mailaddress['username'] = $email; + } } else { $v_mailaddress = array( - 'name' => '', + 'username' => '', + 'realname' => '', 'email' => $p_mailaddress, ); } - + return $v_mailaddress; } @@ -502,11 +519,15 @@ if ( user_is_name_valid( $t_reporter ) && user_is_name_unique( $t_reporter ) ) { - # notify the selected group a new user has signed-up + # notify the selected group a new user has signed-up and set realname if( user_signup( $t_reporter, $v_mailaddress[ 'email' ] ) ) { - email_notify_new_account( $t_reporter, $v_mailaddress[ 'email' ] ); + if (ON == config_get('enable_email_notification')) + email_notify_new_account( $t_reporter, $v_mailaddress[ 'email' ] ); + $t_reporter_id = user_get_id_by_name ( $t_reporter ); + if ($v_mailaddress['realname'] != '') + user_set_realname($t_reporter_id, $v_mailaddress['realname']); } } @@ -698,6 +719,7 @@ $t_resolved = config_get( 'bug_resolved_status_threshold' ); $t_status = bug_get_field( $t_bug_id, 'status' ); + config_set('email_receive_own', ON); if ( $t_resolved <= $t_status ) { # Reopen issue and add a bug note @@ -708,6 +730,8 @@ # Add a bug note bugnote_add( $t_bug_id, $t_description ); } + global $g_email_receive_own; + config_set('email_receive_own', $g_email_receive_own); } else { @@ -763,7 +787,10 @@ # Create the bug $t_bug_id = $t_bug_data->create(); + config_set('email_receive_own', ON); email_new_bug( $t_bug_id ); + global $g_email_receive_own; + config_set('email_receive_own', $g_email_receive_own); } # Add files diff --git a/lang/strings_english.txt b/lang/strings_english.txt index 7e60b90..2bfc623 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -25,6 +25,8 @@ $s_plugin_EmailReporting_mail_check_timer = 'How often should the mailboxes be c $s_plugin_EmailReporting_mail_use_reporter = 'Use one account for issues created by email'; $s_plugin_EmailReporting_mail_reporter = 'The account name for issues created by email'; $s_plugin_EmailReporting_mail_auto_signup = 'Signup new users automatically (possible security risk!, see documentation)'; +$s_plugin_EmailReporting_mail_use_email_as_username = 'Use email as username'; +$s_plugin_EmailReporting_mail_strip_domain_from_username = 'Strip domain name from username'; $s_plugin_EmailReporting_mail_fetch_max = 'How many emails per mailbox should be fetched every time this script is executed (see documentation)'; $s_plugin_EmailReporting_mail_add_complete_email = 'Add the complete email into the attachments'; $s_plugin_EmailReporting_mail_save_from = 'Write the sender of the message into the issue report'; diff --git a/pages/config.php b/pages/config.php index defac6d..b5fbe17 100644 --- a/pages/config.php +++ b/pages/config.php @@ -68,6 +68,14 @@ $t_config_array = array( 'type' => 'boolean', ), array( + 'name' => 'mail_use_email_as_username', + 'type' => 'boolean', + ), + array( + 'name' => 'mail_strip_domain_from_username', + 'type' => 'boolean', + ), + array( 'name' => 'mail_fetch_max', 'type' => 'integer', ), diff --git a/pages/config_edit.php b/pages/config_edit.php index b68e6a5..ceefe70 100644 --- a/pages/config_edit.php +++ b/pages/config_edit.php @@ -9,6 +9,8 @@ $f_mail_check_timer = gpc_get_int( 'mail_check_timer', 300 ); $f_mail_use_reporter = gpc_get_bool( 'mail_use_reporter', ON ); $f_mail_reporter = gpc_get_string( 'mail_reporter', 'Mail' ); $f_mail_auto_signup = gpc_get_bool( 'mail_auto_signup', OFF ); +$f_mail_use_email_as_username = gpc_get_bool('mail_use_email_as_username', OFF); +$f_mail_strip_domain_from_username = gpc_get_bool('mail_strip_domain_from_username', OFF); $f_mail_fetch_max = gpc_get_int( 'mail_fetch_max', 1 ); $f_mail_add_complete_email = gpc_get_bool( 'mail_add_complete_email', OFF ); $f_mail_save_from = gpc_get_bool( 'mail_save_from', OFF ); @@ -73,6 +75,14 @@ if( plugin_config_get( 'mail_auto_signup' ) != $f_mail_auto_signup ) { plugin_config_set( 'mail_auto_signup', $f_mail_auto_signup ); } +if( plugin_config_get( 'mail_use_email_as_username', false ) != $f_mail_use_email_as_username ) { + plugin_config_set( 'mail_use_email_as_username', $f_mail_use_email_as_username ); +} + +if( plugin_config_get( 'mail_strip_domain_from_username', false ) != $f_mail_strip_domain_from_username ) { + plugin_config_set( 'mail_strip_domain_from_username', $f_mail_strip_domain_from_username ); +} + if( plugin_config_get( 'mail_fetch_max' ) != $f_mail_fetch_max ) { plugin_config_set( 'mail_fetch_max', $f_mail_fetch_max ); } -- 1.7.0.2.msysgit.0 From 68bd57285282e4800e5b56b05fd7c2b93e597692 Mon Sep 17 00:00:00 2001 From: unknown <o.sannier@.siege.ldlc.com> Date: Tue, 6 Apr 2010 14:24:08 +0200 Subject: [PATCH 4/4] Disable the signup email, it never finishes and prevents the rest of the code to work --- core/mail_api.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/mail_api.php b/core/mail_api.php index 3c7202a..407cca9 100644 --- a/core/mail_api.php +++ b/core/mail_api.php @@ -522,8 +522,8 @@ # notify the selected group a new user has signed-up and set realname if( user_signup( $t_reporter, $v_mailaddress[ 'email' ] ) ) { - if (ON == config_get('enable_email_notification')) - email_notify_new_account( $t_reporter, $v_mailaddress[ 'email' ] ); +// if (ON == config_get('enable_email_notification')) +// email_notify_new_account( $t_reporter, $v_mailaddress[ 'email' ] ); $t_reporter_id = user_get_id_by_name ( $t_reporter ); if ($v_mailaddress['realname'] != '') -- 1.7.0.2.msysgit.0 events.patch (5,650 bytes)
Index: core/config_api.php =================================================================== --- core/config_api.php (revision 994) +++ core/config_api.php (working copy) @@ -164,7 +164,14 @@ ?> <tr <?php echo helper_alternate_class( )?>> <td class="category" width="60%"> - <?php echo plugin_lang_get( $p_name )?> + <?php + $plugin_name = event_signal('EVENT_ERP_GET_EXTRA_FIELD_NAME', $p_name); + if ($plugin_name != null) + echo $plugin_name; + else + echo plugin_lang_get( $p_name ); + + ?> </td> <?php switch ( $p_type ) @@ -439,7 +446,19 @@ <?php break; - default: echo '<tr><td colspan="3">' . plugin_lang_get( 'unknown_setting' ) . $p_name . ' -> level 1</td></tr>'; + default: + $plugin_name = event_signal('EVENT_ERP_GET_EXTRA_FIELD_NAME', $p_name); + if ($plugin_name != null) + { + echo '<tr '.helper_alternate_class( ).'>'; + echo '<td class="category" width="60%">'.$plugin_name.'</td>'; + echo event_signal('EVENT_ERP_OUTPUT_EXTRA_FIELD_TYPE', array($p_name, $p_type, $t_value)); + echo '</tr>'; + } + else + { + echo '<tr><td colspan="3">' . plugin_lang_get( 'unknown_setting' ) . $p_name . ' -> level 1</td></tr>'; + } } } Index: core/mail_api.php =================================================================== --- core/mail_api.php (revision 994) +++ core/mail_api.php (working copy) @@ -592,6 +592,8 @@ $t_status = bug_get_field( $t_bug_id, 'status' ); + $t_description = event_signal( 'EVENT_ERP_PROCESS_BUGNOTE_DATA', $t_description, array($p_email, $this->_mailbox) ); + if ( $this->_bug_resolved_status_threshold <= $t_status ) { # Reopen issue and add a bug note @@ -662,6 +664,7 @@ # Allow plugins to pre-process bug data $t_bug_data = event_signal( 'EVENT_REPORT_BUG_DATA', $t_bug_data ); + $t_bug_data = event_signal( 'EVENT_ERP_PROCESS_BUG_DATA', $t_bug_data, array($p_email, $this->_mailbox) ); # Create the bug $t_bug_id = $t_bug_data->create(); Index: EmailReporting.php =================================================================== --- EmailReporting.php (revision 995) +++ EmailReporting.php (working copy) @@ -215,6 +215,46 @@ } } + function events() { + return array( + # Allow other plugins to process bugdata before the bug is added + # Parameters are BugData, Email details array, Mailbox data + # Result is BugData + 'EVENT_ERP_PROCESS_BUG_DATA' => EVENT_TYPE_CHAIN, + + # Allow other plugins to process bugnote data before the bug is added + # Parameters are bugnote text, Email details array, Mailbox data + # Result is bugnote text + 'EVENT_ERP_PROCESS_BUGNOTE_DATA' => EVENT_TYPE_CHAIN, + + # Allow other plugins to add configuration elements in the form displayed + # by manage_mailbox.php in the mailbox_settings_issue section + # Parameters are extra fields from other plugins and mailbox data (value of $t_mailbox) + # Result is an array of key/value pairs used as the first two parameters + # in a call to ERP_output_config_options + 'EVENT_ERP_GET_EXTRA_MAILBOX_SETTINGS_ISSUE_FIELDS' => EVENT_TYPE_CHAIN, + + # Allow other plugins to add elements in the mailbox data that is saved in the config + # Parameters are extra data from other plugins and Mailbox data from manage_mailbox_edit.php + # Result is Mailbox data + 'EVENT_ERP_GET_EXTRA_MAILBOX_DATA' => EVENT_TYPE_CHAIN, + + # Allow other plugins to give the name for an extra field added via the + # EVENT_ERP_GET_EXTRA_MAILBOX_SETTINGS_ISSUE_FIELDS event + # Parameter is the name of the extra field + # Result is the displayable string as returned by plugin_lang_get + 'EVENT_ERP_GET_EXTRA_FIELD_NAME' => EVENT_TYPE_FIRST, + + # Allow other plugins to output the input HTML elements for a specific type + # as given for an extra field added via the + # EVENT_ERP_GET_EXTRA_MAILBOX_SETTINGS_ISSUE_FIELDS event + # Parameters are the name, the type and the value of the extra field + # Result is the HTML code that will be displayed on the right part of the table + # and must include the <td></td> tags + 'EVENT_ERP_OUTPUT_EXTRA_FIELD_TYPE' => EVENT_TYPE_FIRST, + ); + } + /** * EmailReporting plugin hooks. */ Index: pages/manage_mailbox.php =================================================================== --- pages/manage_mailbox.php (revision 994) +++ pages/manage_mailbox.php (working copy) @@ -73,6 +73,14 @@ ERP_output_config_option( 'mailbox_project_id', 'dropdown_projects', -3, $t_mailbox ); ERP_output_config_option( 'mailbox_global_category_id', 'dropdown_global_categories', -3, $t_mailbox ); +$extra_fields = event_signal('EVENT_ERP_GET_EXTRA_MAILBOX_SETTINGS_ISSUE_FIELDS', null, $t_mailbox); + +if (is_array($extra_fields)) +{ + foreach ($extra_fields as $field_id => $field_type_id) + ERP_output_config_option( $field_id, $field_type_id, -3, $t_mailbox ); +} + ERP_output_config_option( $f_mailbox_action . '_mailbox', 'submit' ); ?> Index: pages/manage_mailbox_edit.php =================================================================== --- pages/manage_mailbox_edit.php (revision 994) +++ pages/manage_mailbox_edit.php (working copy) @@ -31,6 +31,11 @@ $t_mailbox += $t_mailbox_imap; } + + $t_extra_data = event_signal('EVENT_ERP_GET_EXTRA_MAILBOX_DATA', null, array($t_mailbox)); + + if (is_array($t_extra_data)) + $t_mailbox = array_merge($t_mailbox, $t_extra_data); } if ( $f_mailbox_action === 'add' || $f_mailbox_action === 'copy' ) directory_trim.diff (1,400 bytes)
Index: manage_config_edit.php =================================================================== --- manage_config_edit.php (revision 1000) +++ manage_config_edit.php (revision 1001) @@ -9,7 +9,7 @@ 'mail_add_complete_email' => gpc_get_bool( 'mail_add_complete_email' ), 'mail_auto_signup' => gpc_get_bool( 'mail_auto_signup' ), 'mail_debug' => gpc_get_bool( 'mail_debug' ), - 'mail_debug_directory' => trim( str_replace( '\\', '/', gpc_get_string( 'mail_debug_directory' ) ), '/ ' ), + 'mail_debug_directory' => rtrim(trim( str_replace( '\\', '/', gpc_get_string( 'mail_debug_directory' ) )), '/' ), 'mail_delete' => gpc_get_bool( 'mail_delete' ), 'mail_email_receive_own' => gpc_get_string( 'mail_email_receive_own' ), 'mail_encoding' => gpc_get_string( 'mail_encoding' ), @@ -26,7 +26,7 @@ 'mail_reporter_id' => gpc_get_int( 'mail_reporter_id' ), 'mail_save_from' => gpc_get_bool( 'mail_save_from' ), 'mail_secured_script' => gpc_get_bool( 'mail_secured_script' ), - 'mail_tmp_directory' => trim( str_replace( '\\', '/', gpc_get_string( 'mail_tmp_directory' ) ), '/ ' ), + 'mail_tmp_directory' => rtrim(trim( str_replace( '\\', '/', gpc_get_string( 'mail_tmp_directory' ) )), '/'), 'mail_use_bug_priority' => gpc_get_bool( 'mail_use_bug_priority' ), 'mail_use_reporter' => gpc_get_bool( 'mail_use_reporter' ), ); file_upload.patch (8,952 bytes)
Index: core/custom_file_api.php =================================================================== --- core/custom_file_api.php (revision 994) +++ core/custom_file_api.php (working copy) @@ -1,123 +0,0 @@ -<?php -/** - * Add a file to the system using the configured storage method - * - * @param integer $p_bug_id the bug id - * @param array $p_file the uploaded file info, as retrieved from gpc_get_file() - * - * almost the same as its counterpart in the file_api.php from MantisBT version 1.2.0, but with small adjustments to the disk upload part - */ -function ERP_custom_file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null ) { - - file_ensure_uploaded( $p_file ); - $t_file_name = $p_file['name']; - $t_tmp_file = $p_file['tmp_name']; - - if( !file_type_check( $t_file_name ) ) { - trigger_error( ERROR_FILE_NOT_ALLOWED, ERROR ); - } - - if( !file_is_name_unique( $t_file_name, $p_bug_id ) ) { - trigger_error( ERROR_DUPLICATE_FILE, ERROR ); - } - - if( 'bug' == $p_table ) { - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - $t_bug_id = bug_format_id( $p_bug_id ); - } else { - $t_project_id = helper_get_current_project(); - $t_bug_id = 0; - } - - if( $p_user_id === null ) { - $c_user_id = auth_get_current_user_id(); - } else { - $c_user_id = (int)$p_user_id; - } - - # prepare variables for insertion - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_project_id = db_prepare_int( $t_project_id ); - $c_file_type = db_prepare_string( $p_file['type'] ); - $c_title = db_prepare_string( $p_title ); - $c_desc = db_prepare_string( $p_desc ); - - if( $t_project_id == ALL_PROJECTS ) { - $t_file_path = config_get( 'absolute_path_default_upload_folder' ); - } else { - $t_file_path = project_get_field( $t_project_id, 'file_path' ); - if( $t_file_path == '' ) { - $t_file_path = config_get( 'absolute_path_default_upload_folder' ); - } - } - $c_file_path = db_prepare_string( $t_file_path ); - $c_new_file_name = db_prepare_string( $t_file_name ); - - $t_file_hash = ( 'bug' == $p_table ) ? $t_bug_id : config_get( 'document_files_prefix' ) . '-' . $t_project_id; - $t_unique_name = file_generate_unique_name( $t_file_hash . '-' . $t_file_name, $t_file_path ); - $t_disk_file_name = $t_file_path . $t_unique_name; - $c_unique_name = db_prepare_string( $t_unique_name ); - - $t_file_size = filesize( $t_tmp_file ); - if( 0 == $t_file_size ) { - trigger_error( ERROR_FILE_NO_UPLOAD_FAILURE, ERROR ); - } - $t_max_file_size = (int) min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) ); - if( $t_file_size > $t_max_file_size ) { - trigger_error( ERROR_FILE_TOO_BIG, ERROR ); - } - $c_file_size = db_prepare_int( $t_file_size ); - - $t_method = config_get( 'file_upload_method' ); - - switch( $t_method ) { - case FTP: - case DISK: - file_ensure_valid_upload_path( $t_file_path ); - - if( !file_exists( $t_disk_file_name ) ) { - if( FTP == $t_method ) { - $conn_id = file_ftp_connect(); - file_ftp_put( $conn_id, $t_disk_file_name, $t_tmp_file ); - file_ftp_disconnect( $conn_id ); - } - - // move_uploaded_file replaced with rename function. Needed since files added through the EmailReporting method are not seen as such - if( !rename( $t_tmp_file, $t_disk_file_name ) ) { - // Corrected trigger error message name, FILE_MOVE_FAILED should have been ERROR_FILE_MOVE_FAILED - trigger_error( ERROR_FILE_MOVE_FAILED, ERROR ); - } - - chmod( $t_disk_file_name, config_get( 'attachments_file_permissions' ) ); - - $c_content = "''"; - } else { - trigger_error( ERROR_FILE_DUPLICATE, ERROR ); - } - break; - case DATABASE: - $c_content = db_prepare_binary_string( fread( fopen( $t_tmp_file, 'rb' ), $t_file_size ) ); - break; - default: - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); - $c_id = ( 'bug' == $p_table ) ? $c_bug_id : $c_project_id; - - $query = "INSERT INTO $t_file_table - (" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id) - VALUES - ($c_id, '$c_title', '$c_desc', '$c_unique_name', '$c_new_file_name', '$c_file_path', $c_file_size, '$c_file_type', '" . db_now() . "', $c_content, $c_user_id)"; - db_query( $query ); - - if( 'bug' == $p_table ) { - - # updated the last_updated date - $result = bug_update_date( $p_bug_id ); - - # log new bug - history_log_event_special( $p_bug_id, FILE_ADDED, $t_file_name ); - } -} -?> Index: core/mail_api.php =================================================================== --- core/mail_api.php (revision 998) +++ core/mail_api.php (working copy) @@ -13,8 +13,6 @@ require_once( 'user_api.php' ); require_once( 'file_api.php' ); - require_once( plugin_config_get( 'path_erp', NULL, TRUE ) . 'core/custom_file_api.php' ); - require_once( 'Net/POP3.php' ); require_once( plugin_config_get( 'path_erp', NULL, TRUE ) . 'core/Net/IMAP_1.0.3.php' ); @@ -735,7 +733,7 @@ foreach ( $p_email[ 'X-Mantis-Parts' ] as $part ) { - $t_file_rejected = $this->add_file( $t_bug_id, $part ); + $t_file_rejected = $this->add_file( $t_bug_id, $p_email[ 'Reporter_id' ], $part ); if ( $t_file_rejected !== TRUE ) { @@ -765,7 +763,7 @@ # -------------------- # Very dirty: Adds a file to a bug. # returns true on success and the filename with reason on error - private function add_file( $p_bug_id, &$p_part ) + private function add_file( $p_bug_id, $p_user_id, &$p_part ) { # Handle the file upload $t_part_name = ( ( isset( $p_part[ 'name' ] ) ) ? trim( $p_part[ 'name' ] ) : NULL ); @@ -794,17 +792,34 @@ $this->_file_number++; } - $t_file_name = $this->_mail_tmp_directory . '/' . md5( microtime() ); + $t_file_name = $this->_mail_tmp_directory . '/' . $this->_file_number . '-' . $t_part_name; file_put_contents( $t_file_name, $p_part[ 'body' ] ); - ERP_custom_file_add( $p_bug_id, array( - 'tmp_name' => realpath( $t_file_name ), - 'name' => $this->_file_number . '-' . $t_part_name, - 'type' => $p_part[ 'ctype' ], - 'error' => NULL - ), 'bug' ); - + $ch = curl_init(); + + $data = array('bug_id' => $p_bug_id, + 'user_id' => $p_user_id, + 'file' => '@'.$t_file_name); // .';type='.$p_part[ 'ctype' ]); // the type part does not work under all versions of PHP (5.2.6 KO, 5.2.13 OK) + + $url = config_get_global( 'path' ).plugin_page('file_add.php', true); + echo $url."\n"; + echo "\n\n"; + print_r($data); + echo "\n\n"; + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + + if(curl_exec($ch) === false) + { + echo 'Curl error: ' . curl_error($ch) ."<br />\n"; + } + + // Close handle + curl_close($ch); + if ( is_file( $t_file_name ) ) { unlink( $t_file_name ); Index: pages/file_add.php =================================================================== --- pages/file_add.php (revision 0) +++ pages/file_add.php (revision 0) @@ -0,0 +1,49 @@ +<?php + +require_once('file_api.php'); + +$t_address = $_SERVER['REMOTE_ADDR']; +$t_valid = false; + +helper_begin_long_process(); + +# Always allow the same machine to import +if ( '127.0.0.1' == $t_address || '127.0.1.1' == $t_address + || 'localhost' == $t_address || '::1' == $t_address + || $_SERVER['SERVER_ADDR'] == $t_address || $_SERVER['SERVER_NAME'] == $t_address ) { + $t_valid = true; +} + +# Not validated by this point gets the boot! +if ( !$t_valid ) { + die( plugin_lang_get( 'invalid_file_add_url' ) ); +} + + +$f_bug_id = gpc_get_int( 'bug_id', -1 ); +$f_user_id = gpc_get_int( 'user_id', null ); +$f_file = gpc_get_file( 'file', -1 ); + +echo "Bug id : $f_bug_id<br />\n"; +echo "User id: $f_user_id<<br />\n"; +echo "File info:<br />\n"; +print_r($f_file); +echo "<br />\n"; + +if ( $f_bug_id == -1 && $f_file == -1 ) { + # _POST/_FILES does not seem to get populated if you exceed size limit so check if bug_id is -1 + trigger_error( ERROR_FILE_TOO_BIG, ERROR ); +} + +# Must set global current user id because file_add and other functions it calls +# make calls to auth_get_current_user_id() and we obviously have no user logged +# in when run via the cron job +global $g_cache_current_user_id; +$g_cache_current_user_id = $f_user_id; + +echo "Adding file<br />\n"; +file_add( $f_bug_id, $f_file, 'bug'); +echo "All done<br />\n"; + + +?> \ No newline at end of file file_number.patch (1,389 bytes)
Index: core/mail_api.php =================================================================== --- core/mail_api.php (revision 1002) +++ core/mail_api.php (working copy) @@ -35,8 +35,6 @@ 'IMAP' => array( 'normal' => 143, 'encrypted' => 993 ), ); - private $_file_number = 1; - private $_validated_email_list = array(); private $_mail_add_bug_reports; @@ -729,8 +727,6 @@ { $t_rejected_files = NULL; - $this->_file_number = 1; - foreach ( $p_email[ 'X-Mantis-Parts' ] as $part ) { $t_file_rejected = $this->add_file( $t_bug_id, $p_email[ 'Reporter_id' ], $part ); @@ -787,12 +783,14 @@ } else { - while ( !file_is_name_unique( $this->_file_number . '-' . $t_part_name, $p_bug_id ) ) + $file_number = 0; + + while ( !file_is_name_unique( $t_file_name = (($file_number > 0)? preg_replace('/(\..+)$/', '-'.$file_number.'$1' , $t_part_name) : $t_part_name), $p_bug_id ) ) { - $this->_file_number++; + $file_number++; } - $t_file_name = $this->_mail_tmp_directory . '/' . $this->_file_number . '-' . $t_part_name; + $t_file_name = $this->_mail_tmp_directory . '/' . $t_file_name; file_put_contents( $t_file_name, $p_part[ 'body' ] ); @@ -824,8 +822,6 @@ { unlink( $t_file_name ); } - - $this->_file_number++; } return( TRUE ); multi_string_reply_marker.patch (1,291 bytes)
Index: core/config_api.php =================================================================== --- core/config_api.php (revision 1002) +++ core/config_api.php (working copy) @@ -146,6 +146,7 @@ break; case 'array': + case 'multi_string': case 'boolean': case 'directory_string': case 'integer': @@ -184,6 +185,14 @@ <?php break; + case 'multi_string': +?> + <td class="center" width="40%" colspan="2"> + <textarea cols="40" rows="6" name="<?php echo $p_name ?>"><?php echo $t_value; ?></textarea> + </td> +<?php + break; + case 'boolean': ?> <td class="center" width="20%"> Index: pages/manage_config.php =================================================================== --- pages/manage_config.php (revision 1002) +++ pages/manage_config.php (working copy) @@ -76,7 +76,7 @@ ERP_output_config_option( 'mail_nosubject', 'string', -2 ); ERP_output_config_option( 'mail_nodescription', 'string', -2 ); ERP_output_config_option( 'mail_removed_reply_text', 'string', -2 ); -ERP_output_config_option( 'mail_remove_replies_after', 'string', -2 ); +ERP_output_config_option( 'mail_remove_replies_after', 'multi_string', -2 ); ERP_output_config_option( NULL, 'empty' ); ERP_output_config_option( 'debug_options', 'header' ); reply_identification.patch (1,783 bytes)
Index: core/mail_api.php =================================================================== --- core/mail_api.php (revision 1007) +++ core/mail_api.php (working copy) @@ -1054,12 +1054,15 @@ # Removes replies from mails private function identify_replies( $p_description ) { + $t_description = $p_description; + if ( $this->_mail_remove_replies ) { - $t_first_occurence = stripos( $p_description, $this->_mail_remove_replies_after ); + $t_first_occurence = stripos( $t_description, $this->_mail_remove_replies_after ); + if ( $t_first_occurence !== FALSE ) { - $t_description = substr( $p_description, 0, $t_first_occurence ) . $this->_mail_removed_reply_text; + $t_description = substr( $t_description, 0, $t_first_occurence ) . $this->_mail_removed_reply_text; } } @@ -1069,19 +1072,14 @@ # the version delivered with this package seems to be working OK though but just to be sure $t_email_separator1 = substr( $this->_email_separator1, 0, -1 ); - $t_first_occurence = strpos( $p_description, $t_email_separator1 ); - if ( $t_first_occurence !== FALSE && substr_count( $p_description, $t_email_separator1, $t_first_occurence ) >= 5 ) + $t_first_occurence = strpos( $t_description, $t_email_separator1 ); + if ( $t_first_occurence !== FALSE && substr_count( $t_description, $t_email_separator1, $t_first_occurence ) >= 5 ) { - $t_description = substr( $p_description, 0, $t_first_occurence ) . $this->_mail_removed_reply_text; + $t_description = substr( $t_description, 0, $t_first_occurence ) . $this->_mail_removed_reply_text; } } - if ( isset( $t_description ) ) - { - return( $t_description ); - } - - return( $p_description ); + return $t_description; } # -------------------- note_and_new_issue_add_subject_cc_date.patch (11,736 bytes)
diff -Naur original/EmailReporting/core/Mail/Parser.php new/EmailReporting/core/Mail/Parser.php --- original/EmailReporting/core/Mail/Parser.php 2011-09-15 10:04:38.000000000 +0200 +++ new/EmailReporting/core/Mail/Parser.php 2011-09-15 10:36:47.000000000 +0200 @@ -14,6 +14,8 @@ private $_from; private $_subject; + private $_cc; + private $_date; private $_charset = 'auto'; private $_priority; private $_transferencoding; @@ -100,6 +102,8 @@ { $this->_from = $this->process_encoding( $this->_from ); $this->_subject = $this->process_encoding( $this->_subject ); + $this->_cc = $this->process_encoding( $this->_cc ); + $this->_date = $this->process_encoding( $this->_date ); $this->_body = $this->process_encoding( $this->_body ); } } @@ -114,6 +118,16 @@ return( $this->_subject ); } + public function cc() + { + return( $this->_cc ); + } + + public function mail_date() + { + return( $this->_date ); + } + public function priority() { return( $this->_priority ); @@ -133,6 +147,17 @@ { $this->setFrom( $structure->headers['from'] ); $this->setSubject( $structure->headers['subject'] ); + + if( isset( $structure->headers['cc'] ) ) + { + $this->setCC( $structure->headers['cc'] ); + } + + if( isset( $structure->headers['date'] ) ) + { + $this->setDate( $structure->headers['date'] ); + } + $this->setContentType( $structure->ctype_primary, $structure->ctype_secondary ); if ( isset( $structure->ctype_parameters[ 'charset' ] ) ) @@ -171,6 +196,16 @@ $this->_subject = $subject; } + private function setCC( $cc ) + { + $this->_cc = $cc; + } + + private function setDate( $date ) + { + $this->_date = $date; + } + private function setCharset( $charset ) { if ( extension_loaded( 'mbstring' ) && $this->_charset === 'auto' ) diff -Naur original/EmailReporting/core/mail_api.php new/EmailReporting/core/mail_api.php --- original/EmailReporting/core/mail_api.php 2011-09-15 10:04:38.000000000 +0200 +++ new/EmailReporting/core/mail_api.php 2011-09-15 10:36:47.000000000 +0200 @@ -58,6 +58,9 @@ private $_mail_removed_reply_text; private $_mail_reporter_id; private $_mail_save_from; + private $_mail_save_note_subject; + private $_mail_save_cc; + private $_mail_save_date; private $_mail_tmp_directory; private $_mail_use_bug_priority; private $_mail_use_reporter; @@ -109,6 +112,9 @@ $this->_mail_removed_reply_text = plugin_config_get( 'mail_removed_reply_text' ); $this->_mail_reporter_id = plugin_config_get( 'mail_reporter_id' ); $this->_mail_save_from = plugin_config_get( 'mail_save_from' ); + $this->_mail_save_note_subject = plugin_config_get( 'mail_save_note_subject'); + $this->_mail_save_cc = plugin_config_get( 'mail_save_cc' ); + $this->_mail_save_date = plugin_config_get( 'mail_save_date' ); $this->_mail_tmp_directory = plugin_config_get( 'mail_tmp_directory' ); $this->_mail_use_bug_priority = plugin_config_get( 'mail_use_bug_priority' ); $this->_mail_use_reporter = plugin_config_get( 'mail_use_reporter' ); @@ -447,15 +453,14 @@ $t_mp->parse(); - $t_email[ 'From' ] = $t_mp->from(); - $t_email[ 'From_parsed' ] = $this->parse_address( $t_email[ 'From' ] ); - $t_email[ 'Reporter_id' ] = $this->get_user( $t_email[ 'From_parsed' ] ); - - $t_email[ 'Subject' ] = trim( $t_mp->subject() ); - - $t_email[ 'X-Mantis-Body' ] = trim( $t_mp->body() ); - - $t_email[ 'X-Mantis-Parts' ] = $t_mp->parts(); + $t_email[ 'From' ] = $t_mp->from(); + $t_email[ 'From_parsed' ] = $this->parse_address( $t_email[ 'From' ] ); + $t_email[ 'Reporter_id' ] = $this->get_user( $t_email[ 'From_parsed' ] ); + $t_email[ 'Subject' ] = trim( $t_mp->subject() ); + $t_email[ 'CC' ] = trim( $t_mp->cc() ); + $t_email[ 'Date' ] = trim( $t_mp->mail_date() ); + $t_email[ 'X-Mantis-Body' ] = trim( $t_mp->body() ); + $t_email[ 'X-Mantis-Parts' ] = $t_mp->parts(); if ( $this->_mail_use_bug_priority ) { @@ -602,8 +607,12 @@ $t_description = $p_email[ 'X-Mantis-Body' ]; $t_description = $this->identify_replies( $t_description ); - $t_description = $this->apply_mail_save_from( $p_email[ 'From' ], $t_description ); + $t_description = $this->apply_mail_subject( $p_email[ 'Subject' ], $t_description ); + $t_description = $this->apply_mail_save_date( $p_email[ 'Date' ], $t_description ); + $t_description = $this->apply_mail_save_cc( $p_email[ 'CC' ], $t_description ); + $t_description = $this->apply_mail_save_from( $p_email[ 'From' ], $t_description ); + # Event integration # Core mantis event already exists within bignote_add function $t_bugnote_text = event_signal( 'EVENT_ERP_BUGNOTE_DATA', $t_description, $t_bug_id ); @@ -650,7 +659,13 @@ $t_bug_data->status = $this->_bug_submit_status; $t_bug_data->summary = $p_email[ 'Subject' ]; - $t_bug_data->description = $this->apply_mail_save_from( $p_email[ 'From' ], $p_email[ 'X-Mantis-Body' ] ); + $t_description = $p_email[ 'X-Mantis-Body' ]; + $t_description = $this->apply_mail_subject( $p_email[ 'Subject' ], $t_description ); + $t_description = $this->apply_mail_save_date( $p_email[ 'Date' ], $t_description ); + $t_description = $this->apply_mail_save_cc( $p_email[ 'CC' ], $t_description ); + $t_description = $this->apply_mail_save_from( $p_email[ 'From' ], $t_description ); + + $t_bug_data->description = $t_description; $t_bug_data->steps_to_reproduce = $this->_default_bug_steps_to_reproduce; $t_bug_data->additional_information = $this->_default_bug_additional_info; @@ -1018,6 +1033,7 @@ private function mail_is_a_bugnote( $p_mail_subject ) { $t_bug_id = $this->get_bug_id_from_subject( $p_mail_subject ); + print("recognized t_bug_id=[".$t_bug_id."], subject=[".$p_mail_subject."]"); if ( $t_bug_id !== FALSE ) { @@ -1034,7 +1050,7 @@ # return the bug's id from the subject private function get_bug_id_from_subject( $p_mail_subject ) { - preg_match( "/\[.*?\s([0-9]{1,7}?)\]/u", $p_mail_subject, $v_matches ); + preg_match( "/.*\[.*?(0*[0-9]{1,7}?)\s*\]/u", $p_mail_subject, $v_matches ); if ( isset( $v_matches[ 1 ] ) ) { @@ -1119,12 +1135,49 @@ { if ( $this->_mail_save_from ) { - return( 'Email from: ' . $p_from . "\n\n" . $p_description ); + return( 'From: ' . $p_from . "\n" . $p_description ); + } + + return( $p_description ); + } + + # -------------------- + # Add the save subject text if enabled + private function apply_mail_subject( $p_subject, $p_description ) + { + if ( $this->_mail_save_note_subject ) + { + return( 'Subject: ' . $p_subject . "\n\n\n" . $p_description ); + } + + return( $p_description ); + } + + # -------------------- + # Add the save cc text if enabled + private function apply_mail_save_cc( $p_cc, $p_description ) + { + if ( $this->_mail_save_cc ) + { + return( 'CC: ' . $p_cc . "\n" . $p_description ); } return( $p_description ); } + + # -------------------- + # Add the save date text if enabled + private function apply_mail_save_date( $p_date, $p_description ) + { + if ( $this->_mail_save_date ) + { + return( 'Date: ' . $p_date . "\n" . $p_description ); + } + + return( $p_description ); + } + # -------------------- # Show memory usage in debug mode private function show_memory_usage( $p_location ) diff -Naur original/EmailReporting/EmailReporting.php new/EmailReporting/EmailReporting.php --- original/EmailReporting/EmailReporting.php 2011-09-15 10:04:37.000000000 +0200 +++ new/EmailReporting/EmailReporting.php 2011-09-15 10:36:47.000000000 +0200 @@ -48,6 +48,9 @@ # Is this plugin allowed to process and add bugnotes to existing issues 'mail_add_bugnotes' => ON, + # Add email subject to a note or new bug report + 'mail_save_note_subject' => OFF, + # Add complete email into the attachments 'mail_add_complete_email' => OFF, @@ -133,6 +136,12 @@ # Write sender of the message into the bug report 'mail_save_from' => ON, + # Write CC into the bug report + 'mail_save_cc' => OFF, + + # Write Date into the bug report + 'mail_save_date' => OFF, + # Do you want to secure the EmailReporting script so that it cannot be run # via a webserver? 'mail_secured_script' => ON, @@ -474,5 +483,10 @@ plugin_config_set( 'mail_mantisbt_url_fix', $t_path ); } } + if ( $t_config_version <= 10 ) + { + plugin_config_set( 'mail_save_note_subject', ON ); + plugin_config_set( 'config_version', 11 ); + } } } diff -Naur original/EmailReporting/lang/strings_english.txt new/EmailReporting/lang/strings_english.txt --- original/EmailReporting/lang/strings_english.txt 2011-09-15 10:04:38.000000000 +0200 +++ new/EmailReporting/lang/strings_english.txt 2011-09-15 10:36:47.000000000 +0200 @@ -51,7 +51,10 @@ $s_plugin_EmailReporting_mail_remove_replies_after = 'Use this text to identify the start of a reply'; $s_plugin_EmailReporting_mail_removed_reply_text = 'Use this text if replies have been removed from the email'; $s_plugin_EmailReporting_mail_reporter_id = 'The default / fallback reporter user for issues created by email'; -$s_plugin_EmailReporting_mail_save_from = 'Write the sender of the email into the issue report'; +$s_plugin_EmailReporting_mail_save_from = 'Write the sender of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_cc = 'Write the CC of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_date = 'Write the Date of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_note_subject = 'Write the email subject into the issue/bugnote'; $s_plugin_EmailReporting_mail_secured_script = 'Block this script from running via a webserver (recommended = "Yes")'; $s_plugin_EmailReporting_mail_tmp_directory = 'Directory for saving temporary email content'; $s_plugin_EmailReporting_mail_use_bug_priority = 'Look for priority header field'; diff -Naur original/EmailReporting/pages/manage_config_edit.php new/EmailReporting/pages/manage_config_edit.php --- original/EmailReporting/pages/manage_config_edit.php 2011-09-15 10:04:37.000000000 +0200 +++ new/EmailReporting/pages/manage_config_edit.php 2011-09-15 10:36:47.000000000 +0200 @@ -26,6 +26,9 @@ 'mail_removed_reply_text' => gpc_get_string( 'mail_removed_reply_text' ), 'mail_reporter_id' => gpc_get_int( 'mail_reporter_id' ), 'mail_save_from' => gpc_get_bool( 'mail_save_from' ), + 'mail_save_cc' => gpc_get_bool( 'mail_save_cc' ), + 'mail_save_date' => gpc_get_bool( 'mail_save_date' ), + 'mail_save_note_subject' => gpc_get_bool( 'mail_save_note_subject'), 'mail_secured_script' => gpc_get_bool( 'mail_secured_script' ), 'mail_tmp_directory' => ERP_prepare_directory_string( gpc_get_string( 'mail_tmp_directory' ) ), 'mail_use_bug_priority' => gpc_get_bool( 'mail_use_bug_priority' ), diff -Naur original/EmailReporting/pages/manage_config.php new/EmailReporting/pages/manage_config.php --- original/EmailReporting/pages/manage_config.php 2011-09-15 10:04:37.000000000 +0200 +++ new/EmailReporting/pages/manage_config.php 2011-09-15 10:36:47.000000000 +0200 @@ -65,6 +65,9 @@ ERP_output_config_option( 'mail_remove_replies', 'boolean', -2 ); ERP_output_config_option( 'mail_email_receive_own', 'boolean', -2 ); ERP_output_config_option( 'mail_save_from', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_cc', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_date', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_note_subject', 'boolean', -2 ); ERP_output_config_option( NULL, 'empty' ); ERP_output_config_option( 'priority_feature_options', 'header' ); note_and_new_issue_add_subject_cc_date_to.patch (12,919 bytes)
diff -Nuar original/EmailReporting/core/Mail/Parser.php new/EmailReporting/core/Mail/Parser.php --- original/EmailReporting/core/Mail/Parser.php 2010-10-19 18:48:26.000000000 +0200 +++ new/EmailReporting/core/Mail/Parser.php 2011-09-15 11:43:00.000000000 +0200 @@ -13,7 +13,10 @@ private $_content; private $_from; + private $_to; private $_subject; + private $_cc; + private $_date; private $_charset = 'auto'; private $_priority; private $_transferencoding; @@ -99,7 +102,10 @@ if ( extension_loaded( 'mbstring' ) ) { $this->_from = $this->process_encoding( $this->_from ); + $this->_to = $this->process_encoding( $this->_to ); $this->_subject = $this->process_encoding( $this->_subject ); + $this->_cc = $this->process_encoding( $this->_cc ); + $this->_date = $this->process_encoding( $this->_date ); $this->_body = $this->process_encoding( $this->_body ); } } @@ -114,6 +120,21 @@ return( $this->_subject ); } + public function cc() + { + return( $this->_cc ); + } + + public function mail_to() + { + return( $this->_to ); + } + + public function mail_date() + { + return( $this->_date ); + } + public function priority() { return( $this->_priority ); @@ -133,6 +154,22 @@ { $this->setFrom( $structure->headers['from'] ); $this->setSubject( $structure->headers['subject'] ); + + if( isset( $structure->headers['cc'] ) ) + { + $this->setCC( $structure->headers['cc'] ); + } + + if( isset( $structure->headers['date'] ) ) + { + $this->setDate( $structure->headers['date'] ); + } + + if( isset( $structure->headers['to'] ) ) + { + $this->setTo( $structure->headers['to'] ); + } + $this->setContentType( $structure->ctype_primary, $structure->ctype_secondary ); if ( isset( $structure->ctype_parameters[ 'charset' ] ) ) @@ -171,6 +208,21 @@ $this->_subject = $subject; } + private function setCC( $cc ) + { + $this->_cc = $cc; + } + + private function setDate( $date ) + { + $this->_date = $date; + } + + private function setTo( $to ) + { + $this->_to = $to; + } + private function setCharset( $charset ) { if ( extension_loaded( 'mbstring' ) && $this->_charset === 'auto' ) diff -Nuar original/EmailReporting/core/mail_api.php new/EmailReporting/core/mail_api.php --- original/EmailReporting/core/mail_api.php 2010-11-06 23:23:16.000000000 +0100 +++ new/EmailReporting/core/mail_api.php 2011-09-15 12:00:34.000000000 +0200 @@ -58,6 +58,10 @@ private $_mail_removed_reply_text; private $_mail_reporter_id; private $_mail_save_from; + private $_mail_save_to; + private $_mail_save_note_subject; + private $_mail_save_cc; + private $_mail_save_date; private $_mail_tmp_directory; private $_mail_use_bug_priority; private $_mail_use_reporter; @@ -109,6 +113,10 @@ $this->_mail_removed_reply_text = plugin_config_get( 'mail_removed_reply_text' ); $this->_mail_reporter_id = plugin_config_get( 'mail_reporter_id' ); $this->_mail_save_from = plugin_config_get( 'mail_save_from' ); + $this->_mail_save_to = plugin_config_get( 'mail_save_to' ); + $this->_mail_save_note_subject = plugin_config_get( 'mail_save_note_subject'); + $this->_mail_save_cc = plugin_config_get( 'mail_save_cc' ); + $this->_mail_save_date = plugin_config_get( 'mail_save_date' ); $this->_mail_tmp_directory = plugin_config_get( 'mail_tmp_directory' ); $this->_mail_use_bug_priority = plugin_config_get( 'mail_use_bug_priority' ); $this->_mail_use_reporter = plugin_config_get( 'mail_use_reporter' ); @@ -447,15 +455,15 @@ $t_mp->parse(); - $t_email[ 'From' ] = $t_mp->from(); - $t_email[ 'From_parsed' ] = $this->parse_address( $t_email[ 'From' ] ); - $t_email[ 'Reporter_id' ] = $this->get_user( $t_email[ 'From_parsed' ] ); - - $t_email[ 'Subject' ] = trim( $t_mp->subject() ); - - $t_email[ 'X-Mantis-Body' ] = trim( $t_mp->body() ); - - $t_email[ 'X-Mantis-Parts' ] = $t_mp->parts(); + $t_email[ 'From' ] = $t_mp->from(); + $t_email[ 'From_parsed' ] = $this->parse_address( $t_email[ 'From' ] ); + $t_email[ 'Reporter_id' ] = $this->get_user( $t_email[ 'From_parsed' ] ); + $t_email[ 'Subject' ] = trim( $t_mp->subject() ); + $t_email[ 'CC' ] = trim( $t_mp->cc() ); + $t_email[ 'Date' ] = trim( $t_mp->mail_date() ); + $t_email[ 'To' ] = trim( $t_mp->mail_to() ); + $t_email[ 'X-Mantis-Body' ] = trim( $t_mp->body() ); + $t_email[ 'X-Mantis-Parts' ] = $t_mp->parts(); if ( $this->_mail_use_bug_priority ) { @@ -602,8 +610,16 @@ $t_description = $p_email[ 'X-Mantis-Body' ]; $t_description = $this->identify_replies( $t_description ); - $t_description = $this->apply_mail_save_from( $p_email[ 'From' ], $t_description ); + $t_description = $this->apply_mail_subject( $p_email[ 'Subject' ], $t_description ); + $t_description = $this->apply_mail_save_date( $p_email[ 'Date' ], $t_description ); + if( array_key_exists( $p_email[ 'CC' ] ) && !empty( $p_email[ 'CC' ] ) ) + { + $t_description = $this->apply_mail_save_cc( $p_email[ 'CC' ], $t_description ); + } + $t_description = $this->apply_mail_save_to( $p_email[ 'To' ], $t_description ); + $t_description = $this->apply_mail_save_from( $p_email[ 'From' ], $t_description ); + # Event integration # Core mantis event already exists within bignote_add function $t_bugnote_text = event_signal( 'EVENT_ERP_BUGNOTE_DATA', $t_description, $t_bug_id ); @@ -650,7 +666,19 @@ $t_bug_data->status = $this->_bug_submit_status; $t_bug_data->summary = $p_email[ 'Subject' ]; - $t_bug_data->description = $this->apply_mail_save_from( $p_email[ 'From' ], $p_email[ 'X-Mantis-Body' ] ); + $t_description = $p_email[ 'X-Mantis-Body' ]; + $t_description = $this->apply_mail_subject( $p_email[ 'Subject' ], $t_description ); + $t_description = $this->apply_mail_save_date( $p_email[ 'Date' ], $t_description ); + + if( array_key_exists( $p_email[ 'CC' ] ) && !empty( $p_email[ 'CC' ] ) ) + { + $t_description = $this->apply_mail_save_cc( $p_email[ 'CC' ], $t_description ); + } + + $t_description = $this->apply_mail_save_to( $p_email[ 'To' ], $t_description ); + $t_description = $this->apply_mail_save_from( $p_email[ 'From' ], $t_description ); + + $t_bug_data->description = $t_description; $t_bug_data->steps_to_reproduce = $this->_default_bug_steps_to_reproduce; $t_bug_data->additional_information = $this->_default_bug_additional_info; @@ -1034,7 +1062,7 @@ # return the bug's id from the subject private function get_bug_id_from_subject( $p_mail_subject ) { - preg_match( "/\[.*?\s([0-9]{1,7}?)\]/u", $p_mail_subject, $v_matches ); + preg_match( "/.*\[.*?(0*[0-9]{1,7}?)\s*\]/u", $p_mail_subject, $v_matches ); if ( isset( $v_matches[ 1 ] ) ) { @@ -1119,13 +1147,62 @@ { if ( $this->_mail_save_from ) { - return( 'Email from: ' . $p_from . "\n\n" . $p_description ); + return( 'From: ' . $p_from . "\n" . $p_description ); + } + + return( $p_description ); + } + + # -------------------- + # Add the save to text if enabled + private function apply_mail_save_to( $p_to, $p_description ) + { + if ( $this->_mail_save_to ) + { + return( 'To: ' . $p_to . "\n" . $p_description ); + } + + return( $p_description ); + } + + # -------------------- + # Add the save subject text if enabled + private function apply_mail_subject( $p_subject, $p_description ) + { + if ( $this->_mail_save_note_subject ) + { + return( 'Subject: ' . $p_subject . "\n\n\n" . $p_description ); } return( $p_description ); } # -------------------- + # Add the save cc text if enabled + private function apply_mail_save_cc( $p_cc, $p_description ) + { + if ( $this->_mail_save_cc ) + { + return( 'CC: ' . $p_cc . "\n" . $p_description ); + } + + return( $p_description ); + } + + + # -------------------- + # Add the save date text if enabled + private function apply_mail_save_date( $p_date, $p_description ) + { + if ( $this->_mail_save_date ) + { + return( 'Date: ' . $p_date . "\n" . $p_description ); + } + + return( $p_description ); + } + + # -------------------- # Show memory usage in debug mode private function show_memory_usage( $p_location ) { diff -Nuar original/EmailReporting/EmailReporting.php new/EmailReporting/EmailReporting.php --- original/EmailReporting/EmailReporting.php 2010-11-11 23:31:02.000000000 +0100 +++ new/EmailReporting/EmailReporting.php 2011-09-15 11:43:00.000000000 +0200 @@ -48,6 +48,9 @@ # Is this plugin allowed to process and add bugnotes to existing issues 'mail_add_bugnotes' => ON, + # Add email subject to a note or new bug report + 'mail_save_note_subject' => OFF, + # Add complete email into the attachments 'mail_add_complete_email' => OFF, @@ -133,6 +136,15 @@ # Write sender of the message into the bug report 'mail_save_from' => ON, + # Write recipient (To) of the message into the bug report + 'mail_save_to' => OFF, + + # Write CC into the bug report + 'mail_save_cc' => OFF, + + # Write Date into the bug report + 'mail_save_date' => OFF, + # Do you want to secure the EmailReporting script so that it cannot be run # via a webserver? 'mail_secured_script' => ON, @@ -474,5 +486,10 @@ plugin_config_set( 'mail_mantisbt_url_fix', $t_path ); } } + if ( $t_config_version <= 10 ) + { + plugin_config_set( 'mail_save_note_subject', ON ); + plugin_config_set( 'config_version', 11 ); + } } } diff -Nuar original/EmailReporting/lang/strings_english.txt new/EmailReporting/lang/strings_english.txt --- original/EmailReporting/lang/strings_english.txt 2010-10-19 18:44:46.000000000 +0200 +++ new/EmailReporting/lang/strings_english.txt 2011-09-15 11:43:00.000000000 +0200 @@ -51,7 +51,11 @@ $s_plugin_EmailReporting_mail_remove_replies_after = 'Use this text to identify the start of a reply'; $s_plugin_EmailReporting_mail_removed_reply_text = 'Use this text if replies have been removed from the email'; $s_plugin_EmailReporting_mail_reporter_id = 'The default / fallback reporter user for issues created by email'; -$s_plugin_EmailReporting_mail_save_from = 'Write the sender of the email into the issue report'; +$s_plugin_EmailReporting_mail_save_from = 'Write the sender of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_to = 'Write the recipient (To) of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_cc = 'Write the CC of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_date = 'Write the Date of the email into the issue/bugnote'; +$s_plugin_EmailReporting_mail_save_note_subject = 'Write the email subject into the issue/bugnote'; $s_plugin_EmailReporting_mail_secured_script = 'Block this script from running via a webserver (recommended = "Yes")'; $s_plugin_EmailReporting_mail_tmp_directory = 'Directory for saving temporary email content'; $s_plugin_EmailReporting_mail_use_bug_priority = 'Look for priority header field'; diff -Nuar original/EmailReporting/pages/manage_config_edit.php new/EmailReporting/pages/manage_config_edit.php --- original/EmailReporting/pages/manage_config_edit.php 2010-10-07 15:08:38.000000000 +0200 +++ new/EmailReporting/pages/manage_config_edit.php 2011-09-15 11:43:00.000000000 +0200 @@ -26,6 +26,10 @@ 'mail_removed_reply_text' => gpc_get_string( 'mail_removed_reply_text' ), 'mail_reporter_id' => gpc_get_int( 'mail_reporter_id' ), 'mail_save_from' => gpc_get_bool( 'mail_save_from' ), + 'mail_save_to' => gpc_get_bool( 'mail_save_to' ), + 'mail_save_cc' => gpc_get_bool( 'mail_save_cc' ), + 'mail_save_date' => gpc_get_bool( 'mail_save_date' ), + 'mail_save_note_subject' => gpc_get_bool( 'mail_save_note_subject'), 'mail_secured_script' => gpc_get_bool( 'mail_secured_script' ), 'mail_tmp_directory' => ERP_prepare_directory_string( gpc_get_string( 'mail_tmp_directory' ) ), 'mail_use_bug_priority' => gpc_get_bool( 'mail_use_bug_priority' ), diff -Nuar original/EmailReporting/pages/manage_config.php new/EmailReporting/pages/manage_config.php --- original/EmailReporting/pages/manage_config.php 2010-10-07 15:08:26.000000000 +0200 +++ new/EmailReporting/pages/manage_config.php 2011-09-15 11:43:00.000000000 +0200 @@ -65,6 +65,10 @@ ERP_output_config_option( 'mail_remove_replies', 'boolean', -2 ); ERP_output_config_option( 'mail_email_receive_own', 'boolean', -2 ); ERP_output_config_option( 'mail_save_from', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_to', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_cc', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_date', 'boolean', -2 ); +ERP_output_config_option( 'mail_save_note_subject', 'boolean', -2 ); ERP_output_config_option( NULL, 'empty' ); ERP_output_config_option( 'priority_feature_options', 'header' ); | ||||
related to | 0006658 | closed | ryandesign | mantisbt | Replying to a mantis ticket should add it as a note to that issue |
has duplicate | 0001568 | closed | grangeway | mantisbt | Abillity to send mail to mantis adding bugs and bugnotes |
has duplicate | 0003320 | closed | grangeway | mantisbt | Email ability |
has duplicate | 0005233 | closed | thraxisp | mantisbt | Submission of issues by email |
has duplicate | 0005710 | closed | thraxisp | mantisbt | E-Mail-Import in mantis |
has duplicate | 0008339 | closed | vboctor | mantisbt | email reporting |
has duplicate | 0009964 | closed | jreese | mantisbt | report a bug via email |
has duplicate | 0010010 | closed | thraxisp | mantisbt | E-mail implementation to mantis as a new bug |
has duplicate | 0010550 | closed | siebrand | mantisbt | Report issue via email |
has duplicate | 0011831 | closed | atrol | mantisbt | Tickets can be created via email? |
has duplicate | 0013049 | closed | atrol | mantisbt | Report a new Bug via Email |
related to | 0006619 | closed | grangeway | mantisbt | Report by email concept |
related to | 0008984 | closed | SL-Gundam | Plugin - EmailReporting | Adding notes to existing bug via email |
related to | 0007086 | closed | SL-Gundam | Plugin - EmailReporting | Mantis email via IMAP + folders |
related to | 0010146 | closed | dregad | mantisbt | Send/Receive mail from issue |
I've put a test version to the request ;) Have fun. |
|||||||||
I haven't tried it, but it looks good. I guess we can include this (at least until we have a more flexible e-mail interface). I would appreciate it however if you provide a patch for the project admin interface. A few other concerns:
|
|||||||||
You can use it. It's an ugly hack this time. ;) A feedback to the user was not needed here, but of course, it's possible. And... edited on: 08-07-04 04:20 |
|||||||||
OK, looking forward to see what you come up with! |
|||||||||
I took a look to Bug 0001568 an it seems to be possible for me. Today I've introduced a new function for finding a user via its mailadress and one to create a new user account out of the box by a mail report. |
|||||||||
I'm not going to type 'OK, keep it up!' every time you post a status update, but I am reading them :-) Consider it implicit. |
|||||||||
The new patch adds the following functions to bug_report_mail:
todo: look into subject of mails for adding bug notes |
|||||||||
The mantis-working patch creates user accounts in the right way and is able to recognize mails as replies to an already opened bug. I think, this should be a ready-to-work solution this time :) The patch is against Mantis 0.18.3 |
|||||||||
Looks and sounds good. However, we're currently working on getting 0.19.0 out first. Could you wait until it's out and send in a patch against that (or even better, use 'cvs diff' with an up to date 0.19.0 CVS tree)? |
|||||||||
No problem ;) I'll wait for it. |
|||||||||
Hi, this looks really nice and I´m looking for a solution to report issues vie email. |
|||||||||
Yes, I know this. An other possibilily is to put the mail's content into a script doing a http post request. Both are solutions, I tried. But on my mantis host, I have a lot of But if you're interested in, I can integrate my older solution doing a http post request into this patch. Edit: I take a look, it's only a little change :) bearbeitet am: 08-12-04 16:54 |
|||||||||
Puh... The next thing, i will integrate is the possibility to have more than one mailaccount for every project. Some people asked me to add support for mail accounts per category. Have fun... Indy |
|||||||||
This is fantastic stuff! Keep it up. May I put up an idea: if you create a user account from the email (if one was not found), would you then delete the new account when the issue is closed? (as an option) Again - great work. |
|||||||||
|
|||||||||
This seems to be related to an old issue 3320: Email ability |
|||||||||
On having a bug with no reporter... I agree it is not the best idea - even if it is closed, it would be good to know who reported the issue for future reference. Will give this more thought. |
|||||||||
I'm sorry, the first patch i added today is not really good. The newer will work. Sorry. |
|||||||||
why isn't this bug marked as related to the bug 3320? |
|||||||||
Any chance we can get a version that works on stdin? This would be awesome for people using software like qmail where it makes more sense to pipe input directly from a .qmail file (this also puts a smaller load on the server in that it's only done when mail is actually received). Using the CLI-interface, PHP files can be invoked/executed from the command-line like any other type of script. So no need to go via the webserver. |
|||||||||
Yes, of course it's possible. |
|||||||||
The newest patch is able to handle MIME-Mails in a correct way. It works on my system, please test :) -- By the way... I have no idea this time to handle mails via stdin in a correct way. Ouhps: please remove the comment from line 224 in mail_api.php ;) |
|||||||||
Update to Mantis 0.19.2. I've added new configuration options, see README.bug_report_mail for details. |
|||||||||
Could someone please just include a download wich can be copied to/over the 0.19.2 version. |
|||||||||
A complete Mantis 0.19.2 including this patch can be downloaded here: |
|||||||||
Looks really nice. I'm currently in the process of installing a new Mantis with this patch applied and testing it. However, I found some small problems when the mails are sent via PINE:
Please see my patch mantis-0.19.2-additional-fixes.patch and include it to your patch if you like it. The patch has to be applied after mantis-0.19.2.patch. |
|||||||||
BTW, indy: I think you should change the status of this bug away from "feedback", otherwise it might be overlooked as Mantis developers think you still haven't answered their questions... |
|||||||||
Another remark (hopefully the last for today, sorry :( ): I additionally needed to patch Mail_Mime 1.2.1 according to http://pear.php.net/bugs/bug.php?id=1132 so that it will also decode mails with encoding "BASE64" instead of "base64". |
|||||||||
gernot: I do not have any privileges to change the state for this report. |
|||||||||
Additional remark: if you call bug_report_mail.php from the command line via "php", the host and path settings of your server will not be found. This leads to an incorrect message sent upon user registration (www.example.com instead of your server name, wrong path). So if you want to use this script via "Php" command line, you have to manually set $t_host and $t_path (at least, I didn't try it yet). |
|||||||||
I get a 404 here? I would REALLY like to test this out as I use a live bug-tracking system for a database-driven website that controls not only content to a site, but a organization's own reporting and membership system. Thanks in advance! |
|||||||||
I've put the patches and the modified version of Mantis back into the download-area. |
|||||||||
Thanks! |
|||||||||
Will this patch also become available for the new 1.x.x version of Mantis? |
|||||||||
Of course, but in the moment, I've not enough time to do this. |
|||||||||
I found a bug which prevented the body of an mime email to be added in the description field of a new bug report. file: core/mail.api.php if (strtolower($t_parts[0]['Content-Type']) == 'text/plain' || |
|||||||||
Fatal error: main(): Failed opening required 'Net/POP3.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/virtual/sfmc/public_html/admin/bugs/core/mail_api.php on line 22 I get this error from the cron.. I have this on a virtual host (hosting partner)... It's not permissions as the file is chmod' 655.. |
|||||||||
I've got a problem (maybe my stupidity). |
|||||||||
@jbrouhard: You need the Net_POP3 package from PEAR. @rainman: What's your POP3 server? |
|||||||||
The POP3 server is an Exchange server with POP3 access. I turned the debugging on in Net_POP3 and I've been diving through the code. I found a missing Auth_SASL package (which appeared to be optional, but I installed it anyway), but so far I still have a problem. I think I'm close. I'll post a followup if I get it working. I expect I'm missing another package. |
|||||||||
This is the exact server version I am running: It appears that I have an authorization problem. Here is the error I am getting: USER NOT supported authentication method!. This server supports these methods: NTLM, but I support DIGEST-MD5,CRAM-MD5,APOP,PLAIN,LOGIN,USER |
|||||||||
rainman: you might be able to changhe the settings on the Exchange server to allow for PLAIN login, or even APOP login. NTLM is Exchange's hook to the Active Directory. We run Exchange 5.5 where I work, so I can't really check this out. |
|||||||||
OK. The problem appears to be between the exchange POP3 server and Pear::Net_POP3 negotiating the authenitication method. If I hard code the auth method to 'USER' it logs in OK. I will attempt to take it up with the Net_POP3 folks. |
|||||||||
Found a minor problem with the attachment functionality: My POP3 server (MS Exchange (ARGH!)) was sending the message in multiple parts that ended up causing the mail_add_file function to try to save a file with no name. I think that this is because the user was sending the mail formatted in HTML, so the message was considered an attachment, but there was no name. There's probably a better way to fix this, but here's what I did to fix it: In file mail_api.php |
|||||||||
The Server admin got the Net_POP3 pear package installed, and now i'm getting: Fatal error: main(): Failed opening required 'Mail/mimeDecode.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/virtual/sfmc/public_html/admin/bugs/core/mail_api.php on line 23 I'm guessing mimeDecode is missing ? |
|||||||||
I think this package is missing: http://pear.php.net/package/Mail_Mime |
|||||||||
I found that the function to add a bugnote was not working because my project name in Mantis had a space in it. The bug id in the brackets looked something like this [Project Name 0000341]. To fix this I added a space into the regex in the mail_is_a_bugnote function and the mail_get_bug_id_from_subject function in mail_api.php. Old regex example: return pregmatch("/[([A-Za-z0-9-.]\s[0-9]{7})]/", $p_mail_subject); I think maybe I goofed when creating a project with a space in the name, but this fixes the problem. |
|||||||||
Thanks a lot for the bugfixes and patches. |
|||||||||
Heyho, the first patch for Mantis 1.0.0rc1 is submitted. Feel free to test! |
|||||||||
Now, the file adding seems to work! A complete version of Mantis 1.0.0rc1 including all required packages is available for download. |
|||||||||
I tried to download the solution from "http://arme-und-beine.de/download/mantis-1.0.0rc1.zip" but the file downloaded is corrupted |
|||||||||
I've load the file up again. There's also a bzip2 archive in the directory, try this one, if the ZIP archive fails again. (I hate ZIP gah) |
|||||||||
OK!!. |
|||||||||
Having an install issue... pulled down the above mentioned mantis-1.0rc1 bzip with the patches rolled in, went to the admin dir, tried to upgrade the DB and got the following error.. Parse error: parse error, expecting `')'' in /var/www/html/newmantis/admin/schema.php on line 349 line 349 is:
?> I also get the same error with the login page |
|||||||||
Fixed my issue, not sure if this is somthing that needs to be looked at... the problem was as follows - note I had to change the 'id' as I am upgrading an existing mantis and already had a user with id=2 --- mantis-1.0.0rc1/admin/schema.php 2005-08-24 09:58:20.000000000 -0400 -$upgrade[] = Array('InsertData', Array( config_get('mantis_user_table'),
Basically I needed to add the $upgrade[] ... line to the seccond 'mail' user addition code. |
|||||||||
When I run the bug_report_mail.php I get the following error: APPLICATION WARNING #100: Configuration option 'mail_debug' not found. APPLICATION WARNING #100: Configuration option 'mail_debug' not found. However I am still getting the tickets created in my test project under the catagory which they are supose to. What config file is the mail_debug variable suposed to be set in? and what is the recomended value for this option. |
|||||||||
RFE: Is it possible for this to support pop3s as well? out mail server doesn't use pop3 for security reasons. I am working around it right now but my solution is a bit of a kludge. |
|||||||||
RFE: The install doesn't take into consideration that you may be upgrading an existing DB. When it tries to create the mail user it does so with and ID of two... this wont work if you have existing users in your db. The program sould do a "select max(id) from mantis_user_table;" and then incriment that value by 1, assigning max(id)+1 to the id field for the creation of the mail user. |
|||||||||
RFE: E-mail Ticket addition kacks if there is no subject in the e-mail... If the e-mail sent to the box which mantis checks for e-mail tickets contains no subject it will not insert the ticket to the project with a "No Summary" error: APPLICATION ERROR #11 A necessary field 'Summary' was empty. Please recheck your inputs. To make matters worse the e-mail ticket is also del'ed which can lead to a situation where you can get accused of not responding to an issue, because as far as the user is concern their e-mail was delivered even though the bug_report_mail.php/mantis thew the isssue on the floor The mail_api.php should be changed to look and see if the Subject string is empty and write in a default subject so that when it's handed off to mantis it will properly insert the bug to your project. |
|||||||||
Right now this works great for submittion via e-mail however it's practical application is limited due to the fact that all future tracking after the inital e-mail is limited to mantis-only conversation. Is it planned to have this grow to the point where the origional submitter will be e-mailed on each ticket update? as well as an inital tracking ticket which they can reply to, which will automatically update the mantis bug? Without the ability to carry on a conversation regarding the bug over e-mail the usefullness of the submittion via e-mail is limited. |
|||||||||
@drtns: POP3S is possible if it's supported by the Net_POP3 package. The answer for submitters is already possible, if you enable creating of a new account for email reporters. Your patch will be integrated ASAP, thanks! |
|||||||||
In my case I received too the APPLICATION WARNING 100: Configuration option 'mail_debug' not found with no issue created |
|||||||||
Can anybody provide a list of features needed or bugs to be resolved until this feature can be integrated into a mantis-version? |
|||||||||
Of course: bugs:
features:
|
|||||||||
Hi guys, Thanks to all |
|||||||||
Hi all, If a 1.0.0rc2 patch is made can instructions be included on how to apply it to an already configured system? (I've already deleted the admin directory as directed so the schema.php will fail). Thanks, Al. |
|||||||||
I'll make a patch for 1.0.0rc2 this weekend and include a mail sample and an installation howto! |
|||||||||
Will there be a patch for RC 1.0.0rc2? Or will the patch for rc1 work as well? Keep up the good work! |
|||||||||
I'm sorry - until now I was not able to take enough time for making a new patch set for Mantis 0.19.3 and 1.0.0rc2. Maybe, the current patches will work, but there are still some bugs. |
|||||||||
Are there any plans to integrate this feature in Mantis in an official release? |
|||||||||
Jo... I'm ready. For Windows users I'll put ZIP-archives including the patch and necessary stuff on http://arme-und-beine.de/download @moppel: |
|||||||||
The code looks really nice and clean, I think we can integrate this after we put out 1.0 (we want to finally get that out first). A few notes:
Really impressive work! |
|||||||||
|
|||||||||
Hi. I've used Mantis 1.0.0rc2 patch. If I send mail with subject, mail body and attachment I get "It seems, there is no text... :-o" in bug description field. My settings are: |
|||||||||
This could be a bug. Maybe, please send me you testmail to gerrit.beine@gmx.de. I'll take a look. |
|||||||||
poll mail cron info. If someone need a win32 cron running as a service(i try it with XP Pro), i use a ".cmd" batchfile with "c:...\php c:...\bug_report_mail.php" It works great with a freeware from http://www.kalab.com/freeware/cron/cron.htm greetz & great work indy |
|||||||||
nice work, you have done so far. I hope this will improve our work substantially, unfortunately: investigating it a little further: in mantis-1.0.3rc3tar.gz schema.php had ^M (control-M) at the end of every line, so patch couldn't find the lines.... removing them, solved the issue. |
|||||||||
Hi all, I've made a quick and dirty patch for Mantis 0.19.4 and 1.0.0rc4. It's available here: http://arme-und-beine.de/projekte_mantis.html Until now, I haven't found enough time to test it, but I hope it's working. So long... |
|||||||||
It's all working!!!!! |
|||||||||
I've the following two problems |
|||||||||
regarding bugnote id 11929 ad 2) Only load one message: How many mails should be fetched at the same time
See also doc/README.bug_report_mail |
|||||||||
In my configuration the parameter is set to 20 |
|||||||||
Maybe, this could be to large. |
|||||||||
i've posted conceptual issue 0006619. |
|||||||||
I have to problems with this patch: |
|||||||||
FYI: I'm using an older release with my own bug fixes (see notes above) but I found a situation where when one of the reporter email addresses was invalid, the reply from the postmaster was added as a note, which caused another email to go out to the reporter, which caused another reply from the postmaster ... Well, you get the picture. I fixed it by checking the from address and ignoring emails from the postmaster, however there's probably a smarter way to fix it. |
|||||||||
Can i use 1.0.0rc3 patch for Mantis 1.0.0 relase? |
|||||||||
I'm using the patch with 1.0.0 and works fine. |
|||||||||
Hy guys, I am very interested in this feature of Mantis but I don't have the possiblities to test this patch at the moment. My question is: How does the E-Mails look like?? Is it difficult to write them, that the system can work with them? Is it a very robust system, or is it possible that a single character can crash the whole system?? C YA - []Nekro |
|||||||||
I just installed this patch to 1.0.1 and it is great! A few little glitches I have noticed: -Email are not removed from the mailbox. Easily solved as indicated by jaapandre |
|||||||||
Hi there, I'm working on the next "release". I'll submit it after the 5th of march (after the chemnitzer linux days) So long... Gerrit |
|||||||||
Would there be an easy way to: -Keep the emails on the mail server but avoid creating new issues each time they are fetched without deleting the emails? I would like to keep a trace in my mailbox. What I do for now is a rule on the mail server to copy email to a second mailbox from which mantis will fetch emails and deletes them afterward. |
|||||||||
Hi, How can I apply the patch to my mantis system?? Which programm do I need?? I am using a WindowsXP OS... C YA - Nekro |
|||||||||
Take a look to this site: http://arme-und-beine.de/projekte_mantis.html I offer some patched archives of Mantis for download. |
|||||||||
I cannot get the email attachment to be added to my issues. I have the Mail_MIME package installed... and I can attach file to other issues for the same project manually just fine. Any idea what else I could check? EDIT: Ok, I isolated the problem to this line that fails in file_api.php: <i>move_uploaded_file( $p_tmp_file, $t_disk_file_name )</i> I checked both src and dest file names and they are Ok... plus I see the uploaded file created properly in my /tmp/ directory. It does not seem to be linked to privileges and I have safe mode OFF. I am using DISK upload. EDIT 2: Was this tested under Linux with DISK storage? From what I read, the move_uploaded_file function will only work if the file being moved was actually uploaded. When you save the file you got from the POP3 server to the /tmp/ directory it does not look like it qualifies for that function and it refuses to move it to my project's upload folder. I finally got it to work like this: <b>file_api.php:</b> <b>mail_api.php:</b> |
|||||||||
What about setting the priority in Mantis based on if the email is sent with low / normal / high priority? Using a set of variables to configure to what the email priority should translate into Mantis priority... EDIT: Made a quick & dirty patch to enable this, seems to work OK: <b>config_inc.php:</b> <b>mail_api.php - mail_parse_content</b> <b>mail_api.php - mail_add_bug </b> |
|||||||||
Indy, you indicated that you had a new release in the work for better Outlook support... will this be released for 1.0.x or will it be only ready for the 1.1 release that will incorporate the email reporting feature? I am having numerous problems with Outlook emails which make email submission unreliable in my environment. I am eagerly waiting for any improvements! |
|||||||||
Hi, I'm sorry. On May, 2nd the thesis period will be over, then I'll offer new patches with some new features and fixes, especially for mails sent with Outlook. So long... |
|||||||||
Hi, I'm back ;-) Now, a patch for Mantis 1.0.3 is available. I've also added the patches by EBY with some minor changes. In this version, the processing of mails changed: bug_report_mail no longer fetches all mails into an array. Feel free to test and report bugs, if there are any. So long... Indy |
|||||||||
Can someone clariy for me what this patch will do? I've installed it and can get incoming emails to be added as new issues. But, what I really want to accomplish is allowing users to reply to emails that mantis sends out on existing issues and have their reply added as a note to the issue. Can this patch do that? My testing is just with simple text emails. |
|||||||||
How exactly would i set this up on a Windows server with exchange running in the background? My linux knowledge leaves much to be desired. My mantis installation is currently running 100% with no issues but it is a business requirement that can accept incoming emails for tickets. I've been through the entire note list so far and not much has been cleared up. |
|||||||||
^^^ignore that, i got it working \o/ ^^^ Sort of, anyway. I've added the following to my config_inc.php The MIME parsing is functioning correctly but the auto signup is not. I've snt mails from various accounts but it always reports the user as the mail reporter. I've since deleted the mail reporter user and now the tickets have no reporter whatsoever. Any help there pls. Also, i've noticed that the version number have a conflict. I've loaded a test version of mantis 1.0.3 and the latest mail patch but the version number displaying at the bottom of the screen reports Mantis 1.0.0rc4. Any help would be appreciated! |
|||||||||
Just got around to try to install your latest patch... could there be an error with the patch file, I highlighted in bold what I think should not be there, i.e. replace with 'mantis_project_table'. BTW, I am applying the patch to a clean 1.0.3 install. $upgrade[] = Array('CreateTableSQL',Array(config_get('mantis_project<b>file</b>table'),"
Update: I found other issues in the patch file for the following files, could you have done your diff on a 'non default 1.0.3' build? I patched files manually and all seems fine now. File to patch: mantis-1.0.3/admin/schema.php |
|||||||||
okay then, i was just being stupid... Got my mails working. It sends and receives emails without attachments briliantly. Problem now comes in when i send a message with an attachment(doesn't matter if it is the first issue or any of the subsequent responses). The issue will be created and the subject is placed in the summary field but in the description it states "It seems, there is no text... :-o" The file does not get attached to the issue either. |
|||||||||
how would i go about setting the following? I need to exclude all email addresses (except internal) from receiving the signup notification. I also need to exclude certain email addresses from receiving any mails whatsoever. These will be messages that come from other systems relating to downtime, program errors, etc. Any help would be appreciated! |
|||||||||
Is indy still around? I need to install the 1.0.3 patch but i need the windows version... I checked his site and there is nothing available. The last patch is mantis-1.0.0rc4.zip... I have a feeling that this patch will resolve my issues. |
|||||||||
Yes, he is ;-) I'll create a patched version of Mantis 1.0.3 this evening and post the URL here. |
|||||||||
Thanks indy, any news on that URL? |
|||||||||
using Mantis 1.0.1 I noticed that although mail_fetch_max was set to 1, multiple emails were imported and not all correct. I changed this: into this : Most likely there is a better way, if so please let us know. |
|||||||||
Heyho, patched versions of Mantis 1.0.3 are available now: So long... |
|||||||||
Thanks for the patched release. Strange error though. If i install a new version then the db is setup perfectly. If i update an existing installation then the db changes are not applied. I cannot access the manage projects section as i get the following error: APPLICATION ERROR 0000401 I've checked the db and true enough the mentioned fields do not exist. They do exist on a new installation though. This is causing a bit of a problem as i cannot upgrade my current live release to the latest version. Any ideas? |
|||||||||
Please take a look to doc/README.bug_report_mail Quote: If you are alway running Mantis you have to alter your projects table So long... Indy |
|||||||||
Yeah, sorry about that. The typo had me a bit confused... I think alway should actually be already. Different problem now though... I've enabled auto_signup to create a user for each incoming ticket. It imports the first mail from a user perfectly but if i submit a 2nd email it will not import the data. I enabled debugging and ran bug_report_mail.php in IE. The following displays: Array ( [0] => Array ( [0] => 27 [id] => 27 [1] => Mail Requests [name] => Mail Requests [2] => 10 [status] => 10 [3] => 1 [enabled] => 1 [4] => 10 [view_state] => 10 [5] => 10 [access_min] => 10 [6] => [file_path] => [7] => This is for incoming mails (rfs@domain.com) [description] => This is for incoming mails (rfs@domain.com) [8] => mail.domain.com [pop3_host] => mail.domain.com [9] => DOMAIN\RFS [pop3_user] => DOMAIN\RFS [10] => Password [pop3_pass] => Password [11] => 0 [pop3_categories] => 0 ) ) Array ( [Received] => from TESTSVR ([10.1.0.200]) by server.domain.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id PGMJG0QS; Wed, 19 Jul 2006 11:34:03 +0200 [Message-ID] => <291B76E98794D511878C0010B5EC4BEE02A86E07@mail.domain.com> [From] => TEST System [To] => user@domain.com [Subject] => TEST New company registration [Date] => Wed, 19 Jul 2006 11:22:30 +0200 [MIME-Version] => 1.0 [Content-Type] => text/plain; charset="iso-8859-1" [X-Mantis-Body] => New client Registration Company: edwed Contact Person: sds Telephone: 21 21 Ben3 [Priority] => 30 ) Below that i get: APPLICATION ERROR 0000801 Weird indeed. This used to work perfectly before i applied the latest version. Help please! |
|||||||||
We receive from time to time mails without subject and the import script stumbles over this. where the original code was : Before i forget, adjustment has to be made in mail_api.php. Finally want to confirm the issue and fix reported by EBY (0012226) when using DISK as storage solution. Cas |
|||||||||
I'll integrate this new patch and fix the errors on weekend. So long... |
|||||||||
Not too sure if you've done the integration yet but if not would it possible to integrate directly with version 1.0.4. which was released over the weekend? |
|||||||||
Hi bmcool, I'll do this. So long... |
|||||||||
i downloaded the copy from indy's link on 7/16/2006, but when I try to click the link for managing my specific project (manage_proj_edit_page.php?project_id=1), I get the following error: SYSTEM WARNING: main(PEAR.php): failed to open stream: No such file or directory It looks like all necessary pear packages are in it, except for this file. Do I need to download this file from another package off pear.php.net? Thanks. |
|||||||||
You may use the PEAR.php from http://pear.php.net/package/PEAR |
|||||||||
I also can confirm BMCCOOL's comment (0013114) that when wants the user to be added if it does not exist, the latest patch acts strangely. It indeeds generates a "User not found" error. Cas |
|||||||||
I also can confirm BMCCOOL's comment (0013114) that when one wants the user to be added if it does not exist, the latest patch acts strangely. It indeeds generates a "User not found" error. Cas |
|||||||||
I have spotted another issue (and created the solution for it). function mail_add_bug Add filesif ( null != $p_mail['X-Mantis-Parts'] ) { then the mail_add_file routine should be like this --------------------Very dirty: Adds a file to a bug.function mail_add_file( $p_bug_id, $p_part,$p_filenr ) { Hopefully this helps others too. Cas |
|||||||||
Thanks to cas, I've added your patch. |
|||||||||
Heyho, I've updated the patch for Mantis 1.0.5. See: http://gerritbeine.de/download/mantis/ The mail parsing is a complete rewrite, now it should support all combinations of embedded HTML and text and also different encodings. So long... |
|||||||||
Hi, I've recently upgraded to 1.0.5 but get the following error when i run bug_report_mail.php [pear_error: message="Generic login error" code=1 mode=return level=notice prefix="" info=""] This is just the portion of the error that i think is causing the error. I've never seen it before and google doesn't know much either... Any ideas? |
|||||||||
Indy, i have found 2 little issues. One of the nice things of this add-on is that when a second mail arrives with the same topic, it adds it as a note to the original. If you find time to look at this, could you also strip the "RE:" that outlooks adds to the subject when replying such that also those messages can be added as a note ? |
|||||||||
A lot of attachments were lost after the crash of mantisbt.org. Indy, can you please attach the latest code. I will patch this Mantis installation to show the broken attachments. |
|||||||||
Hi there, the latest version of the mail import patch is available again. It is still unchanged, I'll fix the noticed issues when I'm back from Kyrgyzstan in the middle of October. |
|||||||||
Wow, indy! What are you doing there in Kirgyzstan? Are you Russian? |
|||||||||
No, I'm German. ;-) |
|||||||||
That's cool, anyway |
|||||||||
Hey everyone, just wanted to let you know the good news that Indy has joined the Mantis development team and we will work together in getting this feature into Mantis codebase. The first step will be to write the requirements of the feature in the Wiki. The aim of this excercise will be to indentify any necessary changes that are required before including this in the offical codebase. Once this is done it shouldn't be a lot of work to implement the changes and get this stuff in. http://wiki.mantisbugtracker.com/doku.php/mantisbt:requirements I would like to take this chance to thank Indy for his work so far and looking forward to work closely with him once he gets back from his business trip. |
|||||||||
I'm just testing this nice feature under Windows. I had some difficulties with attachments because of the hard-coded '/tmp' in the mail_add_file-function.
} |
|||||||||
Indy, i notice different behavior if i run the bug_report_mail.php script through a commandline. Amongst other things, retrieving the reporter id seems to fail. If i run the script through the browser all works fine. |
|||||||||
This is a fantastic feature I'm really hoping to use, but I've hit an error. When I go to Manage/Manage Projects/'specific project' (manage_proj_edit_page.php) I get the following error: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /mantis/Mail/Parser.php on line 7 I made a complete new install using the 1.0.5 package from Indy's site: http://gerritbeine.de/download/mantis/mantis-1.0.5.tar.bz2 All the files and db tables apear to be in place, and the rest of Mantis functions fine. Any ideas? |
|||||||||
Hi! I need some help! At here we use utf-8 for mail encoding. This is not too nice in mantis when I report a bug by mail. |
|||||||||
vJack, I had the same problem. The cause is the Parser.php. The php scripts in this file are wrote to support only PHP version 5.x. So when I tried to make it work on my PHP 4.x hosting, it resulted in similar errors. Somehow the code should be refactored to support both versions PHP 4.x and 5.x, I guess. |
|||||||||
wrt my post (0013367) Anybody have any ideas how i can get past the "generic login error" when i run bug_report_mail.php? |
|||||||||
hi everyone I'm trying to get this nifty feature working in windows. so far I'm not getting any errors but I'm unsure of a couple things. Is the 'mail' user that needs to be set up the address that we would be sending e-mails to to report a bug via e-mail? and also is opening bug_report_mail.php from the web browser the proper way to retrieve the e-mails for entry into reporting the bug? |
|||||||||
The Mail\Parser.php uses the new format specifiers which are not supported by PHP 4.x. Hence, this will not work on the PHP servers running on most of the Mantis installations out there and won't be compliant with Mantis current minimum requirements. I got it passing the syntax check, but haven't tested it, by removing the following:
It would be great if we can use an older version of this module which supports 4.x. In the worst case, we should avoid including these files if the installed version of PHP is 4.x. |
|||||||||
The Mail_Parser class is written by me. Sorry, I have no more PHP 4.x installations running... ;-) |
|||||||||
what syntax must e-mails follow to be parsed properly for reporting issues? |
|||||||||
Is my understanding of this correct? After installation of the patch you go to manage project accounts and add a user/email address and set up a reporter account? and set it up for the current category of the project? upon running bug_report_mail no errors get generated and nothing changes in the database even when I try to get it to be more verbose. Is there something glaringly obvious that I'm missing? any assistance would be appreciated. |
|||||||||
Small issue with your debug mode... emails are always saved to file to my temporary folder even if debug is off. Looks like you do not check if the debug mode is ON or OFF in the mail_save_message_to_file function, despite the fact that you retrieve the config param value. I moved the call to the mail_save_message_to_file function in mail_process_all_mails like this: ... function mail_process_all_mails( &$p_account ) { ... if ( $t_mail_debug ) { <b>#mail_save_message_to_file( $t_msg );</b> ... |
|||||||||
Does anyone have a patch for this feature based on 1.1.0a2? |
|||||||||
Sorry, there is no newer patch at the moment. I'm sorry. When I'm back in Germany, the development of my patch will continue. |
|||||||||
Is there a reason this has not been committed to the development tree to officially supported, instead of having to patch every release? |
|||||||||
Victor gave me already CVS access, but I was not able to commit the patch into the offical Mantis sourcecode. I was very busy the last months. |
|||||||||
Where I can findout all the modules updated for 1.1.0a1 |
|||||||||
I would just like a quick confirm, that the 1.0.5 patch works for 1.0.6?? |
|||||||||
Same question: I would just like a quick confirm, that the 1.0.5 patch works for 1.0.6?? |
|||||||||
A small problem I noticed and for which I am trying to find a solution: If you forward the same email to Mantis twice (or different emails with same attachments names and order) to add a bug note to an existing bug... then on the second email, the system will add the new bug note but when it tries to add the attachment it will fail and result in a "duplicate file" error. Although this mod adds a prefix (1-, 2-, 3-, etc.) to each attachment in the same email, it will have problems when subsequent emails for the same bug have the same attachments names and in the same order. As a result, the email is parsed into the existing bug note, the attachments dont make it and the email is left in the mailbox after the error is triggered. This means that on the next email fetch, the email is still parsed and bug note added again and failure on attachment (duplicate file name in database) will again leave the email in the mailbox... repeating over and over... with email notification going out non stop each time the email is parsed again. You get the picture. I am trying to find a solution for this: deleting the email prior to this attachment parsing is a quick fix but not intuitive to users as their attachments are just dropped. Ideally, a way to number attachments globally would work... if at the time where the system starts numbering attachments for a new email, it 1st fetched the max attachment prefix number for the current bug. More work. |
|||||||||
I made a quick and dirty fix for the problem I just reported: I do not use the attachment numbering code found in mail_api.php, I could take out the numbering completely but decided to just comment out where it added when passed to the file_add code: #EBY 20070327 - bug with prefix file_add($p_bug_id, $t_file_name, $number."-".$p_part['name'], $p_part['ctype'], 'bug');
Instead when it comes time to check for the unicity of the new attachment file name in the database, I replaced the check as follows: #EBY 20070327 - fix duplicate attachment issue if ( !file_is_name_unique( $p_file_name, $p_bug_id ) ) {trigger_error( ERROR_DUPLICATE_FILE, ERROR );}This works great and if I forward more copies of the same file in different emails they all get added with a different unique prefix. Not a very elegant solution (dont like that kind of loop) but it does the job for now! |
|||||||||
Regarding the 1.0.5 patch for Email on release 1.0.6... I got mine to work although I did have some problems that required minor edits. I don't think the problems I encountered were related to the patch being made for 1.0.5 but rather just small bugs that caused minor issues on my specific setup. |
|||||||||
Hi everybody, it's a very nice stuff !! I've developped the following evolutions on the mail reporter functionnality:
you will find a complete 1.0.6 distribution on http://boulayj.free.fr/Open%20Source/mantis1.0.6%20+%20mail%20reporter.zip |
|||||||||
The zip file seems to be corrupted |
|||||||||
Will there be a version for the 1.1* ???? |
|||||||||
Yes it will, when I find enough time to work on it again. |
|||||||||
Maybe somebody else can do the integration if you dont have the time... (I can look at it if you like...) |
|||||||||
I would love the email format to be compatible with the bugzilla format: http://www.bugzilla.org/docs/3.0/html/api/email_in.html Some thought has gone in to the Bugzilla format, I think it would be a good idea to learn from their experience. Plus compatability makes it easier for people to switch to Mantis. |
|||||||||
I was in need of this feature for Mantis 1.1.0a3. This is the result. It's based on mantis-1.0.5.patch.gz Changelog:
|
|||||||||
I forgot to terminate a line in mail_api.php. ( "Mantis-1.1.0a3-changed_files_only.zip" ) My apologies for that. I added the package again with the correction in it ( "Mantis-1.1.0a3-changed_files_only-v2.zip" ) Can somebody remove "Mantis-1.1.0a3-changed_files_only.zip". I can't do it myself. |
|||||||||
How to apply a patch? Step by step instructions for for reporting via E-Mail patch? I'm running mantis-1.1.0a3 on a shared host. 1) I don't know how to apply the patch :=( HELP! 2) After paching, files in ""Mantis-1.1.0a3-changed_files_only-v2.zip" should be copied 3) I assume that i have to configure an e-mail forwarder for "reporter@domain.com" like this: Correct me if I'm wrong. |
|||||||||
How to apply a patch??? I'm running mantis-1.1.0a3 on a shared host. 1) I don't know how to apply the patch :=( HELP! 2) After paching, files in ""Mantis-1.1.0a3-changed_files_only-v2.zip" 3) I assume that i have to configure an e-mail forwarder for "reporter@domain.com" like this: Correct me if I'm wrong. |
|||||||||
I discovered one last small problem that could occur. So thats fixed in Mantis-1.1.0a3-changed_files_only-v3.zip Because this was the second problem which required patching i tested all the changes. I couldn't find anymore problems. |
|||||||||
@reszel In the /docs/ directory you'll find 2 files called: After the script has been succesfully installed you can log into the admin account. Go to "Manage projects" page. Click on a project. At the bottom of the page you'll find a form to activate email retrieval for that project. Hope this helps |
|||||||||
Hi Indy, I have a couple of things that I think could improve this even more: Keep up the great work! |
|||||||||
Why isn't this in CVS branch?? |
|||||||||
Why isn't this in CVS branch?? |
|||||||||
See note 0013961 davide73italy ;) |
|||||||||
i still dont get how do i activate the reporting by mail... |
|||||||||
If a email Report via Email with attachments recieved. Line 466 in mail_api.php while( !file_is_name_unique( $number . '-' . $p_file_name, $p_bug_id ) ) { it have to be: while( !file_is_name_unique( $number . '-' . $part['name'], $t_bug_id ) ) { |
|||||||||
If a email Report via Email with attachments recieved. Line 466 in mail_api.php while( !file_is_name_unique( $number . '-' . $p_file_name, $p_bug_id ) ) { it have to be: while( !file_is_name_unique( $number . '-' . $part['name'], $t_bug_id ) ) { |
|||||||||
can someone please help me..i have been waiting for many days now i still dont get how do i activate the reporting by mail... |
|||||||||
Hi DaVinci, In the POP3 settings fields, you must type the POP3 connexion parameters. POP3 Host : your mail server Once your pop mail server is configured, you can also configure some parameters in the configuration file In order to execute the automatic reporter, you have to go on page I hope this will help you ... |
|||||||||
thanxx for the reply.. error:<db_username> [pear_error: message="-ERR authorization failed" code=-1 mode=return level=notice prefix="" info=""] error:helpdesk@mydomain.com [pear_error: message="Generic login error" code=1 mode=return level=notice prefix="" info=""] |
|||||||||
im am the administrator an yet i get the error above |
|||||||||
It seems that your connection parameters are wrong !! Try to enter the user account only : "helpdesk", without the complete email adress. It should work ! Could you also give me the version of the mail reporter extension you use ? |
|||||||||
im using: and i appereciate ur help but i do not understand what do u mean http://your_mantis_server/bug_report_mail.php This is what i want to do: http://www.mantisbt.org/forums/viewtopic.php?t=3429&highlight= |
|||||||||
Thank you for great patch! :-) it makes issue and notes for existed issues by email. But it don't create notifications to email reporter via email even with "creating new accounts" option enabled. I'm using mantis 1.0.5 with mantis-1.0.5.patch.gz |
|||||||||
Ummm... First of all, thanks to all for that huge and great work. Second, I have configured this patch ok and I can report issues via web OK including spanish caracters like ñ, á,é,à .. etc... But using mail reporter plug-in I can report issues via email IF NOT contain these spanish caracters... if contain it i get this error: How can solve it????????????????Please. APPLICATION ERROR 0000401 Many thanks in advance. |
|||||||||
After a lot of work making it work for 1.0.8, i finally have it working. Thanks for such a great patch, but i would love to see this new feature in the upcoming 1.1.0 version! |
|||||||||
Please add the following line to the file mimeDecode.php to prevent adding of e-mail certificates (to verify that the mail is from me) as an attachment to a bug. This line needs to be added around line 292 in the function _decode in the above mentioned file. |
|||||||||
Found another small issue. If an email is retrieved with an attachment but no body text, the bug/issue is created but the attachment is not added. |
|||||||||
eagle00789, |
|||||||||
I've played with this for a while and would love to see this accepted into the Mantis sourcecode. Very useful patch, this... |
|||||||||
Please add this one to the project! |
|||||||||
Please add this one to the project! |
|||||||||
I've been abroad for a while, but now I'm back. So long... Gerrit |
|||||||||
Hi Gerrit, I ask, because I'm on the way to integrate this great patch into my prod version 1.0.7 (which also works for 1.0.8) |
|||||||||
Hi all, thanks in advance |
|||||||||
Have a small update on the mail_api.php. --------------------return true if there is a valid mantis bug referernce in subjectfunction mail_is_a_bugnote ( $p_mail_subject ) { Perhaps this can be included in the next version. Cas |
|||||||||
hi, Thanks in advance. |
|||||||||
jboulay in note(0014370) you have a bat file to run the mail call function. I have a test instance of Mantis on Windows XP and I changed the paths in the batch file to match my setup and it works. I've a production version on Windows 2000 server and I can't get the batch file to work. I'm stuck. Do you know what I need to change to have it work on Windows 2000 server? Thank You |
|||||||||
Any news about this patch and its availability for 1.1.0? |
|||||||||
I tried to integrate this patch to mantis-1.1.0 and got the following error: APPLICATION ERROR #18 Page redirection error, ensure that there are no spaces outside the PHP block (<?php ?>) in configinc.php or custom*.php files. Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section. I have checked the config files and the custom files and it doesn't have any spaces outside php block. Any solution for the above problem? |
|||||||||
I have managed to setup the plugin in mantis-1.1.0. The issues was with config_defaults_inc.php and I used the new config_defaults_inc.php and added the additional config parameters for mail_report. However I am unable to create bug from email. I am using a secure POP3 server and have hacked core/mail_api.php to modify the POP3 port to 995. Is there any way out to fix the issue with secure POP3 server? |
|||||||||
I have downloaded and installed 1.1.1, is this issue built in to this new version or do I still need to download and apply this patch? |
|||||||||
scubie, A longer time ago it was moved from 1.1.0 to 1.2.0, unfortunately. |
|||||||||
Thanks brody - still learning to use the system, important lesson learned! |
|||||||||
libregeek, In addition to changing the port to 995, add ssl:// before the mail server. E.g., ssl://pop.gmail.com Once I did that, I was able to connect to a secure POP3 server and retrieve the mails. DaVinci, This may also have been the cause of your "Generic login error" error message. |
|||||||||
Just a couple notes:
Thanks for the work you've been putting into this, Indy. It's an important feature! |
|||||||||
Strangeways, My working copy is on V1.0.7; if you or anyone else is interested, I'd post the fixed file to this thread |
|||||||||
Hi Brody, Thanks for the information! I would be interested in seeing the changes you have made to parser.php. My working copy is V1.1.0, but I'm trying to put together a package of changed files for V1.1.1. Perhaps I could incorporate the bug fix into that and then post the new package here. |
|||||||||
Strangeways, I hope that its enough to only attach the mentioned file "parser.php". May changes are commented with (brody). If you have questions, contact me... |
|||||||||
Thanks Brody! This was very helpful. I ended up including both html parser commands and put an operating system check to run the correct version. I also ended up rewriting the setParts function and made sure to check for the disposition attribute on each part. I've put together an UNOFFICIAL package for V1.1.1 and attached it to this issue. The changes are listed below:
As stated above, this package is unofficial. It also needs testing. Indy, feel free to include any of these changes in an official packaging. Something else I'd like to do at some point is add a checkbox next to the POP3 Host field to indicate a secure POP3 server. This would automatically add ssl:// to the beginning of the mail server string, and also change the port from 110 to 995. |
|||||||||
Just uploaded a new package: Mantis-1.1.1-changed_files_only-unofficial-v1.tgz There was a bug in the setParts function that was causing the content to appear to be duplicated when there was no attachment. My apologies. I've fixed it to only concatenate the content when it is in sub-parts. The previous package can be deleted. |
|||||||||
Strangeways, Although I did not take a look into your changes, but your assumption isn't that correct, I think. I got all parts as attachment including that meant as body. Using a debug session I first found out that setParts() got called recursivly to get sub parts and uses all parts in its last loop. Second the "disposition" test came to check between text body part(s) and text attachment. All attachments (with disposition set) should be handled as attachments (addParts) Regarding the htmlparser - my version is a java class around jericho-html.jar, which also could be used under linux. Because the html parser could be configured inside the configuration (I'm right?) it would make more sense to support a "flying file" parameter, which tells, where the file should be included. Thus you'd get in either case as shell_exec ($html_parser) and inside configuration |
|||||||||
Great, it works. Thanks! I think I found something though. If I configure Mantis to pick up 5 messages at a time, it doen't seem to call the "QUIT" command. Without the "QUIT" command, our GroupWise server doesn't delete messages, although I see Mantis send the "DELE" command. If I make $g_mail_fetch_max 1, everything works just fine and messages are picked up, processed and deleted from the mailserver. |
|||||||||
Just wanted to provide another patch here - but that failed without an error message. This patch circumvents the problem (i have currently), if one can't delete mails on a pop3 account for some reasons. Thus you would set "g_mail_delete" to <b>OFF</b>. Side effect: On every call of the php script you duplicate your issues. I extended the mail_api.php to check, if an e-mail of an account (of a project) is newer than the last checked mail and only add newer mails. Last saving the datestamp of the last added mail, so only then again newer mails are filled in. |
|||||||||
Second try - it did :-) see last attached file (<b>mail_api.php.patch-v2</b>) |
|||||||||
I cannot get the email attachment to be added to my issue and for the description always “No description found” |
|||||||||
I attached the debug file |
|||||||||
Thanks for the debugfile - this file is a Mime-Mail (in my opinion), thus you need to switch at least $g_mail_parse_mime to ON. Besides that, there is a typo in your configuration I guess: |
|||||||||
hi, i added a few lines of code to set the category and severity from the email message when reporting a new bug. --- mail_api.php-orig 2008-02-14 15:07:51.863103100 +0100 +
|
|||||||||
I run it with $g_mail_fetch_max set to 1 and a cronjob that fetches mail every minute. Should work fine as long as there aren't any e-mail bursts. |
|||||||||
Hmm, found something else. This one is nasty... If I report anything via e-mail, the URL Mantis puts in the confirmation e-mail is screwed up. My URL is rewritten to http://www.example.com./view.php?id=xxx (yup, mind the period before the slash). I know the example.com domain is mentioned in the default config, but in my config it's gone. I searched through the program files, but couldn't find anything suspicious. Ok, I'm not a programmer... If I do something with an issue in Mantis itself, everything's fine. But as soon as I interact with Mantis through e-mail, the URL gets whacked. |
|||||||||
One advice on the added POP3 ability, which works on my system. Therein the database is changed and a new user is added to the user base. The user per default has nomail@localhost as user, but of not acknowlegable default email settings, set additional a preference record with all e-mail traffic for that user is switched off. Furthermore it might be useful, to protect that user against deleting and changing |
|||||||||
@Woefdram,0004286:0017046: You right, this seems to be a bug, maybe a not initialized variable, my disturbed URL is more crashed compared to another manually added issue, which says (e.g.): by Mail Reporter, the URL is I guess, that has to do with the fact, that the Mail Reporter is run directly with php.exe, while the other is run through the webserver |
|||||||||
Using the Mantis-1.1.1-changed_files_only-unofficial-v1.tgz I'm having a problem with the description not being added. I have the mail patch running in mantis 1.0.6 and have the config file with Parse MIME = ON and the description is included. But on the 1.1.1 version with the Parse MIME = ON get the error no description found. I can look at the file from the debug and it has the description. I'm running on Windows 2000 Server. |
|||||||||
To fix the URL in the email just add the path to your Mantis installation in the config_inc.php file or added it in the Configuration section in Mantis. Works for me :-) |
|||||||||
@Loki: What did you configure there - Would you tell us? I instead changed config_defaults.inc, made some translations (i.e. de, en) to circumvent this problem with a correct message in the e-mail. I'll attach adequate patches including those for the above mentioned languages |
|||||||||
Hi. In the config_inc.php or in the configuration Mantis version 1.1.1 |
|||||||||
Using the Mantis-1.1.1-changed_files_only-unofficial-v1.tgz I'm having a problem with the description not being added. The Description is included if the email format is Plain text. Parse MIME = ON I've turn on: This setting I don't understand for WINDOWS 2000 Server. How would I set this the example is not for Windows HTML Parser Command
Any help would be Great! |
|||||||||
@Loki: The by default mentioned HTTP-Parser is a plain linux tool and the execution command is also unix like. I needed to change several lines in the mantis software to integrate such an html-parser on windows. Please take a look at my note 0004286:0016968 and strangeways' notes below. The unofficial patch should prepare to use a html-parser also under windows, as strangeways wrote. |
|||||||||
@Loki: Thanks for the tip. I put my Mantis URL in $g_path and now the links Mantis generates are correct. |
|||||||||
@Woefdram: Welcome. @brody: I read the notes and from what is said in them the 1.1.1 should only need these 2 config settings: This is how they are set but I still get 'no description found' in the description in Mantis. If this setting htmlparser\parse.bat ${f} needs to be added I'm not sure where it goes. Thanks |
|||||||||
Loki, i><b>@strangeway</b: Because I think there are a lot of users, who are running mantis on windows, might it be interesting to generally and as an option to the plain linux variant integrate my solution into the next release bundle? I think, that Java will be available on most OSes including Linux and Windows.</i> |
|||||||||
@brody: Thanks for the clarification on why the html is not working. I have Mantis 1.0.6 using the mail import and it imports the description when the email is in HTML. So I'm confused as to why that works on the same server that I have the test version 1.1.1 on? I'm going to hold off upgrading the production code from 1.0.6 to 1.1.x until I've tested a html parser (jericho-html). |
|||||||||
Loki, that is indeed interesting - I'm using V1.0.7 with pop3-email extension on Windows, but not V1.1.1; maybe strangeways could help around V1.1.1 and its differing behaviour concerning the html parser on Windows. The original pop3-email extension is from V1.0.5, but there was no html-parser inside (except the configuration for unix OSes). What is your e-mail backend? Some of them deliver html emails in both html and text. The parser (of 1.1.1) has been changed by strangeways with parts of my code as written in that note below. I tested it thoroughly on my environment. If you would send me such an email, which works on V1.0.6 and not on V1.1.1, I could take a look on it. I've again read your 0004286:0017210 and maybe found a hint to your problem. You wrote about two settings and what they are in your configuration, if I'm right. While the first one seems to be correct (its a switch), the second one is no switch, but the commandline to call and this one I've set to "htmlparser\parse.bat". Please take in mind that my setting assume a slightly other kind of calling mechanism as with unix, but strangeway should have adapted it in V1.1.1 |
|||||||||
b>@Indy</b: Thanks again for providing the pop3 patch. A question: Do you have an idea, why umlauts are destroyed on reading (or saving the mail) as new issue or note? e.g. "ü" get converted to ü |
|||||||||
I have successfully installed the email_reporting patch for mantis-1.1.1. The mails sent to a POP3 account is successfully registered in the mantis system. But the reporter doesn't get any confirmation mail or the bug_id. How can I send back the issue_id to the sender, so that the user will get the issue_id and use it as a referencein future. Is there any patch available? If not can I work on this feature? |
|||||||||
hi all, we are using at the moment mantis 1.0.8 with the mail report function on a Linux Server and it's running perfect. In the future we want to use mantis 1.1.1 with the mail report function on a Windows 2003 Server. Now I'm testing it and I've got many Problems with the mail report function. I know that we must change something in the parser.php file and that we need a htmlparser for windows. @brody: you wrote in note#16968 |
|||||||||
I had some problems with my provider (save mode is set, so HTML parser cannot be launched). So I changed the function setBody in Mail/Parser.php:
The change causes an include of the mailbody in the incidents description field when parsing of HTML mails is rturned off ($g_mail_parse_html = OFF;). It uses striptags() to remove HTML tags from the body. If you like, include it. |
|||||||||
@libregeek's 0004286:0017342: I guess that the Mail Reporter adds new issues to your issue list. If the user gets not registered automatically on sending a new issue (as in my case), he must register at the site and switch its settings to be notified on new issues, but that are all issues. If you register new users ($g_mail_user_reporter = OFF), it might be additional implementation effort to get the user notified about his own issue, because mantis' e-mail notification on new issues does by default only notify developers and above, if they want to be notified about it(personal settings). Additionally you can influence this maybe through settings in the configuration. Take a look at $g_notify_flags |
|||||||||
@jojow's 0004286:0017345: The parse.bat is only a wrapper around "my" htmlparser, the jericho-html parser, I use. If you need it, I'll could put it here, but I think your parser might be wrapped through another call as mine. |
|||||||||
I've tested the "strip_tags" - function. With only this function I get an error 401 and the INSERT into the database won't work.
|
|||||||||
that's funny: |
|||||||||
@jojow: I found a small PHP package which possibly fits the needs: http://php-html.sourceforge.net/html2text.php But I did not try it. By the way: I allways get a strange error message when adding comments with the "Add Note" Form on your installation: Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 199508 bytes) in /home/mantisbt/public_html/bugs/core/database_api.php on line 171 Does not belong here but fyi... |
|||||||||
@brody: Thanks for your clarification. In my case the implementation is like the following - I don't create a new user when somebody sent a bug(via email) to mantis. Instead, it uses a common account(like mailUser) for all users to report the bug to mantis. I am wondering how difficult it will be to add some email-ids to a issue so that they will be notified about the bug status and notes. |
|||||||||
I managed to get German umlauts working by changing Mail/Parser.php: in setBody() I added a new line at the end: <code> Windows: parser command with parameter
</code> In setSubject I also added htmlentities(): <code> This works for me with plain text and html mails. |
|||||||||
Hi, Here at the City of Amsterdam (www.amsterdam.nl) we've been using this GREAT addition to mantis for about 6 months now. We'd like to update to Mantis 1.2. But as you know this e-mail reporting function does not work in that version of Mantis. Are there any plans to for an update for this function to work with Mantis 1.2? Perhaps as a plugin even? Thanks for your reply! |
|||||||||
Hi, I'm working on integrating this into our system. I've hit a problem with net_pop3, which isn't quite decoding mime e-mails properly. Sometimes a mail sent with text and html bodies will contain both: this appears as the body repeated twice, with the first copy containing no newlines (I presume the whole thing is being sent to the html processor) - this is most noticeable from outlook and yahoo! mail though it does not happen every time. Also, if you send a mail from gmail with an attachment, the body is sent as an inline text part, and is not picked up at all. My experience with this is that it can be reproduced every time, simply send a gmail with an attachment and "No Description found" is inserted. Anybody else having these problems? I don't want to have to go in and change net_pop3, and since it's been nearly 3 years since the last release I don't hold out much hope for a bug-fix. I'm going to look at piping it out to a different program/script.... |
|||||||||
@rjosulli: the decoding of mime mails is not done by net_pop3, but by the Mail-package, especially Mail_mimeDecode and Mail_Parser. I remember that I've to fix several issues there (we use MS Exchange/Outlook, too) to get it working. But in the meantime its working in most of cases. |
|||||||||
We also use this feature heavily and I am surprised it is not in the latest versio (1.2.0). |
|||||||||
I'm using Mantis 1.1.1 on Linux with following settings and all tims that a new mail is sent a ticket is created with in the body the plain text and html text. |
|||||||||
@dapozzom:
IF you switch first setting of, html is not handled any more. |
|||||||||
My incoming mail is generated with HTML/Plain text setting on the client, so if I will put the $g_mail_parse_html =OFF the description will contain " No description found", setting to ON the description will contain the HTML body and the "translated" one. So the bug description contains twice the same information. |
|||||||||
I am confused with all this history. Can someone give me a basic outline of how to get this thing running on 1.0.8 and Windows 2003? What files should I download, will I need that html parser, etc? Thanks! |
|||||||||
I seem to have a problem with very long URLs which get truncated if received by mail. And this is how it shows up after importing: Any suggestions someone? |
|||||||||
@dapozzom 0004286:0018024, you wrote: My incoming mail is generated with HTML/Plain text setting on the client, so if I will put the $g_mail_parse_html =OFF the description will contain " No description found", setting to ON the description will contain the HTML body and the "translated" one. So the bug description contains twice the same information. If you have a clean "plain text" part in your mail, you should get it also, if you switch html parsing to OFF. If you get "no description found", did you maybe switch "mime parsing" to OFF. It seems to me that something with your mails is not ok for the parsing process either in mime, which normal correctly differ between text and html parts in general inside mime based mails. I've both "mime parsing" and "html parsing" on, which works |
|||||||||
@cas 0004286:0018044: Take a look into the datbase table to decide, if the line breaks (you see) come from the parsing process or from the bugtracker userinterface. If in the database (bug text table) a URL in the description column is not broken by <cr> or <lf>, the gui breakes an disforms the URLs |
|||||||||
Brody, all long entries direct through the gui are fine, only when parsed at mail receipt wh have this behaviour. |
|||||||||
Found another little issue and prepared fix for it. |
|||||||||
Found another little issue and prepared fix for it. |
|||||||||
Uploaded a new package with changes files for version 1.1.2 Jun 2008
Hope this package is usefull for some of you |
|||||||||
Sorry for this but there was small typo which caused problems with processing attachments. Here is the fixed package: Mantis-1.1.2-changed_files_only-unofficial_v2.zip Jul 2008
|
|||||||||
Hi, For me the following version works fine:
... and mails with attachments are not analyzed right: "No description found" |
|||||||||
Hello, Is: The latest version of this? Paul |
|||||||||
Hi, Just wanted to make a suggestion for a future release. If possible can the passwords not be stored in plain text. Thanks, -Jack |
|||||||||
Is this still be developed or has this been abandoned? Its been awhile since I've seen any updates are there are a few features not working right. I'm having issues with replies to emails not being added as bug notes and the mail parser seems to fail on characters with accent marks on them. Thanks, -Jack |
|||||||||
Hi, I have the same problem with french accents, is there a way to get around this issue ? Thanks. Laurent |
|||||||||
Hello, how does this work if you are using Active Directory? Our UserIDs are not email addresses, they are our network logins. Can this check AD, and create an account using a network login, and fill in the email address as per AD? Seems like everything I read above is related to an internet facing installation. Thanks |
|||||||||
Suggestion for future release: Per project one specific reporter. Now you have to choose between one reporter ( 'Mail' ) or all kind of different reporters. Suppose you have within one organization, which reports by email, one contactperson. You want that to be the reporter. This give them feedback on the issue created ( Issue ID ). I do not want all different reporters in the system. ( Otherwise I would have make accounts for them. Later on you could also update the reporter field in the issue ). |
|||||||||
I am having te same problem with recognizing emails as bugnotes ( already existing issues ). See 0004286:0018506. However for me that is not the solution. How is this suppose to work. What do you put in the subject of the email, just the issue ID ( with or without the leading zero's ) or something else. |
|||||||||
I'm having problems with emails containing attachments. It will not attach them to a isuue, and log file shows: SYSTEM WARNING: file_put_contents(/image001.jpg) However normal uploads by Mantis are working correctly. What could be the problem? However in my php.ini upload_tmp_dir was not set so it tried to write into the rootdir '/', which was not allowed. |
|||||||||
i can not get it to work on 1.2.0a2 i couldnt even get it to work on 1.1.3 or 1.1.4 |
|||||||||
Hello DaVinci. Did not test it on 1.2.0a2, but works on 1.1.4. What is your problem exactly? |
|||||||||
TomR, In 1.1.4 and 1.1.3 the e-mails that Mantis collects are empty: no description, no attachemnts no nothing |
|||||||||
TomR, In 1.1.4 and 1.1.3 the e-mails that Mantis collects are empty: no description, no attachemnts no nothing |
|||||||||
i've a suggestion:
|
|||||||||
Reg. your last mentioned problem of examining the same mail twice, I added a check, if the mail is to old and has been checked before... Reg. empty mails, what product is the mailserver you use?! I guess, a M$ Exchange... |
|||||||||
@brody i've tried to access the mails from LotusNotes but it didnt work :( |
|||||||||
@DaVinci |
|||||||||
@brody |
|||||||||
This would make for a great plugin; I don't think it'll be making it's way into Mantis core anytime for 1.2.x, so removing the target. |
|||||||||
@all the people above when a reporter sends a mail his e-mail address is imported in header: <b>Report from: John Doe <john.doe@domain.com></b> John Doe is always a user in Mantis and i want his name to be imported into <b>Reported by</b> filed instead of <b>Reporter</b> [reporter@somedomain.com] which is the name of the e-mail address everyone sends e-mail to. I hope you understands the question. |
|||||||||
@JReese: When will this come - as plugin? This important feature for a lot of users is displaced many many times... @DaVinci: Think, that I understand you. The patches for the feature to process e-mails can put that name into the reporter's field. But therefore a reporter entry (a new user) must be generated every time. Therefor two switches exists: $g_mail_use_reporter and $g_mail_reporter. If first is set to "OFF" every issue is saved under its reporter. The "Reported from:" is controlled by $g_mail_save_from switch. Seems to be a misconfiguration in your case. |
|||||||||
@brody: |
|||||||||
@DaVinci: Yes (for the first) - as documented in the settings file ... read:" --- mail reporting settings -----
and the second part also documented in the config file: Write sender of the message into the bug report [IF set to ON!] |
|||||||||
b>@indy</b: thanks again for providing the email-pop3 addon. I'm using the (self-extended) mantis-1.0.5.patch.gz addapted to V1.0.7 and have a problem with the original Parser.php, which mangles some mails by second time applying a decoding of "quoted printable". The first apply comes from the origin Mime_Decode class (if configured to decode mime mails directly) and the again decoding of the decoded text comes from the Parser.php class function setBody(), which decodes a plain text again and calls a html parser for html part of mails. Any idea? Is correct to generally make setBody() to only set the body and do no further decoding? |
|||||||||
@brody what am i doing wrong? |
|||||||||
It seems that attached *.txt files are not attached to the issue. Can anybody explain me the reason for that? |
|||||||||
@brody |
|||||||||
@brody i couldnt get it to work with LotusNotes |
|||||||||
@DaVinci at 07:53: I guess you mean W2K (I don't know W3K) :-) @DaVinci at 07:57: If LotusNotes is capable of being contacted by POP3 and you or your application gets the rights to do so. We use (sorrily) Exchange Server and I found a lot of problems, because Microsoft has its own standards regarding POP3 and IMAP. I've no experience regarding contacting Lotus Notes. |
|||||||||
@TomR's note 0004286:0020180: It might be forbidden in this installation. Some of the admins should/could tell you, the reason. I'm only reporter here... |
|||||||||
@brody |
|||||||||
Hi Really very nice, it is great work Actually it's working fine for bug report email.I got following issues kindly help me very urgent. 1.when user reply via email, the whole content(exist notes also) stored in bug notes but i want only reply messags only stored on bug notes. 2.if user attach the file means the bug notes displayed "No description found" but file is not attached to bug notes. |
|||||||||
@TomR 0004286:0020234: I found same problem in context to Exchange Server, which sometimes handled *.txt attachements not as attachement or slightly different to normal attachment. If you use Exchange Server as your e-mail backend that might be the reason for that mishaviour. A general fix is difficult; I fixed Parser.php for that, after digging deep into Exchange's Mail Handling. In general I had to fix/correct a lot of things. BTW: THe mentioned patch seems to be in indys upload of package 1.1.1
|
|||||||||
@Brody, Thnx for your reply, however no Exchange whatsover. Just POP3 on Linux server. I used Mantis-1.1.2-changed files only-unofficial V2.zip and that seemd to work, except voor *.txt uploads. |
|||||||||
POP3 is a "client side" protocol. I connect to Exchange by POP3, but that does not matter the format of the messages. Maybe your mail server on linux does also have special behaviour. I do not know, I found some misbehaviour on Exchange and patched my installation adequately. If you need to get this fixed on your installation, you'll have to debug it. For that I use the eclipse PDT Plugin (org.eclipse.php) in combination with the free available zend debugger plugin and for the non mail functions a local installation on my laptop. Good luck! |
|||||||||
Hi thanks for your reply brody 2.when user reply via email with file attachment, the file is not displayed in notes section and also notes are displayed "No description found" instead of display original reply messages. if any extra configuration need currently i used following configuration in config_inc.php file
kindly help me very urgent can i change any configuration please advise me I need how can i set "bug report email" functionality in our external projects.that is i using testing project in this project i need integrate the bug report email functionality kindly give yours valuable suggestion. |
|||||||||
In the mantisbt wiki it's mentioned that an email_reporting feature is being done(http://wiki.mantisbt.org/doku.php/mantisbt:features). Is this the patch that would be included or are the developers working on some other patch ? |
|||||||||
Rajendran, from your settings I think, there are some more settings regarding the mail reporting: Please check against my settings, which produces wanted output in general and overwrite the default:
Furthermore für the last setting you need a correctly configured HTML-Parser, here is my own: HTML Parser Command
This setting should only demonstrate how to set, but you can't take over! And a correctly set directory:
Both are preconfigured for an unix environment. The file upload settings are IMO only for the web part of the application. Regarding that neither the file is attached, nor the note displays the reply mail, there are several reasons for that - I can't help more. I'd suggest the same, I told TomR with his problem of adding *.txt files |
|||||||||
libregreek, seems to be the available patches. I do not know any release version of mantis, who has this feature completely inside and as the history of this item shows, the integration is moved to later versions many times. I think its difficult for them. Any comments from a mantis developer? |
|||||||||
Hi I am using "Mantis-1.1.0a3-changed_files_only-v3.zip" files but without the file attachment messages are stored fine, but when upload the file attachment the messages are not displayed correctly(the messages are "No descrption found and also file is not stored in our server"). kindly help me i had sent my configuration settings above the notes |
|||||||||
@brody |
|||||||||
Hi when run "bug_report_mail.php" got the below issues 1.APPLICATION ERROR #11 A necessary field 'Category' was empty. Please recheck your inputs. 2.Notes does not added to bug kindly help me pls.very urgent 3."X-Mantis-Body"]=> string(14740) "This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: nomail@montreal.servershost.net Unrouteable address ------ |
|||||||||
Hi when run "bug_report_mail.php" got the below issues 1.APPLICATION ERROR #11 A necessary field 'Category' was empty. Please recheck your inputs. 2.Notes does not added to bug kindly help me pls.very urgent 3."X-Mantis-Body"]=> string(14740) "This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: nomail@montreal.servershost.net Unrouteable address ------ |
|||||||||
I run this page "Run bug_report_mail.php" got the below error error:project@rhytha.info [pear_error: message="-ERR Login failed." code=-1 mode=return level=notice prefix="" info=""] how can i fix this email reply messages(notes) added successfully but when attach the file with reply notes, attachment file are not stored in our server kindly help me |
|||||||||
@brody any suggestions? |
|||||||||
Hi I need track the reply messages from existing mail for our project same for mantis concept. is it possible? if possible give me any reference site or if u have any script sent me pls help me |
|||||||||
@brody and other developers: I think it's worth re-write this patch to suit the new plugin system in mantis-1.2. Does this makes sense? |
|||||||||
when running "bug_report_mail.php" i got the following error SYSTEM WARNING: fopen(Daily task report status.xls) [function.fopen]: failed to open stream: Permission denied APPLICATION ERROR #15 File upload failed. File is not readable by Mantis. Please check the project settings Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section. kindly help me following is my config.inc.php set these values to match your setup |
|||||||||
@rajindran
this is how i've set it up [code] Mail Reporting
Valid methods are: 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'#NOTE: Try to chnage between these methods..the most common is USER
#NOTE Reported by mail: is the name of the bug category in MANTIS [you have to create one] where all the mails that are reportet by mail come
[/code] |
|||||||||
just a short question: does the status "assigned" mean that this killer feature will become part of the mantis distribution finally? :->>> |
|||||||||
@rajendran See 0004286:0019681 |
|||||||||
01: considering that it was assigned three years ago to a developer who no longer contributes to MantisBT, and that no other current developer has stepped up to the task, I'd say "no". However, as I mentioned in a previous comment, the new plugin system in the 1.2.x versions add the possibility for someone to create this as an external feature for MantisBT that won't require editing core files. However, that still requires someone to volunteer the time and energy needed to get something like that working. |
|||||||||
In case nobody is working on this, I am willing to transform this into a plugin. |
|||||||||
Have this plugin nearly ready and am looking for testers. The plugin has been created within the plugin system of the 1.2.x version, more specific on the very last release 1.2.0a3 |
|||||||||
Cas, I am willing to test the plugin, however I first have to setup a 1.2.0a3 version of mantis. I will do that this weekend. Please post when you are ready an upload plugin here. |
|||||||||
Have attached the email plugin called Recmail (Receive mail). Based upon Indy's work. |
|||||||||
I tried to install the plugin in a GNU/Linux (Fedora) server and failed due to incompatibility in directory separator(used \ instead of /) in the require_once statements. These are mainly noticed in the pages/ folder. I have created a patch for the same. Please commit if it doesn't break anything else. |
|||||||||
@cas |
|||||||||
I will incorporate the patch and see if I can do something on the POP3S issue. |
|||||||||
Hi. I have been testing this plugin for use within my company. Two things I noticed but could be doing something wrong: 1) Replies to tickets made via email create new tickets and are not added to bugnotes. Thanks, Tim |
|||||||||
Replies to tickets quite often conatin the full bug-report. This is a pain. add after this section: This has been tested in version 1.1.X |
|||||||||
@ Tim, |
|||||||||
Good question. Where do I find that? Whatever the default is, I guess. I never made any changes to it that way. |
|||||||||
check this setting: $g_file_upload_method |
|||||||||
Okay. Looks like it is set to DATABASE. I guess I should try changing it to FILE and try again. |
|||||||||
Alright, I changed it to DISK and tried again with the same results. |
|||||||||
Okay, I have been doing a little more research. I have found, that if I send in a file attachment, nothing seems to get parsed. Nothing gets added to the ticket as a description, nor does the attachment get added to the ticket. Is it the parser? Where does the $g_mail_html_parser variable go? I added it to the config_inc.php file as I did not see it in any of the files included with the plugin. I have tried sending it as both an html mail and a plain text mail and the results are the same. With an attachment, I get no description or attachment. Without the attachment, it works fine. Let me know if there is any way I can help. Oh, the install is a virgin 1.2.0a3 install with just this plugin. |
|||||||||
I downloaded Recmail.zip, and applied recmail.patch to get it to work under linux. I had two issues:
Made a few minor changes to get it to work better for me. I have uploaded them as "recmail_reply_attach.patch". I hope it helps. |
|||||||||
@cas - reg. your note 0004286:0020883 - a good idea, but IMO from my experience incomplete, because checking this text is not always possible. In the tense of HTML-mails, this text is sometimes not used (and further more I'm german with same contacts). Resulting that I check following:
In newer mails sometimes I saw, that these checks also fails. |
|||||||||
I will include Joshua's patch and make fresh version available. |
|||||||||
@cas - reg. your note 0004286:0020883: What I did was check for the original "$g_from_name" and cut the message there. Not ideal, but better than checking for -----Original Message----- in my experience. |
|||||||||
I have a nasty problem with "Mail/mimeDecode.php". If users have a bug on a page like that and mail it to Mantis the mimeDecode.php destroys this url. How? Well, via the function _quotedPrintableDecode, line 609: $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\1'))", $input); Somehow it seems IF there's a number behind the "equals" sign (=) in de body of the mail, this gets translated into HEX. But we don't want that! I've tried to out comment this function but ran into the problem that the page does not finish anymore failing to delete the mails on the server. So that did not work. Anyone have a suggestion on how to fix this? |
|||||||||
@remko: I noticed this behaviour too - sometimes and on an elder installation of mantis. I tried to find out, where the problem is and I guess this happens on the fact, that the decoding is called twice from the mail processing. Maybe that hint helps - I've currently no time to provide a fix for that, but someone else could maybe. |
|||||||||
@0020906 the following code seems to fix this problem (but only for http urls, so this code could be improved): if (strpos($input, 'http://') === false){ |
|||||||||
Attached version 0.95, have taken into account mentioned issues. Please use recmail095a.zip, initial one contains a bug. Unfortunately I am not allowed to remove. |
|||||||||
Hi, the bugnotes issues works now. I still can't send attachments, however. I am using Ubuntu Linux. If there is anything else you need from me, let me know. |
|||||||||
Is there an error message? |
|||||||||
Hello, Thanks for this helpful plugin. I use MantisBT 1.2.0a3 and have one issue to make it working. I can't add a Mailbox through 'Maintain POP3 Settings' and get an error: "SYSTEM WARNING: mysql_fetch_row(): supplied argument is not a valid MySQL result resource". Do you have any idea about the solution? Thx |
|||||||||
has the table (mantis_plugin_recmail_pop3_table) been created ok? if not, execute this sql on the DB: |
|||||||||
Thanks this table wasn't there. Also I modified my due_date column in Mantis_Bug_Table from datetime to VARCHAR as I had wrong value (-3599) in INSERT query. |
|||||||||
Not sure what that fiedl has to do with this plugin. Nevertheless I do not believe that you should change that. My register plugin certainly expects that field to be 'timedate' format. Suggest to open another issue for that problem. |
|||||||||
@cas: I will try your plugin on our test system. On our live system we're still using the "old" nonplugin version of this function. We found that we also have a "attachment issue" like midgardtech (@0020914). In Mail/mimeDecode.php we put in: if (strpos($input, 'http://' [^]) === false){ that did fix the "broken url" problem, but gave us a new problem: mails with attachments do not get parsed properly any more (and won't be deleted from the server). I quess we have to fix this at the root of the problem. That could be as brody (@0020907) suggests that the parsing is called twice. Do you know if your plugin fixes this broken-URL problem? |
|||||||||
@cas. We are having the same problem as you mentioned @18044 : long URLS get broken. We are only having this problem with incoming HTML-mail. Plain TEXT mails are fine. Did you ever fix this problem? N.B. Not only the URLS are "cut" at a certain point, but also the rest of the text. So I would suspect a "truncate" of "wrap" variable somewhere, but I can't seem to find it. I quess the problem is somewhere in the /Mail/mimiPart.php. But where? |
|||||||||
This plugin has been working well for us now on Linux using the DATABASE method. I made several more edits since the last time. The only major addition is the option to reject unknown incoming emails. (See "reject-mail.patch", applied to "Recmail095a.zip")
I also renamed "Recmail_api.php" to "recmail_api.php" for Linux, though this change isn't in the patch. [edit: We use DATABASE, not DISK. Sorry.] |
|||||||||
@Joshua @remko, |
|||||||||
We've got a problem with attachments which names contain a Umlaut. Those mails do not get parsed properly and therefore there won't be deleted from the Server. Has anybody an idea how to fix that? |
|||||||||
Perhaps by adjusting the name of the attachment by using a function like: Now look at function 'function mail_add_file' inside Recmail_api.php. with : $t_file_name = strip-Accents(plugin_config_get( 'mail_tmp_directory' ) . '/' . $p_part['name']); Do not forget to add this function (strip-Accents) to the same script. |
|||||||||
Thank you for your answer! ["X-Mantis-Body"]=> string(34) "die ist mal wieder ein Umlauttest." ["X-Mantis-Parts"]=> array(1) { [0]=> array(3) { ["ctype"]=> string(10) "text/plain" ["name"]=> string(8) "t?st.txt" ["body"]=> string(31) "Dies ist ein test. bla bla " } } ["Priority"]=> int(30) ["X-Mantis-Complete"]=> NULL } The mail I sent looked like this: This is a multi-part message in MIME format. die ist mal wieder ein Umlauttest. --------------030803080500020503020303 Dies ist ein test. The Problem is that the filename comes as filename*=ISO-8859-15''%74%E4%73%74%2E%74%78%74 |
|||||||||
Hi ... Been a while since I posted my problem with attachments, but I am still getting it. Anytime I send an email with an attachment, Not only do I not get the attachment in the bug but I also do not get a description. Without the attachment it works just fine. I ran the lynx method of forcing the pop3 check which works. But I do not see any errors. I tried running the command line php version and get this message: Could not open input file: /var/www/plugin.php?page=Recmail/bug_report_mail.php Is there anywhere I can look for errors? I did check apaches error.log but found nothing. Thanks. |
|||||||||
As for the umlauts, will try to do some additional testing, to see if it can be fixed. |
|||||||||
Question for the community, currently when receiving an email, the system will try to add it as a note to an existing issue. However this will only happen if the status of this issue is below the "bug_readonly_status_threshold". For now, the next version of the plugin will raise a new issue. |
|||||||||
Unfortunately, I don't know a think about php or programming. You say you are running the software on a windows box? Are you running wamp or xamp or anything like that? I will try to set this up on a windows box to see if things run differently. Thanks. |
|||||||||
I am running Xampp and running IIS |
|||||||||
fyi, in case it's not been addressed yet: fix on non-ascii characters. i'm playing around with an older version (unofficial something, meant for 1.1.1 i think, and i have mantis 1.1.6). to get nordic characters i had to add utf8_encode in mail_parse_content, to get a couple of lines as follows: seems to work fine with norwegian characters. |
|||||||||
Is the http://git.mantisforge.org/w/email.git supposed to contain the code for this plugin? I ask, because the head is empty at all the referenced mirrors, but I can't say anything about the push url. |
|||||||||
It would be nice to get it on there - iirc, when i've looked at these patches before, they dont change the core api's so a plugin would be good. If there is a problem accessing the repository that was created, whoever created it - drop me an email and i'll see if we can get it working. Paul |
|||||||||
Hello people, we had the exact same problem as described by ecik. I traced down the problem to the function file_is_name_unique in the core/file_api.php. It is the sql-query: A possible solution is to change the name of the file beforehand: Our tests have shown, that this helps with german umlauts, but not nessecarily with every kind of special character (which are not found in the german language). I'm wondering if this function is really needed. As far as I understand it, it's there to see if there is already an existing file with the same name attached to the issue. If yes, it will be renamed, using a additional number in front of the name (i.e. filename.txt => 1_filename.txt). Anyway, hope I could help. |
|||||||||
Hello, We are able to test it for other umlauts, too. Not only for german. I will post if any further problems with special characters appear. |
|||||||||
Glad I could help. Here an additional note: If this fix is not working for your special characters, be it norwegian or hindu for example, you could try just replacing those signs using str_replace() or one of the other functions that php offers. As the very last solution you can disable this check completly. As I said before, we don't really have a scenario, where we would need this verification. |
|||||||||
Hi, <b>isset($contentType['charset']) ? $contentType['charset'] : 'US-ASCII',</b> and line 205 from: and line 400-402: <b>// } elseif ($charset && (strtolower($charset) != 'us-ascii')) { but i still get questionamrk instead of norwegian chracters. Can nayone help me here please. |
|||||||||
Hi, to get nordic characters i had to add utf8_encode in mail_parse_content, to get a couple of lines as follows: |
|||||||||
@ecik |
|||||||||
@cas when I start the automation "... php.exe plugin.php?page=Recmail/bug_report_mail.php ..." as found in the readme.txt i get following Error: |
|||||||||
@ecik @DaVinci -Jack |
|||||||||
hi, error:abc [pear_error: message="Generic login error" code=1 mode=return level=notice prefix="" info=""] the settings are. POP address: pop.gmail.com can anyone please help |
|||||||||
@DaVinci: you should fiddle a bit with the authentication method. I had the same problem with Exchange, turned out it worked just fine when I chose "user" there. |
|||||||||
please verify the mail authentication method |
|||||||||
The auth method used for POP3Valid methods are: 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'$g_mail_auth_method = 'USER'; i've fiddled with the authentication but it didnt help |
|||||||||
@DaVinci http://mail.google.com/support/bin/answer.py?answer=86399 I would suggest changing the port from 110 which is the standard POP3 port to 995 if you really want to try it out with Gmail. -Jack |
|||||||||
@Devslashnull a.k.a. Jack I didnt understand that |
|||||||||
Don't use Gmail to test unless you want to make changes to the code. I gave you the link for Thunderbird to show you that Gmail does use port 995 and not 110. If you still want to use Gmail to test then you need to update the code to use port 995 instead of 110. If you are using other accounts that don't use port 995 then you will have to make a fair amount of changes to the code base in order to support POP3 accounts using port 110 and those using 995. Hope that clears things up. -Jack |
|||||||||
@Brody c0020317 You mentioned that you had found a solution for your own implementation for processing text documents for an email and that you made several code changes to Parser.php. Any chance you can provide us with the changes you made so I can configure it for the setup I am working with? Also it seemed like you indicated a change had been implemented but I am using the code from Mantis-1.1.2-changed_files_only-unofficial_v2.zip but am still encountering the problem. Any insight would be appreciated. -Jack |
|||||||||
@jack |
|||||||||
Not sure what you want to know about LotusNotes and phpMail. I've never user LotusNotes so I can't say anything about it. -Jack |
|||||||||
@jack |
|||||||||
@davinci, |
|||||||||
Hello all, I got this error with this plugins Did I miss something !!!! Debian Etch Recmail_api.php need to be renamed to recmail_api.php (or only a symbolic link) reject-mail.patch is not a patch ... =) Here the result |
|||||||||
Hi everyone I saw that cas already created a plugin for MantisBT-1.2.0 But it didn't work that well for me, mainly because he was directly referencing mysql_query functions and i was using mysqli. But i also made some small modifications to this script which i never uploaded here as can be seen from the changelog. In the end i created my own version of the plugin and incorporated as much as possible from cas's ideas. I hope he doesn't mind. I hope it works well for everyone. Here is my changelog
|
|||||||||
Thanks SL-Gundam, good to see the plugin has reach an even higher level. Will be testing this shortly. |
|||||||||
Just tested with success. Is there a way to control the reply message? Thanks again. |
|||||||||
What do you mean control the reply message? I know there is currently a bug where mantis 1.2.0rc1 sends emails to users in only its Global language (normally english) and not that of the users its sending to. Maybe thats what you mean? Btw i'm currently updating this script again with a feature that was requested on this page but i apparently missed. When a new user needs to be registered automatically it will try to use the senders name as the username. If this fails it will use the email address as a username Look forward to it |
|||||||||
As mentioned earlier here is the small update Aug 2009
I think this will be the stable release for a while unless i think of something new to change... but i'm out of ideas and can't find anymore in this issues bugnotes. |
|||||||||
@SL_Gundam: first of all: thanks 4 this plugin! |
|||||||||
I checked but it properly decrypts it right before it wil try to connect to the pop3 server But i did find a bug in MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.rar (0.5 didn't have this problem) where if you edited a mailbox, that it would not decrypt before editing. Upon saving it would encrypt it on top of the already encrypted password Fixing this now. Should be a new version in about 30 mins |
|||||||||
Here is the changelog for (MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.1.rar) Aug 2009 v2
|
|||||||||
I created a custom field called "user_email", and I needed that email will be sent to this email and not the user's mail. how can I do? thanks! |
|||||||||
i'm not really following you. Could you explain it a little bit more? |
|||||||||
do you speak spanish?? I created a custom field called "email user" diferents users reported incidents in mantis with the same user account. The notifications to get to at email of the prefences of user, but I want to get to custom "email user" How can I change it? sorry for my english! :-( |
|||||||||
No, I speak dutch. Alright i'm gonna try to decribe what you're saying. Correct me if i'm wrong. You created a custom field in mantis called "email user" and connected that field to the required projects. You want those automated notifications sent to the email address in the custom field "email user"? If that is the problem then i have bad news. Mantis api's are set up to email to users and the email address in the user profile for those users. It is not possible to sent emails to specific email addresses outside of the user accounts. If necessary you could fix this by creating a plugin yourself or find someone to do it for you. But would it not be easier to correct the reporter for the issues? EmailReporting can do this automatically, see the second, third and fourth option in the EmailReporting configuration page. |
|||||||||
what and where is the EmailReporting?? can you help me? thanks! |
|||||||||
See the attachments to this issue for file "MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.1.rar" |
|||||||||
I download it but I dont know install it! can you help me? thanks |
|||||||||
Read the readme in EmailReporting/doc/ directory inside the package for more information, though based on your reaction i'm not really sure this will fix your problem. Also i think you are better off asking this question in the support section "Forums" of MantisBT (http://www.mantisbt.org/forums) |
|||||||||
mail_api.php: function mail_parse_address I had issues with emails from LoutsNotes where the passed in p_mailaddress was just the email address. preg did not match and the function returned blank which then raised errors and blocked further processing. Simple fix of adding an 'else' resolved it for us: NB This is in the version for Mantis 1.1.2, I see the version for Mantis 1.2 now returns an array, presumably the additional line would now be: This may be of use to some of you if experiencing similar issues. |
|||||||||
There should be "<>" around the email address even if the name is not present... is this not the case with lotusnotes? weird... i thought that was part of the standard Anyways i applied the change mentioned by you in version 0.6.2 of the EmailReporting plugin(not yet released). |
|||||||||
Hi I try to download MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.1.rar Thanks |
|||||||||
Hi I try to download MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.1.rar Thanks |
|||||||||
No the package is complete, its just that mantis currently has a bug it seems with getting the name of the file correctly to the client. Just save the downloaded php file with the proper name and extension (.rar) and you should be able to open the package properly SL-Gundam |
|||||||||
Hi thanks SL-Gundam but I extract to ./plugins/ directory i cant see any thing related to EmailReporting in side plugin manager? can you help me please -kasshapa |
|||||||||
The files need to be placed in [your mantis folder]\plugins\ You should extract without using the file name as a path but with the directory structure inside the archive. The end result should be: [your mantis folder]\plugins\EmailReporting\ In the folder should be one php file and 5 folders. If thats all correct you should see a box with "Installed plugins" and "Available plugins" or at least one of them in the "Manage plugins" page. Click install for the plugin "Email reporting 0.6.1" That should get you on your way |
|||||||||
Hi SL-Gundam it wont work my site on that way :( thanks |
|||||||||
Well found your problem (i think). This plugin manager is for old mantis versions. You need to install mantis 1.2.0rc1 with its builtin plugin system. The latest emailreporting package requires mantisbt 1.2.0rc1 or it will not work SL-Gundam |
|||||||||
Hi SL-Gundam thanks for you reply. any idea for this? -Kasshapa |
|||||||||
Yeah it means that the php module is not working properly from the command line. This might be because it can not find the folders with extensions or that it can't find the php.ini file. At least its not a problem with the EmailReporting plugin. try "php.exe -i" or "php.exe --ini" (both without quotes ofcourse) to debug your problem |
|||||||||
Hi SL Gundam I put OFF to script from running via a webserver and try to run the Script via web browser. then it say it can find the PEAR.php inside the \plugins\EmailReporting\core folder and i copied the PEAR.php from \plugins\EmailReporting\core\Mail after that it was asking about PEAR5.php but i cant fine the PEAR5.php in side this code but i got the PEAR5.php from the php.net and copied to \plugins\EmailReporting\core . then it say error:Tracker [pear_error: message="-ERR Command is not valid in this state." code=-1 mode=return level=notice prefix="" info=""] Am i in wrong way? Kassapa |
|||||||||
Hi SL Gundam php.exe --ini Configuration File (php.ini) Path: C:\WINDOWS and php.exe -i display full information in CMD |
|||||||||
I've reproduced the problem with the missing pear.php. Its actually not missing, just in thw wrong folder. I'm going to fix this and will release a new version when its ready SL-Gundam |
|||||||||
Well here is the new version: MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.2.rar It only contains some minor fixes and improvements but it fixes some hickups some of you might have encountered Changelog:
Oh and cas i have not heard anything from you about my version of the EmailReporting plugin after you commented that you would try it. I'm wondering if you have any ideas for improving the plugin even more. SL-Gundam |
|||||||||
My tests went ok, all I did afterwards was watching progress here. I can only say that you have done a great job. For now I have no more requirements/ideas for improving. |
|||||||||
Hi SL Gundam thanks for the new vertion error:Tracker [pear_error: message="-ERR Command is not valid in this state." code=-1 mode=return level=notice prefix="" info=""] error:Tracker [pear_error: message="-ERR Command is not valid in this state." code=-1 mode=return level=notice prefix="" info=""] is there are any configration i must do? thanks |
|||||||||
Thats an error with the mailbox you added. See the following link for possible solutions: http://www.google.nl/search?sourceid=navclient&ie=UTF-8&rlz=1T4GGLJ_enNL270NL270&q=%22Command+is+not+valid+in+this+state%22 But you could also try adjusting "The authentication method used for the mailbox". You can find it in the configuration page of the EmailReporting plugin |
|||||||||
Thanks SL Gundam Now it’s working. Thanks for the all help given Regards |
|||||||||
Hi, Thanks for this new version too. It's very helpful! However, I still have a problem with Frenc characters with accents (as à,é,è,...) which are removed in the bugnote (i.e.: problème->problme). I tried several solutions explained previously but I'm still stuck. Any help would be welcome, regards, Tanky |
|||||||||
Yes they are removed because of the conversion of the charsets. EmailReporting converts all charsets to utf8 Some characters will be removed because it can not convert them properly. Its better then the alternative where originally it would cut of any further text when such a character was encountered If you find a good solution to this problem where it will convert those characters properly aswell, let me know. For the moment i think selecting the proper charset in EmailReporting config is the best way. For example: If the tables and fields in the mantis database use a utf8 charset then also select utf8 in the emailreporting config page. If the tables use a latin1 charset you should probably apply the iso-8859-1 charset in the emailreporting config page Hope this helps SL-Gundam |
|||||||||
Hello, MySQL tables use latin1_swedish_ci charset and I already choose iso-8859-1 charset in the EmailReporting config page without any success. Thanks for your answer anyway. I just have to wait until someone provide us a solution. Tanky |
|||||||||
I've got some good news and some bad news The good news is i think i fixed the charset problems. The bad news is that my experience with charsets is limited. So i might have created new bugs I tried testing the changes as well as i could and it seems to work without problems but please let me know whether this fixes possible problems you encountered with the charsets Also 1.2.0rc2 is out but i have not tested this plugin in that version yet (as you can see from its filename). I'll do that in due time but i think the plugin should work properly since i have not seen any changes in the plugin system or in the core functions of mantis used by this plugin which could cause problems. But i might be wrong though Here is the new version: MantisBT-1.2.0rc1_plugin_EmailReporting-0.6.3.rar Changelog:
|
|||||||||
hmmm i seem to have missed a post from cas about the processing of bugnotes (0004286:0021199). I going to apply the fix as cas suggested in the next version |
|||||||||
Hello SL-Gundam, I applied the lastest patch but still get the charset problem. Thanks |
|||||||||
I'm using utf-8 in the database, in EmailReporting and in Microsoft Outlook 2007 Will try to investigate this a little more SL-Gundam |
|||||||||
It seems multipart emails dont get parsed properlly, so the bugs are coming in with no content the header is parsed, but the content of the email is negated |
|||||||||
I will look into that Keloran. But i don't expect a fix in the next couple weeks since all of my pc's except for the server are being reinstalled SL-Gundam |
|||||||||
Seems to be a config issue, semi fixed now (it did loose some formatting, but not enough to complain over) |
|||||||||
@SL-Gundam: I changed my Outlook charset from Iso to UTF-8 and it works now! By the way, do you know how to change my current MySQL database charset from ? So, I don't have to modify configuration of all my Outlook users? Thanks |
|||||||||
it's possible by creating a sql dump, changing all the charsets references in the dump and reimporting the dump. This will create problems though since some characters will be replaced by question marks for existing data on reimport. I'm going to try to reproduce your setup and see what i can do to fix it SL-Gundam |
|||||||||
@SL-Gundam and @cas, it's great to see that we have this work as a plugin for 1.2.0. My understanding is that you support pulling the data from POP email accounts. I wonder if we should structure the plugin into two pieces:
What are your thoughts? |
|||||||||
Thats actually not a bad idea. I'll try separating the two parts and integrating imap into the plugin after i find a fix for the charset problems SL-Gundam |
|||||||||
Hello everybody. When i attach single zip file that contains some text/log files in mail and creating issue through mail. The zip file is attached properly with the newly created issue but couldn't read that file. It is not being opened. And similar case, when i attach some other files like word, excel with the same zip file in mail then i'm able to read this zip file properly. No issues at all. Can anybody tell me the solution to this? Steps to come to error:
B) Working situation
I have attached same zip file in A and B situation. But one is working another is not. |
|||||||||
You do not have this problem when you add those zip files to already existing issues using the upload functionality on the issue details page (so when adding attachments to issues without use of this plugin)? SL-Gundam |
|||||||||
@SL-Gundam Hi, Hope you can help me. The key to this problem must be somewhere in a 7/8 bit check triggering some kind of hard word wrap I'm thinking. What are your thoughts? By the way: I've had this problem with all versions of this plugin but would really like to solve it. I'm using UTF-8 encoding for the plugin and for my database. |
|||||||||
@remko Thats probably a problem with the html parser. I'm not sure whether that is fixable but i will look into it. SL-Gundam |
|||||||||
Problem with PHP 5.11, wait for 5.12 before you upgrade. Commenting out feof in readLine fixes this problem:
As feof( ) seems to randomly return true I suspect a timing issue, probably depends on whether the mail server has written to the socket before feof is called - our mail server resides on another server. The problem has possibly arisen in PHP bug 49072 (feof never returns true for damaged file in zip). http://bugs.php.net/bug.php?id=49072 It is fixed in the latest version ( 5.12 release candidate 2 ). |
|||||||||
@SL-Gundam : found the problem. It's not with this plugin parsing, it's with the display parsing. The text in de database is fine, with soft linebreaks where they should be and no broken text. So I ques I'll have to look into the standard mantis display parsing for the description field to fix this. |
|||||||||
i know that mantis 1.2.0rc1 removes line breaks in the simple view and shows them properly in advanced view. I'm not sure about 1.2.0rc2 since it does not seem to have those view types |
|||||||||
@tanky I think i've found the reason why charset conversions still did not work properly for you. I will release a new version of the plugin in a couple days. Please test it again with that new version SL-Gundam |
|||||||||
@rajil I think i've found your problem and its not an issue with this plugin As far as i can see Mantis 1.2.0rc2 sometimes adds some text before and after the actual file. This might cause your problems with reading the file. The cause for this bug might not be mantis but i did not investigate any further Also in 1.2.0rc1 and rc2 there is a problem where the name of the file is not properly assigned which results in a file name like "file_download.php" or "file_download" followed by whatever extension the original filename had. SL-Gundam |
|||||||||
@remko I think i've actually found your problem. It has to do with plaintext emails. Email programs often add a html and a plaintext version of the same email to the email its sending. It seems the plaintext versions get wrapped while using the latin charsets, either by the email program (in my case outlook 2007) or the email server(s). At least it seems its not something i can fix within this plugin SL-Gundam |
|||||||||
Well its finally here: MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.0.rar IMAP functionality has been added and a small number of improvements and bug fixes are present in this version. it's possible that the changes have created new bugs, especially since new functionality has been added but i've checked the new functionality as good as possible so lets hope we don't see any more bugs ;) Charset problems should be fixed now. Please let me know if any of you still find any problems with this IMAP addition based on work from Rolf Kleef 0007086. The IMAP base folder is the folder under which Mantis expects to find subfolders for each project or a single folder for specific project. This could for instance be "INBOX/to_mantis" (meaning the mail folder "to_mantis" under the INBOX folder of the account). If you enable "Create project subfolder structure" for a mailbox, folders for projects are created under the IMAP base folder if they don't exist yet. Emails in those subfolders will be imported to their corresponding projects. If you disable this setting, only emails in the basefolder will be imported to the project which is defined for the mailbox Inbox can most likely not be your basefolder, but that might differ between different imap servers. (Applies only to mailboxes where you enable "Create project subfolder structure") The very free format of project names needed to be mapped to a bit more restricted format for IMAP folder names. We took these steps, and it might lead to name collisions or folder names that are a tiny bit different from their project name counterparts (but we haven't had problems in practice).
Changelog:
SL-Gundam |
|||||||||
Hello SL-Gundam, Thanks for this new version. It fixed my charset problem whatever ISO or UTF-8 selected in Outlook for sending emails. Tanky |
|||||||||
Thats very good news tanky, we have finally fixed that issue then :D SL-Gundam |
|||||||||
@SL-Gundam
Since mantis wont let me upload here is a link: |
|||||||||
@obstbaum80, looks good. I've already made changes for a 0.7.1 release so i will change my 0.7.1 to 0.7.2 and add your changes to them SL-Gundam |
|||||||||
Hi everyone Here is a new version: MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.2.rar Based on obstbaum80's work and some small enhancements by myself. Since one issue regarding the 0 byte attachments could block the proper processing of emails, i'm releasing this update now instead of waiting for more people to find bugs. If necessary a 0.7.3 release will follow for further bug fixing Changelog:
SL-Gundam |
|||||||||
Does the plugin work with version 1.1.1 of Mantis? |
|||||||||
No, i'm afraid not. The plugin system which it requires was a new feature in version 1.2.0. So you need to have at least MantisBT 1.2.0rc1 SL-Gundam |
|||||||||
Hi, i hope somebody can help me. I'm new to mantis and try to run mantis with emailreporting possibility. I have a successfull 1.1.8 Installation and some confusing problems with a paralell try to install 1.2.0rc2. So, my Question is, can i use any Package with my 1.1.8 Installation? Would be nice to get some help... Thanks |
|||||||||
Simple answer is NO. Package are geared towards the plugin module of version 1.2 |
|||||||||
Hi everyone here is a new version again: MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.3.rar I've put in some more work and its now possible to run this plugin without setting up a cronjob. Though the recommended method is still that you set up a cronjob. I added that functionality for people who for some reason are not able to set up a cronjob. This method has the disadvantage that the main trigger is a mantis page visit. So if nobody visits the mantis webpages, no new issues will be imported. There is a timer in the plugin configuration so that not every page visit will trigger this, we wouldn't want to spam the mailservers with connections. I've also made several enhancements to the code as can be seen from the changelog below Dec 2009 v3
SL-Gundam |
|||||||||
It's kinda a shame. Today i had a new client for who i also set up MantisBT 1.2.0rc2 + the EmailReporting plugin. During this i found out that there is a possible problem with setting up a cronjob on linux systems. This problem consisted of not being able to find the core.php file in the mantis root directory. I applied a fix for this in EmailReporting 0.7.4 just a day after i released 0.7.3. Anyways it comes down to this. If you have problems setting up the cronjob because its failing with errors that it could not find core.php in bug_report_mail.php on line 5, please let me know. I will prepare 0.7.4 for release if more people have problems with this, otherwise i'm going to wait a bit more until the changelog for that version has grown a bit bigger. Merry christmas and a happy newyear SL-Gundam |
|||||||||
I had this problem (unable to find core.php), but I've fixed it, so for me no need for a quick update... |
|||||||||
Help Needed! I'm not sure this is the right forum to ask for help regarding a setup issue with this plugin.. so if it isn't please point me to the right place. Also, I am not a programmer so my knowledge of PHP is limited. Configuration: I installed the plugin, activated it, and setup a POP3 account in the mail account settings. When I do "test mailbox" the response just goes back to the Since I am on windows I run the c:\program files\php\php.exe c:\inetpub\wwwroot\mantis\plugins\EmailReporting\scripts\bug_report_mail.php from the command prompt (and tried via a batch file) and it just returns nothing so I don't know whats going on. It doesn't write anything to the mail temp folder that I have setup in plugin configuration nor does it create a bug. Also, I have turned on Debug and it doesn't write anything to that folder either. The only thing I can see that may be an issue is in the plugin config, at the bottom it says: "PHP mbstring functionality unavailable" Maybe this is the problem? What does it mean? Anybody know what's going on? |
|||||||||
open up php.ini |
|||||||||
That message would be fixed by Cas response but it should not be necessary for the plugin to work properly, it's only needed for charset conversions between emails and database. Though i have noticed that at the moment in 0.7.3 its missing those conditions so it actually does require mbstring in 0.7.3. I'll fix that for 0.7.4 During the testing you only get "Operation succeeded" when you enable "show_queries_count", otherwise when a test is succesfull you'll just get the maintain mailox page again. So your mailbox is working properly It only needs those temporary folders when there are emails in the mailboxes its checking. Let me know if you are having problems fixing "PHP mbstring functionality unavailable", then i will make 0.7.4 available here SL-Gundam |
|||||||||
I realize this is not a forum, but wanted to say THANKS for the development, it is not that I use it, but the enthusiastic persistent development is great! |
|||||||||
i would like to submit some additional changes i made. any chance we can get access to a git repository on mantisforge to continue the development in this plugin? |
|||||||||
@obstbaum80 I've also got some changes lined up. I don't know about the if and when of the git repository but in the mean time we can at least combine our changes and make a new release of this plugin in this issue. SL-Gundam |
|||||||||
Hi there, i've a little question about the text parsing process. If yes, where can i find the config file to set up what to parse where to? Do i need goodPHP experience to modify it? Never really worked with php yet. Just want to have a email beeing added directly to the Tracker fields and not everything in description and modify the plugin that for example a body like this : "Category:1&&Reproducibility:Always&&Severity:Minor&&Description:'MyTextHere...' and so on" will be submited directly to the Bugtracker System I'm using MantisBT 1.2.0rc2 and Email reporting 0.7.2. Chris |
|||||||||
Currently the plugin will not parse the body for anything It will use the default values as defined in the mantis configuration parts (config_defaults_inc.php, config_inc.php and the mantis configuration page) One thing this plugin does do is parse the priority of the email SL-Gundam |
|||||||||
Well here it is again: MantisBT-1.2.0rc2_plugin_EmailReporting-0.7.4.rar This version just fixes a small number of bugs that were found. The most significant changes are probably:
Jan 2010
SL-Gundam |
|||||||||
Hello, localhost/mantis/plugins/emailReporting/core For checking I installed the pluginmanager plugin. It works well against emailReporting. PEAR also works. At the moment I use that version: http://downloads.sourceforge.net/mantisbt/mantis-1.2.0rc2.zip Greetings from Berlin, Germany |
|||||||||
Basically the procedure is as follows
That should be it |
|||||||||
Hello, I edited the bug_report_mail.php and found on line 31: "$t_mailboxes = mail_get_mailboxes();" Then I asked google for 'mail_get_mailboxes()'. I got no answer. Do you have an idea what's wrong here? bolshi |
|||||||||
mail_get_mailboxes is a function in core/mail_api.php. Weird that you get that error because 2 lines before that mail_api.php is included by a require_once. Which means that if that failed, it should have already got a fatal error. But since you did not get that error a version of mail_api.php was included... though i doubt I fear you might have mixed various versions of EmailReporting with each other, particulary a version older than 0.7.0 and 0.7.0 or newer (maybe even a MantisBT 1.1.x version of this plugin). Do the following (make sure you create proper backups if necessary):
This should fix any conflicting EmailReporting versions. |
|||||||||
I reinstalled as described. Seems to be fixed. Thank you. At the moment I don't get a message from crontab. But I don't get no mail as well. Neither via POP nor via IMAP. If I test the account via POP there's no error message. Via IMAP I got the following: Operation NOT successful Mailbox description: mantis request via IMAP [pear_error: message=", " code=0 mode=return level=notice prefix="" info=""] Do I have different ways for testing? appended:
[code] Mail Reporting
Valid methods are: 'DIGEST-MD5','CRAM-MD5','LOGIN','PLAIN','APOP','USER'#NOTE: Try to chnage between these methods..the most common is USER
#NOTE Reported by mail: is the name of the bug category in MANTIS [you have to create one] where all the mails that are reportet by mail come
[/code] Which file do I have to edit to fill the appropriate values into it? |
|||||||||
your mailboxes are setup correctly when you do not get a error when you test them. But when no emails are imported at all, then the cronjob is not working as it should. I suggest you check that a bit more. About the code above, thats useless since it was applicable to a older version. All of that has been moved to the EmailReporting configuration. |
|||||||||
Concerning description the cronjob contains the following: That's just for mistakes. But I couldn't find any other information to define the cronjob. In mantis forums they said: "Sorry, we don't support that plugin." |
|||||||||
afraid not. It expects you know pretty much on your own how to create a cronjob and if needed how to find out whether its working properly. If you lack that knowledge then i think the easiest way would be to go to the EmailReporting plugin configuration page and set the second option to "No" and remove the cronjob you added. Thats pretty new functionality though so there might still be some bugs in it. Also make sure you do not get errors when you test the mailboxes you've set up. I'm afraid i can not help you since the error you are currently getting is empty. Which should not be possible... Why do you have the hostname mail.server.de? As far as i can find that hostname does not exist, neither does server.de for that matter |
|||||||||
This is a great module, thanks for the development. I've just noticed a big issue while configuring mailboxes when working with subprojects. The value of the dropdown on a subproject is e.g. "6;8" which is not numeric and hence the saving of the mailbox setting fails. The mailbox_project should be "8", not "6;8". Any chance of fixing this? |
|||||||||
I've fixed the issue. It will be in the next version. Though i'm not sure when that will be. You can fix it yourself by doing the following:
SL-Gundam |
|||||||||
Excellent, thanks for your quick and precise response. It works as described. |
|||||||||
Thanks for this excellent tool. but one more question. how can i automatically set the "assigned to" person. i have assign some projects to a admin and when an bug is reported by mail the admin of this project need to be informed. for one this is no problem. but when i have different projekt with different admins how can i do this? Thanks for your help |
|||||||||
That can be fixed easily with the default mantis functionality. Just go to Manage -> Manage Configuration -> E-mail Notifications Now for "Status changes to 'new'" enable the proper box for the access levels that you want to receive notifications. |
|||||||||
Newbie here, I am trying to get this plugin to work with my Google Apps account. I tried various combinations, but unfortunately nothing seems to work. Can you please help with the settings? |
|||||||||
I perform regular tests on gmail with EmailReporting (don't know if google apps differs greatly). I do advise that you check whether you are running the latest version of EmailReporting Both IMAP and POP work for me. See the following pages for information on the configuration for gmail accounts |
|||||||||
Hi SL_Gundam I am running the latest version of EmailReporting. Can you please share your settings for POP3 This is what I have Can you please tell me what I am doing wrong? Thanks |
|||||||||
Thanks for your help. Now I try to inform the reporter when an note is added to his reported task. but i doesn't work. The next thing is, that the answer is always coming with the default "mail" reporter mail address. but i want to use the mail address of the used mailbox and this is different from the mail account user. Is it possible to change this? |
|||||||||
@pearljam145, could you test the mailbox using the EmailReporting "Test mailbox" functionality. I've just tested this with my own gmail account and it worked without problems. I used the same set up as you. Also please check whether you have enabled POP for your gmail account (see the settings page within your gmail account for "Forwarding and POP/IMAP") @Andreas Besier, various things could cause that the user does not get notifications
Also the email address of the mailbox the email was sent to is not used for anything during the creation of the issue. EmailReporting uses the following two settings from the configuration page to decide who sent the note or the issue to EmailReporting
Also Andreas, please keep your questions on the topic of EmailReporting. Any questions about standard functionality of MantisBT should be directed to the forums: http://www.mantisbt.org/support.php SL-Gundam |
|||||||||
Ok I found the issue. My ISP is blocking connections on port 995. I just tried telnet pop.gmail.com 995, and got a connection refused message. Sorry about the trouble and thank you for the feedback. |
|||||||||
i just tried what you did but i used putty, but it also fails. So it might not be your ISP. My advise still stands, try the "Test mailbox" functionality and see what error it returns. SL-Gundam |
|||||||||
Would this plugin also work with MSSQL? Or is it independent 'cos Mantis itself manages the db stuff? |
|||||||||
the earlier plugin for 1.2.0 called recmail was specific for mysql but EmailReporting only uses the mantis api's and therefore should work with all the supported database types for mantis |
|||||||||
Hi again, sorry for my question again maybe i use the wrong thread. But i use 3 Mailboxes with the server type POP3. Each Mailbox use an different projekt. For example: Mailbox: A Pop3-Account A Project A I only got one configuration with the option "Use one account for issues created by email " set to no. Everything works absolutly fine but when i receive an mail, for example somebody add an note to an task, the reply address is always "Mantis Bug Tracker (no-reply@xxxxxxx)" The no-reply@xxxxxx comes from the mail account user. But i want to change this mail address from no-reply@xxxx to an mailbox specific address for example: Mailbox A POP3 Reply-Address: projectA@xxxxx I also tried to change the plugin_EmailReporting_mail_reporter configuration from each project to specified project with different Users. But it doesn't work. Please can you help me or do i have to use this in an other thread? Thanks for your help |
|||||||||
Hi again, sorry for my question again maybe i use the wrong thread. But i use 3 Mailboxes with the server type POP3. Each Mailbox use an different projekt. For example: Mailbox: A Pop3-Account A Project A I only got one configuration with the option "Use one account for issues created by email " set to no. Everything works absolutly fine but when i receive an mail, for example somebody add an note to an task, the reply address is always "Mantis Bug Tracker (no-reply@xxxxxxx)" The no-reply@xxxxxx comes from $g_from_email config settings. But i want to change this mail address from no-reply@xxxx to an mailbox specific address for example: Mailbox A POP3 Reply-Address: projectA@xxxxx I also tried to change the plugin_EmailReporting_mail_reporter configuration from each project to specified project with different Users. But it doesn't work. Please can you help me or do i have to use this in an other thread? Thanks for your help |
|||||||||
@Andreas. The email address mantisbt uses as the from address when its sending mails is core mantis functionality. This plugin does not change or add anything on to that. See the following settings in config_defaults_inc.php and possibly config_inc.php /**
/**
But why would you want to change the reply address? replies work from any address. If sombody replies to a mantis notification email, it does not matter to which mailbox the email is sent, as long as EmailReporting correctly checks the mailbox for emails it will allways be added to the correct issue. SL-Gundam |
|||||||||
Tried to install the latest version of plugin in mantisbt-1.2.0 (stable) and got the following errors in the manage_plugin_page APPLICATION WARNING #300: String "plugin_EmailReporting_title" not found. In adidtion the following errors occured in the plugin page(mantis/plugin.php?page=EmailReporting/config) APPLICATION ERROR #2502 It may be nice if this package is added to the git repository(http://git.mantisforge.org/) |
|||||||||
Please ignore #c0024462 I have added a minor feature to prevent spam emails getting reported as issue in mantis. (Use case: Our company is providing support only to three companies which has their own domain names. We don't expect other users to mail to this exclusive support email address) This feature is completely optional and you have to specify a configuration change in EmailReporting.php. This requires a configuration variable named 'mail_patterns', which is essentially an array of regular expressions to match the incoming email. The regular expressions should be compatible with preg_* methods in PHP. As of now, this configuration change cannot be done through the admin interface. You have to edit the source code to make the changes. I have also incremented the minor version of the plugin(0.7.5) |
|||||||||
I have made one more change in mail_get_user() method. This is to check whether the incoming email address is already registered in mantis database, even if mail_use_reporter is set to TRUE. Here is the use case: I have tested and confirmed that this change will not break any existing functionality. The updated package is tagged with version 0.7.6 and uploaded to the files section. It is very hard to track the versions in this bug. It may be really nice if this plugin is moved to http://git.mantisforge.org |
|||||||||
Thats useless libregeek. That was already present in EmailReporting if you do the following: In this case it would check for existing users with the email address. If that fails it will use the Mail Reporter account as a fallback As long as you give your external clients no account in mantis this should work as expected SL-Gundam |
|||||||||
Hello SL-Gundam, |
|||||||||
I have reverted the changes as per the comment in c0024486 and the package is added with version 0.7.7 I have also separated the README and CHANGELOG and changed the format for CHANGELOG file. The entries are now based on version number which would be easy to track the changes. How about adding this plugin in git.mantisforge.org with the name "EmailReporting" ? |
|||||||||
I had a problem getting the plugin (0.7.7) to be available in the plugin section. When I copied 0.7.5 in there it worked great. Anyone else see this? |
|||||||||
Yeah libregeek changed the plugin directory name which could cause problem for people updating there existing installation. In a couple hours i will release a new version and it should be fixed. SL-Gundam |
|||||||||
Well here it is. A little bit earlier then expected since i put some extra time in testing the changes this weekend. MantisBT-1.2.0_plugin_EmailReporting-0.7.8.rar I implemented libregeek's idea using a different method. His idea was good, but its implementation was not user friendly. Also mantisbt already contained a variant of his idea in its core code. Its better to use that. The validation is done by the email_is_valid function which checks for several things based on certain core mantis configuration options, namely One drawback of this method i implemented is that it only allows one domain, which might not be enough for libregeek. But i believe thats something that should be taken up with the mantis developers to improve the functionality so that it allows multiple domains It uses the limit_email_domain setting which can be found in config_defaults_inc.php in the mantis root directory Changelog:
SL-Gundam |
|||||||||
I am getting the following when I test my mailbox:Operation NOT successful Mailbox description: GMail [pear_error: message="not connected! (CMD:LOGIN)" code=0 mode=return level=notice prefix="" info=""]I tried recreating the mailbox from scratch and got the same. |
|||||||||
I just tested this on my gmail account (using EmailReporting 0.7.8) and it works without issues. I also see nothing wrong with the way you set up the mailbox. The hostname should officially be imap.gmail.com but from tests it seems smtp.gmail.com works as well The error suggests a problem with making a connection to the imap server Is it possible the server where your mantis installation is running, is not allowed to make outgoing connections to port 993? SL-Gundam |
|||||||||
I have a server setup primary for database hosting, but also for cron jobs. It seems to work fine on there, so I'm happy. I could have sworn it was working on my Win2003 servers before, but then I went back to 0.7.5 and got the same error so maybe I just didn't document where I was running it from very well. Anyway, thanks for all the support. Great work on this plugin. |
|||||||||
Another new version as there were some bugs that needed fixing: MantisBT-1.2.0_plugin_EmailReporting-0.7.9.rar If you enabled the new functionality for email address checking, all emails would have been rejected most likely. This is because instead of checking the email address, an array was passed to the email_is_valid function. This is now fixed. NOTE: i forgot to update the version number from 0.7.9-DEV to 0.7.9. This will not cause any problems. So the next time a version is released by someone it will be either 0.8.0 or 0.7.10. Mar 2010 - EmailReporting-0.7.9
SL-Gundam |
|||||||||
Thanks to SL-Gundam for reviewing the code and suggesting better implementation for limiting email domains. My idea was not entirely based on email domains. Some of our partner companies uses email address in the format firstname.companyname@gmail.com. I know that we can use our own domains in gmail, but those companies don't need to bother about the email management and their policy is not to provide official email address to their temporary employees. It seems weird, but it's the way it works. My concern was to address such issues also because we are providing mantis support to such small companies. In this case 'limit_email_domain' doesn't work and a regular expression is the ideal solution, even though it needs some developer intervention. The folder renaming was a mistake from my part and I'm sorry for this. It would be nice to use an Open Standard compression utility(such as gzip or bzip) to package the module. RAR is a proprietary format whichn is not an ideal format for a FOSS project (http://en.wikipedia.org/wiki/RAR). In addition, it is causing too much problems in GNU/Linux based systems. Each time I download this package, I have to manually copy them to it's corresponding folders. Please see the attached screenshot |
|||||||||
I have created a repository in git.mantisforge.org for EmailReporting plugin. Please visit http://git.mantisforge.org/w/EmailReporting.git Please note that I'm still learning Git from http://www.kernel.org/pub/software/scm/git/docs/user-manual.html , So please guide me if I'm doing something wrong. I request all the contributors here to create an account in git.mantisforge.org(if you don't have an account) and post your username here. I can then add your name to provide you commit access. Since the plugin works well with the latest mantis(1.2.0), I request the developers to close this ticket and do all the future customisations in Git. |
|||||||||
@libregeek 0004286:0024573 @libregeek 0004286:0024577 |
|||||||||
@SL-Gundam: You can find several GUI here: But I haven't used any of them, since commandline is the best tool for me :) |
|||||||||
Hello, I just installed this plugin and I must say I'm very thrilled. It works great and was very easy to setup. Is this possible? If yes, how? Thanks for your help |
|||||||||
Quote from above... Just downloaded Changelog: My job is: Line 17 is |
|||||||||
Well, answering myself here, I did it this way : Add the following at lines 701 and 758 and the following at lines 712 and 760 (line numbers adjusted after each add) |
|||||||||
@obones, currently not (yet) possible with this plugin. It listens completely to mantis config settings. Unless you hack it like you did now @ch750536, libregeek placed the wrong file in /scripts/bug_report_mail.php. Please download MantisBT-1.2.0_plugin_EmailReporting-0.7.9.rar found in this issue |
|||||||||
Worked a treat, thanks. |
|||||||||
Thanks, that confirmed what I thought. I'll keep watching for new versions.
Regarding the second remark, I would have thought that email IDs would be saved in a table (or a file) to indicate which have already been processed. Otherwise, how could the plugin know if an email has been processed when not deleting them from the mailbox? Once again, thanks for the great work. |
|||||||||
Well, ok, my bad, point two is my fault as I forgot to add "global $g_email_receive_own;" just before the config_set calls. This lead to invalid update queries made to the database. |
|||||||||
libregeek has fixed the problem with /scripts/bug_report_mail.php in the git repository. So from now on people can use the git repository to download the plugin, if they wish. SL-Gundam |
|||||||||
@obones. The reply removal functionality has been specifically set up to remove original mantis notification emails from reply's, not to remove all reply's in the email. I'm still trying to figure how best to set up complete removal of all reply's. But i have not found a satisfying solution (not yet anyway) About the email ids. It's functionality i never really looked at as i did not use it. But i'll test it and see what happens and possibly make corrections if required. SL-Gundam |
|||||||||
About the email ids. In my pop3 tests with delete mail setting disabled. The email was only processed one time. It seems to only process unread emails. After an email is processed it is automatically marked as read. IMAP does not offer this functionality though So if you sent an email to a email address and mark the email as read using imap or webmail, it should not be processed by the EmailReporting plugin if you are using pop3. IMAP on the other hand will keep on importing the same email over and over. I'll see what i can do to improve it for IMAP, but don't expect a fix very soon though |
|||||||||
Thanks, I'm using pop3 so it's fine with me. Assign the category according to keywords in the subject line Basically, the idea would be to have a regular expression that if matched indicates which category to use for the newly created issue. |
|||||||||
Is there a way to use the email report only for adding notes? Creating a bug should processed through the mantis forms. If an email with an unknown issue # is received the email will be discarded. Furthermore here is an idea for keeping out spam mails:
|
|||||||||
Which file did you use to add your auto reply hack? |
|||||||||
@ativak: That was in core/mail_api.php |
|||||||||
@obones. Personally i think its more logical to just create multiple email addresses where users can email to. You can create multiple mailboxes in emailreporting that are connected to the same project but if you select a different category for every added mailbox you will have the same effect. This is in my opinion more user friendly for people using it. @Andi3938. Currently only adding notes is not possible. But you could create a trash project were emails without a valid issue id would be imported. If you make the project invisible you only need to empty it every now and then. I'll see if i can add a good methode for this in the next version. Also the second requested feature is already present in EmailReporting. Just adjust the the configuration options on the "EmailReporting configuration" page (reachable from within the "mailbox settings" page and from within the "manage plugins" page) @obones and alitvak. That fix will move the configuration for email_receive_own to the database. Keep that in mind. It might also be smarter to use config_set_cache to only set it in the current page request |
|||||||||
We actually already have multiple addresses, one per "department" that can post issues. |
|||||||||
I can see why that would be usefull in your situation. I'll be looking forward to your implementation of the idea. |
|||||||||
SL_Gundam, |
|||||||||
I'll add it to my todo list (unless somebody else adds the functionality before me of course) But i think we could expand that idea to some ideas that were already mentioned where you can set up different rules on which certain actions are applied on received emails. For example (rough rule set idea): This way people can set their own parameters which they can use in emails. Which should satisfy other requests mentioned in earlier notes aswell But this functionality would require considerable work if we want to maintain a user friendly interface. Also this is just my idea on a possible implementation so if anybody else has other ideas on how to do this please post them here so we can discuss them |
|||||||||
Well, I feared it would be complicated to store the configuration but it was definitely easier than I thought. |
|||||||||
@obones: |
|||||||||
Ok, done, hope this is ok |
|||||||||
Just done another commit that allows sending bug notes to projects that have accented characters in their name. |
|||||||||
@obones |
|||||||||
Well, they work fine on my server, but I have no idea if they work on a non UTF-8 environment. |
|||||||||
Good morning all! I'm working on getting some Mantis upgrades rolled out here internally at my company and have a few questions about this one before I start on it. I've gone over most of the messages above all the way back to beginning, but some of the code is above my head. OK, most of it is, hehe. :) Functionality wise, does this do the following at present:
Primarily we need to use this so that some of us can respond to bugs from our blackberries rather than having to log into mantis each time. Would not need to create new issues so much (use Mantis forms as mentioned above). As a note: I'd be interested in having this added to core functionality if desired, and can have company work with the consulting group to get online. Just a thought there. I have a message into the MantisBT group on a few other items as well. |
|||||||||
currently EmailReporting allways imports the emails without modifications except for the possible removal of original mantis notification emails. So if two people are emailing eachother back and forth and CC the mailbox from which EmailReporting retrieves emails during the whole session, then that will create new issues over and over unless all of those emails contained a issue id. Then all of those emails will imported in that issue. But if people just reply to mantis notification emails then there should not be any problems. |
|||||||||
Sounds good Gundam. Another question: But if people just reply to mantis notification emails then there should not be any problems. So if I respond to a notification e-mail, hitting the reply, and my response includes all the notification text (bug information, bug notes, bug history, bug relationships), will all that text be added into the new note, or is that stripped? Thanks very much! |
|||||||||
There is an option to strip it. Install the plugin in a test environment, you'll be able to get a better grasp of what it does and what it does not. |
|||||||||
I've worked a bit more on this plugin and noticed that the call email_notify_new_account never returns and that the email is not deleted and added as a bug until the next time interval as elapsed for the cron task. John Doe <j.doe@company.com> Currently, it will create a user whose user name is "John Doe" and whose email is "j.doe@company.com" without a real name. user name = j.doe This makes it much more friendly to my users who now have a single account, no matter where they post their bugs from. http://www.mantisforge.org/dev/manual/en/developers/dev.contrib.submit.html Hope this is good. |
|||||||||
Hi all, I have recently installed Mantis plus the mentioned plugin, the whole configuration is:
The thing that is important to me is for all the users to be able to create issues in Mantis by sending email. I have installed and configured everything according to documenation and it works - well, most of the time: I have one problem I haven't been able to solve. The problem I need help with concerns automatization: everything works if I manually get emails from POP3 account to mantis using webserver, but it sometimes crashes when I try the other method - to schedule a job with php.exe running the script. Details:
plz hlp anybody because there is no info on the web... |
|||||||||
Ah i see the problem. It will be fixed in 0.8.0. But that version is currently under development and it will take me some time to finish it. For the moment i advise you to setup a scheduled job like was mentioned in readme and not use the alternative method which you have currently enabled. Basically this means that the windows task scheduler must run the following command (adjust directories for your installation): Now to disable that setting i mentioned, set the following setting to "Yes" in the configurations options: "Have you (or will you) set up a cron / scheduled job for retrieving emails (recommended = Yes)" For the second problem with the commandline script, you need to adjust the mail_encoding setting in the configuration options. It needs to be the same as your database charset. I think that should fix your problems... if not let us know SL-Gundam |
|||||||||
hello, thank you for your answer the problem is connected to charset/collation - because the problem mails are those who contains polish language specific chars
plz hlp regards, |
|||||||||
alright the it might be something thats in the email which causes the error Do the following Enable debug mode in EmailReporting and make sure that the complete email is written to the debug directory. The file that created should be formatted more or less like this: [unix timestamp]_[md5 hash]. That file contains the complete email before it is parsed. If you succeed at creating that file, we just need to get that file to me so that i can debug the problem and hopefully fix it. SL-Gundam |
|||||||||
ok I did that - how can I provide you with that file?
|
|||||||||
Well filmerkl's problem has been fixed, though it required him to reinstall his software on a different machine. I don't suspect it to be a problem in EmailReporting, but rather in mysql configuration files... but since it was fixed by him we did not investigate any further @obones 0004286:0025040. I could not reproduce your problem with the email_notify_new_account function. Please try to find the reason it stops working for you. An error would help to investigate it further. Also everyone. http://git.mantisforge.org/w/EmailReporting.git - Now shows historical releases but also contains in progress work. If you grab a release from there make sure you get the right one as in progress work is more susceptible to bugs. Stable releases will still be posted in this issue SL-Gundam |
|||||||||
@SL-Gundam 0004286:0025134 : I'm not quite sure why it fails, maybe it's because I don't have anyone that wants to get notified, and that I'm using LDAP to authenticate users. I'll see what I can do, but it's not at the top of my priority list. |
|||||||||
Notification of removal of functionality Hi everyone I'm still very busy with version 0.8.0 One of the changes will be the removal of functionality introduced by me in EmailReporting 0.7.3 To be specific, this change (from changelog): Scheduling bug_report_mail as a cron / scheduled job is not required anymore, but is recommended and EmailReporting default configuration assumes you have / will set one up. The alternative method i created had one bug which i fixed in 0.8.0-DEV but i also found out that the functionality has serious problems compared to the normal method. Its limitations (some also apply to other scheduled solutions that would call bug_report_mail through the webserver) have forced me to remove the functionality as its just not practical. The limitations are among other things
The execution time is the important one because the script looses most of its time retrieving data from the mailboxes. A single 12mb to 17mb email could easily take up 45 seconds of running time and 128mb of memory. I advise everyone that uses this functionality to try to find a solution so that you can run bug_report_mail as a properly scheduled job. Personally i don't think anyone actually used it as the bug that has been in it would have only made it work if you used a non-standard http / https port for your webserver SL-Gundam |
|||||||||
@obones. During some testing of another problem i actually ran into your problem with email_notify_new_account. It's actually a bug in the email_api.php of mantis itself but its correctible by just filling a certain variable with a value (0011818). It all depends on how you handle notice errors. If notice level errors halt your mantis installation from further processing the script then your problem will show itself. Since most production environments do not halt on notice level errors there are no problems for most users, most development environments on the other hand show and halt on any errors including notice level errors. I will fix this for 0.8.0 SL-Gundam |
|||||||||
Just a suggestion. Can we move this issue discussion to a forum that allows truncating older notes or perhaps we could delete at least half of the notes here. I don't think anything older then 2009 is relevant for the current discussion. |
|||||||||
The rules system idea has been scrapped... at least for the moment. The reason for this is that while i was busy with 0.8.0, i also added code which would allow other plugins to hook themselves into the emailreporting plugin. See the calls below. These calls are the same ones also used for the creation of normal bug reports Allow plugins to pre-process bug data$t_bug_data = event_signal( 'EVENT_REPORT_BUG_DATA', $t_bug_data ); Possibly for use with extra notifications creationhelper_call_custom_function( 'issue_create_notify', array( $t_bug_id ) ); Allow plugins to post-process bug data with the new bug IDevent_signal( 'EVENT_REPORT_BUG', array( $t_bug_data, $t_bug_id ) ); This should allow other people to create their own adjustments to the created bug reports using there own plugins or plugins created by other people. Since this would allow the more experienced people endless amounts of adjustability, i thought it would be better then a rule system which could very well be too limited and clutter up the interface. If ever i still get the silly idea to create the rule system. It will be created as a new plugin which requires the EmailReporting plugin @cas. This might be something you can connect to your Reminder plugin and also get your due_date the way you want it. I'm actually planning on having a look at that plugin and possibly use it within the IT department where i work. @obones. Please also try to implement your categorybysubject idea using this method. The LDAP problem you had with user account creations will be fixed in 0.8.0 SL-Gundam |
|||||||||
@alitvak: I agree with you, it would be nice to be able to post bug requests in the "EmailReporting" category. @SL-Gundam: Nice idea to have plugins in here as well. I'll wait for 0.8.0 to come out and will experiment with this. There would be a need for an event that allows to add elements in the configuration page though. One other thing that should be considered: Do not store the attached files directly but rather call a webpage to do the storage for us. This would solve those two problems:
That special webpage could be one from the plugin package itself, thus allowing to call it without being authenticated but restrict its usage from localhost for instance. The "Source" collection of plugins by John Reese has such a script with similar restrictions for importing the latest changesets from a source repository |
|||||||||
@obones. Added configurations will require a configuration page within your own plugin. If that causes problems please let me know and we'll discuss whats needed to fix it EmailReporting uses the exact same method for file uploads as mantis bt does and therefore supports all different methods (disk, database, ftp). But for disk a small fix was required before it would work. Thats the reason for custom_file_api.php Concerning the Cron user i'm exactly sure on how to fix problems like that. Largely because i use a windows server SL-Gundam |
|||||||||
Well here it is: MantisBT-1.2.0_plugin_EmailReporting-0.8.0.rar My todo list is empty again. You can get the new version from: http://git.mantisforge.org/w/EmailReporting.git Biggest changes:
Changelog:
SL-Gundam |
|||||||||
I just tested the 0.8.0 version and I must say that I'm very please with the quality of this release. Most of my customizations are now obsolete, this is very great.
I have thus modified the EmailReporting plugin to have its own events, and I used them to create my own plugin that does the category by keyword processing. Regards |
|||||||||
Events based on subject are possible by using the generic events and the $t_bug_data->summary which is always the subject I will have a look at the second part (and your patch) SL-Gundam |
|||||||||
Yes, but summary was just an example. Having access to the whole data means that one can do whatever he can think about and not be limited to what is inside the BugData structure. |
|||||||||
Just uploaded my plugin that uses those new events. |
|||||||||
@SL-Gundam: |
|||||||||
@SL-Gundam: Here is the situation: For various reasons, that "www-data" user cannot have a shell and cannot have a cron table. So for the EmailReporting plugin to work, the cron entry has to be associated to another user. Let's call that user "mantisuser". But later on, when someone accesses a bug page and tries to get the attached files, it's the Apache server that tries to read the file. And because it runs under the "www-data" user, it cannot read the files owned by "mantisuser". To avoid this, there is the brute force method that consists in changing the owners of the files right after the bug_report_mail.php script has run. But this is not always possible because some administrators may not want to give access to the chown command. That would most likely be the case on shared hosting for instance. The sensible way to solve this is to not create files owned by someone else in the first place. And for this to happen, there is a need to call an upload script via the web server. This page from the EmailReporting plugin would then call the "file_add" function from "file_api.php" which in turn would add the file as if it had been uploaded via the regular Mantis page. Using that second method, you can now get rid of custom_file_api.php and thus avoid the maintenance headaches whenever the Mantis team does a change to the official file_add function. I have made the required changes to my own installation of EmailReporting and it works just fine. It requires CURL support in the Apache server, but this is available on most systems by default. The attached patch applies the required changes so that you can see for yourself. |
|||||||||
yep you're right about the directory trims. That will be fixed in 0.8.1 For the rest i will have a look at them |
|||||||||
One other thing: |
|||||||||
The file_upload method provided will not be implemented. The reason for this is that it causes other problems, namely if the webserver is behind a router / firewall, its possible that the url used externally is not available internally. Also i feel that it is a completely different method of processing the emails. If we add attachments using that method we might as well do the same with the bug report and bugnotes. One requirement i have for EmailReporting is that it works with as little requirements as possible. EmailReporting can use mbstring and openssl. But it does not require it to do its work. Same with the PEAR packages as they are present in EmailReporting. But with your solution CURL is required if you want attachments to work... unless we add two different solutions for processing attachments. But i'm not planning on doing that. Maybe a variant of this could be an idea for the next major release |
|||||||||
After looking at the plugin you created and the changes it requires in EmailReporting, i got to the following conclusions. Its possible for your plugin to use the generic events. Just do the following:
Now the only variable not available for your plugin is $p_mail and you don't really need that since all of its information is in the t_bug_data. My goal is to make EmailReporting as transparent as possible. Users should not notice any differences whether they use emails or the mantis website. Specific EmailReporting events would stand in the way of that. [EDIT] removed part about plugin_config_get usage as i was wrong about that SL-Gundam |
|||||||||
Well nobody's perfect, especially not me so this was not unexpected MantisBT-1.2.1_plugin_EmailReporting-0.8.1.rar You can get the new version from: http://git.mantisforge.org/w/EmailReporting.git This bugfix release fixes a problem on linux systems from note 0004286:0025288 Apr 2010 v2 - EmailReporting-0.8.1
SL-Gundam |
|||||||||
For the file upload, I can understand. I'll have to keep it because it's the only way for me to have things work properly. External branches are here for this kind of scenario, so it's fine by me. For the plugin subevents, I'm sorry, but I don't understand your logic here. If I follow it to its end, there shouldn't be a way in Mantis to add anything to its configuration page, nor to its menu, everything should be in the plugin configuration page. Making EmailReporting transparent is a good idea, but not allowing to plug cleanly into it, I have trouble understanding. In the end, you're the one deciding here, but I just wanted to help make that plugin customizable by as many people as possible. And neither you nor I can know what they could come up with. |
|||||||||
My comments were just about the availability of information. Your changes to event calls were not a requirement for those, they just might have made it a little but easier. Also i don't want to compromise the configuration options of the EmailReporting plugin. If in the future there is a need to adjust those configuration options, i don't want to run the risk of possibly erasing, breaking or conflicting with those options added by other plugins. Every plugin should manage his own configuration options. About the decision. If i'm the one implementing it i need to be convinced that it is the right solution. With your plugin, as stated in the comments, there were other ways, in my opinion better ways, to do it. Thats why i personally decided against doing it myself. But that does not stop other people from pushing it into the repository though. Just as long as it is not me. I've got your email address from your plugin. I think its best we continue this discussion there. A lengthy discussion here would not do this mantis page any good. |
|||||||||
I have received your email, I will continue that conversation over via this media. I also uploaded two new patches:
|
|||||||||
When a report gets created or updated by the cron run, the notification email contains links, that are actually wrong. They're called http://www.domain.com/plugins/EmailReporting/scripts/view.php?id=### where it should actually be http://www.domain.com/view.php?id=### I guess that's a bug and as a quick fix, I've added a file /plugins/EmailReporting/scripts/view.php with the following content: <?php |
|||||||||
I am testing 0.8.1 and I wonder if anything changed. I have a new user added to mantis but he is not added to any projects (as a result of auto adding feature of this plugin). Most of my projects including the default for the mail reporting are private. If I am not manually adding user to a "Email Reporting Default" project, then reporter can see all assignment changes or status changes but doesn't see notes. Even if I tell Mantiss to add this user to monitor the ticket, he still is not receiving newly added notes. Only when I add this user to this project as a reporter or with higher privileges, this user will receive new added notes. Am I forced to add reporter to the project all the time? If so shouldn't plugin auto-add feature add user to the specified default project? Why doesn't just allowing user to monitor ticket work? |
|||||||||
I've just installed and configured (I hope properly :) Emailreporting version 0.8.1 but whan I try to fetch email via IMAP on terminal I have one or more lines reporting the following error: Anyone else have experienced it? |
|||||||||
Hi, I have installed mantis 1.2 as well as e-mail reporting plugin 0.8 on aapche server, Its working good. I have setup the database and all. Every thing is working fine. But have some issues with the email reporting. Users are able to report bugs via e-mail, its picking the user name according to the email address, User can add bug note as well. What I am really interseted about is, what is the format to assiging the bug to a particular user (based upon username or e-mail address)and how to change the status of the bug (new,resolved,fixed) via e-mail. There is also a problem I am facing is the format of the mail, mantis is sending to the user. From where I can change or customise the format of the mail send by mantis? I would appreciate if anyone can help, I need the solution very much. Thanks. |
|||||||||
Hi, I have installed mantis 1.2 as well as e-mail reporting plugin 0.8 on aapche server, Its working good. I have setup the database and all. Every thing is working fine. But have some issues with the email reporting. Users are able to report bugs via e-mail, its picking the user name according to the email address, User can add bug note as well. What I am really interseted about is, what is the format to assiging the bug to a particular user (based upon username or e-mail address)and how to change the status of the bug (new,resolved,fixed) via e-mail. There is also a problem I am facing is the format of the mail, mantis is sending to the user. From where I can change or customise the format of the mail send by mantis? I would appreciate if anyone can help, I need the solution very much. Thanks. |
|||||||||
Hello, Anyone knows how can we assign an bug to a user via mail? Thanks |
|||||||||
@alitvak, the auto added reporter user is only added to fallback support and default functionality. If you want your reporters to get emails and be able to do stuff directly in mantis its advised to disable "Use only default reporter user for issues created by email". That way EmailReporting will try to identify users based on the from email address @jurgenhaas, Which version are you using. I've never encountered it using MantisBT 1.2.1 and EmailReporting 0.8.1 @midimarcus, What kind of IMAP server software are you using? @susovan, There is no functionality like that present in EmailReporting at the moment (maybe in the future). EmailReporting only handles incoming emails. Outgoing emails are handled by Mantis @Neha.Goyal, There is no functionality like that present in EmailReporting at the moment (maybe in the future). Mantis core functionality does have something in categories maybe that is usable SL-Gundam |
|||||||||
How about support for öäå? If the email sender has ä in his name the plugin won't work as it does without ä's. |
|||||||||
@eejape, Which version of EmailReporting are you using? I cannot reproduce this in version 0.8.0 or later |
|||||||||
Forget it. I tested it on my Debian and it runs ok. For an unknown reason it does not work on my test system which is fedora 12... The fedora case: If the sender name has öäå the description is cut from there. i.e. For testing I had a sender named Köyhä the ticket description ended up as: The attached email is ok... |
|||||||||
@SL-Gundam, up until now I'm using EmailReporter 0.7.9 and Mantis 1.2.2, just figured that there is a new version 0.8.1 available. For some reason I get no notofication emails when this ticket gets new notes, although I'm getting notified for other tickets. The issue I reported doesn't occure everytime and I haven't figured a pattern yet, when it happens and when it doesn't. I'll go and upgrade EmailReporting now and see what happens. Keep fingers crossed. |
|||||||||
I have some troubles to unpack the latest rar files, could you put also the tar.gz files online? many thanks Xavier |
|||||||||
Arg, doesn't work with imap TLS and novalidate_certificat. I'm actually using eventum, but I would like to use mantis. I am running latest stable Mantisbt 1.2.2 & MantisBT-1.2.1_plugin_EmailReporting-0.8.1.rar Thx a lot |
|||||||||
I have added to config.api new option
?>
?> and replaced dropdown_global_categories with dropdown_categories for global_category_id Now i can select exact category for project required :) |
|||||||||
I discovered an issue in 0.8.2DEV, file core/Mail/Parser.php In lines 306 and 310 the call is |
|||||||||
@eejape, is it possible the charset setting in the EmailReporting configuration page is set incorrectly in your test environment? @jurgenhaas, let us know if the problem persists @reivax, i will only publish rar files within this issue. For tar.gz please visit the EmailReporting.git --> http://git.mantisforge.org/w/EmailReporting.git @dornata, EmailReporting has support for encrypted connections. Tested with both imap.google.com but also with a personal imap server with a self generated certificate. If it does not work for you for some reason please supply me with information so that i can try to reproduce the issue on my side (for example your imap server software etc.). Small note, you need to have the openssl extension loaded in php and it needs to support the proper stream transports for encrypted connections to be available --> http://www.php.net/manual/en/function.stream-get-transports.php @datacompboy, going to implement a slightly modified version of your code in 0.8.3. @obstbaum80, yep your right. Will be fixed 0.8.3 SL-Gundam |
|||||||||
In our production environment from about 2 weeks we got various bug reported via email with "No description found" on description field. Some bugs is normal, some other have "no description found" I've temporary workarounded the problem printing all email stream in this cases editing [b]core/mail.api.php[/b] file from: [/code] to this: [/code] Anyone can help me? I attach a mail complete streams here: This is a multi-part message in MIME format. ------=_NextPart_000_017A_01CB6964.0E44FF40 targa cccccccccccccc __ Informazioni da ESET NOD32 Antivirus, versione del database = Il messaggio =E8 stato controllato da ESET NOD32 Antivirus. www.nod32.it __ Informazioni da ESET NOD32 Antivirus, versione del database = Il messaggio =E8 stato controllato da ESET NOD32 Antivirus. www.nod32.it ------=_NextPart_000_017A_01CB6964.0E44FF40 ------=_NextPart_000_017A_01CB6964.0E44FF40 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> __ Informazioni da ESET = Il messaggio =E8 stato controllato da ESET NOD32=20 <A=20 __ = (20101011) __ Il messaggio =E8 stato controllato da ESET = <A=20 ------=_NextPart_000_017A_01CB6964.0E44FF40-- |
|||||||||
@UVI, you must be running an older version of EmailReporting. Please upgrade to the latest version. If the problem still persists after that, let us know. SL-Gundam |
|||||||||
@ SL-Gundam We've upgraded to Mantis-1.1.1-changed_files_only-unofficial-v1.tgz because our mantis version is currently 1.1.1. It's correct? Thanks |
|||||||||
about possibility to get categories of a defined project (datacompboy latest note), a very simple solution could be |
|||||||||
I'm unable to provide adequate support for mantis versions older then 1.2.0. That is because in Mantisbt 1.2.0 a plugin system was introduced. During that conversion i improved a lot of the EmailReporting code. I barely did any work on the script before that time. Your best guess if you don't want to upgrade to 1.2.x is to use one of the following two archives found in the attachments of this issue: Also don't forget to add the fields found in the /doc/bug_report_mail.sql if you use one of those versions I hope it works but i can only provide a minimum of support i'm afraid |
|||||||||
@ SL-Gundam Now it works! |
|||||||||
it's been a while and 2 versions have not been released here 0.8.2 - contained mainly changes for plugin developers You can find the new version in the attachment to this issue (MantisBT-1.2.3_plugin_EmailReporting-0.8.4.rar) and also in the git repository (http://git.mantisforge.org/w/EmailReporting.git) Changelog:
Sep 2010 - EmailReporting-0.8.3
May 2010 - EmailReporting-0.8.2
SL-Gundam |
|||||||||
How is the e-mail content used? Is it just like e-mail suject used as issue summary and e-mail content used as issue description? Or are there any keywords I can use in the e-mail to define other fields as priority, category, "steps to reproduce" and so on? Thx, keen |
|||||||||
no keywords... not yet anyway. |
|||||||||
On second thought that answer was a bit short so here is a more detailed answer Currently the category is set by your mailbox setup in EmailReporting. You can add multiple mailboxes from which to retrieve emails and connect them to different projects with different categories Priority is read from the email priority For the rest it has a very simplified methode of removing reply's and has the ability to scan for original mantis notification emails and remove it, if enabled, from bugnotes. A rule system with the possibility for keywords is in development and hopefully will be in the next major version. But who knows when that will be. |
|||||||||
Ok thanks for your response! |
|||||||||
http://pear.php.net/package/Mail_mimeDecode/download In the latest version (1.5.5) of the PEAR package mimedecode somebody changed the way that worked and that causes the problem you have. The mimedecode package thats provided with EmailReporting is version 1.5.4 and does not have that problem but it will only be used if you don't have the mimedecode package installed from the PEAR database SL-Gundam |
|||||||||
I'm now running into a new problem as we changed the mail server backend. Here is our configuration: Mantis 1.2.4 And when we check emails with plugins/EmailReporting/scripts/bug_report_mail.php we are receiving this error: 2915,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:PARSE ERROR!!! must be a '\r\n' here but is a ' '!!!! (getting the next line)|STR:| A0007 OK STATUS completed. | 2871,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:must be a but is a 'A0007' !!!! 2903,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:bogus response!!!! (COMMAND: ) 2915,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:PARSE ERROR!!! must be a '\r\n' here but is a 'OK'!!!! (getting the next line)|STR:| STATUS completed. | 2871,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:must be a but is a 'STATUS' !!!! 2903,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:bogus response!!!! (COMMAND: ) 2915,/mantisbt/plugins/EmailReporting/core/Net/IMAPProtocol_1.0.3.php,PROTOCOL ERROR!:PARSE ERROR!!! must be a '\r\n' here but is a 'COMPLETED.'!!!! (getting the next line)|STR:| | Mailbox: Support Mailbox IMAP [pear_error: message=", " code=0 mode=return level=notice prefix="" info=""] Done checking all mailboxes Any idea what's wrong here? |
|||||||||
Ok. Got no clue atm. So i need the following: SL-Gundam |
|||||||||
Just upgraded to Mantis 1.2.4 and the latest version of the plugin. We have the following issue: |
|||||||||
On the configuration page of EmailReporting you need to adjust the setting called "Directory for saving temporary email content" and optionally also "Save email contents to this directory if debug mode is activated". Note: The php ini setting upload_tmp_dir (the default for the first setting mentioned above) is usually an absolute path, not a relative one as its globally set for all php programs on a webserver, not just for MantisBT. SL-Gundam |
|||||||||
The problem is not with the temp location but with the final (DISK) location. |
|||||||||
I have uploaded bug_report_mail2.php. This is a variant on the standard script and needs to be stored in the root of Mantis. Using this script for scheduled tasks (under windows) ensures proper working of importing emails with attachments. |
|||||||||
Hi all, Im not a programmer, just an end user with a bit of basic knowledge about php. If this is not the place to post this then I apologise. I have been trying to get this to work all afternoon on my implementation of mantis and have a problem. Well 2 problems really.
tia, Paula |
|||||||||
@cas a absolute path instead of a relative path for the storage dir would have fixed it as well
|
|||||||||
Hello, I am using mantisbt 1.2.4 and the latest build of emailreporting 0.8.4. Is there a way to have the system send a response to the submitter of an issue to show that it has in fact been received and provide the ticket id # in the email so they can reference it in future conversations? I don't see anything like this in the configuration at all. Any help is appreciated! Doug |
|||||||||
@ddeprekel You can also enable "Should users receive emails for their own actions" in the configuration page for EmailReporting. This will only enable email_receive_own for EmailReporting (again see above for those notification options). |
|||||||||
Since we upgraded to the latest version (0.8.4) we are facing a problem with parsing of multipart emails. All seems to be configured right as it usually works, just from a few customers, it isn't working. I have uploaded th file jurgenhaas_parse_html_issue.zip which includes two complete emails, one of which is working OK and the other fails. Failing means that we get 'No description found' in the bug description, although all content is in the attached complete file to the bug. We can't figure out what's the difference between the two emails that could be causing the problem. Can you please help us with this? |
|||||||||
@jurgenhaas. Both emails provided parse correctly in my tests. So i see only 2 options
Hope this helps SL-Gundam |
|||||||||
As for 1.) How do I find out which PEAR package is used and how do I disable a possible wrong one? As for 2.) "Remove all replies" is disabled, it's just "Remove MantisBT notification emails from replies." being enabled and the "Use this text to identify the start of a reply" is set to the default "-----Original Message-----" |
|||||||||
This issue IMHO should be changed to Plugin Task |
|||||||||
@jurgenhaas, For 1. Rename the core_pear directory (if present) to something else temporarily and run a test on a mailbox. If everything still works then you have a directory somewhere which contains the pear files. Check the phpinfo() page for the include_path variable. One of the directories in that variable should be your pear directory. The core_pear directory is only used when the necessary pear files are not found somewhere else. Which version were you running before you upgraded to 0.8.4? |
|||||||||
Here is the report of further tests, nothing has been successful yet:
I have uploaded another zip archive containing files from the debug log which are not showing up in Mantis with their bodies. One of the files is been from the old core_pear (-ALT) and the other one from the new core_pear (-NEU). Could you please try and check them again for me? |
|||||||||
Found the problem. Its in the pear package mimedecode. The latest pear package available does not have the problem (1.5.5), but the version currently delivered with EmailReporting does (1.5.4) The problem has definitely been present in 0.8.3 and 0.8.4. I'm not completely sure about earlier versions but from your tests it seems this bug has been in the pear package for quite some time. I've pushed some changes to the git repository - http://git.mantisforge.org/w/EmailReporting.git. Now until a new stable version of EmailReporting is released you can fix this in a couple ways
Personally i do not advise the first option as it is a development release and therefore i cannot provide adequate support for it. Let me know if your problem still persists Thx Jurgenhaas for your patience |
|||||||||
Hi Guys, Apparently, there is a bug in this plugin causing continues repeating of the same issue when some error interrupted email parsing/issue reporting. In our case it was the size of the attachment which went over default MySQL limit of 1MB. As a result the same email was registered as an issue many times until it was manually removed from the mailbox. Additionally, no other emails are processed as plugin is stuck with the email causing problem and cannot move to another one. I suggest to have some mechanism to skip an email if it was already added as an issue or caused exception or something like that. Thanks. |
|||||||||
There is a mechanism which checks the maximum allowed size of the attachment. It does this the same way Mantis does with attachments This is based on the following settings: In this case you set the mantisbt variable 'max_file_size' too high. You should have set it to the maximum size allowed by your server setup or lower than that depending on what you want to allow. Besides that, MantisBT has enough warnings in the admin / install interface about the mysql limit. So rather then a bug i see this as a misconfiguration on your side SL-Gundam |
|||||||||
Just downloaded the mimedecode.php and replaced the existing file with it and that seems to have resolved my issue. Thanks a lof SL-Gundam, great support. |
|||||||||
How can the issues be tagged ? Use case: We use the tagging feature a lot on day to day basis. It would be great if the bugs reported through this tool can be tagged directly. With this I can directly filter for my tag defined for bugs reported via email. Has anyone already implemented such a feature already ? |
|||||||||
Not to my knowledge. But who knows what modifications other people created to extend functionality for EmailReporting. I'm currently developing a rule based system for the next version of EmailReporting. I will try to implement a option to apply tags within that SL-Gundam |
|||||||||
Hi SL-Gundam,
I agree that this particular size limit issue is misconfiguration. But this is not a point of my report. Point is: The EmailReporting plugin will not be able to handle email fetching correctly if for whatever reason saving of the particular email failed. In this case plugin will try to post this failed email into the Mantis system forever until either problem is resolved or email was deleted from the inbox. To make things worse - each time a new duplicate issue is registered. Regards, |
|||||||||
Alex, |
|||||||||
@AlexYarmoshko. EmailReporting already checks a lot of possible errors, which could break the processing of emails and prevents them from breaking the processing of the emails. But some of them do depend on proper configuration on the client side. Also some errors just cannot be prevented, no matter how many checks we build in the system. If you find another email that breaks the processing of emails for EmailReporting let me know and we'll investigate the cause. I've updated the readme a little bit to make it clear this setting is important and needs to be checked by the person installing the plugin. There is one option which could possibly prevent problems like these permanently: Before i even begin with adding functionality like that, i would like to know some other peoples opinions. Personally i'd rather have EmailReporting break processing emails like it does now so that it is clearer that there is a actual problem somewhere and that once the problem is fixed the email is imported correctly. The duplicate issues can easily be cleaned up by a mantis admin and he can also stop the scheduled job from running to debug the cause of his current problems. SL-Gundam |
|||||||||
Personally I would never activate such option, as you already stated, loosing emails, not even knowing why it went missing, is just not an option. |
|||||||||
We now have a dedicated wiki page for EmailReporting: Please contribute. |
|||||||||
I'm trying to make a very simple (I hope) change to the EmailReporting plugin, and I was hoping someone could help. All I need is to change the order of the notes in the actual email report you receive on any modification to a ticket. Basically, I need the order to be reversed in the notification mail so that newer notes are at the top, not the bottom. Anyone? |
|||||||||
That is depending on the preferences of the recipient. In short, do not touch the plugin! |
|||||||||
I have a problem with this plugin. My clients use Microsoft Outlook (same problem with yahoo or hotmail emails in html format), in order to send to the IT team, bug reports by email that are automatically added as issues into Mantis. I would like the Mantis bug description field to respect EXACTLY the format of the email sent by the client (css included). Can the bug description field in the /bugs/view.php page in Mantis contain images ? I mean, the same images we see in the 'Attached files ' field on the same page... |
|||||||||
No sorry the plugin has not been prepared for usage like that. The reason for that is that MantisBT would not allow it since the descriptions are plain text and therefore would not allow html css and ofcourse inline pictures. If in the future MantisBT would allow it, then of course an attempt will be made to also add support in EmailReporting SL-Gundam |
|||||||||
Thank you! In this case, without modifying the core Mantis, another solution for the developer to read the client's request in more or less the original format, would be that the plugin add a Mantis bug with a minimal text (email's subject for example) and add the html email's body :
There is no plugin configuration doing this ? |
|||||||||
The best EmailReporting is currently able to offer is: If you want to add the complete raw email with text, html and attachments to the issue you can activate the debug mode and activate the option to add the complete email. I doubt that is what you want but you can have a look at it if you wish. It would be possible to add only the html email as attachment to the issue but its still not possible to add pictures inline when opening that html attachment as the attached pictures are also attachments in the issue which is different from attachments in emails. One way or the other inline pictures is not yet possible because a mantis issue is inherently different from an email. If i ever think of something that could facilitate this i will of course investigate further, but at the moment i can't think of anything. If you do see a solution or want to try to find one, i suggest creating a proof of concept or even modify the EmailReporting plugin yourself and provide the code in this issue (maybe even commit it yourself into the git repository). What i currently want to look at is what is the cause for this wish. The company i work at is also using Microsoft Outlook 2007 and Exchange 2010 server to facilitate its email needs. My colleagues also use inline pictures and i've never had any problems with the current setup of EmailReporting with the created issues by that system. Please clarify the reason for the wish or the problems it currently causes. SL-Gundam |
|||||||||
Some background from me, I have not installed this plugin and this individual who did install this is no longer working with me. I'm trying to get this plugin to do what it says it will do: submit a ticket via e-mail. I've tried to test the mailboxes and they have all failed. I'm not sure what e-mail address I should be sending issues to or even how this is set up. Can someone help provide some information to this? Many thanks to any help! |
|||||||||
EmailReporting Plugin now has a dedicated forum at Mantis-Forums. Please use the forum for help in installing and using this plugin.; |
|||||||||
Hi 1) The regexp for bug id recognition now accepts:
2) A config option "Write the email subject as the first line of the bugnote" was added. Since the subject of an email can be "custom" so it can include some info we would like to save in the note content ToDo: |
|||||||||
EmailReporting plugin is now in GitHub along with other MantisBT plugins. The stable releases can be downloaded from the following URL: https://github.com/mantisbt-plugins/EmailReporting/downloads If you wish to contribute to the plugin, please fork the repo in github and push your changes. Please do not submit patches to this bug report. |
|||||||||
@zdroyer: I think the features you mentioned in ToDo should go to a separate plugin as it is out of scope of EmailReporting plugin. May be you can request a repo in https://github.com/mantisbt-plugins and invite contributors. |
|||||||||
@libregeek, I've just committed my mod to GitHub (I need to practice a bit git - a 15 minute tutorial is not enough to us git fluently ;) If it is essential in my Mantis installation to have Bug<->Note converter, I will start developing it using github. |
|||||||||
Mantis:1.2.5 How can I resolve this error? [pear_error: message=", " code=0 mode=return level=notice prefix="" info=""] Fatal error: Cannot use object of type PEAR_Error as array in C:\wamp\www\mantis I have a mail account, mantis user using that mail account. |
|||||||||
the problem was that I had PEAR installed, but not the packages? Once I installed PEAR packages, that error was resolved, and now I'm having the parsing error of previous notes (c0027815). I updated PEAR mime_Decode to 1.5.5, but the parsing error is having issues in \EmailReporting\core\Net\IMAPProtocol_1.0.3.php
Mailbox: Test and my installed pear packages:
|
|||||||||
Thank you all for this very nice plugin. Ed |
|||||||||
Hello, I hope you could help me to find a solution for my problem. We installed the Plugin on a Mantis Version 1.2.3 and it runs smooth. It's some kind of windows server with an inetpub-folder (I don't have real access to this, because it's an customer). But at the time an email with cyrillian characters is collected from the postbox, the plugin crashes and throw this error Message. APPLICATION ERROR 0000401 Database query failed. Error received from database was 0001366: Incorrect string value: '\x93junk...' for column 'description' at row 1 for the query: INSERT INTO mantis_bug_text_table Previous non-fatal errors occurred. Page content follow. I don't know if this here relates to my problem, but there "SL-Gundam (Manager)" fixed the problem via mail. Kind Regards |
|||||||||
@C4Vette. See the configuration options page. You seem to have modified the default priorities delivered with MantisBT so you need to adjust the priorities array accordingly @oboeck. See forum |
|||||||||
Hi all, First off, great plugin. I've made some changes to suit it entirely to my liking and thought I'd give these changes back to the community. I've created my patch against MantisBT-1.2.3_plugin_EmailReporting-0.8.4.rar as found attached to this issue. I've tested and confirmed this working on my Mantis 1.2.8 setup. Of course a disclaimer, your mileage may vary, don't come to me if your entire mantis database is gone after using my patch (should in no way ever be able to happen, but there, i've said it). I've first implemented the patch relaxed_bugid_reqexp_and_subject_in_note.path (partly by hand because patching with this file to this codebase didn't work entirely correctly). After that I've made changes to do the following:
Of course CC and Date header adding have been added in such a way that they are configurable from the 'Manage plugins' page and default to 'off'. Hope someone will find this helpful, patch file is called note_and_new_issue_add_subject_cc_date.patch and is attached to this issue. |
|||||||||
Hi all, back again so soon. I've decided to also add the 'To' field. This might look strange to some of you because you use this to actually mail to an account, but we use the thunderbird Mail Redirect addon (http://mailredirect.mozdev.org/index.html) to bounce messages in a mailbox where Mantis will find them. This means the original To: header is still intact so I thought I'd also show that to log who the mail originally was sent to. I've also removed a leftover debug print statement from the code. Patch added is note_and_new_issue_add_subject_cc_date_to.patch and supersedes the previous patch as this is again a patch against the codebase in MantisBT-1.2.3_plugin_EmailReporting-0.8.4.rar. This means you don't have to use both my patch files, you can just use this last one. |
|||||||||
Can you explain or suggest a workaround, why when multiple emails are listed on a ticket, e.g. in CC. and one of the CC'd persons reply-all, a new ticket is being created? In this particular example I email manits@xxxx, this is the email configured to be parsed my the email reporting tool. A group mygroup@xxxx is CC'd. Then one of the user of the group hit reply-all. This will trigger a new email. The user does have permissions to mantis/project/ticket. a. can this be integrated in a patch? We're using Mantis 1.2.7 with EmailReporting-0.8.4 |
|||||||||
@nhartung, EmailReporting searches the subject line for an issue id number.
EmailReporting only recognizes issue notes when the subject line contains the issue number. |
|||||||||
Hi to all, I m desperate. Operation NOT successful Mailbox description: example - bug [pear_error: message="220 and/or bulk e-mail." code=-1 mode=return level=notice prefix="" info=""] Please help me to fix this. I didn t see this kind of error here. |
|||||||||
Hi to all, I m desperate. Operation NOT successful Mailbox description: example - bug [pear_error: message="220 and/or bulk e-mail." code=-1 mode=return level=notice prefix="" info=""] Please help me to fix this. I didn t see this kind of error here. |
|||||||||
i take it example.com is not your real mail servers domain. Anyways this is an error from your mail server. I suggest you consult its manual on how to retrieve emails using the pop3 protocol Secondly i think 26 is not the correct port number for the pop3 protocol for your mail server. Maybe try leaving it empty and use the default ports |
|||||||||
teste |
|||||||||
@SL-Gundam: the ticket will be created with an email. To: mantis@xxxxx Then a user which is a member of 'usergroup' reply-all to the email. This triggers a new ticket. not sure why, because the subject has the ticket number in it. |
|||||||||
Please give me the complete subject line you are using |
|||||||||
A bug with long email addresses! The obvious workaround is to enable fall back to default reporter One more problem is that the username generation does not seem to work. The username is always generated like this firstname_lastname_domain_randomnumbers no matter which selection is made on the configuration page. |
|||||||||
@eejape |
|||||||||
Thanks @libregeek, long emails fixed. Still remains the problem with the username generation... |
|||||||||
In MantisBT 1.2.6 they changed the name of 2 constants thats why this functionality does not work as expected. You have 2 options to fix this
|
|||||||||
Hi all, Install the 0.84 version on Mantis 1.2.4, works like a breeze. Thank you for this great plugin. I do have a quick question, what's the mechanism to get an email added to an existing bug? When I send an email to Mantis it creates a bug. But when I get a response from someone (outside Mantis) on this bug, I'd like that response to add to the bug in stead of creating a new one. |
|||||||||
Users need to respond to Mantis notification emails. These emails contain a subject line more or less like: "RE: [project 0001234] test issue" EmailReporting will retrieve the issue id from the email and will try adding a note to the issue in question. This will fail if the issue has passed the readonly border. See 'bug_readonly_status_threshold'. For all other cases if it can find the issue id in the subject line it should work |
|||||||||
Is there a way to have the "from:" field to be custom per project so that people can simply click reply and their email would be added as a note. I've setup to use one email box per project, but perhaps this is a mistake in hindsight? Any suggestions please. |
|||||||||
@Bedlore |
|||||||||
Hi! Lastly, I have about 15 projects, how can I select where to add a new issue by mail? Should I create 15 different accounts? Thanks so much. |
|||||||||
In future please ask questions on the forums: http://www.mantisbt.org/forums/viewforum.php?f=13 Also see: As for your questions
SL-Gundam |
|||||||||
Thanks! |
|||||||||
I see grangeway moved this to another project. Could this please be moved back to the EmailReporting project? |
|||||||||
test |
|||||||||
test |
|||||||||
test |
|||||||||
test |
|||||||||
test |
|||||||||
EmailReporting has a project within MantisBT now so no need for one gigantic issue about this For further reference and notifying us about bugs please check: https://www.mantisbt.org/wiki/doku.php/mantisbt:emailreporting |
|||||||||