Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
//                                                                            //
5
//   Copyright (C) 2006  Phorum Development Team                              //
6
//   http://www.phorum.org                                                    //
7
//                                                                            //
8
//   This program is free software. You can redistribute it and/or modify     //
9
//   it under the terms of either the current Phorum License (viewable at     //
10
//   phorum.org) or the Phorum License that was distributed with this file    //
11
//                                                                            //
12
//   This program is distributed in the hope that it will be useful,          //
13
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
14
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
15
//                                                                            //
16
//   You should have received a copy of the Phorum License                    //
17
//   along with this program.                                                 //
18
////////////////////////////////////////////////////////////////////////////////
19
 
20
if ( !defined( "PHORUM_ADMIN" ) ) return;
21
 
22
$error = "";
23
 
24
if ( count( $_POST ) ) {
25
    // set the defaults
26
    foreach( $_POST as $field => $value ) {
27
        switch ( $field ) {
28
            case "title":
29
 
30
                if ( empty( $value ) ) {
31
                    $_POST[$field] = "Phorum 5";
32
                }
33
 
34
                break;
35
 
36
            case "http_path":
37
 
38
                if ( empty( $value ) ) {
39
                    $_POST[$field] = dirname( $_SERVER["HTTP_REFERER"] );
40
                } elseif ( !preg_match( "/^(http|https):\/\/(([a-z0-9][a-z0-9_-]*)(\.[a-z0-9][a-z0-9_-]*)+)(:(\d+))?/i", $value ) && !preg_match( "/^(http|https):\/\/[a-z0-9][a-z0-9_-]*(:\d+)?\//i", $value ) ) {
41
                    $error = "The provided HTTP Path is not a valid URL.";
42
                }
43
 
44
                break;
45
 
46
            case "cache":
47
 
48
                if ( empty( $value ) ) {
49
                    $_POST[$field] = "/tmp";
50
                } elseif ( !file_exists( $value ) ) {
51
                    $error = "This cache directory does not exist.  Please create it with the proper permissions.";
52
                }
53
 
54
                break;
55
 
56
            case "session_timeout":
57
 
58
                $_POST[$field] = (int)$_POST[$field];
59
 
60
                break;
61
 
62
            case "short_session_timeout":
63
 
64
                $_POST[$field] = (int)$_POST[$field];
65
 
66
                // impose a 5 minute minimum on this field for sanity reasons
67
                if($_POST[$field]<5) $_POST[$field];
68
 
69
                break;
70
 
71
            case "session_path":
72
 
73
                if ( empty( $value ) ) {
74
                    $_POST[$field] = "/";
75
                } elseif ( $value[0] != "/" ) {
76
                    $error = "Session Path must start with a /";
77
                }
78
 
79
                break;
80
 
81
            case "session_domain":
82
 
83
                if ( !empty( $value ) && !stristr( $_POST["http_path"], $value ) ) {
84
                    $error = "Session Domain must be part of the domain in HTTP Path or empty.";
85
                }
86
 
87
                break;
88
 
89
            case "system_email_from_address":
90
 
91
                if ( empty( $value ) ) {
92
                    $error = "You must supply an email address for system emails to use as a from address.";
93
                }
94
 
95
                break;
96
 
97
            case "max_file_size":
98
 
99
                settype( $_POST[$field], "int" );
100
 
101
                break;
102
 
103
            case "file_space_quota":
104
 
105
                settype( $_POST[$field], "int" );
106
 
107
                break;
108
 
109
            case "file_types":
110
 
111
                $_POST[$field] = strtolower( $value );
112
 
113
                break;
114
            case "cache_users":
115
                if ( empty( $value ) ) {
116
                    $_POST[$field] = 0;
117
                }
118
 
119
        }
120
 
121
        if ( $error ) break;
122
    }
123
 
124
    if ( empty( $error ) ) {
125
        unset( $_POST["module"] );
126
 
127
        if ( phorum_db_update_settings( $_POST ) ) {
128
            phorum_redirect_by_url($_SERVER['PHP_SELF']);
129
            exit();
130
        } else {
131
            $error = "Database error while updating settings.";
132
        }
133
    }
134
}
135
 
136
if ( $error ) {
137
    phorum_admin_error( $error );
138
}
139
// create the time zone drop down array
140
for( $x = -23;$x <= 23;$x++ ) {
141
    $tz_range[$x] = $x;
142
}
143
 
144
include_once "./include/admin/PhorumInputForm.php";
145
 
146
$frm = &new PhorumInputForm ( "", "post" );
147
 
148
$frm->addbreak( "Phorum General Settings" );
149
 
150
$frm->hidden( "module", "settings" );
151
 
152
$row=$frm->addrow( "Phorum Title", $frm->text_box( "title", $PHORUM["title"], 50 ) );
153
 
