tighten return codes
[diogenes.git] / include / diogenes.globals.inc.php.in
CommitLineData
6855525e
JL
1<?php
2/*
3 * Copyright (C) 2003-2004 Polytechnique.org
4 * http://opensource.polytechnique.org/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22require_once 'diogenes/diogenes.core.globals.inc.php';
23
24/** This class describes Diogenes' global settings.
25 */
26class DiogenesGlobals extends DiogenesCoreGlobals {
27 /** Absolute directory location of Diogenes root. */
28 var $root;
29 /** Absolute directory location of Diogenes spool directory. */
30 var $spoolroot;
31 /** Absolute directory location of Diogenes RCS. */
32 var $rcsroot;
33 /** The Diogenes root URL */
34 var $rooturl;
35 /** The Diogenes version */
36 var $version = "@VERSION@";
37
38 /** A barrel's stylesheet */
39 var $cssfile = "style.css";
40 /** The file containing a barrel page definition */
41 var $htmlfile = "page.html";
42 /** The Word file containing a barrel page definition */
43 var $wordfile = "page.doc";
44
45 /** The revision control system (DiogenesRcs or DiogenesCvs).
46 * This can be set from the toplevel interface
47 */
48 var $rcs = "DiogenesRcs";
49 /** The class for display toplevel pages. */
50 var $toplevel = 'DiogenesToplevel';
51 /** The class for displaying sites. */
52 var $barrel = 'DiogenesBarrel';
53 /** The class to use for session handling. */
54 var $session = 'DiogenesSession';
55 /** The class to use for WebDAV operations. */
56 var $webdav = 'DiogenesWebDAV';
57
58 /** The database table holding the global options */
59 var $table_global_options = "diogenes_option";
60
61 /** The database table holding the plugins */
62 var $table_plugins = "diogenes_plugin";
63
64 /** The tables for authentication */
65 var $tauth = array('native'=>"diogenes_auth");
66 /** Labels for the authentication tables */
67 var $tlabel = array('native'=>"Diogenes");
68
69 /** Should we display W3C validator links from user-created pages ? */
70 var $validatepages = 0;
71
72 /** Should we debug database calls ? */
73 var $debugdatabase = 0;
74
75 /** Should we show plugin debugging information ? */
76 var $debugplugins = 0;
77
78 /** What file should we write the WebDAV log to? (empty = none) */
79 var $debugwebdav = '';
80
81 /** Should we capture all WebDAV output to a log? */
82 var $debugwebdav_capture = 0;
83
84 /** Invalid locations for barrel pages */
85 var $invalidlocations = array("admin", "webdav");
86
87 /** Invalid barrel names */
88 var $invalidaliases = array("CVSROOT", "templates_c", "tree_c", "diogenes");
89
90 /** Available HTML editors */
91 var $html_editors = array(
92 'kafenio' => "Kafenio",
93 'ekit' => "Ekit"
94 );
95
96 /** Availables languages */
97 var $locales = array(
98 'en_US'=> "English",
99 'es_ES'=> "Español",
100 'fr_FR'=> "Français",
101 'nl_NL'=> "Nederlands",
102 'sv_SE'=> "Svenska"
103 );
104
105 /** Available menu styles */
106 var $menu_styles = array(
107 0=> "classic",
108 1=> "dynamic tree",
109 2=> "dynamic tree, save state"
110 );
111
112 /** Available menu themes */
113 var $menu_themes = array(
114 'gnome' => 'gnome',
115 'gorilla' => 'gorilla',
116 'lush' => 'lush',
117 'mozilla' => 'mozilla'
118 );
aa2b3c61
JL
119
120 /** Available style sheets */
121 var $style_sheets = array(
122 'default_blue' => 'Default Blue',
c2df69e9 123 'fresh_blue' => 'Fresh Blue',
aa2b3c61
JL
124 'funky_doc' => 'Funky Doc',
125 );
126
127 /** Default stylesheet for new barrels */
128 var $barrel_style_sheet = 'default_blue';
6855525e
JL
129
130 /** The HTML editor to use (ekit, kafenio) */
131 var $html_editor = "kafenio";
132
133 /** Toplevel menu style */
134 var $menu_style = 0;
135
136 /** Toplevel menu theme */
137 var $menu_theme = "gorilla";
138
139 /** Template directory */
140 var $template_dir = "";
141
142 /** Default template for barrel pages */
143 var $template = "";
144
145 /** Utility to use for Word file import.
146 * set 'wvHtml' to make us of wv for Word import
147 * otherwise leave empty to disable word import.
148 */
149 //var $word_import = 'wvHtml';
150 var $word_import = '';
151
152 /** Available Word import utilities */
153 var $word_imports = array(
154 '' => "disabled",
155 'wvHtml' => "wvHtml"
156 );
157
158
159 /** Check that RootURL is a full URL */
160 function checkRootUrl()
161 {
162 return preg_match('/^http(s)?:\/\/.*/i', $this->rooturl);
163 }
164
165
166 /** Read extra options from database.
167 */
168 function readOptions()
169 {
170 $res = $this->db->query("select name,value from {$this->table_global_options} where barrel=''");
171
172 // we only accept options which already exist in this
173 // class
174 while (list($key,$value) = mysql_fetch_row($res)) {
175 if (isset($this->$key))
176 $this->$key = $value;
177 }
178 }
179
180
181 /** Store a preference to database.
182 */
183 function updateOption($name,$value)
184 {
185 $this->$name = stripslashes($value);
186 $this->db->query("replace into {$this->table_global_options} set barrel='',name='$name',value='$value'");
187 }
188
189}
190
191?>