updated version to 1.3
[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 $base_path = "/var/www/phpfspot";
29
30    var $web_path = "/phpfspot";
31
32    /* path to the directory to store the generated thumbnails.
33       this path needs not do be directly reachable via the webserver
34       Default it points to a subdirectory of $base_path.
35    */
36    var $thumb_path = "/var/www/phpfspot/thumbs";
37
38    var $theme_name = "default";
39  
40    /* database access via "native" sqlite3 support or via "pdo" */
41    var $db_access = "native";
42
43    /* path to Smarty (http://smarty.php.net) installation. this option
44       should directly point to the Smarty main directory containing the
45       sub directories 'libs', 'misc', 'unit_test', ...
46       the default value '/usr/share/php/smarty' is for Debian GNU/Linux
47       where Smarty is installed through as dpkg.
48    */
49    var $smarty_path = "/usr/share/php/smarty";
50
51    /* it's enough if this database is readonly for the webserver */
52    var $fspot_db = "/var/www/f-spot-dbs/photos.db";
53
54    /* this database MUST be writeable for the webserver. Set the directory
55       permissions correctly so phpfspot can create this database for you!!
56    */
57    var $phpfspot_db = "/var/www/f-spot-dbs/phpfspot.db";
58
59    /* don't touch if you haven't changed the base templates */
60    var $thumb_width = "150";
61    var $thumb_height = "145";
62    var $photo_width = "640";
63    var $mini_width = "100";
64
65    /* how many thumbnails should be displayed on the photo index view */
66    /* use 0 to display all matching photos on one page                */
67    var $thumbs_per_page = 50;
68
69    /* Usually the photo directory differs between your local F-Spot installation
70       and your webserver. With this you can advice phpfspot to replace all paths
71       (they are stored in F-Spot's sqlite3 database).
72    */
73    var $path_replace_from = "/home/unki";
74    var $path_replace_to = "/var/www/phpfspot/Photos";
75
76    /* This is not really a security option - it only hides some present F-Spot
77       tags from the available-tags-list
78    */
79    var $hide_tags = Array("Favorites", "Hidden", "People", "Places", "Events");
80
81    /* Show only pictures which are tagged with the following tags.
82       Comment out this option with // if you want to show all tags &
83       pictures.
84    */
85    //var $show_tags = Array("Friends", "Holidays");
86
87    /* logging = display || errorlog || logfile */
88    var $logging = "display";
89
90    /* set this if you chose logging = logfile */
91    var $log_file = "phpfspot_err.log";
92
93    /* no need to modified anything below this line */
94    var $error_found = 0;
95
96    public function __construct()
97    {
98       if(!isset($this->page_title) || $this->page_title == "")
99          $this->showError("Please set \$page_title in phpfspot_cfg");
100    
101       if(!isset($this->base_path) || $this->base_path == "")
102          $this->showError("Please set \$base_path in phpfspot_cfg");
103
104       if(!isset($this->web_path) || $this->web_path == "")
105          $this->showError("Please set \$web_path in phpfspot_cfg");
106
107       if(!isset($this->thumb_path) || $this->thumb_path == "")
108          $this->showError("Please set \$thumb_path in phpfspot_cfg");
109
110       if(!isset($this->smarty_path) || $this->smarty_path == "")
111          $this->showError("Please set \$smarty_path in phpfspot_cfg");
112
113       if(!isset($this->fspot_db) || $this->fspot_db == "")
114          $this->showError("Please set \$fspot_db in phpfspot_cfg");
115
116       if(!isset($this->db_access) || $this->db_access == "")
117          $this->showError("Please set \$db_access in phpfspot_cfg");
118
119       if(!isset($this->phpfspot_db) || $this->phpfspot_db == "")
120          $this->showError("Please set \$phpfspot_db in phpfspot_cfg");
121
122       if(!isset($this->thumb_width) || $this->thumb_width == "")
123          $this->showError("Please set \$thumb_width in phpfspot_cfg");
124
125       if(!isset($this->thumb_height) || $this->thumb_height == "")
126          $this->showError("Please set \$thumb_height in phpfspot_cfg");
127
128       if(!isset($this->photo_width) || $this->photo_width == "")
129          $this->showError("Please set \$photo_width in phpfspot_cfg");
130
131       if(!isset($this->mini_width) || $this->mini_width == "")
132          $this->showError("Please set \$mini_width in phpfspot_cfg");
133
134       if(!isset($this->thumbs_per_page))
135          $this->showError("Please set \$thumbs_per_page in phpfspot_cfg");
136
137       if(!isset($this->path_replace_from) || $this->path_replace_from == "")
138          $this->showError("Please set \$path_replace_from in phpfspot_cfg");
139
140       if(!isset($this->path_replace_to) || $this->path_replace_to == "")
141          $this->showError("Please set \$path_replace_to in phpfspot_cfg");
142
143       if(!isset($this->hide_tags))
144          $this->showError("Please set \$hide_tags in phpfspot_cfg");
145
146       if(!isset($this->theme_name))
147          $this->showError("Please set \$theme_name in phpfspot_cfg");
148
149       if(!isset($this->logging))
150          $this->showError("Please set \$logging in phpfspot_cfg");
151
152       if(isset($this->logging) && $this->logging == 'logfile') {
153
154          if(!isset($this->log_file))
155             $this->showError("Please set \$log_file because you set logging = log_file in phpfspot_cfg");
156
157          if(!is_writeable($this->log_file))
158             $this->showError("The specified \$log_file ". $log_file ." is not writeable!");
159
160       }
161
162       if(isset($this->error_found) && $this->error_found)
163          exit(1);
164
165       /* check for pending slash on web_path */
166       if(!preg_match("/\/$/", $this->web_path))
167          $this->web_path.= "/";
168
169    } // __construct()
170
171    private function showError($text)
172    {
173       print $text ."<br />\n";
174       $this->error_found = 1;
175
176    } // showError()
177
178 }
179
180 ?>