From 1a2430bc24c3a226970f143e589734d77f78d765 Mon Sep 17 00:00:00 2001 From: kirinji Date: Sun, 30 Sep 2007 16:28:15 +0000 Subject: [PATCH] More modifications --- cgi-files/Modules/Database/MySQL5.pm | 286 +++++++++++++-------------- cgi-files/Modules/Database/SQLite.pm | 266 ++++++++++++------------- cgi-files/kiriwrite.cgi | 14 -- 3 files changed, 276 insertions(+), 290 deletions(-) diff --git a/cgi-files/Modules/Database/MySQL5.pm b/cgi-files/Modules/Database/MySQL5.pm index 80bc323..42c3fd9 100644 --- a/cgi-files/Modules/Database/MySQL5.pm +++ b/cgi-files/Modules/Database/MySQL5.pm @@ -38,7 +38,7 @@ use DBI qw(:sql_types); our $VERSION = "0.1.0"; my ($options, %options); my $database_handle; -my $string_handle; +my $statement_handle; my $error; my $errorext; my $database_filename; @@ -491,10 +491,10 @@ sub dbexists{ # Check if the table exists. - $string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($filename) . '_database_info\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($filename) . '_database_info\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@table_data = $string_handle->fetchrow_array()){ + while (@table_data = $statement_handle->fetchrow_array()){ $table_exists = 1; @@ -554,9 +554,9 @@ sub disconnect{ # Disconnect from the server. - if ($string_handle){ + if ($statement_handle){ - $string_handle->finish(); + $statement_handle->finish(); } @@ -586,15 +586,15 @@ sub getdblist{ # Get the list of databases. - $string_handle = $database_handle->prepare("SHOW TABLES") or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare("SHOW TABLES") or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); my @final_table_list; my @database_table_list; my @table_name; my $table; - while (@table_name = $string_handle->fetchrow_array()){ + while (@table_name = $statement_handle->fetchrow_array()){ push(@database_table_list, decode_utf8($table_name[0])); @@ -683,10 +683,10 @@ sub getdatabaseinfo{ my ($databaseinfo, %databaseinfo); my ($sqldata, @sqldata); - $string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - @sqldata = $string_handle->fetchrow_array(); + @sqldata = $statement_handle->fetchrow_array(); # Process the database information into a hash. @@ -701,7 +701,7 @@ sub getdatabaseinfo{ "Revision" => decode_utf8($sqldata[6]) ); - $string_handle->finish(); + $statement_handle->finish(); return %databaseinfo; @@ -773,10 +773,10 @@ sub getseconddatabaseinfo{ $error = ""; $errorext = ""; - $string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - @sqldata = $string_handle->fetchrow_array(); + @sqldata = $statement_handle->fetchrow_array(); # Process the database information into a hash. @@ -790,7 +790,7 @@ sub getseconddatabaseinfo{ "Revision" => decode_utf8($sqldata[6]) ); - $string_handle->finish(); + $statement_handle->finish(); return %databaseinfo; @@ -848,7 +848,7 @@ sub adddatabase{ # Create the database structure (info and page tables); - $string_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbfilename) . '_database_info ( + $statement_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbfilename) . '_database_info ( name varchar(256) primary key, description varchar(512), notes mediumtext, @@ -857,9 +857,9 @@ sub adddatabase{ kiriwrite_version_minor int(4), kiriwrite_version_revision int(4) ) DEFAULT CHARSET=utf8') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); - $string_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbfilename) . '_database_pages ( + $statement_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbfilename) . '_database_pages ( filename varchar(256) primary key, pagename varchar(512), pagedescription varchar(512), @@ -869,12 +869,12 @@ sub adddatabase{ pagesettings int(1), lastmodified datetime ) DEFAULT CHARSET=utf8') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); # Convert the values into SQL query formatted values and add an entry # to the kiriwrite_database_info table. - $string_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbfilename) . '_database_info (name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision) VALUES( + $statement_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbfilename) . '_database_info (name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision) VALUES( \'' . $class->convert($dbname) . '\', \'' . $class->convert($dbdescription) . '\', \'' . $class->convert($dbnotes) . '\', @@ -883,7 +883,7 @@ sub adddatabase{ \'' . $class->convert($dbminorver) . '\', \'' . $class->convert($dbrevisionver) . '\' )') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -938,27 +938,27 @@ sub editdatabase{ # Rename the tables. - $string_handle = $database_handle->prepare('RENAME TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_info TO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_info, ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages TO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_pages'); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('RENAME TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_info TO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_info, ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages TO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_pages'); + $statement_handle->execute(); } # Get the current database information. - $string_handle = $database_handle->prepare('SELECT name FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT name FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - my @database_oldinfo = $string_handle->fetchrow_array(); + my @database_oldinfo = $statement_handle->fetchrow_array(); my $dboldname = decode_utf8($database_oldinfo[0]); # Update the database information. - $string_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_info SET name = \'' . $class->convert($dbname) . '\', + $statement_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($dbnewfilename) . '_database_info SET name = \'' . $class->convert($dbname) . '\', description = \'' . $class->convert($dbdescription) . '\', notes = \'' . $class->convert($dbnotes) . '\', categories = \'' . $class->convert($dbcategories) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -1005,15 +1005,15 @@ sub deletedatabase{ # Delete the database tables. - $string_handle = $database_handle->prepare('DROP TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($databasename) . '_database_info') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DROP TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($databasename) . '_database_info') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the _database_pages table exists and delete it if it exists. - $string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($databasename) . '_database_pages\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($databasename) . '_database_pages\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@table_data = $string_handle->fetchrow_array()){ + while (@table_data = $statement_handle->fetchrow_array()){ $table_exists = 1; @@ -1025,8 +1025,8 @@ sub deletedatabase{ # the _database_pages table really does exist so delete it. - $string_handle = $database_handle->prepare('DROP TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($databasename) . '_database_pages') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DROP TABLE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($databasename) . '_database_pages') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1057,10 +1057,10 @@ sub connecttemplate{ # Check if the template database exists. - $string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_templates\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_templates\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@templatedb_check = $string_handle->fetchrow_array()){ + while (@templatedb_check = $statement_handle->fetchrow_array()){ $templatedb_exists = 1; @@ -1106,14 +1106,14 @@ sub gettemplatelist{ my $class = shift; - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates ORDER BY filename ASC') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates ORDER BY filename ASC') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); my @database_template; my @templates_list; my $template_filename; - while (@database_template = $string_handle->fetchrow_array()){ + while (@database_template = $statement_handle->fetchrow_array()){ # Get certain values from the array. @@ -1163,10 +1163,10 @@ sub gettemplateinfo{ my $filename = $passedoptions->{"TemplateFilename"}; - $string_handle = $database_handle->prepare('SELECT filename, templatename, templatedescription, templatelayout, datemodified FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, templatename, templatedescription, templatelayout, datemodified FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@template_data = $string_handle->fetchrow_array()){ + while (@template_data = $statement_handle->fetchrow_array()){ # Get certain values from the array. @@ -1241,10 +1241,10 @@ sub addtemplate{ # Check if the template database exists. - $string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_templates\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_templates\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@templatedb_check = $string_handle->fetchrow_array()){ + while (@templatedb_check = $statement_handle->fetchrow_array()){ $templatedb_exists = 1; @@ -1255,14 +1255,14 @@ sub addtemplate{ if (!$templatedb_exists){ - $string_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_templates ( + $statement_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_templates ( filename varchar(256) primary key, templatename varchar(512), templatedescription varchar(512), templatelayout mediumtext, datemodified datetime ) DEFAULT CHARSET=utf8') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -1270,13 +1270,13 @@ sub addtemplate{ if (!$templatedb_exists){ - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ($blankfile = 1); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ($blankfile = 1); if ($blankfile eq 0){ - $string_handle->execute(); + $statement_handle->execute(); - while (@page_exists = $string_handle->fetchrow_array()){ + while (@page_exists = $statement_handle->fetchrow_array()){ $error = "TemplatePageExists"; return; @@ -1314,14 +1314,14 @@ sub addtemplate{ } - $string_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_templates (filename, templatename, templatedescription, templatelayout, datemodified) VALUES( + $statement_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_templates (filename, templatename, templatedescription, templatelayout, datemodified) VALUES( \'' . $class->convert($template_filename) . '\', \'' . $class->convert($template_name) . '\', \'' . $class->convert($template_description) . '\', \'' . $class->convert($template_layout) . '\', \'' . $class->convert($template_date) . '\' )') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -1359,10 +1359,10 @@ sub edittemplate{ # Check if the template exists. - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@template_info = $string_handle->fetchrow_array()){ + while (@template_info = $statement_handle->fetchrow_array()){ $template_found = 1; @@ -1385,7 +1385,7 @@ sub edittemplate{ # Update the template information. - $string_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_templates SET + $statement_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_templates SET filename = \'' . $class->convert($new_template_filename) . '\', templatename = \'' . $class->convert($new_template_name) . '\', templatedescription = \'' . $class->convert($new_template_description) . '\', @@ -1393,7 +1393,7 @@ sub edittemplate{ datemodified = \'' . $class->convert($templatenewdate) . '\' WHERE filename = \'' . $class->convert($template_filename) . '\' ') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -1424,10 +1424,10 @@ sub deletetemplate{ # Check if the template exists. - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@pagedata = $string_handle->fetchrow_array()){ + while (@pagedata = $statement_handle->fetchrow_array()){ $template_count++; @@ -1444,8 +1444,8 @@ sub deletetemplate{ # Delete the template from the template database. - $string_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_templates WHERE filename = \'' . $class->convert($template_filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1467,15 +1467,15 @@ sub getpagelist{ my $class = shift; - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); my @database_pagefilenames; my @database_pagefilenames_final; # Process the collected pages. - while (@database_pagefilenames = $string_handle->fetchrow_array){ + while (@database_pagefilenames = $statement_handle->fetchrow_array){ # Add each page to the list of pages in the database. @@ -1520,12 +1520,12 @@ sub getpageinfo{ if ($page_reduced eq 1){ - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page exists in the database. - while (@data_page = $string_handle->fetchrow_array()){ + while (@data_page = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1549,12 +1549,12 @@ sub getpageinfo{ } else { - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page exists in the database. - while (@data_page = $string_handle->fetchrow_array()){ + while (@data_page = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1643,13 +1643,13 @@ sub addpage{ # Check to see if the filename given already exists # in the page database. - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if a page with the filename given really does # exist. - while (@database_page = $string_handle->fetchrow_array()){ + while (@database_page = $statement_handle->fetchrow_array()){ # A page does exist so increment the count to 1. @@ -1697,7 +1697,7 @@ sub addpage{ # Add the page to the selected database. - $string_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( + $statement_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( \'' . $class->convert($page_filename) . '\', \'' . $class->convert($page_name) . '\', \'' . $class->convert($page_description) . '\', @@ -1707,7 +1707,7 @@ sub addpage{ \'' . $class->convert($page_settings) . '\', \'' . $class->convert($page_date) . '\' )') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -1740,10 +1740,10 @@ sub deletepage{ # Check if the page exists before deleting it. - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ $page_found = 1; @@ -1760,8 +1760,8 @@ sub deletepage{ # Delete the page. - $string_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1808,12 +1808,12 @@ sub editpage{ # Check if the page with the filename given exists. - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page really does exist. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # The page information is found. @@ -1837,12 +1837,12 @@ sub editpage{ if ($page_filename ne $page_newfilename){ - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_newfilename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_newfilename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if a page really is using the new filename. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # The page information is found. @@ -1866,8 +1866,8 @@ sub editpage{ # Edit the selected page. - $string_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages SET filename = \'' . $class->convert($page_newfilename) . '\', pagename = \'' . $class->convert($page_newname) . '\', pagedescription = \'' . $class->convert($page_newdescription) . '\', pagesection = \'' . $class->convert($page_newsection) . '\', pagetemplate = \'' . $class->convert($page_newtemplate) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagesettings = \'' . $class->convert($page_newsettings) . '\', lastmodified = \'' . $page_date . '\' WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages SET filename = \'' . $class->convert($page_newfilename) . '\', pagename = \'' . $class->convert($page_newname) . '\', pagedescription = \'' . $class->convert($page_newdescription) . '\', pagesection = \'' . $class->convert($page_newsection) . '\', pagetemplate = \'' . $class->convert($page_newtemplate) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagesettings = \'' . $class->convert($page_newsettings) . '\', lastmodified = \'' . $page_date . '\' WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1903,12 +1903,12 @@ sub movepage{ # Check if the page with the filename given exists. - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page really does exist. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1955,10 +1955,10 @@ sub movepage{ $page_found = 0; @page_info = (); - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ $page_found = 1; @@ -1975,7 +1975,7 @@ sub movepage{ # Add the page to the new database. - $string_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( + $statement_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( \'' . $class->convert($database_page{"PageFilename"}) . '\', \'' . $class->convert($database_page{"PageName"}) . '\', \'' . $class->convert($database_page{"PageDescription"}) . '\', @@ -1985,12 +1985,12 @@ sub movepage{ \'' . $class->convert($database_page{"PageSettings"}) . '\', \'' . $class->convert($database_page{"PageLastModified"}) . '\' )') or ( $error = "NewDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); # Delete the page from the old database. - $string_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($database_page{"PageFilename"}) . '\'') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($database_page{"PageFilename"}) . '\'') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -2026,12 +2026,12 @@ sub copypage{ # Check if the page with the filename given exists. - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page really does exist. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -2078,10 +2078,10 @@ sub copypage{ $page_found = 0; @page_info = (); - $string_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ $page_found = 1; @@ -2098,7 +2098,7 @@ sub copypage{ # Add the page to the new database. - $string_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( + $statement_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_' . $class->convert($second_database_filename) . '_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( \'' . $class->convert($database_page{"PageFilename"}) . '\', \'' . $class->convert($database_page{"PageName"}) . '\', \'' . $class->convert($database_page{"PageDescription"}) . '\', @@ -2108,7 +2108,7 @@ sub copypage{ \'' . $class->convert($database_page{"PageSettings"}) . '\', \'' . $class->convert($database_page{"PageLastModified"}) . '\' )') or ( $error = "NewDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -2137,10 +2137,10 @@ sub connectfilter{ # Check if the template database exists. - $string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_filters\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_filters\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@filterdb_check = $string_handle->fetchrow_array()){ + while (@filterdb_check = $statement_handle->fetchrow_array()){ $filterdb_exists = 1; @@ -2191,10 +2191,10 @@ sub getfilterlist{ # Get the list of filters available. - $string_handle = $database_handle->prepare('SELECT id, priority FROM ' . $class->convert($options{"TablePrefix"}) . '_filters ORDER BY priority ASC') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT id, priority FROM ' . $class->convert($options{"TablePrefix"}) . '_filters ORDER BY priority ASC') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@filter_data = $string_handle->fetchrow_array()){ + while (@filter_data = $statement_handle->fetchrow_array()){ # Add the filter to the list of available filters. @@ -2235,12 +2235,12 @@ sub getfilterinfo{ my $filter_id = $passedoptions->{"FilterID"}; - $string_handle = $database_handle->prepare('SELECT id, priority, findsetting, replacesetting, notes FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT id, priority, findsetting, replacesetting, notes FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Get the filter information. - while (@filter_data = $string_handle->fetchrow_array()){ + while (@filter_data = $statement_handle->fetchrow_array()){ $filter_info{"FilterID"} = decode_utf8($filter_data[0]); $filter_info{"FilterPriority"} = decode_utf8($filter_data[1]); @@ -2316,10 +2316,10 @@ sub addfilter{ # Check if the template database exists. - $string_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_filters\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SHOW TABLES LIKE \'' . $class->convert($options{"TablePrefix"}) . '_filters\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@filterdb_check = $string_handle->fetchrow_array()){ + while (@filterdb_check = $statement_handle->fetchrow_array()){ $filterdb_exists = 1; @@ -2358,23 +2358,23 @@ sub addfilter{ # Create the filter database table. - $string_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_filters ( + $statement_handle = $database_handle->prepare('CREATE TABLE ' . $class->convert($options{"TablePrefix"}) . '_filters ( id int(7) primary key, priority int(5), findsetting varchar(1024), replacesetting varchar(1024), notes text ) DEFAULT CHARSET=utf8') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } # Find the lowest filter identification number available. - $string_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters ORDER BY id ASC') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters ORDER BY id ASC') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@database_filters = $string_handle->fetchrow_array()){ + while (@database_filters = $statement_handle->fetchrow_array()){ $filter_id = decode_utf8($database_filters[0]); @@ -2394,12 +2394,12 @@ sub addfilter{ $new_id = $filter_id + 1; - $string_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters WHERE id = \'' . $class->convert($new_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters WHERE id = \'' . $class->convert($new_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Get the filter identification number. - while (@filterid_check = $string_handle->fetchrow_array()){ + while (@filterid_check = $statement_handle->fetchrow_array()){ $filter_found = 1; @@ -2436,14 +2436,14 @@ sub addfilter{ # Add the filter to the filter database. - $string_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_filters (id, priority, findsetting, replacesetting, notes) VALUES ( + $statement_handle = $database_handle->prepare('INSERT INTO ' . $class->convert($options{"TablePrefix"}) . '_filters (id, priority, findsetting, replacesetting, notes) VALUES ( \'' . $class->convert($new_id) . '\', \'' . $class->convert($filter_priority) . '\', \'' . $class->convert($filter_find) . '\', \'' . $class->convert($filter_replace) .'\', \'' . $class->convert($filter_notes) . '\' )') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -2487,12 +2487,12 @@ sub editfilter{ # Check if the filter exists before editing it. - $string_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the filter exists. - while (@filter_data = $string_handle->fetchrow_array()){ + while (@filter_data = $statement_handle->fetchrow_array()){ $filter_exists = 1; @@ -2512,13 +2512,13 @@ sub editfilter{ # Edit the selected filter. - $string_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_filters SET + $statement_handle = $database_handle->prepare('UPDATE ' . $class->convert($options{"TablePrefix"}) . '_filters SET findsetting = \'' . $class->convert($filter_newfind) . '\', replacesetting = \'' . $class->convert($filter_newreplace) . '\', priority = \'' . $class->convert($filter_newpriority) . '\', notes = \'' . $class->convert($filter_newnotes) . '\' WHERE id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); return; @@ -2554,10 +2554,10 @@ sub deletefilter{ # Check if the filter exists before deleting. - $string_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT id FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@filter_data = $string_handle->fetchrow_array()){ + while (@filter_data = $statement_handle->fetchrow_array()){ $filter_exists = 1; @@ -2574,8 +2574,8 @@ sub deletefilter{ # Delete the filter from the filter database. - $string_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DELETE FROM ' . $class->convert($options{"TablePrefix"}) . '_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } diff --git a/cgi-files/Modules/Database/SQLite.pm b/cgi-files/Modules/Database/SQLite.pm index 77366c4..f4a9d1b 100644 --- a/cgi-files/Modules/Database/SQLite.pm +++ b/cgi-files/Modules/Database/SQLite.pm @@ -37,20 +37,20 @@ use DBI qw(:sql_types); our $VERSION = "0.1.0"; my ($options, %options); my $database_handle; -my $string_handle; +my $statement_handle; my $error = ""; my $errorext = ""; my $database_filename; my $second_database_filename; my $second_database_handle; -my $second_string_handle; +my $second_statement_handle; my $templatedb_loaded = 0; my $templatedb_exists = 1; -my $template_string_handle; +my $template_statement_handle; my $template_database_handle; my $filterdb_loaded = 0; my $filterdb_exists = 1; -my $filterdb_string_handle; +my $filterdb_statement_handle; my $filterdb_database_handle; @@ -638,12 +638,12 @@ sub getdatabaseinfo{ $error = ""; $errorext = ""; - $string_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM kiriwrite_database_info LIMIT 1') or ( + $statement_handle = $database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM kiriwrite_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); - @sqldata = $string_handle->fetchrow_array(); + @sqldata = $statement_handle->fetchrow_array(); # Process the database information into a hash. @@ -657,8 +657,8 @@ sub getdatabaseinfo{ "Revision" => $sqldata[6] ); - $string_handle->finish(); - undef $string_handle; + $statement_handle->finish(); + undef $statement_handle; return %databaseinfo; @@ -683,12 +683,12 @@ sub getseconddatabaseinfo{ $error = ""; $errorext = ""; - $second_string_handle = $second_database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM kiriwrite_database_info LIMIT 1') or ( + $second_statement_handle = $second_database_handle->prepare('SELECT name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision FROM kiriwrite_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $second_database_handle->errstr, return ); - $second_string_handle->execute(); + $second_statement_handle->execute(); - @sqldata = $second_string_handle->fetchrow_array(); + @sqldata = $second_statement_handle->fetchrow_array(); # Process the database information into a hash. @@ -702,8 +702,8 @@ sub getseconddatabaseinfo{ "Revision" => $sqldata[6] ); - $second_string_handle->finish(); - undef $second_string_handle; + $second_statement_handle->finish(); + undef $second_statement_handle; return %databaseinfo; @@ -763,7 +763,7 @@ sub adddatabase{ $database_handle = DBI->connect("dbi:SQLite:dbname=" . $options{"Directory"} . '/' . $dbfilename . ".db.sqlite"); $database_handle->{unicode} = 1; - $string_handle = $database_handle->prepare('CREATE TABLE kiriwrite_database_info( + $statement_handle = $database_handle->prepare('CREATE TABLE kiriwrite_database_info( name varchar(256) primary key, description varchar(512), notes text, @@ -772,9 +772,9 @@ sub adddatabase{ kiriwrite_version_minor int(4), kiriwrite_version_revision int(4) )') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); - $string_handle = $database_handle->prepare('CREATE TABLE kiriwrite_database_pages( + $statement_handle = $database_handle->prepare('CREATE TABLE kiriwrite_database_pages( filename varchar(256) primary key, pagename varchar(512), pagedescription varchar(512), @@ -784,12 +784,12 @@ sub adddatabase{ pagesettings int(1), lastmodified datetime )') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); # Convert the values into SQL query formatted values and add an entry # to the kiriwrite_database_info table. - $string_handle = $database_handle->prepare('INSERT INTO kiriwrite_database_info (name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision) VALUES( + $statement_handle = $database_handle->prepare('INSERT INTO kiriwrite_database_info (name, description, notes, categories, kiriwrite_version_major, kiriwrite_version_minor, kiriwrite_version_revision) VALUES( \'' . $class->convert($dbname) . '\', \'' . $class->convert($dbdescription) . '\', \'' . $class->convert($dbnotes) . '\', @@ -798,7 +798,7 @@ sub adddatabase{ \'' . $class->convert($dbminorver) . '\', \'' . $class->convert($dbrevisionver) . '\' )') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); } @@ -929,22 +929,22 @@ sub editdatabase{ # Get the current database information. - $string_handle = $database_handle->prepare('SELECT name FROM kiriwrite_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT name FROM kiriwrite_database_info LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - my @database_oldinfo = $string_handle->fetchrow_array(); + my @database_oldinfo = $statement_handle->fetchrow_array(); my $dboldname = $database_oldinfo[0]; # Update the database information. - $string_handle = $database_handle->prepare('UPDATE kiriwrite_database_info SET name = \'' . $class->convert($dbname) . '\', + $statement_handle = $database_handle->prepare('UPDATE kiriwrite_database_info SET name = \'' . $class->convert($dbname) . '\', description = \'' . $class->convert($dbdescription) . '\', notes = \'' . $class->convert($dbnotes) . '\', categories = \'' . $class->convert($dbcategories) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); - undef $string_handle; + undef $statement_handle; return; } @@ -1152,15 +1152,15 @@ sub getpagelist{ my $class = shift; - $string_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); my @database_pagefilenames; my @database_pagefilenames_final; # Process the collected pages. - while (@database_pagefilenames = $string_handle->fetchrow_array){ + while (@database_pagefilenames = $statement_handle->fetchrow_array){ # Add each page to the list of pages in the database. @@ -1168,7 +1168,7 @@ sub getpagelist{ } - undef $string_handle; + undef $statement_handle; return @database_pagefilenames_final; } @@ -1212,13 +1212,13 @@ sub getpageinfo{ if ($page_reduced eq 1){ - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); # Check if the page exists in the database. - while (@data_page = $string_handle->fetchrow_array()){ + while (@data_page = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1243,13 +1243,13 @@ sub getpageinfo{ } else { - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); # Check if the page exists in the database. - while (@data_page = $string_handle->fetchrow_array()){ + while (@data_page = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1290,7 +1290,7 @@ sub getpageinfo{ } - undef $string_handle; + undef $statement_handle; return %database_page; } @@ -1338,13 +1338,13 @@ sub addpage{ # Check to see if the filename given already exists # in the page database. - $string_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if a page with the filename given really does # exist. - while (@database_page = $string_handle->fetchrow_array()){ + while (@database_page = $statement_handle->fetchrow_array()){ # A page does exist so increment the count to 1. @@ -1392,7 +1392,7 @@ sub addpage{ # Add the page to the selected database. - $string_handle = $database_handle->prepare('INSERT INTO kiriwrite_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( + $statement_handle = $database_handle->prepare('INSERT INTO kiriwrite_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( \'' . $class->convert($page_filename) . '\', \'' . $class->convert($page_name) . '\', \'' . $class->convert($page_description) . '\', @@ -1402,9 +1402,9 @@ sub addpage{ \'' . $class->convert($page_settings) . '\', \'' . $class->convert($page_date) . '\' )') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle->execute(); - undef $string_handle; + undef $statement_handle; } @@ -1437,10 +1437,10 @@ sub deletepage{ # Check if the page exists before deleting it. - $string_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ $page_found = 1; @@ -1457,8 +1457,8 @@ sub deletepage{ # Delete the page. - $string_handle = $database_handle->prepare('DELETE FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DELETE FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1505,12 +1505,12 @@ sub editpage{ # Check if the page with the filename given exists. - $string_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page really does exist. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # The page information is found. @@ -1534,12 +1534,12 @@ sub editpage{ if ($page_filename ne $page_newfilename){ - $string_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_newfilename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_newfilename) . '\' LIMIT 1') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if a page really is using the new filename. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # The page information is found. @@ -1563,8 +1563,8 @@ sub editpage{ # Edit the selected page. - $string_handle = $database_handle->prepare('UPDATE kiriwrite_database_pages SET filename = \'' . $class->convert($page_newfilename) . '\', pagename = \'' . $class->convert($page_newname) . '\', pagedescription = \'' . $class->convert($page_newdescription) . '\', pagesection = \'' . $class->convert($page_newsection) . '\', pagetemplate = \'' . $class->convert($page_newtemplate) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagesettings = \'' . $class->convert($page_newsettings) . '\', lastmodified = \'' . $page_date . '\' WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('UPDATE kiriwrite_database_pages SET filename = \'' . $class->convert($page_newfilename) . '\', pagename = \'' . $class->convert($page_newname) . '\', pagedescription = \'' . $class->convert($page_newdescription) . '\', pagesection = \'' . $class->convert($page_newsection) . '\', pagetemplate = \'' . $class->convert($page_newtemplate) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagedata = \'' . $class->convert($page_newcontent) . '\', pagesettings = \'' . $class->convert($page_newsettings) . '\', lastmodified = \'' . $page_date . '\' WHERE filename = \'' . $class->convert($page_filename) . '\'') or ( $error = "DatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1600,12 +1600,12 @@ sub movepage{ # Check if the page with the filename given exists. - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page really does exist. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1652,10 +1652,10 @@ sub movepage{ $page_found = 0; @page_info = (); - $second_string_handle = $second_database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $second_database_handle->errstr, return ); - $second_string_handle->execute(); + $second_statement_handle = $second_database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $second_database_handle->errstr, return ); + $second_statement_handle->execute(); - while (@page_info = $second_string_handle->fetchrow_array()){ + while (@page_info = $second_statement_handle->fetchrow_array()){ $page_found = 1; @@ -1672,7 +1672,7 @@ sub movepage{ # Add the page to the new database. - $second_string_handle = $second_database_handle->prepare('INSERT INTO kiriwrite_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( + $second_statement_handle = $second_database_handle->prepare('INSERT INTO kiriwrite_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( \'' . $class->convert($database_page{"PageFilename"}) . '\', \'' . $class->convert($database_page{"PageName"}) . '\', \'' . $class->convert($database_page{"PageDescription"}) . '\', @@ -1682,12 +1682,12 @@ sub movepage{ \'' . $class->convert($database_page{"PageSettings"}) . '\', \'' . $class->convert($database_page{"PageLastModified"}) . '\' )') or ( $error = "NewDatabaseError", $errorext = $second_database_handle->errstr, return ); - $second_string_handle->execute(); + $second_statement_handle->execute(); # Delete the page from the old database. - $string_handle = $database_handle->prepare('DELETE FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($database_page{"PageFilename"}) . '\'') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('DELETE FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($database_page{"PageFilename"}) . '\'') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); } @@ -1723,12 +1723,12 @@ sub copypage{ # Check if the page with the filename given exists. - $string_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); - $string_handle->execute(); + $statement_handle = $database_handle->prepare('SELECT filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "OldDatabaseError", $errorext = $database_handle->errstr, return ); + $statement_handle->execute(); # Check if the page really does exist. - while (@page_info = $string_handle->fetchrow_array()){ + while (@page_info = $statement_handle->fetchrow_array()){ # Get the values from the array. @@ -1775,10 +1775,10 @@ sub copypage{ $page_found = 0; @page_info = (); - $second_string_handle = $second_database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $second_database_handle->errstr, return ); - $second_string_handle->execute(); + $second_statement_handle = $second_database_handle->prepare('SELECT filename FROM kiriwrite_database_pages WHERE filename = \'' . $class->convert($page_filename) . '\' LIMIT 1') or ( $error = "NewDatabaseError", $errorext = $second_database_handle->errstr, return ); + $second_statement_handle->execute(); - while (@page_info = $second_string_handle->fetchrow_array()){ + while (@page_info = $second_statement_handle->fetchrow_array()){ $page_found = 1; @@ -1795,7 +1795,7 @@ sub copypage{ # Add the page to the new database. - $second_string_handle = $second_database_handle->prepare('INSERT INTO kiriwrite_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( + $second_statement_handle = $second_database_handle->prepare('INSERT INTO kiriwrite_database_pages (filename, pagename, pagedescription, pagesection, pagetemplate, pagedata, pagesettings, lastmodified) VALUES ( \'' . $class->convert($database_page{"PageFilename"}) . '\', \'' . $class->convert($database_page{"PageName"}) . '\', \'' . $class->convert($database_page{"PageDescription"}) . '\', @@ -1805,7 +1805,7 @@ sub copypage{ \'' . $class->convert($database_page{"PageSettings"}) . '\', \'' . $class->convert($database_page{"PageLastModified"}) . '\' )') or ( $error = "NewDatabaseError", $errorext = $second_database_handle->errstr, return ); - $second_string_handle->execute(); + $second_statement_handle->execute(); } @@ -1886,7 +1886,7 @@ sub disconnectfilter{ if ($filterdb_loaded eq 1){ - undef $filterdb_string_handle; + undef $filterdb_statement_handle; $filterdb_database_handle->disconnect(); } @@ -1910,10 +1910,10 @@ sub getfilterlist{ # Get the list of filters available. - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters ORDER BY priority ASC') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters ORDER BY priority ASC') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); - while (@filter_data = $filterdb_string_handle->fetchrow_array()){ + while (@filter_data = $filterdb_statement_handle->fetchrow_array()){ # Add the filter to the list of available filters. @@ -1921,7 +1921,7 @@ sub getfilterlist{ } - undef $filterdb_string_handle; + undef $filterdb_statement_handle; return @filter_list; } @@ -1955,12 +1955,12 @@ sub getfilterinfo{ my $filter_id = $passedoptions->{"FilterID"}; - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id, priority, findsetting, replacesetting, notes FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id, priority, findsetting, replacesetting, notes FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); # Get the filter information. - while (@filter_data = $filterdb_string_handle->fetchrow_array()){ + while (@filter_data = $filterdb_statement_handle->fetchrow_array()){ $filter_info{"FilterID"} = $filter_data[0]; $filter_info{"FilterPriority"} = $filter_data[1]; @@ -1986,7 +1986,7 @@ sub getfilterinfo{ # Return the filter information. - undef $filterdb_string_handle; + undef $filterdb_statement_handle; return %filter_info; } @@ -2088,7 +2088,7 @@ sub addfilter{ # Check if the filter table exists. - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters ORDER BY id ASC') or ( $nofiltertable = 1 ); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters ORDER BY id ASC') or ( $nofiltertable = 1 ); # Check if there is really no filter table. @@ -2096,23 +2096,23 @@ sub addfilter{ # Create the filter database table. - $filterdb_string_handle = $filterdb_database_handle->prepare('CREATE TABLE kiriwrite_filters ( + $filterdb_statement_handle = $filterdb_database_handle->prepare('CREATE TABLE kiriwrite_filters ( id int(7) primary key, priority int(5), findsetting varchar(1024), replacesetting varchar(1024), notes text )') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle->execute(); } # Find the lowest filter identification number available. - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters ORDER BY id ASC') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters ORDER BY id ASC') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); - while (@database_filters = $filterdb_string_handle->fetchrow_array()){ + while (@database_filters = $filterdb_statement_handle->fetchrow_array()){ $filter_id = $database_filters[0]; @@ -2132,12 +2132,12 @@ sub addfilter{ $new_id = $filter_id + 1; - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters WHERE id = \'' . $class->convert($new_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters WHERE id = \'' . $class->convert($new_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); # Get the filter identification number. - while (@filterid_check = $filterdb_string_handle->fetchrow_array()){ + while (@filterid_check = $filterdb_statement_handle->fetchrow_array()){ $filter_found = 1; @@ -2174,14 +2174,14 @@ sub addfilter{ # Add the filter to the filter database. - $filterdb_string_handle = $filterdb_database_handle->prepare('INSERT INTO kiriwrite_filters (id, priority, findsetting, replacesetting, notes) VALUES ( + $filterdb_statement_handle = $filterdb_database_handle->prepare('INSERT INTO kiriwrite_filters (id, priority, findsetting, replacesetting, notes) VALUES ( \'' . $class->convert($new_id) . '\', \'' . $class->convert($filter_priority) . '\', \'' . $class->convert($filter_find) . '\', \'' . $class->convert($filter_replace) .'\', \'' . $class->convert($filter_notes) . '\' )') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle->execute(); } @@ -2238,12 +2238,12 @@ sub editfilter{ # Check if the filter exists before editing it. - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); # Check if the filter exists. - while (@filter_data = $filterdb_string_handle->fetchrow_array()){ + while (@filter_data = $filterdb_statement_handle->fetchrow_array()){ $filter_exists = 1; @@ -2263,15 +2263,15 @@ sub editfilter{ # Edit the selected filter. - $filterdb_string_handle = $filterdb_database_handle->prepare('UPDATE kiriwrite_filters SET + $filterdb_statement_handle = $filterdb_database_handle->prepare('UPDATE kiriwrite_filters SET findsetting = \'' . $class->convert($filter_newfind) . '\', replacesetting = \'' . $class->convert($filter_newreplace) . '\', priority = \'' . $class->convert($filter_newpriority) . '\', notes = \'' . $class->convert($filter_newnotes) . '\' WHERE id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle->execute(); - undef $filterdb_string_handle; + undef $filterdb_statement_handle; return; } @@ -2306,10 +2306,10 @@ sub deletefilter{ # Check if the filter exists before deleting. - $filterdb_string_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('SELECT id FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); - while (@filter_data = $filterdb_string_handle->fetchrow_array()){ + while (@filter_data = $filterdb_statement_handle->fetchrow_array()){ $filter_exists = 1; @@ -2326,10 +2326,10 @@ sub deletefilter{ # Delete the filter from the filter database. - $filterdb_string_handle = $filterdb_database_handle->prepare('DELETE FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); - $filterdb_string_handle->execute(); + $filterdb_statement_handle = $filterdb_database_handle->prepare('DELETE FROM kiriwrite_filters where id = \'' . $class->convert($filter_id) . '\'') or ( $error = "FilterDatabaseError", $errorext = $filterdb_database_handle->errstr, return ); + $filterdb_statement_handle->execute(); - undef $filterdb_string_handle; + undef $filterdb_statement_handle; } @@ -2410,7 +2410,7 @@ sub disconnecttemplate{ if ($templatedb_loaded eq 1){ - undef $template_string_handle; + undef $template_statement_handle; $template_database_handle->disconnect(); } @@ -2429,14 +2429,14 @@ sub gettemplatelist{ $error = ""; $errorext = ""; - $template_string_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates ORDER BY filename ASC') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates ORDER BY filename ASC') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); + $template_statement_handle->execute(); my @database_template; my @templates_list; my $template_filename; - while (@database_template = $template_string_handle->fetchrow_array()){ + while (@database_template = $template_statement_handle->fetchrow_array()){ # Get certain values from the array. @@ -2486,10 +2486,10 @@ sub gettemplateinfo{ my $filename = $passedoptions->{"TemplateFilename"}; - $template_string_handle = $template_database_handle->prepare('SELECT filename, templatename, templatedescription, templatelayout, datemodified FROM kiriwrite_templates WHERE filename = \'' . $class->convert($filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle = $template_database_handle->prepare('SELECT filename, templatename, templatedescription, templatelayout, datemodified FROM kiriwrite_templates WHERE filename = \'' . $class->convert($filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); + $template_statement_handle->execute(); - while (@template_data = $template_string_handle->fetchrow_array()){ + while (@template_data = $template_statement_handle->fetchrow_array()){ # Get certain values from the array. @@ -2578,13 +2578,13 @@ sub addtemplate{ if ($templatedb_exists eq 0){ - $template_string_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ($blankfile = 1); + $template_statement_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ($blankfile = 1); if ($blankfile eq 0){ - $template_string_handle->execute(); + $template_statement_handle->execute(); - while (@page_exists = $template_string_handle->fetchrow_array()){ + while (@page_exists = $template_statement_handle->fetchrow_array()){ $error = "TemplatePageExists"; return; @@ -2636,7 +2636,7 @@ sub addtemplate{ # Check to see if a template can be added. - $template_string_handle = $template_database_handle->prepare('INSERT INTO kiriwrite_templates (filename, templatename, templatedescription, templatelayout, datemodified) VALUES( + $template_statement_handle = $template_database_handle->prepare('INSERT INTO kiriwrite_templates (filename, templatename, templatedescription, templatelayout, datemodified) VALUES( \'' . $class->convert($template_filename) . '\', \'' . $class->convert($template_name) . '\', \'' . $class->convert($template_description) . '\', @@ -2646,7 +2646,7 @@ sub addtemplate{ if (!$notemplatetable){ - $template_string_handle->execute(); + $template_statement_handle->execute(); } @@ -2668,23 +2668,23 @@ sub addtemplate{ } - $template_string_handle = $template_database_handle->prepare('create table kiriwrite_templates( + $template_statement_handle = $template_database_handle->prepare('create table kiriwrite_templates( filename varchar(256) primary key, templatename varchar(512), templatedescription varchar(512), templatelayout text, datemodified datetime );') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle->execute(); - $template_string_handle = $template_database_handle->prepare('INSERT INTO kiriwrite_templates (filename, templatename, templatedescription, templatelayout, datemodified) VALUES( + $template_statement_handle = $template_database_handle->prepare('INSERT INTO kiriwrite_templates (filename, templatename, templatedescription, templatelayout, datemodified) VALUES( \'' . $class->convert($template_filename) . '\', \'' . $class->convert($template_name) . '\', \'' . $class->convert($template_description) . '\', \'' . $class->convert($template_layout) . '\', \'' . $class->convert($template_date) . '\' )') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle->execute(); } @@ -2717,10 +2717,10 @@ sub deletetemplate{ # Check if the template exists. - $template_string_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); + $template_statement_handle->execute(); - while (@pagedata = $template_string_handle->fetchrow_array()){ + while (@pagedata = $template_statement_handle->fetchrow_array()){ $template_count++; @@ -2737,8 +2737,8 @@ sub deletetemplate{ # Delete the template from the template database. - $template_string_handle = $template_database_handle->prepare('DELETE FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle = $template_database_handle->prepare('DELETE FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\'') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); + $template_statement_handle->execute(); } @@ -2790,10 +2790,10 @@ sub edittemplate{ # Check if the template exists. - $template_string_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle = $template_database_handle->prepare('SELECT filename FROM kiriwrite_templates WHERE filename = \'' . $class->convert($template_filename) . '\' LIMIT 1') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); + $template_statement_handle->execute(); - while (@template_info = $template_string_handle->fetchrow_array()){ + while (@template_info = $template_statement_handle->fetchrow_array()){ $template_found = 1; @@ -2816,7 +2816,7 @@ sub edittemplate{ # Update the template information. - $template_string_handle = $template_database_handle->prepare('UPDATE kiriwrite_templates SET + $template_statement_handle = $template_database_handle->prepare('UPDATE kiriwrite_templates SET filename = \'' . $class->convert($new_template_filename) . '\', templatename = \'' . $class->convert($new_template_name) . '\', templatedescription = \'' . $class->convert($new_template_description) . '\', @@ -2824,7 +2824,7 @@ sub edittemplate{ datemodified = \'' . $class->convert($templatenewdate) . '\' WHERE filename = \'' . $class->convert($template_filename) . '\' ') or ( $error = "TemplateDatabaseError", $errorext = $template_database_handle->errstr, return ); - $template_string_handle->execute(); + $template_statement_handle->execute(); } @@ -2856,7 +2856,7 @@ sub disconnect{ # This function is not needed in this database module. - undef $string_handle; + undef $statement_handle; } diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi index e131756..83c80e4 100755 --- a/cgi-files/kiriwrite.cgi +++ b/cgi-files/kiriwrite.cgi @@ -3157,34 +3157,20 @@ sub kiriwrite_page_multicopy{ my @newdatabase_page; my $filename; - my $filename_sql; - my $filename_out; - my $olddatabase_database_handle; - my $olddatabase_string_handle; my $olddatabase_name; - my $newdatabase_database_handle; - my $newdatabase_string_handle; my $newdatabase_name; my $page; my $warning; my $page_filename; - my $page_filename_sql; my $page_name; - my $page_name_sql; my $page_description; - my $page_description_sql; my $page_section; - my $page_section_sql; my $page_template; - my $page_template_sql; my $page_data; - my $page_data_sql; my $page_settings; - my $page_settings_sql; my $page_lastmodified; - my $page_lastmodified_sql; my $page_seek = 0; my $warning_count = 0; -- 2.39.5