Is that possible to generate individually project id ??
I suppose I will have to change code. Where is this funtion in scripts for set new number for new projects ??
thanx..wait for rly..

Moderators: Developer, Contributor
There is no function in Mantis for it. The project id is set by using the functionality of the underlying database engine (MySQL, Oracle, ...) to create unique keys.truefriend-cz wrote: ↑Jan 21, 2019 11:04 pmWhere is this funtion in scripts for set new number for new projects ??
Code: Select all
function project_create( $p_name, $p_description, $p_status...
...
$t_query = 'INSERT INTO {project}
( name, status, enabled, view_state, file_path, description, inherit_global )
VALUES
( ' . db_param() . ', ' . db_param() ....
db_query( $t_query, array( $p_name, ...
# return the id of the new project
return db_insert_id( db_get_table( 'project' ) );
Code: Select all
print_header_redirect( $t_redirect_url );
Code: Select all
if( isset( $_GET['project_id'] ) ) {
$selector = 'ID';
$check_db_exist == '';
if( mb_substr($_GET['project_id'], 0, strlen($selector)) == $selector ) {
$project_id_encrypted = ltrim($_GET['project_id'], $selector);
$project_id_decrypted = openssl_decrypt(hex2bin($project_id_encrypted), 'AES-128-CBC', 'PrivateKey');
} else {
$check_db_exist = db_fetch_array(db_query('SELECT COUNT(*) as result FROM {project} WHERE id = '.$_GET['project_id']));
}
$check_db_exist = $check_db_exist['result'];
if( $check_db_exist == '1' ) {
$project_id_encrypted = bin2hex(openssl_encrypt($_GET['project_id'], 'AES-128-CBC', 'PrivateKey'));
$project_id_decrypted = openssl_decrypt(hex2bin($project_id_encrypted), 'AES-128-CBC', 'PrivateKey');
$file = fopen($g_absolute_path.'/config/DecpryptTable.txt', 'w+');
fwrite($file, 'Project name: ' . project_get_name ( $project_id_decrypted ) . PHP_EOL);
fwrite($file, 'Decrypted ID: ' . $project_id_decrypted . PHP_EOL);
fwrite($file, 'Encrypted ID: ID' . $project_id_encrypted . PHP_EOL);
fclose($file);
echo 'Created info file';
exit();
}
if( $check_db_exist == '0' ) {
exit();
}
if( $_GET['action'] == "add" ) {
gpc_clear_cookie( 'MANTIS_PROJECT_COOKIE' );
gpc_clear_cookie( 'MANTIS_secure_session' );
gpc_set_cookie( 'MANTIS_PROJECT_COOKIE', $project_id_decrypted, true );
print_header_redirect( 'bug_report_page.php' );
} elseif ( $_GET['action'] == "view" ) {
gpc_clear_cookie( 'MANTIS_PROJECT_COOKIE' );
gpc_clear_cookie( 'MANTIS_secure_session' );
gpc_set_cookie( 'MANTIS_PROJECT_COOKIE', $project_id_decrypted, true );
print_header_redirect( 'view_all_bug_page.php' );
} else {
gpc_clear_cookie( 'MANTIS_PROJECT_COOKIE' );
gpc_clear_cookie( 'MANTIS_secure_session' );
gpc_set_cookie( 'MANTIS_PROJECT_COOKIE', $project_id_decrypted, true );
print_header_redirect( 'view_all_bug_page.php' );
}
} else {
if( isset( $_SESSION['user_interactions'] ) AND $f_username == 'anonymous' ) {
end($_SESSION['user_interactions']);
$t_logout_redirect = auth_logout_redirect_page();
auth_logout();
print_header_redirect( $t_logout_redirect, true, false );
} else {
end($_SESSION['user_interactions']);
print_header_redirect( $t_redirect_url );
// exit();
}
}
Code: Select all
RewriteRule ^bugs/add-(.*) /bugs/login.php?username=anonymous&perm_login=false&action=add&project_id=$1
RewriteRule ^bugs/view-(.*) /bugs/login.php?username=anonymous&perm_login=false&action=view&project_id=$1
Code: Select all
http://www.domain.tld/bugs/add-ID89278d97289s472r0482094
http://www.domain.tld/bugs/view-ID89278d97289s472r0482094
Code: Select all
http://www.domain.tld/bugs/login.php?username=anonymous&perm_login=false&action=add&project_id=5
http://www.domain.tld/bugs/login.php?username=anonymous&perm_login=false&action=view&project_id=5
or
http://www.domain.tld/bugs/add-5
http://www.domain.tld/bugs/view-5
Code: Select all
<?php
session_start();
$_SESSION['user_interactions'][] = $_SERVER['HTTP_REFERER'];
layout_login_page_end();