Exemplo n.º 1
0
 function selectEmailPrint($emailFields, $columns)
 {
     if ($emailFields) {
         print_fieldset("email", 'E-mail');
         echo "<div onkeydown=\"eventStop(event); return bodyKeydown(event, 'email');\">\n";
         echo "<p>" . 'From' . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
         echo 'Subject' . ": <select name='email_id'><option>" . optionlist(get_key_vals("SELECT {$this->id}, {$this->title} FROM {$this->table} ORDER BY {$this->title}"), $_POST["email_id"], true) . "</select>\n";
         echo "<p>" . 'Attachments' . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
         echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
         echo "<input type='submit' name='email' value='" . 'Send' . "' onclick=\"return this.form['delete'].onclick();\">\n";
         echo "</div>\n";
         echo "</div></fieldset>\n";
         return true;
     }
 }
Exemplo n.º 2
0
 function _translate($idf)
 {
     static $translations, $lang;
     if (!isset($lang)) {
         $lang = get_lang();
     }
     if ($idf == "" || $lang == "en") {
         return $idf;
     }
     if (!isset($translations)) {
         $translations = get_key_vals("SELECT idf, translation FROM translation WHERE language_id = " . q($lang));
     }
     $return =& $translations[$idf];
     if (!isset($return)) {
         $return = $idf;
         $connection = connection();
         $connection->query("INSERT INTO translation (language_id, idf, translation) VALUES (" . q($lang) . ", " . q($idf) . ", " . q($idf) . ")");
     }
     return $return;
 }
Exemplo n.º 3
0
/** Run query which can be killed by AJAX call after timing out
* @param string
* @return array of strings
*/
function slow_query($query)
{
    global $adminer, $token;
    $db = $adminer->database();
    $timeout = $adminer->queryTimeout();
    if (support("kill") && is_object($connection2 = connect()) && ($db == "" || $connection2->select_db($db))) {
        $kill = $connection2->result("SELECT CONNECTION_ID()");
        // MySQL and MySQLi can use thread_id but it's not in PDO_MySQL
        ?>
<script type="text/javascript">
var timeout = setTimeout(function () {
	ajax('<?php 
        echo js_escape(ME);
        ?>
script=kill', function () {
	}, 'token=<?php 
        echo $token;
        ?>
&kill=<?php 
        echo $kill;
        ?>
');
}, <?php 
        echo 1000 * $timeout;
        ?>
);
</script>
<?php 
    } else {
        $connection2 = null;
    }
    ob_flush();
    flush();
    $return = @get_key_vals($query, $connection2, $timeout);
    // @ - may be killed
    if ($connection2) {
        echo "<script type='text/javascript'>clearTimeout(timeout);</script>\n";
        ob_flush();
        flush();
    }
    return array_keys($return);
}
Exemplo n.º 4
0
        $row = $table_status;
        $row["name"] = $TABLE;
        $row["fields"] = array();
        if (!$_GET["auto_increment"]) {
            // don't prefill by original Auto_increment for the sake of performance and not reusing deleted ids
            $row["Auto_increment"] = "";
        }
        foreach ($orig_fields as $field) {
            $field["has_default"] = isset($field["default"]);
            $row["fields"][] = $field;
        }
        if (support("partitioning")) {
            $from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . q(DB) . " AND TABLE_NAME = " . q($TABLE);
            $result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION {$from} ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
            list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
            $partitions = get_key_vals("SELECT PARTITION_NAME, PARTITION_DESCRIPTION {$from} AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");
            $partitions[""] = "";
            $row["partition_names"] = array_keys($partitions);
            $row["partition_values"] = array_values($partitions);
        }
    }
}
$collations = collations();
$engines = engines();
// case of engine may differ
foreach ($engines as $engine) {
    if (!strcasecmp($engine, $row["Engine"])) {
        $row["Engine"] = $engine;
        break;
    }
}
Exemplo n.º 5
0
 /** Get status variables
  * @return array ($name => $value)
  */
 function show_status()
 {
     return get_key_vals("SHOW STATUS");
 }