154
$row=$frm->addrow( "DNS Lookups", $frm->select_tag( "dns_lookup", array( "No", "Yes" ), $PHORUM["dns_lookup"] ) );
155
 
156
$row=$frm->addrow( "Use Cookies", $frm->select_tag( "use_cookies", array( "No", "Yes" ), $PHORUM["SETTINGS"]["use_cookies"] ) );
157
 
158
$row=$frm->addrow( "Hide Forums", $frm->select_tag( "hide_forums", array( "No", "Yes" ), $PHORUM["hide_forums"] ) );
159
$frm->addhelp($row, "Hide Forums", "By setting this to Yes, forums that users are not allowed to read will be hidden from them in the forums list." );
160
 
161
$row=$frm->addrow( "Show New Count in Forum List", $frm->select_tag( "show_new_on_index", array( "No", "Yes" ), $PHORUM["show_new_on_index"] ) );
162
 
163
$row=$frm->addrow( "Folder/Forum display style", $frm->select_tag( "use_new_folder_style", array( "Classic", "New" ), $PHORUM["use_new_folder_style"] ) );
164
$frm->addhelp($row, "Folder/Forum display style", "Since version 3, Phorum has included folders.  Until version 5.1, forums inside folders did not show until you clicked on the folder.  In 5.1, the list of forums in a folder can now be shown under that folder in the forum list.  This allows admins to organize a large list of forums all on one page." );
165
 
166
$row=$frm->addrow( "Enable Moderator Notifications", $frm->select_tag( "enable_moderator_notifications", array( "No", "Yes" ), $PHORUM["enable_moderator_notifications"] ) );
167
$frm->addhelp($row, "Enable Moderator Notifications", "By setting this to Yes, Phorum will display notice to the various kinds of moderators when they have a new item that requires their attention. For example, message moderators will see a notice whenever there is an unapproved message." );
168
 
169
$row=$frm->addrow( "User Post Edit Time Limit (minutes)", $frm->text_box( "user_edit_timelimit", $PHORUM["user_edit_timelimit"], 10) );
170
$frm->addhelp($row, "User Post Edit Time Limit (minutes)", "If set to a value larger then 0, this acts as a time limit for post editing. Users will only be able to edit their own posts within this time limit. This only applies if a user has the necessary permissions to edit their post, and does not affect moderators." );
171
 
172
$row=$frm->addrow( "Reply form appears", $frm->select_tag( "reply_on_read_page", array( "1"=>"On the read page", "0"=>"On a separate page" ), $PHORUM["reply_on_read_page"] ) );
173
 
174
$row=$frm->addrow( "After posting goto", $frm->select_tag( "redirect_after_post", array( "list"=>"Message List Page", "read"=>"Message Read Page" ), $PHORUM["redirect_after_post"] ) );
175
 
176
$row=$frm->addrow( "Database error handling", $frm->select_tag( "error_logging", array( "screen"=>"Errors will be shown on the screen", "file"=>"Errors will go to a logfile (".$PHORUM['cache']."/phorum-sql-errors.log)", "mail"=> "Errors will be emailed to the system email address"), $PHORUM["error_logging"] ) );
177
 
178
$frm->addbreak( "HTML Settings" );
179
 
180
$row=$frm->addrow( "Phorum HTML Title", $frm->text_box( "html_title", $PHORUM["html_title"], 50 ) );
181
 
182
$row=$frm->addrow( "Phorum Head Tags", $frm->textarea( "head_tags", $PHORUM["head_tags"], 30, 5, "style='width: 100%'" ) );
183
 
184
$row=$frm->addrow( "Show and allow RSS-links", $frm->select_tag( "use_rss", array( "No", "Yes" ), $PHORUM["use_rss"] ) );
185
 
186
$frm->addbreak( "File/Path Settings" );
187
 
188
$row=$frm->addrow( "HTTP Path", $frm->text_box( "http_path", $PHORUM["http_path"], 30 ) );
189
$frm->addhelp($row, "HTTP Path", "This is the base url of your Phorum." );
190
 
191
$row=$frm->addrow( "Disabled URL", $frm->text_box( "disabled_url", $PHORUM["disabled_url"], 50 ) );
192
$frm->addhelp($row, "Disabled URL", "This url will be redirected to when the Phorum status is disabled.  If no URL is given, a message in English will be displayed." );
193
 
194
$row=$frm->addrow( "Cache Directory", $frm->text_box( "cache", $PHORUM["cache"], 30 ) );
195
$frm->addhelp($row, "Cache Directory", "Phorum caches its templates for faster use later.  This setting is the directory where Phorum stores that cache.  Most users will be fine using their servers temp directory.  If your server uses PHP Safe Mode, you will need to create a directory under your Phorum directory and make it writable by the web server." );
196
 
