project_id support for login.php

Post about your customizations to share with others.

Moderators: Contributor, Developer

Post Reply
truefriend-cz
Posts: 65
Joined: Jan 08, 2019 2:14 am

project_id support for login.php

Post by truefriend-cz » Jan 19, 2019 2:32 pm

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.19.0, OS: Windows, PHP: 7.3, Charset (PHP, Database): UTF-8, and: little, bad english

cas
Posts: 528
Joined: Mar 11, 2006 11:08 am
Contact:

Re: project_id support for login.php

Post by cas » Jan 20, 2019 4:53 am

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: 65
Joined: Jan 08, 2019 2:14 am

Re: project_id support for login.php

Post by truefriend-cz » Jan 20, 2019 5:12 pm

cas wrote:
Jan 20, 2019 4:53 am
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.19.0, OS: Windows, PHP: 7.3, Charset (PHP, Database): UTF-8, and: little, bad english

Post Reply