From: kirinji Date: Mon, 3 Sep 2007 18:26:14 +0000 (+0000) Subject: Some updates. X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=9379933d4d112578e469053a691dfbb4873384f7;p=kiriwrite%2F.git Some updates. --- diff --git a/cgi-files/Modules/Database/MySQL5.pm b/cgi-files/Modules/Database/MySQL5.pm index c398c6d..3a41408 100644 --- a/cgi-files/Modules/Database/MySQL5.pm +++ b/cgi-files/Modules/Database/MySQL5.pm @@ -1498,6 +1498,8 @@ sub getpageinfo{ # options Specifies the following options in any order. # # # # PageFilename Specifies the page filename to get the page information from. # +# Reduced Specifies if the reduced version of the page information should # +# be retrieved. # ################################################################################# $error = ""; @@ -1514,42 +1516,76 @@ sub getpageinfo{ # Get the page from the database. my $page_filename = $passedoptions->{"PageFilename"}; + my $page_reduced = $passedoptions->{"Reduced"}; - $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(); + if ($page_reduced eq 1){ - # Check if the page exists in the database. + $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(); - while (@data_page = $string_handle->fetchrow_array()){ + # Check if the page exists in the database. - # Get the values from the array. + while (@data_page = $string_handle->fetchrow_array()){ - $pagefilename = decode_utf8($data_page[0]); - $pagename = decode_utf8($data_page[1]); - $pagedescription = decode_utf8($data_page[2]); - $pagesection = decode_utf8($data_page[3]); - $pagetemplate = decode_utf8($data_page[4]); - $pagedata = decode_utf8($data_page[5]); - $pagesettings = decode_utf8($data_page[6]); - $pagelastmodified = decode_utf8($data_page[7]); + # Get the values from the array. - # Put the values into the page hash. + $pagefilename = decode_utf8($data_page[0]); + $pagename = decode_utf8($data_page[1]); + $pagedescription = decode_utf8($data_page[2]); + $pagelastmodified = decode_utf8($data_page[3]); - %database_page = ( - "PageFilename" => $pagefilename, - "PageName" => $pagename, - "PageDescription" => $pagedescription, - "PageSection" => $pagesection, - "PageTemplate" => $pagetemplate, - "PageContent" => $pagedata, - "PageSettings" => $pagesettings, - "PageLastModified" => $class->dateconvert($pagelastmodified), - ); + # Put the values into the page hash. - $page_found = 1; + %database_page = ( + "PageFilename" => $pagefilename, + "PageName" => $pagename, + "PageDescription" => $pagedescription, + "PageLastModified" => $class->dateconvert($pagelastmodified), + ); - } + $page_found = 1; + + } + } 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(); + + # Check if the page exists in the database. + + while (@data_page = $string_handle->fetchrow_array()){ + + # Get the values from the array. + + $pagefilename = decode_utf8($data_page[0]); + $pagename = decode_utf8($data_page[1]); + $pagedescription = decode_utf8($data_page[2]); + $pagesection = decode_utf8($data_page[3]); + $pagetemplate = decode_utf8($data_page[4]); + $pagedata = decode_utf8($data_page[5]); + $pagesettings = decode_utf8($data_page[6]); + $pagelastmodified = decode_utf8($data_page[7]); + + # Put the values into the page hash. + + %database_page = ( + "PageFilename" => $pagefilename, + "PageName" => $pagename, + "PageDescription" => $pagedescription, + "PageSection" => $pagesection, + "PageTemplate" => $pagetemplate, + "PageContent" => $pagedata, + "PageSettings" => $pagesettings, + "PageLastModified" => $class->dateconvert($pagelastmodified), + ); + + $page_found = 1; + + } + + } + # Check if the page did exist. if (!$page_found){ diff --git a/cgi-files/Modules/Database/SQLite.pm b/cgi-files/Modules/Database/SQLite.pm index 31d0dee..28c7cba 100644 --- a/cgi-files/Modules/Database/SQLite.pm +++ b/cgi-files/Modules/Database/SQLite.pm @@ -1184,6 +1184,8 @@ sub getpageinfo{ # options Specifies the following options in any order. # # # # PageFilename Specifies the page filename to get the page information from. # +# Reduced Specifies if the reduced version of the page information should # +# be retrieved. # ################################################################################# $error = ""; @@ -1200,39 +1202,76 @@ sub getpageinfo{ # Get the page from the database. my $page_filename = $passedoptions->{"PageFilename"}; + my $page_reduced = $passedoptions->{"Reduced"}; - $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 ); - $string_handle->execute(); + if ($page_reduced eq 1){ - # Check if the page exists in the database. + $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 ); - while (@data_page = $string_handle->fetchrow_array()){ + $string_handle->execute(); - # Get the values from the array. + # Check if the page exists in the database. - $pagefilename = $data_page[0]; - $pagename = $data_page[1]; - $pagedescription = $data_page[2]; - $pagesection = $data_page[3]; - $pagetemplate = $data_page[4]; - $pagedata = $data_page[5]; - $pagesettings = $data_page[6]; - $pagelastmodified = $data_page[7]; + while (@data_page = $string_handle->fetchrow_array()){ + + # Get the values from the array. + + $pagefilename = $data_page[0]; + $pagename = $data_page[1]; + $pagedescription = $data_page[2]; + $pagelastmodified = $data_page[3]; + + # Put the values into the page hash. + + %database_page = ( + "PageFilename" => $pagefilename, + "PageName" => $pagename, + "PageDescription" => $pagedescription, + "PageLastModified" => $class->dateconvert($pagelastmodified), + ); + + $page_found = 1; + + } - # Put the values into the page hash. - %database_page = ( - "PageFilename" => $pagefilename, - "PageName" => $pagename, - "PageDescription" => $pagedescription, - "PageSection" => $pagesection, - "PageTemplate" => $pagetemplate, - "PageContent" => $pagedata, - "PageSettings" => $pagesettings, - "PageLastModified" => $class->dateconvert($pagelastmodified), - ); + } 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 ); - $page_found = 1; + $string_handle->execute(); + + # Check if the page exists in the database. + + while (@data_page = $string_handle->fetchrow_array()){ + + # Get the values from the array. + + $pagefilename = $data_page[0]; + $pagename = $data_page[1]; + $pagedescription = $data_page[2]; + $pagesection = $data_page[3]; + $pagetemplate = $data_page[4]; + $pagedata = $data_page[5]; + $pagesettings = $data_page[6]; + $pagelastmodified = $data_page[7]; + + # Put the values into the page hash. + + %database_page = ( + "PageFilename" => $pagefilename, + "PageName" => $pagename, + "PageDescription" => $pagedescription, + "PageSection" => $pagesection, + "PageTemplate" => $pagetemplate, + "PageContent" => $pagedata, + "PageSettings" => $pagesettings, + "PageLastModified" => $class->dateconvert($pagelastmodified), + ); + + $page_found = 1; + + } } @@ -2609,17 +2648,17 @@ sub addtemplate{ # Create a template table. - my $directory_permissions = main::kiriwrite_filepermissions(".", 1, 1, 0); + my $directory_permissions = main::kiriwrite_filepermissions(".", 1, 1, 0); - if ($directory_permissions eq 1){ + if ($directory_permissions eq 1){ - # The template database cannot be created because of invalid directory - # permissions so return an error. + # The template database cannot be created because of invalid directory + # permissions so return an error. - $error = "TemplateDatabaseFileUncreateable"; - return; + $error = "TemplateDatabaseFileUncreateable"; + return; - } + } $template_string_handle = $template_database_handle->prepare('create table kiriwrite_templates( filename varchar(256) primary key, diff --git a/cgi-files/kiriwrite.cgi b/cgi-files/kiriwrite.cgi index 85d6a2d..bd59725 100755 --- a/cgi-files/kiriwrite.cgi +++ b/cgi-files/kiriwrite.cgi @@ -4649,7 +4649,7 @@ sub kiriwrite_page_list{ } else { my %database_info; - my %template_info; + my %page_info; my @database_pages; my $pagemultioptions = ""; my $db_name = ""; @@ -4665,7 +4665,7 @@ sub kiriwrite_page_list{ my $db_file_notblank = 0; tie(%database_info, 'Tie::IxHash'); - tie(%template_info, 'Tie::IxHash'); + tie(%page_info, 'Tie::IxHash'); # The database_file variable is not blank, so print out a list of pages from # the selected database. @@ -4792,7 +4792,7 @@ sub kiriwrite_page_list{ foreach $page_filename (@database_pages){ - %template_info = $kiriwrite_dbmodule->getpageinfo({ PageFilename => $page_filename }); + %page_info = $kiriwrite_dbmodule->getpageinfo({ PageFilename => $page_filename, Reduced => 1 }); # Check if any errors have occured. @@ -4813,10 +4813,10 @@ sub kiriwrite_page_list{ $page_count++; - $page_filename = $template_info{"PageFilename"}; - $page_name = $template_info{"PageName"}; - $page_description = $template_info{"PageDescription"}; - $page_modified = $template_info{"PageLastModified"}; + $page_filename = $page_info{"PageFilename"}; + $page_name = $page_info{"PageName"}; + $page_description = $page_info{"PageDescription"}; + $page_modified = $page_info{"PageLastModified"}; # Set the table cell style. diff --git a/cgi-files/lang/en-GB.xml b/cgi-files/lang/en-GB.xml index 9281cea..51003d9 100644 --- a/cgi-files/lang/en-GB.xml +++ b/cgi-files/lang/en-GB.xml @@ -4,7 +4,7 @@ English (British) Steve Brokenshire - sbrokenshire(ao)xestia(dottie)co(dottie)uk + sbrokenshire|ao|xestia|dottie|co|dottie|uk