diff --git a/CREDITS b/CREDITS index dd3a0c9eb..4642b120e 100644 --- a/CREDITS +++ b/CREDITS @@ -18,6 +18,7 @@ CREDITS, in chronological order [lc] - Loïc Chapeaux [mg] - Mirko Giese [rj] - Robin Johnson +[af] - Armel Fauveau [xx] - ... (to be completed) diff --git a/config.inc.php3 b/config.inc.php3 index 1b5ee64b3..62909b669 100755 --- a/config.inc.php3 +++ b/config.inc.php3 @@ -6,17 +6,32 @@ * All directives are explained in Documentation.html */ +/* + * Bookmark Table Structure + * + * CREATE TABLE bookmark ( + * id int(11) DEFAULT '0' NOT NULL auto_increment, + * dbase varchar(255) NOT NULL, + * label varchar(255) NOT NULL, + * query text NOT NULL, + * PRIMARY KEY (id) + * ); + * + */ + // The $cfgServers array starts with $cfgServers[1]. Do not use $cfgServers[0]. // You can disable a server config entry by setting host to ''. $cfgServers[1]['host'] = 'localhost'; // MySQL hostname $cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port $cfgServers[1]['adv_auth'] = false; // Use advanced authentication? -$cfgServers[1]['stduser'] = ''; // MySQL standard user (only needed with advanced auth) +$cfgServers[1]['stduser'] = ''; // MySQL standard user (only needed with advanced auth) $cfgServers[1]['stdpass'] = ''; // MySQL standard password (only needed with advanced auth) -$cfgServers[1]['user'] = 'phpMyAdmin'; // MySQL user (only needed with basic auth) -$cfgServers[1]['password'] = 'test99'; // MySQL password (only needed with basic auth) -$cfgServers[1]['only_db'] = 'phpMyAdmin'; // If set to a db-name, only this db is accessible +$cfgServers[1]['user'] = 'phpMyAdmin'; // MySQL user (only needed with basic auth) +$cfgServers[1]['password'] = 'test99'; // MySQL password (only needed with basic auth) +$cfgServers[1]['only_db'] = 'phpMyAdmin'; // If set to a db-name, only this db is accessible $cfgServers[1]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname +$cfgServers[1]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support +$cfgServers[1]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support $cfgServers[2]['host'] = ''; $cfgServers[2]['port'] = ''; @@ -27,6 +42,8 @@ $cfgServers[2]['user'] = 'root'; $cfgServers[2]['password'] = ''; $cfgServers[2]['only_db'] = ''; $cfgServers[2]['verbose'] = ''; +$cfgServers[2]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support +$cfgServers[2]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support $cfgServers[3]['host'] = ''; $cfgServers[3]['port'] = ''; @@ -37,6 +54,8 @@ $cfgServers[3]['user'] = 'root'; $cfgServers[3]['password'] = ''; $cfgServers[3]['only_db'] = ''; $cfgServers[3]['verbose'] = ''; +$cfgServers[3]['bookmarkdb'] = ''; // Bookmark db - leave blank for no bookmark support +$cfgServers[3]['bookmarktable'] = ''; // Bookmark table - leave blank for no bookmark support // If you have more than one server configured, you can set $cfgServerDefault // to any one of them to autoconnect to that server when phpMyAdmin is started, @@ -63,11 +82,9 @@ $cfgOrder = "ASC"; $cfgShowBlob = true; $cfgShowSQL = true; - $cfgModifyDeleteAtLeft = true; $cfgModifyDeleteAtRight = false; - $cfgDefaultLang = "en"; // default language to use, if not browser-defined or user-defined // $cfgLang = "en"; // force: always use this language - must be defined in select_lang.inc.php3 require("select_lang.inc.php3"); // load language file diff --git a/db_details.php3 b/db_details.php3 index f897b02f4..5f65d7650 100755 --- a/db_details.php3 +++ b/db_details.php3 @@ -1,10 +1,7 @@ ">
$strOr $strLocationTextfile";?>:

