diff --git a/admin/rehash.php b/admin/rehash.php --- a/admin/rehash.php +++ b/admin/rehash.php @@ -92,6 +92,17 @@ function school_list() /** * \brief + * Compare the two schools by their names. + * + * \see strcmp() + */ +function school_cmp($school_a, $school_b) +{ + return strcmp($school_a['name'], $school_b['name']); +} + +/** + * \brief * Write out the cache file which remembers the list of available * schools. * @@ -133,6 +144,7 @@ function school_cache($schools) $domain_cache_ptr[$domain_part] = $school['id']; } } + uasort($list_cache, 'school_cmp'); $cache = array('list' => $list_cache, 'domains' => $domain_cache); diff --git a/class.class.php b/class.class.php --- a/class.class.php +++ b/class.class.php @@ -73,10 +73,10 @@ class Classes { $n = "\n"; $out = '' . $n - . ' getName()) . '"/>' . $n + . ' ' . $n . ' ' . $n - . '
' . $n - . '
' . $n + . '
' . $n + . '
' . $n . "\n"; foreach ($this->sections as $key => $section) diff --git a/class.schedule.php b/class.schedule.php --- a/class.schedule.php +++ b/class.schedule.php @@ -290,7 +290,7 @@ class Schedule "\n"; */ $headcode = array('outputStyle', 'jQuery', 'jQueryUI', 'uiTabsKeyboard'); } - $outputPage = new page($this->getName(), $headcode); + $outputPage = new Page(htmlentities($this->getName()), $headcode); @@ -377,11 +377,11 @@ class Schedule { if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1]) { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $M = $j; $filled = true; } else { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $filled = true; } } @@ -420,11 +420,11 @@ class Schedule { if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1]) { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $Tu = $j; $filled = true; } else { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $filled = true; } } @@ -463,11 +463,11 @@ class Schedule { if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1]) { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $W = $j; $filled = true; } else { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $filled = true; } } @@ -506,11 +506,11 @@ class Schedule { if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1]) { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $Th = $j; $filled = true; } else { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $filled = true; } } @@ -549,11 +549,11 @@ class Schedule { if($this->classStorage[$j]->getSection($this->storage[$i][$j])->getEndTime() > $time[$r+1]) { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $F = $j; $filled = true; } else { - $table .= "\n\t\t" . $this->classStorage[$j]->getName() . " " . $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() . ""; + $table .= "\n\t\t" . htmlentities($this->classStorage[$j]->getName()) . " " . htmlentities( $this->classStorage[$j]->getSection($this->storage[$i][$j])->getLetter() ) . ""; $filled = true; } } diff --git a/class.section.php b/class.section.php --- a/class.section.php +++ b/class.section.php @@ -172,7 +172,7 @@ class Section $out .= ' ' . $n . ' ' . $n + . ' value="' . htmlentities($this->letter) . '" />' . $n . " \n"; break; } @@ -242,7 +242,7 @@ class Section . " \n"; } - $out .= '
' . $n; + $out .= '
' . $n; $out .= ' ' . $n; $out .= "\n"; diff --git a/inc/class.page.php b/inc/class.page.php --- a/inc/class.page.php +++ b/inc/class.page.php @@ -40,6 +40,10 @@ class page /* the current school. See get_school(). */ private $school; + /** + * \param $ntitle + * Must be a valid HTML string (i.e., escaped with htmlentities()). + */ public function __construct($ntitle, $nscripts = array(), $immediate = TRUE) { global $ga_trackers; @@ -91,14 +95,14 @@ class page . " \n"; } - self::session_start(); + self::session_start(); + /* everything that needs sessions started to work: */ + + $this->school = school_load_guess(); + if($immediate && $ntitle != "NOHEAD") $this->head(); - - /* everything that needs sessions started to work: */ - - $this->school = school_load_guess(); } /** @@ -171,7 +175,8 @@ class page Submit Feedback
© '. date('Y').' Nathan Gelderloos
- Ethan Zonca + Ethan Zonca
+ Nathan Phillip Brink
diff --git a/input.php b/input.php --- a/input.php +++ b/input.php @@ -51,16 +51,19 @@ if ($school && (!empty($_REQUEST['school if (!empty($_REQUEST['selectschool']) || $school['id'] == 'default' && !isset($_SESSION['school_chosen'])) { + $next_page = 'input.php'; + if (isset($_GET['s'])) + $next_page .= '?s=' . (int)$_GET['s']; ?>

School Selection

Choose the school you attend from the list below. If you cannot find your school, you may proceed using - the generic + the generic settings.

showSchools('input.php'); + $inputPage->showSchools($next_page); $inputPage->foot(); exit; } @@ -76,7 +79,7 @@ if (!empty($_REQUEST['selectschool'])

getName()) . '"'; /*"*/ ?> +getName()) . '"'; /*"*/ ?> /> diff --git a/school.d/default.inc b/school.d/default.inc --- a/school.d/default.inc +++ b/school.d/default.inc @@ -41,11 +41,11 @@ function default_instructions_html()

  1. Get in touch with your advisor and find out what courses you need to take next semester.
  2. -
  3. Look up each course which your advisor specified in your college's course catalog. Note the different sectxions for each course..
  4. +
  5. Look up each course which your advisor specified in your college's course catalog. Note the different sections for each course..
  6. Enter each course into a slate_permutate schedule. For each course, add the sections listed in your school's course catalogue (at your discretion).
  7. Submit your list of courses and their sections. Let slate_permutate perform its magic.
  8. View all of the different permutations of your schedule and find a few that work for you.
  9. -
  10. Print our your preferred schedule by selecting a schedule an choosing your User-Agent's print option.
  11. +
  12. Print out your preferred schedule by selecting a schedule an choosing your User-Agent's print option.
  13. Wait until it's your turn to register and grab your preferred sections before they fill up!
EOF; diff --git a/scripts/scheduleInput.js b/scripts/scheduleInput.js --- a/scripts/scheduleInput.js +++ b/scripts/scheduleInput.js @@ -140,7 +140,7 @@ //-------------------------------------------------- function addRow(){ sectionsOfClass[classNum] = 0; // This is class 0, initialize at 0 - jQuery('#jsrows').append(''); + jQuery('#jsrows').append(''); classNum++; }; @@ -176,7 +176,7 @@ //-------------------------------------------------- jQuery('.addSection').live('click', function() { sectionsOfClass[jQuery(this).parent().parent().attr("title")]++; // Increases sectionsOfClass[classNum] - jQuery(this).parent().parent().after('' + getCommonInputs(jQuery(this).parent().parent().attr("title")) + ''); + jQuery(this).parent().parent().after('' + getCommonInputs(jQuery(this).parent().parent().attr("title")) + ''); }); //--------------------------------------------------