Skip to content

Commit

Permalink
remove duplicate requires for database_library, make sure config.php …
Browse files Browse the repository at this point in the history
…is require_once-ed

git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@166 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
Dave Goodwin committed Oct 20, 2011
1 parent b4bd6f5 commit 9f15ef8
Show file tree
Hide file tree
Showing 95 changed files with 3,711 additions and 3,826 deletions.
1 change: 0 additions & 1 deletion data.php
Expand Up @@ -11,7 +11,6 @@

require_once("config.php");

require $xerte_toolkits_site->php_library_path . "database_library.php";
require $xerte_toolkits_site->php_library_path . "template_status.php";
require $xerte_toolkits_site->php_library_path . "display_library.php";

Expand Down
1 change: 0 additions & 1 deletion example.php
Expand Up @@ -11,7 +11,6 @@

require_once("config.php");

require $xerte_toolkits_site->php_library_path . "database_library.php";
require $xerte_toolkits_site->php_library_path . "screen_size_library.php";
require $xerte_toolkits_site->php_library_path . "template_status.php";
require $xerte_toolkits_site->php_library_path . "display_library.php";
Expand Down
73 changes: 37 additions & 36 deletions feedback/index.php
@@ -1,14 +1,15 @@
<?PHP /**
*
* feedback page, allows users to send feedback to site admins
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/

include "../config.php";
<?php
/**
*
* feedback page, allows users to send feedback to site admins
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/

require_once("../config.php");

?>

Expand All @@ -24,37 +25,37 @@

<body>

<div class="topbar">
<img src="../website_code/images/xerteLogo.jpg" style="margin-left:10px; float:left" />
<img src="../website_code/images/UofNLogo.jpg" style="margin-right:10px; float:right" />
</div>
<div class="mainbody">

<?PHP /**
* If something is posted, send this feedback
*/

if(isset($_POST['feedback'])){
<div class="topbar">
<img src="../website_code/images/xerteLogo.jpg" style="margin-left:10px; float:left" />
<img src="../website_code/images/UofNLogo.jpg" style="margin-right:10px; float:right" />
</div>
<div class="mainbody">

<?PHP /**
* If something is posted, send this feedback
*/

echo "<p>Thank you for your feedback</p></div></body></html>";
if(isset($_POST['feedback'])){

mail($xerte_toolkits_site->feedback_list, "Xerte Online Feedback", "Name " . mysql_real_escape_string($_POST['name']) . "<br>Message<br>" . mysql_real_escape_string($_POST['feedback']), $xerte_toolkits_site->headers);
echo "<p>Thank you for your feedback</p></div></body></html>";

}else{

/**
* Else display the page
*/
mail($xerte_toolkits_site->feedback_list, "Xerte Online Feedback", "Name " . mysql_real_escape_string($_POST['name']) . "<br>Message<br>" . mysql_real_escape_string($_POST['feedback']), $xerte_toolkits_site->headers);

echo "<div class=\"title\"><p>Welcome to Xerte on-line Toolkits Feedback page</p></div><div style=\"width:45%; float:left; position:relative; margin-right:20px;\">Please leave your feedback here. All feedback is anonymous, unless you would like a response, and if you do, please leave your name opposite and some contact details in the box below. Thank you, the IS Learning Team.</div><div style=\"width:50%; float:left; position:relative;\">";
}else{

echo "<form action=\"\" method=\"post\">Name<textarea name=\"name\" style=\"width:100%;\" rows=\"1\"></textarea>Feedback<textarea name=\"feedback\" style=\"width:100%;\" rows=\"25\"></textarea><input type=\"submit\" value=\"Send Feedback\"></form>";
/**
* Else display the page
*/

echo "</div></div></body></html>";
echo "<div class=\"title\"><p>Welcome to Xerte on-line Toolkits Feedback page</p></div><div style=\"width:45%; float:left; position:relative; margin-right:20px;\">Please leave your feedback here. All feedback is anonymous, unless you would like a response, and if you do, please leave your name opposite and some contact details in the box below. Thank you, the IS Learning Team.</div><div style=\"width:50%; float:left; position:relative;\">";

}
echo "<form action=\"\" method=\"post\">Name<textarea name=\"name\" style=\"width:100%;\" rows=\"1\"></textarea>Feedback<textarea name=\"feedback\" style=\"width:100%;\" rows=\"25\"></textarea><input type=\"submit\" value=\"Send Feedback\"></form>";

?>
</div>
echo "</div></div></body></html>";

}

