当前位置: 首页>>代码示例>>PHP>>正文


PHP idf_escape函数代码示例

本文整理汇总了PHP中idf_escape函数的典型用法代码示例。如果您正苦于以下问题:PHP idf_escape函数的具体用法?PHP idf_escape怎么用?PHP idf_escape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了idf_escape函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dumpTable

 function dumpTable($table, $style, $is_view = false)
 {
     if ($_POST["format"] == "sql_alter") {
         $create = create_sql($table, $_POST["auto_increment"]);
         if ($is_view) {
             echo substr_replace($create, " OR REPLACE", 6, 0) . ";\n\n";
         } else {
             echo substr_replace($create, " IF NOT EXISTS", 12, 0) . ";\n\n";
             // create procedure which iterates over original columns and adds new and removes old
             $query = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = " . q($table) . " ORDER BY ORDINAL_POSITION";
             echo "DELIMITER ;;\nCREATE PROCEDURE adminer_alter (INOUT alter_command text) BEGIN\n\tDECLARE _column_name, _collation_name, after varchar(64) DEFAULT '';\n\tDECLARE _column_type, _column_default text;\n\tDECLARE _is_nullable char(3);\n\tDECLARE _extra varchar(30);\n\tDECLARE _column_comment varchar(255);\n\tDECLARE done, set_after bool DEFAULT 0;\n\tDECLARE add_columns text DEFAULT '";
             $fields = array();
             $after = "";
             foreach (get_rows($query) as $row) {
                 $default = $row["COLUMN_DEFAULT"];
                 $row["default"] = $default !== null ? q($default) : "NULL";
                 $row["after"] = q($after);
                 //! rgt AFTER lft, lft AFTER id doesn't work
                 $row["alter"] = escape_string(idf_escape($row["COLUMN_NAME"]) . " {$row['COLUMN_TYPE']}" . ($row["COLLATION_NAME"] ? " COLLATE {$row['COLLATION_NAME']}" : "") . ($default !== null ? " DEFAULT " . ($default == "CURRENT_TIMESTAMP" ? $default : $row["default"]) : "") . ($row["IS_NULLABLE"] == "YES" ? "" : " NOT NULL") . ($row["EXTRA"] ? " {$row['EXTRA']}" : "") . ($row["COLUMN_COMMENT"] ? " COMMENT " . q($row["COLUMN_COMMENT"]) : "") . ($after ? " AFTER " . idf_escape($after) : " FIRST"));
                 echo ", ADD {$row['alter']}";
                 $fields[] = $row;
                 $after = $row["COLUMN_NAME"];
             }
             echo "';\n\tDECLARE columns CURSOR FOR {$query};\n\tDECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;\n\tSET @alter_table = '';\n\tOPEN columns;\n\tREPEAT\n\t\tFETCH columns INTO _column_name, _column_default, _is_nullable, _collation_name, _column_type, _extra, _column_comment;\n\t\tIF NOT done THEN\n\t\t\tSET set_after = 1;\n\t\t\tCASE _column_name";
             foreach ($fields as $row) {
                 echo "\n\t\t\t\tWHEN " . q($row["COLUMN_NAME"]) . " THEN\n\t\t\t\t\tSET add_columns = REPLACE(add_columns, ', ADD {$row['alter']}', IF(\n\t\t\t\t\t\t_column_default <=> {$row['default']} AND _is_nullable = '{$row['IS_NULLABLE']}' AND _collation_name <=> " . (isset($row["COLLATION_NAME"]) ? "'{$row['COLLATION_NAME']}'" : "NULL") . " AND _column_type = " . q($row["COLUMN_TYPE"]) . " AND _extra = '{$row['EXTRA']}' AND _column_comment = " . q($row["COLUMN_COMMENT"]) . " AND after = {$row['after']}\n\t\t\t\t\t, '', ', MODIFY {$row['alter']}'));";
                 //! don't replace in comment
             }
             echo "\n\t\t\t\tELSE\n\t\t\t\t\tSET @alter_table = CONCAT(@alter_table, ', DROP ', '`', REPLACE(_column_name, '`', '``'), '`');\n\t\t\t\t\tSET set_after = 0;\n\t\t\tEND CASE;\n\t\t\tIF set_after THEN\n\t\t\t\tSET after = _column_name;\n\t\t\tEND IF;\n\t\tEND IF;\n\tUNTIL done END REPEAT;\n\tCLOSE columns;\n\tIF @alter_table != '' OR add_columns != '' THEN\n\t\tSET alter_command = CONCAT(alter_command, 'ALTER TABLE " . adminer_table($table) . "', SUBSTR(CONCAT(add_columns, @alter_table), 2), ';\\n');\n\tEND IF;\nEND;;\nDELIMITER ;\nCALL adminer_alter(@adminer_alter);\nDROP PROCEDURE adminer_alter;\n\n";
             //! indexes
         }
         return true;
     }
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:34,代码来源:dump-alter.php

示例2: editInput

 function editInput($table, $field, $attrs, $value)
 {
     static $foreignTables = array();
     static $values = array();
     $foreignKeys =& $foreignTables[$table];
     if ($foreignKeys === null) {
         $foreignKeys = column_foreign_keys($table);
     }
     foreach ((array) $foreignKeys[$field["field"]] as $foreignKey) {
         if (count($foreignKey["source"]) == 1) {
             $target = $foreignKey["table"];
             $id = $foreignKey["target"][0];
             $options =& $values[$target][$id];
             if (!$options) {
                 $options = array("" => "") + get_vals("SELECT " . idf_escape($id) . " FROM " . table($target) . " ORDER BY 1");
             }
             return "<select{$attrs}>" . optionlist($options, $value) . "</select>";
         }
     }
 }
开发者ID:acepsaepudin,项目名称:adminer,代码行数:20,代码来源:edit-foreign.php

示例3: substr

<?php

$TYPE = $_GET["type"];
if ($_POST && !$error) {
    $link = substr(ME, 0, -1);
    if ($_POST["drop"]) {
        query_redirect("DROP TYPE " . idf_escape($TYPE), $link, lang('Type has been dropped.'));
    } else {
        query_redirect("CREATE TYPE " . idf_escape($_POST["name"]) . " {$_POST['as']}", $link, lang('Type has been created.'));
    }
}
page_header($TYPE != "" ? lang('Alter type') . ": " . h($TYPE) : lang('Create type'), $error);
$row = $_POST;
if (!$row) {
    $row = array("as" => "AS ");
}
?>

<form action="" method="post">
<p>
<?php 
if ($TYPE != "") {
    echo "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n";
} else {
    echo "<input name='name' value='" . h($row['name']) . "'>\n";
    textarea("as", $row["as"]);
    echo "<p><input type='submit' value='" . lang('Save') . "'>\n";
}
?>
<input type="hidden" name="token" value="<?php 
echo $token;
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:31,代码来源:type.inc.php

示例4: page_header

            $connection->query("DROP USER {$new_user}");
        }
    }
}
page_header(isset($_GET["host"]) ? lang('Username') . ": " . h("{$USER}@{$_GET['host']}") : lang('Create user'), $error, array("privileges" => array('', lang('Privileges'))));
if ($_POST) {
    $row = $_POST;
    $grants = $new_grants;
} else {
    $row = $_GET + array("host" => $connection->result("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', -1)"));
    // create user on the same domain by default
    $row["pass"] = $old_pass;
    if ($old_pass != "") {
        $row["hashed"] = true;
    }
    $grants[DB != "" && !isset($_GET["host"]) ? idf_escape(addcslashes(DB, "%_")) . ".*" : ""] = array();
}
?>
<form action="" method="post">
<table cellspacing="0">
<tr><th><?php 
echo lang('Server');
?>
<td><input name="host" maxlength="60" value="<?php 
echo h($row["host"]);
?>
">
<tr><th><?php 
echo lang('Username');
?>
<td><input name="user" maxlength="16" value="<?php 
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:31,代码来源:user.inc.php

