diff options
| -rw-r--r-- | sample/src/setup.xml | 10 | ||||
| -rw-r--r-- | src/atom-writer.c | 2 | ||||
| -rw-r--r-- | src/cgg.c | 6 | ||||
| -rw-r--r-- | src/setup.c | 8 | ||||
| -rw-r--r-- | src/setup.h | 5 |
5 files changed, 22 insertions, 9 deletions
diff --git a/sample/src/setup.xml b/sample/src/setup.xml index 7fde549..75cce85 100644 --- a/sample/src/setup.xml +++ b/sample/src/setup.xml @@ -88,10 +88,16 @@ And the second line.</add_copyright> <!-- to particular album index files. --> <filename>atomfeed.xml</filename> <title>CGG Sample gallery site news</title> - <!-- It's crucial to set URL of the site. Enter root URL of the gallery. --> - <base_url>http://www.example.com/</base_url> </feed> + <location> + <!-- Root URL of the gallery. Required for feeds. --> + <base_url>http://www.example.com/</base_url> + <!-- Local path to the gallery root. Specify either absolute path --> + <!-- or relative to ServerRoot. Required for password protection. --> + <local_path>/var/www/</local_path> + </location> + <footer><![CDATA[ So this is footer, suitable place for copyright, W3C validation links and advertisement! | Generated with <a href="http://cgg.bzatek.net/" title="Cataract Gallery Generator">Cataract Gallery Generator</a>. | diff --git a/src/atom-writer.c b/src/atom-writer.c index 8fa1ec8..51609bb 100644 --- a/src/atom-writer.c +++ b/src/atom-writer.c @@ -187,7 +187,7 @@ atom_writer_write_to_file (TAtomFeed *feed, const gchar *filename, TGallerySetup else { fprintf (f, " <entry>\n"); fprintf (f, " <title>%s</title>\n", item->title); - s = g_build_path ("/", setup->feed_base_url, item->path, "/", NULL); + s = g_build_path ("/", setup->location_base_url, item->path, "/", NULL); fprintf (f, " <link rel=\"alternate\" type=\"text/html\" href=\"%s\"/>\n", s); g_free (s); @@ -192,14 +192,14 @@ main (int argc, char* argv[]) if (news_feed) { if (verbose) printf ("Writing Atom feed: %s\n", setup->feed_filename); - if (setup->feed_base_url == NULL || strlen (setup->feed_base_url) == 0) + if (setup->location_base_url == NULL || strlen (setup->location_base_url) == 0) log_error ("Error: feed base URL not defined!\n"); else if (setup->feed_filename == NULL || strlen (setup->feed_filename) == 0) log_error ("Error: feed file name not defined!\n"); else { - atom_writer_set_base_url (news_feed, setup->feed_base_url); - s = g_build_filename (setup->feed_base_url, setup->feed_filename, NULL); + atom_writer_set_base_url (news_feed, setup->location_base_url); + s = g_build_filename (setup->location_base_url, setup->feed_filename, NULL); atom_writer_set_feed_url (news_feed, s); g_free (s); diff --git a/src/setup.c b/src/setup.c index f053555..c78b15f 100644 --- a/src/setup.c +++ b/src/setup.c @@ -122,7 +122,10 @@ parse_setup_xml (const gchar *filename) setup->feed_enabled = xml_file_get_node_attribute_boolean (xml, "/gallery_setup/feed", "enable", FALSE); setup->feed_filename = xml_file_get_node_value (xml, "/gallery_setup/feed/filename/text()"); setup->feed_title = xml_file_get_node_value (xml, "/gallery_setup/feed/title/text()"); - setup->feed_base_url = xml_file_get_node_value (xml, "/gallery_setup/feed/base_url/text()"); + + /* location section */ + setup->location_base_url = xml_file_get_node_value (xml, "/gallery_setup/location/base_url/text()"); + setup->location_local_path = xml_file_get_node_value (xml, "/gallery_setup/location/local_path/text()"); /* footer section */ setup->footer = xml_file_get_node_value (xml, "/gallery_setup/footer/text()"); @@ -379,7 +382,8 @@ free_setup_data (TGallerySetup *setup) g_free (setup->favicon_type); g_free (setup->feed_filename); g_free (setup->feed_title); - g_free (setup->feed_base_url); + g_free (setup->location_base_url); + g_free (setup->location_local_path); g_free (setup->footer); free_design_setup_data (setup->design); g_free (setup); diff --git a/src/setup.h b/src/setup.h index 7e4ce1e..c34d861 100644 --- a/src/setup.h +++ b/src/setup.h @@ -78,7 +78,10 @@ typedef struct { gboolean feed_enabled; gchar *feed_filename; gchar *feed_title; - gchar *feed_base_url; + + /* location section */ + gchar *location_base_url; + gchar *location_local_path; /* footer section */ gchar *footer; |