197
$frm->addbreak("Cache Settings");
198
$row=$frm->addrow( "Enable Caching Userdata:", $frm->select_tag( "cache_users", array( "No", "Yes" ), $PHORUM["cache_users"] ) );
199
//$row=$frm->addrow( "Enable Caching Newflags:", $frm->select_tag( "cache_newflags", array( "No", "Yes" ), $PHORUM["cache_newflags"] ) );
200
 
201
$frm->addbreak( "Date Options" );
202
 
203
$row=$frm->addrow( "Time Zone Offset", $frm->select_tag( "tz_offset", $tz_range, $PHORUM["tz_offset"] ) );
204
$frm->addhelp($row, "Time Zone Offset", "If you and/or your users are in a different time zone than the server, you can have the default displayed time adjusted by using this option." );
205
 
206
$frm->addbreak( "Cookie/Session Settings" );
207
 
208
$row=$frm->addrow( "Main Session Timeout (days)", $frm->text_box( "session_timeout", $PHORUM["session_timeout"], 10 ) );
209
$frm->addhelp($row, "Session Timeout", "When users log in to your Phorum, they are issued a cookie.  You can set this timeout to the number of days that you want the cookie to stay on the users computer.  If you set it to 0, the cookie will only last as long as the user has the browser open." );
210
 
211
$row=$frm->addrow( "Session Path (start with /)", $frm->text_box( "session_path", $PHORUM["session_path"], 30 ) );
212
$frm->addhelp($row, "Session Path", "When cookies are sent to client's browser, part of the cookie determines the path (url) for which the cookies are valid.  For example, if the url is http://example.com/phorum, you could set the path to /phorum.  Then, the users browser would only send the cookie information when the user accessed the Phorum.  You could also use simply / and the cookie info will be sent for any page on your site.  This could be useful if you want to use Phorum's login system for other parts of your site." );
213
 
214
$row=$frm->addrow( "Session Domain", $frm->text_box( "session_domain", $PHORUM["session_domain"], 30 ) );
215
$frm->addhelp($row, "Session Domain", "Most likely, you can leave this blank.  If you know you need to use a different domain (like you use forums.example.com, you may want to just use example.com as the domain), you may enter it here." );
216
 
217
$row=$frm->addrow( "Track User Usage", $frm->select_tag( "track_user_activity", array( 0=>"Never", 86400=>"Once per day", 3600=>"Once per hour", 600=>"Once per 5 minutes", 1=>"Constantly" ), $PHORUM["track_user_activity"] ) );
218
$frm->addhelp($row, "Track User Usage", "When set the last time a user accessed the Phorum will be recorded as often as you have decided upon.  This will require constant updates to your database.  If you have a busy forum on weak equipment, this may be bad thing to set to low." );
219
 
220
$frm->addbreak( "Tighter Security" );
221
 
222
$row=$frm->addrow( "Enable Tighter Security", $frm->select_tag( "tight_security", array( "No", "Yes" ), $PHORUM["tight_security"] ) );
223
$frm->addhelp($row, "Enable Tighter Security", "Tight security in Phorum will require that users confirm their login information from time to time before posting messages, accessing private messages or using their Control Center.  The length of time is determined by Short Session Timeout." );
224
 
225
$row=$frm->addrow( "Short Session Timeout (minutes)", $frm->text_box( "short_session_timeout", $PHORUM["short_session_timeout"], 10 ) );
226
$frm->addhelp($row, "Short Session Timeout", "When tight security is enabled, the users will be issued a second cookie when the type in their login information.  If the user does not use the site for the period of time you set here, they will have to re-enter their login information before posting messages, accessing private messages or using their Control Center.  They will still be allowed to read the Phorum as long as their Main Session is still good.  The time is minutes.  The minimum is 5 minutes.  Otherwise, your users will be very angry at you.<br /><br />P.S. 1 day = 1440 minutes" );
227
 
228
$frm->addbreak( "User Settings" );
229
 
230
$row=$frm->addrow( "Allow Time Zone Selection", $frm->select_tag( "user_time_zone", array( "No", "Yes" ), $PHORUM["user_time_zone"] ) );
231
 
232
$row=$frm->addrow( "Allow Template Selection", $frm->select_tag( "user_template", array( "No", "Yes" ), $PHORUM["user_template"] ) );
233
 
234
$reg_con_arr = array(
235
 
236
    PHORUM_REGISTER_INSTANT_ACCESS => "None needed",
237
 
238
    PHORUM_REGISTER_VERIFY_EMAIL => "Verify via email",
239
 
240
    PHORUM_REGISTER_VERIFY_MODERATOR => "Verified by a moderator",
241
 
242
    PHORUM_REGISTER_VERIFY_BOTH => "Verified by a moderator and via email"
243
 
244
    );