示例5: queries_adminer_redirect

                if (count($databases) == 1 || $db != "") {
                    // ignore empty lines but always try to create single database
                    if (!create_database($db, $row["collation"])) {
                        $success = false;
                    }
                    $last = $db;
                }
            }
            queries_adminer_redirect(ME . "db=" . urlencode($last), lang('Database has been created.'), $success);
        }
    } else {
        // alter database
        if (!$row["collation"]) {
            adminer_redirect(substr(ME, 0, -1));
        }
        query_adminer_redirect("ALTER DATABASE " . idf_escape($name) . (preg_match('~^[a-z0-9_]+$~i', $row["collation"]) ? " COLLATE {$row['collation']}" : ""), substr(ME, 0, -1), lang('Database has been altered.'));
    }
}
page_header(DB != "" ? lang('Alter database') : lang('Create database'), $error, array(), h(DB));
$collations = collations();
$name = DB;
if ($_POST) {
    $name = $row["name"];
} elseif (DB != "") {
    $row["collation"] = db_collation(DB, $collations);
} elseif ($jush == "sql") {
    // propose database name with limited privileges
    foreach (get_vals("SHOW GRANTS") as $grant) {
        if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~', $grant, $match) && $match[1]) {
            $name = stripcslashes(idf_unescape("`{$match['2']}`"));
            break;
开发者ID:umairriaz90,项目名称:Daschug1,代码行数:31,代码来源:database.inc.php

示例6: editingKeydown

 $backward_keys = $adminer->backwardKeys($TABLE, $table_name);
 echo "<table id='table' cellspacing='0' class='nowrap checkable' onclick='tableClick(event);' onkeydown='return editingKeydown(event);'>\n";
 echo "<thead><tr>" . (!$group && $select ? "" : "<td><input type='checkbox' id='all-page' onclick='formCheck(this, /check/);'> <a href='" . h($_GET["modify"] ? remove_from_uri("modify") : $_SERVER["REQUEST_URI"] . "&modify=1") . "'>" . lang('edit') . "</a>");
 $names = array();
 $functions = array();
 reset($select);
 $rank = 1;
 foreach ($rows[0] as $key => $val) {
     if ($key != $oid) {
         $val = $_GET["columns"][key($select)];
         $field = $fields[$select ? $val ? $val["col"] : current($select) : $key];
         $name = $field ? $adminer->fieldName($field, $rank) : "*";
         if ($name != "") {
             $rank++;
             $names[$key] = $name;
             $column = idf_escape($key);
             $href = remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key);
             $desc = "&desc%5B0%5D=1";
             echo '<th onmouseover="columnMouse(this);" onmouseout="columnMouse(this, \' hidden\');">';
             echo '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || !$order && $is_group && $group[0] == $column ? $desc : '')) . '">';
             // $order[0] == $key - COUNT(*)
             echo (!$select || $val ? apply_sql_function($val["fun"], $name) : h(current($select))) . "</a>";
             //! columns looking like functions
             echo "<span class='column hidden'>";
             echo "<a href='" . h($href . $desc) . "' title='" . lang('descending') . "' class='text'> ↓</a>";
             if (!$val["fun"]) {
                 echo '<a href="#fieldset-search" onclick="selectSearch(\'' . h(js_escape($key)) . '\'); return false;" title="' . lang('Search') . '" class="text jsonly"> =</a>';
             }
             echo "</span>";
         }
         $functions[$key] = $val["fun"];
开发者ID:olien,项目名称:mysql_tools,代码行数:31,代码来源:select.inc.php

示例7: array

$row = $_POST;
if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"]) {
    $alter = array();
    foreach ($row["indexes"] as $index) {
        $name = $index["name"];
        if (in_array($index["type"], $index_types)) {
            $columns = array();
            $lengths = array();
            $descs = array();
            $set = array();
            ksort($index["columns"]);
            foreach ($index["columns"] as $key => $column) {
                if ($column != "") {
                    $length = $index["lengths"][$key];
                    $desc = $index["descs"][$key];
                    $set[] = idf_escape($column) . ($length ? "(" . +$length . ")" : "") . ($desc ? " DESC" : "");
                    $columns[] = $column;
                    $lengths[] = $length ? $length : null;
                    $descs[] = $desc;
                }
            }
            if ($columns) {
                $existing = $indexes[$name];
                if ($existing) {
                    ksort($existing["columns"]);
                    ksort($existing["lengths"]);
                    ksort($existing["descs"]);
                    if ($index["type"] == $existing["type"] && array_values($existing["columns"]) === $columns && (!$existing["lengths"] || array_values($existing["lengths"]) === $lengths) && array_values($existing["descs"]) === $descs) {
                        // skip existing index
                        unset($indexes[$name]);
                        continue;
开发者ID:unix4you2,项目名称:pmydb,代码行数:31,代码来源:indexes.inc.php

示例8: process_input

/** Process edit input field
* @param one field from fields()
* @return string or false to leave the original value
*/
function process_input($field)
{
    global $adminer;
    $idf = bracket_escape($field["field"]);
    $function = $_POST["function"][$idf];
    $value = $_POST["fields"][$idf];
    if ($field["type"] == "enum") {
        if ($value == -1) {
            return false;
        }
        if ($value == "") {
            return "NULL";
        }
        return +$value;
    }
    if ($field["auto_increment"] && $value == "") {
        return null;
    }
    if ($function == "orig") {
        return $field["on_update"] == "CURRENT_TIMESTAMP" ? idf_escape($field["field"]) : false;
    }
    if ($function == "NULL") {
        return "NULL";
    }
    if ($field["type"] == "set") {
        return array_sum((array) $value);
    }
    if ($function == "json") {
        $function = "";
        $value = json_decode($value, true);
        if (!is_array($value)) {
            return false;
            //! report errors
        }
        return $value;
    }
    if (preg_match('~blob|bytea|raw|file~', $field["type"]) && ini_bool("file_uploads")) {
        $file = get_file("fields-{$idf}");
        if (!is_string($file)) {
            return false;
            //! report errors
        }
        return q($file);
    }
    return $adminer->processInput($field, $value, $function);
}
开发者ID:K0n24d,项目名称:adminer,代码行数:50,代码来源:functions.inc.php

示例9: fields

<?php

$TABLE = $_GET["download"];
$fields = fields($TABLE);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . friendly_url("{$TABLE}-" . implode("_", $_GET["where"])) . "." . friendly_url($_GET["field"]));
$select = array(idf_escape($_GET["field"]));
$result = $driver->select($TABLE, $select, array(where($_GET, $fields)), $select);
$row = $result ? $result->fetch_row() : array();
echo $row[0];
exit;
// don't output footer
开发者ID:yxw2014,项目名称:adminer,代码行数:12,代码来源:download.inc.php

示例10: login

 function login($login, $password)
 {
     $connection = connection();
     return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . q($login) . " AND password_sha1 = " . q(sha1($password)));
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:5,代码来源:login-table.php

示例11: preg_replace

<?php

$row = $_POST;
if ($_POST && !$error) {
    $link = preg_replace('~ns=[^&]*&~', '', ME) . "ns=";
    if ($_POST["drop"]) {
        query_adminer_redirect("DROP SCHEMA " . idf_escape($_GET["ns"]), $link, lang('Schema has been dropped.'));
    } else {
        $name = trim($row["name"]);
        $link .= urlencode($name);
        if ($_GET["ns"] == "") {
            query_adminer_redirect("CREATE SCHEMA " . idf_escape($name), $link, lang('Schema has been created.'));
        } elseif ($_GET["ns"] != $name) {
            query_adminer_redirect("ALTER SCHEMA " . idf_escape($_GET["ns"]) . " RENAME TO " . idf_escape($name), $link, lang('Schema has been altered.'));
            //! sp_rename in MS SQL
        } else {
            adminer_redirect($link);
        }
    }
}
page_header($_GET["ns"] != "" ? lang('Alter schema') : lang('Create schema'), $error);
if (!$row) {
    $row["name"] = $_GET["ns"];
}
?>

<form action="" method="post">
<p><input name="name" id="name" value="<?php 
echo h($row["name"]);
?>
" autocapitalize="off">
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:31,代码来源:scheme.inc.php

示例12: trigger_options

<?php

$TABLE = $_GET["trigger"];
$name = $_GET["name"];
$trigger_options = trigger_options();
$row = (array) trigger($name) + array("Trigger" => $TABLE . "_bi");
if ($_POST) {
    if (!$error && in_array($_POST["Timing"], $trigger_options["Timing"]) && in_array($_POST["Event"], $trigger_options["Event"]) && in_array($_POST["Type"], $trigger_options["Type"])) {
        // don't use drop_create() because there may not be more triggers for the same action
        $on = " ON " . table($TABLE);
        $drop = "DROP TRIGGER " . idf_escape($name) . ($jush == "pgsql" ? $on : "");
        $location = ME . "table=" . urlencode($TABLE);
        if ($_POST["drop"]) {
            query_adminer_redirect($drop, $location, lang('Trigger has been dropped.'));
        } else {
            if ($name != "") {
                queries($drop);
            }
            queries_adminer_redirect($location, $name != "" ? lang('Trigger has been altered.') : lang('Trigger has been created.'), queries(create_trigger($on, $_POST)));
            if ($name != "") {
                queries(create_trigger($on, $row + array("Type" => reset($trigger_options["Type"]))));
            }
        }
    }
    $row = $_POST;
}
page_header($name != "" ? lang('Alter trigger') . ": " . h($name) : lang('Create trigger'), $error, array("table" => $TABLE));
?>

<form action="" method="post" id="form">
<table cellspacing="0">
开发者ID:umairriaz90,项目名称:Daschug1,代码行数:31,代码来源:trigger.inc.php

示例13: array

}
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";
    if (!$connection->multi_query($query)) {
        echo "<p class='error'>" . error() . "\n";
    } else {
        $connection2 = connect();
        if (is_object($connection2)) {
            $connection2->select_db(DB);
        }
        do {
            $result = $connection->store_result();
            if (is_object($result)) {
                select($result, $connection2);
            } else {
                echo "<p class='message success'>" . lang('Routine has been called, %d row(s) affected.', $connection->affected_rows) . "\n";
            }
开发者ID:acepsaepudin,项目名称:adminer,代码行数:31,代码来源:call.inc.php

示例14: queries_redirect

                if (count($databases) == 1 || $db != "") {
                    // ignore empty lines but always try to create single database
                    if (!create_database($db, $_POST["collation"])) {
                        $success = false;
                    }
                    $last = $db;
                }
            }
            queries_redirect(ME . "db=" . urlencode($last), lang('Database has been created.'), $success);
        }
    } else {
        // alter database
        if (!$_POST["collation"]) {
            redirect(substr(ME, 0, -1));
        }
        query_redirect("ALTER DATABASE " . idf_escape($name) . (eregi('^[a-z0-9_]+$', $_POST["collation"]) ? " COLLATE {$_POST['collation']}" : ""), substr(ME, 0, -1), lang('Database has been altered.'));
    }
}
page_header(DB != "" ? lang('Alter database') : lang('Create database'), $error, array(), DB);
$collations = collations();
$name = DB;
$collate = null;
if ($_POST) {
    $name = $_POST["name"];
    $collate = $_POST["collation"];
} elseif (DB != "") {
    $collate = db_collation(DB, $collations);
} elseif ($jush == "sql") {
    // propose database name with limited privileges
    foreach (get_vals("SHOW GRANTS") as $grant) {
        if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~', $grant, $match) && $match[1]) {
开发者ID:acepsaepudin,项目名称:adminer,代码行数:31,代码来源:database.inc.php

示例15: foreach

 }
 foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) {
     $unique_array = unique_array($rows[$n], $indexes);
     if (!$unique_array) {
         $unique_array = array();
         foreach ($rows[$n] as $key => $val) {
             if (!preg_match('~^(COUNT\\((\\*|(DISTINCT )?`(?:[^`]|``)+`)\\)|(AVG|GROUP_CONCAT|MAX|MIN|SUM)\\(`(?:[^`]|``)+`\\))$~', $key)) {
                 //! columns looking like functions
                 $unique_array[$key] = $val;
             }
         }
     }
     $unique_idf = "";
     foreach ($unique_array as $key => $val) {
         if (($jush == "sql" || $jush == "pgsql") && strlen($val) > 64) {
             $key = strpos($key, '(') ? $key : idf_escape($key);
             //! columns looking like functions
             $key = "MD5(" . ($jush == 'sql' && preg_match("~^utf8_~", $fields[$key]["collation"]) ? $key : "CONVERT({$key} USING " . charset($connection) . ")") . ")";
             $val = md5($val);
         }
         $unique_idf .= "&" . ($val !== null ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key));
     }
     echo "<tr" . odd() . ">" . (!$group && $select ? "" : "<td>" . adminer_checkbox("check[]", substr($unique_idf, 1), in_array(substr($unique_idf, 1), (array) $_POST["check"]), "", "this.form['all'].checked = false; formUncheck('all-page');") . ($is_group || information_schema(DB) ? "" : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . $unique_idf) . "'>" . lang('edit') . "</a>"));
     foreach ($row as $key => $val) {
         if (isset($names[$key])) {
             $field = $fields[$key];
             if ($val != "" && (!isset($email_fields[$key]) || $email_fields[$key] != "")) {
                 $email_fields[$key] = is_adminer_mail($val) ? $names[$key] : "";
                 //! filled e-mails can be contained on other pages
             }
             $link = "";
开发者ID:gigikiri,项目名称:WordPress,代码行数:31,代码来源:select.inc.php


注:本文中的idf_escape函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。