b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _generalsettings.class.php

Documentation is available at _generalsettings.class.php

  1. <?php
  2. /**
  3.  * This file implements the GeneralSettings class, which handles Name/Value pairs.
  4.  *
  5.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  6.  * See also {@link http://sourceforge.net/projects/evocms/}.
  7.  *
  8.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  9.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10.  *
  11.  *  {@internal License choice
  12.  *  - If you have received this file as part of a package, please find the license.txt file in
  13.  *    the same folder or the closest folder above for complete license terms.
  14.  *  - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15.  *    then you must choose one of the following licenses before using the file:
  16.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18.  *  }}}
  19.  *
  20.  *  {@internal Open Source relicensing agreement:
  21.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  22.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  23.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  24.  *  }}}
  25.  *
  26.  * @package evocore
  27.  *
  28.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  29.  * @author fplanque: Francois PLANQUE
  30.  * @author blueyed: Daniel HAHLER
  31.  *
  32.  * @version $Id: _generalsettings.class.php,v 1.28 2010/02/08 17:53:55 efy-yury Exp $
  33.  */
  34. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  35.  
  36. load_class'settings/model/_abstractsettings.class.php''AbstractSettings' );
  37.  
  38. /**
  39.  * Class to handle the global settings.
  40.  *
  41.  * @package evocore
  42.  */
  43. {
  44.     /**
  45.      * The default settings to use, when a setting is not given
  46.      * in the database.
  47.      *
  48.      * @todo Allow overriding from /conf/_config_TEST.php?
  49.      * @access protected
  50.      * @var array 
  51.      */
  52.     var $_defaults = array(
  53.         'admin_skin' => 'chicago',
  54.  
  55.         'antispam_last_update' => '2000-01-01 00:00:00',
  56.         'antispam_threshold_publish' => '-90',
  57.         'antispam_threshold_delete' => '100'// do not delete by default!
  58.         'antispam_block_spam_referers' => '0',    // By default, let spam referers go in silently (just don't log them). This is in case the blacklist is too paranoid (social media, etc.)
  59.         'antispam_report_to_central' => '1',
  60.  
  61.         'evonet_last_update' => '1196000000',        // just around the time we implemented this ;)
  62.         'evonet_last_attempt' => '1196000000',        // just around the time we implemented this ;)
  63.  
  64.         'log_public_hits' => '1',
  65.         'log_admin_hits' => '0',
  66.         'log_spam_hits' => '0',
  67.         'auto_prune_stats_mode' => 'page',  // 'page' is the safest mode for average installs (may be "off", "page" or "cron")
  68.         'auto_prune_stats' => '15',         // days (T_hitlog and T_sessions)
  69.  
  70.         'outbound_notifications_mode' => 'immediate'// 'immediate' is the safest mode for average installs (may be "off", "immediate" or "cron")
  71.  
  72.         'fm_enable_create_dir' => '1',
  73.         'fm_enable_create_file' => '1',
  74.         'fm_enable_roots_blog' => '1',
  75.         'fm_enable_roots_user' => '1',
  76.         'fm_enable_roots_shared' => '1',
  77.         'fm_enable_roots_skins' => '1',
  78.  
  79.         'fm_showtypes' => '0',
  80.         'fm_showfsperms' => '0',
  81.  
  82.         'fm_default_chmod_file' => '664',
  83.         'fm_default_chmod_dir' => '775',
  84.  
  85.         'newusers_canregister' => '0',
  86.         'newusers_mustvalidate' => '1',
  87.         'newusers_revalidate_emailchg' => '0',
  88.         'newusers_level' => '1',
  89.  
  90.         'allow_avatars' => 1,
  91.  
  92.         'regexp_filename' => '^[a-zA-Z0-9\-_. ]+$'// TODO: accept (spaces and) special chars / do full testing on this
  93.         'regexp_dirname' => '^[a-zA-Z0-9\-_]+$'// TODO: accept spaces and special chars / do full testing on this
  94.         'reloadpage_timeout' => '300',
  95.         'time_difference' => '0',
  96.         'timeout_sessions' => '604800',     // seconds (604800 == 7 days)
  97.         'upload_enabled' => '1',
  98.         'upload_maxkb' => '2048',
  99.  
  100.         'user_minpwdlen' => '5',
  101.         'js_passwd_hashing' => '1',                    // Use JS password hashing by default
  102.  
  103.         'webhelp_enabled' => '1',
  104.  
  105.         'allow_moving_chapters' => '0',                // Do not allow moving chapters by default
  106.         'chapter_ordering' => 'alpha',
  107.  
  108.         'general_cache_enabled' => 0,
  109.  
  110.         'eblog_enabled' => 0,                        // blog by email
  111.         'eblog_method' => 'pop3',                    // blog by email
  112.         'eblog_encrypt' => 'none',                    // blog by email
  113.         'eblog_server_port' => 110,                    // blog by email
  114.         'eblog_default_category' => 1,                // blog by email
  115.         'AutoBR' => 0,                                // Used for email blogging. fp> TODO: should be replaced by "email renderers/decoders/cleaners"...
  116.         'eblog_add_imgtag' => 1,                    // blog by email
  117.         'eblog_body_terminator' => '___',            // blog by email
  118.         'eblog_subject_prefix' => 'blog:',            // blog by email
  119.         'general_xmlrpc' => 1,
  120.         'xmlrpc_default_title' => '',        //default title for posts created throgh blogger api
  121.  
  122.         'nickname_editing' => 'edited-user',        // "never" - Never allow; "default-no" - Let users decide, default to "no" for new users; "default-yes" - Let users decide, default to "yes" for new users; "always" - Always allow
  123.         'multiple_sessions' => 'userset_default_no'// multiple sessions settings -- overriden for demo mode in contructor
  124.     );
  125.  
  126.  
  127.     /**
  128.      * Constructor.
  129.      *
  130.      * This loads the general settings and checks db_version.
  131.      *
  132.      * It will also turn off error-reporting/halting of the {@link $DB DB object}
  133.      * temporarily to present a more decent error message if tables do not exist yet.
  134.      *
  135.      * Because the {@link $DB DB object} itself creates a connection when it gets
  136.      * created "Error selecting database" occurs before we can check for it here.
  137.      */
  138.     function GeneralSettings()
  139.     {
  140.         global $new_db_version$DB$demo_mode;
  141.  
  142.         $save_DB_show_errors $DB->show_errors;
  143.         $save_DB_halt_on_error $DB->halt_on_error;
  144.         $DB->halt_on_error false;
  145.         $DB->show_errors false;
  146.  
  147.         // Init through the abstract constructor. This should be the first DB connection.
  148.         parent::AbstractSettings'T_settings'array'set_name' )'set_value');
  149.  
  150.         // check DB version:
  151.         if$this->get'db_version' != $new_db_version )
  152.         // Database is not up to date:
  153.             if$DB->last_error )
  154.             {
  155.                 $error_message '<p>MySQL error:</p>'.$DB->last_error;
  156.             }
  157.             else
  158.             {
  159.                 $error_message '<p>Database schema is not up to date!</p>'
  160.                     .'<p>You have schema version &laquo;'.(integer)$this->get'db_version' ).'&raquo;, '
  161.                     .'but we would need &laquo;'.(integer)$new_db_version.'&raquo;.</p>';
  162.             }
  163.             global $adminskins_path;
  164.             require $adminskins_path.'conf_error.main.php'// error & exit
  165.         }
  166.  
  167.         $DB->halt_on_error $save_DB_halt_on_error;
  168.         $DB->show_errors $save_DB_show_errors;
  169.  
  170.  
  171.         if$demo_mode )
  172.         // Demo mode requires to allow multiple concurrent sessions:
  173.             $this->_defaults['multiple_sessions''always';
  174.         }
  175.     }
  176.  
  177.  
  178.     /**
  179.      * Get a 32-byte string that can be used as salt for public keys.
  180.      *
  181.      * @return string 
  182.      */
  183.     function get_public_key_salt()
  184.     {
  185.         $public_key_salt $this->get'public_key_salt' );
  186.         ifempty($public_key_salt) )
  187.         {
  188.             $public_key_salt generate_random_key(32);
  189.             $this->set'public_key_salt'$public_key_salt );
  190.             $this->dbupdate();
  191.         }
  192.         return $public_key_salt;
  193.     }
  194.  
  195. }
  196.  
  197.  
  198.  
  199. /*
  200.  * $Log: _generalsettings.class.php,v $
  201.  * Revision 1.28  2010/02/08 17:53:55  efy-yury
  202.  * copyright 2009 -> 2010
  203.  *
  204.  * Revision 1.27  2009/12/12 19:14:13  fplanque
  205.  * made avatars optional + fixes on img props
  206.  *
  207.  * Revision 1.26  2009/12/06 22:55:21  fplanque
  208.  * Started breadcrumbs feature in admin.
  209.  * Work in progress. Help welcome ;)
  210.  * Also move file settings to Files tab and made FM always enabled
  211.  *
  212.  * Revision 1.25  2009/11/12 00:46:34  fplanque
  213.  * doc/minor/handle demo mode
  214.  *
  215.  * Revision 1.24  2009/10/28 13:41:56  efy-maxim
  216.  * default multiple sessions settings
  217.  *
  218.  * Revision 1.23  2009/10/26 12:59:36  efy-maxim
  219.  * users management
  220.  *
  221.  * Revision 1.22  2009/10/25 19:24:51  efy-maxim
  222.  * multiple_sessions param
  223.  *
  224.  * Revision 1.21  2009/10/25 19:20:30  efy-maxim
  225.  * users settings
  226.  *
  227.  * Revision 1.20  2009/09/14 13:42:12  efy-arrin
  228.  * Included the ClassName in load_class() call with proper UpperCase
  229.  *
  230.  * Revision 1.19  2009/09/02 13:47:32  waltercruz
  231.  * Setting the default title fot posts created through blogger API
  232.  *
  233.  * Revision 1.18  2009/08/31 15:56:39  waltercruz
  234.  * Adding setting to enable/disable xmlrc
  235.  *
  236.  * Revision 1.17  2009/03/08 23:57:45  fplanque
  237.  * 2009
  238.  *
  239.  * Revision 1.16  2009/02/22 16:55:27  blueyed
  240.  * Add GeneralSettings::get_public_key_salt
  241.  *
  242.  * Revision 1.15  2009/01/28 21:23:23  fplanque
  243.  * Manual ordering of categories
  244.  *
  245.  * Revision 1.14  2008/10/06 18:11:58  tblue246
  246.  * Further blog by email fixes
  247.  *
  248.  * Revision 1.13  2008/10/06 11:02:27  tblue246
  249.  * Blog by mail now supports POP3 & IMAP, SSL & TLS
  250.  *
  251.  * Revision 1.12  2008/10/05 10:55:46  tblue246
  252.  * Blog by mail: We've only one working method => removed the drop-down box and added automatical change to pop3a.
  253.  * The default value for this setting was in the wrong file, moved.
  254.  *
  255.  * Revision 1.11  2008/09/28 08:06:07  fplanque
  256.  * Refactoring / extended page level caching
  257.  *
  258.  * Revision 1.10  2008/09/23 06:18:38  fplanque
  259.  * File manager now supports a shared directory (/media/shared/global/)
  260.  *
  261.  * Revision 1.9  2008/04/04 17:02:22  fplanque
  262.  * cleanup of global settings
  263.  *
  264.  * Revision 1.8  2008/02/19 11:11:19  fplanque
  265.  * no message
  266.  *
  267.  * Revision 1.7  2008/01/21 09:35:34  fplanque
  268.  * (c) 2008
  269.  *
  270.  * Revision 1.6  2007/11/28 17:29:44  fplanque
  271.  * Support for getting updates from b2evolution.net
  272.  *
  273.  * Revision 1.5  2007/11/03 04:57:51  fplanque
  274.  * no message
  275.  *
  276.  * Revision 1.4  2007/11/01 19:50:39  fplanque
  277.  * minor
  278.  *
  279.  * Revision 1.3  2007/09/03 16:44:28  fplanque
  280.  * chicago admin skin
  281.  *
  282.  * Revision 1.2  2007/07/01 18:47:11  fplanque
  283.  * fixes
  284.  *
  285.  * Revision 1.1  2007/06/25 11:01:21  fplanque
  286.  * MODULES (refactored MVC)
  287.  *
  288.  * Revision 1.33  2007/05/26 21:30:54  blueyed
  289.  * Allow spaces in filenames by default
  290.  *
  291.  * Revision 1.32  2007/04/26 00:11:02  fplanque
  292.  * (c) 2007
  293.  *
  294.  * Revision 1.31  2007/04/10 17:55:09  fplanque
  295.  * minor
  296.  *
  297.  * Revision 1.30  2007/03/25 13:20:52  fplanque
  298.  * cleaned up blog base urls
  299.  * needs extensive testing...
  300.  *
  301.  * Revision 1.29  2007/03/24 20:41:16  fplanque
  302.  * Refactored a lot of the link junk.
  303.  * Made options blog specific.
  304.  * Some junk still needs to be cleaned out. Will do asap.
  305.  *
  306.  * Revision 1.28  2006/12/15 22:54:14  fplanque
  307.  * allow disabling of password hashing
  308.  *
  309.  * Revision 1.27  2006/12/11 00:32:26  fplanque
  310.  * allow_moving_chapters stting moved to UI
  311.  * chapters are now called categories in the UI
  312.  *
  313.  * Revision 1.26  2006/12/07 15:23:42  fplanque
  314.  * filemanager enhanced, refactored, extended to skins directory
  315.  *
  316.  * Revision 1.25  2006/12/07 00:55:52  fplanque
  317.  * reorganized some settings
  318.  *
  319.  * Revision 1.24  2006/12/04 19:41:11  fplanque
  320.  * Each blog can now have its own "archive mode" settings
  321.  *
  322.  * Revision 1.23  2006/12/04 18:16:50  fplanque
  323.  * Each blog can now have its own "number of page/days to display" settings
  324.  *
  325.  * Revision 1.22  2006/11/24 18:27:25  blueyed
  326.  * Fixed link to b2evo CVS browsing interface in file docblocks
  327.  *
  328.  * Revision 1.21  2006/11/09 23:11:44  blueyed
  329.  * Made chmod settings editable
  330.  *
  331.  * Revision 1.20  2006/10/06 21:03:06  blueyed
  332.  * Removed deprecated/unused "upload_allowedext" Setting, which restricted file extensions during upload though!
  333.  */
  334. ?>

Documentation generated on Sat, 06 Mar 2010 04:11:32 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).