+0) + { + echo "$strOr $strBookmarkQuery:
\n"; + echo "\n"; + echo "
\n"; + } +} +?>
  • diff --git a/db_readdump.php3 b/db_readdump.php3 index 61a192e34..d8d2de7ef 100755 --- a/db_readdump.php3 +++ b/db_readdump.php3 @@ -9,6 +9,13 @@ require("grab_globals.inc.php3"); include("lib.inc.php3"); +// Bookmark Support + +if($sql_bookmark != "") + $sql_query = $sql_bookmark; + +// + if(!empty($sql_file) && $sql_file != "none" && ereg("^php[0-9A-Za-z_.-]+$", basename($sql_file))) { $sql_query = fread(fopen($sql_file, "r"), filesize($sql_file)); } diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index 32ba6bd93..237c74e30 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -149,4 +149,8 @@ $strCheckTable = "Check table"; $strAnalyzeTable = "Analyze table"; $strRepairTable = "Repair table"; $strOptimizeTable = "Optimize table"; + +$strBookmarkQuery = "Bookmarked SQL-query"; +$strBookmarkThis = "Bookmark this SQL-query"; +$strBookmarkLabel = "Label"; ?> diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index f7ad31702..e10536838 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -168,4 +168,8 @@ $strAnalyzeTable = "Analyze table"; //to translate $strRepairTable = "Repair table"; //to translate $strOptimizeTable = "Optimize table"; //to translate $strTableType = "Table type"; //to translate + +$strBookmarkQuery = "Requêtes bookmarkées"; +$strBookmarkThis = "Bookmarker cette requête"; +$strBookmarkLabel = "Label"; ?> diff --git a/lib.inc.php3 b/lib.inc.php3 index b7211696b..3b5558ef8 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -682,6 +682,56 @@ function split_string($sql, $delimiter) { return($ret); } +// Bookmark Support + +function get_bookmarks_param() { + global $cfgServers; + global $cfgServer; + global $server; + + $i=1; + while($i<=sizeof($cfgServers)) { + if($cfgServer['adv_auth']) { + if(($cfgServers[$i]['host']==$cfgServer['host'] || $cfgServers[$i]['host']=='') && $cfgServers[$i]['adv_auth']==true && $cfgServers[$i]['stduser']==$cfgServer['user'] && $cfgServers[$i]['stdpass']==$cfgServer['password']) { + + $cfgBookmark['db']=$cfgServers[$i]['bookmarkdb']; + $cfgBookmark['table']=$cfgServers[$i]['bookmarktable']; + break; + } + } + else { + if(($cfgServers[$i]['host']==$cfgServer['host'] || $cfgServers[$i]['host']=='') && $cfgServers[$i]['adv_auth']==false && $cfgServers[$i]['user']==$cfgServer['user'] && $cfgServers[$i]['password']==$cfgServer['password']) { + + $cfgBookmark['db']=$cfgServers[$i]['bookmarkdb']; + $cfgBookmark['table']=$cfgServers[$i]['bookmarktable']; + break; + } + } + $i++; + } + return $cfgBookmark; +} + +function list_bookmarks($db, $cfgBookmark) { + $query="SELECT label, query FROM ".$cfgBookmark['db'].".".$cfgBookmark['table']." WHERE dbase='$db'"; + $result=mysql_db_query($cfgBookmark['db'], $query); + + if($result>0 && mysql_num_rows($result)>0) + { + $flag = 1; + while($row = mysql_fetch_row($result)) + { + $bookmark_list["$flag - ".$row[0]] = $row[1]; + $flag++; + } + return $bookmark_list; + } + else + return false; +} + +$cfgBookmark=get_bookmarks_param(); + } // $__LIB_INC__ // ----------------------------------------------------------------- ?> diff --git a/sql.php3 b/sql.php3 index 28b108bf7..5207197c3 100755 --- a/sql.php3 +++ b/sql.php3 @@ -104,8 +104,35 @@ else { include("header.inc.php3"); display_table($result); if(!eregi("SHOW VARIABLES|SHOW PROCESSLIST|SHOW STATUS", $sql_query)) + { echo "

    $strInsertNewRow

    "; + + // Bookmark Support + + if($cfgBookmark['db'] && $cfgBookmark['table'] && $db!=$cfgBookmark['db'] && !$sql_bookmark) + { + echo "
    \n"; + echo "$strOr

    \n"; + echo $strBookmarkLabel.":\n"; + $goto="sql.php3?server=$server&lang=$lang&db=$db&table=$table&pos=$pos&sql_bookmark=1&sql_query=".urlencode($sql_query); + ?> + + + + + + + + + "> + + +
    + "; + } } } //ne drop query require ("footer.inc.php3"); -?> +?> \ No newline at end of file