?>
</div>
</body>
</html>
</html>
115 changes: 57 additions & 58 deletions getfile.php
@@ -1,62 +1,61 @@
<?PHP

require("config.php");

require $xerte_toolkits_site->php_library_path . "login_library.php";
require $xerte_toolkits_site->php_library_path . "user_library.php";
require $xerte_toolkits_site->php_library_path . "database_library.php";
require $xerte_toolkits_site->php_library_path . "template_library.php";
require $xerte_toolkits_site->php_library_path . "template_status.php";
require $xerte_toolkits_site->php_library_path . "display_library.php";

$mysql_id=database_connect("Successful database connect for play queries","Failed database connect for play queries");

/*
* Check the template ID is numeric
*/

$safe_file_path = mysql_real_escape_string($_GET['file']);

$data_from_file_name = explode("-",$safe_file_path);

if(is_numeric($data_from_file_name[0])){

if(has_rights_to_this_template($data_from_file_name[0],$_SESSION['toolkits_logon_id'])){

/*
* Check if user is editor (could be read only)
*/

if(is_user_an_editor($data_from_file_name[0],$_SESSION['toolkits_logon_id'])){

if($data_from_file_name[1]==$_SESSION['toolkits_logon_username']){

$file = $xerte_toolkits_site->users_file_area_full . $safe_file_path;

header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Transfer-Encoding: binary");

readfile($file);

}

}


}

}else{

/*
* Was not numeric, so display error message
*/

echo edit_xerte_page_format_top(file_get_contents($xerte_toolkits_site->website_code_path . "error_top")) . " Sorry this resource does not exist </div></div></body></html>";
die();


}
require_once("config.php");

require $xerte_toolkits_site->php_library_path . "login_library.php";
require $xerte_toolkits_site->php_library_path . "user_library.php";
require $xerte_toolkits_site->php_library_path . "template_library.php";
require $xerte_toolkits_site->php_library_path . "template_status.php";
require $xerte_toolkits_site->php_library_path . "display_library.php";

$mysql_id=database_connect("Successful database connect for play queries","Failed database connect for play queries");

/*
* Check the template ID is numeric
*/

$safe_file_path = mysql_real_escape_string($_GET['file']);

$data_from_file_name = explode("-",$safe_file_path);

if(is_numeric($data_from_file_name[0])){

if(has_rights_to_this_template($data_from_file_name[0],$_SESSION['toolkits_logon_id'])){

/*
* Check if user is editor (could be read only)
*/

if(is_user_an_editor($data_from_file_name[0],$_SESSION['toolkits_logon_id'])){

if($data_from_file_name[1]==$_SESSION['toolkits_logon_username']){

$file = $xerte_toolkits_site->users_file_area_full . $safe_file_path;

header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Transfer-Encoding: binary");

readfile($file);

}

}


}

}else{

/*
* Was not numeric, so display error message
*/

echo edit_xerte_page_format_top(file_get_contents($xerte_toolkits_site->website_code_path . "error_top")) . " Sorry this resource does not exist </div></div></body></html>";
die();


}

?>
3 changes: 1 addition & 2 deletions index.php
@@ -1,6 +1,6 @@
<?php

require("config.php");
require_once("config.php");

