X-Git-Url: http://Server1/repobrowser/?p=kiriwrite%2F.git;a=blobdiff_plain;f=cgi-files%2FModules%2FDatabase%2FSQLite.pm;h=31d0deeff1c511a51acb5716e95d428543a6e8b7;hp=270f8fa2b33142768a4ffab5e344d3ddb95b43cd;hb=1553f195cb1ca50f1409afec52b29002e03b4511;hpb=be683aa626f39218c9ee5e3e0523069a5243dd83 diff --git a/cgi-files/Modules/Database/SQLite.pm b/cgi-files/Modules/Database/SQLite.pm index 270f8fa..31d0dee 100644 --- a/cgi-files/Modules/Database/SQLite.pm +++ b/cgi-files/Modules/Database/SQLite.pm @@ -38,10 +38,12 @@ our $VERSION = "0.1.0"; my ($options, %options); my $database_handle; my $string_handle; -my $second_database_handle; -my $second_string_handle; +my $error = ""; +my $errorext = ""; my $database_filename; my $second_database_filename; +my $second_database_handle; +my $second_string_handle; my $templatedb_loaded = 0; my $templatedb_exists = 1; my $template_string_handle; @@ -50,8 +52,7 @@ my $filterdb_loaded = 0; my $filterdb_exists = 1; my $filterdb_string_handle; my $filterdb_database_handle; -my $error = ""; -my $errorext = ""; + ################################################################################# # Generic Subroutines. # @@ -1481,6 +1482,33 @@ sub editpage{ } + # Check if there is a page that already exists with the new + # filename. + + 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(); + + # Check if a page really is using the new filename. + + while (@page_info = $string_handle->fetchrow_array()){ + + # The page information is found. + + $page_found = 1; + + } + + if ($page_found eq 1){ + + $error = "PageExists"; + return; + + } + + } + # Get the current date. my ($created_second, $created_minute, $created_hour, $created_day, $created_month, $created_year, $created_weekday, $created_yearday, $created_dst) = localtime;