245
 
246
$row=$frm->addrow( "Registration Verification", $frm->select_tag( "registration_control", $reg_con_arr, $PHORUM["registration_control"] ) );
247
 
248
$upload_arr = array(
249
 
250
    PHORUM_UPLOADS_SELECT => "Off",
251
 
252
    PHORUM_UPLOADS_REG => "On",
253
 
254
    );
255
 
256
$row=$frm->addrow( "File Uploads:", $frm->select_tag( "file_uploads", $upload_arr, $PHORUM["file_uploads"] ) );
257
 
258
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;File Types (eg. gif;jpg)", $frm->text_box( "file_types", $PHORUM["file_types"], 30 ) );
259
 
260
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Max File Size (KB)", $frm->text_box( "max_file_size", $PHORUM["max_file_size"], 30 ) );
261
 
262
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;File Space Quota (KB)", $frm->text_box( "file_space_quota", $PHORUM["file_space_quota"], 30 ) );
263
 
264
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Allow Off Site Links", $frm->select_tag( "file_offsite", array( "No", "Yes" ), $PHORUM["file_offsite"] ) );
265
$frm->addhelp($row, "&nbsp;&nbsp;&nbsp;Allow Off Site Links", "You may not want to allow other web sites to link to files that users upload to your forums.  If not, set this to No.  If you want to use links on other parts of your web site or only specific web sites, you will need to use your web server's security features to accomplish this.  For Apache users, you can reference <i>Prevent \"Image Theft\"</i> at http://httpd.apache.org/docs/env.html#examples." );
266
 
267
$row=$frm->addrow( "Private Messaging:", $frm->select_tag( "enable_pm", array( "Off", "On" ), $PHORUM["enable_pm"] ) );
268
 
269
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Count New Private Messages", $frm->select_tag( "enable_new_pm_count", array( "No", "Yes" ), $PHORUM["enable_new_pm_count"] ) );
270
$frm->addhelp($row, "Count New Private Messages", "By setting this to Yes, Phorum will check if a user has new private messages, and display an indicator. On a Phorum with a lot of users and private messages, this may hurt performance. This option has no effect if Private Messaging is disabled." );
271
 
272
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Enable Drop-down User List", $frm->select_tag( "enable_dropdown_userlist", array( "No", "Yes" ), $PHORUM["enable_dropdown_userlist"] ) );
273
$frm->addhelp($row, "Enable Drop-down User List", "By setting this to Yes, Phorum will display a drop-down list of users instead of an empty text box on pages where you can select a user. Two examples of such pages are when sending a private message, and when adding users to a group in the group moderation page. This option should be disabled if you have a large number of users, as a list of thousands of users will slow performance dramatically." );
274
 
275
$row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Max number of stored messages", $frm->text_box( "max_pm_messagecount", $PHORUM["max_pm_messagecount"], 30 ) );
276
$frm->addhelp($row, "Max number of stored messages", "This is the maximum number of private messages that a user may store on the server. The number of private messages is the total of all messages in all PM folders together. Setting this value to zero will allow for unlimited messages.");
277
 
278
$frm->addbreak( "General Defaults" );
279
 
280
$row=$frm->addrow( "Default Template", $frm->select_tag( "default_template", phorum_get_template_info(), $PHORUM["default_template"] ) );
281
 
282
$row=$frm->addrow( "Default Language", $frm->select_tag( "default_language", phorum_get_language_info(), $PHORUM["default_language"] ) );
283
 
284
$frm->addbreak( "System Email Settings" );
285
 
286
$row=$frm->addrow( "System Emails From Name", $frm->text_box( "system_email_from_name", $PHORUM["system_email_from_name"], 30 ) );
287
 
288
$row=$frm->addrow( "System Emails From Address", $frm->text_box( "system_email_from_address", $PHORUM["system_email_from_address"], 30 ) );
289
 
290
$row=$frm->addrow( "Use BCC in sending mails:", $frm->select_tag( "use_bcc", array( "No", "Yes" ), $PHORUM["use_bcc"] ) );
291
 
292
$row=$frm->addrow( "Ignore Admin for moderator-emails:", $frm->select_tag( "email_ignore_admin", array( "No", "Yes" ), $PHORUM["email_ignore_admin"] ) );
293
$frm->addhelp($row, "&nbsp;&nbsp;&nbsp;Ignore Admin for moderator-emails", "If you select yes for this option, then the moderator-notifications and report-message emails will not be sent to the admininistrator, only to moderators" );
294
 
295
// calling mods
296
$frm=phorum_hook("admin_general", $frm);
297
 
298
$frm->show();
299
 
300
?>
301