Skip to content

Commit

Permalink
Workaround for 8103: replace all occurrences of ASC and DESC constants
Browse files Browse the repository at this point in the history
with ASCENDING and DESCENDING.
This is done to avoid problems if the administrator sets
$g_default_bugnote_order and/or $g_bugnote_order to ASC/DESC instead
of 'ASC'/'DESC'


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4460 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
giallu committed Jul 21, 2007
1 parent 7052a96 commit 1e7048e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
6 changes: 3 additions & 3 deletions config_defaults_inc.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: config_defaults_inc.php,v 1.345 2007-07-11 03:18:12 vboctor Exp $
# $Id: config_defaults_inc.php,v 1.346 2007-07-21 22:54:28 giallu Exp $
# --------------------------------------------------------


Expand Down Expand Up @@ -1635,8 +1635,8 @@
# --------------------
# Sort direction to icon mapping
$g_sort_icon_arr = array (
ASC => 'up.gif',
DESC => 'down.gif'
ASCENDING => 'up.gif',
DESCENDING => 'down.gif'
);
# --------------------
# Read status to icon mapping
Expand Down
7 changes: 3 additions & 4 deletions core/constant_inc.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: constant_inc.php,v 1.68 2007-07-21 13:38:26 prichards Exp $
# $Id: constant_inc.php,v 1.69 2007-07-21 22:54:29 giallu Exp $
# --------------------------------------------------------

### CONSTANTS ###
Expand Down Expand Up @@ -86,10 +86,9 @@
# project view_state
define( 'VS_PUBLIC', 10 );
define( 'VS_PRIVATE', 50 );

# direction
define( 'ASC', 101 );
define( 'DESC', 102 );
define( 'ASCENDING', 101 );
define( 'DESCENDING', 102 );

# unread status
define( 'READ', 201 );
Expand Down
8 changes: 4 additions & 4 deletions core/icon_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: icon_api.php,v 1.14 2005-09-19 03:17:16 ryandesign Exp $
# $Id: icon_api.php,v 1.15 2007-07-21 22:54:29 giallu Exp $
# --------------------------------------------------------

### Icon API ###
Expand Down Expand Up @@ -44,10 +44,10 @@ function print_sort_icon( $p_dir, $p_sort_by, $p_field ) {
return;
}

if ( ( 'DESC' == $p_dir ) || ( DESC == $p_dir ) ) {
$t_dir = DESC;
if ( ( 'DESC' == $p_dir ) || ( DESCENDING == $p_dir ) ) {
$t_dir = DESCENDING;
} else {
$t_dir = ASC;
$t_dir = ASCENDING;
}

$t_none = NONE;
Expand Down
6 changes: 3 additions & 3 deletions core/print_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: print_api.php,v 1.172 2007-07-15 19:59:34 prichards Exp $
# $Id: print_api.php,v 1.173 2007-07-21 22:54:29 giallu Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -1246,7 +1246,7 @@ function print_view_bug_sort_link( $p_string, $p_sort_field, $p_sort, $p_dir, $p
# --------------------
function print_manage_user_sort_link( $p_page, $p_string, $p_field, $p_dir, $p_sort_by, $p_hide=0 ) {
if ( $p_sort_by == $p_field ) { # If this is the selected field flip the order
if ( 'ASC' == $p_dir || ASC == $p_dir ) {
if ( 'ASC' == $p_dir || ASCENDING == $p_dir ) {
$t_dir = 'DESC';
} else {
$t_dir = 'ASC';
Expand All @@ -1260,7 +1260,7 @@ function print_manage_user_sort_link( $p_page, $p_string, $p_field, $p_dir, $p_s
# --------------------
function print_manage_project_sort_link( $p_page, $p_string, $p_field, $p_dir, $p_sort_by ) {
if ( $p_sort_by == $p_field ) { # If this is the selected field flip the order
if ( 'ASC' == $p_dir || ASC == $p_dir ) {
if ( 'ASC' == $p_dir || ASCENDING == $p_dir ) {
$t_dir = 'DESC';
} else {
$t_dir = 'ASC';
Expand Down
6 changes: 3 additions & 3 deletions core/utility_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: utility_api.php,v 1.21 2007-07-14 16:13:54 giallu Exp $
# $Id: utility_api.php,v 1.22 2007-07-21 22:54:29 giallu Exp $
# --------------------------------------------------------

### Utility API ###
Expand Down Expand Up @@ -172,8 +172,8 @@ function ini_get_number( $p_name ) {

# --------------------
# Sort a multi-dimensional array by one of its keys
function multi_sort( $p_array, $p_key, $p_direction=ASC ) {
if ( DESC == $p_direction ) {
function multi_sort( $p_array, $p_key, $p_direction=ASCENDING ) {
if ( DESCENDING == $p_direction ) {
$t_factor = -1;
} else {
# might as well allow everything else to mean ASC rather than erroring
Expand Down
4 changes: 2 additions & 2 deletions manage_proj_edit_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: manage_proj_edit_page.php,v 1.100 2007-07-13 07:58:31 giallu Exp $
# $Id: manage_proj_edit_page.php,v 1.101 2007-07-21 22:54:28 giallu Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -235,7 +235,7 @@

$t_projects = project_get_all_rows();

$t_projects = multi_sort( $t_projects, 'name', ASC );
$t_projects = multi_sort( $t_projects, 'name', ASCENDING );

foreach ( $t_projects as $t_project ) {
if ( in_array( $t_project['id'], $t_all_subprojects ) ||
Expand Down
6 changes: 3 additions & 3 deletions manage_proj_page.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: manage_proj_page.php,v 1.19 2005-05-16 12:56:06 vboctor Exp $
# $Id: manage_proj_page.php,v 1.20 2007-07-21 22:54:28 giallu Exp $
# --------------------------------------------------------
?>
<?php
Expand All @@ -22,9 +22,9 @@
$f_dir = gpc_get_string( 'dir', 'ASC' );

if ( 'ASC' == $f_dir ) {
$t_direction = ASC;
$t_direction = ASCENDING;
} else {
$t_direction = DESC;
$t_direction = DESCENDING;
}

?>
Expand Down

0 comments on commit 1e7048e

Please sign in to comment.