2009-07-03 05:16:39 +00:00
< ? php
2009-08-25 16:29:59 +00:00
error_reporting ( 6135 ); // errors and warnings
2009-07-03 05:16:39 +00:00
2009-07-24 15:50:35 +00:00
include " ../adminer/include/coverage.inc.php " ;
2009-07-03 05:16:39 +00:00
// disable filter.default
2009-07-03 10:10:40 +00:00
$filter = ( ! ereg ( '^(unsafe_raw)?$' , ini_get ( " filter.default " )) || ini_get ( " filter.default_flags " ));
2009-07-03 05:16:39 +00:00
if ( $filter ) {
2009-07-03 10:10:40 +00:00
foreach ( array ( '_GET' , '_POST' , '_COOKIE' , '_SERVER' ) as $val ) {
$unsafe = filter_input_array ( constant ( " INPUT $val " ), FILTER_UNSAFE_RAW );
if ( $unsafe ) {
$$val = $unsafe ;
}
}
2009-07-03 05:16:39 +00:00
}
// used only in compiled file
if ( isset ( $_GET [ " file " ])) {
header ( " Expires: " . gmdate ( " D, d M Y H:i:s " , time () + 365 * 24 * 60 * 60 ) . " GMT " );
if ( $_GET [ " file " ] == " favicon.ico " ) {
header ( " Content-Type: image/x-icon " );
2009-09-23 09:56:07 +00:00
echo base64_decode ( " compile_file('../adminer/static/favicon.ico', 'base64_encode'); " );
2009-07-03 05:16:39 +00:00
} elseif ( $_GET [ " file " ] == " default.css " ) {
header ( " Content-Type: text/css " );
2009-09-23 09:56:07 +00:00
?> compile_file('../adminer/static/default.css', 'minify_css');<?php
2009-07-03 05:16:39 +00:00
} elseif ( $_GET [ " file " ] == " functions.js " ) {
header ( " Content-Type: text/javascript " );
2009-09-23 09:56:07 +00:00
?> compile_file('../adminer/static/functions.js', 'JSMin::minify');compile_file('static/editing.js', 'JSMin::minify');<?php
2009-07-03 05:16:39 +00:00
} else {
header ( " Content-Type: image/gif " );
switch ( $_GET [ " file " ]) {
2009-09-23 09:56:07 +00:00
case " plus.gif " : echo base64_decode ( " compile_file('../adminer/static/plus.gif', 'base64_encode'); " ); break ;
case " cross.gif " : echo base64_decode ( " compile_file('../adminer/static/cross.gif', 'base64_encode'); " ); break ;
case " up.gif " : echo base64_decode ( " compile_file('../adminer/static/up.gif', 'base64_encode'); " ); break ;
case " down.gif " : echo base64_decode ( " compile_file('../adminer/static/down.gif', 'base64_encode'); " ); break ;
case " arrow.gif " : echo base64_decode ( " compile_file('../adminer/static/arrow.gif', 'base64_encode'); " ); break ;
2009-07-03 05:16:39 +00:00
}
}
exit ;
}
2009-07-30 08:12:54 +00:00
if ( ! isset ( $_SERVER [ " REQUEST_URI " ])) {
2010-01-09 23:33:41 +00:00
$_SERVER [ " REQUEST_URI " ] = $_SERVER [ " ORIG_PATH_INFO " ] . ( $_SERVER [ " QUERY_STRING " ] != " " ? " ? $_SERVER[QUERY_STRING] " : " " );
2009-07-30 08:12:54 +00:00
}
2009-11-02 21:10:27 +00:00
session_write_close (); // disable session.auto_start
@ ini_set ( " session.use_trans_sid " , false ); // protect links in export, @ - may be disabled
session_name ( " adminer_sid " ); // use specific session name to get own namespace
2009-12-18 17:21:37 +00:00
$params = array ( 0 , preg_replace ( '~\\?.*~' , '' , $_SERVER [ " REQUEST_URI " ]), " " , ( bool ) $_SERVER [ " HTTPS " ]);
2009-11-02 21:10:27 +00:00
if ( version_compare ( PHP_VERSION , '5.2.0' ) >= 0 ) {
$params [] = true ; // HttpOnly
2009-07-03 05:16:39 +00:00
}
2009-11-02 21:10:27 +00:00
call_user_func_array ( 'session_set_cookie_params' , $params ); // ini_set() may be disabled
session_start ();
2009-07-03 05:16:39 +00:00
// disable magic quotes to be able to use database escaping function
if ( get_magic_quotes_gpc ()) {
2009-11-03 13:30:42 +00:00
$process = array ( & $_GET , & $_POST , & $_COOKIE );
while ( list ( $key , $val ) = each ( $process )) {
foreach ( $val as $k => $v ) {
unset ( $process [ $key ][ $k ]);
if ( is_array ( $v )) {
$process [ $key ][ stripslashes ( $k )] = $v ;
$process [] = & $process [ $key ][ stripslashes ( $k )];
} else {
$process [ $key ][ stripslashes ( $k )] = ( $filter ? $v : stripslashes ( $v ));
}
}
}
unset ( $process );
2009-07-03 05:16:39 +00:00
}
2009-09-14 15:12:51 +00:00
if ( function_exists ( " set_magic_quotes_runtime " )) {
set_magic_quotes_runtime ( false );
}
2009-08-25 12:11:12 +00:00
@ set_time_limit ( 0 ); // @ - can be disabled
2009-07-03 06:26:01 +00:00
2009-08-29 13:54:25 +00:00
define ( " DB " , $_GET [ " db " ]); // for the sake of speed and size
2010-01-09 23:33:41 +00:00
define ( " ME " , preg_replace ( '~^[^?]*/([^?]*).*~' , '\\1' , $_SERVER [ " REQUEST_URI " ]) . '?' . ( SID ? SID . '&' : '' ) . ( $_GET [ " server " ] != " " ? 'server=' . urlencode ( $_GET [ " server " ]) . '&' : '' ) . ( DB != " " ? 'db=' . urlencode ( DB ) . '&' : '' ));
2009-07-11 19:45:57 +00:00
include " ../adminer/include/version.inc.php " ;
include " ../adminer/include/functions.inc.php " ;
include " ../adminer/include/lang.inc.php " ;
2009-07-22 12:55:54 +00:00
include " ../adminer/lang/ $LANG .inc.php " ;
2009-07-11 19:45:57 +00:00
include " ./include/adminer.inc.php " ;
include " ../adminer/include/design.inc.php " ;
include " ../adminer/include/pdo.inc.php " ;
include " ../adminer/include/mysql.inc.php " ;
2010-01-08 17:12:03 +00:00
include " ../adminer/include/xxtea.inc.php " ;
2009-07-21 12:19:25 +00:00
include " ../adminer/include/auth.inc.php " ;
2009-07-11 19:45:57 +00:00
include " ./include/connect.inc.php " ;
include " ./include/editing.inc.php " ;
include " ./include/export.inc.php " ;
2009-07-16 14:06:33 +00:00
2009-11-02 22:09:23 +00:00
session_cache_limiter ( " " ); // to allow restarting session
2009-11-03 10:55:57 +00:00
if ( ! ini_get ( " session.use_cookies " ) || @ ini_set ( " session.use_cookies " , false ) !== false ) { // @ - may be disabled
session_write_close (); // improves concurrency if a user opens several pages at once, may be restarted later
2009-11-02 22:09:23 +00:00
}
2009-12-18 15:36:57 +00:00
$on_actions = array ( " RESTRICT " , " CASCADE " , " SET NULL " , " NO ACTION " ); ///< @var array used in foreign_keys()
$confirm = " onclick= \" return confirm(' " . lang ( 'Are you sure?' ) . " '); \" " ; ///< @var string
$token = $_SESSION [ " tokens " ][ $_GET [ " server " ]]; ///< @var string CSRF protection
/** @var string */
2009-07-16 14:06:33 +00:00
$error = ( $_POST
2009-07-20 11:59:11 +00:00
? ( $_POST [ " token " ] == $token ? " " : lang ( 'Invalid CSRF token. Send the form again.' ))
2009-09-02 13:58:45 +00:00
: ( $_SERVER [ " REQUEST_METHOD " ] != " POST " ? " " : lang ( 'Too big POST data. Reduce the data or increase the %s configuration directive.' , '"post_max_size"' )) // posted form with no data means that post_max_size exceeded because Adminer always sends token at least
2009-07-16 14:06:33 +00:00
);