<?php /********************** The $_PORTAL array is typically like this: $_PORTAL['section'] $_PORTAL['activity'] $_PORTAL['action'] $_PORTAL['params'] **********************/ $_PORTAL = array(); $_PORTAL = portal_parse_uri(@$_SERVER['REQUEST_URI']); $_PORTAL['errors'] = array(); // Get a database connection to the servers used in the application mystery_db_connect('portal_dbh', $portal_config['portal_database_connection']); mystery_db_connect('sunflower_dbh', $portal_config['sunflower_database_connection']); mystery_db_connect('rails_dbh', $portal_config['rails_database_connection']); // Setup custom authentication using the Mystery auth framework. $_MYSTERY['external_auth_functions'][] = 'portal_auth'; // Setup configuration values for this session $_PORTAL['project'] = portal_get_project_key(); $_PORTAL['project_info'] = portal_get_project_info_by_key($_PORTAL['project']); portal_convert_project_settings_to_local($_PORTAL['project']); // Revert the project key to get activities working correctly if this is a special -dev project $_PORTAL['project'] = str_replace('-dev', '', $_PORTAL['project']); // setup any contstants we want to use $portal_image_types = array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF(intel byte order)', 8 => 'TIFF(motorola byte order)', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM'); //mystery_db_connect('lhh_dbh', $lhh_config['lhh_database_connection']);
function portal_determine_resource($uri) { // This function determines which resource the user should be given, based on the current // section -> activity -> action -> params $_PORTAL = portal_parse_uri($uri); switch ($_PORTAL['section']) { case '': case 'home': if ($_SESSION['portal']['member_type'] == 'student') { $include_file = 'controllers/student-home.php'; } else { $include_file = 'controllers/home.php'; } break; case 'about': $include_file = 'controllers/about.php'; break; case 'help': $include_file = 'controllers/help.php'; break; case 'faq': $include_file = 'controllers/faq.php'; break; case 'requirements': $include_file = 'controllers/requirements.php'; break; case 'support': $include_file = 'controllers/support.php'; break; case 'studenthome': $include_file = 'controllers/student-home.php'; break; case 'signin': $include_file = 'controllers/signin.php'; break; case 'reminder': $include_file = 'controllers/reminder.php'; break; case 'signout': $include_file = 'controllers/signout.php'; break; case 'signup': $include_file = 'controllers/signup.php'; break; case 'switch': $include_file = 'controllers/switch.php'; break; case 'links': $include_file = 'controllers/links.php'; break; case 'admin': $include_file = 'controllers/admin.php'; break; case 'preview': $include_file = 'controllers/preview.php'; break; case 'diy': $include_file = 'controllers/diy.php'; break; case 'otrunk': $include_file = 'controllers/otrunk.php'; break; case 'course': $include_file = 'controllers/course.php'; break; case 'activities': switch ($_PORTAL['activity']) { case 'view': $include_file = 'controllers/activity-view.php'; // deprecated break; case 'list': case 'my': case 'school': case 'world': $include_file = 'controllers/activity-list.php'; // deprecated break; case 'create': default: $include_file = 'controllers/activities.php'; break; } break; case 'class': switch ($_PORTAL['activity']) { case 'edit': case 'add': case 'copy': $include_file = 'controllers/class-manage.php'; break; case 'delete': $include_file = 'controllers/class-delete.php'; break; case 'roster': $include_file = 'controllers/class-roster.php'; break; case 'report': $include_file = 'controllers/class-report.php'; break; case 'preview': $include_file = 'controllers/student-preview.php'; break; } break; case 'school': switch ($_PORTAL['activity']) { case 'edit': $include_file = 'controllers/school-edit.php'; break; } break; case 'district': switch ($_PORTAL['activity']) { case 'edit': $include_file = 'controllers/district-edit.php'; break; } break; case 'student': switch ($_PORTAL['activity']) { case 'add': $include_file = 'controllers/student-signup.php'; break; } break; case 'teacher': switch ($_PORTAL['activity']) { case 'add': $include_file = 'controllers/teacher-signup.php'; break; } break; case 'member': switch ($_PORTAL['activity']) { case 'report': $include_file = 'controllers/member-report.php'; break; case 'edit': $include_file = 'controllers/member-edit.php'; break; case 'delete': $include_file = 'controllers/member-delete.php'; break; case 'info': $include_file = 'controllers/member-info.php'; break; } break; case 'statistics': $include_file = 'controllers/usage-statistics.php'; break; case 'usage': $include_file = 'controllers/usage-stats.php'; break; case 'xml': switch ($_PORTAL['activity']) { case 'classlist': $include_file = 'controllers/xml-classlist.php'; break; } break; default: $include_file = 'controllers/error.php'; break; } return $include_file; }