commit 546a74246dfde12cee41de90908efc6f23f9addb
Author: SAIF
Date: Thu Sep 19 21:54:48 2013 +0100
Add The Scripts Files
Add The Scripts Files
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..412eeda
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b9d6bd9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,215 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+*.pubxml
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+#############
+## Windows detritus
+#############
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac crap
+.DS_Store
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist/
+build/
+eggs/
+parts/
+var/
+sdist/
+develop-eggs/
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
diff --git a/.svn/README.txt b/.svn/README.txt
new file mode 100644
index 0000000..271a8ce
--- /dev/null
+++ b/.svn/README.txt
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
diff --git a/.svn/dir-wcprops b/.svn/dir-wcprops
new file mode 100644
index 0000000..4629956
--- /dev/null
+++ b/.svn/dir-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svnpublic/mysqli_converter/!svn/ver/11/MySQLConverterTool
+END
diff --git a/.svn/empty-file b/.svn/empty-file
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/entries b/.svn/entries
new file mode 100644
index 0000000..3fabce3
--- /dev/null
+++ b/.svn/entries
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.svn/format b/.svn/format
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/.svn/format
@@ -0,0 +1 @@
+4
diff --git a/.svn/prop-base/Converter.php.svn-base b/.svn/prop-base/Converter.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/prop-base/README.svn-base b/.svn/prop-base/README.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/prop-base/cli.php.svn-base b/.svn/prop-base/cli.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/prop-base/index.php.svn-base b/.svn/prop-base/index.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/props/Converter.php.svn-work b/.svn/props/Converter.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/props/README.svn-work b/.svn/props/README.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/props/cli.php.svn-work b/.svn/props/cli.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/props/index.php.svn-work b/.svn/props/index.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/.svn/text-base/Converter.php.svn-base b/.svn/text-base/Converter.php.svn-base
new file mode 100644
index 0000000..1b5a6b5
--- /dev/null
+++ b/.svn/text-base/Converter.php.svn-base
@@ -0,0 +1,936 @@
+ext/mysqli Converter
+*
+* @category Converter
+* @package MySQLConverterTool
+* @author Andrey Hristov , Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Converter {
+
+ //
+ // protected
+ //
+
+ /**
+ * Scanner state constant
+ *
+ * @const
+ * @access protected
+ */
+ const STATE_NORMAL = 'normal_state';
+
+
+ /**
+ * Scanner state constant
+ *
+ * @const
+ * @access protectd
+ */
+ const STATE_FUNC_FOUND = 'func_found';
+
+
+ /**
+ * Scanner state constant
+ *
+ * @const
+ * @access protected
+ */
+ const STATE_PARAM_LIST = 'parameter_list';
+
+
+ /**
+ * Converted (= resulting) source code
+ *
+ * @var string
+ */
+ protected $output = '';
+
+
+ /**
+ * List of errors which occured during the conversion
+ *
+ * @var array
+ */
+ protected $errors = array();
+
+
+ /**
+ * List of PHP token
+ *
+ * @var string
+ */
+ protected $tokens = array();
+
+
+ /**
+ * Mapping of ext/mysql -> ext/mysqli constants
+ *
+ */
+ protected $mysql_ext_consts = array(
+ 'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS',
+ 'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE',
+ 'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE',
+ 'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL',
+ 'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
+ 'MYSQL_BOTH' => 'MYSQLI_BOTH',
+ 'MYSQL_NUM' => 'MYSQLI_NUM',
+ );
+
+
+ /**
+ * Number of functions found in the given source
+ *
+ * @var int
+ */
+ protected $funcs_found = 0;
+
+
+ /**
+ * Number of functions converted in the given source
+ *
+ * @var int
+ */
+ protected $funcs_converted = 0;
+
+
+ /**
+ * List of functions that are not supported
+ *
+ * @var array
+ */
+ protected $mysql_funcs_not_supported = array(
+ // rewrite the ugly mysql_result calls manually!
+ 'mysql_result' => true,
+ // whatever that function is...
+ 'mysql_fetch_field2' => true,
+ );
+
+
+ /**
+ * List of functions that can be converted
+ *
+ * Acts as kind of a function pointer list, but with objects
+ *
+ * @var array
+ */
+ protected $mysql_funcs = array();
+
+
+ /**
+ * Flag: enable token debug output?
+ *
+ * @var bool
+ */
+ protected $debug_dump_tokens = false;
+
+
+ /**
+ * Flag: enable parameter parsing debug output?
+ *
+ * @var bool
+ */
+ protected $debug_dump_params = false;
+
+
+ /**
+ * Current line number during the parsing process
+ *
+ * @var int
+ */
+ protected $lineno = 0;
+
+
+ //
+ // public
+ //
+
+
+ /**
+ *
+ *
+ * @param bool Turn on debug output of scanner token?
+ * @param bool Turn on debug output of function parameters?
+ */
+ public function __construct($debug_token = false, $debug_params = false) {
+
+ if (!function_exists('token_name')) {
+ // HACK FIXME
+ die('ext/tokenizer is needed!\n');
+ }
+
+ if (!defined('T_ML_COMMENT'))
+ define('T_ML_COMMENT', T_COMMENT);
+
+ if (!defined('T_DOC_COMMENT'))
+ define('T_DOC_COMMENT', T_ML_COMMENT);
+
+ if (!defined('T_SIMPLE_TOKEN'))
+ define('T_SIMPLE_TOKEN', 32567);
+
+ $this->debug_dump_tokens = $debug_token;
+ $this->debug_dump_params = $debug_params;
+
+ $this->mysql_funcs =
+ array(
+ // PHP_FALIAS(mysql, mysql_db_query, NULL)
+ 'mysql' => new MySQLConverterTool_Function_DBQuery(),
+ // in OO this is a property
+ 'mysql_affected_rows' => new MySQLConverterTool_Function_ConnParam('mysqli_affected_rows'),
+ 'mysql_change_user' => new MySQLConverterTool_Function_ChangeUser(),
+ 'mysql_client_encoding' => new MySQLConverterTool_Function_ConnParam('mysqli_character_set_name'),
+ 'mysql_close' => new MySQLConverterTool_Function_ConnParamBool('mysqli_close'),
+ // pconnect has less params but they are not significant for mysqli_connect
+ 'mysql_connect' => new MySQLConverterTool_Function_Connect(),
+ // PHP_FALIAS(mysql_createdb, mysql_create_db, NULL)
+ 'mysql_createdb' => new MySQLConverterTool_Function_CreateDB(),
+ 'mysql_create_db' => new MySQLConverterTool_Function_CreateDB(),
+ 'mysql_data_seek' => new MySQLConverterTool_Function_Generic('mysqli_data_seek'),
+ 'mysql_dbname' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_db_name' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_db_query' => new MySQLConverterTool_Function_DBQuery(),
+ // PHP_FALIAS(mysql_dropdb, mysql_drop_db, NULL)
+ 'mysql_dropdb' => new MySQLConverterTool_Function_DropDB(),
+ 'mysql_drop_db' => new MySQLConverterTool_Function_DropDB(),
+ // in OO this is a property
+ 'mysql_error' => new MySQLConverterTool_Function_Error('mysqli_error'),
+ // in OO this is a property
+ 'mysql_errno' => new MySQLConverterTool_Function_Error('mysqli_errno'),
+ 'mysql_escape_string' => new MySQLConverterTool_Function_EscapeString('mysqli_real_escape_string'),
+ 'mysql_fetch_array' => new MySQLConverterTool_Function_Generic('mysqli_fetch_array'),
+ 'mysql_fetch_assoc' => new MySQLConverterTool_Function_Generic('mysqli_fetch_assoc'),
+ 'mysql_fetch_field' => new MySQLConverterTool_Function_FetchField(),
+ 'mysql_fetch_lengths' => new MySQLConverterTool_Function_GenericBoolean('mysqli_fetch_lengths'),
+ 'mysql_fetch_object' => new MySQLConverterTool_Function_Generic('mysqli_fetch_object'),
+ 'mysql_fetch_row' => new MySQLConverterTool_Function_Generic('mysqli_fetch_row'),
+ // PHP_FALIAS(mysql_fieldflags, mysql_field_flags, NULL)
+ 'mysql_fieldflags' => new MySQLConverterTool_Function_FieldFlags(),
+ 'mysql_field_flags' => new MySQLConverterTool_Function_FieldFlags(),
+ // PHP_FALIAS(mysql_fieldlen, mysql_field_len, NULL)
+ 'mysql_fieldlen' => new MySQLConverterTool_Function_FieldLen(),
+ 'mysql_field_len' => new MySQLConverterTool_Function_FieldLen(),
+ // PHP_FALIAS(mysql_fieldname, mysql_field_name, NULL)
+ 'mysql_fieldname' => new MySQLConverterTool_Function_FieldName(),
+ 'mysql_field_name' => new MySQLConverterTool_Function_FieldName(),
+ 'mysql_field_seek' => new MySQLConverterTool_Function_GenericBoolean('mysqli_field_seek'),
+ // PHP_FALIAS(mysql_fieldtable, mysql_field_table, NULL)
+ 'mysql_fieldtable' => new MySQLConverterTool_Function_FieldTable(),
+ 'mysql_field_table' => new MySQLConverterTool_Function_FieldTable(),
+ // PHP_FALIAS(mysql_fieldtype, mysql_field_type, NULL)
+ 'mysql_fieldtype' => new MySQLConverterTool_Function_FieldType(),
+ 'mysql_field_type' => new MySQLConverterTool_Function_FieldType(),
+ // PHP_FALIAS(mysql_freeresult, mysql_free_result, NULL)
+ 'mysql_freeresult' => new MySQLConverterTool_Function_FreeResult(),
+ 'mysql_free_result' => new MySQLConverterTool_Function_FreeResult(),
+ 'mysql_get_client_info' => new MySQLConverterTool_Function_Generic('mysqli_get_client_info'),
+ // in OO this is a property
+ 'mysql_get_host_info' => new MySQLConverterTool_Function_ConnParamBool('mysqli_get_host_info'),
+ // in OO this is a property
+ 'mysql_get_proto_info' => new MySQLConverterTool_Function_ConnParamBool('mysqli_get_proto_info'),
+ // in OO this is a property
+ 'mysql_get_server_info' => new MySQLConverterTool_Function_ConnParamBool('mysqli_get_server_info'),
+ 'mysql_info' => new MySQLConverterTool_Function_ConnParam('mysqli_info'),
+ 'mysql_insert_id' => new MySQLConverterTool_Function_ConnParamBool('mysqli_insert_id'),
+ // PHP_FALIAS(mysql_listdbs, mysql_list_dbs, NULL)
+ 'mysql_listdbs' => new MySQLConverterTool_Function_ListDBs(),
+ 'mysql_list_dbs' => new MySQLConverterTool_Function_ListDBs(),
+ // PHP_FALIAS(mysql_listfields, mysql_list_fields, NULL)
+ 'mysql_listfields' => new MySQLConverterTool_Function_ListFields(),
+ 'mysql_list_fields' => new MySQLConverterTool_Function_ListFields(),
+ 'mysql_list_processes' => new MySQLConverterTool_Function_ListProcesses(),
+ // PHP_FALIAS(mysql_listtables, mysql_list_tables, NULL)
+ 'mysql_listtables' => new MySQLConverterTool_Function_ListTables(),
+ 'mysql_list_tables' => new MySQLConverterTool_Function_ListTables(),
+ // PHP_FALIAS(mysql_numfields, mysql_num_fields, NULL)
+ 'mysql_numfields' => new MySQLConverterTool_Function_Generic('mysqli_num_fields'),
+ // in OO this is a property
+ 'mysql_num_fields' => new MySQLConverterTool_Function_GenericBoolean('mysqli_num_fields'),
+ // PHP_FALIAS(mysql_numrows, mysql_num_rows, NULL)
+ 'mysql_numrows' => new MySQLConverterTool_Function_Generic('mysqli_num_rows'),
+ // in OO this is a property
+ 'mysql_num_rows' => new MySQLConverterTool_Function_Generic('mysqli_num_rows'),
+ // pconnect has less params but they are not significant for mysqli_connect
+ 'mysql_pconnect' => new MySQLConverterTool_Function_Connect(),
+ 'mysql_ping' => new MySQLConverterTool_Function_ConnParam('mysqli_ping'),
+ 'mysql_query' => new MySQLConverterTool_Function_ParReversed('mysqli_query'),
+ 'mysql_real_escape_string' => new MySQLConverterTool_Function_RealEscapeString('mysqli_real_escape_string'),
+ // mysql_result -- Get result data
+ // PHP_FALIAS(mysql_selectdb, mysql_select_db, NULL)
+ 'mysql_selectdb' => new MySQLConverterTool_Function_SelectDB(),
+ 'mysql_select_db' => new MySQLConverterTool_Function_SelectDB(),
+ 'mysql_stat' => new MySQLConverterTool_Function_ConnParam('mysqli_stat'),
+ 'mysql_tablename' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_table_name' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_thread_id' => new MySQLConverterTool_Function_ConnParam('mysqli_thread_id'),
+ 'mysql_unbuffered_query' => new MySQLConverterTool_Function_UnbufferedQuery(),
+ );
+
+ } // end func __construct
+
+
+
+ /**
+ * Converts the given source code
+ *
+ * @param string Source code to be converted
+ * @return array Converted source code and status information
+ */
+ public function convertString($source) {
+
+ $this->lineno = 0;
+ $this->output = '';
+ $this->tokens = token_get_all($source);
+ $this->errors = array();
+ $this->lineno = 1;
+
+ $this->funcs_found = 0;
+ $this->funcs_converted = 0;
+
+ $this->scanner(0);
+
+ return array(
+ 'output' => $this->output,
+ 'found' => $this->funcs_found,
+ 'converted' => $this->funcs_converted,
+ 'errors' => $this->errors,
+ );
+ } // end func convertString
+
+
+ /**
+ * Reads a file and returns the converted source code
+ *
+ * @param strng filename
+ * @param array Converted source and status information
+ */
+ public function convertFile($filename) {
+
+ if (!file_exists($filename) || !is_readable($filename) || !is_file($filename)) {
+ $ret = $this->convertString('');
+ $ret['errors'][] = array('line' => -1, 'msg' => 'Cannot open file "' . $filename . '".');
+ return $ret;
+ }
+
+ return $this->convertString(file_get_contents($filename));
+ }
+
+
+ /**
+ * Returns all files of a directory that have a certain name
+ *
+ *
+ */
+ public function getFilesOfDirectory($dir, $file_pattern = '*', Array $files = array()) {
+
+ if (!is_dir($dir) || !is_readable($dir))
+ return $files;
+
+ $patterns = $this->buildRegularExpression($file_pattern);
+ if (empty($patterns))
+ return $files;
+
+ $dh = opendir($dir);
+ if (!$dh)
+ return $files;
+
+ while ($file = readdir($dh)) {
+ if ('.' == $file || '..' == $file)
+ continue;
+
+ $ffile = $dir . '/' . $file;
+ if (is_dir($ffile))
+ $files = $this->getFilesOfDirectory($ffile, $file_pattern, $files);
+
+ if (!is_file($ffile))
+ continue;
+
+ $accept = false;
+ foreach ($patterns as $k => $pattern) {
+ if (preg_match('@' . $pattern . '$@i', $file)) {
+ $accept = true;
+ break;
+ }
+ }
+
+ if ($accept)
+ $files[] = $ffile;
+ }
+ closedir($dh);
+
+ return $files;
+ }
+
+
+ /**
+ * Unsets the variable which stores the global (default) connection of ext/mysql
+ *
+ * This is a hack required by the test framework.
+ *
+ */
+ public function unsetGlobalConnection() {
+
+ $obj = new MySQLConverterTool_Function_Generic('mysqli_query');
+ eval(sprintf('@mysqli_close(%s);', $obj->ston_name));
+ eval(sprintf('if (isset(%s)) unset(%s);', $obj->ston_name, $obj->ston_name));
+
+ }
+
+
+ /**
+ * Returns a list of functions that can be converted automatically
+ *
+ * @return array
+ */
+ public function getSupportedFunctions() {
+
+ $ret = array_keys($this->mysql_funcs);
+ sort($ret);
+
+ return $ret;
+ }
+
+
+ /**
+ * Returns a list of functions that cannot be converted automatically
+ *
+ * @return array
+ */
+ public function getUnsupportedFunctions() {
+
+ $ret = array_keys($this->mysql_funcs_not_supported);
+ sort($ret);
+
+ return $ret;
+ }
+
+ //
+ // protected
+ //
+
+
+ /**
+ * Scans the source and rebuilds a converted version of it
+ *
+ * @param int
+ */
+ protected function scanner($level) {
+
+ // current parser state
+ $state = self::STATE_NORMAL;
+
+ // list of function parameters
+ $func_params = array();
+ // current parameter value
+ $curr_param = '';
+ // current bracket nesting level
+ $bracket_level = 0;
+ // name of the currently processed function
+ $func_name = '';
+ // flag: does the currently parameter contain variables or constants?
+ $param_dynamic = false;
+ // flag for something that looks like a mysql_func call but is not followed by parameters
+ $expect_param_brace_open = false;
+
+
+ while (list( , $token) = each($this->tokens)) {
+
+ if (is_string($token)) {
+ $id = T_SIMPLE_TOKEN;
+ $token_name = 'T_SIMPLE_TOKEN';
+ $text = $token;
+ } else {
+ list($id, $text) = $token;
+ $token_name = token_name($id);
+ }
+
+ // remember the current line number
+ $lineno = $this->lineno;
+ $this->lineno += $this->countLines($text);
+
+ if ($this->debug_dump_tokens) {
+
+ $this->debug_print('dump token',
+ sprintf("[%-05d - %10s - %d - %-10s - %03d - %05d] %s",
+ $lineno,
+ $token_name,
+ $expect_param_brace_open,
+ $state,
+ $bracket_level,
+ strlen($text),
+ htmlspecialchars($text))
+ );
+
+ }
+
+ switch ($id) {
+
+ case T_COMMENT:
+ case T_ML_COMMENT:
+ case T_DOC_COMMENT:
+
+ switch ($state) {
+ case self::STATE_NORMAL:
+ $this->output .= $text;
+ break;
+
+ case self::STATE_FUNC_FOUND:
+ // comment between func_name and comma
+ break;
+
+ case self::STATE_PARAM_LIST:
+ $curr_param .= $text;
+ break;
+ }
+
+ break;
+
+ case T_SIMPLE_TOKEN:
+
+ switch ($state) {
+
+ case self::STATE_NORMAL:
+ $this->output .= $text;
+ break;
+
+ case self::STATE_FUNC_FOUND:
+
+ switch ($text) {
+ case '(':
+ $state = self::STATE_PARAM_LIST;
+ $func_params = array();
+ $curr_param = NULL;
+ $param_dynamic = false;
+ $expect_param_brace_open = false;
+ break;
+
+ case ')':
+ default:
+ if ($expect_param_brace_open) {
+ // something that looks like is not followed by an opening brace for
+ $state = self::STATE_NORMAL;
+ $this->funcs_found--;
+ $expect_param_brace_open = 0;
+ $steps = 0;
+ $tmp = '';
+ while (($token = prev($this->tokens)) && ($tmp != $func_name)) {
+ if (is_array($token)) {
+ $tmp = $token[1];
+ } else {
+ $tmp = $token;
+ }
+ $steps++;
+ }
+ while ($steps-- > 1) {
+ $token = next($this->tokens);
+ if (is_array($token))
+ $tmp = $token[1];
+ else
+ $tmp = $token;
+ $this->output .= $tmp;
+ }
+ next($this->tokens);
+ break 3;
+ }
+ break;
+ }
+ break;
+
+ case self::STATE_PARAM_LIST:
+
+ switch ($text) {
+ case ',':
+ if ($bracket_level == 1) {
+ $func_params[] = array('value' => $curr_param, 'dynamic' => $param_dynamic);
+ $curr_param = '';
+ $param_dynamic = false;
+ } else {
+ $curr_param .= $text;
+ }
+ // don't add to the curr_param
+ break(2);
+
+ case '(':
+ $bracket_level++;
+ break;
+
+ case ')':
+ $bracket_level--;
+ if ($bracket_level == 0) {
+ // end of the parameter specification
+
+ if (!is_null($curr_param))
+ $func_params[] = array('value' => $curr_param, 'dynamic' => $param_dynamic);
+
+ $curr_param = NULL;
+ $param_dynamic = false;
+ $state = self::STATE_NORMAL;
+
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ array('name' => $func_name, 'params' => $func_params)
+ );
+ }
+
+ if (!$level) {
+
+ list($handler_warning, $handler_code) = $this->mysql_funcs[$func_name]->handle($func_params);
+ if (!is_null($handler_warning))
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] %s', $lineno, $handler_warning));
+
+ if (is_null($handler_code)) {
+ $this->output .= $this->rebuildFunctionCode($func_name, $func_params, $handler_warning);
+ } else {
+ $this->funcs_converted++;
+ $this->output .= $handler_code;
+ }
+
+ } else {
+ // we are in recursive call - return
+
+ list($handler_warning, $handler_code) = $this->mysql_funcs[$func_name]->handle($func_params);
+ if (!is_null($handler_warning))
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] %s', $lineno, $handler_warning));
+
+ if (is_null($handler_code)) {
+ return $this->rebuildFunctionCode($func_name, $func_params, $handler_warning);
+ } else {
+ $this->funcs_converted++;
+ return $handler_code;
+ }
+
+ }
+
+ }
+ break;
+
+ case '.':
+ case '&':
+ case '^':
+ case '|':
+ case '&&':
+ case '||':
+ case 'and':
+ case 'or':
+ case 'xor':
+ case '<<':
+ case '>>':
+ case '<':
+ case '<=':
+ case '>':
+ case '>=':
+ case '=':
+ case '*':
+ case '/':
+ case '%':
+ case '+':
+ case '-':
+ case '++':
+ case '--':
+ case '!':
+ case '~':
+ case '=':
+ case '+=':
+ case '-=':
+ case '*=':
+ case '/=':
+ case '.=':
+ case '%=':
+ case '&=':
+ case '|=':
+ case '^=':
+ case '<<=':
+ case '>>=':
+ case '?':
+ case '==':
+ case '!=':
+ case '===':
+ case '!==':
+ case '(':
+ case 'new':
+ // forget it - this parameter value is build dynamically
+ // we won't try to guess it's value using static code analysis
+ // this needs to be checked manually
+ $param_dynamic = true;
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ 'Operator found in parameter. Assuming that the paramter value will be dynamic and cannot be foreseen.'
+ );
+ }
+ break;
+ }
+
+ $curr_param .= $text;
+ break;
+ }
+ break;
+
+ case T_STRING:
+
+ if (isset($this->mysql_ext_consts[$text])) {
+
+ $text = $this->mysql_ext_consts[$text];
+
+ } else {
+
+ switch ($state) {
+ case self::STATE_PARAM_LIST:
+ // maybe a function call or constant as part of a parameter value?
+
+ if (isset($this->mysql_funcs_not_supported[$text])) {
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] Function "%s" is not supported for conversion! You must rewrite the converted code. The conversion is not complete. Consider rewriting your code first and rerunning the conversion tool"', $lineno, $text));
+
+ }
+
+ if (isset($this->mysql_funcs[$text])) {
+ // return the current token and reparse it
+ prev($this->tokens);
+ // in the default of the outter switch add this to $curr_param
+ $text = $this->scanner($level + 1);
+ $param_dynamic = true;
+ }
+ // fall to default
+ break;
+
+ case self::STATE_FUNC_FOUND:
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] We found a string between the function name "%s" and the parameter list. Looks like a syntax error in the source file. Please check!', $lineno, $func_name));
+
+ break;
+
+ case self::STATE_NORMAL:
+ default:
+
+ if (isset($this->mysql_funcs_not_supported[$text])) {
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] Function "%s" is not supported for conversion! You must rewrite the converted code code. The conversion is not complete. Consider rewriting your code first and rerunning the conversion tool."', $lineno, $text));
+
+ }
+
+ if (isset($this->mysql_funcs[$text])) {
+ $state = self::STATE_FUNC_FOUND;
+ $func_name = $text;
+ $bracket_level = 1;
+ $this->funcs_found++;
+ $expect_param_brace_open = true;
+
+ break(2);
+ }
+
+ if ($text == 'is_resource') {
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] You are using is_resource(). Make sure that you do not use it to test for the return value of mysql_query(). mysql_query() returns a resource or a boolean value. mysqli_query() returns an object or a boolean value. If you check the return value of mysql_query like < if (is_resource($res = mysql_query())) [...] > the converted code will fail, because $res will be an object in ext/mysqli."', $lineno, $text));
+ }
+ // here we fall-through
+ }
+ }
+
+
+ default:
+
+ if ($id === T_CONSTANT_ENCAPSED_STRING) {
+ /* try to detect function_exists('some_mysql_func'); */
+ $prev_steps = 0;
+
+ if (isset($this->mysql_funcs[substr($text, 1, -1)]) &&
+ $this->mysql_funcs[substr($text, 1, -1)]->new_name) {
+ // strip quotes
+ // move back because now 'some_mysql_func' will be returned by prev()
+ $prev_steps = 1;
+ $tmp_token = prev($this->tokens);
+
+ do {
+ $tmp_token = prev($this->tokens);
+ $prev_steps++;
+ } while ($tmp_token[0] === T_WHITESPACE);
+
+ if ($tmp_token === '(') {
+
+ $tmp_token = prev($this->tokens);
+ $prev_steps++;
+
+ if ($tmp_token[0] === T_STRING &&
+ $tmp_token[1] === 'function_exists') {
+
+ $text = $text[0] . $this->mysql_funcs[substr($text, 1, -1)]->new_name . $text[0];
+ }
+
+ }
+
+ while ($prev_steps--)
+ each($this->tokens);
+ }
+ }
+
+ switch ($state) {
+ case self::STATE_PARAM_LIST:
+
+ switch ($id) {
+
+ case T_VARIABLE:
+ case T_FUNCTION:
+ case T_CONST:
+ // this is a variable, we cannot guess value of the parameter
+ // using this static conversion approach
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ "Adding variable '$text' to current parameter."
+ );
+ }
+ $param_dynamic = true;
+ $curr_param .= $text;
+ break;
+
+ case T_WHITESPACE:
+ default:
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ "Adding '$text' to current parameter."
+ );
+ }
+
+ $curr_param .= $text;
+ break;
+ }
+ break;
+
+ case self::STATE_FUNC_FOUND:
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] Please check your code for parse errors, we failed to parse "%s". Conversion will be incomplete!".', $lineno, $text));
+ break;
+
+ default:
+ case self::STATE_NORMAL:
+ $this->output .= $text;
+ break;
+ }
+ break;
+ }
+
+ }
+
+ }
+
+
+ /**
+ * Print a debug message
+ *
+ * @param string Message prefix
+ * @param mixed Array or literal to print
+ */
+ protected function debug_print($prefix, $var) {
+
+ if (is_scalar($var)) {
+ printf("[%s/%s] %s\n",
+ get_class($this),
+ $prefix,
+ $var);
+ } else {
+ printf("[%s/%s] ", get_class($this), $prefix);
+ var_dump($var);
+ printf("\n");
+ }
+
+
+ } // end func debug_print
+
+
+ /**
+ * Returns the number of lines of a string
+ *
+ * @param string
+ * @return int
+ */
+ protected function countLines($text) {
+
+ $last_pos = 0;
+ $lines = 0;
+ while (($pos = strpos($text, "\n", $last_pos)) !== FALSE) {
+ $last_pos = $pos + 1;
+ $lines++;
+ }
+
+ return $lines;
+ }
+
+
+ /**
+ * Rebuilds the original function code based on function name and parameters and adds a comment with a warning after the last parameter
+ *
+ * @param string
+ * @param array
+ * @param string
+ */
+ protected function rebuildFunctionCode($name, $params, $warning) {
+
+ $ret = $name . '(';
+ if (count($params) > 0) {
+ foreach ($params as $k => $param)
+ $ret .= $param['value'] . ', ';
+ $ret = substr($ret, 0, -2);
+ }
+ $ret .= ')';
+ // $ret .= ' /* [MySQLConverterTool] ' . $warning . '*/)';
+
+ return $ret;
+ }
+
+
+
+ /**
+ * Expands a user specified file pattern with * as the only pattern to a regular expression
+ *
+ * @param string
+ * @return array
+ */
+ protected function buildRegularExpression($file_pattern) {
+
+ $parts = explode(',', $file_pattern);
+ if (empty($parts))
+ return array();
+
+ $ret = array();
+ foreach ($parts as $k => $v)
+ $ret[] = str_replace('\*', '.*', preg_quote($v, '@'));
+
+ return $ret;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/.svn/text-base/README.svn-base b/.svn/text-base/README.svn-base
new file mode 100644
index 0000000..23b599c
--- /dev/null
+++ b/.svn/text-base/README.svn-base
@@ -0,0 +1,18 @@
+ Welcome to the MySQL ext/mysql->ext/mysqli Converter Tool.
+ This tool helps you to migrate PHP files using the PHP
+ MySQL extension to use the MySQLi extension.
+
+ Extract the archive into a directory on your web server. Open
+ http:////MySQLConverterTool/GUI/index.php
+ for a Web GUI. If you want to work on the command line, try
+ php -f cli.php.
+
+ Note that absolutely no security checks are performed
+ by the tool which prevent users from trying to read and convert
+ files (e.g. /etc/passwd). Make sure to add security measures,
+ if needed.
+
+ If you want to run any tests, check the hints given
+ in UnitTests/README.
+
+ Have fun!
\ No newline at end of file
diff --git a/.svn/text-base/cli.php.svn-base b/.svn/text-base/cli.php.svn-base
new file mode 100644
index 0000000..207aa6e
--- /dev/null
+++ b/.svn/text-base/cli.php.svn-base
@@ -0,0 +1,445 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+/**
+* Parse the command line options
+*
+* @param int
+* @param array
+* @return array
+* @access public
+*/
+function parseOptions($argc, $argv) {
+
+ $options = array();
+ $error = null;
+
+ if ($argc < 2) {
+ $error = 'No options given';
+ return array($options, $error);
+ }
+
+ reset($argv);
+
+ // skip $argv[0] - program name
+ next($argv);
+
+ while (list($k, $arg) = each($argv)) {
+ $arg = trim($arg);
+ switch ($arg) {
+ case '-f':
+ if (list($k, $arg) = each($argv)) {
+ $arg = trim($arg);
+ if (substr($arg, 0, 1) == '-') {
+ $error = '-f needs a file name';
+ break 2;
+ } else if (!file_exists($arg)) {
+ $error = sprintf('"%s" does not exist', $arg);
+ break 2;
+ } else if (!is_file($arg)) {
+ $error = sprintf('"%s" is not a file', $arg);
+ break 2;
+ } else if (!is_readable($arg)) {
+ $error = sprintf('"%s" is not reabale', $arg);
+ break 2;
+ } else {
+ $options['files'][$arg] = $arg;
+ }
+ } else {
+ $error = sprintf('-f needs a file name');
+ break 2;
+ }
+ break;
+
+ case '-d':
+ if (list($k, $arg) = each($argv)) {
+ $arg = trim($arg);
+ if (substr($arg, 0, 1) == '-') {
+ $error = '-d needs a directory name';
+ break 2;
+ } else if (!file_exists($arg)) {
+ $error = sprintf('"%s" does not exist', $arg);
+ break 2;
+ } else if (!is_dir($arg)) {
+ $error = sprintf('"%s" is not a directory', $arg);
+ break 2;
+ } else if (!is_readable($arg)) {
+ $error = sprintf('"%s" is not readable', $arg);
+ break 2;
+ } else {
+ $options['directories'][$arg] = $arg;
+ }
+ } else {
+ $error = sprintf('-d needs a directory name');
+ break 2;
+ }
+ break;
+
+ case '-s':
+ if (list($k, $arg) = each($argv)) {
+ $arg = trim($arg);
+ if ('' == $arg) {
+ $error = '-s expects a code snippet to follow the option';
+ break 2;
+ }
+ $options['snippet'] = $arg;
+ } else {
+ $error = '-s expects a code snippet to follow the option';
+ break 2;
+ }
+ break;
+
+ case '-h':
+ case '--help':
+ $options['help'] = true;
+
+ case '-u':
+ $options['update'] = true;
+ break;
+
+ case '-b':
+ $options['backup'] = true;
+ $options['update'] = true;
+ break;
+
+ case '-v':
+ if (isset($options['quiet'])) {
+ $error = 'You cannot use -v with -q';
+ break 2;
+ }
+ $options['verbose'] = true;
+ break;
+
+ case '-q':
+ if (isset($options['verbose'])) {
+ $error = 'You cannot use -q with -v';
+ break 2;
+ }
+ $options['quiet'] = true;
+ break;
+
+ case '-w':
+ $options['warnings'] = true;
+ break;
+
+ case '-p':
+ if (list($k, $arg) = each($argv)) {
+ $arg = trim($arg);
+ if ('' == $arg) {
+ $error = '-p needs a search pattern';
+ break 2;
+ } else {
+ $options['pattern'] = $arg;
+ }
+ } else {
+ $error = '-p needs a search pattern';
+ break 2;
+ }
+ break;
+
+ default:
+ $error = sprintf('Invalid option "%s"', $arg);
+ break;
+
+ }
+
+ }
+
+ return array($options, $error);
+} // end func parseOptions
+
+
+/**
+* Prints the help message with usage instructions
+*
+* @param array
+*/
+function printHelp($argv) {
+
+ printf("\n");
+ printf("Usage of %s :\n\n", $argv[0]);
+ printf("-f Convert file\n");
+ printf("-d Convert directory\n");
+ printf('-p File name pattern for -d, e.g. -p "*.php,*.php3". Default: *');
+ printf("\n");
+ printf("-s Convert code snippet\n");
+ printf("\n");
+ printf("-u Update (modify) input file during the conversion\n");
+ printf("-b Backup files to [original_name].org before they get updated\n\n");
+ printf("-v verbose - print conversion details\n");
+ printf("-w warnings - print errors/warnings, if any\n");
+ printf("-q quiet - don't print the generated code\n");
+ printf("\n\n");
+
+} // end func printHelp
+
+
+/**
+* Returns a status description (OK, Error, Warning) based on the conversion result
+*
+* @param array
+* @return string
+*/
+function getConversionStatus($conv_result) {
+
+ $status = null;
+ if (($conv_result['found'] == $conv_result['converted']) && (count($conv_result['errors']) == 0)) {
+ $status = 'OK';
+ } else if (($conv_result['found'] == $conv_result['converted']) && (count($conv_result['errors']) > 0)) {
+ $status = 'Warning';
+ } else if (($conv_result['found'] != $conv_result['converted']) && (count($conv_result['errors']) > 0)) {
+ $status = 'Error';
+ }
+
+ return $status;
+} // end func getConversionStatus
+
+
+/**
+* Prints the overview summary with conversion details
+*
+* @param array
+* @param string
+* @param mixed
+*/
+function printConversionHeader($conv_result, $status, $file = null) {
+
+ if (!is_null($file)) {
+ print "\n";
+ printSeperator("File $file");
+ print "\n";
+ }
+
+ print "\n";
+ printSeperator("Summary", '-');
+ print "\n";
+
+ printf("Status: %s\n", $status);
+ printf("Number of mysql_-functions found: %d\n", $conv_result['found']);
+ printf("Number of mysql_-functions converted: %d\n", $conv_result['converted']);
+ printf("Warnings/Errors: %d\n", count($conv_result['errors']));
+ printf("Code length: %d Bytes\n", strlen($conv_result['output']));
+
+} // end func printConversionHeader
+
+
+/**
+* Prints the conversion errors
+*
+* @param array
+*/
+function printConversionErrors($conv_result) {
+
+ print "\n";
+ print "\n";
+ printSeperator("Warnings/Errors", '-');
+ print "\n";
+
+ foreach ($conv_result['errors'] as $k => $error) {
+ printSeperator(sprintf("Warning/Error on line %d", $error['line']), ' ');
+ print $error['msg'];
+ print "\n";
+ }
+} // end func printConversionErrors
+
+
+/**
+* Prints the generated source code
+*
+* @param array
+*/
+function printConversionOutput($conv_result, $verbose, $quiet) {
+
+ if ($verbose) {
+ print "\n";
+ print "\n";
+ printSeperator("Generated code", '-');
+ print "\n";
+ }
+
+ if (!$quiet)
+ print $conv_result['output'];
+
+ if ($verbose) {
+ print "\n";
+ print "\n";
+ printSeperator("End of code", "-");
+ print "\n";
+ }
+
+} // end func printConversionOutput
+
+
+/**
+* Converts a file
+*
+* @param string
+* @param bool
+*/
+function convertFile($file, $verbose, $quiet, $update, $backup, $warnings, $seperator = '#') {
+
+ $conv = new MySQLConverterTool_Converter();
+ $ret = $conv->convertFile($file);
+ $status = getConversionStatus($ret);
+
+ if ($quiet)
+ printSeperator(sprintf('[ %-7s ] %s', $status, $file), $seperator);
+
+ if ($verbose)
+ printConversionHeader($ret, $status, $file);
+
+ if ($backup) {
+ $ffile = $file . '.org';
+ if (file_exists($ffile) && !unlink($ffile)) {
+ printf("Error:\n");
+ printf("Cannot unlink old backup file '%s'. Check the file permissions.\n\n", $ffile);
+ return;
+ }
+
+ if (!rename($file, $ffile)) {
+ printf("Error:\n");
+ printf("Cannot rename '%s' to %s'. Check the file permissions.\n\n", $file, $ffile);
+ return;
+ }
+
+ if ($verbose)
+ printf("Backup created.\n", $ffile);
+ }
+
+ if ($update) {
+
+ if (!$fp = fopen($file, 'w')) {
+ printf("Error:\n");
+ printf("Cannot modify file '%s'. Check the file permissions.\n\n", $file);
+ return;
+ }
+ fwrite($fp, $ret['output']);
+ fclose($fp);
+
+ if ($verbose)
+ printf("File updated/modified.\n", $file);
+
+ }
+
+ if (($verbose || $warnings) && count($ret['errors']) > 0)
+ printConversionErrors($ret);
+
+ printConversionOutput($ret, $verbose, $quiet);
+} // end func convertFile
+
+
+/**
+*
+*/
+function convertSnippet($code, $verbose, $quiet, $warnings, $seperator = '#') {
+
+ $conv = new MySQLConverterTool_Converter();
+ $ret = $conv->convertString($code);
+ $status = getConversionStatus($ret);
+
+ if ($quiet)
+ printSeperator('Snippet', $seperator);
+
+ if ($verbose)
+ printConversionHeader($ret, $status, NULL);
+
+ if (($verbose || $warnings) && count($ret['errors']) > 0)
+ printConversionErrors($ret);
+
+ printConversionOutput($ret, $verbose, $quiet);
+} // end func convertSnippet
+
+
+/**
+* Helper: prints a line with a title
+*
+* @param string
+* @param string
+*/
+function printSeperator($title, $seperator = '#') {
+
+ $len = strlen($title) + 2;
+
+ $num = 1;
+ // $num = max(floor((80 - $len) / 2), 0);
+ for ($i = 0; $i < $num; $i++)
+ print $seperator;
+
+ printf(' %s ', $title);
+
+ if ($num > 0) {
+ $num = 80 - $num - $len;
+ for ($i = 0; $i < $num; $i++)
+ print $seperator;
+ }
+
+ print "\n";
+
+} // end func printSeperator
+
+
+if (!isset($argc) || !isset($argv)) {
+ // redirect to the web gui
+ // or maybe die("This is the command line interface, use php -f cli.php to run it! Open index.php for the web interface."); ?
+ header('Location: GUI/index.php');
+ exit(0);
+
+}
+
+
+list($options, $error) = parseOptions($argc, $argv);
+if (!is_null($error) || empty($options) || isset($options['help'])) {
+ // some sort of trouble or help output requested
+
+ if (!is_null($error)) {
+ printf("\n");
+ printf("Error: %s\n", $error);
+ }
+ printHelp($argv);
+
+} else {
+
+ print "\n";
+
+ if (!empty($options['files'])) {
+ foreach ($options['files'] as $k => $file)
+ convertFile($file, isset($options['verbose']), isset($options['quiet']), isset($options['update']), isset($options['backup']), isset($options['warnings']));
+ }
+
+ if (!empty($options['directories'])) {
+ $conv = new MySQLConverterTool_Converter();
+ foreach ($options['directories'] as $k => $directory) {
+ $files = $conv->getFilesOfDirectory($directory, (isset($options['pattern'])) ? $options['pattern'] : '');
+ if (empty($files)) {
+ printSeperator(sprintf('No files found in "%s"', $directory), '*');
+ print "\n";
+ continue;
+ }
+
+ printSeperator(sprintf('Directory "%s"', $directory), '*');
+ print "\n";
+ foreach ($files as $k => $file) {
+ convertFile($file, isset($options['verbose']), isset($options['quiet']), isset($options['update']), isset($options['backup']), isset($options['warnings']), ' ');
+ }
+
+ }
+ }
+
+ if (isset($options['snippet']))
+ convertSnippet($options['snippet'], isset($options['verbose']), isset($options['quiet']), isset($options['warnings']));
+
+}
+?>
\ No newline at end of file
diff --git a/.svn/text-base/index.php.svn-base b/.svn/text-base/index.php.svn-base
new file mode 100644
index 0000000..b70f9a1
--- /dev/null
+++ b/.svn/text-base/index.php.svn-base
@@ -0,0 +1,16 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+header('Location: GUI/index.php');
+exit(0);
+?>
\ No newline at end of file
diff --git a/.svn/wcprops/Converter.php.svn-work b/.svn/wcprops/Converter.php.svn-work
new file mode 100644
index 0000000..3764228
--- /dev/null
+++ b/.svn/wcprops/Converter.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Converter.php
+END
diff --git a/.svn/wcprops/README.svn-work b/.svn/wcprops/README.svn-work
new file mode 100644
index 0000000..5cea925
--- /dev/null
+++ b/.svn/wcprops/README.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/README
+END
diff --git a/.svn/wcprops/cli.php.svn-work b/.svn/wcprops/cli.php.svn-work
new file mode 100644
index 0000000..50d52b9
--- /dev/null
+++ b/.svn/wcprops/cli.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/cli.php
+END
diff --git a/.svn/wcprops/index.php.svn-work b/.svn/wcprops/index.php.svn-work
new file mode 100644
index 0000000..bb2d002
--- /dev/null
+++ b/.svn/wcprops/index.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/index.php
+END
diff --git a/Converter.php b/Converter.php
new file mode 100644
index 0000000..2abb901
--- /dev/null
+++ b/Converter.php
@@ -0,0 +1,936 @@
+ext/mysqli Converter
+*
+* @category Converter
+* @package MySQLConverterTool
+* @author Andrey Hristov , Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Converter {
+
+ //
+ // protected
+ //
+
+ /**
+ * Scanner state constant
+ *
+ * @const
+ * @access protected
+ */
+ const STATE_NORMAL = 'normal_state';
+
+
+ /**
+ * Scanner state constant
+ *
+ * @const
+ * @access protectd
+ */
+ const STATE_FUNC_FOUND = 'func_found';
+
+
+ /**
+ * Scanner state constant
+ *
+ * @const
+ * @access protected
+ */
+ const STATE_PARAM_LIST = 'parameter_list';
+
+
+ /**
+ * Converted (= resulting) source code
+ *
+ * @var string
+ */
+ protected $output = '';
+
+
+ /**
+ * List of errors which occured during the conversion
+ *
+ * @var array
+ */
+ protected $errors = array();
+
+
+ /**
+ * List of PHP token
+ *
+ * @var string
+ */
+ protected $tokens = array();
+
+
+ /**
+ * Mapping of ext/mysql -> ext/mysqli constants
+ *
+ */
+ protected $mysql_ext_consts = array(
+ 'MYSQL_CLIENT_COMPRESS' => 'MYSQLI_CLIENT_COMPRESS',
+ 'MYSQL_CLIENT_IGNORE_SPACE' => 'MYSQLI_CLIENT_IGNORE_SPACE',
+ 'MYSQL_CLIENT_INTERACTIVE' => 'MYSQLI_CLIENT_INTERACTIVE',
+ 'MYSQL_CLIENT_SSL' => 'MYSQLI_CLIENT_SSL',
+ 'MYSQL_ASSOC' => 'MYSQLI_ASSOC',
+ 'MYSQL_BOTH' => 'MYSQLI_BOTH',
+ 'MYSQL_NUM' => 'MYSQLI_NUM',
+ );
+
+
+ /**
+ * Number of functions found in the given source
+ *
+ * @var int
+ */
+ protected $funcs_found = 0;
+
+
+ /**
+ * Number of functions converted in the given source
+ *
+ * @var int
+ */
+ protected $funcs_converted = 0;
+
+
+ /**
+ * List of functions that are not supported
+ *
+ * @var array
+ */
+ protected $mysql_funcs_not_supported = array(
+ // rewrite the ugly mysql_result calls manually!
+ 'mysql_result' => true,
+ // whatever that function is...
+ 'mysql_fetch_field2' => true,
+ );
+
+
+ /**
+ * List of functions that can be converted
+ *
+ * Acts as kind of a function pointer list, but with objects
+ *
+ * @var array
+ */
+ protected $mysql_funcs = array();
+
+
+ /**
+ * Flag: enable token debug output?
+ *
+ * @var bool
+ */
+ protected $debug_dump_tokens = false;
+
+
+ /**
+ * Flag: enable parameter parsing debug output?
+ *
+ * @var bool
+ */
+ protected $debug_dump_params = false;
+
+
+ /**
+ * Current line number during the parsing process
+ *
+ * @var int
+ */
+ protected $lineno = 0;
+
+
+ //
+ // public
+ //
+
+
+ /**
+ *
+ *
+ * @param bool Turn on debug output of scanner token?
+ * @param bool Turn on debug output of function parameters?
+ */
+ public function __construct($debug_token = false, $debug_params = false) {
+
+ if (!function_exists('token_name')) {
+ // HACK FIXME
+ die('ext/tokenizer is needed!\n');
+ }
+
+ if (!defined('T_ML_COMMENT'))
+ define('T_ML_COMMENT', T_COMMENT);
+
+ if (!defined('T_DOC_COMMENT'))
+ define('T_DOC_COMMENT', T_ML_COMMENT);
+
+ if (!defined('T_SIMPLE_TOKEN'))
+ define('T_SIMPLE_TOKEN', 32567);
+
+ $this->debug_dump_tokens = $debug_token;
+ $this->debug_dump_params = $debug_params;
+
+ $this->mysql_funcs =
+ array(
+ // PHP_FALIAS(mysql, mysql_db_query, NULL)
+ 'mysql' => new MySQLConverterTool_Function_DBQuery(),
+ // in OO this is a property
+ 'mysql_affected_rows' => new MySQLConverterTool_Function_ConnParam('mysqli_affected_rows'),
+ 'mysql_change_user' => new MySQLConverterTool_Function_ChangeUser(),
+ 'mysql_client_encoding' => new MySQLConverterTool_Function_ConnParam('mysqli_character_set_name'),
+ 'mysql_close' => new MySQLConverterTool_Function_ConnParamBool('mysqli_close'),
+ // pconnect has less params but they are not significant for mysqli_connect
+ 'mysql_connect' => new MySQLConverterTool_Function_Connect(),
+ // PHP_FALIAS(mysql_createdb, mysql_create_db, NULL)
+ 'mysql_createdb' => new MySQLConverterTool_Function_CreateDB(),
+ 'mysql_create_db' => new MySQLConverterTool_Function_CreateDB(),
+ 'mysql_data_seek' => new MySQLConverterTool_Function_Generic('mysqli_data_seek'),
+ 'mysql_dbname' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_db_name' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_db_query' => new MySQLConverterTool_Function_DBQuery(),
+ // PHP_FALIAS(mysql_dropdb, mysql_drop_db, NULL)
+ 'mysql_dropdb' => new MySQLConverterTool_Function_DropDB(),
+ 'mysql_drop_db' => new MySQLConverterTool_Function_DropDB(),
+ // in OO this is a property
+ 'mysql_error' => new MySQLConverterTool_Function_Error('mysqli_error'),
+ // in OO this is a property
+ 'mysql_errno' => new MySQLConverterTool_Function_Error('mysqli_errno'),
+ 'mysql_escape_string' => new MySQLConverterTool_Function_EscapeString('mysqli_real_escape_string'),
+ 'mysql_fetch_array' => new MySQLConverterTool_Function_Generic('mysqli_fetch_array'),
+ 'mysql_fetch_assoc' => new MySQLConverterTool_Function_Generic('mysqli_fetch_assoc'),
+ 'mysql_fetch_field' => new MySQLConverterTool_Function_FetchField(),
+ 'mysql_fetch_lengths' => new MySQLConverterTool_Function_GenericBoolean('mysqli_fetch_lengths'),
+ 'mysql_fetch_object' => new MySQLConverterTool_Function_Generic('mysqli_fetch_object'),
+ 'mysql_fetch_row' => new MySQLConverterTool_Function_Generic('mysqli_fetch_row'),
+ // PHP_FALIAS(mysql_fieldflags, mysql_field_flags, NULL)
+ 'mysql_fieldflags' => new MySQLConverterTool_Function_FieldFlags(),
+ 'mysql_field_flags' => new MySQLConverterTool_Function_FieldFlags(),
+ // PHP_FALIAS(mysql_fieldlen, mysql_field_len, NULL)
+ 'mysql_fieldlen' => new MySQLConverterTool_Function_FieldLen(),
+ 'mysql_field_len' => new MySQLConverterTool_Function_FieldLen(),
+ // PHP_FALIAS(mysql_fieldname, mysql_field_name, NULL)
+ 'mysql_fieldname' => new MySQLConverterTool_Function_FieldName(),
+ 'mysql_field_name' => new MySQLConverterTool_Function_FieldName(),
+ 'mysql_field_seek' => new MySQLConverterTool_Function_GenericBoolean('mysqli_field_seek'),
+ // PHP_FALIAS(mysql_fieldtable, mysql_field_table, NULL)
+ 'mysql_fieldtable' => new MySQLConverterTool_Function_FieldTable(),
+ 'mysql_field_table' => new MySQLConverterTool_Function_FieldTable(),
+ // PHP_FALIAS(mysql_fieldtype, mysql_field_type, NULL)
+ 'mysql_fieldtype' => new MySQLConverterTool_Function_FieldType(),
+ 'mysql_field_type' => new MySQLConverterTool_Function_FieldType(),
+ // PHP_FALIAS(mysql_freeresult, mysql_free_result, NULL)
+ 'mysql_freeresult' => new MySQLConverterTool_Function_FreeResult(),
+ 'mysql_free_result' => new MySQLConverterTool_Function_FreeResult(),
+ 'mysql_get_client_info' => new MySQLConverterTool_Function_Generic('mysqli_get_client_info'),
+ // in OO this is a property
+ 'mysql_get_host_info' => new MySQLConverterTool_Function_ConnParamBool('mysqli_get_host_info'),
+ // in OO this is a property
+ 'mysql_get_proto_info' => new MySQLConverterTool_Function_ConnParamBool('mysqli_get_proto_info'),
+ // in OO this is a property
+ 'mysql_get_server_info' => new MySQLConverterTool_Function_ConnParamBool('mysqli_get_server_info'),
+ 'mysql_info' => new MySQLConverterTool_Function_ConnParam('mysqli_info'),
+ 'mysql_insert_id' => new MySQLConverterTool_Function_ConnParamBool('mysqli_insert_id'),
+ // PHP_FALIAS(mysql_listdbs, mysql_list_dbs, NULL)
+ 'mysql_listdbs' => new MySQLConverterTool_Function_ListDBs(),
+ 'mysql_list_dbs' => new MySQLConverterTool_Function_ListDBs(),
+ // PHP_FALIAS(mysql_listfields, mysql_list_fields, NULL)
+ 'mysql_listfields' => new MySQLConverterTool_Function_ListFields(),
+ 'mysql_list_fields' => new MySQLConverterTool_Function_ListFields(),
+ 'mysql_list_processes' => new MySQLConverterTool_Function_ListProcesses(),
+ // PHP_FALIAS(mysql_listtables, mysql_list_tables, NULL)
+ 'mysql_listtables' => new MySQLConverterTool_Function_ListTables(),
+ 'mysql_list_tables' => new MySQLConverterTool_Function_ListTables(),
+ // PHP_FALIAS(mysql_numfields, mysql_num_fields, NULL)
+ 'mysql_numfields' => new MySQLConverterTool_Function_Generic('mysqli_num_fields'),
+ // in OO this is a property
+ 'mysql_num_fields' => new MySQLConverterTool_Function_GenericBoolean('mysqli_num_fields'),
+ // PHP_FALIAS(mysql_numrows, mysql_num_rows, NULL)
+ 'mysql_numrows' => new MySQLConverterTool_Function_Generic('mysqli_num_rows'),
+ // in OO this is a property
+ 'mysql_num_rows' => new MySQLConverterTool_Function_Generic('mysqli_num_rows'),
+ // pconnect has less params but they are not significant for mysqli_connect
+ 'mysql_pconnect' => new MySQLConverterTool_Function_Connect(),
+ 'mysql_ping' => new MySQLConverterTool_Function_ConnParam('mysqli_ping'),
+ 'mysql_query' => new MySQLConverterTool_Function_ParReversed('mysqli_query'),
+ 'mysql_real_escape_string' => new MySQLConverterTool_Function_RealEscapeString('mysqli_real_escape_string'),
+ // mysql_result -- Get result data
+ // PHP_FALIAS(mysql_selectdb, mysql_select_db, NULL)
+ 'mysql_selectdb' => new MySQLConverterTool_Function_SelectDB(),
+ 'mysql_select_db' => new MySQLConverterTool_Function_SelectDB(),
+ 'mysql_stat' => new MySQLConverterTool_Function_ConnParam('mysqli_stat'),
+ 'mysql_tablename' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_table_name' => new MySQLConverterTool_Function_Tablename(),
+ 'mysql_thread_id' => new MySQLConverterTool_Function_ConnParam('mysqli_thread_id'),
+ 'mysql_unbuffered_query' => new MySQLConverterTool_Function_UnbufferedQuery(),
+ );
+
+ } // end func __construct
+
+
+
+ /**
+ * Converts the given source code
+ *
+ * @param string Source code to be converted
+ * @return array Converted source code and status information
+ */
+ public function convertString($source) {
+
+ $this->lineno = 0;
+ $this->output = '';
+ $this->tokens = token_get_all($source);
+ $this->errors = array();
+ $this->lineno = 1;
+
+ $this->funcs_found = 0;
+ $this->funcs_converted = 0;
+
+ $this->scanner(0);
+
+ return array(
+ 'output' => $this->output,
+ 'found' => $this->funcs_found,
+ 'converted' => $this->funcs_converted,
+ 'errors' => $this->errors,
+ );
+ } // end func convertString
+
+
+ /**
+ * Reads a file and returns the converted source code
+ *
+ * @param strng filename
+ * @param array Converted source and status information
+ */
+ public function convertFile($filename) {
+
+ if (!file_exists($filename) || !is_readable($filename) || !is_file($filename)) {
+ $ret = $this->convertString('');
+ $ret['errors'][] = array('line' => -1, 'msg' => 'Cannot open file "' . $filename . '".');
+ return $ret;
+ }
+
+ return $this->convertString(file_get_contents($filename));
+ }
+
+
+ /**
+ * Returns all files of a directory that have a certain name
+ *
+ *
+ */
+ public function getFilesOfDirectory($dir, $file_pattern = '*', Array $files = array()) {
+
+ if (!is_dir($dir) || !is_readable($dir))
+ return $files;
+
+ $patterns = $this->buildRegularExpression($file_pattern);
+ if (empty($patterns))
+ return $files;
+
+ $dh = opendir($dir);
+ if (!$dh)
+ return $files;
+
+ while ($file = readdir($dh)) {
+ if ('.' == $file || '..' == $file)
+ continue;
+
+ $ffile = $dir . '/' . $file;
+ if (is_dir($ffile))
+ $files = $this->getFilesOfDirectory($ffile, $file_pattern, $files);
+
+ if (!is_file($ffile))
+ continue;
+
+ $accept = false;
+ foreach ($patterns as $k => $pattern) {
+ if (preg_match('@' . $pattern . '$@i', $file)) {
+ $accept = true;
+ break;
+ }
+ }
+
+ if ($accept)
+ $files[] = $ffile;
+ }
+ closedir($dh);
+
+ return $files;
+ }
+
+
+ /**
+ * Unsets the variable which stores the global (default) connection of ext/mysql
+ *
+ * This is a hack required by the test framework.
+ *
+ */
+ public function unsetGlobalConnection() {
+
+ $obj = new MySQLConverterTool_Function_Generic('mysqli_query');
+ eval(sprintf('@mysqli_close(%s);', $obj->ston_name));
+ eval(sprintf('if (isset(%s)) unset(%s);', $obj->ston_name, $obj->ston_name));
+
+ }
+
+
+ /**
+ * Returns a list of functions that can be converted automatically
+ *
+ * @return array
+ */
+ public function getSupportedFunctions() {
+
+ $ret = array_keys($this->mysql_funcs);
+ sort($ret);
+
+ return $ret;
+ }
+
+
+ /**
+ * Returns a list of functions that cannot be converted automatically
+ *
+ * @return array
+ */
+ public function getUnsupportedFunctions() {
+
+ $ret = array_keys($this->mysql_funcs_not_supported);
+ sort($ret);
+
+ return $ret;
+ }
+
+ //
+ // protected
+ //
+
+
+ /**
+ * Scans the source and rebuilds a converted version of it
+ *
+ * @param int
+ */
+ protected function scanner($level) {
+
+ // current parser state
+ $state = self::STATE_NORMAL;
+
+ // list of function parameters
+ $func_params = array();
+ // current parameter value
+ $curr_param = '';
+ // current bracket nesting level
+ $bracket_level = 0;
+ // name of the currently processed function
+ $func_name = '';
+ // flag: does the currently parameter contain variables or constants?
+ $param_dynamic = false;
+ // flag for something that looks like a mysql_func call but is not followed by parameters
+ $expect_param_brace_open = false;
+
+
+ while (list( , $token) = each($this->tokens)) {
+
+ if (is_string($token)) {
+ $id = T_SIMPLE_TOKEN;
+ $token_name = 'T_SIMPLE_TOKEN';
+ $text = $token;
+ } else {
+ list($id, $text) = $token;
+ $token_name = token_name($id);
+ }
+
+ // remember the current line number
+ $lineno = $this->lineno;
+ $this->lineno += $this->countLines($text);
+
+ if ($this->debug_dump_tokens) {
+
+ $this->debug_print('dump token',
+ sprintf("[%-05d - %10s - %d - %-10s - %03d - %05d] %s",
+ $lineno,
+ $token_name,
+ $expect_param_brace_open,
+ $state,
+ $bracket_level,
+ strlen($text),
+ htmlspecialchars($text))
+ );
+
+ }
+
+ switch ($id) {
+
+ case T_COMMENT:
+ case T_ML_COMMENT:
+ case T_DOC_COMMENT:
+
+ switch ($state) {
+ case self::STATE_NORMAL:
+ $this->output .= $text;
+ break;
+
+ case self::STATE_FUNC_FOUND:
+ // comment between func_name and comma
+ break;
+
+ case self::STATE_PARAM_LIST:
+ $curr_param .= $text;
+ break;
+ }
+
+ break;
+
+ case T_SIMPLE_TOKEN:
+
+ switch ($state) {
+
+ case self::STATE_NORMAL:
+ $this->output .= $text;
+ break;
+
+ case self::STATE_FUNC_FOUND:
+
+ switch ($text) {
+ case '(':
+ $state = self::STATE_PARAM_LIST;
+ $func_params = array();
+ $curr_param = NULL;
+ $param_dynamic = false;
+ $expect_param_brace_open = false;
+ break;
+
+ case ')':
+ default:
+ if ($expect_param_brace_open) {
+ // something that looks like is not followed by an opening brace for
+ $state = self::STATE_NORMAL;
+ $this->funcs_found--;
+ $expect_param_brace_open = 0;
+ $steps = 0;
+ $tmp = '';
+ while (($token = prev($this->tokens)) && ($tmp != $func_name)) {
+ if (is_array($token)) {
+ $tmp = $token[1];
+ } else {
+ $tmp = $token;
+ }
+ $steps++;
+ }
+ while ($steps-- > 1) {
+ $token = next($this->tokens);
+ if (is_array($token))
+ $tmp = $token[1];
+ else
+ $tmp = $token;
+ $this->output .= $tmp;
+ }
+ next($this->tokens);
+ break 3;
+ }
+ break;
+ }
+ break;
+
+ case self::STATE_PARAM_LIST:
+
+ switch ($text) {
+ case ',':
+ if ($bracket_level == 1) {
+ $func_params[] = array('value' => $curr_param, 'dynamic' => $param_dynamic);
+ $curr_param = '';
+ $param_dynamic = false;
+ } else {
+ $curr_param .= $text;
+ }
+ // don't add to the curr_param
+ break(2);
+
+ case '(':
+ $bracket_level++;
+ break;
+
+ case ')':
+ $bracket_level--;
+ if ($bracket_level == 0) {
+ // end of the parameter specification
+
+ if (!is_null($curr_param))
+ $func_params[] = array('value' => $curr_param, 'dynamic' => $param_dynamic);
+
+ $curr_param = NULL;
+ $param_dynamic = false;
+ $state = self::STATE_NORMAL;
+
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ array('name' => $func_name, 'params' => $func_params)
+ );
+ }
+
+ if (!$level) {
+
+ list($handler_warning, $handler_code) = $this->mysql_funcs[$func_name]->handle($func_params);
+ if (!is_null($handler_warning))
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] %s', $lineno, $handler_warning));
+
+ if (is_null($handler_code)) {
+ $this->output .= $this->rebuildFunctionCode($func_name, $func_params, $handler_warning);
+ } else {
+ $this->funcs_converted++;
+ $this->output .= $handler_code;
+ }
+
+ } else {
+ // we are in recursive call - return
+
+ list($handler_warning, $handler_code) = $this->mysql_funcs[$func_name]->handle($func_params);
+ if (!is_null($handler_warning))
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] %s', $lineno, $handler_warning));
+
+ if (is_null($handler_code)) {
+ return $this->rebuildFunctionCode($func_name, $func_params, $handler_warning);
+ } else {
+ $this->funcs_converted++;
+ return $handler_code;
+ }
+
+ }
+
+ }
+ break;
+
+ case '.':
+ case '&':
+ case '^':
+ case '|':
+ case '&&':
+ case '||':
+ case 'and':
+ case 'or':
+ case 'xor':
+ case '<<':
+ case '>>':
+ case '<':
+ case '<=':
+ case '>':
+ case '>=':
+ case '=':
+ case '*':
+ case '/':
+ case '%':
+ case '+':
+ case '-':
+ case '++':
+ case '--':
+ case '!':
+ case '~':
+ case '=':
+ case '+=':
+ case '-=':
+ case '*=':
+ case '/=':
+ case '.=':
+ case '%=':
+ case '&=':
+ case '|=':
+ case '^=':
+ case '<<=':
+ case '>>=':
+ case '?':
+ case '==':
+ case '!=':
+ case '===':
+ case '!==':
+ case '(':
+ case 'new':
+ // forget it - this parameter value is build dynamically
+ // we won't try to guess it's value using static code analysis
+ // this needs to be checked manually
+ $param_dynamic = true;
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ 'Operator found in parameter. Assuming that the paramter value will be dynamic and cannot be foreseen.'
+ );
+ }
+ break;
+ }
+
+ $curr_param .= $text;
+ break;
+ }
+ break;
+
+ case T_STRING:
+
+ if (isset($this->mysql_ext_consts[$text])) {
+
+ $text = $this->mysql_ext_consts[$text];
+
+ } else {
+
+ switch ($state) {
+ case self::STATE_PARAM_LIST:
+ // maybe a function call or constant as part of a parameter value?
+
+ if (isset($this->mysql_funcs_not_supported[$text])) {
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] Function "%s" is not supported for conversion! You must rewrite the converted code. The conversion is not complete. Consider rewriting your code first and rerunning the conversion tool"', $lineno, $text));
+
+ }
+
+ if (isset($this->mysql_funcs[$text])) {
+ // return the current token and reparse it
+ prev($this->tokens);
+ // in the default of the outter switch add this to $curr_param
+ $text = $this->scanner($level + 1);
+ $param_dynamic = true;
+ }
+ // fall to default
+ break;
+
+ case self::STATE_FUNC_FOUND:
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] We found a string between the function name "%s" and the parameter list. Looks like a syntax error in the source file. Please check!', $lineno, $func_name));
+
+ break;
+
+ case self::STATE_NORMAL:
+ default:
+
+ if (isset($this->mysql_funcs_not_supported[$text])) {
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] Function "%s" is not supported for conversion! You must rewrite the converted code code. The conversion is not complete. Consider rewriting your code first and rerunning the conversion tool."', $lineno, $text));
+
+ }
+
+ if (isset($this->mysql_funcs[$text])) {
+ $state = self::STATE_FUNC_FOUND;
+ $func_name = $text;
+ $bracket_level = 1;
+ $this->funcs_found++;
+ $expect_param_brace_open = true;
+
+ break(2);
+ }
+
+ if ($text == 'is_resource') {
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] You are using is_resource(). Make sure that you do not use it to test for the return value of mysql_query(). mysql_query() returns a resource or a boolean value. mysqli_query() returns an object or a boolean value. If you check the return value of mysql_query like < if (is_resource($res = mysql_query())) [...] > the converted code will fail, because $res will be an object in ext/mysqli."', $lineno, $text));
+ }
+ // here we fall-through
+ }
+ }
+
+
+ default:
+
+ if ($id === T_CONSTANT_ENCAPSED_STRING) {
+ /* try to detect function_exists('some_mysql_func'); */
+ $prev_steps = 0;
+
+ if (isset($this->mysql_funcs[substr($text, 1, -1)]) &&
+ $this->mysql_funcs[substr($text, 1, -1)]->new_name) {
+ // strip quotes
+ // move back because now 'some_mysql_func' will be returned by prev()
+ $prev_steps = 1;
+ $tmp_token = prev($this->tokens);
+
+ do {
+ $tmp_token = prev($this->tokens);
+ $prev_steps++;
+ } while ($tmp_token[0] === T_WHITESPACE);
+
+ if ($tmp_token === '(') {
+
+ $tmp_token = prev($this->tokens);
+ $prev_steps++;
+
+ if ($tmp_token[0] === T_STRING &&
+ $tmp_token[1] === 'function_exists') {
+
+ $text = $text[0] . $this->mysql_funcs[substr($text, 1, -1)]->new_name . $text[0];
+ }
+
+ }
+
+ while ($prev_steps--)
+ each($this->tokens);
+ }
+ }
+
+ switch ($state) {
+ case self::STATE_PARAM_LIST:
+
+ switch ($id) {
+
+ case T_VARIABLE:
+ case T_FUNCTION:
+ case T_CONST:
+ // this is a variable, we cannot guess value of the parameter
+ // using this static conversion approach
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ "Adding variable '$text' to current parameter."
+ );
+ }
+ $param_dynamic = true;
+ $curr_param .= $text;
+ break;
+
+ case T_WHITESPACE:
+ default:
+ if ($this->debug_dump_params) {
+ $this->debug_print(
+ 'params',
+ "Adding '$text' to current parameter."
+ );
+ }
+
+ $curr_param .= $text;
+ break;
+ }
+ break;
+
+ case self::STATE_FUNC_FOUND:
+
+ $this->errors[] = array('line' => $lineno, 'msg' => sprintf('[Line %d] Please check your code for parse errors, we failed to parse "%s". Conversion will be incomplete!".', $lineno, $text));
+ break;
+
+ default:
+ case self::STATE_NORMAL:
+ $this->output .= $text;
+ break;
+ }
+ break;
+ }
+
+ }
+
+ }
+
+
+ /**
+ * Print a debug message
+ *
+ * @param string Message prefix
+ * @param mixed Array or literal to print
+ */
+ protected function debug_print($prefix, $var) {
+
+ if (is_scalar($var)) {
+ printf("[%s/%s] %s\n",
+ get_class($this),
+ $prefix,
+ $var);
+ } else {
+ printf("[%s/%s] ", get_class($this), $prefix);
+ var_dump($var);
+ printf("\n");
+ }
+
+
+ } // end func debug_print
+
+
+ /**
+ * Returns the number of lines of a string
+ *
+ * @param string
+ * @return int
+ */
+ protected function countLines($text) {
+
+ $last_pos = 0;
+ $lines = 0;
+ while (($pos = strpos($text, "\n", $last_pos)) !== FALSE) {
+ $last_pos = $pos + 1;
+ $lines++;
+ }
+
+ return $lines;
+ }
+
+
+ /**
+ * Rebuilds the original function code based on function name and parameters and adds a comment with a warning after the last parameter
+ *
+ * @param string
+ * @param array
+ * @param string
+ */
+ protected function rebuildFunctionCode($name, $params, $warning) {
+
+ $ret = $name . '(';
+ if (count($params) > 0) {
+ foreach ($params as $k => $param)
+ $ret .= $param['value'] . ', ';
+ $ret = substr($ret, 0, -2);
+ }
+ $ret .= ')';
+ // $ret .= ' /* [MySQLConverterTool] ' . $warning . '*/)';
+
+ return $ret;
+ }
+
+
+
+ /**
+ * Expands a user specified file pattern with * as the only pattern to a regular expression
+ *
+ * @param string
+ * @return array
+ */
+ protected function buildRegularExpression($file_pattern) {
+
+ $parts = explode(',', $file_pattern);
+ if (empty($parts))
+ return array();
+
+ $ret = array();
+ foreach ($parts as $k => $v)
+ $ret[] = str_replace('\*', '.*', preg_quote($v, '@'));
+
+ return $ret;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/README.txt b/Function/.svn/README.txt
new file mode 100644
index 0000000..271a8ce
--- /dev/null
+++ b/Function/.svn/README.txt
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
diff --git a/Function/.svn/dir-wcprops b/Function/.svn/dir-wcprops
new file mode 100644
index 0000000..9ca8be1
--- /dev/null
+++ b/Function/.svn/dir-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svnpublic/mysqli_converter/!svn/ver/11/MySQLConverterTool/Function
+END
diff --git a/Function/.svn/empty-file b/Function/.svn/empty-file
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/entries b/Function/.svn/entries
new file mode 100644
index 0000000..e235a09
--- /dev/null
+++ b/Function/.svn/entries
@@ -0,0 +1,257 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Function/.svn/format b/Function/.svn/format
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/Function/.svn/format
@@ -0,0 +1 @@
+4
diff --git a/Function/.svn/prop-base/ChangeUser.php.svn-base b/Function/.svn/prop-base/ChangeUser.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ConnParam.php.svn-base b/Function/.svn/prop-base/ConnParam.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ConnParamBool.php.svn-base b/Function/.svn/prop-base/ConnParamBool.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/Connect.php.svn-base b/Function/.svn/prop-base/Connect.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/CreateDB.php.svn-base b/Function/.svn/prop-base/CreateDB.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/DBQuery.php.svn-base b/Function/.svn/prop-base/DBQuery.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/DropDB.php.svn-base b/Function/.svn/prop-base/DropDB.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/Error.php.svn-base b/Function/.svn/prop-base/Error.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/EscapeString.php.svn-base b/Function/.svn/prop-base/EscapeString.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FetchField.php.svn-base b/Function/.svn/prop-base/FetchField.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FieldFlags.php.svn-base b/Function/.svn/prop-base/FieldFlags.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FieldLen.php.svn-base b/Function/.svn/prop-base/FieldLen.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FieldName.php.svn-base b/Function/.svn/prop-base/FieldName.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FieldTable.php.svn-base b/Function/.svn/prop-base/FieldTable.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FieldType.php.svn-base b/Function/.svn/prop-base/FieldType.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/FreeResult.php.svn-base b/Function/.svn/prop-base/FreeResult.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/Generic.php.svn-base b/Function/.svn/prop-base/Generic.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/GenericBoolean.php.svn-base b/Function/.svn/prop-base/GenericBoolean.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ListDBs.php.svn-base b/Function/.svn/prop-base/ListDBs.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ListFields.php.svn-base b/Function/.svn/prop-base/ListFields.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ListProcesses.php.svn-base b/Function/.svn/prop-base/ListProcesses.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ListTables.php.svn-base b/Function/.svn/prop-base/ListTables.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/ParReversed.php.svn-base b/Function/.svn/prop-base/ParReversed.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/RealEscapeString.php.svn-base b/Function/.svn/prop-base/RealEscapeString.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/SelectDB.php.svn-base b/Function/.svn/prop-base/SelectDB.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/Tablename.php.svn-base b/Function/.svn/prop-base/Tablename.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/prop-base/UnbufferedQuery.php.svn-base b/Function/.svn/prop-base/UnbufferedQuery.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ChangeUser.php.svn-work b/Function/.svn/props/ChangeUser.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ConnParam.php.svn-work b/Function/.svn/props/ConnParam.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ConnParamBool.php.svn-work b/Function/.svn/props/ConnParamBool.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/Connect.php.svn-work b/Function/.svn/props/Connect.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/CreateDB.php.svn-work b/Function/.svn/props/CreateDB.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/DBQuery.php.svn-work b/Function/.svn/props/DBQuery.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/DropDB.php.svn-work b/Function/.svn/props/DropDB.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/Error.php.svn-work b/Function/.svn/props/Error.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/EscapeString.php.svn-work b/Function/.svn/props/EscapeString.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FetchField.php.svn-work b/Function/.svn/props/FetchField.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FieldFlags.php.svn-work b/Function/.svn/props/FieldFlags.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FieldLen.php.svn-work b/Function/.svn/props/FieldLen.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FieldName.php.svn-work b/Function/.svn/props/FieldName.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FieldTable.php.svn-work b/Function/.svn/props/FieldTable.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FieldType.php.svn-work b/Function/.svn/props/FieldType.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/FreeResult.php.svn-work b/Function/.svn/props/FreeResult.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/Generic.php.svn-work b/Function/.svn/props/Generic.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/GenericBoolean.php.svn-work b/Function/.svn/props/GenericBoolean.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ListDBs.php.svn-work b/Function/.svn/props/ListDBs.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ListFields.php.svn-work b/Function/.svn/props/ListFields.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ListProcesses.php.svn-work b/Function/.svn/props/ListProcesses.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ListTables.php.svn-work b/Function/.svn/props/ListTables.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/ParReversed.php.svn-work b/Function/.svn/props/ParReversed.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/RealEscapeString.php.svn-work b/Function/.svn/props/RealEscapeString.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/SelectDB.php.svn-work b/Function/.svn/props/SelectDB.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/Tablename.php.svn-work b/Function/.svn/props/Tablename.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/props/UnbufferedQuery.php.svn-work b/Function/.svn/props/UnbufferedQuery.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/Function/.svn/text-base/ChangeUser.php.svn-base b/Function/.svn/text-base/ChangeUser.php.svn-base
new file mode 100644
index 0000000..23def8e
--- /dev/null
+++ b/Function/.svn/text-base/ChangeUser.php.svn-base
@@ -0,0 +1,91 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ChangeUser extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_change_user';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_change_user ( string user, string password [, string database [, resource link_identifier]] )
+ // mysqli_change_user ( mysqli link, string user, string password, string database )
+
+ $warning = NULL;
+
+ if (4 == count($params)) {
+
+ list($user, $pass, $db, $conn) = $this->extractParamValues($params);
+ $ret = "mysqli_change_user($conn, $user, $pass, $db)";
+
+ } else if (3 == count($params)) {
+
+ list($user, $pass, $db) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+ $ret = "mysqli_change_user($conn, $user, $pass, $db)";
+
+ } else if (2 == count($params)) {
+
+ list($user, $pass) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+
+ // [1] $res = mysqli_query(conn, 'SELECT DATABASE()')
+ // [2] $row = mysqli_fetch_row($res);
+ // [3] $row = array_shift($row);
+ // [4] unset($row);
+ // [5] mysqli_free_result($res);
+ // [6] unset($res);
+ // [7] mysqli_change_user(conn, user, pass, $db)
+ //
+ // [1] ( ($res = mysqli_query() ) ? $db : false
+ // [2] ( ($res = mysqli_query() && row = mysqli_fetch_row($res)) ? $db : false
+ // [3] ( ($res = mysqli_query() && row = mysqli_fetch_row($res) && ((row = array_shift(row)) !== false) ) ? true : false
+ // [5] ( ($res = mysqli_query() && row = mysqli_fetch_row($res) && ((row = array_shift(row)) !== false) ) && mysqli_free_result(res) ) ? true : false
+ // [7] ( ($res = mysqli_query() && row = mysqli_fetch_row($res) && ((row = array_shift(row)) !== false) ) && mysqli_free_result(res) ) ? mysqli_change_user(conn, user, pass, $row) : false
+
+
+ $ret = '( ';
+ $ret.= '( ';
+ $ret.= '($___mysqli_res = mysqli_query(' . $conn . ', "SELECT DATABASE()")) && ';
+ $ret.= '($___mysqli_tmp = mysqli_fetch_row($___mysqli_res)) && ';
+ $ret.= '(($___mysqli_tmp = array_shift($___mysqli_tmp)) !== false) && ';
+ $ret.= '(mysqli_free_result($___mysqli_res)) ';
+ $ret.= ') ? ';
+ $ret.= sprintf('mysqli_change_user(%s, %s, %s, $___mysqli_tmp) : ', $conn, $user, $pass);
+ $ret.= 'false ';
+ $ret.= ')';
+
+ } else {
+
+ $warning = self::PARSE_ERROR_WRONG_PARAMS;
+ $ret = NULL;
+
+ }
+
+ return array($warning, $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'mysql_change_user() can be translated into mysqli_change_user if the database is given. If not, it must be emulated using mysqli_query() and SELECT DATABASE() - which looks a bit like a hack.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ConnParam.php.svn-base b/Function/.svn/text-base/ConnParam.php.svn-base
new file mode 100644
index 0000000..643dfac
--- /dev/null
+++ b/Function/.svn/text-base/ConnParam.php.svn-base
@@ -0,0 +1,36 @@
+ mysqli_func(resource)
+*
+* @category Functions
+* @package MySQLConverterTool
+* @author Andrey Hristov , Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ConnParam extends MySQLConverterTool_Function_Generic {
+
+ function handle(Array $params = array()) {
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, "$this->new_name($conn)");
+ }
+
+ function getConversionHint() {
+
+ return 'Generic class for all functions that look like mysql_foo([]) -> mysqli_bar()';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ConnParamBool.php.svn-base b/Function/.svn/text-base/ConnParamBool.php.svn-base
new file mode 100644
index 0000000..bd8e145
--- /dev/null
+++ b/Function/.svn/text-base/ConnParamBool.php.svn-base
@@ -0,0 +1,37 @@
+ ((bool)mysqli_func(resource))
+*
+* @category Functions
+* @package MySQLConverterTool
+* @author Andrey Hristov , Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ConnParamBool extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, '((is_null($___mysqli_res = ' . $this->new_name . '(' . $conn . '))) ? false : $___mysqli_res)');
+ }
+
+ function getConversionHint() {
+
+ return 'Generic class for all functions that look like mysql_foo([]) -> ((bool)mysqli_bar())';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/Connect.php.svn-base b/Function/.svn/text-base/Connect.php.svn-base
new file mode 100644
index 0000000..b841235
--- /dev/null
+++ b/Function/.svn/text-base/Connect.php.svn-base
@@ -0,0 +1,203 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_Connect extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_connect';
+
+
+ public function __construct() {
+ }
+
+ function handle(Array $params = array()) {
+ static $last_params = array();
+
+ /*
+ Known deficiencies:
+ - will try to handle unix_socket but not the best solution
+ */
+
+ // mysql_connect ( [string server [, string username [, string password [, bool new_link [, int client_flags]]]]] )
+ // mysql_pconnect ( [string server [, string username [, string password [, int client_flags]]]] )
+ // mysqli_connect ( [string host [, string username [, string passwd [, string dbname [, int port [, string socket]]]]]] )
+
+ $warning = NULL;
+ $socket = NULL;
+ $port = NULL;
+
+ @list($server, $user, $password, $new_link, $client_flags) = $this->extractParamValues($params);
+ if (!is_null($server)) {
+ if ($params[0]['dynamic']) {
+ $warning = 'Cannot analyze server parameter to extract host, socket and port! Conversion cannot be performed automatically. You must manually check the result of the conversion.';
+ } else {
+ list($server, $socket, $port) = $this->expandServerParam($server);
+ }
+ }
+
+ $found = false;
+ if (is_null($new_link) || ($new_link == false)) {
+ // Maybe someone relies on:
+ // If a second call is made to mysql_connect() with the same arguments,
+ // no new link will be established, but instead, the link identifier of the already
+ // opened link will be returned. The new_link parameter modifies this behavior
+ // and makes mysql_connect() always open a new link, even if mysql_connect()
+ // was called before with the same parameters.
+ // The current converter version cannot catch this. All we can do is throw a warning
+
+ foreach ($last_params as $k => $lparams) {
+ if ($params == $lparams) {
+ $warning .= " You're calling mysql_connect() twice with the same parameters. We don't know for sure if you want a new connection or reuse the old connection. You must check your code.";
+ $found = true;
+ break;
+ }
+ }
+
+ }
+ if (!$found)
+ $last_params[] = $params;
+
+
+ $dbname = 'NULL';
+ $ret = NULL;
+ $num_params = count($params);
+
+ if ($num_params < 5) {
+
+ if (!is_null($socket)) {
+
+ $ret = sprintf('(%s = %s(%s, %s, %s, %s, %d, \'%s\'))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ is_null($user) ? 'NULL' : $user,
+ is_null($password) ? 'NULL' : $password,
+ is_null($dbname) ? 'NULL' : $dbname,
+ is_null($port) ? 'NULL' : $port,
+ $socket);
+ } else {
+
+ if (is_null($server)) {
+ // mysql_connect()
+ $ret = sprintf('(%s = %s())',
+ $this->ston_name,
+ $this->new_name);
+
+ } else if (!is_null($port)) {
+ // port used - no chance to generate pretty code
+
+ $ret = sprintf('(%s = %s(%s, %s, %s, %s, %d))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ is_null($user) ? 'NULL' : $user,
+ is_null($password) ? 'NULL' : $password,
+ is_null($dbname) ? 'NULL' : $dbname,
+ $port
+ );
+
+ } else if (!is_null($password)) {
+
+ // mysql_connect(, , )
+ $ret = sprintf('(%s = %s(%s, %s, %s))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ is_null($user) ? 'NULL' : $user,
+ $password);
+
+ } else if (!is_null($user)) {
+ // mysql_connect(,
+ $ret = sprintf('(%s = %s(%s, %s))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ $user);
+
+ } else {
+ // mysql_connect() but not mysql_connect()
+
+ $ret = sprintf('(%s = %s(%s))',
+ $this->ston_name,
+ $this->new_name,
+ $server);
+
+ }
+
+ }
+
+ } else if ($num_params == 5) {
+
+ $ret = sprintf('(((%s = mysqli_init()) && (mysqli_real_connect(%s, %s, %s, %s, %s, %d, %s, %s))) ? %s : FALSE)',
+ $this->ston_name,
+ $this->ston_name,
+ $server,
+ $user,
+ $password,
+ $dbname,
+ is_null($port) ? 3306 : $port,
+ is_null($socket) ? 'NULL' : $socket,
+ $client_flags,
+ $this->ston_name);
+
+ } else {
+ // too many parameters
+
+ $warning = self::PARSE_ERROR_WRONG_PARAMS;
+ $ret = NULL;
+
+ }
+
+ return array($warning, $ret);
+ }
+
+
+ protected function expandServerParam($server) {
+
+ $socket = NULL;
+ $port = NULL;
+
+ $pos = strpos($server, ':/');
+ if (FALSE !== $pos) {
+ // Unix Socket
+
+ $first_ch = $server[0];
+ $last_ch = substr($server, -1, 1);
+
+ if (($last_ch == '"' || $last_ch == "'") && $last_ch == $first_ch) {
+ $server = substr($server, 1, -1);
+ }
+
+ $socket = substr($server, $pos + 1);
+ $server = '"localhost"';
+
+ } else if (preg_match('/(["\']*)([^:]+):(\d+)/iu', $server, $matches)) {
+ // host:port
+
+ $server = $matches[1] . $matches[2] . $matches[1];
+ $port = $matches[3];
+
+ }
+
+ return array($server, $socket, $port);
+ }
+
+ function getConversionHint() {
+
+ return 'mysql_connect can be mapped to mysqli_connect with some parameter swapping if no client_flags are used. If client_flags are used, mysqli_init()/mysqli_real_connect() are needed.';
+
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/CreateDB.php.svn-base b/Function/.svn/text-base/CreateDB.php.svn-base
new file mode 100644
index 0000000..c474a0b
--- /dev/null
+++ b/Function/.svn/text-base/CreateDB.php.svn-base
@@ -0,0 +1,63 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_CreateDB extends MySQLConverterTool_Function_Generic {
+
+
+ // not used, but anyway
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_create_db ( string database_name [, resource link_identifier] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+
+ if ('const' == $db_type) {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "CREATE DATABASE " . constant(\'%s\')))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ } else {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "CREATE DATABASE %s"))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ }
+
+ return array('mysql_create_db(string database_name [...]) is emulated using mysqli_query() and CREATE DATABASE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and CREATE DATABASE.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/DBQuery.php.svn-base b/Function/.svn/text-base/DBQuery.php.svn-base
new file mode 100644
index 0000000..dd6eb86
--- /dev/null
+++ b/Function/.svn/text-base/DBQuery.php.svn-base
@@ -0,0 +1,61 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_DBQuery extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_db_query ( string database, string query [, resource link_identifier] )
+ if (count($params) < 2 || count($params) > 3)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($new_db, $query, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($new_db, $new_db_type) = $this->extractValueAndType(trim($new_db));
+ if ('const' == $new_db_type) {
+ $ret = sprintf('((mysqli_query(%s, "USE " . constant(\'%s\'))) ? mysqli_query(%s, %s) : false)',
+ $conn,
+ $new_db,
+ $conn,
+ $query);
+ } else {
+ $ret = sprintf('((mysqli_query(%s, "USE %s")) ? mysqli_query(%s, %s) : false)',
+ $conn,
+ $new_db,
+ $conn,
+ $query);
+ }
+
+ return array('mysql_db_query(string database_name [...]) is emulated using mysqli_query() and USE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and USE.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/DropDB.php.svn-base b/Function/.svn/text-base/DropDB.php.svn-base
new file mode 100644
index 0000000..3870d01
--- /dev/null
+++ b/Function/.svn/text-base/DropDB.php.svn-base
@@ -0,0 +1,62 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_DropDB extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_drop_db ( string database_name [, resource link_identifier] )
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+
+ if ('const' == $db_type) {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "DROP DATABASE " . constant(\'%s\')))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ } else {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "DROP DATABASE %s"))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ }
+
+ return array('mysql_drop_db(string database_name [...]) is emulated using mysqli_query() and DROP DATABASE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and DROP DATABASE.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/Error.php.svn-base b/Function/.svn/text-base/Error.php.svn-base
new file mode 100644
index 0000000..9d0d821
--- /dev/null
+++ b/Function/.svn/text-base/Error.php.svn-base
@@ -0,0 +1,45 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+
+class MySQLConverterTool_Function_Error extends MySQLConverterTool_Function_Generic {
+
+ function handle(Array $params = array()) {
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn)) {
+ $warning = 'mysql_error()/mysql_errno() can be called without a connection handle, mysqli_error()/mysqli_errno() not. As we do not know if a default connection has been opened, we have wrapped the function call in (() ? mysqli_() : mysqli_connect_error()/mysqli_connect_errno()). This is not 100% the same as the original code in all cases. Check the generated code!';
+ $conn = $this->ston_name;
+ } else {
+ $warning = null;
+ }
+ if ('mysqli_error' == $this->new_name)
+ $ret = sprintf('((is_object(%s)) ? %s(%s) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))', $conn, $this->new_name, $conn);
+ else
+ $ret = sprintf('((is_object(%s)) ? %s(%s) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false))', $conn, $this->new_name, $conn);
+
+ return array($warning, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'mysql_error()/mysql_errno() do not require a connection handle. When using the default connection for mysqli_error()/mysqli_errno() we throw a warning. We do not know for sure if a connection exists and add some extra code for the case it does not exist.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/EscapeString.php.svn-base b/Function/.svn/text-base/EscapeString.php.svn-base
new file mode 100644
index 0000000..5b892ff
--- /dev/null
+++ b/Function/.svn/text-base/EscapeString.php.svn-base
@@ -0,0 +1,47 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_EscapeString extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_escape_string ( string unescaped_string )
+
+ if (count($params) != 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($par1) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+
+ $warning = 'WARNING: mysql_escape_string() is deprecated. If no global connection has been opened already the converter cannot use mysqli_real_escape_string() to emulate the function. We add a runtime test if a connection exists, if not trigger_error() gets used to throw an E_USER_ERROR. It would be a security bug to do anything else. You must fix our code manually!';
+ $ret = sprintf('((isset(%s) && is_object(%s)) ? %s(%s, %s) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""))',
+ $conn,
+ $conn,
+ $this->new_name,
+ $conn,
+ $par1
+ );
+
+ return array($warning, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_real_escape_string and the default connection. If not default connection exists an E_USER_ERROR gets thrown.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FetchField.php.svn-base b/Function/.svn/text-base/FetchField.php.svn-base
new file mode 100644
index 0000000..183ea78
--- /dev/null
+++ b/Function/.svn/text-base/FetchField.php.svn-base
@@ -0,0 +1,147 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FetchField extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = "mysqli_fetch_field_direct";
+
+
+ public function __construct() {
+ }
+
+ function handle(Array $params = array()) {
+
+ // object mysql_fetch_field ( resource result [, int field_offset] )
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($res, $offset) = $this->extractParamValues($params);
+
+
+ /*
+ [01] $f = f() && is_object($f)
+ [02] $f->primary_key = ($f->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0
+ [03] $f->multiple_key = ($f->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0
+ [04] $f->unique_key = ($f->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0
+
+ MySQL source! #define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
+ [05] $f->numeric = ($f->type <= MYSQLI_TYPE_INT24 || $f->fype == MYSQLI_TYPE_YEAR || ((defined('MYSQLI_TYPE_NEWDECIMAL')) ? ($f->type == MYSQLI_TYPE_NEWDECIMAL) : false)
+
+ [06] $f->blob = (int)in_array($f->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))
+
+ [07] $f->unsinged = ($f->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0
+ [08] $f->zerofill = ($f->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0
+
+ [09] $type = $f->type
+ [10] $f->type = (($type == MYSQLI_TYPE_STRING) || ($type == MYSQLI_TYPE_VAR_STRING)) ? 'type' : ''
+ [11] $f->type = ("" == $f-type && in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int " : ""
+ [12] $f->type = ("" == $f-type && in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real " : ""
+ [13] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP) ? "timestamp " : ""
+ [14] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_YEAR) ? "year " : ""
+ [15] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_DATE) || ($___mysqli_tmp == MYSQLI_TYPE_NEWDATE)) ? "date " : ""
+ [16] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_TIME) ? "time " : ""
+ [17] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_SET) ? "set " : ""
+ [18] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_ENUM) ? "enum " : ""
+ [19] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY) ? "geometry " : ""
+ [20] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_DATETIME) ? "datetime " : ""
+ [21] $f->type = ("" == $f-type && (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))) ? "blob " : ""
+ [22] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_NULL) ? "null " : "unknown";
+
+ [23] $f->not_null = ($f->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0
+
+ (
+ ([01] && is_object($f) ? (
+ !is_null([02]) && !is_null([03]) && !is_null([04]) &&
+ !is_null([05]) && !is_null([06]) && !is_null([07]) &&
+ !is_null([08]) && !is_null([09]) ...
+ ) : false) ? $___mysqli_tmp : false)
+ */
+
+ $warning = 'You should rewrite all your mysql_fetch_field() calls. The generated code should be compatible. But have a look at the generated code, it is unmaintainable! FIX your code!';
+
+
+ $ret = '(';
+ $ret.= '(';
+ // [01]
+ $ret.= sprintf('(($___mysqli_tmp = mysqli_fetch_field_direct(%s, %s)) && is_object($___mysqli_tmp))', $res,
+ (is_null($offset)) ? sprintf('mysqli_field_tell(%s)', $res) : (int)$offset);
+ $ret.= ' ? ( ';
+ // [02]
+ $ret.= '(!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && ';
+ // [03]
+ $ret.= '(!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && ';
+ // [04]
+ $ret.= '(!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && ';
+ // [05]
+ $ret.= '(!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && ';
+ // [06]
+ $ret.= '(!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && ';
+ // [07]
+ $ret.= '(!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && ';
+ // [08]
+ $ret.= '(!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && ';
+ // [09]
+ $ret.= '(!is_null($___mysqli_type = $___mysqli_tmp->type)) && ';
+ // [10]
+ $ret.= '(!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&';
+ // [11]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&';
+ // [12]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && ';
+ // [13]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && ';
+ // [14]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && ';
+ // [15]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && ';
+ // [16]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && ';
+ // [17]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&';
+ // [18]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && ';
+ // [19]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && ';
+ // [20]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && ';
+ // [21]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && ';
+ // [22]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && ';
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && ';
+ // [23]
+ $ret.= '(!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0))';
+
+ $ret.= ' ) : false';
+ $ret.= ' )';
+ $ret.= ' ? $___mysqli_tmp : false)';
+
+
+ return array($warning, $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct() and a conditional expression.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FieldFlags.php.svn-base b/Function/.svn/text-base/FieldFlags.php.svn-base
new file mode 100644
index 0000000..a3ea757
--- /dev/null
+++ b/Function/.svn/text-base/FieldFlags.php.svn-base
@@ -0,0 +1,92 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldFlags extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_field_flags ( resource result, int field_offset )
+ // "not_null" NOT_NULL_FLAG MYSQLI_NOT_NULL_FLAG
+ // "primary_key" PRI_KEY_FLAG MYSQLI_PRI_KEY_FLAG
+ // "unique_key" UNIQUE_KEY_FLAG MYSQLI_UNIQUE_KEY_FLAG
+ // "multiple_key" MULTIPLE_KEY_FLAG MYSQLI_MULTIPLE_KEY_FLAG
+ // "blob" BLOB_FLAG MYSQLI_BLOB_FLAG
+ // "unsigned" UNSIGNED_FLAG MYSQLI_UNSIGNED_FLAG
+ // "zerofill" ZEROFILL_FLAG MYSQLI_ZEROFILL_FLAG
+ // "binary" BINARY_FLAG !!!
+ // "enum" ENUM_FLAG !!!
+ // "auto_increment" AUTO_INCREMENT_FLAG MYSQLI_AUTO_INCREMENT_FLAG
+ // "timestamp" TIMESTAMP_FLAG MYSQLI_TIMESTAMP_FLAG
+ // "set" SET_FLAG MYSQLI_SET_FLAG
+
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ // (($__f = ) ? (string)((substr((($__f & FLAG_CONSTANT) ? 'flag_string' : '')) [. ()], -1)) : false)
+ // ----------- 1 ---------- ------------------- n --------------------------------------------------- ------- 3 --
+
+ // ----------- 1 ----------
+ $ret = sprintf('(($___mysqli_tmp = %s(%s, %s)->flags) ? ',
+ $this->new_name,
+ $res,
+ $i
+ );
+
+ // ------------------- n ------------------------
+ $ret .= '(string)(substr(';
+ $ret .= '(($___mysqli_tmp & MYSQLI_NOT_NULL_FLAG) ? "not_null " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_PRI_KEY_FLAG) ? "primary_key " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_UNIQUE_KEY_FLAG) ? "unique_key " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_MULTIPLE_KEY_FLAG) ? "unique_key " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_BLOB_FLAG) ? "blob " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_UNSIGNED_FLAG) ? "unsigned " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_ZEROFILL_FLAG) ? "zerofill " : "") . ' ;
+ // FIXME - Constants are missing in ext/mysqli, added to CVS on 20.07.2006
+ $ret .= '(($___mysqli_tmp & 128) ? "binary " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & 256) ? "enum " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_AUTO_INCREMENT_FLAG) ? "auto_increment " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_TIMESTAMP_FLAG) ? "timestamp " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_SET_FLAG) ? "set " : "")';
+ $ret .= ', 0, -1)';
+
+ // ------- 3 --------------
+ $ret .= ')';
+ $ret .= ' : false)';
+
+ return array(NULL, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct and a conditional espression.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FieldLen.php.svn-base b/Function/.svn/text-base/FieldLen.php.svn-base
new file mode 100644
index 0000000..2d9b2d3
--- /dev/null
+++ b/Function/.svn/text-base/FieldLen.php.svn-base
@@ -0,0 +1,48 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldLen extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_fields';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // int mysql_field_len ( resource result, int field_offset )
+ // array mysqli_fetch_fields ( mysqli_result result )
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((($___mysqli_tmp = mysqli_fetch_fields(%s)) && (isset($___mysqli_tmp[%d]))) ? $___mysqli_tmp[%d]->length : false)',
+ $res,
+ $i,
+ $i));
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_fields().';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FieldName.php.svn-base b/Function/.svn/text-base/FieldName.php.svn-base
new file mode 100644
index 0000000..895d013
--- /dev/null
+++ b/Function/.svn/text-base/FieldName.php.svn-base
@@ -0,0 +1,46 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldName extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_field_name ( resource result, int field_offset )
+ // mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((($___mysqli_tmp = mysqli_fetch_field_direct(%s, %d)->name) && (!is_null($___mysqli_tmp))) ? $___mysqli_tmp : false)', $res, $i));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct().';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FieldTable.php.svn-base b/Function/.svn/text-base/FieldTable.php.svn-base
new file mode 100644
index 0000000..f64223c
--- /dev/null
+++ b/Function/.svn/text-base/FieldTable.php.svn-base
@@ -0,0 +1,47 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldTable extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct()
+ {
+ }
+
+
+ function handle(Array $params = array())
+ {
+ // string mysql_field_table ( resource result, int field_offset )
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, "(mysqli_fetch_field_direct($res, $i)->table)");
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct().';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FieldType.php.svn-base b/Function/.svn/text-base/FieldType.php.svn-base
new file mode 100644
index 0000000..c79fb7c
--- /dev/null
+++ b/Function/.svn/text-base/FieldType.php.svn-base
@@ -0,0 +1,89 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldType extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_field_type ( resource result, int field_offset )
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ /*
+
+ The following types reported by ext/mysqli are not reported by ext/mysql:
+
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT);
+ #if MYSQL_VERSION_ID > 50002
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
+ #endif
+ */
+ list($res, $i) = $this->extractParamValues($params);
+
+ // (($__f = ->type) ? (string)((substr((($__f == FLAG_CONSTANT) ? 'flag_string' : '')) [. ()], -1) : false)
+ // (($__f = ->type) ? (string)((substr((( ($__f == FLAG_CONSTANT) || (...) ) ? 'flag_string ' : '')) [. ()], -1) : false)
+ // ----------- 1 ---------- ------------------- n ------------------------ ------- 3 --------------
+ // refinement of 1:
+ // ((is_object($__f = ) && !is_null($__f = $f__->type)) ?
+ // refinement of n:
+ // ((($__f == substr()) == "") ? "unknown" : $__f)
+
+ // ----------- 1 ----------
+ $ret = '(';
+ $ret.= sprintf('(is_object($___mysqli_tmp = mysqli_fetch_field_direct(%s, %d)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type)) ? ', $res, $i);
+
+ // ------------------- n ------------------------
+ $ret.= '((($___mysqli_tmp = ';
+ $ret.= '(string)(substr(';
+ $ret.= '( (($___mysqli_tmp == MYSQLI_TYPE_STRING) || ($___mysqli_tmp == MYSQLI_TYPE_VAR_STRING) ) ? "string " : "" ) . ';
+ $ret.= '( (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int " : "" ) . ';
+ $ret.= '( (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP) ? "timestamp " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_YEAR) ? "year " : "" ) . ';
+ $ret.= '( (($___mysqli_tmp == MYSQLI_TYPE_DATE) || ($___mysqli_tmp == MYSQLI_TYPE_NEWDATE) ) ? "date " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_TIME) ? "time " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_SET) ? "set " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_ENUM) ? "enum " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY) ? "geometry " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_DATETIME) ? "datetime " : "" ) . ';
+ $ret.= '( (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))) ? "blob " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_NULL) ? "null " : "" )';
+ $ret.= ', 0, -1))';
+ $ret.= ') == "") ? "unknown" : $___mysqli_tmp)';
+
+ // ------- 3 --------------
+ $ret.= ' : false)';
+
+ return array(NULL, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct() and a conditional expression. The following types reported by ext/mysqli are not reposted by ext/mysql: MYSQLI_TYPE_CHAR, MYSQLI_TYPE_INTERVAL, MYSQLI_TYPE_BIT';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/FreeResult.php.svn-base b/Function/.svn/text-base/FreeResult.php.svn-base
new file mode 100644
index 0000000..9dbd180
--- /dev/null
+++ b/Function/.svn/text-base/FreeResult.php.svn-base
@@ -0,0 +1,42 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FreeResult extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_free_result';
+
+
+ public function __construct() {
+ }
+
+ public function handle(Array $params = array()) {
+
+ if (count($params) != 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((mysqli_free_result(%s) || (is_object(%s) && (get_class(%s) == "mysqli_result"))) ? true : false)', $res, $res, $res));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using a conditional expression and mysqli_free_result().';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/Generic.php.svn-base b/Function/.svn/text-base/Generic.php.svn-base
new file mode 100644
index 0000000..60216c6
--- /dev/null
+++ b/Function/.svn/text-base/Generic.php.svn-base
@@ -0,0 +1,152 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_Generic {
+
+ /**
+ *
+ * @const PARSE_ERROR_WRONG_PARAMS
+ */
+ const PARSE_ERROR_WRONG_PARAMS = 'Wrong parameter count. Function call not converted, resulting code is incomplete -- original code used. You must check your source!';
+
+
+ //
+ // public
+ //
+
+ /**
+ * New name of the converted function
+ *
+ * Used only for functions that have MySQLi counterpart that takes the same
+ * parameters as the originial MySQL extension function.
+ *
+ *
+ * @var string
+ */
+ public $new_name;
+
+
+ /**
+ * Name of a variable holding the connection identifier of all functions that rely on default connections
+ *
+ * @var string
+ */
+ public $ston_name = '$GLOBALS["___mysqli_ston"]';
+
+
+ //
+ // public
+ //
+
+ public function __construct($new_name, $ston_name = NULL) {
+
+ $this->new_name = $new_name;
+ if (!is_null($ston_name))
+ $this->ston_name = $ston_name;
+
+ }
+
+
+ /*
+ * Try to use less concats - dots - in the output string
+ *
+ * @param string
+ * @param string
+ */
+ public function smart_concat($par1, $par2) {
+
+ if ($par2[0] !== '"' && $par2[0] !== "'")
+ return '"' . $par1 . '" . ' . $par2;
+
+ return $par2[0] . $par1 . substr($par2, 1);
+ }
+
+
+ /**
+ * Returns a string with the functions call
+ *
+ * @param array list of parameters of the returned function call
+ */
+ public function handle(Array $params = array()) {
+
+ $params = $this->extractParamValues($params);
+ return array(NULL, $this->new_name."(".implode(", ", $params).")");
+ }
+
+
+ /**
+ * Returns a string which describes who the conversion is done
+ *
+ * @return string
+ */
+ public function getConversionHint() {
+
+ return 'Using 1:1 counterpart from the MySQLi extension';
+ }
+
+
+ /**
+ * Returns a PHP comment which describes how the conversion is done
+ *
+ * @return string
+ */
+ public function getConversionPHPComment() {
+
+ $ret = wordwrap($this->getConversionHint(), 60);
+ $ret = explode("\n", $ret);
+ $ret = "\n// [MySQL->MySQLi] " . implode("\n// [MySQL->MySQLi] ", $ret);
+ $ret .= "\n";
+
+ return $ret;
+ }
+
+ //
+ // protected
+ //
+
+ /**
+ * Extracts the parameter values from the parameter scanner hash
+ *
+ * @param array
+ * @return array
+ */
+ protected function extractParamValues($params) {
+
+ $ret = array();
+ foreach ($params as $k => $param) {
+ $ret[] = $param['value'];
+ }
+
+ return $ret;
+ }
+
+
+ /**
+ *
+ */
+ protected function extractValueAndType($var) {
+
+ $var_type = 'const';
+ if ("" != $var && ($var[0] == '"' || $var[0] == "'") && $var[0] == substr($var, -1)) {
+ $var = substr($var, 1, -1);
+ $var_type = 'string_or_var';
+ }
+ if ("" != ($tmp = trim($var)) && $tmp[0] == '$') {
+ $var_type = 'string_or_var';
+ }
+
+ return array($var, $var_type);
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/GenericBoolean.php.svn-base b/Function/.svn/text-base/GenericBoolean.php.svn-base
new file mode 100644
index 0000000..d641e8f
--- /dev/null
+++ b/Function/.svn/text-base/GenericBoolean.php.svn-base
@@ -0,0 +1,26 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_GenericBoolean extends MySQLConverterTool_Function_Generic {
+
+
+ public function handle(Array $params = array()) {
+
+ $params = $this->extractParamValues($params);
+ return array(NULL, sprintf('(($___mysqli_tmp = %s(%s)) ? $___mysqli_tmp : false)', $this->new_name, implode(", ", $params)));
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ListDBs.php.svn-base b/Function/.svn/text-base/ListDBs.php.svn-base
new file mode 100644
index 0000000..30d2f1c
--- /dev/null
+++ b/Function/.svn/text-base/ListDBs.php.svn-base
@@ -0,0 +1,45 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListDBs extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_list_dbs ( [resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, sprintf('(($___mysqli_tmp = mysqli_query(%s, "SHOW DATABASES")) ? $___mysqli_tmp : false)', $conn));
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW DATABASES. Returns NULL instead of false in case of an error';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ListFields.php.svn-base b/Function/.svn/text-base/ListFields.php.svn-base
new file mode 100644
index 0000000..004cef6
--- /dev/null
+++ b/Function/.svn/text-base/ListFields.php.svn-base
@@ -0,0 +1,66 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListFields extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_list_fields ( string database_name, string table_name [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 2 || count($params) > 3)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $table, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+ list($table, $table_type) = $this->extractValueAndType(trim($table));
+
+ $sql = '"SHOW COLUMNS FROM ';
+ if ($db_type == 'const')
+ $sql .= '" . constant(\'' . $db . '\') . ".';
+ else
+ $sql .= $db . '.';
+
+ if ($table_type == 'const')
+ $sql .= '" . constant(\'' . $table . '\')';
+ else
+ $sql .= $table . '"';
+
+ $ret = sprintf('(($___mysqli_tmp = mysqli_query(%s, %s)) ? $___mysqli_tmp : false)', $conn, $sql);
+
+ return array(
+ 'mysql_list_fields(string database_name, string table_name [...]) is emulated using mysqli_query() and SHOW COLUMNS FROM database_name.table_name . This is a possible SQL injection security bug as no tests are performed what value database_name and/or table_name have. Check your script! Additionally, this is not fully compatible to the original expression, check the mysql_list_fields() documentation on php.net!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW COLUMNS FROM table';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ListProcesses.php.svn-base b/Function/.svn/text-base/ListProcesses.php.svn-base
new file mode 100644
index 0000000..a771a93
--- /dev/null
+++ b/Function/.svn/text-base/ListProcesses.php.svn-base
@@ -0,0 +1,48 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListProcesses extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // resource mysql_list_processes ( [resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, sprintf('mysqli_query(%s, "SHOW PROCESSLIST")', $conn));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW PROCESSLIST.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ListTables.php.svn-base b/Function/.svn/text-base/ListTables.php.svn-base
new file mode 100644
index 0000000..03d7e3d
--- /dev/null
+++ b/Function/.svn/text-base/ListTables.php.svn-base
@@ -0,0 +1,54 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListTables extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_list_tables ( string database [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+ if ('const' == $db_type) {
+ $ret = sprintf('mysqli_query(%s, "SHOW TABLES FROM " . constant(\'%s\'))', $conn, $db);
+ } else {
+ $ret = sprintf('mysqli_query(%s, "SHOW TABLES FROM %s")', $conn, $db);
+ }
+
+ return array('mysql_list_tables(string database_name [...]) is emulated using mysqli_query() and SHOW TABLES FROM database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW TABLES FROM.';
+ }
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/ParReversed.php.svn-base b/Function/.svn/text-base/ParReversed.php.svn-base
new file mode 100644
index 0000000..4ed81c9
--- /dev/null
+++ b/Function/.svn/text-base/ParReversed.php.svn-base
@@ -0,0 +1,41 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ParReversed extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_query ( string query [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($par1, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, "$this->new_name($conn, $par1)");
+ }
+
+
+ function getConversionHint() {
+
+ return 'Generic function for: mysql_func(param1, param2) => mysqli_func(param2, param1). Currently used for mysql_query(), mysql_real_escape_string()';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/RealEscapeString.php.svn-base b/Function/.svn/text-base/RealEscapeString.php.svn-base
new file mode 100644
index 0000000..ba4085f
--- /dev/null
+++ b/Function/.svn/text-base/RealEscapeString.php.svn-base
@@ -0,0 +1,59 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_RealEscapeString extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] )
+ // string mysqli_real_escape_string ( mysqli link, string escapestr )
+
+ if (count($params) == 1) {
+
+ list($string) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+ $warning = 'If no global connection has been opened already the converter cannot use mysqli_real_escape_string() to emulate the function. We add a runtime test if a connection exists, if not trigger_error() gets used to throw an E_USER_ERROR. It would be a security bug to do anything else. You must fix our code manually!';
+ $ret = sprintf('((isset(%s) && is_object(%s)) ? %s(%s, %s) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""))',
+ $conn,
+ $conn,
+ $this->new_name,
+ $conn,
+ $string
+ );
+
+ } else if (count($params) == 2) {
+
+ list($string, $conn) = @$this->extractParamValues($params);
+ $warning = null;
+ $ret = sprintf('%s(%s, %s)', $this->new_name, $conn, $string);
+
+ } else {
+
+ $warning = self::PARSE_ERROR_WRONG_PARAMS;
+ $ret = null;
+
+ }
+
+ return array($warning, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_real_escape_string and the default connection if no connection is given. If no default connection exists an E_USER_ERROR gets thrown.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/SelectDB.php.svn-base b/Function/.svn/text-base/SelectDB.php.svn-base
new file mode 100644
index 0000000..7bf4446
--- /dev/null
+++ b/Function/.svn/text-base/SelectDB.php.svn-base
@@ -0,0 +1,56 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_SelectDB extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // bool mysql_select_db ( string database_name [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+ if ('const' == $db_type) {
+ $ret = sprintf('((bool)mysqli_query(%s, "USE " . constant(\'%s\')))', $conn, $db);
+ } else {
+ $ret = sprintf('((bool)mysqli_query(%s, "USE %s"))', $conn, $db);
+ }
+
+ return array('mysql_select_db(string database_name [...]) is emulated using mysqli_query() and USE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and USE.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/Tablename.php.svn-base b/Function/.svn/text-base/Tablename.php.svn-base
new file mode 100644
index 0000000..50c313a
--- /dev/null
+++ b/Function/.svn/text-base/Tablename.php.svn-base
@@ -0,0 +1,45 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_Tablename extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_fetch_row';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_db_name ( resource result, int row [, mixed field] )
+ // string mysql_tablename ( resource result, int i )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((mysqli_data_seek(%s, %s) && (($___mysqli_tmp = mysqli_fetch_row(%s)) !== NULL)) ? array_shift($___mysqli_tmp) : false)', $res, $i, $res));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_data_seek(), mysqli_fetch_row() and a conditional expression.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/text-base/UnbufferedQuery.php.svn-base b/Function/.svn/text-base/UnbufferedQuery.php.svn-base
new file mode 100644
index 0000000..d94e509
--- /dev/null
+++ b/Function/.svn/text-base/UnbufferedQuery.php.svn-base
@@ -0,0 +1,48 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_UnbufferedQuery extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_unbuffered_query ( string query [, resource link_identifier] )
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($q, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(null, "mysqli_query($conn, $q, MYSQLI_USE_RESULT)");
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and MYSQLI_USE_RESULT.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/.svn/wcprops/ChangeUser.php.svn-work b/Function/.svn/wcprops/ChangeUser.php.svn-work
new file mode 100644
index 0000000..6e7f11b
--- /dev/null
+++ b/Function/.svn/wcprops/ChangeUser.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/ChangeUser.php
+END
diff --git a/Function/.svn/wcprops/ConnParam.php.svn-work b/Function/.svn/wcprops/ConnParam.php.svn-work
new file mode 100644
index 0000000..5a1b71d
--- /dev/null
+++ b/Function/.svn/wcprops/ConnParam.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/ConnParam.php
+END
diff --git a/Function/.svn/wcprops/ConnParamBool.php.svn-work b/Function/.svn/wcprops/ConnParamBool.php.svn-work
new file mode 100644
index 0000000..067adc5
--- /dev/null
+++ b/Function/.svn/wcprops/ConnParamBool.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/ConnParamBool.php
+END
diff --git a/Function/.svn/wcprops/Connect.php.svn-work b/Function/.svn/wcprops/Connect.php.svn-work
new file mode 100644
index 0000000..c23cb0c
--- /dev/null
+++ b/Function/.svn/wcprops/Connect.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/Connect.php
+END
diff --git a/Function/.svn/wcprops/CreateDB.php.svn-work b/Function/.svn/wcprops/CreateDB.php.svn-work
new file mode 100644
index 0000000..f325c32
--- /dev/null
+++ b/Function/.svn/wcprops/CreateDB.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svnpublic/mysqli_converter/!svn/ver/8/MySQLConverterTool/Function/CreateDB.php
+END
diff --git a/Function/.svn/wcprops/DBQuery.php.svn-work b/Function/.svn/wcprops/DBQuery.php.svn-work
new file mode 100644
index 0000000..c221413
--- /dev/null
+++ b/Function/.svn/wcprops/DBQuery.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svnpublic/mysqli_converter/!svn/ver/10/MySQLConverterTool/Function/DBQuery.php
+END
diff --git a/Function/.svn/wcprops/DropDB.php.svn-work b/Function/.svn/wcprops/DropDB.php.svn-work
new file mode 100644
index 0000000..0a53e7a
--- /dev/null
+++ b/Function/.svn/wcprops/DropDB.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svnpublic/mysqli_converter/!svn/ver/8/MySQLConverterTool/Function/DropDB.php
+END
diff --git a/Function/.svn/wcprops/Error.php.svn-work b/Function/.svn/wcprops/Error.php.svn-work
new file mode 100644
index 0000000..ef26932
--- /dev/null
+++ b/Function/.svn/wcprops/Error.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svnpublic/mysqli_converter/!svn/ver/11/MySQLConverterTool/Function/Error.php
+END
diff --git a/Function/.svn/wcprops/EscapeString.php.svn-work b/Function/.svn/wcprops/EscapeString.php.svn-work
new file mode 100644
index 0000000..b17ebb1
--- /dev/null
+++ b/Function/.svn/wcprops/EscapeString.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 83
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/EscapeString.php
+END
diff --git a/Function/.svn/wcprops/FetchField.php.svn-work b/Function/.svn/wcprops/FetchField.php.svn-work
new file mode 100644
index 0000000..2843073
--- /dev/null
+++ b/Function/.svn/wcprops/FetchField.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FetchField.php
+END
diff --git a/Function/.svn/wcprops/FieldFlags.php.svn-work b/Function/.svn/wcprops/FieldFlags.php.svn-work
new file mode 100644
index 0000000..6e40307
--- /dev/null
+++ b/Function/.svn/wcprops/FieldFlags.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FieldFlags.php
+END
diff --git a/Function/.svn/wcprops/FieldLen.php.svn-work b/Function/.svn/wcprops/FieldLen.php.svn-work
new file mode 100644
index 0000000..20b3be0
--- /dev/null
+++ b/Function/.svn/wcprops/FieldLen.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FieldLen.php
+END
diff --git a/Function/.svn/wcprops/FieldName.php.svn-work b/Function/.svn/wcprops/FieldName.php.svn-work
new file mode 100644
index 0000000..1f85da0
--- /dev/null
+++ b/Function/.svn/wcprops/FieldName.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FieldName.php
+END
diff --git a/Function/.svn/wcprops/FieldTable.php.svn-work b/Function/.svn/wcprops/FieldTable.php.svn-work
new file mode 100644
index 0000000..d8a5c1f
--- /dev/null
+++ b/Function/.svn/wcprops/FieldTable.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FieldTable.php
+END
diff --git a/Function/.svn/wcprops/FieldType.php.svn-work b/Function/.svn/wcprops/FieldType.php.svn-work
new file mode 100644
index 0000000..d8ce28e
--- /dev/null
+++ b/Function/.svn/wcprops/FieldType.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FieldType.php
+END
diff --git a/Function/.svn/wcprops/FreeResult.php.svn-work b/Function/.svn/wcprops/FreeResult.php.svn-work
new file mode 100644
index 0000000..77e44c9
--- /dev/null
+++ b/Function/.svn/wcprops/FreeResult.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/FreeResult.php
+END
diff --git a/Function/.svn/wcprops/Generic.php.svn-work b/Function/.svn/wcprops/Generic.php.svn-work
new file mode 100644
index 0000000..82dcbb6
--- /dev/null
+++ b/Function/.svn/wcprops/Generic.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svnpublic/mysqli_converter/!svn/ver/8/MySQLConverterTool/Function/Generic.php
+END
diff --git a/Function/.svn/wcprops/GenericBoolean.php.svn-work b/Function/.svn/wcprops/GenericBoolean.php.svn-work
new file mode 100644
index 0000000..ecef9ed
--- /dev/null
+++ b/Function/.svn/wcprops/GenericBoolean.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 85
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/GenericBoolean.php
+END
diff --git a/Function/.svn/wcprops/ListDBs.php.svn-work b/Function/.svn/wcprops/ListDBs.php.svn-work
new file mode 100644
index 0000000..8c9bdf1
--- /dev/null
+++ b/Function/.svn/wcprops/ListDBs.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/ListDBs.php
+END
diff --git a/Function/.svn/wcprops/ListFields.php.svn-work b/Function/.svn/wcprops/ListFields.php.svn-work
new file mode 100644
index 0000000..17b6a45
--- /dev/null
+++ b/Function/.svn/wcprops/ListFields.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/8/MySQLConverterTool/Function/ListFields.php
+END
diff --git a/Function/.svn/wcprops/ListProcesses.php.svn-work b/Function/.svn/wcprops/ListProcesses.php.svn-work
new file mode 100644
index 0000000..8cb3eda
--- /dev/null
+++ b/Function/.svn/wcprops/ListProcesses.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/ListProcesses.php
+END
diff --git a/Function/.svn/wcprops/ListTables.php.svn-work b/Function/.svn/wcprops/ListTables.php.svn-work
new file mode 100644
index 0000000..e78a3d2
--- /dev/null
+++ b/Function/.svn/wcprops/ListTables.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/8/MySQLConverterTool/Function/ListTables.php
+END
diff --git a/Function/.svn/wcprops/ParReversed.php.svn-work b/Function/.svn/wcprops/ParReversed.php.svn-work
new file mode 100644
index 0000000..d57282e
--- /dev/null
+++ b/Function/.svn/wcprops/ParReversed.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 82
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/ParReversed.php
+END
diff --git a/Function/.svn/wcprops/RealEscapeString.php.svn-work b/Function/.svn/wcprops/RealEscapeString.php.svn-work
new file mode 100644
index 0000000..6f74010
--- /dev/null
+++ b/Function/.svn/wcprops/RealEscapeString.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 87
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/RealEscapeString.php
+END
diff --git a/Function/.svn/wcprops/SelectDB.php.svn-work b/Function/.svn/wcprops/SelectDB.php.svn-work
new file mode 100644
index 0000000..3d205f1
--- /dev/null
+++ b/Function/.svn/wcprops/SelectDB.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svnpublic/mysqli_converter/!svn/ver/8/MySQLConverterTool/Function/SelectDB.php
+END
diff --git a/Function/.svn/wcprops/Tablename.php.svn-work b/Function/.svn/wcprops/Tablename.php.svn-work
new file mode 100644
index 0000000..872467d
--- /dev/null
+++ b/Function/.svn/wcprops/Tablename.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 80
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/Tablename.php
+END
diff --git a/Function/.svn/wcprops/UnbufferedQuery.php.svn-work b/Function/.svn/wcprops/UnbufferedQuery.php.svn-work
new file mode 100644
index 0000000..10de772
--- /dev/null
+++ b/Function/.svn/wcprops/UnbufferedQuery.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 86
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/Function/UnbufferedQuery.php
+END
diff --git a/Function/ChangeUser.php b/Function/ChangeUser.php
new file mode 100644
index 0000000..3e99d27
--- /dev/null
+++ b/Function/ChangeUser.php
@@ -0,0 +1,91 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ChangeUser extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_change_user';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_change_user ( string user, string password [, string database [, resource link_identifier]] )
+ // mysqli_change_user ( mysqli link, string user, string password, string database )
+
+ $warning = NULL;
+
+ if (4 == count($params)) {
+
+ list($user, $pass, $db, $conn) = $this->extractParamValues($params);
+ $ret = "mysqli_change_user($conn, $user, $pass, $db)";
+
+ } else if (3 == count($params)) {
+
+ list($user, $pass, $db) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+ $ret = "mysqli_change_user($conn, $user, $pass, $db)";
+
+ } else if (2 == count($params)) {
+
+ list($user, $pass) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+
+ // [1] $res = mysqli_query(conn, 'SELECT DATABASE()')
+ // [2] $row = mysqli_fetch_row($res);
+ // [3] $row = array_shift($row);
+ // [4] unset($row);
+ // [5] mysqli_free_result($res);
+ // [6] unset($res);
+ // [7] mysqli_change_user(conn, user, pass, $db)
+ //
+ // [1] ( ($res = mysqli_query() ) ? $db : false
+ // [2] ( ($res = mysqli_query() && row = mysqli_fetch_row($res)) ? $db : false
+ // [3] ( ($res = mysqli_query() && row = mysqli_fetch_row($res) && ((row = array_shift(row)) !== false) ) ? true : false
+ // [5] ( ($res = mysqli_query() && row = mysqli_fetch_row($res) && ((row = array_shift(row)) !== false) ) && mysqli_free_result(res) ) ? true : false
+ // [7] ( ($res = mysqli_query() && row = mysqli_fetch_row($res) && ((row = array_shift(row)) !== false) ) && mysqli_free_result(res) ) ? mysqli_change_user(conn, user, pass, $row) : false
+
+
+ $ret = '( ';
+ $ret.= '( ';
+ $ret.= '($___mysqli_res = mysqli_query(' . $conn . ', "SELECT DATABASE()")) && ';
+ $ret.= '($___mysqli_tmp = mysqli_fetch_row($___mysqli_res)) && ';
+ $ret.= '(($___mysqli_tmp = array_shift($___mysqli_tmp)) !== false) && ';
+ $ret.= '(mysqli_free_result($___mysqli_res)) ';
+ $ret.= ') ? ';
+ $ret.= sprintf('mysqli_change_user(%s, %s, %s, $___mysqli_tmp) : ', $conn, $user, $pass);
+ $ret.= 'false ';
+ $ret.= ')';
+
+ } else {
+
+ $warning = self::PARSE_ERROR_WRONG_PARAMS;
+ $ret = NULL;
+
+ }
+
+ return array($warning, $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'mysql_change_user() can be translated into mysqli_change_user if the database is given. If not, it must be emulated using mysqli_query() and SELECT DATABASE() - which looks a bit like a hack.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/ConnParam.php b/Function/ConnParam.php
new file mode 100644
index 0000000..4055a25
--- /dev/null
+++ b/Function/ConnParam.php
@@ -0,0 +1,36 @@
+ mysqli_func(resource)
+*
+* @category Functions
+* @package MySQLConverterTool
+* @author Andrey Hristov , Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ConnParam extends MySQLConverterTool_Function_Generic {
+
+ function handle(Array $params = array()) {
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, "$this->new_name($conn)");
+ }
+
+ function getConversionHint() {
+
+ return 'Generic class for all functions that look like mysql_foo([]) -> mysqli_bar()';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/ConnParamBool.php b/Function/ConnParamBool.php
new file mode 100644
index 0000000..074efff
--- /dev/null
+++ b/Function/ConnParamBool.php
@@ -0,0 +1,37 @@
+ ((bool)mysqli_func(resource))
+*
+* @category Functions
+* @package MySQLConverterTool
+* @author Andrey Hristov , Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ConnParamBool extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, '((is_null($___mysqli_res = ' . $this->new_name . '(' . $conn . '))) ? false : $___mysqli_res)');
+ }
+
+ function getConversionHint() {
+
+ return 'Generic class for all functions that look like mysql_foo([]) -> ((bool)mysqli_bar())';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/Connect.php b/Function/Connect.php
new file mode 100644
index 0000000..257b00e
--- /dev/null
+++ b/Function/Connect.php
@@ -0,0 +1,203 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_Connect extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_connect';
+
+
+ public function __construct() {
+ }
+
+ function handle(Array $params = array()) {
+ static $last_params = array();
+
+ /*
+ Known deficiencies:
+ - will try to handle unix_socket but not the best solution
+ */
+
+ // mysql_connect ( [string server [, string username [, string password [, bool new_link [, int client_flags]]]]] )
+ // mysql_pconnect ( [string server [, string username [, string password [, int client_flags]]]] )
+ // mysqli_connect ( [string host [, string username [, string passwd [, string dbname [, int port [, string socket]]]]]] )
+
+ $warning = NULL;
+ $socket = NULL;
+ $port = NULL;
+
+ @list($server, $user, $password, $new_link, $client_flags) = $this->extractParamValues($params);
+ if (!is_null($server)) {
+ if ($params[0]['dynamic']) {
+ $warning = 'Cannot analyze server parameter to extract host, socket and port! Conversion cannot be performed automatically. You must manually check the result of the conversion.';
+ } else {
+ list($server, $socket, $port) = $this->expandServerParam($server);
+ }
+ }
+
+ $found = false;
+ if (is_null($new_link) || ($new_link == false)) {
+ // Maybe someone relies on:
+ // If a second call is made to mysql_connect() with the same arguments,
+ // no new link will be established, but instead, the link identifier of the already
+ // opened link will be returned. The new_link parameter modifies this behavior
+ // and makes mysql_connect() always open a new link, even if mysql_connect()
+ // was called before with the same parameters.
+ // The current converter version cannot catch this. All we can do is throw a warning
+
+ foreach ($last_params as $k => $lparams) {
+ if ($params == $lparams) {
+ $warning .= " You're calling mysql_connect() twice with the same parameters. We don't know for sure if you want a new connection or reuse the old connection. You must check your code.";
+ $found = true;
+ break;
+ }
+ }
+
+ }
+ if (!$found)
+ $last_params[] = $params;
+
+
+ $dbname = 'NULL';
+ $ret = NULL;
+ $num_params = count($params);
+
+ if ($num_params < 5) {
+
+ if (!is_null($socket)) {
+
+ $ret = sprintf('(%s = %s(%s, %s, %s, %s, %d, \'%s\'))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ is_null($user) ? 'NULL' : $user,
+ is_null($password) ? 'NULL' : $password,
+ is_null($dbname) ? 'NULL' : $dbname,
+ is_null($port) ? 'NULL' : $port,
+ $socket);
+ } else {
+
+ if (is_null($server)) {
+ // mysql_connect()
+ $ret = sprintf('(%s = %s())',
+ $this->ston_name,
+ $this->new_name);
+
+ } else if (!is_null($port)) {
+ // port used - no chance to generate pretty code
+
+ $ret = sprintf('(%s = %s(%s, %s, %s, %s, %d))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ is_null($user) ? 'NULL' : $user,
+ is_null($password) ? 'NULL' : $password,
+ is_null($dbname) ? 'NULL' : $dbname,
+ $port
+ );
+
+ } else if (!is_null($password)) {
+
+ // mysql_connect(, , )
+ $ret = sprintf('(%s = %s(%s, %s, %s))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ is_null($user) ? 'NULL' : $user,
+ $password);
+
+ } else if (!is_null($user)) {
+ // mysql_connect(,
+ $ret = sprintf('(%s = %s(%s, %s))',
+ $this->ston_name,
+ $this->new_name,
+ is_null($server) ? 'NULL' : $server,
+ $user);
+
+ } else {
+ // mysql_connect() but not mysql_connect()
+
+ $ret = sprintf('(%s = %s(%s))',
+ $this->ston_name,
+ $this->new_name,
+ $server);
+
+ }
+
+ }
+
+ } else if ($num_params == 5) {
+
+ $ret = sprintf('(((%s = mysqli_init()) && (mysqli_real_connect(%s, %s, %s, %s, %s, %d, %s, %s))) ? %s : FALSE)',
+ $this->ston_name,
+ $this->ston_name,
+ $server,
+ $user,
+ $password,
+ $dbname,
+ is_null($port) ? 3306 : $port,
+ is_null($socket) ? 'NULL' : $socket,
+ $client_flags,
+ $this->ston_name);
+
+ } else {
+ // too many parameters
+
+ $warning = self::PARSE_ERROR_WRONG_PARAMS;
+ $ret = NULL;
+
+ }
+
+ return array($warning, $ret);
+ }
+
+
+ protected function expandServerParam($server) {
+
+ $socket = NULL;
+ $port = NULL;
+
+ $pos = strpos($server, ':/');
+ if (FALSE !== $pos) {
+ // Unix Socket
+
+ $first_ch = $server[0];
+ $last_ch = substr($server, -1, 1);
+
+ if (($last_ch == '"' || $last_ch == "'") && $last_ch == $first_ch) {
+ $server = substr($server, 1, -1);
+ }
+
+ $socket = substr($server, $pos + 1);
+ $server = '"localhost"';
+
+ } else if (preg_match('/(["\']*)([^:]+):(\d+)/iu', $server, $matches)) {
+ // host:port
+
+ $server = $matches[1] . $matches[2] . $matches[1];
+ $port = $matches[3];
+
+ }
+
+ return array($server, $socket, $port);
+ }
+
+ function getConversionHint() {
+
+ return 'mysql_connect can be mapped to mysqli_connect with some parameter swapping if no client_flags are used. If client_flags are used, mysqli_init()/mysqli_real_connect() are needed.';
+
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/CreateDB.php b/Function/CreateDB.php
new file mode 100644
index 0000000..734179d
--- /dev/null
+++ b/Function/CreateDB.php
@@ -0,0 +1,63 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_CreateDB extends MySQLConverterTool_Function_Generic {
+
+
+ // not used, but anyway
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_create_db ( string database_name [, resource link_identifier] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+
+ if ('const' == $db_type) {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "CREATE DATABASE " . constant(\'%s\')))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ } else {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "CREATE DATABASE %s"))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ }
+
+ return array('mysql_create_db(string database_name [...]) is emulated using mysqli_query() and CREATE DATABASE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and CREATE DATABASE.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/DBQuery.php b/Function/DBQuery.php
new file mode 100644
index 0000000..9fb94e0
--- /dev/null
+++ b/Function/DBQuery.php
@@ -0,0 +1,61 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_DBQuery extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_db_query ( string database, string query [, resource link_identifier] )
+ if (count($params) < 2 || count($params) > 3)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($new_db, $query, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($new_db, $new_db_type) = $this->extractValueAndType(trim($new_db));
+ if ('const' == $new_db_type) {
+ $ret = sprintf('((mysqli_query(%s, "USE " . constant(\'%s\'))) ? mysqli_query(%s, %s) : false)',
+ $conn,
+ $new_db,
+ $conn,
+ $query);
+ } else {
+ $ret = sprintf('((mysqli_query(%s, "USE %s")) ? mysqli_query(%s, %s) : false)',
+ $conn,
+ $new_db,
+ $conn,
+ $query);
+ }
+
+ return array('mysql_db_query(string database_name [...]) is emulated using mysqli_query() and USE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and USE.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/DropDB.php b/Function/DropDB.php
new file mode 100644
index 0000000..5f55afa
--- /dev/null
+++ b/Function/DropDB.php
@@ -0,0 +1,62 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_DropDB extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_drop_db ( string database_name [, resource link_identifier] )
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+
+ if ('const' == $db_type) {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "DROP DATABASE " . constant(\'%s\')))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ } else {
+ $ret = sprintf('((is_null($___mysqli_res = %s(%s, "DROP DATABASE %s"))) ? false : $___mysqli_res)',
+ $this->new_name,
+ $conn,
+ $db
+ );
+ }
+
+ return array('mysql_drop_db(string database_name [...]) is emulated using mysqli_query() and DROP DATABASE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and DROP DATABASE.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/Error.php b/Function/Error.php
new file mode 100644
index 0000000..ce46f38
--- /dev/null
+++ b/Function/Error.php
@@ -0,0 +1,45 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+
+class MySQLConverterTool_Function_Error extends MySQLConverterTool_Function_Generic {
+
+ function handle(Array $params = array()) {
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn)) {
+ $warning = 'mysql_error()/mysql_errno() can be called without a connection handle, mysqli_error()/mysqli_errno() not. As we do not know if a default connection has been opened, we have wrapped the function call in (() ? mysqli_() : mysqli_connect_error()/mysqli_connect_errno()). This is not 100% the same as the original code in all cases. Check the generated code!';
+ $conn = $this->ston_name;
+ } else {
+ $warning = null;
+ }
+ if ('mysqli_error' == $this->new_name)
+ $ret = sprintf('((is_object(%s)) ? %s(%s) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))', $conn, $this->new_name, $conn);
+ else
+ $ret = sprintf('((is_object(%s)) ? %s(%s) : (($___mysqli_res = mysqli_connect_errno()) ? $___mysqli_res : false))', $conn, $this->new_name, $conn);
+
+ return array($warning, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'mysql_error()/mysql_errno() do not require a connection handle. When using the default connection for mysqli_error()/mysqli_errno() we throw a warning. We do not know for sure if a connection exists and add some extra code for the case it does not exist.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/EscapeString.php b/Function/EscapeString.php
new file mode 100644
index 0000000..4c0bb2e
--- /dev/null
+++ b/Function/EscapeString.php
@@ -0,0 +1,47 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_EscapeString extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_escape_string ( string unescaped_string )
+
+ if (count($params) != 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($par1) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+
+ $warning = 'WARNING: mysql_escape_string() is deprecated. If no global connection has been opened already the converter cannot use mysqli_real_escape_string() to emulate the function. We add a runtime test if a connection exists, if not trigger_error() gets used to throw an E_USER_ERROR. It would be a security bug to do anything else. You must fix our code manually!';
+ $ret = sprintf('((isset(%s) && is_object(%s)) ? %s(%s, %s) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""))',
+ $conn,
+ $conn,
+ $this->new_name,
+ $conn,
+ $par1
+ );
+
+ return array($warning, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_real_escape_string and the default connection. If not default connection exists an E_USER_ERROR gets thrown.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FetchField.php b/Function/FetchField.php
new file mode 100644
index 0000000..5bcb463
--- /dev/null
+++ b/Function/FetchField.php
@@ -0,0 +1,147 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FetchField extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = "mysqli_fetch_field_direct";
+
+
+ public function __construct() {
+ }
+
+ function handle(Array $params = array()) {
+
+ // object mysql_fetch_field ( resource result [, int field_offset] )
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($res, $offset) = $this->extractParamValues($params);
+
+
+ /*
+ [01] $f = f() && is_object($f)
+ [02] $f->primary_key = ($f->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0
+ [03] $f->multiple_key = ($f->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0
+ [04] $f->unique_key = ($f->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0
+
+ MySQL source! #define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
+ [05] $f->numeric = ($f->type <= MYSQLI_TYPE_INT24 || $f->fype == MYSQLI_TYPE_YEAR || ((defined('MYSQLI_TYPE_NEWDECIMAL')) ? ($f->type == MYSQLI_TYPE_NEWDECIMAL) : false)
+
+ [06] $f->blob = (int)in_array($f->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))
+
+ [07] $f->unsinged = ($f->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0
+ [08] $f->zerofill = ($f->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0
+
+ [09] $type = $f->type
+ [10] $f->type = (($type == MYSQLI_TYPE_STRING) || ($type == MYSQLI_TYPE_VAR_STRING)) ? 'type' : ''
+ [11] $f->type = ("" == $f-type && in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int " : ""
+ [12] $f->type = ("" == $f-type && in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real " : ""
+ [13] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP) ? "timestamp " : ""
+ [14] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_YEAR) ? "year " : ""
+ [15] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_DATE) || ($___mysqli_tmp == MYSQLI_TYPE_NEWDATE)) ? "date " : ""
+ [16] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_TIME) ? "time " : ""
+ [17] $f->type = ("" == $f-type && $___mysqli_tmp == MYSQLI_TYPE_SET) ? "set " : ""
+ [18] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_ENUM) ? "enum " : ""
+ [19] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY) ? "geometry " : ""
+ [20] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_DATETIME) ? "datetime " : ""
+ [21] $f->type = ("" == $f-type && (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))) ? "blob " : ""
+ [22] $f->type = ("" == $f-type && ($___mysqli_tmp == MYSQLI_TYPE_NULL) ? "null " : "unknown";
+
+ [23] $f->not_null = ($f->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0
+
+ (
+ ([01] && is_object($f) ? (
+ !is_null([02]) && !is_null([03]) && !is_null([04]) &&
+ !is_null([05]) && !is_null([06]) && !is_null([07]) &&
+ !is_null([08]) && !is_null([09]) ...
+ ) : false) ? $___mysqli_tmp : false)
+ */
+
+ $warning = 'You should rewrite all your mysql_fetch_field() calls. The generated code should be compatible. But have a look at the generated code, it is unmaintainable! FIX your code!';
+
+
+ $ret = '(';
+ $ret.= '(';
+ // [01]
+ $ret.= sprintf('(($___mysqli_tmp = mysqli_fetch_field_direct(%s, %s)) && is_object($___mysqli_tmp))', $res,
+ (is_null($offset)) ? sprintf('mysqli_field_tell(%s)', $res) : (int)$offset);
+ $ret.= ' ? ( ';
+ // [02]
+ $ret.= '(!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && ';
+ // [03]
+ $ret.= '(!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && ';
+ // [04]
+ $ret.= '(!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && ';
+ // [05]
+ $ret.= '(!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && ';
+ // [06]
+ $ret.= '(!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && ';
+ // [07]
+ $ret.= '(!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && ';
+ // [08]
+ $ret.= '(!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && ';
+ // [09]
+ $ret.= '(!is_null($___mysqli_type = $___mysqli_tmp->type)) && ';
+ // [10]
+ $ret.= '(!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&';
+ // [11]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&';
+ // [12]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && ';
+ // [13]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && ';
+ // [14]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && ';
+ // [15]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && ';
+ // [16]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && ';
+ // [17]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&';
+ // [18]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && ';
+ // [19]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && ';
+ // [20]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && ';
+ // [21]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && ';
+ // [22]
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && ';
+ $ret.= '(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && ';
+ // [23]
+ $ret.= '(!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0))';
+
+ $ret.= ' ) : false';
+ $ret.= ' )';
+ $ret.= ' ? $___mysqli_tmp : false)';
+
+
+ return array($warning, $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct() and a conditional expression.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FieldFlags.php b/Function/FieldFlags.php
new file mode 100644
index 0000000..10c0722
--- /dev/null
+++ b/Function/FieldFlags.php
@@ -0,0 +1,92 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldFlags extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_field_flags ( resource result, int field_offset )
+ // "not_null" NOT_NULL_FLAG MYSQLI_NOT_NULL_FLAG
+ // "primary_key" PRI_KEY_FLAG MYSQLI_PRI_KEY_FLAG
+ // "unique_key" UNIQUE_KEY_FLAG MYSQLI_UNIQUE_KEY_FLAG
+ // "multiple_key" MULTIPLE_KEY_FLAG MYSQLI_MULTIPLE_KEY_FLAG
+ // "blob" BLOB_FLAG MYSQLI_BLOB_FLAG
+ // "unsigned" UNSIGNED_FLAG MYSQLI_UNSIGNED_FLAG
+ // "zerofill" ZEROFILL_FLAG MYSQLI_ZEROFILL_FLAG
+ // "binary" BINARY_FLAG !!!
+ // "enum" ENUM_FLAG !!!
+ // "auto_increment" AUTO_INCREMENT_FLAG MYSQLI_AUTO_INCREMENT_FLAG
+ // "timestamp" TIMESTAMP_FLAG MYSQLI_TIMESTAMP_FLAG
+ // "set" SET_FLAG MYSQLI_SET_FLAG
+
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ // (($__f = ) ? (string)((substr((($__f & FLAG_CONSTANT) ? 'flag_string' : '')) [. ()], -1)) : false)
+ // ----------- 1 ---------- ------------------- n --------------------------------------------------- ------- 3 --
+
+ // ----------- 1 ----------
+ $ret = sprintf('(($___mysqli_tmp = %s(%s, %s)->flags) ? ',
+ $this->new_name,
+ $res,
+ $i
+ );
+
+ // ------------------- n ------------------------
+ $ret .= '(string)(substr(';
+ $ret .= '(($___mysqli_tmp & MYSQLI_NOT_NULL_FLAG) ? "not_null " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_PRI_KEY_FLAG) ? "primary_key " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_UNIQUE_KEY_FLAG) ? "unique_key " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_MULTIPLE_KEY_FLAG) ? "unique_key " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_BLOB_FLAG) ? "blob " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_UNSIGNED_FLAG) ? "unsigned " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_ZEROFILL_FLAG) ? "zerofill " : "") . ' ;
+ // FIXME - Constants are missing in ext/mysqli, added to CVS on 20.07.2006
+ $ret .= '(($___mysqli_tmp & 128) ? "binary " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & 256) ? "enum " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_AUTO_INCREMENT_FLAG) ? "auto_increment " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_TIMESTAMP_FLAG) ? "timestamp " : "") . ' ;
+ $ret .= '(($___mysqli_tmp & MYSQLI_SET_FLAG) ? "set " : "")';
+ $ret .= ', 0, -1)';
+
+ // ------- 3 --------------
+ $ret .= ')';
+ $ret .= ' : false)';
+
+ return array(NULL, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct and a conditional espression.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FieldLen.php b/Function/FieldLen.php
new file mode 100644
index 0000000..3d37526
--- /dev/null
+++ b/Function/FieldLen.php
@@ -0,0 +1,48 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldLen extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_fields';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // int mysql_field_len ( resource result, int field_offset )
+ // array mysqli_fetch_fields ( mysqli_result result )
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((($___mysqli_tmp = mysqli_fetch_fields(%s)) && (isset($___mysqli_tmp[%d]))) ? $___mysqli_tmp[%d]->length : false)',
+ $res,
+ $i,
+ $i));
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_fields().';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FieldName.php b/Function/FieldName.php
new file mode 100644
index 0000000..c5c1507
--- /dev/null
+++ b/Function/FieldName.php
@@ -0,0 +1,46 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldName extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_field_name ( resource result, int field_offset )
+ // mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((($___mysqli_tmp = mysqli_fetch_field_direct(%s, %d)->name) && (!is_null($___mysqli_tmp))) ? $___mysqli_tmp : false)', $res, $i));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct().';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FieldTable.php b/Function/FieldTable.php
new file mode 100644
index 0000000..64bac95
--- /dev/null
+++ b/Function/FieldTable.php
@@ -0,0 +1,47 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldTable extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct()
+ {
+ }
+
+
+ function handle(Array $params = array())
+ {
+ // string mysql_field_table ( resource result, int field_offset )
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, "(mysqli_fetch_field_direct($res, $i)->table)");
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct().';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FieldType.php b/Function/FieldType.php
new file mode 100644
index 0000000..66f5374
--- /dev/null
+++ b/Function/FieldType.php
@@ -0,0 +1,89 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FieldType extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_fetch_field_direct';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_field_type ( resource result, int field_offset )
+ // object mysqli_fetch_field_direct ( mysqli_result result, int fieldnr )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ /*
+
+ The following types reported by ext/mysqli are not reported by ext/mysql:
+
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_CHAR", FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_INTERVAL", FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT);
+ #if MYSQL_VERSION_ID > 50002
+ REGISTER_LONG_CONSTANT("MYSQLI_TYPE_BIT", FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT);
+ #endif
+ */
+ list($res, $i) = $this->extractParamValues($params);
+
+ // (($__f = ->type) ? (string)((substr((($__f == FLAG_CONSTANT) ? 'flag_string' : '')) [. ()], -1) : false)
+ // (($__f = ->type) ? (string)((substr((( ($__f == FLAG_CONSTANT) || (...) ) ? 'flag_string ' : '')) [. ()], -1) : false)
+ // ----------- 1 ---------- ------------------- n ------------------------ ------- 3 --------------
+ // refinement of 1:
+ // ((is_object($__f = ) && !is_null($__f = $f__->type)) ?
+ // refinement of n:
+ // ((($__f == substr()) == "") ? "unknown" : $__f)
+
+ // ----------- 1 ----------
+ $ret = '(';
+ $ret.= sprintf('(is_object($___mysqli_tmp = mysqli_fetch_field_direct(%s, %d)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type)) ? ', $res, $i);
+
+ // ------------------- n ------------------------
+ $ret.= '((($___mysqli_tmp = ';
+ $ret.= '(string)(substr(';
+ $ret.= '( (($___mysqli_tmp == MYSQLI_TYPE_STRING) || ($___mysqli_tmp == MYSQLI_TYPE_VAR_STRING) ) ? "string " : "" ) . ';
+ $ret.= '( (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int " : "" ) . ';
+ $ret.= '( (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP) ? "timestamp " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_YEAR) ? "year " : "" ) . ';
+ $ret.= '( (($___mysqli_tmp == MYSQLI_TYPE_DATE) || ($___mysqli_tmp == MYSQLI_TYPE_NEWDATE) ) ? "date " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_TIME) ? "time " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_SET) ? "set " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_ENUM) ? "enum " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY) ? "geometry " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_DATETIME) ? "datetime " : "" ) . ';
+ $ret.= '( (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB))) ? "blob " : "" ) . ';
+ $ret.= '( ($___mysqli_tmp == MYSQLI_TYPE_NULL) ? "null " : "" )';
+ $ret.= ', 0, -1))';
+ $ret.= ') == "") ? "unknown" : $___mysqli_tmp)';
+
+ // ------- 3 --------------
+ $ret.= ' : false)';
+
+ return array(NULL, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_fetch_field_direct() and a conditional expression. The following types reported by ext/mysqli are not reposted by ext/mysql: MYSQLI_TYPE_CHAR, MYSQLI_TYPE_INTERVAL, MYSQLI_TYPE_BIT';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/FreeResult.php b/Function/FreeResult.php
new file mode 100644
index 0000000..d7012f8
--- /dev/null
+++ b/Function/FreeResult.php
@@ -0,0 +1,42 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_FreeResult extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_free_result';
+
+
+ public function __construct() {
+ }
+
+ public function handle(Array $params = array()) {
+
+ if (count($params) != 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((mysqli_free_result(%s) || (is_object(%s) && (get_class(%s) == "mysqli_result"))) ? true : false)', $res, $res, $res));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using a conditional expression and mysqli_free_result().';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/Generic.php b/Function/Generic.php
new file mode 100644
index 0000000..ab2537f
--- /dev/null
+++ b/Function/Generic.php
@@ -0,0 +1,152 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_Generic {
+
+ /**
+ *
+ * @const PARSE_ERROR_WRONG_PARAMS
+ */
+ const PARSE_ERROR_WRONG_PARAMS = 'Wrong parameter count. Function call not converted, resulting code is incomplete -- original code used. You must check your source!';
+
+
+ //
+ // public
+ //
+
+ /**
+ * New name of the converted function
+ *
+ * Used only for functions that have MySQLi counterpart that takes the same
+ * parameters as the originial MySQL extension function.
+ *
+ *
+ * @var string
+ */
+ public $new_name;
+
+
+ /**
+ * Name of a variable holding the connection identifier of all functions that rely on default connections
+ *
+ * @var string
+ */
+ public $ston_name = '$GLOBALS["___mysqli_ston"]';
+
+
+ //
+ // public
+ //
+
+ public function __construct($new_name, $ston_name = NULL) {
+
+ $this->new_name = $new_name;
+ if (!is_null($ston_name))
+ $this->ston_name = $ston_name;
+
+ }
+
+
+ /*
+ * Try to use less concats - dots - in the output string
+ *
+ * @param string
+ * @param string
+ */
+ public function smart_concat($par1, $par2) {
+
+ if ($par2[0] !== '"' && $par2[0] !== "'")
+ return '"' . $par1 . '" . ' . $par2;
+
+ return $par2[0] . $par1 . substr($par2, 1);
+ }
+
+
+ /**
+ * Returns a string with the functions call
+ *
+ * @param array list of parameters of the returned function call
+ */
+ public function handle(Array $params = array()) {
+
+ $params = $this->extractParamValues($params);
+ return array(NULL, $this->new_name."(".implode(", ", $params).")");
+ }
+
+
+ /**
+ * Returns a string which describes who the conversion is done
+ *
+ * @return string
+ */
+ public function getConversionHint() {
+
+ return 'Using 1:1 counterpart from the MySQLi extension';
+ }
+
+
+ /**
+ * Returns a PHP comment which describes how the conversion is done
+ *
+ * @return string
+ */
+ public function getConversionPHPComment() {
+
+ $ret = wordwrap($this->getConversionHint(), 60);
+ $ret = explode("\n", $ret);
+ $ret = "\n// [MySQL->MySQLi] " . implode("\n// [MySQL->MySQLi] ", $ret);
+ $ret .= "\n";
+
+ return $ret;
+ }
+
+ //
+ // protected
+ //
+
+ /**
+ * Extracts the parameter values from the parameter scanner hash
+ *
+ * @param array
+ * @return array
+ */
+ protected function extractParamValues($params) {
+
+ $ret = array();
+ foreach ($params as $k => $param) {
+ $ret[] = $param['value'];
+ }
+
+ return $ret;
+ }
+
+
+ /**
+ *
+ */
+ protected function extractValueAndType($var) {
+
+ $var_type = 'const';
+ if ("" != $var && ($var[0] == '"' || $var[0] == "'") && $var[0] == substr($var, -1)) {
+ $var = substr($var, 1, -1);
+ $var_type = 'string_or_var';
+ }
+ if ("" != ($tmp = trim($var)) && $tmp[0] == '$') {
+ $var_type = 'string_or_var';
+ }
+
+ return array($var, $var_type);
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/GenericBoolean.php b/Function/GenericBoolean.php
new file mode 100644
index 0000000..15b48c2
--- /dev/null
+++ b/Function/GenericBoolean.php
@@ -0,0 +1,26 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_GenericBoolean extends MySQLConverterTool_Function_Generic {
+
+
+ public function handle(Array $params = array()) {
+
+ $params = $this->extractParamValues($params);
+ return array(NULL, sprintf('(($___mysqli_tmp = %s(%s)) ? $___mysqli_tmp : false)', $this->new_name, implode(", ", $params)));
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/ListDBs.php b/Function/ListDBs.php
new file mode 100644
index 0000000..41ad3f9
--- /dev/null
+++ b/Function/ListDBs.php
@@ -0,0 +1,45 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListDBs extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_list_dbs ( [resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, sprintf('(($___mysqli_tmp = mysqli_query(%s, "SHOW DATABASES")) ? $___mysqli_tmp : false)', $conn));
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW DATABASES. Returns NULL instead of false in case of an error';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/ListFields.php b/Function/ListFields.php
new file mode 100644
index 0000000..b6bca34
--- /dev/null
+++ b/Function/ListFields.php
@@ -0,0 +1,66 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListFields extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_list_fields ( string database_name, string table_name [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 2 || count($params) > 3)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $table, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+ list($table, $table_type) = $this->extractValueAndType(trim($table));
+
+ $sql = '"SHOW COLUMNS FROM ';
+ if ($db_type == 'const')
+ $sql .= '" . constant(\'' . $db . '\') . ".';
+ else
+ $sql .= $db . '.';
+
+ if ($table_type == 'const')
+ $sql .= '" . constant(\'' . $table . '\')';
+ else
+ $sql .= $table . '"';
+
+ $ret = sprintf('(($___mysqli_tmp = mysqli_query(%s, %s)) ? $___mysqli_tmp : false)', $conn, $sql);
+
+ return array(
+ 'mysql_list_fields(string database_name, string table_name [...]) is emulated using mysqli_query() and SHOW COLUMNS FROM database_name.table_name . This is a possible SQL injection security bug as no tests are performed what value database_name and/or table_name have. Check your script! Additionally, this is not fully compatible to the original expression, check the mysql_list_fields() documentation on php.net!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW COLUMNS FROM table';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/ListProcesses.php b/Function/ListProcesses.php
new file mode 100644
index 0000000..b6a1cd8
--- /dev/null
+++ b/Function/ListProcesses.php
@@ -0,0 +1,48 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListProcesses extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // resource mysql_list_processes ( [resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) > 1)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, sprintf('mysqli_query(%s, "SHOW PROCESSLIST")', $conn));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW PROCESSLIST.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/ListTables.php b/Function/ListTables.php
new file mode 100644
index 0000000..54a3144
--- /dev/null
+++ b/Function/ListTables.php
@@ -0,0 +1,54 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ListTables extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_list_tables ( string database [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+ if ('const' == $db_type) {
+ $ret = sprintf('mysqli_query(%s, "SHOW TABLES FROM " . constant(\'%s\'))', $conn, $db);
+ } else {
+ $ret = sprintf('mysqli_query(%s, "SHOW TABLES FROM %s")', $conn, $db);
+ }
+
+ return array('mysql_list_tables(string database_name [...]) is emulated using mysqli_query() and SHOW TABLES FROM database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and SHOW TABLES FROM.';
+ }
+}
+?>
\ No newline at end of file
diff --git a/Function/ParReversed.php b/Function/ParReversed.php
new file mode 100644
index 0000000..de0a2d1
--- /dev/null
+++ b/Function/ParReversed.php
@@ -0,0 +1,41 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_ParReversed extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_query ( string query [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($par1, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(NULL, "$this->new_name($conn, $par1)");
+ }
+
+
+ function getConversionHint() {
+
+ return 'Generic function for: mysql_func(param1, param2) => mysqli_func(param2, param1). Currently used for mysql_query(), mysql_real_escape_string()';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/RealEscapeString.php b/Function/RealEscapeString.php
new file mode 100644
index 0000000..096e744
--- /dev/null
+++ b/Function/RealEscapeString.php
@@ -0,0 +1,59 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_RealEscapeString extends MySQLConverterTool_Function_Generic {
+
+
+ function handle(Array $params = array()) {
+
+ // string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] )
+ // string mysqli_real_escape_string ( mysqli link, string escapestr )
+
+ if (count($params) == 1) {
+
+ list($string) = $this->extractParamValues($params);
+ $conn = $this->ston_name;
+ $warning = 'If no global connection has been opened already the converter cannot use mysqli_real_escape_string() to emulate the function. We add a runtime test if a connection exists, if not trigger_error() gets used to throw an E_USER_ERROR. It would be a security bug to do anything else. You must fix our code manually!';
+ $ret = sprintf('((isset(%s) && is_object(%s)) ? %s(%s, %s) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""))',
+ $conn,
+ $conn,
+ $this->new_name,
+ $conn,
+ $string
+ );
+
+ } else if (count($params) == 2) {
+
+ list($string, $conn) = @$this->extractParamValues($params);
+ $warning = null;
+ $ret = sprintf('%s(%s, %s)', $this->new_name, $conn, $string);
+
+ } else {
+
+ $warning = self::PARSE_ERROR_WRONG_PARAMS;
+ $ret = null;
+
+ }
+
+ return array($warning, $ret);
+ }
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_real_escape_string and the default connection if no connection is given. If no default connection exists an E_USER_ERROR gets thrown.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/SelectDB.php b/Function/SelectDB.php
new file mode 100644
index 0000000..9cf4c53
--- /dev/null
+++ b/Function/SelectDB.php
@@ -0,0 +1,56 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_SelectDB extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // bool mysql_select_db ( string database_name [, resource link_identifier] )
+ // mixed mysqli_query ( mysqli link, string query [, int resultmode] )
+
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($db, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ list($db, $db_type) = $this->extractValueAndType(trim($db));
+ if ('const' == $db_type) {
+ $ret = sprintf('((bool)mysqli_query(%s, "USE " . constant(\'%s\')))', $conn, $db);
+ } else {
+ $ret = sprintf('((bool)mysqli_query(%s, "USE %s"))', $conn, $db);
+ }
+
+ return array('mysql_select_db(string database_name [...]) is emulated using mysqli_query() and USE database_name. This is a possible SQL injection security bug as no tests are performed what value database_name has. Check your script!', $ret);
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query() and USE.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/Function/Tablename.php b/Function/Tablename.php
new file mode 100644
index 0000000..b9e4058
--- /dev/null
+++ b/Function/Tablename.php
@@ -0,0 +1,45 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_Tablename extends MySQLConverterTool_Function_Generic {
+
+ public $new_name = 'mysqli_fetch_row';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_db_name ( resource result, int row [, mixed field] )
+ // string mysql_tablename ( resource result, int i )
+
+ if (count($params) != 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ list($res, $i) = $this->extractParamValues($params);
+
+ return array(NULL, sprintf('((mysqli_data_seek(%s, %s) && (($___mysqli_tmp = mysqli_fetch_row(%s)) !== NULL)) ? array_shift($___mysqli_tmp) : false)', $res, $i, $res));
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_data_seek(), mysqli_fetch_row() and a conditional expression.';
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/Function/UnbufferedQuery.php b/Function/UnbufferedQuery.php
new file mode 100644
index 0000000..348ad0b
--- /dev/null
+++ b/Function/UnbufferedQuery.php
@@ -0,0 +1,48 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_Function_UnbufferedQuery extends MySQLConverterTool_Function_Generic {
+
+
+ public $new_name = 'mysqli_query';
+
+
+ public function __construct() {
+ }
+
+
+ function handle(Array $params = array()) {
+
+ // mysql_unbuffered_query ( string query [, resource link_identifier] )
+ if (count($params) < 1 || count($params) > 2)
+ return array(self::PARSE_ERROR_WRONG_PARAMS, NULL);
+
+ @list($q, $conn) = $this->extractParamValues($params);
+ if (is_null($conn))
+ $conn = $this->ston_name;
+
+ return array(null, "mysqli_query($conn, $q, MYSQLI_USE_RESULT)");
+ }
+
+
+ function getConversionHint() {
+
+ return 'Emulated using mysqli_query and MYSQLI_USE_RESULT.';
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/GUI/.svn/README.txt b/GUI/.svn/README.txt
new file mode 100644
index 0000000..271a8ce
--- /dev/null
+++ b/GUI/.svn/README.txt
@@ -0,0 +1,2 @@
+This is a Subversion working copy administrative directory.
+Visit http://subversion.tigris.org/ for more information.
diff --git a/GUI/.svn/dir-wcprops b/GUI/.svn/dir-wcprops
new file mode 100644
index 0000000..3811a85
--- /dev/null
+++ b/GUI/.svn/dir-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svnpublic/mysqli_converter/!svn/ver/6/MySQLConverterTool/GUI
+END
diff --git a/GUI/.svn/empty-file b/GUI/.svn/empty-file
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/entries b/GUI/.svn/entries
new file mode 100644
index 0000000..1713588
--- /dev/null
+++ b/GUI/.svn/entries
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GUI/.svn/format b/GUI/.svn/format
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/GUI/.svn/format
@@ -0,0 +1 @@
+4
diff --git a/GUI/.svn/prop-base/convert_directory.php.svn-base b/GUI/.svn/prop-base/convert_directory.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/prop-base/convert_file.php.svn-base b/GUI/.svn/prop-base/convert_file.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/prop-base/convert_snippet.php.svn-base b/GUI/.svn/prop-base/convert_snippet.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/prop-base/help.php.svn-base b/GUI/.svn/prop-base/help.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/prop-base/index.php.svn-base b/GUI/.svn/prop-base/index.php.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/props/convert_directory.php.svn-work b/GUI/.svn/props/convert_directory.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/props/convert_file.php.svn-work b/GUI/.svn/props/convert_file.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/props/convert_snippet.php.svn-work b/GUI/.svn/props/convert_snippet.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/props/help.php.svn-work b/GUI/.svn/props/help.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/props/index.php.svn-work b/GUI/.svn/props/index.php.svn-work
new file mode 100644
index 0000000..e69de29
diff --git a/GUI/.svn/text-base/convert_directory.php.svn-base b/GUI/.svn/text-base/convert_directory.php.svn-base
new file mode 100644
index 0000000..65a4736
--- /dev/null
+++ b/GUI/.svn/text-base/convert_directory.php.svn-base
@@ -0,0 +1,109 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+if (isset($_POST['cancel'])) {
+ // Cancel button
+ header('Location: index.php');
+ exit(0);
+}
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Convert all files from a directory';
+$snippet_nav_path = array($_SERVER['PHP_SELF'] => 'Convert a directory');
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+
+if (empty($_POST) || !isset($_POST['start'])) {
+ // show the form
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/form_directory.php');
+
+} else {
+ // process the form
+ $snippet_errors = array();
+ if ("" == trim($_POST['directory'])) {
+ $snippet_errors['directory'] = 'Please specify a directory';
+ }
+
+ if ("" == trim($_POST['pattern']))
+ $_POST['pattern'] = '*.*';
+
+ require_once('../Converter.php');
+ $conv = new MySQLConverterTool_Converter();
+ $files = $conv->getFilesOfDirectory($_POST['directory'], $_POST['pattern']);
+
+ if (empty($files)) {
+ $snippet_errors['directory'] = 'No matching files found in the specified directory';
+ }
+
+ if (!empty($snippet_errors)) {
+ // show the form
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/form_directory.php');
+ } else {
+ // let's try to convert some files...
+
+ $snippet_conv_found = 0;
+ $snippet_conv_converted = 0;
+ $snippet_conv_ok = 0;
+ $snippet_conv_warnings = 0;
+ $snippet_conv_errors = 0;
+ $snippet_conv_count = count($files);
+ $snippet_conv_length = 0;
+ $outputs = array();
+ foreach ($files as $k => $snippet_file) {
+ $output = $conv->convertFile($snippet_file);
+ $snippet_conv_found += $output['found'];
+ $snippet_conv_converted += $output['converted'];
+ $snippet_conv_ok += ($output['found'] == $output['converted']) && (count($output['errors']) == 0) ? 1 : 0;
+ $snippet_conv_warnings += ($output['found'] == $output['converted']) && (count($output['errors']) > 0) ? 1 : 0;
+ $snippet_conv_errors += ($output['found'] != $output['converted']) && (count($output['errors']) > 0) ? 1 : 0;
+ $snippet_conv_length += strlen($output['output']);
+
+ if (isset($_POST['update']) && $_POST['update'] == 'yes') {
+ if (isset($_POST['backup']) && $_POST['backup'] == 'on') {
+ if (file_exists($snippet_file . '.org'))
+ unlink($snippet_file . '.org');
+ $output['rename'] = rename($snippet_file, $snippet_file . '.org');
+ } else {
+ $output['rename'] = false;
+ }
+ $fp = fopen($snippet_file, 'w');
+ if (!$fp) {
+ $output['update'] = false;
+ } else {
+ $output['update'] = true;
+ fwrite($fp, $output['output']);
+ fclose($fp);
+ }
+ } else {
+ $output['rename'] = false;
+ $output['update'] = false;
+ }
+
+ $outputs[$snippet_file] = $output;
+ }
+
+ // Display some summary information...
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/show_converted_directory.php');
+
+ // Display the results for every file
+ $snippet_show_details = (count($files) == 1) ? true : false;
+ foreach ($outputs as $snippet_file => $snippet_conv)
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/show_converted_file.php');
+
+ }
+
+}
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/footer.php');
+?>
\ No newline at end of file
diff --git a/GUI/.svn/text-base/convert_file.php.svn-base b/GUI/.svn/text-base/convert_file.php.svn-base
new file mode 100644
index 0000000..7614df7
--- /dev/null
+++ b/GUI/.svn/text-base/convert_file.php.svn-base
@@ -0,0 +1,84 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+if (isset($_POST['cancel'])) {
+ // Cancel button
+ header('Location: index.php');
+ exit(0);
+}
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Convert a file';
+$snippet_nav_path = array($_SERVER['PHP_SELF'] => 'Convert a file');
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+
+if (empty($_POST) || !isset($_POST['start'])) {
+ // show the form
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/form_file.php');
+
+} else {
+ // process the form
+ $snippet_errors = array();
+ if ("" == trim($_POST['file'])) {
+ $snippet_errors['file'] = 'Please specify a file.';
+ }
+
+ if (!file_exists($_POST['file']) || !is_file($_POST['file']) || !is_readable($_POST['file'])) {
+ $snippet_errors['file'] = 'Problems reading the file. Please verify that it exists and can be read.';
+ }
+
+
+ if (!empty($snippet_errors)) {
+ // show the form
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/form_file.php');
+ } else {
+ // let's try to convert some files...
+
+ require_once('../Converter.php');
+ $conv = new MySQLConverterTool_Converter();
+
+ $snippet_file = $_POST['file'];
+ $snippet_conv = $conv->convertFile($_POST['file']);
+
+ if (isset($_POST['update']) && $_POST['update'] == 'yes') {
+ if (isset($_POST['backup']) && $_POST['backup'] == 'on') {
+ if (file_exists($snippet_file . '.org'))
+ unlink($snippet_file . '.org');
+ $snippet_conv['rename'] = rename($snippet_file, $snippet_file . '.org');
+ } else {
+ $snippet_conv['rename'] = false;
+ }
+ $fp = fopen($snippet_file, 'w');
+ if (!$fp) {
+ $snippet_conv['update'] = false;
+ } else {
+ $snippet_conv['update'] = true;
+ fwrite($fp, $snippet_conv['output']);
+ fclose($fp);
+ }
+ } else {
+ $snippet_conv['rename'] = false;
+ $snippet_conv['update'] = false;
+ }
+ $snippet_show_details = true;
+
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/show_converted_file.php');
+
+ }
+
+}
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/footer.php');
+?>
\ No newline at end of file
diff --git a/GUI/.svn/text-base/convert_snippet.php.svn-base b/GUI/.svn/text-base/convert_snippet.php.svn-base
new file mode 100644
index 0000000..b83cd8b
--- /dev/null
+++ b/GUI/.svn/text-base/convert_snippet.php.svn-base
@@ -0,0 +1,57 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+if (isset($_POST['cancel'])) {
+ // Cancel button
+ header('Location: index.php');
+ exit(0);
+}
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Convert a code snippet';
+$snippet_nav_path = array($_SERVER['PHP_SELF'] => 'Convert a code snippet');
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+
+if (empty($_POST) || !isset($_POST['start'])) {
+ // show the form
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/form_snippet.php');
+
+} else {
+ // process the form
+ $snippet_errors = array();
+ if ("" == trim($_POST['snippet'])) {
+ $snippet_errors['snippet'] = 'Please provide some code to be converted.';
+ }
+
+ if (!empty($snippet_errors)) {
+ // show the form
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/form_snippet.php');
+ } else {
+ // let's try to convert some files...
+
+ require_once('../Converter.php');
+ $conv = new MySQLConverterTool_Converter();
+
+ $snippet_conv = $conv->convertString($_POST['snippet']);
+ $snippet_show_details = true;
+
+ MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/show_converted_snippet.php');
+
+ }
+
+}
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/footer.php');
+?>
\ No newline at end of file
diff --git a/GUI/.svn/text-base/help.php.svn-base b/GUI/.svn/text-base/help.php.svn-base
new file mode 100644
index 0000000..34f7b94
--- /dev/null
+++ b/GUI/.svn/text-base/help.php.svn-base
@@ -0,0 +1,138 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Help';
+$snippet_nav_path = array($_SERVER['PHP_SELF'] => 'Help');
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+?>
+
About
+
+This is the MySQL ext/mysql Converter Tool. The tool can be used to convert PHP
+files using the PHP MySQL extension (ext/mysql) to make the scripts use the PHP MySQLi extension.
+The PHP MySQL extension has been designed to work with the MySQL Server up to version 4.1.0.
+Some features introduced later, for example prepared statements, are not supported by the extension.
+To use these features, you have to use the PHP MySQLi extension. This tool helps you to convert
+your existing scripts from the old MySQL extension to the new MySQLi extension.
+
+
+The tool uses a simple approach to map mysql_*-functions to their mysqli_*-counterparts.
+All mysql_*-functions can be converted automatically. The generated code will run out of
+the box. However, the tool does not take context and runtime informationn into account
+when it does the conversion. This can lead to situations where the tool is not sure if the
+generated code is semantically identical to the original code in all ways. If this happens,
+a warning will the thrown and you will be requested to check the automatically generated tool
+
+
+The tool has been originally developed by MySQL AB. It is released under the terms of the
+PHP Licence 3.0.
+
+
Where can I get more information?
+
+Plase consult the MySQL Forge Wiki for additional information.
+
+
What cannot be converted automatically?
+
+Use the function MySQLConvertTool_Converter::getUnsupportedFunctions() to get a list of all
+functions which cannot be converted automatically. Currently, the tool does not support
+the conversion of the following, rarely used functions:
+
+
mysql_result()
+
mysql_fetch_field2()
+
+All other mysql_*-functions can be converted automatically.
+
+
What is considered to be a warning?
+
+The converter tool works stateless. It does not take any context or runtime information into account.
+It does nothing but analyze existing mysql_*-functions and tries to translate them into their
+mysqli_*-counterparts. Most expressions can be translated into semantically identical expressions
+using this approach. But there are limits. Whenever such a limit gets hit, the tool throws
+an error and asks you to check your code manually.
+
+
A simple example of an expression which cannot be converted without context information is mysql_error().
+Consider the following PHP code:
+
+The author of the code relies on the default connection feature. mysql_errno() can be called with or without a
+link identifier. The function accepts one optional parameter:
+
+
+
+
+mysql_errno ( [resource link_identifier] )
+
+
+
+
+The mysqli_errno() counterpart of the MySQLi extension must be provided with a link identifier.
+
+
+
+
+mysqli_errno ( mysqli link )
+
+
+
+
+The tool is clever enough to store the return value of mysql_connect() [mysqli_connect()] in a global variable
+and pass the global variable to the mysqli_errno() function call. But if mysqli_connect() fails and does not
+return a link identifier, mysqli_errno() will be called with an invalid parameter. Again, the conversion tool
+is clever enough to add a conditional expression to ensure that the generated code behaves like the original
+code, but this is considered as a "hack" and a "warning" will be thrown. The warning tells you to check manually
+that the generated code is semantically identical to the original code. You could, for example,
+have a mysql_errno() somewhere in your code without a preceding mysql_connect(). That does not make too much sense,
+but it could be. As the converter tool does not consider any state and context information it cannot detect
+such problems. When the mysql_errno() call gets converted no information is available if it is preceded by a mysql_connect()
+call or not.
+
+
+Yes, we think it is worth to throw a warning. You can call it picky. Most of the warnings can be safely
+ignored. But we give no warranty. Check your code manually!
+
+
+There are many more situations when a warning gets thrown. For example, mysql_fetch_field() will be replaced
+by a semantically identical expression, but the replacement is a huge, ugly piece of code which you should streamline.
+
+
Can I safely ignore the warnings?
+
+No, you are strongly requested to check the generated code manually. It is likely that the generated code
+works as expected in most cases, but not in all cases!
+
+
What is considered to be an error?
+
+The tool considers a conversion as failed and all warnings as errors if the number of converted functions
+differs from the number of mysql_*-functions found in the given PHP source.
+
+
Where can I learn more about limitations?
+
+The converter tool comes with more than 50 "real-life" test cases. At least one test case exists for every
+mysql_-function which can be handled by the tool. If a test case contains code which cannot be
+converted automatically into a semantically identical mysqli*-function, the test case name is preceded with
+the word "FAILURE". Check the test cases in the folder UnitTests/Converter/TestCode
+for details.
+
+
\ No newline at end of file
diff --git a/GUI/.svn/text-base/index.php.svn-base b/GUI/.svn/text-base/index.php.svn-base
new file mode 100644
index 0000000..d89db47
--- /dev/null
+++ b/GUI/.svn/text-base/index.php.svn-base
@@ -0,0 +1,46 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'Welcome to the MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Welcome to the MySQL ext/mysq Converter Tool';
+
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+?>
+
+ You have successfully installed the MySQL ext/mysql Converter Tool.
+ The tool helps you to migrate existing PHP code using the PHP MySQL Extension
+ (ext/mysql) to the PHP MySQLi Extension (ext/mysqli). The tool reads the source code
+ and converts all MySQL functions into their MySQLi counterparts.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/help.php b/GUI/help.php
new file mode 100644
index 0000000..31cc689
--- /dev/null
+++ b/GUI/help.php
@@ -0,0 +1,138 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Help';
+$snippet_nav_path = array($_SERVER['PHP_SELF'] => 'Help');
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+?>
+
About
+
+This is the MySQL ext/mysql Converter Tool. The tool can be used to convert PHP
+files using the PHP MySQL extension (ext/mysql) to make the scripts use the PHP MySQLi extension.
+The PHP MySQL extension has been designed to work with the MySQL Server up to version 4.1.0.
+Some features introduced later, for example prepared statements, are not supported by the extension.
+To use these features, you have to use the PHP MySQLi extension. This tool helps you to convert
+your existing scripts from the old MySQL extension to the new MySQLi extension.
+
+
+The tool uses a simple approach to map mysql_*-functions to their mysqli_*-counterparts.
+All mysql_*-functions can be converted automatically. The generated code will run out of
+the box. However, the tool does not take context and runtime informationn into account
+when it does the conversion. This can lead to situations where the tool is not sure if the
+generated code is semantically identical to the original code in all ways. If this happens,
+a warning will the thrown and you will be requested to check the automatically generated tool
+
+
+The tool has been originally developed by MySQL AB. It is released under the terms of the
+PHP Licence 3.0.
+
+
Where can I get more information?
+
+Plase consult the MySQL Forge Wiki for additional information.
+
+
What cannot be converted automatically?
+
+Use the function MySQLConvertTool_Converter::getUnsupportedFunctions() to get a list of all
+functions which cannot be converted automatically. Currently, the tool does not support
+the conversion of the following, rarely used functions:
+
+
mysql_result()
+
mysql_fetch_field2()
+
+All other mysql_*-functions can be converted automatically.
+
+
What is considered to be a warning?
+
+The converter tool works stateless. It does not take any context or runtime information into account.
+It does nothing but analyze existing mysql_*-functions and tries to translate them into their
+mysqli_*-counterparts. Most expressions can be translated into semantically identical expressions
+using this approach. But there are limits. Whenever such a limit gets hit, the tool throws
+an error and asks you to check your code manually.
+
+
A simple example of an expression which cannot be converted without context information is mysql_error().
+Consider the following PHP code:
+
+The author of the code relies on the default connection feature. mysql_errno() can be called with or without a
+link identifier. The function accepts one optional parameter:
+
+
+
+
+mysql_errno ( [resource link_identifier] )
+
+
+
+
+The mysqli_errno() counterpart of the MySQLi extension must be provided with a link identifier.
+
+
+
+
+mysqli_errno ( mysqli link )
+
+
+
+
+The tool is clever enough to store the return value of mysql_connect() [mysqli_connect()] in a global variable
+and pass the global variable to the mysqli_errno() function call. But if mysqli_connect() fails and does not
+return a link identifier, mysqli_errno() will be called with an invalid parameter. Again, the conversion tool
+is clever enough to add a conditional expression to ensure that the generated code behaves like the original
+code, but this is considered as a "hack" and a "warning" will be thrown. The warning tells you to check manually
+that the generated code is semantically identical to the original code. You could, for example,
+have a mysql_errno() somewhere in your code without a preceding mysql_connect(). That does not make too much sense,
+but it could be. As the converter tool does not consider any state and context information it cannot detect
+such problems. When the mysql_errno() call gets converted no information is available if it is preceded by a mysql_connect()
+call or not.
+
+
+Yes, we think it is worth to throw a warning. You can call it picky. Most of the warnings can be safely
+ignored. But we give no warranty. Check your code manually!
+
+
+There are many more situations when a warning gets thrown. For example, mysql_fetch_field() will be replaced
+by a semantically identical expression, but the replacement is a huge, ugly piece of code which you should streamline.
+
+
Can I safely ignore the warnings?
+
+No, you are strongly requested to check the generated code manually. It is likely that the generated code
+works as expected in most cases, but not in all cases!
+
+
What is considered to be an error?
+
+The tool considers a conversion as failed and all warnings as errors if the number of converted functions
+differs from the number of mysql_*-functions found in the given PHP source.
+
+
Where can I learn more about limitations?
+
+The converter tool comes with more than 50 "real-life" test cases. At least one test case exists for every
+mysql_-function which can be handled by the tool. If a test case contains code which cannot be
+converted automatically into a semantically identical mysqli*-function, the test case name is preceded with
+the word "FAILURE". Check the test cases in the folder UnitTests/Converter/TestCode
+for details.
+
+
\ No newline at end of file
diff --git a/GUI/index.php b/GUI/index.php
new file mode 100644
index 0000000..89ebbd6
--- /dev/null
+++ b/GUI/index.php
@@ -0,0 +1,47 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+require_once('snippets/MySQLConverterTool_GUI_Snippets.php');
+
+$snippet_title = 'Welcome to the MySQL ext/mysql Converter Tool';
+$snippet_greeting = 'Welcome to the MySQL ext/mysq Converter Tool';
+
+MySQLConverterTool_GUI_Snippets::load(dirname(__FILE__) . '/snippets/header.php');
+?>
+
+
+
You have successfully installed the MySQL ext/mysql Converter Tool.
+ The tool helps you to migrate existing PHP code using the PHP MySQL Extension
+ (ext/mysql) to the PHP MySQLi Extension (ext/mysqli). The tool reads the source code
+ and converts all MySQL functions into their MySQLi counterparts.
+
+
+
Select one of the following actions:
+
+
+ Convert a directory
+ Use this to convert all PHP files contained in one
+ directory.
+
+
+ Convert a file
+ Use this to convert a single PHP file.
+
+
\ No newline at end of file
diff --git a/GUI/js/application.js b/GUI/js/application.js
new file mode 100644
index 0000000..81b644b
--- /dev/null
+++ b/GUI/js/application.js
@@ -0,0 +1,83 @@
+// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
+// IT'S ALL JUST JUNK FOR OUR DOCS!
+// ++++++++++++++++++++++++++++++++++++++++++
+
+!function ($) {
+
+ $(function(){
+
+ var $window = $(window)
+ var $body = $(document.body)
+
+ var navHeight = $('.navbar').outerHeight(true) + 10
+
+ $body.scrollspy({
+ target: '.bs-sidebar',
+ offset: navHeight
+ })
+
+ $window.on('load', function () {
+ $body.scrollspy('refresh')
+ })
+
+ $('.bs-docs-container [href=#]').click(function (e) {
+ e.preventDefault()
+ })
+
+ // back to top
+ setTimeout(function () {
+ var $sideBar = $('.bs-sidebar')
+
+ $sideBar.affix({
+ offset: {
+ top: function () {
+ var offsetTop = $sideBar.offset().top
+ var sideBarMargin = parseInt($sideBar.children(0).css('margin-top'), 10)
+ var navOuterHeight = $('.bs-docs-nav').height()
+
+ return (this.top = offsetTop - navOuterHeight - sideBarMargin)
+ }
+ , bottom: function () {
+ return (this.bottom = $('.bs-footer').outerHeight(true))
+ }
+ }
+ })
+ }, 100)
+
+ setTimeout(function () {
+ $('.bs-top').affix()
+ }, 100)
+
+ // tooltip demo
+ $('.tooltip-demo').tooltip({
+ selector: "[data-toggle=tooltip]",
+ container: "body"
+ })
+
+ $('.tooltip-test').tooltip()
+ $('.popover-test').popover()
+
+ $('.bs-docs-navbar').tooltip({
+ selector: "a[data-toggle=tooltip]",
+ container: ".bs-docs-navbar .nav"
+ })
+
+ // popover demo
+ $("[data-toggle=popover]")
+ .popover()
+
+ // button state demo
+ $('#fat-btn')
+ .click(function () {
+ var btn = $(this)
+ btn.button('loading')
+ setTimeout(function () {
+ btn.button('reset')
+ }, 3000)
+ })
+
+ // carousel demo
+ $('.bs-docs-carousel-example').carousel()
+})
+
+}(window.jQuery)
diff --git a/GUI/js/bootstrap.js b/GUI/js/bootstrap.js
new file mode 100644
index 0000000..2c64257
--- /dev/null
+++ b/GUI/js/bootstrap.js
@@ -0,0 +1,1999 @@
+/**
+* bootstrap.js v3.0.0 by @fat and @mdo
+* Copyright 2013 Twitter Inc.
+* http://www.apache.org/licenses/LICENSE-2.0
+*/
+if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
+
+/* ========================================================================
+ * Bootstrap: transition.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#transitions
+ * ========================================================================
+ * Copyright 2013 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
+ // ============================================================
+
+ function transitionEnd() {
+ var el = document.createElement('bootstrap')
+
+ var transEndEventNames = {
+ 'WebkitTransition' : 'webkitTransitionEnd'
+ , 'MozTransition' : 'transitionend'
+ , 'OTransition' : 'oTransitionEnd otransitionend'
+ , 'transition' : 'transitionend'
+ }
+
+ for (var name in transEndEventNames) {
+ if (el.style[name] !== undefined) {
+ return { end: transEndEventNames[name] }
+ }
+ }
+ }
+
+ // http://blog.alexmaccaw.com/css-transitions
+ $.fn.emulateTransitionEnd = function (duration) {
+ var called = false, $el = this
+ $(this).one($.support.transition.end, function () { called = true })
+ var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
+ setTimeout(callback, duration)
+ return this
+ }
+
+ $(function () {
+ $.support.transition = transitionEnd()
+ })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: alert.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#alerts
+ * ========================================================================
+ * Copyright 2013 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // ALERT CLASS DEFINITION
+ // ======================
+
+ var dismiss = '[data-dismiss="alert"]'
+ var Alert = function (el) {
+ $(el).on('click', dismiss, this.close)
+ }
+
+ Alert.prototype.close = function (e) {
+ var $this = $(this)
+ var selector = $this.attr('data-target')
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
+ }
+
+ var $parent = $(selector)
+
+ if (e) e.preventDefault()
+
+ if (!$parent.length) {
+ $parent = $this.hasClass('alert') ? $this : $this.parent()
+ }
+
+ $parent.trigger(e = $.Event('close.bs.alert'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent.removeClass('in')
+
+ function removeElement() {
+ $parent.trigger('closed.bs.alert').remove()
+ }
+
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent
+ .one($.support.transition.end, removeElement)
+ .emulateTransitionEnd(150) :
+ removeElement()
+ }
+
+
+ // ALERT PLUGIN DEFINITION
+ // =======================
+
+ var old = $.fn.alert
+
+ $.fn.alert = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.alert')
+
+ if (!data) $this.data('bs.alert', (data = new Alert(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.alert.Constructor = Alert
+
+
+ // ALERT NO CONFLICT
+ // =================
+
+ $.fn.alert.noConflict = function () {
+ $.fn.alert = old
+ return this
+ }
+
+
+ // ALERT DATA-API
+ // ==============
+
+ $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: button.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#buttons
+ * ========================================================================
+ * Copyright 2013 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // BUTTON PUBLIC CLASS DEFINITION
+ // ==============================
+
+ var Button = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, Button.DEFAULTS, options)
+ }
+
+ Button.DEFAULTS = {
+ loadingText: 'loading...'
+ }
+
+ Button.prototype.setState = function (state) {
+ var d = 'disabled'
+ var $el = this.$element
+ var val = $el.is('input') ? 'val' : 'html'
+ var data = $el.data()
+
+ state = state + 'Text'
+
+ if (!data.resetText) $el.data('resetText', $el[val]())
+
+ $el[val](data[state] || this.options[state])
+
+ // push to event loop to allow forms to submit
+ setTimeout(function () {
+ state == 'loadingText' ?
+ $el.addClass(d).attr(d, d) :
+ $el.removeClass(d).removeAttr(d);
+ }, 0)
+ }
+
+ Button.prototype.toggle = function () {
+ var $parent = this.$element.closest('[data-toggle="buttons"]')
+
+ if ($parent.length) {
+ var $input = this.$element.find('input')
+ .prop('checked', !this.$element.hasClass('active'))
+ .trigger('change')
+ if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active')
+ }
+
+ this.$element.toggleClass('active')
+ }
+
+
+ // BUTTON PLUGIN DEFINITION
+ // ========================
+
+ var old = $.fn.button
+
+ $.fn.button = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.button')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.button', (data = new Button(this, options)))
+
+ if (option == 'toggle') data.toggle()
+ else if (option) data.setState(option)
+ })
+ }
+
+ $.fn.button.Constructor = Button
+
+
+ // BUTTON NO CONFLICT
+ // ==================
+
+ $.fn.button.noConflict = function () {
+ $.fn.button = old
+ return this
+ }
+
+
+ // BUTTON DATA-API
+ // ===============
+
+ $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) {
+ var $btn = $(e.target)
+ if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
+ $btn.button('toggle')
+ e.preventDefault()
+ })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: carousel.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#carousel
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // CAROUSEL CLASS DEFINITION
+ // =========================
+
+ var Carousel = function (element, options) {
+ this.$element = $(element)
+ this.$indicators = this.$element.find('.carousel-indicators')
+ this.options = options
+ this.paused =
+ this.sliding =
+ this.interval =
+ this.$active =
+ this.$items = null
+
+ this.options.pause == 'hover' && this.$element
+ .on('mouseenter', $.proxy(this.pause, this))
+ .on('mouseleave', $.proxy(this.cycle, this))
+ }
+
+ Carousel.DEFAULTS = {
+ interval: 5000
+ , pause: 'hover'
+ , wrap: true
+ }
+
+ Carousel.prototype.cycle = function (e) {
+ e || (this.paused = false)
+
+ this.interval && clearInterval(this.interval)
+
+ this.options.interval
+ && !this.paused
+ && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
+
+ return this
+ }
+
+ Carousel.prototype.getActiveIndex = function () {
+ this.$active = this.$element.find('.item.active')
+ this.$items = this.$active.parent().children()
+
+ return this.$items.index(this.$active)
+ }
+
+ Carousel.prototype.to = function (pos) {
+ var that = this
+ var activeIndex = this.getActiveIndex()
+
+ if (pos > (this.$items.length - 1) || pos < 0) return
+
+ if (this.sliding) return this.$element.one('slid', function () { that.to(pos) })
+ if (activeIndex == pos) return this.pause().cycle()
+
+ return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
+ }
+
+ Carousel.prototype.pause = function (e) {
+ e || (this.paused = true)
+
+ if (this.$element.find('.next, .prev').length && $.support.transition.end) {
+ this.$element.trigger($.support.transition.end)
+ this.cycle(true)
+ }
+
+ this.interval = clearInterval(this.interval)
+
+ return this
+ }
+
+ Carousel.prototype.next = function () {
+ if (this.sliding) return
+ return this.slide('next')
+ }
+
+ Carousel.prototype.prev = function () {
+ if (this.sliding) return
+ return this.slide('prev')
+ }
+
+ Carousel.prototype.slide = function (type, next) {
+ var $active = this.$element.find('.item.active')
+ var $next = next || $active[type]()
+ var isCycling = this.interval
+ var direction = type == 'next' ? 'left' : 'right'
+ var fallback = type == 'next' ? 'first' : 'last'
+ var that = this
+
+ if (!$next.length) {
+ if (!this.options.wrap) return
+ $next = this.$element.find('.item')[fallback]()
+ }
+
+ this.sliding = true
+
+ isCycling && this.pause()
+
+ var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
+
+ if ($next.hasClass('active')) return
+
+ if (this.$indicators.length) {
+ this.$indicators.find('.active').removeClass('active')
+ this.$element.one('slid', function () {
+ var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()])
+ $nextIndicator && $nextIndicator.addClass('active')
+ })
+ }
+
+ if ($.support.transition && this.$element.hasClass('slide')) {
+ this.$element.trigger(e)
+ if (e.isDefaultPrevented()) return
+ $next.addClass(type)
+ $next[0].offsetWidth // force reflow
+ $active.addClass(direction)
+ $next.addClass(direction)
+ $active
+ .one($.support.transition.end, function () {
+ $next.removeClass([type, direction].join(' ')).addClass('active')
+ $active.removeClass(['active', direction].join(' '))
+ that.sliding = false
+ setTimeout(function () { that.$element.trigger('slid') }, 0)
+ })
+ .emulateTransitionEnd(600)
+ } else {
+ this.$element.trigger(e)
+ if (e.isDefaultPrevented()) return
+ $active.removeClass('active')
+ $next.addClass('active')
+ this.sliding = false
+ this.$element.trigger('slid')
+ }
+
+ isCycling && this.cycle()
+
+ return this
+ }
+
+
+ // CAROUSEL PLUGIN DEFINITION
+ // ==========================
+
+ var old = $.fn.carousel
+
+ $.fn.carousel = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.carousel')
+ var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
+ var action = typeof option == 'string' ? option : options.slide
+
+ if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
+ if (typeof option == 'number') data.to(option)
+ else if (action) data[action]()
+ else if (options.interval) data.pause().cycle()
+ })
+ }
+
+ $.fn.carousel.Constructor = Carousel
+
+
+ // CAROUSEL NO CONFLICT
+ // ====================
+
+ $.fn.carousel.noConflict = function () {
+ $.fn.carousel = old
+ return this
+ }
+
+
+ // CAROUSEL DATA-API
+ // =================
+
+ $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
+ var $this = $(this), href
+ var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+ var options = $.extend({}, $target.data(), $this.data())
+ var slideIndex = $this.attr('data-slide-to')
+ if (slideIndex) options.interval = false
+
+ $target.carousel(options)
+
+ if (slideIndex = $this.attr('data-slide-to')) {
+ $target.data('bs.carousel').to(slideIndex)
+ }
+
+ e.preventDefault()
+ })
+
+ $(window).on('load', function () {
+ $('[data-ride="carousel"]').each(function () {
+ var $carousel = $(this)
+ $carousel.carousel($carousel.data())
+ })
+ })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: collapse.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#collapse
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // COLLAPSE PUBLIC CLASS DEFINITION
+ // ================================
+
+ var Collapse = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, Collapse.DEFAULTS, options)
+ this.transitioning = null
+
+ if (this.options.parent) this.$parent = $(this.options.parent)
+ if (this.options.toggle) this.toggle()
+ }
+
+ Collapse.DEFAULTS = {
+ toggle: true
+ }
+
+ Collapse.prototype.dimension = function () {
+ var hasWidth = this.$element.hasClass('width')
+ return hasWidth ? 'width' : 'height'
+ }
+
+ Collapse.prototype.show = function () {
+ if (this.transitioning || this.$element.hasClass('in')) return
+
+ var startEvent = $.Event('show.bs.collapse')
+ this.$element.trigger(startEvent)
+ if (startEvent.isDefaultPrevented()) return
+
+ var actives = this.$parent && this.$parent.find('> .panel > .in')
+
+ if (actives && actives.length) {
+ var hasData = actives.data('bs.collapse')
+ if (hasData && hasData.transitioning) return
+ actives.collapse('hide')
+ hasData || actives.data('bs.collapse', null)
+ }
+
+ var dimension = this.dimension()
+
+ this.$element
+ .removeClass('collapse')
+ .addClass('collapsing')
+ [dimension](0)
+
+ this.transitioning = 1
+
+ var complete = function () {
+ this.$element
+ .removeClass('collapsing')
+ .addClass('in')
+ [dimension]('auto')
+ this.transitioning = 0
+ this.$element.trigger('shown.bs.collapse')
+ }
+
+ if (!$.support.transition) return complete.call(this)
+
+ var scrollSize = $.camelCase(['scroll', dimension].join('-'))
+
+ this.$element
+ .one($.support.transition.end, $.proxy(complete, this))
+ .emulateTransitionEnd(350)
+ [dimension](this.$element[0][scrollSize])
+ }
+
+ Collapse.prototype.hide = function () {
+ if (this.transitioning || !this.$element.hasClass('in')) return
+
+ var startEvent = $.Event('hide.bs.collapse')
+ this.$element.trigger(startEvent)
+ if (startEvent.isDefaultPrevented()) return
+
+ var dimension = this.dimension()
+
+ this.$element
+ [dimension](this.$element[dimension]())
+ [0].offsetHeight
+
+ this.$element
+ .addClass('collapsing')
+ .removeClass('collapse')
+ .removeClass('in')
+
+ this.transitioning = 1
+
+ var complete = function () {
+ this.transitioning = 0
+ this.$element
+ .trigger('hidden.bs.collapse')
+ .removeClass('collapsing')
+ .addClass('collapse')
+ }
+
+ if (!$.support.transition) return complete.call(this)
+
+ this.$element
+ [dimension](0)
+ .one($.support.transition.end, $.proxy(complete, this))
+ .emulateTransitionEnd(350)
+ }
+
+ Collapse.prototype.toggle = function () {
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
+ }
+
+
+ // COLLAPSE PLUGIN DEFINITION
+ // ==========================
+
+ var old = $.fn.collapse
+
+ $.fn.collapse = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.collapse')
+ var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
+
+ if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.collapse.Constructor = Collapse
+
+
+ // COLLAPSE NO CONFLICT
+ // ====================
+
+ $.fn.collapse.noConflict = function () {
+ $.fn.collapse = old
+ return this
+ }
+
+
+ // COLLAPSE DATA-API
+ // =================
+
+ $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
+ var $this = $(this), href
+ var target = $this.attr('data-target')
+ || e.preventDefault()
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
+ var $target = $(target)
+ var data = $target.data('bs.collapse')
+ var option = data ? 'toggle' : $this.data()
+ var parent = $this.attr('data-parent')
+ var $parent = parent && $(parent)
+
+ if (!data || !data.transitioning) {
+ if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
+ $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
+ }
+
+ $target.collapse(option)
+ })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: dropdown.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#dropdowns
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // DROPDOWN CLASS DEFINITION
+ // =========================
+
+ var backdrop = '.dropdown-backdrop'
+ var toggle = '[data-toggle=dropdown]'
+ var Dropdown = function (element) {
+ var $el = $(element).on('click.bs.dropdown', this.toggle)
+ }
+
+ Dropdown.prototype.toggle = function (e) {
+ var $this = $(this)
+
+ if ($this.is('.disabled, :disabled')) return
+
+ var $parent = getParent($this)
+ var isActive = $parent.hasClass('open')
+
+ clearMenus()
+
+ if (!isActive) {
+ if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
+ // if mobile we we use a backdrop because click events don't delegate
+ $('').insertAfter($(this)).on('click', clearMenus)
+ }
+
+ $parent.trigger(e = $.Event('show.bs.dropdown'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent
+ .toggleClass('open')
+ .trigger('shown.bs.dropdown')
+
+ $this.focus()
+ }
+
+ return false
+ }
+
+ Dropdown.prototype.keydown = function (e) {
+ if (!/(38|40|27)/.test(e.keyCode)) return
+
+ var $this = $(this)
+
+ e.preventDefault()
+ e.stopPropagation()
+
+ if ($this.is('.disabled, :disabled')) return
+
+ var $parent = getParent($this)
+ var isActive = $parent.hasClass('open')
+
+ if (!isActive || (isActive && e.keyCode == 27)) {
+ if (e.which == 27) $parent.find(toggle).focus()
+ return $this.click()
+ }
+
+ var $items = $('[role=menu] li:not(.divider):visible a', $parent)
+
+ if (!$items.length) return
+
+ var index = $items.index($items.filter(':focus'))
+
+ if (e.keyCode == 38 && index > 0) index-- // up
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
+ if (!~index) index=0
+
+ $items.eq(index).focus()
+ }
+
+ function clearMenus() {
+ $(backdrop).remove()
+ $(toggle).each(function (e) {
+ var $parent = getParent($(this))
+ if (!$parent.hasClass('open')) return
+ $parent.trigger(e = $.Event('hide.bs.dropdown'))
+ if (e.isDefaultPrevented()) return
+ $parent.removeClass('open').trigger('hidden.bs.dropdown')
+ })
+ }
+
+ function getParent($this) {
+ var selector = $this.attr('data-target')
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ var $parent = selector && $(selector)
+
+ return $parent && $parent.length ? $parent : $this.parent()
+ }
+
+
+ // DROPDOWN PLUGIN DEFINITION
+ // ==========================
+
+ var old = $.fn.dropdown
+
+ $.fn.dropdown = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('dropdown')
+
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.dropdown.Constructor = Dropdown
+
+
+ // DROPDOWN NO CONFLICT
+ // ====================
+
+ $.fn.dropdown.noConflict = function () {
+ $.fn.dropdown = old
+ return this
+ }
+
+
+ // APPLY TO STANDARD DROPDOWN ELEMENTS
+ // ===================================
+
+ $(document)
+ .on('click.bs.dropdown.data-api', clearMenus)
+ .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
+ .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
+ .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: modal.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#modals
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // MODAL CLASS DEFINITION
+ // ======================
+
+ var Modal = function (element, options) {
+ this.options = options
+ this.$element = $(element)
+ this.$backdrop =
+ this.isShown = null
+
+ if (this.options.remote) this.$element.load(this.options.remote)
+ }
+
+ Modal.DEFAULTS = {
+ backdrop: true
+ , keyboard: true
+ , show: true
+ }
+
+ Modal.prototype.toggle = function (_relatedTarget) {
+ return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
+ }
+
+ Modal.prototype.show = function (_relatedTarget) {
+ var that = this
+ var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
+
+ this.$element.trigger(e)
+
+ if (this.isShown || e.isDefaultPrevented()) return
+
+ this.isShown = true
+
+ this.escape()
+
+ this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+
+ this.backdrop(function () {
+ var transition = $.support.transition && that.$element.hasClass('fade')
+
+ if (!that.$element.parent().length) {
+ that.$element.appendTo(document.body) // don't move modals dom position
+ }
+
+ that.$element.show()
+
+ if (transition) {
+ that.$element[0].offsetWidth // force reflow
+ }
+
+ that.$element
+ .addClass('in')
+ .attr('aria-hidden', false)
+
+ that.enforceFocus()
+
+ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
+
+ transition ?
+ that.$element.find('.modal-dialog') // wait for modal to slide in
+ .one($.support.transition.end, function () {
+ that.$element.focus().trigger(e)
+ })
+ .emulateTransitionEnd(300) :
+ that.$element.focus().trigger(e)
+ })
+ }
+
+ Modal.prototype.hide = function (e) {
+ if (e) e.preventDefault()
+
+ e = $.Event('hide.bs.modal')
+
+ this.$element.trigger(e)
+
+ if (!this.isShown || e.isDefaultPrevented()) return
+
+ this.isShown = false
+
+ this.escape()
+
+ $(document).off('focusin.bs.modal')
+
+ this.$element
+ .removeClass('in')
+ .attr('aria-hidden', true)
+ .off('click.dismiss.modal')
+
+ $.support.transition && this.$element.hasClass('fade') ?
+ this.$element
+ .one($.support.transition.end, $.proxy(this.hideModal, this))
+ .emulateTransitionEnd(300) :
+ this.hideModal()
+ }
+
+ Modal.prototype.enforceFocus = function () {
+ $(document)
+ .off('focusin.bs.modal') // guard against infinite focus loop
+ .on('focusin.bs.modal', $.proxy(function (e) {
+ if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
+ this.$element.focus()
+ }
+ }, this))
+ }
+
+ Modal.prototype.escape = function () {
+ if (this.isShown && this.options.keyboard) {
+ this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
+ e.which == 27 && this.hide()
+ }, this))
+ } else if (!this.isShown) {
+ this.$element.off('keyup.dismiss.bs.modal')
+ }
+ }
+
+ Modal.prototype.hideModal = function () {
+ var that = this
+ this.$element.hide()
+ this.backdrop(function () {
+ that.removeBackdrop()
+ that.$element.trigger('hidden.bs.modal')
+ })
+ }
+
+ Modal.prototype.removeBackdrop = function () {
+ this.$backdrop && this.$backdrop.remove()
+ this.$backdrop = null
+ }
+
+ Modal.prototype.backdrop = function (callback) {
+ var that = this
+ var animate = this.$element.hasClass('fade') ? 'fade' : ''
+
+ if (this.isShown && this.options.backdrop) {
+ var doAnimate = $.support.transition && animate
+
+ this.$backdrop = $('')
+ .appendTo(document.body)
+
+ this.$element.on('click.dismiss.modal', $.proxy(function (e) {
+ if (e.target !== e.currentTarget) return
+ this.options.backdrop == 'static'
+ ? this.$element[0].focus.call(this.$element[0])
+ : this.hide.call(this)
+ }, this))
+
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
+
+ this.$backdrop.addClass('in')
+
+ if (!callback) return
+
+ doAnimate ?
+ this.$backdrop
+ .one($.support.transition.end, callback)
+ .emulateTransitionEnd(150) :
+ callback()
+
+ } else if (!this.isShown && this.$backdrop) {
+ this.$backdrop.removeClass('in')
+
+ $.support.transition && this.$element.hasClass('fade')?
+ this.$backdrop
+ .one($.support.transition.end, callback)
+ .emulateTransitionEnd(150) :
+ callback()
+
+ } else if (callback) {
+ callback()
+ }
+ }
+
+
+ // MODAL PLUGIN DEFINITION
+ // =======================
+
+ var old = $.fn.modal
+
+ $.fn.modal = function (option, _relatedTarget) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.modal')
+ var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
+
+ if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
+ if (typeof option == 'string') data[option](_relatedTarget)
+ else if (options.show) data.show(_relatedTarget)
+ })
+ }
+
+ $.fn.modal.Constructor = Modal
+
+
+ // MODAL NO CONFLICT
+ // =================
+
+ $.fn.modal.noConflict = function () {
+ $.fn.modal = old
+ return this
+ }
+
+
+ // MODAL DATA-API
+ // ==============
+
+ $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
+ var $this = $(this)
+ var href = $this.attr('href')
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
+ var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
+
+ e.preventDefault()
+
+ $target
+ .modal(option, this)
+ .one('hide', function () {
+ $this.is(':visible') && $this.focus()
+ })
+ })
+
+ $(document)
+ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
+ .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: tooltip.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#tooltip
+ * Inspired by the original jQuery.tipsy by Jason Frame
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // TOOLTIP PUBLIC CLASS DEFINITION
+ // ===============================
+
+ var Tooltip = function (element, options) {
+ this.type =
+ this.options =
+ this.enabled =
+ this.timeout =
+ this.hoverState =
+ this.$element = null
+
+ this.init('tooltip', element, options)
+ }
+
+ Tooltip.DEFAULTS = {
+ animation: true
+ , placement: 'top'
+ , selector: false
+ , template: '
'
+ , trigger: 'hover focus'
+ , title: ''
+ , delay: 0
+ , html: false
+ , container: false
+ }
+
+ Tooltip.prototype.init = function (type, element, options) {
+ this.enabled = true
+ this.type = type
+ this.$element = $(element)
+ this.options = this.getOptions(options)
+
+ var triggers = this.options.trigger.split(' ')
+
+ for (var i = triggers.length; i--;) {
+ var trigger = triggers[i]
+
+ if (trigger == 'click') {
+ this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
+ } else if (trigger != 'manual') {
+ var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
+ var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
+
+ this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
+ this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
+ }
+ }
+
+ this.options.selector ?
+ (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
+ this.fixTitle()
+ }
+
+ Tooltip.prototype.getDefaults = function () {
+ return Tooltip.DEFAULTS
+ }
+
+ Tooltip.prototype.getOptions = function (options) {
+ options = $.extend({}, this.getDefaults(), this.$element.data(), options)
+
+ if (options.delay && typeof options.delay == 'number') {
+ options.delay = {
+ show: options.delay
+ , hide: options.delay
+ }
+ }
+
+ return options
+ }
+
+ Tooltip.prototype.getDelegateOptions = function () {
+ var options = {}
+ var defaults = this.getDefaults()
+
+ this._options && $.each(this._options, function (key, value) {
+ if (defaults[key] != value) options[key] = value
+ })
+
+ return options
+ }
+
+ Tooltip.prototype.enter = function (obj) {
+ var self = obj instanceof this.constructor ?
+ obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
+
+ clearTimeout(self.timeout)
+
+ self.hoverState = 'in'
+
+ if (!self.options.delay || !self.options.delay.show) return self.show()
+
+ self.timeout = setTimeout(function () {
+ if (self.hoverState == 'in') self.show()
+ }, self.options.delay.show)
+ }
+
+ Tooltip.prototype.leave = function (obj) {
+ var self = obj instanceof this.constructor ?
+ obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
+
+ clearTimeout(self.timeout)
+
+ self.hoverState = 'out'
+
+ if (!self.options.delay || !self.options.delay.hide) return self.hide()
+
+ self.timeout = setTimeout(function () {
+ if (self.hoverState == 'out') self.hide()
+ }, self.options.delay.hide)
+ }
+
+ Tooltip.prototype.show = function () {
+ var e = $.Event('show.bs.'+ this.type)
+
+ if (this.hasContent() && this.enabled) {
+ this.$element.trigger(e)
+
+ if (e.isDefaultPrevented()) return
+
+ var $tip = this.tip()
+
+ this.setContent()
+
+ if (this.options.animation) $tip.addClass('fade')
+
+ var placement = typeof this.options.placement == 'function' ?
+ this.options.placement.call(this, $tip[0], this.$element[0]) :
+ this.options.placement
+
+ var autoToken = /\s?auto?\s?/i
+ var autoPlace = autoToken.test(placement)
+ if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
+
+ $tip
+ .detach()
+ .css({ top: 0, left: 0, display: 'block' })
+ .addClass(placement)
+
+ this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
+
+ var pos = this.getPosition()
+ var actualWidth = $tip[0].offsetWidth
+ var actualHeight = $tip[0].offsetHeight
+
+ if (autoPlace) {
+ var $parent = this.$element.parent()
+
+ var orgPlacement = placement
+ var docScroll = document.documentElement.scrollTop || document.body.scrollTop
+ var parentWidth = this.options.container == 'body' ? window.innerWidth : $parent.outerWidth()
+ var parentHeight = this.options.container == 'body' ? window.innerHeight : $parent.outerHeight()
+ var parentLeft = this.options.container == 'body' ? 0 : $parent.offset().left
+
+ placement = placement == 'bottom' && pos.top + pos.height + actualHeight - docScroll > parentHeight ? 'top' :
+ placement == 'top' && pos.top - docScroll - actualHeight < 0 ? 'bottom' :
+ placement == 'right' && pos.right + actualWidth > parentWidth ? 'left' :
+ placement == 'left' && pos.left - actualWidth < parentLeft ? 'right' :
+ placement
+
+ $tip
+ .removeClass(orgPlacement)
+ .addClass(placement)
+ }
+
+ var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
+
+ this.applyPlacement(calculatedOffset, placement)
+ this.$element.trigger('shown.bs.' + this.type)
+ }
+ }
+
+ Tooltip.prototype.applyPlacement = function(offset, placement) {
+ var replace
+ var $tip = this.tip()
+ var width = $tip[0].offsetWidth
+ var height = $tip[0].offsetHeight
+
+ // manually read margins because getBoundingClientRect includes difference
+ var marginTop = parseInt($tip.css('margin-top'), 10)
+ var marginLeft = parseInt($tip.css('margin-left'), 10)
+
+ // we must check for NaN for ie 8/9
+ if (isNaN(marginTop)) marginTop = 0
+ if (isNaN(marginLeft)) marginLeft = 0
+
+ offset.top = offset.top + marginTop
+ offset.left = offset.left + marginLeft
+
+ $tip
+ .offset(offset)
+ .addClass('in')
+
+ // check to see if placing tip in new offset caused the tip to resize itself
+ var actualWidth = $tip[0].offsetWidth
+ var actualHeight = $tip[0].offsetHeight
+
+ if (placement == 'top' && actualHeight != height) {
+ replace = true
+ offset.top = offset.top + height - actualHeight
+ }
+
+ if (/bottom|top/.test(placement)) {
+ var delta = 0
+
+ if (offset.left < 0) {
+ delta = offset.left * -2
+ offset.left = 0
+
+ $tip.offset(offset)
+
+ actualWidth = $tip[0].offsetWidth
+ actualHeight = $tip[0].offsetHeight
+ }
+
+ this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
+ } else {
+ this.replaceArrow(actualHeight - height, actualHeight, 'top')
+ }
+
+ if (replace) $tip.offset(offset)
+ }
+
+ Tooltip.prototype.replaceArrow = function(delta, dimension, position) {
+ this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
+ }
+
+ Tooltip.prototype.setContent = function () {
+ var $tip = this.tip()
+ var title = this.getTitle()
+
+ $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
+ $tip.removeClass('fade in top bottom left right')
+ }
+
+ Tooltip.prototype.hide = function () {
+ var that = this
+ var $tip = this.tip()
+ var e = $.Event('hide.bs.' + this.type)
+
+ function complete() {
+ if (that.hoverState != 'in') $tip.detach()
+ }
+
+ this.$element.trigger(e)
+
+ if (e.isDefaultPrevented()) return
+
+ $tip.removeClass('in')
+
+ $.support.transition && this.$tip.hasClass('fade') ?
+ $tip
+ .one($.support.transition.end, complete)
+ .emulateTransitionEnd(150) :
+ complete()
+
+ this.$element.trigger('hidden.bs.' + this.type)
+
+ return this
+ }
+
+ Tooltip.prototype.fixTitle = function () {
+ var $e = this.$element
+ if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
+ $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
+ }
+ }
+
+ Tooltip.prototype.hasContent = function () {
+ return this.getTitle()
+ }
+
+ Tooltip.prototype.getPosition = function () {
+ var el = this.$element[0]
+ return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
+ width: el.offsetWidth
+ , height: el.offsetHeight
+ }, this.$element.offset())
+ }
+
+ Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
+ return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
+ placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
+ placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
+ /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
+ }
+
+ Tooltip.prototype.getTitle = function () {
+ var title
+ var $e = this.$element
+ var o = this.options
+
+ title = $e.attr('data-original-title')
+ || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
+
+ return title
+ }
+
+ Tooltip.prototype.tip = function () {
+ return this.$tip = this.$tip || $(this.options.template)
+ }
+
+ Tooltip.prototype.arrow = function () {
+ return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
+ }
+
+ Tooltip.prototype.validate = function () {
+ if (!this.$element[0].parentNode) {
+ this.hide()
+ this.$element = null
+ this.options = null
+ }
+ }
+
+ Tooltip.prototype.enable = function () {
+ this.enabled = true
+ }
+
+ Tooltip.prototype.disable = function () {
+ this.enabled = false
+ }
+
+ Tooltip.prototype.toggleEnabled = function () {
+ this.enabled = !this.enabled
+ }
+
+ Tooltip.prototype.toggle = function (e) {
+ var self = e ? $(e.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type) : this
+ self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
+ }
+
+ Tooltip.prototype.destroy = function () {
+ this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
+ }
+
+
+ // TOOLTIP PLUGIN DEFINITION
+ // =========================
+
+ var old = $.fn.tooltip
+
+ $.fn.tooltip = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.tooltip')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.tooltip.Constructor = Tooltip
+
+
+ // TOOLTIP NO CONFLICT
+ // ===================
+
+ $.fn.tooltip.noConflict = function () {
+ $.fn.tooltip = old
+ return this
+ }
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: popover.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#popovers
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // POPOVER PUBLIC CLASS DEFINITION
+ // ===============================
+
+ var Popover = function (element, options) {
+ this.init('popover', element, options)
+ }
+
+ if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
+
+ Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
+ placement: 'right'
+ , trigger: 'click'
+ , content: ''
+ , template: '
'
+ })
+
+
+ // NOTE: POPOVER EXTENDS tooltip.js
+ // ================================
+
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
+
+ Popover.prototype.constructor = Popover
+
+ Popover.prototype.getDefaults = function () {
+ return Popover.DEFAULTS
+ }
+
+ Popover.prototype.setContent = function () {
+ var $tip = this.tip()
+ var title = this.getTitle()
+ var content = this.getContent()
+
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
+ $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
+
+ $tip.removeClass('fade top bottom left right in')
+
+ // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
+ // this manually by checking the contents.
+ if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
+ }
+
+ Popover.prototype.hasContent = function () {
+ return this.getTitle() || this.getContent()
+ }
+
+ Popover.prototype.getContent = function () {
+ var $e = this.$element
+ var o = this.options
+
+ return $e.attr('data-content')
+ || (typeof o.content == 'function' ?
+ o.content.call($e[0]) :
+ o.content)
+ }
+
+ Popover.prototype.arrow = function () {
+ return this.$arrow = this.$arrow || this.tip().find('.arrow')
+ }
+
+ Popover.prototype.tip = function () {
+ if (!this.$tip) this.$tip = $(this.options.template)
+ return this.$tip
+ }
+
+
+ // POPOVER PLUGIN DEFINITION
+ // =========================
+
+ var old = $.fn.popover
+
+ $.fn.popover = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.popover')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.popover.Constructor = Popover
+
+
+ // POPOVER NO CONFLICT
+ // ===================
+
+ $.fn.popover.noConflict = function () {
+ $.fn.popover = old
+ return this
+ }
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: scrollspy.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#scrollspy
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // SCROLLSPY CLASS DEFINITION
+ // ==========================
+
+ function ScrollSpy(element, options) {
+ var href
+ var process = $.proxy(this.process, this)
+
+ this.$element = $(element).is('body') ? $(window) : $(element)
+ this.$body = $('body')
+ this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process)
+ this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
+ this.selector = (this.options.target
+ || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
+ || '') + ' .nav li > a'
+ this.offsets = $([])
+ this.targets = $([])
+ this.activeTarget = null
+
+ this.refresh()
+ this.process()
+ }
+
+ ScrollSpy.DEFAULTS = {
+ offset: 10
+ }
+
+ ScrollSpy.prototype.refresh = function () {
+ var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
+
+ this.offsets = $([])
+ this.targets = $([])
+
+ var self = this
+ var $targets = this.$body
+ .find(this.selector)
+ .map(function () {
+ var $el = $(this)
+ var href = $el.data('target') || $el.attr('href')
+ var $href = /^#\w/.test(href) && $(href)
+
+ return ($href
+ && $href.length
+ && [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null
+ })
+ .sort(function (a, b) { return a[0] - b[0] })
+ .each(function () {
+ self.offsets.push(this[0])
+ self.targets.push(this[1])
+ })
+ }
+
+ ScrollSpy.prototype.process = function () {
+ var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
+ var scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
+ var maxScroll = scrollHeight - this.$scrollElement.height()
+ var offsets = this.offsets
+ var targets = this.targets
+ var activeTarget = this.activeTarget
+ var i
+
+ if (scrollTop >= maxScroll) {
+ return activeTarget != (i = targets.last()[0]) && this.activate(i)
+ }
+
+ for (i = offsets.length; i--;) {
+ activeTarget != targets[i]
+ && scrollTop >= offsets[i]
+ && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
+ && this.activate( targets[i] )
+ }
+ }
+
+ ScrollSpy.prototype.activate = function (target) {
+ this.activeTarget = target
+
+ $(this.selector)
+ .parents('.active')
+ .removeClass('active')
+
+ var selector = this.selector
+ + '[data-target="' + target + '"],'
+ + this.selector + '[href="' + target + '"]'
+
+ var active = $(selector)
+ .parents('li')
+ .addClass('active')
+
+ if (active.parent('.dropdown-menu').length) {
+ active = active
+ .closest('li.dropdown')
+ .addClass('active')
+ }
+
+ active.trigger('activate')
+ }
+
+
+ // SCROLLSPY PLUGIN DEFINITION
+ // ===========================
+
+ var old = $.fn.scrollspy
+
+ $.fn.scrollspy = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.scrollspy')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.scrollspy.Constructor = ScrollSpy
+
+
+ // SCROLLSPY NO CONFLICT
+ // =====================
+
+ $.fn.scrollspy.noConflict = function () {
+ $.fn.scrollspy = old
+ return this
+ }
+
+
+ // SCROLLSPY DATA-API
+ // ==================
+
+ $(window).on('load', function () {
+ $('[data-spy="scroll"]').each(function () {
+ var $spy = $(this)
+ $spy.scrollspy($spy.data())
+ })
+ })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: tab.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#tabs
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // TAB CLASS DEFINITION
+ // ====================
+
+ var Tab = function (element) {
+ this.element = $(element)
+ }
+
+ Tab.prototype.show = function () {
+ var $this = this.element
+ var $ul = $this.closest('ul:not(.dropdown-menu)')
+ var selector = $this.attr('data-target')
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ if ($this.parent('li').hasClass('active')) return
+
+ var previous = $ul.find('.active:last a')[0]
+ var e = $.Event('show.bs.tab', {
+ relatedTarget: previous
+ })
+
+ $this.trigger(e)
+
+ if (e.isDefaultPrevented()) return
+
+ var $target = $(selector)
+
+ this.activate($this.parent('li'), $ul)
+ this.activate($target, $target.parent(), function () {
+ $this.trigger({
+ type: 'shown.bs.tab'
+ , relatedTarget: previous
+ })
+ })
+ }
+
+ Tab.prototype.activate = function (element, container, callback) {
+ var $active = container.find('> .active')
+ var transition = callback
+ && $.support.transition
+ && $active.hasClass('fade')
+
+ function next() {
+ $active
+ .removeClass('active')
+ .find('> .dropdown-menu > .active')
+ .removeClass('active')
+
+ element.addClass('active')
+
+ if (transition) {
+ element[0].offsetWidth // reflow for transition
+ element.addClass('in')
+ } else {
+ element.removeClass('fade')
+ }
+
+ if (element.parent('.dropdown-menu')) {
+ element.closest('li.dropdown').addClass('active')
+ }
+
+ callback && callback()
+ }
+
+ transition ?
+ $active
+ .one($.support.transition.end, next)
+ .emulateTransitionEnd(150) :
+ next()
+
+ $active.removeClass('in')
+ }
+
+
+ // TAB PLUGIN DEFINITION
+ // =====================
+
+ var old = $.fn.tab
+
+ $.fn.tab = function ( option ) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.tab')
+
+ if (!data) $this.data('bs.tab', (data = new Tab(this)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.tab.Constructor = Tab
+
+
+ // TAB NO CONFLICT
+ // ===============
+
+ $.fn.tab.noConflict = function () {
+ $.fn.tab = old
+ return this
+ }
+
+
+ // TAB DATA-API
+ // ============
+
+ $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
+ e.preventDefault()
+ $(this).tab('show')
+ })
+
+}(window.jQuery);
+
+/* ========================================================================
+ * Bootstrap: affix.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#affix
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // AFFIX CLASS DEFINITION
+ // ======================
+
+ var Affix = function (element, options) {
+ this.options = $.extend({}, Affix.DEFAULTS, options)
+ this.$window = $(window)
+ .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
+ .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
+
+ this.$element = $(element)
+ this.affixed =
+ this.unpin = null
+
+ this.checkPosition()
+ }
+
+ Affix.RESET = 'affix affix-top affix-bottom'
+
+ Affix.DEFAULTS = {
+ offset: 0
+ }
+
+ Affix.prototype.checkPositionWithEventLoop = function () {
+ setTimeout($.proxy(this.checkPosition, this), 1)
+ }
+
+ Affix.prototype.checkPosition = function () {
+ if (!this.$element.is(':visible')) return
+
+ var scrollHeight = $(document).height()
+ var scrollTop = this.$window.scrollTop()
+ var position = this.$element.offset()
+ var offset = this.options.offset
+ var offsetTop = offset.top
+ var offsetBottom = offset.bottom
+
+ if (typeof offset != 'object') offsetBottom = offsetTop = offset
+ if (typeof offsetTop == 'function') offsetTop = offset.top()
+ if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
+
+ var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
+ offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
+ offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
+
+ if (this.affixed === affix) return
+ if (this.unpin) this.$element.css('top', '')
+
+ this.affixed = affix
+ this.unpin = affix == 'bottom' ? position.top - scrollTop : null
+
+ this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
+
+ if (affix == 'bottom') {
+ this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
+ }
+ }
+
+
+ // AFFIX PLUGIN DEFINITION
+ // =======================
+
+ var old = $.fn.affix
+
+ $.fn.affix = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.affix')
+ var options = typeof option == 'object' && option
+
+ if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.affix.Constructor = Affix
+
+
+ // AFFIX NO CONFLICT
+ // =================
+
+ $.fn.affix.noConflict = function () {
+ $.fn.affix = old
+ return this
+ }
+
+
+ // AFFIX DATA-API
+ // ==============
+
+ $(window).on('load', function () {
+ $('[data-spy="affix"]').each(function () {
+ var $spy = $(this)
+ var data = $spy.data()
+
+ data.offset = data.offset || {}
+
+ if (data.offsetBottom) data.offset.bottom = data.offsetBottom
+ if (data.offsetTop) data.offset.top = data.offsetTop
+
+ $spy.affix(data)
+ })
+ })
+
+}(window.jQuery);
diff --git a/GUI/js/bootstrap.min.js b/GUI/js/bootstrap.min.js
new file mode 100644
index 0000000..1765631
--- /dev/null
+++ b/GUI/js/bootstrap.min.js
@@ -0,0 +1,6 @@
+/**
+* bootstrap.js v3.0.0 by @fat and @mdo
+* Copyright 2013 Twitter Inc.
+* http://www.apache.org/licenses/LICENSE-2.0
+*/
+if(!jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(window.jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('').insertAfter(a(this)).on("click",b),f.trigger(d=a.Event("show.bs.dropdown")),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",f);if(h.length){var i=h.index(h.filter(":focus"));38==b.keyCode&&i>0&&i--,40==b.keyCode&&i').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focus",i="hover"==g?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d="function"==typeof this.options.placement?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m="body"==this.options.container?window.innerWidth:j.outerWidth(),n="body"==this.options.container?window.innerHeight:j.outerHeight(),o="body"==this.options.container?0:j.offset().left;d="bottom"==d&&g.top+g.height+i-l>n?"top":"top"==d&&g.top-l-i<0?"bottom":"right"==d&&g.right+h>m?"left":"left"==d&&g.left-h'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery);
\ No newline at end of file
diff --git a/GUI/js/collapse.js b/GUI/js/collapse.js
new file mode 100644
index 0000000..92cc0bc
--- /dev/null
+++ b/GUI/js/collapse.js
@@ -0,0 +1,179 @@
+/* ========================================================================
+ * Bootstrap: collapse.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#collapse
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // COLLAPSE PUBLIC CLASS DEFINITION
+ // ================================
+
+ var Collapse = function (element, options) {
+ this.$element = $(element)
+ this.options = $.extend({}, Collapse.DEFAULTS, options)
+ this.transitioning = null
+
+ if (this.options.parent) this.$parent = $(this.options.parent)
+ if (this.options.toggle) this.toggle()
+ }
+
+ Collapse.DEFAULTS = {
+ toggle: true
+ }
+
+ Collapse.prototype.dimension = function () {
+ var hasWidth = this.$element.hasClass('width')
+ return hasWidth ? 'width' : 'height'
+ }
+
+ Collapse.prototype.show = function () {
+ if (this.transitioning || this.$element.hasClass('in')) return
+
+ var startEvent = $.Event('show.bs.collapse')
+ this.$element.trigger(startEvent)
+ if (startEvent.isDefaultPrevented()) return
+
+ var actives = this.$parent && this.$parent.find('> .panel > .in')
+
+ if (actives && actives.length) {
+ var hasData = actives.data('bs.collapse')
+ if (hasData && hasData.transitioning) return
+ actives.collapse('hide')
+ hasData || actives.data('bs.collapse', null)
+ }
+
+ var dimension = this.dimension()
+
+ this.$element
+ .removeClass('collapse')
+ .addClass('collapsing')
+ [dimension](0)
+
+ this.transitioning = 1
+
+ var complete = function () {
+ this.$element
+ .removeClass('collapsing')
+ .addClass('in')
+ [dimension]('auto')
+ this.transitioning = 0
+ this.$element.trigger('shown.bs.collapse')
+ }
+
+ if (!$.support.transition) return complete.call(this)
+
+ var scrollSize = $.camelCase(['scroll', dimension].join('-'))
+
+ this.$element
+ .one($.support.transition.end, $.proxy(complete, this))
+ .emulateTransitionEnd(350)
+ [dimension](this.$element[0][scrollSize])
+ }
+
+ Collapse.prototype.hide = function () {
+ if (this.transitioning || !this.$element.hasClass('in')) return
+
+ var startEvent = $.Event('hide.bs.collapse')
+ this.$element.trigger(startEvent)
+ if (startEvent.isDefaultPrevented()) return
+
+ var dimension = this.dimension()
+
+ this.$element
+ [dimension](this.$element[dimension]())
+ [0].offsetHeight
+
+ this.$element
+ .addClass('collapsing')
+ .removeClass('collapse')
+ .removeClass('in')
+
+ this.transitioning = 1
+
+ var complete = function () {
+ this.transitioning = 0
+ this.$element
+ .trigger('hidden.bs.collapse')
+ .removeClass('collapsing')
+ .addClass('collapse')
+ }
+
+ if (!$.support.transition) return complete.call(this)
+
+ this.$element
+ [dimension](0)
+ .one($.support.transition.end, $.proxy(complete, this))
+ .emulateTransitionEnd(350)
+ }
+
+ Collapse.prototype.toggle = function () {
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
+ }
+
+
+ // COLLAPSE PLUGIN DEFINITION
+ // ==========================
+
+ var old = $.fn.collapse
+
+ $.fn.collapse = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('bs.collapse')
+ var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
+
+ if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
+ if (typeof option == 'string') data[option]()
+ })
+ }
+
+ $.fn.collapse.Constructor = Collapse
+
+
+ // COLLAPSE NO CONFLICT
+ // ====================
+
+ $.fn.collapse.noConflict = function () {
+ $.fn.collapse = old
+ return this
+ }
+
+
+ // COLLAPSE DATA-API
+ // =================
+
+ $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
+ var $this = $(this), href
+ var target = $this.attr('data-target')
+ || e.preventDefault()
+ || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
+ var $target = $(target)
+ var data = $target.data('bs.collapse')
+ var option = data ? 'toggle' : $this.data()
+ var parent = $this.attr('data-parent')
+ var $parent = parent && $(parent)
+
+ if (!data || !data.transitioning) {
+ if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed')
+ $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
+ }
+
+ $target.collapse(option)
+ })
+
+}(window.jQuery);
diff --git a/GUI/js/dropdown.js b/GUI/js/dropdown.js
new file mode 100644
index 0000000..6093f11
--- /dev/null
+++ b/GUI/js/dropdown.js
@@ -0,0 +1,154 @@
+/* ========================================================================
+ * Bootstrap: dropdown.js v3.0.0
+ * http://twbs.github.com/bootstrap/javascript.html#dropdowns
+ * ========================================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================================== */
+
+
++function ($) { "use strict";
+
+ // DROPDOWN CLASS DEFINITION
+ // =========================
+
+ var backdrop = '.dropdown-backdrop'
+ var toggle = '[data-toggle=dropdown]'
+ var Dropdown = function (element) {
+ var $el = $(element).on('click.bs.dropdown', this.toggle)
+ }
+
+ Dropdown.prototype.toggle = function (e) {
+ var $this = $(this)
+
+ if ($this.is('.disabled, :disabled')) return
+
+ var $parent = getParent($this)
+ var isActive = $parent.hasClass('open')
+
+ clearMenus()
+
+ if (!isActive) {
+ if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
+ // if mobile we we use a backdrop because click events don't delegate
+ $('').insertAfter($(this)).on('click', clearMenus)
+ }
+
+ $parent.trigger(e = $.Event('show.bs.dropdown'))
+
+ if (e.isDefaultPrevented()) return
+
+ $parent
+ .toggleClass('open')
+ .trigger('shown.bs.dropdown')
+
+ $this.focus()
+ }
+
+ return false
+ }
+
+ Dropdown.prototype.keydown = function (e) {
+ if (!/(38|40|27)/.test(e.keyCode)) return
+
+ var $this = $(this)
+
+ e.preventDefault()
+ e.stopPropagation()
+
+ if ($this.is('.disabled, :disabled')) return
+
+ var $parent = getParent($this)
+ var isActive = $parent.hasClass('open')
+
+ if (!isActive || (isActive && e.keyCode == 27)) {
+ if (e.which == 27) $parent.find(toggle).focus()
+ return $this.click()
+ }
+
+ var $items = $('[role=menu] li:not(.divider):visible a', $parent)
+
+ if (!$items.length) return
+
+ var index = $items.index($items.filter(':focus'))
+
+ if (e.keyCode == 38 && index > 0) index-- // up
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
+ if (!~index) index=0
+
+ $items.eq(index).focus()
+ }
+
+ function clearMenus() {
+ $(backdrop).remove()
+ $(toggle).each(function (e) {
+ var $parent = getParent($(this))
+ if (!$parent.hasClass('open')) return
+ $parent.trigger(e = $.Event('hide.bs.dropdown'))
+ if (e.isDefaultPrevented()) return
+ $parent.removeClass('open').trigger('hidden.bs.dropdown')
+ })
+ }
+
+ function getParent($this) {
+ var selector = $this.attr('data-target')
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ var $parent = selector && $(selector)
+
+ return $parent && $parent.length ? $parent : $this.parent()
+ }
+
+
+ // DROPDOWN PLUGIN DEFINITION
+ // ==========================
+
+ var old = $.fn.dropdown
+
+ $.fn.dropdown = function (option) {
+ return this.each(function () {
+ var $this = $(this)
+ var data = $this.data('dropdown')
+
+ if (!data) $this.data('dropdown', (data = new Dropdown(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.dropdown.Constructor = Dropdown
+
+
+ // DROPDOWN NO CONFLICT
+ // ====================
+
+ $.fn.dropdown.noConflict = function () {
+ $.fn.dropdown = old
+ return this
+ }
+
+
+ // APPLY TO STANDARD DROPDOWN ELEMENTS
+ // ===================================
+
+ $(document)
+ .on('click.bs.dropdown.data-api', clearMenus)
+ .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
+ .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
+ .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
+
+}(window.jQuery);
diff --git a/GUI/js/holder.js b/GUI/js/holder.js
new file mode 100644
index 0000000..f717054
--- /dev/null
+++ b/GUI/js/holder.js
@@ -0,0 +1,419 @@
+/*
+
+Holder - 2.0 - client side image placeholders
+(c) 2012-2013 Ivan Malopinsky / http://imsky.co
+
+Provided under the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
+Commercial use requires attribution.
+
+*/
+
+var Holder = Holder || {};
+(function (app, win) {
+
+var preempted = false,
+fallback = false,
+canvas = document.createElement('canvas');
+
+//getElementsByClassName polyfill
+document.getElementsByClassName||(document.getElementsByClassName=function(e){var t=document,n,r,i,s=[];if(t.querySelectorAll)return t.querySelectorAll("."+e);if(t.evaluate){r=".//*[contains(concat(' ', @class, ' '), ' "+e+" ')]",n=t.evaluate(r,t,null,0,null);while(i=n.iterateNext())s.push(i)}else{n=t.getElementsByTagName("*"),r=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0;i= 0.75) {
+ text_height = Math.floor(text_height * 0.75 * (width/text_width));
+ }
+ //Resetting font size if necessary
+ ctx.font = "bold " + (text_height * ratio) + "px " + font;
+ ctx.fillText(text, (width / 2), (height / 2), width);
+ return canvas.toDataURL("image/png");
+}
+
+function render(mode, el, holder, src) {
+ var dimensions = holder.dimensions,
+ theme = holder.theme,
+ text = holder.text ? decodeURIComponent(holder.text) : holder.text;
+ var dimensions_caption = dimensions.width + "x" + dimensions.height;
+ theme = (text ? extend(theme, {
+ text: text
+ }) : theme);
+ theme = (holder.font ? extend(theme, {
+ font: holder.font
+ }) : theme);
+ if (mode == "image") {
+ el.setAttribute("data-src", src);
+ el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
+ if (fallback || !holder.auto) {
+ el.style.width = dimensions.width + "px";
+ el.style.height = dimensions.height + "px";
+ }
+ if (fallback) {
+ el.style.backgroundColor = theme.background;
+ } else {
+ el.setAttribute("src", draw(ctx, dimensions, theme, ratio));
+ }
+ } else if (mode == "background") {
+ if (!fallback) {
+ el.style.backgroundImage = "url(" + draw(ctx, dimensions, theme, ratio) + ")";
+ el.style.backgroundSize = dimensions.width + "px " + dimensions.height + "px";
+ }
+ } else if (mode == "fluid") {
+ el.setAttribute("data-src", src);
+ el.setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
+ if (dimensions.height.substr(-1) == "%") {
+ el.style.height = dimensions.height
+ } else {
+ el.style.height = dimensions.height + "px"
+ }
+ if (dimensions.width.substr(-1) == "%") {
+ el.style.width = dimensions.width
+ } else {
+ el.style.width = dimensions.width + "px"
+ }
+ if (el.style.display == "inline" || el.style.display == "") {
+ el.style.display = "block";
+ }
+ if (fallback) {
+ el.style.backgroundColor = theme.background;
+ } else {
+ el.holderData = holder;
+ fluid_images.push(el);
+ fluid_update(el);
+ }
+ }
+};
+
+function fluid_update(element) {
+ var images;
+ if (element.nodeType == null) {
+ images = fluid_images;
+ } else {
+ images = [element]
+ }
+ for (i in images) {
+ var el = images[i]
+ if (el.holderData) {
+ var holder = el.holderData;
+ el.setAttribute("src", draw(ctx, {
+ height: el.clientHeight,
+ width: el.clientWidth
+ }, holder.theme, ratio));
+ }
+ }
+}
+
+function parse_flags(flags, options) {
+
+ var ret = {
+ theme: settings.themes.gray
+ }, render = false;
+
+ for (sl = flags.length, j = 0; j < sl; j++) {
+ var flag = flags[j];
+ if (app.flags.dimensions.match(flag)) {
+ render = true;
+ ret.dimensions = app.flags.dimensions.output(flag);
+ } else if (app.flags.fluid.match(flag)) {
+ render = true;
+ ret.dimensions = app.flags.fluid.output(flag);
+ ret.fluid = true;
+ } else if (app.flags.colors.match(flag)) {
+ ret.theme = app.flags.colors.output(flag);
+ } else if (options.themes[flag]) {
+ //If a theme is specified, it will override custom colors
+ ret.theme = options.themes[flag];
+ } else if (app.flags.text.match(flag)) {
+ ret.text = app.flags.text.output(flag);
+ } else if (app.flags.font.match(flag)) {
+ ret.font = app.flags.font.output(flag);
+ } else if (app.flags.auto.match(flag)) {
+ ret.auto = true;
+ }
+ }
+
+ return render ? ret : false;
+
+};
+
+
+
+if (!canvas.getContext) {
+ fallback = true;
+} else {
+ if (canvas.toDataURL("image/png")
+ .indexOf("data:image/png") < 0) {
+ //Android doesn't support data URI
+ fallback = true;
+ } else {
+ var ctx = canvas.getContext("2d");
+ }
+}
+
+var dpr = 1, bsr = 1;
+
+if(!fallback){
+ dpr = window.devicePixelRatio || 1,
+ bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
+}
+
+var ratio = dpr / bsr;
+
+var fluid_images = [];
+
+var settings = {
+ domain: "holder.js",
+ images: "img",
+ bgnodes: ".holderjs",
+ themes: {
+ "gray": {
+ background: "#eee",
+ foreground: "#aaa",
+ size: 12
+ },
+ "social": {
+ background: "#3a5a97",
+ foreground: "#fff",
+ size: 12
+ },
+ "industrial": {
+ background: "#434A52",
+ foreground: "#C2F200",
+ size: 12
+ }
+ },
+ stylesheet: ".holderjs-fluid {font-size:16px;font-weight:bold;text-align:center;font-family:sans-serif;margin:0}"
+};
+
+
+app.flags = {
+ dimensions: {
+ regex: /^(\d+)x(\d+)$/,
+ output: function (val) {
+ var exec = this.regex.exec(val);
+ return {
+ width: +exec[1],
+ height: +exec[2]
+ }
+ }
+ },
+ fluid: {
+ regex: /^([0-9%]+)x([0-9%]+)$/,
+ output: function (val) {
+ var exec = this.regex.exec(val);
+ return {
+ width: exec[1],
+ height: exec[2]
+ }
+ }
+ },
+ colors: {
+ regex: /#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,
+ output: function (val) {
+ var exec = this.regex.exec(val);
+ return {
+ size: settings.themes.gray.size,
+ foreground: "#" + exec[2],
+ background: "#" + exec[1]
+ }
+ }
+ },
+ text: {
+ regex: /text\:(.*)/,
+ output: function (val) {
+ return this.regex.exec(val)[1];
+ }
+ },
+ font: {
+ regex: /font\:(.*)/,
+ output: function (val) {
+ return this.regex.exec(val)[1];
+ }
+ },
+ auto: {
+ regex: /^auto$/
+ }
+}
+
+for (var flag in app.flags) {
+ if (!app.flags.hasOwnProperty(flag)) continue;
+ app.flags[flag].match = function (val) {
+ return val.match(this.regex)
+ }
+}
+
+app.add_theme = function (name, theme) {
+ name != null && theme != null && (settings.themes[name] = theme);
+ return app;
+};
+
+app.add_image = function (src, el) {
+ var node = selector(el);
+ if (node.length) {
+ for (var i = 0, l = node.length; i < l; i++) {
+ var img = document.createElement("img")
+ img.setAttribute("data-src", src);
+ node[i].appendChild(img);
+ }
+ }
+ return app;
+};
+
+app.run = function (o) {
+ var options = extend(settings, o),
+ images = [], imageNodes = [], bgnodes = [];
+
+ if(typeof(options.images) == "string"){
+ imageNodes = selector(options.images);
+ }
+ else if (window.NodeList && options.images instanceof window.NodeList) {
+ imageNodes = options.images;
+ } else if (window.Node && options.images instanceof window.Node) {
+ imageNodes = [options.images];
+ }
+
+ if(typeof(options.bgnodes) == "string"){
+ bgnodes = selector(options.bgnodes);
+ } else if (window.NodeList && options.elements instanceof window.NodeList) {
+ bgnodes = options.bgnodes;
+ } else if (window.Node && options.bgnodes instanceof window.Node) {
+ bgnodes = [options.bgnodes];
+ }
+
+ preempted = true;
+
+ for (i = 0, l = imageNodes.length; i < l; i++) images.push(imageNodes[i]);
+
+ var holdercss = document.getElementById("holderjs-style");
+ if (!holdercss) {
+ holdercss = document.createElement("style");
+ holdercss.setAttribute("id", "holderjs-style");
+ holdercss.type = "text/css";
+ document.getElementsByTagName("head")[0].appendChild(holdercss);
+ }
+
+ if (!options.nocss) {
+ if (holdercss.styleSheet) {
+ holdercss.styleSheet.cssText += options.stylesheet;
+ } else {
+ holdercss.appendChild(document.createTextNode(options.stylesheet));
+ }
+ }
+
+ var cssregex = new RegExp(options.domain + "\/(.*?)\"?\\)");
+
+ for (var l = bgnodes.length, i = 0; i < l; i++) {
+ var src = window.getComputedStyle(bgnodes[i], null)
+ .getPropertyValue("background-image");
+ var flags = src.match(cssregex);
+ var bgsrc = bgnodes[i].getAttribute("data-background-src");
+
+ if (flags) {
+ var holder = parse_flags(flags[1].split("/"), options);
+ if (holder) {
+ render("background", bgnodes[i], holder, src);
+ }
+ }
+ else if(bgsrc != null){
+ var holder = parse_flags(bgsrc.substr(bgsrc.lastIndexOf(options.domain) + options.domain.length + 1)
+ .split("/"), options);
+ if(holder){
+ render("background", bgnodes[i], holder, src);
+ }
+ }
+ }
+
+ for (l = images.length, i = 0; i < l; i++) {
+
+ var attr_src = attr_data_src = src = null;
+
+ try{
+ attr_src = images[i].getAttribute("src");
+ attr_datasrc = images[i].getAttribute("data-src");
+ }catch(e){}
+
+ if (attr_datasrc == null && !! attr_src && attr_src.indexOf(options.domain) >= 0) {
+ src = attr_src;
+ } else if ( !! attr_datasrc && attr_datasrc.indexOf(options.domain) >= 0) {
+ src = attr_datasrc;
+ }
+
+ if (src) {
+ var holder = parse_flags(src.substr(src.lastIndexOf(options.domain) + options.domain.length + 1)
+ .split("/"), options);
+ if (holder) {
+ if (holder.fluid) {
+ render("fluid", images[i], holder, src)
+ } else {
+ render("image", images[i], holder, src);
+ }
+ }
+ }
+ }
+ return app;
+};
+
+contentLoaded(win, function () {
+ if (window.addEventListener) {
+ window.addEventListener("resize", fluid_update, false);
+ window.addEventListener("orientationchange", fluid_update, false);
+ } else {
+ window.attachEvent("onresize", fluid_update)
+ }
+ preempted || app.run();
+});
+
+if (typeof define === "function" && define.amd) {
+ define("Holder", [], function () {
+ return app;
+ });
+}
+
+})(Holder, window);
diff --git a/GUI/js/html5shiv.js b/GUI/js/html5shiv.js
new file mode 100644
index 0000000..784f221
--- /dev/null
+++ b/GUI/js/html5shiv.js
@@ -0,0 +1,8 @@
+/*
+ HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
+for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
+
+
\ No newline at end of file
diff --git a/GUI/snippets/.svn/text-base/form_directory.php.svn-base b/GUI/snippets/.svn/text-base/form_directory.php.svn-base
new file mode 100644
index 0000000..25140a8
--- /dev/null
+++ b/GUI/snippets/.svn/text-base/form_directory.php.svn-base
@@ -0,0 +1,107 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+ Read all files from a directory and convert them.
+
+
+ You can choose if the result of the conversion gets only displayed on the
+ screen or if you want to modify the source files. By default
+ backups of the source files will be created before
+ they get modified. A search pattern can be defined to restrict
+ the search for source files to a certain file suffix.
+
+
+
+
Errors
+
+ $msg)
+ printf('
%s
', htmlspecialchars($msg));
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/.svn/text-base/form_file.php.svn-base b/GUI/snippets/.svn/text-base/form_file.php.svn-base
new file mode 100644
index 0000000..58755be
--- /dev/null
+++ b/GUI/snippets/.svn/text-base/form_file.php.svn-base
@@ -0,0 +1,95 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+ Convert a file
+
+
+ You can choose if the result of the conversion gets displayed on the
+ screen or if you want to modify the source file. By default a
+ backup of the source file will be created before
+ it gets modified.
+
+
+
+
Errors
+
+ $msg)
+ printf('
%s
', htmlspecialchars($msg));
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/.svn/text-base/form_snippet.php.svn-base b/GUI/snippets/.svn/text-base/form_snippet.php.svn-base
new file mode 100644
index 0000000..68960cb
--- /dev/null
+++ b/GUI/snippets/.svn/text-base/form_snippet.php.svn-base
@@ -0,0 +1,90 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+?>
+
+ Convert a snippet
+
+
+ You can choose if the result of the conversion gets displayed on the
+ screen or if you want to modify the source snippet. By default a
+ backups of the source snippet will be created before
+ it gets modified.
+
+
+
+
Errors
+
+ $msg)
+ printf('
%s
', htmlspecialchars($msg));
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/.svn/text-base/header.php.svn-base b/GUI/snippets/.svn/text-base/header.php.svn-base
new file mode 100644
index 0000000..8b2a613
--- /dev/null
+++ b/GUI/snippets/.svn/text-base/header.php.svn-base
@@ -0,0 +1,55 @@
+, Ulf Wendel
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/.svn/wcprops/MySQLConverterTool_GUI_Snippets.php.svn-work b/GUI/snippets/.svn/wcprops/MySQLConverterTool_GUI_Snippets.php.svn-work
new file mode 100644
index 0000000..5a50ac3
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/MySQLConverterTool_GUI_Snippets.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 106
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/MySQLConverterTool_GUI_Snippets.php
+END
diff --git a/GUI/snippets/.svn/wcprops/footer.php.svn-work b/GUI/snippets/.svn/wcprops/footer.php.svn-work
new file mode 100644
index 0000000..774f824
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/footer.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/footer.php
+END
diff --git a/GUI/snippets/.svn/wcprops/form_directory.php.svn-work b/GUI/snippets/.svn/wcprops/form_directory.php.svn-work
new file mode 100644
index 0000000..0d97cd9
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/form_directory.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 89
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/form_directory.php
+END
diff --git a/GUI/snippets/.svn/wcprops/form_file.php.svn-work b/GUI/snippets/.svn/wcprops/form_file.php.svn-work
new file mode 100644
index 0000000..b129461
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/form_file.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svnpublic/mysqli_converter/!svn/ver/6/MySQLConverterTool/GUI/snippets/form_file.php
+END
diff --git a/GUI/snippets/.svn/wcprops/form_snippet.php.svn-work b/GUI/snippets/.svn/wcprops/form_snippet.php.svn-work
new file mode 100644
index 0000000..2943b10
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/form_snippet.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 87
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/form_snippet.php
+END
diff --git a/GUI/snippets/.svn/wcprops/header.php.svn-work b/GUI/snippets/.svn/wcprops/header.php.svn-work
new file mode 100644
index 0000000..4e834b0
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/header.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/header.php
+END
diff --git a/GUI/snippets/.svn/wcprops/show_converted_directory.php.svn-work b/GUI/snippets/.svn/wcprops/show_converted_directory.php.svn-work
new file mode 100644
index 0000000..1dc8b85
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/show_converted_directory.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 99
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/show_converted_directory.php
+END
diff --git a/GUI/snippets/.svn/wcprops/show_converted_file.php.svn-work b/GUI/snippets/.svn/wcprops/show_converted_file.php.svn-work
new file mode 100644
index 0000000..d061df5
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/show_converted_file.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 94
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/show_converted_file.php
+END
diff --git a/GUI/snippets/.svn/wcprops/show_converted_snippet.php.svn-work b/GUI/snippets/.svn/wcprops/show_converted_snippet.php.svn-work
new file mode 100644
index 0000000..c3474a8
--- /dev/null
+++ b/GUI/snippets/.svn/wcprops/show_converted_snippet.php.svn-work
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 97
+/svnpublic/mysqli_converter/!svn/ver/3/MySQLConverterTool/GUI/snippets/show_converted_snippet.php
+END
diff --git a/GUI/snippets/MySQLConverterTool_GUI_Snippets.php b/GUI/snippets/MySQLConverterTool_GUI_Snippets.php
new file mode 100644
index 0000000..de65d68
--- /dev/null
+++ b/GUI/snippets/MySQLConverterTool_GUI_Snippets.php
@@ -0,0 +1,34 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Class available since Release 1.0
+*/
+class MySQLConverterTool_GUI_Snippets {
+
+ public static function load($___file) {
+
+ if (!file_exists($___file)) {
+ echo $___file;
+ return false;
+ }
+
+ foreach ($GLOBALS as $___k => $___v)
+ if (substr($___k, 0, 8) == 'snippet_')
+ $$___k = $___v;
+
+ include($___file);
+
+
+ return true;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/GUI/snippets/footer.php b/GUI/snippets/footer.php
new file mode 100644
index 0000000..66cc8d5
--- /dev/null
+++ b/GUI/snippets/footer.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/form_directory.php b/GUI/snippets/form_directory.php
new file mode 100644
index 0000000..4232dce
--- /dev/null
+++ b/GUI/snippets/form_directory.php
@@ -0,0 +1,115 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+ Read all files from a directory and convert them.
+
+
+ You can choose if the result of the conversion gets only displayed on the
+ screen or if you want to modify the source files. By default
+ backups of the source files will be created before
+ they get modified. A search pattern can be defined to restrict
+ the search for source files to a certain file suffix.
+
+
+
+
Errors
+
+ $msg)
+ printf('
%s
', htmlspecialchars($msg));
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/form_file.php b/GUI/snippets/form_file.php
new file mode 100644
index 0000000..fc62d92
--- /dev/null
+++ b/GUI/snippets/form_file.php
@@ -0,0 +1,103 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+ Convert a file
+
+
+ You can choose if the result of the conversion gets displayed on the
+ screen or if you want to modify the source file. By default a
+ backup of the source file will be created before
+ it gets modified.
+
+
+
+
Errors
+
+ $msg)
+ printf('
%s
', htmlspecialchars($msg));
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/form_snippet.php b/GUI/snippets/form_snippet.php
new file mode 100644
index 0000000..df684e6
--- /dev/null
+++ b/GUI/snippets/form_snippet.php
@@ -0,0 +1,88 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+
+?>
+
+ Convert a snippet
+
+
+ You can choose if the result of the conversion gets displayed on the
+ screen or if you want to modify the source snippet. By default a
+ backups of the source snippet will be created before
+ it gets modified.
+
+
+
+
Errors
+
+ $msg)
+ printf('
%s
', htmlspecialchars($msg));
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/header.php b/GUI/snippets/header.php
new file mode 100644
index 0000000..20f2ef7
--- /dev/null
+++ b/GUI/snippets/header.php
@@ -0,0 +1,91 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GUI/snippets/show_converted_directory.php b/GUI/snippets/show_converted_directory.php
new file mode 100644
index 0000000..866809f
--- /dev/null
+++ b/GUI/snippets/show_converted_directory.php
@@ -0,0 +1,37 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+
+
Results of the conversion
+
+
+
Number of Files
+
OK
+
Warnings
+
Errors
+
Number of mysql_*-functions found
+
Number of mysql_*-functions converted
+
Code (kB)
+
+
+
+
+
+
+
+
+
0) ? $snippet_conv_length / 1024 : 0); ?>
+
+
+
\ No newline at end of file
diff --git a/GUI/snippets/show_converted_file.php b/GUI/snippets/show_converted_file.php
new file mode 100644
index 0000000..6db90e6
--- /dev/null
+++ b/GUI/snippets/show_converted_file.php
@@ -0,0 +1,89 @@
+, Ulf Wendel , Saif Lacrimosa
+* @copyright 1997-2006 The PHP Group
+* @license http://www.php.net/license/3_0.txt PHP License 3.0
+* @version CVS: $Id:$, Release: @package_version@
+* @link http://www.mysql.com
+* @since Available since Release 1.0
+*/
+?>
+