segue-1.x /update.php

Language PHP Lines 154
MD5 Hash 873aebd3ec671a8a20279d989716e862 Estimated Cost $1,581 (why?)
Repository https://github.com/adamfranco/segue-1.x.git View Raw File View Project SPDX
  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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<? /* $Id$ */
include("objects/objects.inc.php");

/******************************************************************************
 * Updates and statuses
 * 
 * All updates should have functions:
 *		getName() 			@return string Name of the update.
 *		getDescription()	@return string Description of the update.
 *		test()				@return boolean True if in place
 *		run()				runs the update
 ******************************************************************************/
	$updates = array();
	require_once("updates/update_1.8.0.inc.php");
	require_once("updates/update_1.7.0.inc.php");
	require_once("updates/update_1.5.7.inc.php");
	require_once("updates/update_1.5.3.inc.php");
	require_once("updates/update_1.5.0.inc.php");
	require_once("updates/update_1.3.0.inc.php");
	require_once("updates/update_1.1.0.inc.php");
	require_once("updates/update_1.0.3.inc.php");
	
	$updates[] =& new Update180;
	$updates[] =& new Update170;
	$updates[] =& new Update157;
	$updates[] =& new Update153;
	$updates[] =& new Update150;
	$updates[] =& new Update130;
	$updates[] =& new Update110;
	$updates[] =& new Update103;
	
/******************************************************************************
 * End of update list
 ******************************************************************************/
	

$content = '';
$message = '';

ob_start();
session_start();


// include all necessary files
include("includes.inc.php");

if ($_SESSION['ltype'] != 'admin') {
	// take them right to the user lookup page
	header("Location: username_lookup.php");
	exit;
}

db_connect($dbhost, $dbuser, $dbpass, $dbdb);

/******************************************************************************
 * Run any requested updates
 ******************************************************************************/
if ($_REQUEST[action] == "update") {
	$updates[$_REQUEST[update]]->run();
}

printerr();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Segue Updates</title>
<? 
include("themes/common/logs_css.inc.php"); 
include("themes/common/header.inc.php");
?>
</head>
<!-- <body onload="document.addform.external_id.focus()"> -->
<body onload="document.searchform.name.focus()">

<?
/******************************************************************************
 * Get site id for links to participation section
 ******************************************************************************/
	
	$siteObj =& new site($site);
	$siteid = $siteObj->id;

if ($_SESSION['ltype']=='admin') {
	print "<table width='100%'  class='bg'><tr><td class='bg'>
	Logs: <a href='viewsites.php?$sid&amp;site=$site'>sites</a>
	 | <a href='viewlogs.php?$sid&amp;site=$site'>users</a>
	</td><td align='right' class='bg'>
	<a href='users.php?$sid&amp;site=$site'>add/edit users</a> | 
	<a href='classes.php?$sid&amp;site=$site'>add/edit classes</a> |  
	<a href='add_slot.php?$sid&amp;site=$site'>add/edit slots</a> | 
	 segue updates 
	</td></tr></table>";
}

if ($site) {
	print "<div align='right'>";
	print "<a href='add_students.php?$sid&amp;name=$site'>Roster</a>";
	print " | <a href='email.php?$sid&amp;siteid=$siteid&amp;site=$site&amp;action=list&amp;scope=site'>Participation</a>";
	print " | <a href='viewusers.php?$sid&amp;site=$site'>Logs</a>";
	print "</div><br />";
}

?>

<?=$content?>

<table cellspacing='1' width='100%' id='maintable'>
<tr><td>

<table width='90%' align='center'>
<?
// print out the updates
foreach ($updates as $key => $obj) {
	print "<tr><td colspan='2'><hr /></td></tr>\n";
	print "<tr>\n<td width='50%'>\n";
	print "<b>".$obj->getName()."</b>\n";
	print "<br />".$obj->getDescription();
	print "\n</td>\n<td width='50%' align='center' valign='middle'>\n";
	
	if ($obj->hasRun())
		print "<b>This update is in place</b>\n";
	else
		print "<a href='".$_SERVER[PHP_SELF]."?&amp;action=update&amp;update=".$key."'><b>Run this update</b></a>\n";
		
	print "</td>\n</tr>\n";
}

?>
</table>

</td></tr>
</table>

<br />
<div align='right'><input type='button' value='Close Window' onclick='window.close()' /></div>

<?
/* // debug output -- handy :) */
/* print "<pre>"; */
/* print "request:\n"; */
/* print_r($_REQUEST); */
/* print "\n\n"; */
/* print "session:\n"; */
/* print_r($_SESSION); */
/* print "\n\n"; */
/* print "</pre>"; */
?>

</body>
</html>
Back to Top