<?php require_once './webroot.conf.php'; $page = process_script(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Sean Watson | CS3336 HW4</title> <link rel="stylesheet" href="./css/hw4.css" type="text/css" media="screen" /> </head> <body> <div id="mainBody"> <?php echo $page; ?> </div> </body> </html>
$sth->free(); } else { $db_version = -1; //off by one error... present state is not yet to revision 0. } if ($db_version == CODE_VERSION) { print "Database is already up to date! Exiting."; exit; } if ($db_version > CODE_VERSION) { print "<font color='red'>Big time trouble!</font> - Your database may be more advanced (newer) than this code. Are you using the right \n code and database? <br>Database version: " . $db_version . "<br>Code version: " . CODE_VERSION . "<br>Exiting."; exit; } //loop from current database version to current code database version, // doing pre_check_x, upgrade_x, and post_check_x $dbh->autoCommit(false); for ($version = $db_version + 1; $version <= CODE_VERSION; $version++) { //start with next revision number. load_script($version); $result = process_script($version); if ($result == ERROR) { print "<h1>Aborting upgrade, due to fatal errors.</h1>\n"; print "Please consult the <a href=\"mailto:maia-users@renaissoft.com\">Maia Users</a> Mailing list for help\n"; $dbh->rollback(); exit; } else { update_schema_info($version); print "<li>" . ($result == WARN ? "skipped" : "executed") . " script: " . $version . "</li>"; } } $dbh->commit();
function html2xhtml($html) { process_pagebreak_commands($html); // Remove SCRIPT tags from the page being processed, as script content may // mess the firther html-parsing utilities $html = process_script($html); // Remove STYLE tags for the same reason and store them in the temporary variable // later they will be added back to HEAD section $styles = process_style($html); // Convert HTML character references to their Unicode analogues process_character_references($html); remove_comments($html); fix_attrs_spaces($html); $html = quote_attrs($html); $html = escape_attrs_entities($html); $html = lowercase_tags($html); $html = lowercase_closing_tags($html); $html = fix_closing_tags($html); $html = close_tag("area", $html); $html = close_tag("base", $html); $html = close_tag("basefont", $html); $html = close_tag("br", $html); $html = close_tag("col", $html); $html = close_tag("embed", $html); $html = close_tag("frame", $html); $html = close_tag("hr", $html); $html = close_tag("img", $html); $html = close_tag("input", $html); $html = close_tag("isindex", $html); $html = close_tag("link", $html); $html = close_tag("meta", $html); $html = close_tag("param", $html); $html = make_attr_value("checked", $html); $html = make_attr_value("compact", $html); $html = make_attr_value("declare", $html); $html = make_attr_value("defer", $html); $html = make_attr_value("disabled", $html); $html = make_attr_value("ismap", $html); $html = make_attr_value("multiple", $html); $html = make_attr_value("nohref", $html); $html = make_attr_value("noresize", $html); $html = make_attr_value("noshade", $html); $html = make_attr_value("nowrap", $html); $html = make_attr_value("readonly", $html); $html = make_attr_value("selected", $html); $html = process_html($html); $html = process_body($html); $html = process_head($html); $html = process_p($html); $html = escape_amp($html); $html = escape_lt($html); $html = escape_gt($html); $html = escape_textarea_content($html); process_tables($html, 0); process_lists($html, 0); process_deflists($html, 0); process_selects($html, 0); $html = fix_tags($html); $html = fix_attrs($html); $html = insert_styles($html, $styles); return $html; }
//sub in argument $_REQUEST['code'] = str_replace("\r\n", "\n", $_REQUEST['code']); //get shebang line $_REQUEST['code'] = explode("\n", $_REQUEST['code']); $shebang = substr($_REQUEST['code'][0], 2, strlen($_REQUEST['code'][0]) - 2); unset($_REQUEST['code'][0]); if (substr($_REQUEST['code'][1], 0, 2) == '#!') { $mime = substr($_REQUEST['code'][1], 2, strlen($_REQUEST['code'][1]) - 2); unset($_REQUEST['code'][1]); } //end if mime-type line $_REQUEST['code'] = implode("\n", $_REQUEST['code']); $shebang = explode('|', $shebang); $innercode = $_REQUEST['code']; foreach ($shebang as $line) { $innercode = process_script($line, $innercode); } //end foreach shebang if ($mime) { header('Content-type: ' . $mime); } echo $innercode; exit; } //end if code ?> <h2>YubScript</h2> <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>