Changeset - 73b131aa114b
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 14 years ago 2011-04-09 13:29:31
ohnobinki@ohnopublishing.net
Completely disallow calling `new page()'. Use page::page_create() instead.
2 files changed with 10 insertions and 2 deletions:
0 comments (0 inline, 0 general)
ajax.php
Show inline comments
 
@@ -67,25 +67,25 @@ function slate_permutate_json_success(ar
 

	
 
if (isset($_REQUEST['school_registration_html']))
 
  {
 
    if (!empty($_REQUEST['school']))
 
      $school = school_load($_REQUEST['school']);
 
    if (empty($school))
 
      {
 
	$school = school_load_guess();
 
	if (empty($school))
 
	  slate_permutate_json_error('Unable to load any school.');
 
      }
 

	
 
    $page = new Page('', array(), FALSE);
 
    $page = page::page_create('');
 

	
 
    $courses = array();
 
    if (!empty($_REQUEST['courses']) && is_array($_REQUEST['courses']))
 
      {
 
	/*
 
	 * The below course deserialization blob should be moved into
 
	 * the Course object.
 
	 */
 
	foreach ($_REQUEST['courses'] as $course_json)
 
	  {
 
	    $course = Course::from_json_array($course_json);
 
	    if (!empty($course))
inc/class.page.php
Show inline comments
 
@@ -84,34 +84,42 @@ class page
 
  /* the current school. See get_school(). */
 
  private $school;
 

	
 
  private $semester;
 

	
 
  /*
 
   * Whether or not the user should be presented with the option to
 
   * change the school profile or semester.
 
   */
 
  private $school_semester_constant;
 

	
 
  /**
 
   * \brief
 
   *   Construct a new page.
 
   *
 
   * Only to be called by page::page_construct(). Use that function
 
   * instead of the new keyword.
 
   *
 
   * \see page::page_construct()
 
   *
 
   * \param $ntitle
 
   *   Must be a valid HTML string (i.e., escaped with htmlentities()).
 
   * \param $nscripts
 
   *   An array of strings identifying the scripts to include for this page.
 
   * \param $options
 
   *   An array containing any of the following keys:
 
   *     - 'school': The school to use instead of the autodetected one.
 
   *     - 'semester': The semester to use instead of the autodetected one.
 
   */
 
  public function __construct($ntitle, $nscripts = array(), $immediate = TRUE, array $options = array())
 
  protected function __construct($ntitle, $nscripts = array(), $immediate = TRUE, array $options = array())
 
  {
 
    /* Begin tracking generation time */
 
    $this->pageGenTime = round(microtime(),4);
 

	
 
    global $ga_trackers;
 

	
 
    require_once('school.inc');
 

	
 
    /* Scripts and styles available for inclusion */
 
    $this->headCode['jQuery'] = '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script>';
 
    $this->headCode['jQueryUI'] = '<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script><link rel="stylesheet" href="styles/jqueryui.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
0 comments (0 inline, 0 general)