"; //
for easy styling
echo "";
echo "
\n";
}
function selectLengthPrint($text_length) {
}
function selectActionPrint() {
echo "
\n";
}
function selectEmailPrint($emailFields) {
global $confirm;
if ($emailFields) {
echo '
\n";
}
}
function selectColumnsProcess($columns, $indexes) {
return array(array(), array());
}
function selectSearchProcess($indexes, $fields) {
$return = array();
foreach ((array) $_GET["where"] as $val) {
if (strlen("$val[col]$val[val]")) {
$value = $this->processInput($fields[$val["col"]], $val["val"]);
$cond = ($value == "NULL" ? " IS" : ($val["op"] == "=" ? " =" : " LIKE")) . " $value";
if (strlen($val["col"])) {
$return[] = idf_escape($val["col"]) . $cond;
} else {
// find anywhere
$cols = array();
foreach ($fields as $name => $field) {
if (is_numeric($val["val"]) || !ereg('int|float|double|decimal', $field["type"])) {
$cols[] = $name;
}
}
$return[] = ($cols ? "(" . implode("$cond OR ", array_map('idf_escape', $cols)) . "$cond)" : "0");
}
}
}
return $return;
}
function selectOrderProcess($columns, $select, $indexes) {
if ($_GET["order"]) {
return array(idf_escape($_GET["order"][0]) . (isset($_GET["desc"][0]) ? " DESC" : ""));
}
if ($_GET["index_order"]) {
return $indexes[$_GET["index_order"]]["columns"];
}
unset($indexes["PRIMARY"]);
$index = reset($indexes);
return ($index ? $index["columns"] : array());
}
function selectLimitProcess() {
return (isset($_GET["limit"]) ? $_GET["limit"] : "30");
}
function selectLengthProcess() {
return "100";
}
function selectEmailProcess($where) {
global $dbh;
if ($_POST["email"]) {
$sent = 0;
if ($_POST["all"] || $_POST["check"]) {
$field = idf_escape($_POST["email_field"]);
$result = $dbh->query("SELECT DISTINCT $field FROM " . idf_escape($_GET["select"])
. " WHERE $field IS NOT NULL AND $field != ''"
. ($where ? " AND " . implode(" AND ", $where) : "")
. ($_POST["all"] ? "" : " AND ((" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . "))")
);
while ($row = $result->fetch_row()) {
if (is_email($row[0]) && mail($row[0], email_header($_POST["email_subject"]), $_POST["email_message"],
"MIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit"
. (is_email($_POST["email_from"]) ? "\nFrom: $_POST[email_from]" : "") //! should allow address with a name but simple application of email_header() adds the default server domain
)) {
$sent++;
}
}
$result->free();
}
redirect(remove_from_uri(), lang('%d e-mail(s) have been sent.', $sent));
}
return false;
}
function messageQuery($query) {
return "";
}
function editFunctions($field) {
return (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + array("");
}
function editInput($table, $field, $attrs, $value) {
global $dbh;
$foreign_keys = column_foreign_keys($table);
foreach ((array) $foreign_keys[$field["field"]] as $foreign_key) {
if (count($foreign_key["source"]) == 1) {
$id = idf_escape($foreign_key["target"][0]);
$name = $this->rowDescription($foreign_key["table"]);
if (strlen($name) && $dbh->result($dbh->query("SELECT COUNT(*) FROM " . idf_escape($foreign_key["table"]))) <= 1000) { // optionlist with more than 1000 options would be too big
$return = array();
$result = $dbh->query("SELECT $id, $name FROM " . idf_escape($foreign_key["table"]) . " ORDER BY 2");
if ($field["null"] || !$result->num_rows) { // empty