public function __construct($prefix) { $this->prefix = $prefix; $file = 'other/psumc' . (PSU::isdev() ? '_dev' : ''); $mc = PSUDatabase::connect($file, 'return'); $this->connect($mc['hostname'], $mc['port']); }
/** * url * * Override the base ETrans url function to specifically work for OL * applicants. Build up the gateway with OL App specific variables, * and then return the formatted URL as provided by the _url ETrans * function with the specified params. * * @param int $aidm The aidm of the applicant in question. * @param string $app_id The specific application id for the fee * @param string $program (Optional) Program of study * @return string The formatted URL of the payment gateway */ public function url($aidm, $app_id, $program = 'Online') { /** * Create a new applicant with the provided aidm. The applicant * class checks if the user already has a pidm before hand, and will * return a PSU Person object if that is the case. From there, we * set the applicant identifier that we are using to be that pidm if * they already exist, otherwise we use the aidm as confirmed to * exist by the successful creation of an applicant object. */ $applicant = new PSU\Applicant($aidm); $applicant_id = $applicant instanceof PSU\Person ? $applicant->pidm : $applicant->aidm; if (!$applicant_id) { throw new Exception('Could not find any information attached to AIDM "' . $aidm . '"'); } /** * Online application fee specific URL parameters. These match up * with columns in the ecommerce_transaction table. */ $params = array('orderNumber' => $applicant_id, 'amount' => 5000, 'amountDue' => 5000, 'orderType' => 'Admission UG OL App', 'orderDescription' => 'Undergraduate Online Admission App Fee', 'name' => trim($applicant->last_name . ', ' . $applicant->first_name . ' ' . $applicant->middle_name), 'userChoice2' => $program, 'userChoice3' => $app_id); /** * Rely on the ETrans object to build up a redirect URL to relocate * the user after they have passed through the payment gateway. */ $this->setURLParam('redirectUrl', $this->base_url . '/receipt.html'); $this->setURLParam('retriesAllowed', 5); $this->setURLParam('redirectUrlParameters', implode(',', $this->_redirect_params)); /** * Return the specific URL based on execution location */ return $this->_url(PSU::isdev() ? 'test' : 'prod', $params); }
/** * Translate the incoming hostname to go.ply if we are on the dev box so that * database lookups on the hostname will catch all the normal go keywords. */ public static function dev_hostname($host) { if ($host == 'go.dev.plymouth.edu' && PSU::isdev()) { return 'go.plymouth.edu'; } return $host; }
public function process_auto() { $url = PSU::isdev() ? 'http://uranus.dev.plymouth.edu' : 'http://www.plymouth.edu'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url . "/webapp/courses/enrol/lmb/psu_importnow.php"); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: www." . (PSU::isdev() ? "dev." : "") . "plymouth.edu\r\n")); $head = curl_exec($ch); curl_close($ch); return $head; }
public static function mail($id) { $tpl = new PSU\Template(); $f = PSU::db('myplymouth')->GetRow("SELECT * FROM anejf WHERE id_ = ?", array($id)); $form = new AnejfApply($f, true); $form->readonly(true); $tpl->assign('form', $form); $message = $tpl->fetch('email.tpl'); $to = '*****@*****.**'; if (PSU::isdev()) { $to = '*****@*****.**'; } $subject = sprintf("[ANEJF %d] Application for %s %s", $GLOBALS['ANEJF']['YEAR'], $form->first_name->value(), $form->last_name->value()); PSU::mail($to, $subject, $message, 'Content-Type: text/html'); }
PSU::session_start(); // force ssl + start a session // Let's send UTF-8 (thanks abackstrom) header('Content-Type: text/html; charset=UTF-8'); $GLOBALS['BASE_URL'] = '/webapp/psu-mobile'; $GLOBALS['BASE_DIR'] = __DIR__; $GLOBALS['TITLE'] = 'PSU Mobile'; $GLOBALS['TEMPLATES'] = $GLOBALS['BASE_DIR'] . '/templates/'; $GLOBALS['APP_VERSION'] = '0.8.0'; $GLOBALS['APP_BUILD_NAME'] = 'jqm-html5'; $GLOBALS['APP_BUILD_TYPE'] = 'beta'; // Set some globals about our server for easy use later $GLOBALS['APP_PROTOCOL'] = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; $GLOBALS['APP_URL'] = $GLOBALS['APP_PROTOCOL'] . $_SERVER['HTTP_HOST'] . $GLOBALS['BASE_URL']; // If the app is currently running on the development server if (PSU::isdev()) { // Have the APP_BUILD_TYPE global reflect the current server/code status $GLOBALS['APP_BUILD_TYPE'] .= '-dev'; // Set a global for easier access from templates $GLOBALS['IS_DEV'] = true; // Turn off the CDN define('PSU_CDN', false); } else { // Have the APP_BUILD_TYPE global reflect the current server/code status $GLOBALS['APP_BUILD_TYPE'] .= '-prod'; // Set a global for easier access from templates $GLOBALS['IS_DEV'] = false; } // Include my custom mobile smarty class require_once $GLOBALS['BASE_DIR'] . '/includes/MobileTemplate.class.php'; // Include my custom mobile smarty class
/** * Connect to a database, or return connection parameters. * * @since version 1.0.0 * @param string $connect_data Connection identifier(s). * @param string $return Return type. One of: adodb (ADOdb object), mysql (raw mysql_connect() resource), return (connection parameters as an array). * @return mixed See the $return parameter. */ public function connect($connect_data, $return = 'adodb', $memcache = true) { //if the connect_data is not an array, lets make it one so life is easier if (!is_array($connect_data)) { $connect_data = array($connect_data); } //end if $dbs = array(); //loop over connection array and connect to the databases! foreach ($connect_data as $key => $connect) { $connect = explode('/', $connect); //include the db connection info include $connect[0] . '/' . $connect[1] . '.php'; StatsD\StatsD::increment("db.attempt.{$connect[0]}.{$connect[1]}"); $options = array_slice($connect, 2); //decide which object to create switch ($return) { case 'adodb': require_once 'adodb5/adodb.inc.php'; switch ($connect[0]) { case 'oracle': $driver = in_array('fixcase', $options) ? 'oci8po' : 'oci8'; break; case 'mssql': $driver = 'mssqlpo'; break; // disabled by defautl because ADO_RecordSet::RecordCount() does not work on // PDO connections. PDO supports rowCount(), but ADOdb will not use it unless // $ADODB_COUNTRECS is true. -- ambackstrom, 4 sept 2009 // disabled by defautl because ADO_RecordSet::RecordCount() does not work on // PDO connections. PDO supports rowCount(), but ADOdb will not use it unless // $ADODB_COUNTRECS is true. -- ambackstrom, 4 sept 2009 case 'mysql': $driver = 'mysql'; break; // DEBUG: disabling pdo support for now, it's not enabled on perseus if (!in_array('pdo', $options)) { $driver = 'mysql'; break; } $driver = 'pdo'; $port = null; $host = $_DB[$connect[0]][$connect[1]]['hostname']; if (strpos($host, ':') !== false) { list($host, $port) = explode(':', $host); } $_DB[$connect[0]][$connect[1]]['hostname'] = 'mysql:host=' . $host . ($port ? ';port=' . $port : ''); unset($host, $port); break; default: $driver = $connect[0]; break; } //end switch global $ADODB_COUNTRECS; global $ADODB_CACHE_DIR; global $ADODB_FORCE_TYPE; global $ADODB_GETONE_EOF; global $ADODB_QUOTE_FIELDNAMES; $user = posix_getpwuid(posix_geteuid()); $ADODB_COUNTRECS = false; $ADODB_CACHE_DIR = '/web/temp/ADOdbCache_' . md5($user['name']); $ADODB_GETONE_EOF = false; $ADODB_QUOTE_FIELDNAMES = true; $ADODB_FORCE_TYPE = ADODB_FORCE_IGNORE; if (!file_exists($ADODB_CACHE_DIR)) { mkdir($ADODB_CACHE_DIR, 0700); } //end if if (!ADODB_PREFETCH_ROWS) { define('ADODB_PREFETCH_ROWS', 50); } $db = ADONewConnection($driver); if (substr($driver, 0, 4) == 'oci8') { $db->_initdate = false; // persistent oracle connections $db->autoRollback = true; // must rollback; don't use existing transaction $connect_method = 'PConnect'; } else { $connect_method = 'NConnect'; } if (in_array('debug', $options)) { $db->debug = true; } if (in_array('nocache', $options)) { $db->cacheSecs = 0; } else { $db->cacheSecs = 600; } $db->SetFetchMode(ADODB_FETCH_ASSOC); if ($memcache) { $db->memCache = true; $db->memCacheHost = 'sualocin.plymouth.edu'; // $db->memCacheHost = $ip1; will work too $db->memCachePort = PSU::isdev() ? 21217 : 11217; // this is default memCache port $db->memCacheCompress = MEMCACHE_COMPRESSED; // Use 'true' to store the item compressed (uses zlib) } // modify some fields so date inserts get hour/minute/second as // well as the date. affects SYSDATE $db->dateformat = $db->NLS_DATE_FORMAT = 'RRRR-MM-DD HH24:MI:SS'; $db->fmtDate = "'Y-m-d H:i:s'"; $db->fmtTimeStamp = "'Y-m-d H:i:s'"; //$db->sysDate = 'TRUNC(SYSDATE)'; // function that returns today's date. this is adodb-oci8's default $connected = $db->{$connect_method}($_DB[$connect[0]][$connect[1]]['hostname'], $_DB[$connect[0]][$connect[1]]['username'], PSUSecurity::password_decode($_DB[$connect[0]][$connect[1]]['password']), $_DB[$connect[0]][$connect[1]]['database']); // need the default PDO MySQL behavior to be non-fixcase, for legacy code if ($connected && $driver === 'pdo' && $connect[0] === 'mysql') { if (in_array('fixcase', $options)) { $db->_connectionID->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); } else { $db->_connectionID->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL); } } if (!$connected) { StatsD\StatsD::increment("db.failure.{$connect[0]}.{$connect[1]}"); } if ($connect[0] == 'oracle') { $sql = "ALTER SESSION SET nls_date_format = 'YYYY-MM-DD HH24:MI:SS'"; $db->Execute($sql); } break; case 'mysql': $db = mysql_connect($_DB[$connect[0]][$connect[1]]['hostname'], $_DB[$connect[0]][$connect[1]]['username'], PSUSecurity::password_decode($_DB[$connect[0]][$connect[1]]['password'])); mysql_select_db($_DB[$connect[0]][$connect[1]]['database'], $db); break; case 'return': $db = $_DB[$connect[0]][$connect[1]]; break; } //end switch //unset the password so it doesn't appear in debug unset($db->password); $dbs[$key] = $db; } //end foreach return count($dbs) == 1 ? $dbs[0] : $dbs; }
/** * Modify a URL to point at the CDN. * @todo implement memcache and version numbers * @todo web ui to easily bump version numbers (ie. path LIKE); clears cache */ public static function cdn($url = '', $autoversion = self::AUTOVERSION) { // currently disabled unless explictly enabled if (defined('PSU_CDN') && PSU_CDN == false) { return $url; } if (false !== strpos($GLOBALS['BASE_URL'], '/webapp/banner/')) { return $url; } if (false !== strpos($url, ".php")) { return $url; } $mc = self::get('mc/cdn'); $orig_url = $url; // // first massage the url // static $searches = array('www.plymouth.edu', 'www.dev.plymouth.edu'); static $replaces = array('s0.plymouth.edu', 's0.dev.plymouth.edu'); // full url with protocol + domain if ('http://' === substr($url, 0, 7) || 'https://' === substr($url, 0, 8)) { $url = str_replace($searches, $replaces, $url); } elseif ('/' === substr($url, 0, 1)) { $host = PSU::isdev() ? 's0.dev.plymouth.edu' : 's0.plymouth.edu'; $proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://'; $new = $proto . $host; $url = $new . $url; } else { return $url; } // nothing else to do for non-cdn urls if (preg_match('!https?://s\\d+\\.(dev\\.)?plymouth\\.edu/!', $url) == 0) { return $url; } // if requested, stop here without changing version number embedded in url if ($autoversion == self::NO_AUTOVERSION) { return $url; } // trim off query string from this resource if (false !== ($pos = strpos($url, "?"))) { $url = substr($url, 0, $pos); } // Let's serve JavaScript files from a seperate subdomain, so we can utilize multiple parallel HTTP connections // // Parse the url $url_fragments = parse_url($url); // Check the path and host for safety if ('.js' === substr($url_fragments['path'], -3) && 's0.' === substr($url_fragments['host'], 0, 3)) { // Replace s0. with s1. $url = str_replace('://s0.', '://s1.', $url); } // // then consult memcache to find out if we have a version number // $slash = 0; $path = null; for ($i = 0, $len = strlen($url); $i < $len; $i++) { if ('/' === $url[$i]) { $slash += 1; } if ($slash == 3) { $path = substr($url, $i); break; } } if (!isset($path)) { return $orig_url; } // try to get version out of memcached $version = $mc->get($path); // not in memcached; first attempt, so try to get value from db if ($version === false) { $version = (int) PSU::db('myplymouth')->GetOne("SELECT version FROM http_resources WHERE path = ?", array($path)); if ($version) { $mc->add($path, $version, false, 120); //self::cdn_parent( $path, $parent ); } else { $version = false; } } // wasn't in memcached or db; add to memcached to reduce db hits, but mark as non-versioned if ($version === false) { $version = -1; $mc->add($path, $version, false, 120); //self::cdn_parent( $path, $parent ); } if ($version > 0) { $url .= '?v=' . $version; } return $url; }
/** * Old /me/ path redirects to /student/ */ respond('/me/?[*]?', function ($request, $response, $app) { $base_url = $app->config->get('teacher-cert', 'base_url'); $response->redirect($base_url . '/student/'); }); respond('/student/?[*]?', function ($request, $response, $app) { PSU::add_filter('student_view', 'PSU\\TeacherCert::__return_true'); }); respond(function ($request, $response, $app) { PSU::session_start(); $GLOBALS['BASE_URL'] = $app->config->get('teacher-cert', 'base_url'); $GLOBALS['TITLE'] = 'Teacher Certification'; $GLOBALS['TEMPLATES'] = PSU_BASE_DIR . '/app/teacher-cert/templates'; $domain = PSU::isdev() ? 'dev.plymouth.edu' : 'plymouth.edu'; $GLOBALS['PSUAPI'] = "https://api.{$domain}/0.1/?appid={{appid}}&appkey={{appkey}}"; unset($domain); if (file_exists(PSU_BASE_DIR . '/debug/teacher-cert-debug.php')) { include PSU_BASE_DIR . '/debug/teacher-cert-debug.php'; } IDMObject::authN(); $app->client = new Client($GLOBALS['PSUAPI']); $app->client->setConfig(array('appid' => $app->config->get('teacher-cert', 'api_appid'), 'appkey' => $app->config->get('teacher-cert', 'api_key'))); $app->readonly = false; $app->student_view = false; $app->parse_model_results = function ($results) use($app) { foreach ((array) $results->messages as $category => $messages) { foreach ($messages as $message) { $_SESSION[$category][] = $message; }
<?php require dirname(dirname(__DIR__)) . '/legacy/git-bootstrap.php'; require_once 'autoload.php'; PSU::session_start(); /*******************[Site Constants]*****************/ // Base directory of application $GLOBALS['BASE_DIR'] = dirname(__FILE__); // Base URL $GLOBALS['WEBAPP_URL'] = 'https://' . $_SERVER['HTTP_HOST'] . '/webapp'; // Base URL $GLOBALS['BASE_URL'] = 'https://' . $_SERVER['HTTP_HOST'] . '/webapp/my'; $GLOBALS['WEBAPP_URL'] = 'https://' . $_SERVER['HTTP_HOST'] . '/webapp'; $GLOBALS['OLD_WEBAPP_URL'] = 'https://www' . (PSU::isdev() ? '.dev' : '') . '.plymouth.edu/webapp'; $GLOBALS['HOST_URL'] = 'https://' . $_SERVER['HTTP_HOST']; // Local Includes $GLOBALS['LOCAL_INCLUDES'] = $GLOBALS['BASE_DIR'] . '/includes'; // Templates $GLOBALS['TEMPLATES'] = $GLOBALS['BASE_DIR'] . '/templates'; // Application Title $GLOBALS['TITLE'] = 'myPlymouth'; $GLOBALS['NO_FANCY_TPL'] = true; /*******************[End Site Constants]*****************/ if (is_file($GLOBALS['BASE_DIR'] . '/debug.php')) { include $GLOBALS['BASE_DIR'] . '/debug.php'; } /*******************[Common Includes]**********************/ require_once $GLOBALS['BASE_DIR'] . '/includes/MyController.class.php'; require_once $GLOBALS['BASE_DIR'] . '/includes/MyController_tab.class.php'; require_once $GLOBALS['BASE_DIR'] . '/includes/MyController_channel.class.php'; require_once $GLOBALS['BASE_DIR'] . '/includes/MyController_admin.class.php';
require_once 'autoload.php'; PSU::session_start(); $GLOBALS['TITLE'] = 'Call Log'; $config = \PSU\Config\Factory::get_config(); define('PSU_API_APPID', $config->get('calllog', 'api_appid')); define('PSU_API_APPKEY', $config->get('calllog', 'api_key')); require_once 'PSUWordPress.php'; ini_set('memory_limit', -1); $start_time = time(); ignore_user_abort(true); // Call Log Web Home $HOST = 'https://' . $_SERVER['SERVER_NAME']; $GLOBALS['BASE_URL'] = $HOST . '/webapp/calllog'; $GLOBALS['BASE_DIR'] = __DIR__; define('CALL_LOG_WEB_HOME', $GLOBALS['BASE_URL']); $GLOBALS['DEVELOPMENT'] = PSU::isdev(); $GLOBALS['uploads'] = '/web/uploads/webapp/calllog/attachments'; // Call Log Administrative Web Home define('TEMPLATE_DIR', __DIR__ . '/templates'); define('TEMPLATE_ADMIN_DIR', TEMPLATE_DIR . '/admin'); $GLOBALS['TEMPLATES'] = TEMPLATE_DIR; // Absolute Path To Cascading Style Sheet (CSS) Files define('CSS_DIR', __DIR__ . '/css'); // Web Path To CSS Files define('CSS_WEB_DIR', PSU::cdn($GLOBALS['BASE_URL'] . '/css')); $GLOBALS['CSS_WEB_DIR'] = CSS_WEB_DIR; // Web Path To JS Files define('JS_WEB_DIR', $GLOBALS['BASE_URL'] . '/js'); $GLOBALS['JS_WEB_DIR'] = JS_WEB_DIR; $GLOBALS['HELPDESK_EMAIL'] = '*****@*****.**'; define('INCLUDES_DIR', __DIR__ . '/includes');
*/ if (isset($GLOBALS['wpdb'])) { // wordpress was included some other way, accept it as it is. return true; } if (defined('WP_INSTALLING') && WP_INSTALLING !== true) { // we're about to include wordpress for the first time, but wp_installing is set to an incompatible value throw new Exception('WordPress has not been included, but WP_INSTALLING is not true: cannot proceed'); } define('DISABLE_WP_CRON', true); define('WP_INSTALLING', true); define('IS_PSUWORDPRESS', true); define('WP_CACHE', false); define('WP_DEBUG', false); define('SAVEQUERIES', false); if (!defined('WP_MEMORY_LIMIT')) { define('WP_MEMORY_LIMIT', ini_get('memory_limit')); } define('DOMAIN_CURRENT_SITE', PSU::isdev() ? 'www.dev.plymouth.edu' : 'www.plymouth.edu'); define('PATH_CURRENT_SITE', '/connect/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOGID_CURRENT_SITE', 1); require_once 'autoload.php'; require_once '/web/connect.plymouth.edu/wp-load.php'; // ask php to set the correct time zone (by default, wp changes the tz to utc) wp_timezone_override_offset(); // in PHP 5, WordPress core is explicitly setting the timezone to UTC. (wp-settings.php line 37) date_default_timezone_set('America/New_York'); if (!isset($GLOBALS['wpdb'])) { throw new Exception('Cannot find $wpdb after including WordPress. Please include from the global scope.'); }
/** * Generate the URL for linking off to our ecommerce processor. */ public function url($appid, $name, $amount, $program = '') { $psp_user_id = PSU::db('psp')->GetOne('SELECT psp_user_id FROM app_2008_app WHERE app_id = :appid', array('appid' => $appid)); if (!$psp_user_id) { throw new Exception('Could not find the psp_user_id for that appid'); } $params = array('orderNumber' => $psp_user_id, 'amount' => $amount, 'amountDue' => $amount, 'orderType' => 'Admission GR App', 'orderDescription' => 'Graduate Admission App Fee', 'name' => $name, 'userChoice2' => $program, 'userChoice3' => $appid); $this->setURLParam('redirectUrl', str_replace('igrad', 'www', $this->base_url) . '/receipt.html'); $this->setURLParam('retriesAllowed', 5); $this->setURLParam('redirectUrlParameters', implode(',', $this->_redirect_params)); return $this->_url(PSU::isdev() ? 'test' : 'prod', $params); }
/** * __construct * * Initial object setup. * * @param string|boolean $uid_or_auto indicates how cache and template directories should be set. uid specifies a unique id to build names, true generates paths automatically. leave blank or false to specify these paths yourself. */ function __construct($uid_or_auto = true) { self::$GLOBAL_TEMPLATES = PSU_LEGACY_DIR . '/templates'; self::$STYLE_TEMPLATES = PSU_BASE_DIR . '/app/core/templates'; parent::__construct(); static::$js_registry = array('jquery' => 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js', 'jquery-ui' => 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js', 'ddm' => '/includes/js/jquery-plugins/jquery.multi-ddm.min.js', 'my-combined' => '/webapp/my/js/combined.js', 'my-behavior' => '/webapp/my/js/behavior.js', 'myjs' => '/webapp/portal/myjs/index.php', 'style-behavior' => '/webapp/style-bootstrap/js/behavior.js', 'bootstrap' => '/webapp/style-bootstrap/js/bootstrap.min.js'); $this->psu_server = ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://'; if (PSU::isdev()) { $this->psu_server .= self::psu_dev_server; } else { $this->psu_server .= self::psu_prod_server; } // does user want us to set up smarty dirs? if ($uid_or_auto) { // what's our temp directory? $tmp = null; if (isset($GLOBALS['TEMPORARY_FILES'])) { $tmp = $GLOBALS['TEMPORARY_FILES']; } else { foreach (self::$DEFAULT_TMP as $this_tmp) { if (is_dir($this_tmp) && is_writable($this_tmp)) { $tmp = $this_tmp; break; } } } if ($uid_or_auto === true) { // true means full automatic. use BASE_URL as the unique seed if (!isset($GLOBALS['BASE_URL'])) { // can't be full auto without a base url. throw new PSUSmartyException(PSUSmartyException::NO_BASE_URL); } $md5 = md5($GLOBALS['BASE_URL']); $this->compile_dir = $tmp . '/smarty_tc_' . $md5; } else { // uid was set, and it wasn't true, so use the string $this->compile_dir = $tmp . '/smarty_tc_' . $uid_or_auto; } } elseif (isset($GLOBALS['SMARTY_COMPILE'])) { // user did not want an auto dir, but specified a dir elsewhere $this->compile_dir = $GLOBALS['SMARTY_COMPILE']; } // create compile directory if it's not there yet if (!is_dir($this->compile_dir)) { $old_umask = umask(07); mkdir($this->compile_dir); umask($old_umask); } $this->plugins_dir[] = PSU_EXTERNAL_DIR . '/smarty/psu_plugins'; $this->head = array('js' => array(), 'google_lazy_js' => array(), 'css' => array()); // register any custom functions $this->register_function('PSU_JS', array($this, 'psu_js')); $this->register_function('psu_js', array($this, 'psu_js')); $this->register_function('PSU_GOOGLE_LAZY_JS', array($this, 'psu_google_lazy_js')); $this->register_function('PSU_CSS', array($this, 'psu_css')); $this->register_function('psu_dbug', array($this, 'psu_dbug')); $this->register_function('icon', array($this, 'icon')); $this->register_function('iconbox', array($this, 'iconbox')); $this->register_function('psu_puke', array($this, 'psu_puke')); $this->register_function('psu_progress', array($this, 'psu_progress')); $this->register_function('psu_authz_js', array($this, 'psu_authz_js')); $this->register_outputfilter(array($this, 'psu_head_includes')); $this->register_modifier('cdn', array($this, 'cdn')); $this->register_modifier('cssslug', array($this, 'cssslug')); $this->register_function('paging_querystring', array($this, 'paging_querystring')); $this->register_modifier('paging_order', array($this, 'paging_order')); $this->register_function('psu_messages', array($this, 'psu_messages')); $this->register_function('psu_errors', array($this, 'psu_errors')); $this->register_function('psu_successes', array($this, 'psu_successes')); $this->register_function('psu_warnings', array($this, 'psu_warnings')); $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'; // add in the registry $this->assign('psureg', PSU::get()); }
/** * setupCAS */ static function setupCAS($host = null, $dir = false) { if (!isset($host)) { $host = PSU::isdev() ? 'connect.dev' : 'connect'; } $dir = $dir ? $dir : 'cas/'; if (!$GLOBALS['CAS_SETUP']) { $GLOBALS['CAS_SETUP'] = true; // import phpCAS lib require_once 'cas/CAS.php'; // initialize phpCAS phpCAS::client(CAS_VERSION_2_0, $host . '.plymouth.edu', 443, $dir, false); // logout if desired if (isset($_REQUEST['logout'])) { phpCAS::logout($_REQUEST['logout']); } } // logout if desired if (isset($_REQUEST['logout'])) { phpCAS::logout($_REQUEST['logout']); } }