/
webctlink.php
124 lines (78 loc) · 4.33 KB
/
webctlink.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
require_once(dirname(__FILE__) . "/config.php");
/**
*
* WebCT Integration page, for use with the Stephen Vickers login2 powerlink.
*
* Please look below at the commented INSERT strings and make sure you have these sorted
* If your system is providing it's own sessions then you also need to empty the code from session.php so it is just the PHP tags.
* If your system is not supporting its own session that you may need to leave session_start() (without any parameters) in session.php
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/
/**
* Create the basic session if required - i.e. your host may allow for some of this code to be commented out.
*/
session_start();
include $xerte_toolkits_site->php_library_path . "display_library.php";
//$_SESSION['toolkits_surname'] = "INSERTFIRSTNAMEHERE";
$_SESSION['toolkits_firstname'] = $_GET['firstname'];
//$_SESSION['toolkits_surname'] = "INSERTSURNAMEHERE";
$_SESSION['toolkits_surname'] = $_GET['lastname'];
include $xerte_toolkits_site->php_library_path . "user_library.php";
$mysql_id=database_connect("index.php database connect success","index.php database connect fail");
//$_SESSION['toolkits_logon_username'] = "INSERTUSERNAMEHERE";
$_SESSION['toolkits_logon_username'] = $_GET['username'];
/*
* WebCT powerlink code - you must be able to access the $_SERVER referer for this to work.
*/
$server_referer = $_SERVER['HTTP_REFERER'];
$orig_pos = strpos($server_referer,"organizerId%3D");
$organizer = substr($server_referer,$orig_pos+14);
$organizer = substr($organizer,0,strpos($organizer,"%"));
$proxy = substr($server_referer,strpos($server_referer,"PROXY"));
/*
* WebCT return URL for addcommitURL - replace ***YOURWEBSITEHERE*** with the URL of your webCT install, then remove the comment.
*/
$_SESSION['toolkits_webct_url'] = "<a style=\"text-decoration:none; border:none;\" href=\"http://webct.nottingham.ac.uk/webct/addcommiturl.dowebct?title=~~~NAME~~~&isEnabled=true&isNewWin=1&category=" . $organizer . "&description=&createAnother=false&URL=~~~URL~~~&createdBy=&itemList=&returnURL=%2FaddPickMiniMeItemsToOrganizerPage.dowebct%3FfromCreate%3Dtrue%26refreshUrl%3D%2ForganizerMap%2FDisplayOrganizerVisualDesign.dowebct%253ForganizerId%253D" . $organizer . "%26organizerId%3D" . $organizer . "%26componentType%3D" . $proxy ."\"><img onmouseover=\"this.src='website_code/images/Bttn_PublishOn.gif'\" onmouseout=\"this.src='website_code/images/Bttn_PublishOff.gif'\" onmousedown=\"this.src='website_code/images/Bttn_PublishClick.gif'\" style=\"text-decoration:none; border:none;\" src=\"website_code/images/Bttn_PublishOff.gif\" /></a>";
$_SESSION['webct'] = $_GET['webctpowerlink'];
/*
* Check to see if this is a users' first time on the site
*/
if(check_if_first_time($_SESSION['toolkits_logon_username'])){
/*
* create the user a new id
*/
$_SESSION['toolkits_logon_id'] = create_user_id($_SESSION['toolkits_logon_username'], $_SESSION['toolkits_firstname'], $_SESSION['toolkits_surname']);
/*
* create a virtual root folder for this user
*/
create_a_virtual_root_folder();
}else{
/*
* User exists so update the user settings
*/
$_SESSION['toolkits_logon_id'] = get_user_id();
update_user_logon_time();
}
recycle_bin();
/*
* Output the main page, including the user's and blank templates
*/
echo file_get_contents($xerte_toolkits_site->website_code_path . "management_headers");
echo "<script type=\"text/javascript\"> // JAVASCRIPT library for fixed variables\n // management of javascript is set up here\n // SITE SETTINGS\n";
echo "var site_url = \"" . $xerte_toolkits_site->site_url . "\";\n";
echo "var site_apache = \"" . $xerte_toolkits_site->apache . "\";\n";
echo "var properties_ajax_php_path = \"website_code/php/properties/\";\n var management_ajax_php_path = \"website_code/php/management/\";\n var ajax_php_path = \"website_code/php/\";\n";
echo file_get_contents($xerte_toolkits_site->website_code_path . "integration_top");
list_users_projects("data_down");
echo logged_in_page_format_middle(file_get_contents($xerte_toolkits_site->website_code_path . "management_middle"));
list_blank_templates();
//print_r($_SESSION);
echo file_get_contents($xerte_toolkits_site->website_code_path . "management_bottom");
?>
</body>
</html>