[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/include/admin/ -> settings.php (source)

   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  
 115              case "private_key":
 116  
 117                  $private_key = trim($value);
 118                  if (strlen($private_key) < 30) {
 119                      $error = "Use at least 30 characters for the secret private key.";
 120                  }
 121                  $_POST[$field] = $private_key;
 122                  break;
 123  
 124              case "cache_users":
 125              case "cache_rss":
 126                  if ( empty( $value ) ) {
 127                      $_POST[$field] = 0;
 128                  }
 129  
 130          }
 131  
 132          if ( $error ) break;
 133      }
 134  
 135      if ( empty( $error ) ) {
 136          unset( $_POST["module"] );
 137  
 138          if ( phorum_db_update_settings( $_POST ) ) {
 139              phorum_redirect_by_url($PHORUM["admin_http_path"]);
 140              exit();
 141          } else {
 142              $error = "Database error while updating settings.";
 143          }
 144      }
 145  }
 146  
 147  if ( $error ) {
 148      phorum_admin_error( $error );
 149  }
 150  // create the time zone drop down array
 151  for( $x = -23;$x <= 23;$x++ ) {
 152      $tz_range[$x] = $x;
 153  }
 154  
 155  include_once  "./include/admin/PhorumInputForm.php";
 156  
 157  $frm = &new PhorumInputForm ( "", "post" );
 158  
 159  $frm->addbreak( "Phorum General Settings" );
 160  
 161  $frm->hidden( "module", "settings" );
 162  
 163  $row=$frm->addrow( "Phorum Title", $frm->text_box( "title", $PHORUM["title"], 50 ) );
 164  
 165  $row=$frm->addrow( "DNS Lookups", $frm->select_tag( "dns_lookup", array( "No", "Yes" ), $PHORUM["dns_lookup"] ) );
 166  
 167  $row=$frm->addrow( "Use Cookies", $frm->select_tag( "use_cookies", array( "No", "Yes" ), $PHORUM["SETTINGS"]["use_cookies"] ) );
 168  
 169  $row=$frm->addrow( "Hide Forums", $frm->select_tag( "hide_forums", array( "No", "Yes" ), $PHORUM["hide_forums"] ) );
 170  $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." );
 171  
 172  $row=$frm->addrow( "Show New Count in Forum List", $frm->select_tag( "show_new_on_index", array( "No", "Yes" ), $PHORUM["show_new_on_index"] ) );
 173  $frm->addhelp($row, "Show New Count in Forum List", "This feature will show registered users how many new messages and threads there are in each forum on the forum list page.  If you have a large number of posts, a large number of forums, a large number of users or some combination of the three, this setting could cause some performance issues." );
 174  
 175  $row=$frm->addrow( "Folder/Forum display style", $frm->select_tag( "use_new_folder_style", array( "Classic", "New" ), $PHORUM["use_new_folder_style"] ) );
 176  $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." );
 177  
 178  $row=$frm->addrow( "Enable Moderator Notifications", $frm->select_tag( "enable_moderator_notifications", array( "No", "Yes" ), $PHORUM["enable_moderator_notifications"] ) );
 179  $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." );
 180  
 181  $row=$frm->addrow( "User Post Edit Time Limit (minutes)", $frm->text_box( "user_edit_timelimit", $PHORUM["user_edit_timelimit"], 10) );
 182  $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." );
 183  
 184  $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"] ) );
 185  
 186  $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"] ) );
 187  
 188  $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"] ) );
 189  
 190  $row=$frm->addrow( "Secret private key for signing data", $frm->text_box("private_key", $PHORUM["private_key"], 50) );
 191  $frm->addhelp($row, "Secret key for signing data", "On several occasions, data is transferred from the Phorum system to the user's system and back again. To be sure that there was no tampering with this data on the way, it is signed by Phorum using this secret key. If you do not understand what this is for, then it is safe to simply keep the pre-configured value.<br/><br/><b>Warning:</b> if you change this key, users who are active right now might experience problems.");
 192  
 193  $frm->addbreak( "HTML Settings" );
 194  
 195  $row=$frm->addrow( "Phorum HTML Title", $frm->text_box( "html_title", $PHORUM["html_title"], 50 ) );
 196  
 197  $row=$frm->addrow( "Phorum Head Tags", $frm->textarea( "head_tags", $PHORUM["head_tags"], 30, 5, "style='width: 100%'" ) );
 198  
 199  $row=$frm->addrow( "Show and allow RSS-links", $frm->select_tag( "use_rss", array( "No", "Yes" ), $PHORUM["use_rss"] ) );
 200  
 201  $frm->addbreak( "File/Path Settings" );
 202  
 203  $row=$frm->addrow( "HTTP Path", $frm->text_box( "http_path", $PHORUM["http_path"], 30 ) );
 204  $frm->addhelp($row, "HTTP Path", "This is the base url of your Phorum." );
 205  
 206  $row=$frm->addrow( "Disabled URL", $frm->text_box( "disabled_url", $PHORUM["disabled_url"], 50 ) );
 207  $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." );
 208  
 209  $row=$frm->addrow( "Cache Directory", $frm->text_box( "cache", $PHORUM["cache"], 30 ) );
 210  $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." );
 211  
 212  $frm->addbreak("Cache Settings");
 213  $row=$frm->addrow( "Enable Caching Userdata:", $frm->select_tag( "cache_users", array( "No", "Yes" ), $PHORUM["cache_users"] ) );
 214  $row=$frm->addrow( "Enable Caching RSS-Feeds:", $frm->select_tag( "cache_rss", array( "No", "Yes" ), $PHORUM["cache_rss"] ) );
 215  //$row=$frm->addrow( "Enable Caching Newflags:", $frm->select_tag( "cache_newflags", array( "No", "Yes" ), $PHORUM["cache_newflags"] ) );
 216  
 217  $frm->addbreak( "Date Options" );
 218  
 219  $row=$frm->addrow( "Time Zone Offset", $frm->select_tag( "tz_offset", $tz_range, $PHORUM["tz_offset"] ) );
 220  $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." );
 221  
 222  $frm->addbreak( "Cookie/Session Settings" );
 223  
 224  $row=$frm->addrow( "Main Session Timeout (days)", $frm->text_box( "session_timeout", $PHORUM["session_timeout"], 10 ) );
 225  $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." );
 226  
 227  $row=$frm->addrow( "Session Path (start with /)", $frm->text_box( "session_path", $PHORUM["session_path"], 30 ) );
 228  $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." );
 229  
 230  $row=$frm->addrow( "Session Domain", $frm->text_box( "session_domain", $PHORUM["session_domain"], 30 ) );
 231  $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." );
 232  
 233  $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"] ) );
 234  $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." );
 235  
 236  $frm->addbreak( "Tighter Security" );
 237  
 238  $row=$frm->addrow( "Enable Tighter Security", $frm->select_tag( "tight_security", array( "No", "Yes" ), $PHORUM["tight_security"] ) );
 239  $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." );
 240  
 241  $row=$frm->addrow( "Short Session Timeout (minutes)", $frm->text_box( "short_session_timeout", $PHORUM["short_session_timeout"], 10 ) );
 242  $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" );
 243  
 244  $frm->addbreak( "User Settings" );
 245  
 246  $row=$frm->addrow( "Allow Time Zone Selection", $frm->select_tag( "user_time_zone", array( "No", "Yes" ), $PHORUM["user_time_zone"] ) );
 247  
 248  $row=$frm->addrow( "Allow Template Selection", $frm->select_tag( "user_template", array( "No", "Yes" ), $PHORUM["user_template"] ) );
 249  
 250  $reg_con_arr = array(
 251  
 252      PHORUM_REGISTER_INSTANT_ACCESS => "None needed",
 253  
 254      PHORUM_REGISTER_VERIFY_EMAIL => "Verify via email",
 255  
 256      PHORUM_REGISTER_VERIFY_MODERATOR => "Verified by a moderator",
 257  
 258      PHORUM_REGISTER_VERIFY_BOTH => "Verified by a moderator and via email"
 259  
 260      );
 261  
 262  $row=$frm->addrow( "Registration Verification", $frm->select_tag( "registration_control", $reg_con_arr, $PHORUM["registration_control"] ) );
 263  
 264  $upload_arr = array(
 265  
 266      PHORUM_UPLOADS_SELECT => "Off",
 267  
 268      PHORUM_UPLOADS_REG => "On",
 269  
 270      );
 271  
 272  $row=$frm->addrow( "File Uploads:", $frm->select_tag( "file_uploads", $upload_arr, $PHORUM["file_uploads"] ) );
 273  
 274  $row=$frm->addrow( "&nbsp;&nbsp;&nbsp;File Types (eg. gif;jpg)", $frm->text_box( "file_types", $PHORUM["file_types"], 30 ) );
 275  
 276  $row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Max File Size (KB)", $frm->text_box( "max_file_size", $PHORUM["max_file_size"], 30 ) );
 277  
 278  $row=$frm->addrow( "&nbsp;&nbsp;&nbsp;File Space Quota (KB)", $frm->text_box( "file_space_quota", $PHORUM["file_space_quota"], 30 ) );
 279  
 280  $row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Allow Off Site Links", $frm->select_tag( "file_offsite", array( "No", "Yes" ), $PHORUM["file_offsite"] ) );
 281  $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." );
 282  
 283  $row=$frm->addrow( "Private Messaging:", $frm->select_tag( "enable_pm", array( "Off", "On" ), $PHORUM["enable_pm"] ) );
 284  
 285  $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"] ) );
 286  $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." );
 287  
 288  $row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Enable Drop-down User List", $frm->select_tag( "enable_dropdown_userlist", array( "No", "Yes" ), $PHORUM["enable_dropdown_userlist"] ) );
 289  $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." );
 290  
 291  $row=$frm->addrow( "&nbsp;&nbsp;&nbsp;Max number of stored messages", $frm->text_box( "max_pm_messagecount", $PHORUM["max_pm_messagecount"], 30 ) );
 292  $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.");
 293  
 294  $frm->addbreak( "General Defaults" );
 295  
 296  $row=$frm->addrow( "Default Template", $frm->select_tag( "default_template", phorum_get_template_info(), $PHORUM["default_template"] ) );
 297  
 298  $row=$frm->addrow( "Default Language", $frm->select_tag( "default_language", phorum_get_language_info(), $PHORUM["default_language"] ) );
 299  
 300  $frm->addbreak( "System Email Settings" );
 301  
 302  $row=$frm->addrow( "System Emails From Name", $frm->text_box( "system_email_from_name", $PHORUM["system_email_from_name"], 30 ) );
 303  
 304  $row=$frm->addrow( "System Emails From Address", $frm->text_box( "system_email_from_address", $PHORUM["system_email_from_address"], 30 ) );
 305  
 306  $row=$frm->addrow( "Use BCC in sending mails:", $frm->select_tag( "use_bcc", array( "No", "Yes" ), $PHORUM["use_bcc"] ) );
 307  
 308  $row=$frm->addrow( "Ignore Admin for moderator-emails:", $frm->select_tag( "email_ignore_admin", array( "No", "Yes" ), $PHORUM["email_ignore_admin"] ) );
 309  $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" );
 310  
 311  // calling mods
 312  $frm=phorum_hook("admin_general", $frm);
 313  
 314  $frm->show();
 315  
 316  ?>
 317  


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics