Changeset - 177e04989826
[Not reviewed]
default
0 1 2
Nathan Brink (binki) - 13 years ago 2012-12-11 02:29:21
ohnobinki@ohnopublishing.net
Add support for cornerstone, fixing bug #146, including support for WebAdvisor schools lacking section synonyms.
3 files changed with 92 insertions and 0 deletions:
0 comments (0 inline, 0 general)
inc/school.crawl.webadvisor.inc
Show inline comments
 
@@ -473,6 +473,15 @@ function school_crawl_webadvisor_semeste
 
	      $synonym = $matches[1];
 
	      $title = trim($matches[2]);
 
	    }
 
	  else
 
	    {
 
	      /*
 
	       * Places without synonyms just don’t have the
 
	       * parantheses around the synonym. Just get a title…
 
	       */
 
	      list(, $title) = explode(' ', $sec_short_title, 2);
 
	      $title = trim($title);
 
	    }
 

	
 
	  school_crawl_logf($school_crawl_log, 10, "");
 
	  school_crawl_logf($school_crawl_log, 10, implode('-', $section_id) . ': ' . $sec_short_title);
school.d/cornerstone.crawl.inc
Show inline comments
 
new file 100644
 
<?php /* -*- mode: php; -*- */
 
/*
 
 * Copyright 2012 Nathan Phillip Brink <ohnobinki@ohnopublishing.net>
 
 *
 
 * This file is a part of slate_permutate.
 
 *
 
 * slate_permutate is free software: you can redistribute it and/or modify
 
 * it under the terms of the GNU Affero General Public License as published by
 
 * the Free Software Foundation, either version 3 of the License, or
 
 * (at your option) any later version.
 
 *
 
 * slate_permutate is distributed in the hope that it will be useful,
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 * GNU Affero General Public License for more details.
 
 *
 
 * You should have received a copy of the GNU Affero General Public License
 
 * along with slate_permutate.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'school.crawl.webadvisor.inc';
 

	
 
function cornerstone_crawl_semester_list(array $school, array &$semesters, &$school_crawl_log)
 
{
 
  return school_crawl_webadvisor_semester_list($school, $semesters, $school_crawl_log, array('curlsetup_hook' => '_' . $school['id'] . '_crawl_semester_curlsetup_hook'));
 
}
 

	
 
function cornerstone_crawl_semester(array $school, Semester $semester, &$school_crawl_log)
 
{
 
  return school_crawl_webadvisor_semester($school, $semester, $school_crawl_log, array('curlsetup_hook' => '_' . $school['id'] . '_crawl_semester_curlsetup_hook'));
 
}
 

	
 
/**
 
 * \brief
 
 *   Tell libCURL to ignore the missing SSL cert in the misconfigured
 
 *   server’s SSL certchain.
 
 *
 
 * https://solomon.cornerstone.edu/ is missing the middle cert from
 
 * its SSL certchain. The only way to expose this is to remove the
 
 * cached cert from Mozilla’s certcache. Visiting
 
 * https://eaglesnest.cornerstone.edu/ before visiting solomon is
 
 * enough to get the missing cert cached into Mozilla’s certcache. We
 
 * could try to emulate this behavior, but PHP’s openssl library
 
 * doesn’t support SSL connections (it just does encrypt/decrypt and
 
 * hashes) and it seems libcurl provides no way to access/save the
 
 * certs it encounters, though it does provide a way to specify CA
 
 * certs. I just don’t feel like adding the intermediate CA cert
 
 * slate_permutate’s repository… so, now for some untrusted computing
 
 * instead of getting the verified intermediate cert from eaglesnest!
 
 */
 
function _cornerstone_crawl_semester_curlsetup_hook($curl)
 
{
 
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
 
}
school.d/cornerstone.inc
Show inline comments
 
new file 100644
 
<?php /* -*- mode: php; -*- */
 
/*
 
 * Copyright 2012 Nathan Phillip Brink <ohnobinki@ohnopublishing.net>
 
 *
 
 * This file is a part of slate_permutate.
 
 *
 
 * slate_permutate is free software: you can redistribute it and/or modify
 
 * it under the terms of the GNU Affero General Public License as published by
 
 * the Free Software Foundation, either version 3 of the License, or
 
 * (at your option) any later version.
 
 *
 
 * slate_permutate is distributed in the hope that it will be useful,
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 * GNU Affero General Public License for more details.
 
 *
 
 * You should have received a copy of the GNU Affero General Public License
 
 * along with slate_permutate.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
function cornerstone_info()
 
{
 
  return array(
 
    'example_course_id' => 'ENGL 101',
 
    'name' => 'Cornerstone University',
 
    'student_address' => 'Eagle',
 
    'webadvisor_url' => 'https://solomon.cornerstone.edu/COLLIVE/WebAdvisor',
 
  );
 
}
0 comments (0 inline, 0 general)