/**
*
Expand Down Expand Up @@ -57,7 +57,6 @@

$_SESSION['toolkits_surname'] = $entry[0]['sn'][0];

require_once $xerte_toolkits_site->php_library_path . "database_library.php";

require_once $xerte_toolkits_site->php_library_path . "user_library.php";

Expand Down
124 changes: 61 additions & 63 deletions integration.php
@@ -1,95 +1,93 @@
<?PHP
<?php

require("config.php");
require_once("config.php");

/**
*
* Integration page, generic framework for integrating this service into other systems.
*
* Please look below at the 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 and possibly session_start().
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/
/**
*
* Integration page, generic framework for integrating this service into other systems.
*
* Please look below at the 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 and possibly session_start().
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/

/**
* Create the basic session
*/
/**
* Create the basic session
*/

include $xerte_toolkits_site->php_library_path . "login_library.php";
include $xerte_toolkits_site->php_library_path . "login_library.php";

include $xerte_toolkits_site->php_library_path . "display_library.php";
include $xerte_toolkits_site->php_library_path . "display_library.php";

$_SESSION['toolkits_firstname'] = "INSERTFIRSTNAMEHERE";

$_SESSION['toolkits_surname'] = "INSERTSURNAMEHERE";
$_SESSION['toolkits_firstname'] = "INSERTFIRSTNAMEHERE";

include $xerte_toolkits_site->php_library_path . "database_library.php";
$_SESSION['toolkits_surname'] = "INSERTSURNAMEHERE";

include $xerte_toolkits_site->php_library_path . "user_library.php";
include $xerte_toolkits_site->php_library_path . "user_library.php";

$mysql_id=database_connect("index.php database connect success","index.php database connect fail");
$mysql_id=database_connect("index.php database connect success","index.php database connect fail");

$_SESSION['toolkits_logon_username'] = "INSERTUSERNAMEHERE";
$_SESSION['toolkits_logon_username'] = "INSERTUSERNAMEHERE";

/*
* Check to see if this is a users' first time on the site
*/
/*
* Check to see if this is a users' first time on the site
*/

if(check_if_first_time($_SESSION['toolkits_logon_username'])){
if(check_if_first_time($_SESSION['toolkits_logon_username'])){

/*
* create the user a new id
*/
/*
* create the user a new id
*/

$_SESSION['toolkits_logon_id'] = create_user_id();
$_SESSION['toolkits_logon_id'] = create_user_id();

/*
* create a virtual root folder for this user
*/
/*
* create a virtual root folder for this user
*/

create_a_virtual_root_folder();
create_a_virtual_root_folder();

}else{

/*
* User exists so update the user settings
*/
}else{

$_SESSION['toolkits_logon_id'] = get_user_id();
/*
* User exists so update the user settings
*/

update_user_logon_time();

}
$_SESSION['toolkits_logon_id'] = get_user_id();

recycle_bin();
update_user_logon_time();

/*
* 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";
recycle_bin();

echo "var site_url = \"" . $xerte_toolkits_site->site_url . "\";\n";
/*
* Output the main page, including the user's and blank templates
*/

echo "var site_apache = \"" . $xerte_toolkits_site->apache . "\";\n";
echo file_get_contents($xerte_toolkits_site->website_code_path . "management_headers");

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 "<script type=\"text/javascript\"> // JAVASCRIPT library for fixed variables\n // management of javascript is set up here\n // SITE SETTINGS\n";

echo logged_in_page_format_top(file_get_contents($xerte_toolkits_site->website_code_path . "management_top"));

list_users_projects("data_down");
echo "var site_url = \"" . $xerte_toolkits_site->site_url . "\";\n";

echo logged_in_page_format_middle(file_get_contents($xerte_toolkits_site->website_code_path . "management_middle"));
echo "var site_apache = \"" . $xerte_toolkits_site->apache . "\";\n";

list_blank_templates();
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 . "management_bottom");
echo logged_in_page_format_top(file_get_contents($xerte_toolkits_site->website_code_path . "management_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();

echo file_get_contents($xerte_toolkits_site->website_code_path . "management_bottom");

?>
</body>
Expand Down

0 comments on commit 9f15ef8

Please sign in to comment.