PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 1ms

/update.php

https://github.com/adamfranco/segue-1.x
PHP | 154 lines | 95 code | 29 blank | 30 comment | 7 complexity | 873aebd3ec671a8a20279d989716e862 MD5 | raw file
  1. <? /* $Id$ */
  2. include("objects/objects.inc.php");
  3. /******************************************************************************
  4. * Updates and statuses
  5. *
  6. * All updates should have functions:
  7. * getName() @return string Name of the update.
  8. * getDescription() @return string Description of the update.
  9. * test() @return boolean True if in place
  10. * run() runs the update
  11. ******************************************************************************/
  12. $updates = array();
  13. require_once("updates/update_1.8.0.inc.php");
  14. require_once("updates/update_1.7.0.inc.php");
  15. require_once("updates/update_1.5.7.inc.php");
  16. require_once("updates/update_1.5.3.inc.php");
  17. require_once("updates/update_1.5.0.inc.php");
  18. require_once("updates/update_1.3.0.inc.php");
  19. require_once("updates/update_1.1.0.inc.php");
  20. require_once("updates/update_1.0.3.inc.php");
  21. $updates[] =& new Update180;
  22. $updates[] =& new Update170;
  23. $updates[] =& new Update157;
  24. $updates[] =& new Update153;
  25. $updates[] =& new Update150;
  26. $updates[] =& new Update130;
  27. $updates[] =& new Update110;
  28. $updates[] =& new Update103;
  29. /******************************************************************************
  30. * End of update list
  31. ******************************************************************************/
  32. $content = '';
  33. $message = '';
  34. ob_start();
  35. session_start();
  36. // include all necessary files
  37. include("includes.inc.php");
  38. if ($_SESSION['ltype'] != 'admin') {
  39. // take them right to the user lookup page
  40. header("Location: username_lookup.php");
  41. exit;
  42. }
  43. db_connect($dbhost, $dbuser, $dbpass, $dbdb);
  44. /******************************************************************************
  45. * Run any requested updates
  46. ******************************************************************************/
  47. if ($_REQUEST[action] == "update") {
  48. $updates[$_REQUEST[update]]->run();
  49. }
  50. printerr();
  51. ?>
  52. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  53. <html>
  54. <head>
  55. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  56. <title>Segue Updates</title>
  57. <?
  58. include("themes/common/logs_css.inc.php");
  59. include("themes/common/header.inc.php");
  60. ?>
  61. </head>
  62. <!-- <body onload="document.addform.external_id.focus()"> -->
  63. <body onload="document.searchform.name.focus()">
  64. <?
  65. /******************************************************************************
  66. * Get site id for links to participation section
  67. ******************************************************************************/
  68. $siteObj =& new site($site);
  69. $siteid = $siteObj->id;
  70. if ($_SESSION['ltype']=='admin') {
  71. print "<table width='100%' class='bg'><tr><td class='bg'>
  72. Logs: <a href='viewsites.php?$sid&amp;site=$site'>sites</a>
  73. | <a href='viewlogs.php?$sid&amp;site=$site'>users</a>
  74. </td><td align='right' class='bg'>
  75. <a href='users.php?$sid&amp;site=$site'>add/edit users</a> |
  76. <a href='classes.php?$sid&amp;site=$site'>add/edit classes</a> |
  77. <a href='add_slot.php?$sid&amp;site=$site'>add/edit slots</a> |
  78. segue updates
  79. </td></tr></table>";
  80. }
  81. if ($site) {
  82. print "<div align='right'>";
  83. print "<a href='add_students.php?$sid&amp;name=$site'>Roster</a>";
  84. print " | <a href='email.php?$sid&amp;siteid=$siteid&amp;site=$site&amp;action=list&amp;scope=site'>Participation</a>";
  85. print " | <a href='viewusers.php?$sid&amp;site=$site'>Logs</a>";
  86. print "</div><br />";
  87. }
  88. ?>
  89. <?=$content?>
  90. <table cellspacing='1' width='100%' id='maintable'>
  91. <tr><td>
  92. <table width='90%' align='center'>
  93. <?
  94. // print out the updates
  95. foreach ($updates as $key => $obj) {
  96. print "<tr><td colspan='2'><hr /></td></tr>\n";
  97. print "<tr>\n<td width='50%'>\n";
  98. print "<b>".$obj->getName()."</b>\n";
  99. print "<br />".$obj->getDescription();
  100. print "\n</td>\n<td width='50%' align='center' valign='middle'>\n";
  101. if ($obj->hasRun())
  102. print "<b>This update is in place</b>\n";
  103. else
  104. print "<a href='".$_SERVER[PHP_SELF]."?&amp;action=update&amp;update=".$key."'><b>Run this update</b></a>\n";
  105. print "</td>\n</tr>\n";
  106. }
  107. ?>
  108. </table>
  109. </td></tr>
  110. </table>
  111. <br />
  112. <div align='right'><input type='button' value='Close Window' onclick='window.close()' /></div>
  113. <?
  114. /* // debug output -- handy :) */
  115. /* print "<pre>"; */
  116. /* print "request:\n"; */
  117. /* print_r($_REQUEST); */
  118. /* print "\n\n"; */
  119. /* print "session:\n"; */
  120. /* print_r($_SESSION); */
  121. /* print "\n\n"; */
  122. /* print "</pre>"; */
  123. ?>
  124. </body>
  125. </html>