Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 53 lines (49 sloc) 3.354 kb
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
1 <?php
79d19028 » jakubvrana
2009-08-29 Substitute table name to $TABLE
2 $EVENT = $_GET["event"];
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
3 $intervals = array("YEAR", "QUARTER", "MONTH", "DAY", "HOUR", "MINUTE", "WEEK", "SECOND", "YEAR_MONTH", "DAY_HOUR", "DAY_MINUTE", "DAY_SECOND", "HOUR_MINUTE", "HOUR_SECOND", "MINUTE_SECOND");
c463946e » jakubvrana
2008-09-02 Event status, comment and preserve
4 $statuses = array("ENABLED" => "ENABLE", "DISABLED" => "DISABLE", "SLAVESIDE_DISABLED" => "DISABLE ON SLAVE");
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
5
6 if ($_POST && !$error) {
7 if ($_POST["drop"]) {
79d19028 » jakubvrana
2009-08-29 Substitute table name to $TABLE
8 query_redirect("DROP EVENT " . idf_escape($EVENT), substr(ME, 0, -1), lang('Event has been dropped.'));
ced9de9d » jakubvrana
2009-07-02 Create single column foreign key in table structure
9 } elseif (in_array($_POST["INTERVAL_FIELD"], $intervals) && isset($statuses[$_POST["STATUS"]])) {
20679d8f » jakubvrana
2009-06-05 Use \n in SQL commands
10 $schedule = "\nON SCHEDULE " . ($_POST["INTERVAL_VALUE"]
64d616c0 » jakubvrana
2009-09-22 Rename get_dbh to connection
11 ? "EVERY " . $connection->quote($_POST["INTERVAL_VALUE"]) . " $_POST[INTERVAL_FIELD]"
12 . ($_POST["STARTS"] ? " STARTS " . $connection->quote($_POST["STARTS"]) : "")
13 . ($_POST["ENDS"] ? " ENDS " . $connection->quote($_POST["ENDS"]) : "") //! ALTER EVENT doesn't drop ENDS - MySQL bug #39173
14 : "AT " . $connection->quote($_POST["STARTS"])
c463946e » jakubvrana
2008-09-02 Event status, comment and preserve
15 ) . " ON COMPLETION" . ($_POST["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
16 ;
7352c281 » jakubvrana
2010-01-09 Replace strlen() by != ""
17 query_redirect(($EVENT != ""
79d19028 » jakubvrana
2009-08-29 Substitute table name to $TABLE
18 ? "ALTER EVENT " . idf_escape($EVENT) . $schedule
19 . ($EVENT != $_POST["EVENT_NAME"] ? "\nRENAME TO " . idf_escape($_POST["EVENT_NAME"]) : "")
c463946e » jakubvrana
2008-09-02 Event status, comment and preserve
20 : "CREATE EVENT " . idf_escape($_POST["EVENT_NAME"]) . $schedule
64d616c0 » jakubvrana
2009-09-22 Rename get_dbh to connection
21 ) . "\n" . $statuses[$_POST["STATUS"]] . " COMMENT " . $connection->quote($_POST["EVENT_COMMENT"])
36a36560 » jakubvrana
2009-06-22 Change escape_string to quote
22 . " DO\n$_POST[EVENT_DEFINITION]"
7352c281 » jakubvrana
2010-01-09 Replace strlen() by != ""
23 , substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')));
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
24 }
25 }
36d6864a » jakubvrana
2009-07-20 Whitespace
26
7352c281 » jakubvrana
2010-01-09 Replace strlen() by != ""
27 page_header(($EVENT != "" ? lang('Alter event') . ": " . h($EVENT) : lang('Create event')), $error);
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
28
29 $row = array();
30 if ($_POST) {
31 $row = $_POST;
7352c281 » jakubvrana
2010-01-09 Replace strlen() by != ""
32 } elseif ($EVENT != "") {
64d616c0 » jakubvrana
2009-09-22 Rename get_dbh to connection
33 $result = $connection->query("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . $connection->quote(DB) . " AND EVENT_NAME = " . $connection->quote($EVENT));
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
34 $row = $result->fetch_assoc();
35 }
36 ?>
37
38 <form action="" method="post">
d30facef » jakubvrana
2009-05-01 Remove useless table attributes (thanks to Juraj Krivda)
39 <table cellspacing="0">
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
40 <tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64">
41 <tr><th><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
42 <tr><th><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
06984091 » jakubvrana
2009-10-02 Utilize html_select
43 <tr><th><?php echo lang('Every'); ?><td><input name="INTERVAL_VALUE" value="<?php echo h($row["INTERVAL_VALUE"]); ?>" size="6"> <?php echo html_select("INTERVAL_FIELD", $intervals, $row["INTERVAL_FIELD"]); ?>
44 <tr><th><?php echo lang('Status'); ?><td><?php echo html_select("STATUS", $statuses, $row["STATUS"]); ?>
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
45 <tr><th><?php echo lang('Comment'); ?><td><input name="EVENT_COMMENT" value="<?php echo h($row["EVENT_COMMENT"]); ?>" maxlength="64">
6b30cfa7 » jakubvrana
2009-09-25 Separate checkbox
46 <tr><th>&nbsp;<td><?php echo checkbox("ON_COMPLETION", "PRESERVE", $row["ON_COMPLETION"] == "PRESERVE", lang('On completion preserve')); ?>
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
47 </table>
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
48 <p><textarea name="EVENT_DEFINITION" rows="10" cols="80" style="width: 98%;"><?php echo h($row["EVENT_DEFINITION"]); ?></textarea>
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
49 <p>
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
50 <input type="hidden" name="token" value="<?php echo $token; ?>">
51 <input type="submit" value="<?php echo lang('Save'); ?>">
7352c281 » jakubvrana
2010-01-09 Replace strlen() by != ""
52 <?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
53 </form>
Something went wrong with that request. Please try again.