/** * get database table name * * @param string $p_name Can either be specified as 'XXX' (e.g. 'bug'), or * using the legacy style 'mantis_XXX_table'; in the * latter case, a deprecation warning will be issued. * @return string containing full database table name (with prefix and suffix) */ function db_get_table($p_name) { if (strpos($p_name, 'mantis_') === 0) { $t_table = substr($p_name, 7, strpos($p_name, '_table') - 7); error_parameters(__FUNCTION__ . "( '{$p_name}' )", __FUNCTION__ . "( '{$t_table}' )"); trigger_error(ERROR_DEPRECATED_SUPERSEDED, DEPRECATED); } else { $t_table = $p_name; } # Determine table prefix including trailing '_' $t_prefix = trim(config_get_global('db_table_prefix')); if (!empty($t_prefix) && '_' != substr($t_prefix, -1)) { $t_prefix .= '_'; } # Determine table suffix including leading '_' $t_suffix = trim(config_get_global('db_table_suffix')); if (!empty($t_suffix) && '_' != substr($t_suffix, 0, 1)) { $t_suffix = '_' . $t_suffix; } # Physical table name $t_table = $t_prefix . $t_table . $t_suffix; db_check_identifier_size($t_table); return $t_table; }
/** * get database table name * * @param string $p_name can either be specified as 'XXX' (e.g. 'bug'), or * using the legacy style 'mantis_XXX_table'; in the * latter case, a deprecation warning will be issued * @return string containing full database table name (with prefix and suffix) */ function db_get_table($p_name) { if (strpos($p_name, 'mantis_') === 0) { $t_table = substr($p_name, 7, strpos($p_name, '_table') - 7); error_parameters("db_get_table( '{$p_name}' )", "db_get_table( '{$t_table}' )"); trigger_error(ERROR_DEPRECATED_SUPERSEDED, WARNING); } else { $t_table = $p_name; } $t_prefix = config_get_global('db_table_prefix'); $t_suffix = config_get_global('db_table_suffix'); if ($t_prefix) { $t_table = $t_prefix . '_' . $t_table; } $t_table .= $t_suffix; db_check_identifier_size($t_table); return $t_table; }