4 * http://opencaps.atrc.utoronto.ca
6 * Copyright 2010 Heidi Hazelton
7 * Adaptive Technology Resource Centre, University of Toronto
9 * Licensed under the Educational Community License (ECL), Version 2.0.
10 * You may not use this file except in compliance with this License.
11 * http://www.opensource.org/licenses/ecl2.php
15 if (!defined('INCLUDE_PATH')) {
16 define('INCLUDE_PATH', 'include/');
19 require(INCLUDE_PATH.'classes/user_class.php');
20 require(INCLUDE_PATH.'classes/db_class.php');
21 require(INCLUDE_PATH.'classes/project_class.php');
22 require(INCLUDE_PATH.'classes/clip_class.php');
23 require(INCLUDE_PATH.'classes/caption_class.php');
24 require(INCLUDE_PATH.'classes/time_class.php');
25 require(INCLUDE_PATH.'classes/system_class.php');
29 require(INCLUDE_PATH.'config.inc.php');
32 $supported_ext = array('mov', 'qt', 'mp4', 'm4v', 'mpg', 'mpeg', 'dv', 'mp3', 'wav', 'aac', 'midi', 'au', 'avi', 'aiff');
33 $pub_pages = array("index.php", "login.php", "register.php", "start.php", "start_remote.php", "workflow.php");
35 $page = explode('/',$_SERVER['PHP_SELF']);
38 $base_url = substr('http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"], 0, -(strlen($page)));
\r
40 function my_add_null_slashes( $string ) {
41 return mysql_real_escape_string(stripslashes($string));
43 function my_null_slashes($string) {
46 if ( get_magic_quotes_gpc() ) {
47 $addslashes = 'my_add_null_slashes';
48 $stripslashes = 'stripslashes';
50 $addslashes = 'mysql_real_escape_string';
51 $stripslashes = 'my_null_slashes';
54 if (get_magic_quotes_gpc()) {
55 $addslashes = 'my_add_null_slashes';
56 $stripslashes = 'my_null_slashes';
58 $addslashes = 'addslashes';
59 $stripslashes = 'stripslashes';
64 * check for valid user
67 $this_user = new user($_SESSION['mid'], $_SESSION['username']);
69 if (!in_array($page, $pub_pages) && (!isset($_SESSION['valid_user']) || !$_SESSION['valid_user'] || !isset($_SESSION['mid']) || !$_SESSION['mid']) ) {
70 header("Location:start.php");
74 /* check if system connection */
76 $this_system = new system(ACTIVE_SYSTEM);
82 if (!isset($this_db) && !DISABLE_LOCAL)
83 $this_db = new database();
89 if (isset($_SESSION['pid']) || $page=="workflow.php") {
90 $this_proj = new project();
91 $this_proj->owner = &$this_user;
93 if (isset($_SESSION['pid']))
94 $this_proj->id = $_SESSION['pid'];
96 if (!empty($this_proj->id))
101 global $this_proj, $stripslashes;
103 $json = json_decode($stripslashes(@file_get_contents(INCLUDE_PATH.'../projects/'.$_SESSION['pid'].'/opencaps.json')));
105 $this_proj->id = $json->id;
106 $this_proj->name = $json->name;
107 //$this_proj->prefs = $json->prefs;
109 $this_proj->media_loc = $json->media_loc;
110 $this_proj->media_height = $json->media_height;
111 $this_proj->media_width = $json->media_width;
112 $this_proj->duration = $json->duration;
113 $this_proj->layout = $json->layout;
115 $this_proj->caption_loc = $json->caption_loc;
116 $this_proj->clip_collection = $json->clip_collection;
121 * check for valid project
123 if ($page != "index.php" && $page != "login.php" && $page != "logout.php" && $page != "register.php" && $page != "start.php" && $page != "adminTasks.php") {
124 if (!isset($_SESSION['pid']) && empty($_SESSION['pid'])) {
125 echo "Project not loaded.";
132 //check if using firefox
133 /*if(!strstr($_SERVER['HTTP_USER_AGENT'], "Firefox")) {
134 $_SESSION['errors'][] = "At this time, Capscribe Web requires a Firefox browser.";
135 include(INCLUDE_PATH.'basic_header.inc.php');
136 include(INCLUDE_PATH.'footer.inc.php');