Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 51 lines (47 sloc) 3.152 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"]
7e644b43 »
2010-10-13 Save bytes ($connection->quote shortcut)
11 ? "EVERY " . q($_POST["INTERVAL_VALUE"]) . " $_POST[INTERVAL_FIELD]"
12 . ($_POST["STARTS"] ? " STARTS " . q($_POST["STARTS"]) : "")
13 . ($_POST["ENDS"] ? " ENDS " . q($_POST["ENDS"]) : "") //! ALTER EVENT doesn't drop ENDS - MySQL bug #39173
14 : "AT " . q($_POST["STARTS"])
c463946e » jakubvrana
2008-09-02 Event status, comment and preserve
15 ) . " ON COMPLETION" . ($_POST["ON_COMPLETION"] ? "" : " NOT") . " PRESERVE"
16 ;
d06de551 »
2011-03-08 Use DELIMITER in history
17 queries_redirect(substr(ME, 0, -1), ($EVENT != "" ? lang('Event has been altered.') : lang('Event has been created.')), queries(($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
7e644b43 »
2010-10-13 Save bytes ($connection->quote shortcut)
21 ) . "\n" . $statuses[$_POST["STATUS"]] . " COMMENT " . q($_POST["EVENT_COMMENT"])
5e189f68 »
2011-03-10 Avoid ;;;
22 . rtrim(" DO\n$_POST[EVENT_DEFINITION]", ";") . ";"
d06de551 »
2011-03-08 Use DELIMITER in history
23 ));
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
b7e1cb09 »
2011-08-08 Save bytes
29 $row = $_POST;
30 if (!$row && $EVENT != "") {
7e644b43 »
2010-10-13 Save bytes ($connection->quote shortcut)
31 $rows = get_rows("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . q(DB) . " AND EVENT_NAME = " . q($EVENT));
b0d637b6 »
2010-10-13 Avoid fatal errors
32 $row = reset($rows);
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
33 }
34 ?>
35
36 <form action="" method="post">
d30facef » jakubvrana
2009-05-01 Remove useless table attributes (thanks to Juraj Krivda)
37 <table cellspacing="0">
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
38 <tr><th><?php echo lang('Name'); ?><td><input name="EVENT_NAME" value="<?php echo h($row["EVENT_NAME"]); ?>" maxlength="64">
39 <tr><th><?php echo lang('Start'); ?><td><input name="STARTS" value="<?php echo h("$row[EXECUTE_AT]$row[STARTS]"); ?>">
40 <tr><th><?php echo lang('End'); ?><td><input name="ENDS" value="<?php echo h($row["ENDS"]); ?>">
06984091 » jakubvrana
2009-10-02 Utilize html_select
41 <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"]); ?>
42 <tr><th><?php echo lang('Status'); ?><td><?php echo html_select("STATUS", $statuses, $row["STATUS"]); ?>
689699aa » jakubvrana
2009-07-28 Shortcut for htmlspecialchars
43 <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
44 <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)
45 </table>
6fffbbdd » jakubvrana
2010-04-26 Disable spell checking in SQL textareas
46 <p><?php textarea("EVENT_DEFINITION", $row["EVENT_DEFINITION"]); ?>
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
47 <p>
ace55ed1 » jakubvrana
2009-07-11 HTML instead of XHTML
48 <input type="submit" value="<?php echo lang('Save'); ?>">
a93bc191 »
2010-10-18 Create confirm function
49 <?php if ($EVENT != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo confirm(); ?>><?php } ?>
740ae10a »
2011-03-08 Don't send incomplete forms
50 <input type="hidden" name="token" value="<?php echo $token; ?>">
ff97ef97 » jakubvrana
2008-09-01 Events (MySQL 5.1)
51 </form>
Something went wrong with that request. Please try again.