# 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 = "";
# 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){
# 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 = "";
# 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;
+
+ }
}
# 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,
} else {
my %database_info;
- my %template_info;
+ my %page_info;
my @database_pages;
my $pagemultioptions = "";
my $db_name = "";
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.
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.
$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.
<about>
<name>English (British)</name>
<creator>Steve Brokenshire</creator>
- <mailaddress>sbrokenshire(ao)xestia(dottie)co(dottie)uk</mailaddress>
+ <mailaddress>sbrokenshire|ao|xestia|dottie|co|dottie|uk</mailaddress>
</about>
<database>