예제 #1
0
파일: phpadmin.php 프로젝트: rohdoor/ehcp
                        }
                    }
                    if ($mysql->query("CREATE {$routine} " . idf_escape($_POST["name"]) . " (" . implode(", ", $set) . ")" . (isset($_GET["function"]) ? " RETURNS" . process_type($_POST["returns"], "CHARACTER SET") : "") . "\n\t\t\t{$_POST['definition']}")) {
                        redirect(substr($SELF, 0, -1), strlen($_GET["procedure"]) ? lang('Routine has been altered.') : lang('Routine has been created.'));
                    }
                }
                $error = $mysql->error;
            }
            page_header(strlen($_GET["procedure"]) ? (isset($_GET["function"]) ? lang('Alter function') : lang('Alter procedure')) . ": " . htmlspecialchars($_GET["procedure"]) : (isset($_GET["function"]) ? lang('Create function') : lang('Create procedure')), $error);
            $collations = get_vals("SHOW CHARACTER SET");
            if ($_POST) {
                $row = $_POST;
                $row["fields"] = (array) $row["fields"];
                process_fields($row["fields"]);
            } elseif (strlen($_GET["procedure"])) {
                $row = routine($_GET["procedure"], $routine);
                $row["name"] = $_GET["procedure"];
            } else {
                $row = array("fields" => array());
            }
            ?>

<form action="" method="post" id="form">
<table border="0" cellspacing="0" cellpadding="2">
<?php 
            edit_fields($row["fields"], $collations, $routine);
            if (isset($_GET["function"])) {
                ?>
<tr><td><?php 
                echo lang('Return type');
                ?>
예제 #2
0
<?php

$PROCEDURE = $_GET["procedure"];
$routine = isset($_GET["function"]) ? "FUNCTION" : "PROCEDURE";
$row = $_POST;
$row["fields"] = (array) $row["fields"];
if ($_POST && !process_fields($row["fields"]) && !$error) {
    $temp_name = "{$row['name']}_adminer_" . uniqid();
    drop_create("DROP {$routine} " . idf_escape($PROCEDURE), create_routine($routine, $row), "DROP {$routine} " . idf_escape($row["name"]), create_routine($routine, array("name" => $temp_name) + $row), "DROP {$routine} " . idf_escape($temp_name), substr(ME, 0, -1), lang('Routine has been dropped.'), lang('Routine has been altered.'), lang('Routine has been created.'), $PROCEDURE, $row["name"]);
}
page_header($PROCEDURE != "" ? (isset($_GET["function"]) ? lang('Alter function') : lang('Alter procedure')) . ": " . h($PROCEDURE) : (isset($_GET["function"]) ? lang('Create function') : lang('Create procedure')), $error);
if (!$_POST && $PROCEDURE != "") {
    $row = routine($PROCEDURE, $routine);
    $row["name"] = $PROCEDURE;
}
$collations = get_vals("SHOW CHARACTER SET");
sort($collations);
$routine_languages = routine_languages();
?>

<form action="" method="post" id="form">
<p><?php 
echo lang('Name');
?>
: <input name="name" value="<?php 
echo h($row["name"]);
?>
" maxlength="64" autocapitalize="off">
<?php 
echo $routine_languages ? lang('Language') . ": " . html_select("language", $routine_languages, $row["language"]) : "";
?>
예제 #3
0
<?php

$PROCEDURE = $_GET["call"];
page_header(lang('Call') . ": " . h($PROCEDURE), $error);
$routine = routine($PROCEDURE, isset($_GET["callf"]) ? "FUNCTION" : "PROCEDURE");
$in = array();
$out = array();
foreach ($routine["fields"] as $i => $field) {
    if (substr($field["inout"], -3) == "OUT") {
        $out[$i] = "@" . idf_escape($field["field"]) . " AS " . idf_escape($field["field"]);
    }
    if (!$field["inout"] || substr($field["inout"], 0, 2) == "IN") {
        $in[] = $i;
    }
}
if (!$error && $_POST) {
    $call = array();
    foreach ($routine["fields"] as $key => $field) {
        if (in_array($key, $in)) {
            $val = process_input($field);
            if ($val === false) {
                $val = "''";
            }
            if (isset($out[$key])) {
                $connection->query("SET @" . idf_escape($field["field"]) . " = {$val}");
            }
        }
        $call[] = isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val;
    }
    $query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")";
    echo "<p><code class='jush-{$jush}'>" . h($query) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n";
예제 #4
0
        while ($row = $comps->fetch_array()) {
            /* read the companies configuration */
            print "Company Read: {$row['code']}\n";
            db_con("cubit_{$row['code']}");
            $cfg = getTrhConfig();
            /* not enabled */
            if ($cfg["MANAGEUSER"] <= 0 || empty($cfg["POP3_SERVER"]) || empty($cfg["SMTP_SERVER"])) {
                continue;
            }
            $companies[$row["code"]] = $cfg;
        }
        $comps->free();
    }
    /* run the routines */
    foreach ($companies as $code => $conf) {
        routine($code, $conf);
        if ($smallest_wait < 0 || $smallest_wait > $conf["INTERVAL"]) {
            $smallest_wait = $conf["INTERVAL"];
        }
    }
    if ($smallest_wait < 0) {
        print "\nSleeping for dflt 60\n";
        sleep(60);
    } else {
        print "\nSleeping for {$smallest_wait}\n";
        sleep($smallest_wait);
    }
}
/**
 * routine runner
 *