90ed1fb709bd9ddc1f0ba5328693d8ff9adc6180
[diogenes.git] / include / diogenes.globals.inc.php.in
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
22 require_once 'diogenes/diogenes.core.globals.inc.php';
23
24 /** This class describes Diogenes' global settings.
25 */
26 class 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 );
119
120 /** The HTML editor to use (ekit, kafenio) */
121 var $html_editor = "kafenio";
122
123 /** Toplevel menu style */
124 var $menu_style = 0;
125
126 /** Toplevel menu theme */
127 var $menu_theme = "gorilla";
128
129 /** Template directory */
130 var $template_dir = "";
131
132 /** Default template for barrel pages */
133 var $template = "";
134
135 /** Utility to use for Word file import.
136 * set 'wvHtml' to make us of wv for Word import
137 * otherwise leave empty to disable word import.
138 */
139 //var $word_import = 'wvHtml';
140 var $word_import = '';
141
142 /** Available Word import utilities */
143 var $word_imports = array(
144 '' => "disabled",
145 'wvHtml' => "wvHtml"
146 );
147
148
149 /** Check that RootURL is a full URL */
150 function checkRootUrl()
151 {
152 return preg_match('/^http(s)?:\/\/.*/i', $this->rooturl);
153 }
154
155
156 /** Read extra options from database.
157 */
158 function readOptions()
159 {
160 $res = $this->db->query("select name,value from {$this->table_global_options} where barrel=''");
161
162 // we only accept options which already exist in this
163 // class
164 while (list($key,$value) = mysql_fetch_row($res)) {
165 if (isset($this->$key))
166 $this->$key = $value;
167 }
168 }
169
170
171 /** Store a preference to database.
172 */
173 function updateOption($name,$value)
174 {
175 $this->$name = stripslashes($value);
176 $this->db->query("replace into {$this->table_global_options} set barrel='',name='$name',value='$value'");
177 }
178
179 }
180
181 ?>