issue62, fix time information for item pubDate in rss feed
[phpfspot.git] / phpfspot_cfg.php.dist
1 <?php
2
3 /***************************************************************************
4  *
5  * Copyright (c) by Andreas Unterkircher, unki@netshadow.at
6  * All rights reserved
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  ***************************************************************************/
23
24 class PHPFSPOT_CFG {
25
26    var $page_title = "phpfspot - dynamic PHP gallery for F-Spot";
27
28    var $product = "phpfspot";
29    var $version = "1.0";
30
31    var $base_path = "/var/www/htdocs";
32
33    var $web_path = "/phpfspot";
34
35    /* path to the directory to store the generated thumbnails.
36       this path needs not do be directly reachable via the webserver
37       Default it points to a subdirectory of $base_path.
38    */
39    var $thumb_path = "/var/www/htdocs/thumbs";
40
41    var $theme_name = "default";
42  
43    /* database access via "native" sqlite3 support or via "pdo" */
44    var $db_access = "native";
45
46    /* path to Smarty (http://smarty.php.net) installation. this option
47       should directly point to the Smarty main directory containing the
48       sub directories 'libs', 'misc', 'unit_test', ...
49       the default value '/usr/share/php/smarty' is for Debian GNU/Linux
50       where Smarty is installed through as dpkg.
51    */
52    var $smarty_path = "/usr/share/php/smarty";
53
54    /* it's enough if this database is readonly for the webserver */
55    var $fspot_db = "/var/www/f-spot-dbs/photos.db";
56
57    /* this database MUST be writeable for the webserver. Set the directory
58       permissions correctly so phpfspot can create this database for you!!
59    */
60    var $phpfspot_db = "/var/www/f-spot-dbs/phpfspot.db";
61
62    /* don't touch if you haven't changed the base templates */
63    var $thumb_width = "150";
64    var $photo_width = "640";
65    var $mini_width = "100";
66
67    /* how many columns in the photo index view */
68    var $thumbs_per_row = 4;
69
70    /* how many rows should be displayed on the photo index view */
71    /* use 0 to display all matching photos on one page */
72    var $rows_per_page = 4;
73
74    /* Usually the photo directory differs between your local F-Spot installation
75       and your webserver. With this you can advice phpfspot to replace all paths
76       (they are stored in F-Spot's sqlite3 database).
77    */
78    var $path_replace_from = "/home/unki";
79    var $path_replace_to = "/var/www/images.netshadow.at";
80
81    /* This is not really a security option - it only hides some present F-Spot
82       tags from the available-tags-list
83    */
84    var $hide_tags = Array("Favorites", "Hidden", "People", "Places", "Events");
85
86    /* logging = display || errorlog || logfile */
87    var $logging = "display";
88
89    /* set this if you chose logging = logfile */
90    var $log_file = "phpfspot_err.log";
91
92    /* no need to modified anything below this line */
93    var $error_found = 0;
94
95    public function __construct()
96    {
97       if(!isset($this->page_title) || $this->page_title == "")
98          $this->showError("Please set \$page_title in phpfspot_cfg");
99    
100       if(!isset($this->product) || $this->product == "")
101          $this->showError("Please set \$product in phpfspot_cfg");
102
103       if(!isset($this->version) || $this->version == "")
104          $this->showError("Please set \$version in phpfspot_cfg");
105
106       if(!isset($this->base_path) || $this->base_path == "")
107          $this->showError("Please set \$base_path in phpfspot_cfg");
108
109       if(!isset($this->web_path) || $this->web_path == "")
110          $this->showError("Please set \$web_path in phpfspot_cfg");
111
112       if(!isset($this->thumb_path) || $this->thumb_path == "")
113          $this->showError("Please set \$thumb_path in phpfspot_cfg");
114
115       if(!isset($this->smarty_path) || $this->smarty_path == "")
116          $this->showError("Please set \$smarty_path in phpfspot_cfg");
117
118       if(!isset($this->fspot_db) || $this->fspot_db == "")
119          $this->showError("Please set \$fspot_db in phpfspot_cfg");
120
121       if(!isset($this->db_access) || $this->db_access == "")
122          $this->showError("Please set \$db_access in phpfspot_cfg");
123
124       if(!isset($this->phpfspot_db) || $this->phpfspot_db == "")
125          $this->showError("Please set \$phpfspot_db in phpfspot_cfg");
126
127       if(!isset($this->thumb_width) || $this->thumb_width == "")
128          $this->showError("Please set \$thumb_width in phpfspot_cfg");
129
130       if(!isset($this->photo_width) || $this->photo_width == "")
131          $this->showError("Please set \$photo_width in phpfspot_cfg");
132
133       if(!isset($this->mini_width) || $this->mini_width == "")
134          $this->showError("Please set \$mini_width in phpfspot_cfg");
135
136       if(!isset($this->thumbs_per_row) || $this->thumbs_per_row == "")
137          $this->showError("Please set \$thumbs_per_row in phpfspot_cfg");
138
139       if(!isset($this->rows_per_page) || $this->rows_per_page == "")
140          $this->showError("Please set \$rows_per_page in phpfspot_cfg");
141
142       if(!isset($this->path_replace_from) || $this->path_replace_from == "")
143          $this->showError("Please set \$path_replace_from in phpfspot_cfg");
144
145       if(!isset($this->path_replace_to) || $this->path_replace_to == "")
146          $this->showError("Please set \$path_replace_to in phpfspot_cfg");
147
148       if(!isset($this->hide_tags))
149          $this->showError("Please set \$hide_tags in phpfspot_cfg");
150
151       if(!isset($this->theme_name))
152          $this->showError("Please set \$theme_name in phpfspot_cfg");
153
154       if(!isset($this->logging))
155          $this->showError("Please set \$logging in phpfspot_cfg");
156
157       if(isset($this->logging) && $this->logging == 'logfile') {
158
159          if(!isset($this->log_file))
160             $this->showError("Please set \$log_file because you set logging = log_file in phpfspot_cfg");
161
162          if(!is_writeable($this->log_file))
163             $this->showError("The specified \$log_file ". $log_file ." is not writeable!");
164
165       }
166
167       if(isset($this->error_found) && $this->error_found)
168          exit(1);
169
170       /* check for pending slash on web_path */
171       if(!preg_match("/\/$/", $this->web_path))
172          $this->web_path.= "/";
173
174    } // __construct()
175
176    private function showError($text)
177    {
178       print $text ."<br />\n";
179       $this->error_found = 1;
180
181    } // showError()
182
183 }
184
185 ?>