array_shift($parts), 'cmd' => array_shift($parts), 'query' => $parts ); if((array_search($commands['cmd'],$_CONFIG['commands']) === FALSE) or empty($commands['cmd'])) { $commands['cmd'] = 'display'; $commands['query'] = array('home'); } return($commands); } ########################################################################################## main_sort_schedule_by_month # parameters: the two elements to compare # returns: 0 for equavalent, 1 for a > b, -1 for a < b function main_sort_schedule($a,$b) { global $_NEXT_MONTHS; $a_date = explode('.',$a['startdate']); $b_date= explode('.',$b['startdate']); $a_year = $a_date[2]; $b_year = $b_date[2]; if($a_year == $b_year) { # if the years are the same, compare by month $a_month = $a_date[1]; $b_month = $b_date[1]; if($a_month == $b_month) { # if the month AND year the same, sort by day $a_day = $a_date[0]; $b_day = $b_date[0]; if($a_day == $b_day) { return(0); } else if($a_day > $b_day) { return(1); } else if($a_day < $b_day) { return(-1); } } else if($a_month > $b_month) { return(1); } else if($a_month < $b_month) { return(-1); } # if, for some reason, none of the above ifs work, # just return that they are equivalent return(0); } else if($a_year > $b_year) { return(1); } else if($a_year < $b_year) { return(-1); } }