project_id support for login.php

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
truefriend-cz
Posts: 66
Joined: 08 Jan 2019, 07:14

project_id support for login.php

Post by truefriend-cz »

Hi. How i can add support to login.php for this urls?

http://domain.abc/login.php?username=an ... oject_id=9

Thanks
Mantis version: 2.23.0, OS: Windows, PHP: 7.3, Charset (PHP, Database): UTF-8, and: little, bad english
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: project_id support for login.php

Post by cas »

an anonymous user does not need to login so you can use something like:
https://domain.abc/view_all_bug_page.php?project_id=1
truefriend-cz
Posts: 66
Joined: 08 Jan 2019, 07:14

Re: project_id support for login.php

Post by truefriend-cz »

cas wrote: 20 Jan 2019, 09:53 an anonymous user does not need to login so you can use something like:
https://domain.abc/view_all_bug_page.php?project_id=1
Yes i know but this solution have a problem: https://www.mantisbt.org/bugs/view.php?id=25184
And the fix in the next release is not scheduled: https://www.mantisbt.org/bugs/roadmap_p ... ion_id=339
so solving the problem it will take a while so I"m looking for a way to solve it from my side.

EDIT:

I replaced in login.php text:

Code: Select all

print_header_redirect( $t_redirect_url );
to:

Code: Select all

if( isset( $_GET['project_id'] ) ) {
	if( $_GET['action'] == "add" ) {
		print_header_redirect( 'bug_report_page.php?project_id=' . $_GET['project_id'] );
	} elseif ( $_GET['action'] == "view" ) {
		print_header_redirect( 'view_all_bug_page.php?project_id=' . $_GET['project_id'] );
	} else {
		print_header_redirect( 'view_all_bug_page.php?project_id=' . $_GET['project_id'] );
	}
} else {
	print_header_redirect( $t_redirect_url );
}
And supported these URL formats:

Code: Select all

https://domain.abc/login.php?username=anonymous&perm_login=false&action=add&project_id=1
https://domain.abc/login.php?username=anonymous&perm_login=false&action=view&project_id=1
https://domain.abc/login.php?username=anonymous&perm_login=false&project_id=1
anonymous in config_inc.php must disabled and anonymous user must have empty password.

Please moderators moving this thread to Customizations section.
Mantis version: 2.23.0, OS: Windows, PHP: 7.3, Charset (PHP, Database): UTF-8, and: little, bad english
Post Reply