Changeset 1520

Show
Ignore:
Timestamp:
11/07/2009 10:40:12 AM (10 months ago)
Author:
BrianKoontz
Message:

More work on installer: Reconstructed default paths, removed
site-based config stuff. Refs #912.

Location:
branches/1.2
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/1.2/libs/Config.class.php

    r1515 r1520  
    151151         * specified by this config entry. See {@link Wakka::Action()}. 
    152152         */ 
    153         #var $wikka_action_path = 'actions'; 
    154         var $wikka_action_path = CONFIG_ACTION_PATH;                            // pick up default from wikka.php 
     153        var $wikka_action_path = DEFAULT_ACTION_PATH; 
     154 
    155155        /** 
    156156         * Path to handler files. 
     
    163163         * instance: http://wikkawiki.org/HomePage/acls evokes the acls handler for HomePage. 
    164164         */ 
    165         #var $wikka_handler_path = 'handlers'; 
    166         var $wikka_handler_path = CONFIG_HANDLER_PATH;                          // pick up default from wikka.php 
     165        var $wikka_handler_path = DEFAULT_HANDLER_PATH; 
     166 
    167167        /** 
    168168         * Path to the Wikka formatters. 
     
    170170         * wiki markup into valid XHTML. See {@link Wakka::Format()}. 
    171171         */ 
    172         #var $wikka_formatter_path = 'formatters'; 
    173         var $wikka_formatter_path = CONFIG_FORMATTER_PATH;                      // pick up default from wikka.php 
     172        var $wikka_formatter_path = DEFAULT_FORMATTER_PATH;  
     173 
    174174        /** 
    175175         * Path to the Wikka highlighters. 
     
    184184         */ 
    185185        // @@@ name should use singular 'highlighter' to conform to teh other path "names". 
    186         #var $wikka_highlighters_path = 'formatters'; 
    187         var $wikka_highlighters_path = CONFIG_FORMATTER_PATH;           // pick up default from wikka.php 
     186        var $wikka_highlighters_path = DEFAULT_FORMATTER_PATH;  
    188187 
    189188        /** 
     
    192191         * Template files are used to generate the XHTML output. 
    193192         */ 
    194         var $wikka_template_path = CONFIG_TEMPLATE_PATH;                                // pick up default from wikka.php 
     193        var $wikka_template_path = DEFAULT_TEMPLATE_PATH;  
    195194         
    196195        /** 
    197196         * Directory for 3rd-party components. 
    198197         */ 
    199         var $thirdparty_path = CONFIG_3RDPARTY_PATH;                            // pick up default from wikka.php 
    200         /** 
    201          * Directory for 3rd-party core components; these components are required for 
    202          * basic Wikka functionality. 
    203          */ 
    204         var $thirdparty_code_path = CONFIG_3RDPARTY_CORE_PATH;          // pick up default from wikka.php 
     198        var $thirdparty_path = DEFAULT_3RDPARTY_PATH; 
     199 
     200        /**  
     201         * Directory for 3rd-party core components; these components are 
     202         * required for basic Wikka functionality. 
     203         */ 
     204        var $thirdparty_code_path = DEFAULT_3RDPARTY_CORE_PATH; 
     205 
    205206        /** 
    206207         * Directory for 3rd-party plugin components; these components are optional 
    207208         * and extend Wikka functionality. 
    208209         */ 
    209         var $thirdparty_plugin_path = CONFIG_3RDPARTY_PLUGIN_PATH;      // pick up default from wikka.php 
     210        var $thirdparty_plugin_path = DEFAULT_3RDPARTY_PLUGIN_PATH;  
    210211 
    211212        /** 
    212213         * Directory for the FeedCreator 3rd-party core component. 
    213214         */ 
    214         var $feedcreator_path = CONFIG_FEEDCREATOR_PATH;                        // pick up default from wikka.php 
     215        var $feedcreator_path = DEFAULT_FEEDCREATOR_PATH;  
     216 
    215217        /** 
    216218         * Directory for the SafeHTML 3rd-party core component. 
    217219         */ 
    218         var $safehtml_path = CONFIG_SAFEHTML_PATH;                                      // pick up default from wikka.php 
     220        var $safehtml_path = DEFAULT_SAFEHTML_PATH;  
     221 
    219222        /** 
    220223         * Directory for the optional GeSHi 3rd-party plugin package. 
     
    225228         * {@link Config::$geshi_languages_path geshi_language_path}. 
    226229         */ 
    227         var $geshi_path = CONFIG_GESHI_PATH;                                            // pick up default from wikka.php 
     230        var $geshi_path = DEFAULT_GESHI_PATH;  
     231 
    228232        /** 
    229233         * Directory for the language files for the GeSHi 3rd-party plugin package. 
    230234         */ 
    231         var $geshi_languages_path = CONFIG_GESHI_LANG_PATH;                     // pick up default from wikka.php 
     235        var $geshi_languages_path = DEFAULT_GESHI_LANG_PATH;  
     236  
    232237        /** 
    233238         * Directory for the optional Onyx-RSS 3rd-party plugin component. 
    234239         */ 
    235         var $onyx_path = CONFIG_ONYX_PATH;                                                      // pick up default from wikka.php 
     240        var $onyx_path = DEFAULT_ONYX_PATH;  
    236241 
    237242        /** 
     
    240245         * the required scripts. 
    241246         */ 
    242         var $wikiedit_uripath = CONFIG_WIKIEDIT_URIPATH;                        // pick up default from wikka.php 
     247        var $wikiedit_uripath = DEFAULT_WIKIEDIT_URIPATH;  
     248 
    243249        /** 
    244250         * <b>URL path component</b> for the FreeMind display applet. 
     
    246252         * applet's jar archive. 
    247253         */ 
    248         var $freemind_uripath = CONFIG_FREEMIND_URIPATH;                        // pick up default from wikka.php 
     254        var $freemind_uripath = DEFAULT_FREEMIND_URIPATH; 
    249255 
    250256        /** 
     
    544550         */ 
    545551        var $default_comment_display = 1; 
     552 
    546553        /** 
    547554         * Default language-code used in the wiki. 
     
    549556         * This should be a ISO 639-1 code (e.g. 'en' for English). 
    550557         */ 
    551         #var $default_lang = 'en'; 
    552         var $default_lang = CONFIG_DEFAULT_LANGUAGE;    // pick up default from wikka.php 
     558        var $default_lang = 'en'; 
    553559        /**#@-*/ 
    554560 
  • branches/1.2/setup/install.php

    r1515 r1520  
    2929$_SESSION['sconfig']['navigation_links'] = str_replace('_rootpage', $config['root_page'], $_SESSION['sconfig']['navigation_links']); 
    3030 
    31 $lang_defaults_fallback_path = WIKKA_LANG_PATH.DIRECTORY_SEPARATOR.CONFIG_DEFAULT_LANGUAGE.DIRECTORY_SEPARATOR.'defaults'.DIRECTORY_SEPARATOR; 
     31$lang_defaults_fallback_path = WIKKA_LANG_PATH.DIRECTORY_SEPARATOR.DEFAULT_FALLBACK_LANGUAGE.DIRECTORY_SEPARATOR.'defaults'.DIRECTORY_SEPARATOR; 
    3232test('Checking availability of default pages...', is_dir($lang_defaults_fallback_path), 'default pages not found at '.$lang_defaults_fallback_path, 1); 
    3333$lang_defaults_path = WIKKA_LANG_PATH.DIRECTORY_SEPARATOR.$config['default_lang'].DIRECTORY_SEPARATOR.'defaults'.DIRECTORY_SEPARATOR; 
  • branches/1.2/wikka.php

    r1516 r1520  
    99 * and released under the terms of the modified BSD license 
    1010 * @see /docs/WakkaWiki.LICENSE 
    11  * 
    12  * (...) Explain basic override mechanism @@@ 
    13  * 
    14  * Because we are dealing with overrides here, not all of which need 
    15  * to be defined, we do not assume any dependencies for these 
    16  * overrides: each stands on its own.  (Of course the override file 
    17  * itself may make use of dependencies, but that is up to the 
    18  * administrator setting these up.) 
    19  * All defined and valid override paths are converted to their 
    20  * canonical absolute form. 
    2111 * 
    2212 * @package             Wikka 
     
    4030 * @copyright   Copyright 2006-2009, {@link http://wikkawiki.org/CreditsPage Wikka Development Team} 
    4131 * 
    42  * @uses        validLocalPath()        for validating path override 
    4332 * @uses        getmicrotime()          for determining page generation time 
    4433 * @uses        magicQuotesWorkaround() to overcome magic quotes that may be imposed 
     
    4938 * @todo        use templating class for page generation; 
    5039 */ 
     40 
     41require_once('libs'.DIRECTORY_SEPARATOR.'Compatibility.lib.php'); 
    5142 
    5243// ---------------------- DEBUGGING AND ERROR REPORTING ----------------------- 
     
    10091/** 
    10192 * Path where the Wikka installer is located. 
    102  * This value is <b>not</b> overridable or in any way configurable: each (new) 
    103  * Wikka installation must have its own local 'setup' directory (for now, at least). 
    10493 */ 
    10594if (!defined('WIKKA_SETUP_PATH'))               define('WIKKA_SETUP_PATH', 'setup'); 
     
    148137// ------------------------- END VERSION CHECK (PHP) --------------------------- 
    149138 
    150  
    151 // ---------------------- LOAD PATH AND DEFAULT OVERRIDES ---------------------- 
    152 if ($debug) echo "load path overrides...<br/>\n"; 
    153 // Include configuration override file, if it exists. 
    154 // If it exists at all, it MUST be located in the Wikka installation directory. 
    155 if (file_exists('override.config.php')) 
    156 { 
    157         include 'override.config.php'; 
    158 } 
    159 // ---------------------- END PATH AND DEFAULT OVERRIDES ----------------------- 
    160  
    161139// ---------------------- DEFINE URL DOMAIN / PATH ----------------------------- 
    162140/**#@+* 
     
    176154 * URL fragment consisting of scheme + domain part. 
    177155 * Represents the domain URL where the current instance of Wikka is located. 
    178  * This variable can be overriden in {@link override.config.php} 
    179156 * 
    180157 * @var string 
     
    211188 
    212189// ------------------------ DEFINE & DERIVE CORE PATHS ------------------------- 
     190// Universal path divider; path parser also recognizes Unix-style 
     191// dividers (:) and Windows-style dividers (;) 
     192define('PATH_DIVIDER', ','); 
     193 
     194if ($debug) echo "default filesystem paths...<br/>\n"; 
     195 
     196/** 
     197  * Default filesystem path for the <b>site</b> configuration 
     198  * <b>file</b>. 
     199  */ 
     200if(!defined('DEFAULT_SITE_CONFIGFILE')) define ('DEFAULT_SITE_CONFIGFILE', 'wikka.config.php'); 
     201// For backwards compatibility with existing code...probably needs to 
     202// be removed at some point 
     203if(!defined('SITE_CONFIGFILE')) define ('SITE_CONFIGFILE', DEFAULT_SITE_CONFIGFILE); 
     204 
    213205if ($debug) echo "core component paths...<br/>\n"; 
    214 /**#@+ 
    215  * String constant defining the default path to a specific type of core component. 
    216  */ 
    217 /** 
    218  * Default path to the Wikka code library which contains core components. 
    219  * May be overridden to enable sharing core components between Wikka installations. 
    220  */ 
    221 if (!defined('DEFAULT_LIBRARY_PATH'))   define('DEFAULT_LIBRARY_PATH', 'libs'); 
    222 /** 
    223  * Default path to the Wikka language library where language-specific files are stored. 
    224  * May be overridden to enable sharing core components between Wikka installations. 
    225  */ 
    226 if (!defined('DEFAULT_LANG_PATH'))              define('DEFAULT_LANG_PATH', 'lang'); 
    227 /**#@-*/ 
    228  
    229 /**#@+ 
    230  * String constant defining the effective path to a specific type of core component. 
    231  */ 
     206 
    232207/** 
    233208 * Effective path to the Wikka code library which contains core components. 
    234  * The path takes any optional override into account, and is used directly in 
    235  * Wikka, including in this file. 
    236  */ 
    237 if (!defined('WIKKA_LIBRARY_PATH')) define('WIKKA_LIBRARY_PATH', 
    238         (defined('LOCAL_LIBRARY_PATH') && ($canon_path = validLocalPath(LOCAL_LIBRARY_PATH, 'dir'))) 
    239                 ? $canon_path 
    240                 : DEFAULT_LIBRARY_PATH 
    241         ); 
     209 */ 
     210if (!defined('WIKKA_LIBRARY_PATH')) define('WIKKA_LIBRARY_PATH', 'libs'); 
     211 
    242212/** 
    243213 * Effective path to the Wikka language library which contains language files 
    244214 * and localized system content. 
    245  * The path takes any optional override into account, and is used directly in 
    246  * Wikka, including in this file. 
    247  */ 
    248 if (!defined('WIKKA_LANG_PATH')) define('WIKKA_LANG_PATH', 
    249         (defined('LOCAL_LANG_PATH') && ($canon_path = validLocalPath(LOCAL_LANG_PATH, 'dir'))) 
    250                 ? $canon_path 
    251                 : DEFAULT_LANG_PATH 
    252         ); 
    253 // ---------------------------- CORE PATHS DEFINED ----------------------------- 
    254  
    255  
    256 // -------------------------- COMPATIBILITY LIBRARY ---------------------------- 
    257 if ($debug) echo "loading compatibility library...<br/>\n"; 
    258 // ---- requires the effective library path to be defined 
    259 // Now that the "core" paths are defined, include the "compatibility functions". 
    260 // We do this as early as possible: may be used for following defines and 
    261 // derivations! 
    262 require_once WIKKA_LIBRARY_PATH.DIRECTORY_SEPARATOR.'Compatibility.lib.php'; 
    263 // ------------------------ END COMPATIBILITY LIBRARY -------------------------- 
    264  
    265 // @@@ include regex library HERE, so this file AND the setup process can use it! 
    266  
    267 // ---------------- DEFINE & DERIVE CONFIGURABLE COMPONENT PATHS --------------- 
    268 if ($debug) echo "default 3rd-party component paths...<br/>\n"; 
    269 /* 
    270   Although these paths are configurable, we use defined constants here for three 
    271   reasons: 
    272   1. Like a core path, these represent paths to components that might be 
    273          shared between installations, so we use the same override mechanism here. 
    274   2. While the paths are configurable, the defaults defined here can be overridden 
    275          <i>before</i> they get to the configuration file (and seen by the installer), 
    276          so they effectively become the defaults used during the installation process. 
    277          This enhances consistency between "sister" installations. 
    278   3. A (filesystem) file or directory path needs to take the local directory 
    279          separator into account but in PHP4 a class variable (as used in the default 
    280          configuration file) can only be initialized with a literal or a constant, 
    281          not a concatenation. 
    282 */ 
    283 define('PATH_DIVIDER', ','); 
    284  
    285 /**#@+ 
    286  * Default for a (configurable) filesystem directory for a component. 
    287  */ 
    288 /** 
    289  * Default <b>directory</b> where actions bundled with Wikka are stored. 
    290  * May be overridden as well as configured to enable sharing Wikka components 
    291  * between Wikka installations. 
    292  */ 
    293 if (!defined('DEFAULT_ACTION_PATH'))    define('DEFAULT_ACTION_PATH', 'plugins/actions'.PATH_DIVIDER.'actions'); 
    294 /** 
    295  * Default <b>directory</b> where handlers bundled with Wikka are stored. 
    296  * May be overridden as well as configured to enable sharing Wikka components 
    297  * between Wikka installations. 
    298  */ 
    299 if (!defined('DEFAULT_HANDLER_PATH'))   define('DEFAULT_HANDLER_PATH', 'plugins/handlers'.PATH_DIVIDER.'handlers'); 
    300 /** 
    301  * Default <b>directory</b> where formatters and highlighters bundled with Wikka are stored. 
    302  * May be overridden as well as configured to enable sharing Wikka components 
    303  * between Wikka installations. 
    304  */ 
    305 if (!defined('DEFAULT_FORMATTER_PATH')) define('DEFAULT_FORMATTER_PATH', 'plugins/formatters'.PATH_DIVIDER.'formatters'); 
    306 /** 
    307  * Default <b>directory</b> where template files bundled with Wikka are stored. 
    308  * May be overridden as well as configured to enable sharing Wikka components 
    309  * between Wikka installations. 
    310  */ 
    311 if (!defined('DEFAULT_TEMPLATE_PATH')) define('DEFAULT_TEMPLATE_PATH', 'plugins/templates'.PATH_DIVIDER.'templates'); 
    312 /** 
    313  * Default <b>directory</b> where 3rd-party components bundled with Wikka are stored. 
    314  * This path isn't used directly but can be used in building other 3rd-party 
    315  * component paths. 
    316  * May be overridden as well as configured to enable sharing 3rd-party components 
    317  * with other Wikka installations and other applications. 
    318  */ 
    319 if (!defined('DEFAULT_3RDPARTY_PATH'))                  define('DEFAULT_3RDPARTY_PATH', '3rdparty'); 
    320  
    321 /** 
    322  * Default <b>directory</b> for 3rd-party core components; these components are required for 
    323  * basic Wikka functionality. 
    324  * May be overridden as well as configured to enable sharing 3rd-party components 
    325  * with other Wikka installations and other applications. 
    326  */ 
    327 if (!defined('DEFAULT_3RDPARTY_CORE_PATH'))             define('DEFAULT_3RDPARTY_CORE_PATH', DEFAULT_3RDPARTY_PATH.DIRECTORY_SEPARATOR.'core'); 
    328 /** 
    329  * Default <b>directory</b> for 3rd-party plugin components; these components are optional 
    330  * and extend Wikka functionality. 
    331  * May be overridden as well as configured to enable sharing 3rd-party components 
    332  * with other Wikka installations and other applications. 
    333  */ 
    334 if (!defined('DEFAULT_3RDPARTY_PLUGIN_PATH'))   define('DEFAULT_3RDPARTY_PLUGIN_PATH', DEFAULT_3RDPARTY_PATH.DIRECTORY_SEPARATOR.'plugins'); 
    335  
    336 /** 
    337  * Default <b>directory</b> for the FeedCreator 3rd-party core component. 
    338  * May be overridden as well as configured to enable sharing 3rd-party components 
    339  * with other Wikka installations and other applications. 
    340  */ 
    341 if (!defined('DEFAULT_FEEDCREATOR_PATH'))               define('DEFAULT_FEEDCREATOR_PATH', DEFAULT_3RDPARTY_CORE_PATH.DIRECTORY_SEPARATOR.'feedcreator'); 
    342 /** 
    343  * Default <b>directory</b> for the SafeHTML 3rd-party core component. 
    344  * May be overridden as well as configured to enable sharing 3rd-party components 
    345  * with other Wikka installations and other applications. 
    346  */ 
    347 if (!defined('DEFAULT_SAFEHTML_PATH'))                  define('DEFAULT_SAFEHTML_PATH', DEFAULT_3RDPARTY_CORE_PATH.DIRECTORY_SEPARATOR.'safehtml'); 
    348  
    349 /** 
    350  * Default <b>directory</b> for the optional GeSHi 3rd-party plugin component. 
    351  * May be overridden as well as configured to enable sharing 3rd-party components 
    352  * with other Wikka installations and other applications. 
    353  */ 
    354 if (!defined('DEFAULT_GESHI_PATH'))                             define('DEFAULT_GESHI_PATH', DEFAULT_3RDPARTY_PLUGIN_PATH.DIRECTORY_SEPARATOR.'geshi'); 
    355 /** 
    356  * Default <b>directory</b> for the language files for the GeSHi 3rd-party plugin component. 
    357  * May be overridden as well as configured to enable sharing 3rd-party components 
    358  * with other Wikka installations and other applications. 
    359  */ 
    360 if (!defined('DEFAULT_GESHI_LANG_PATH'))                define('DEFAULT_GESHI_LANG_PATH', DEFAULT_GESHI_PATH.DIRECTORY_SEPARATOR.'geshi'); 
    361 /** 
    362  * Default <b>directory</b> for the optional Onyx-RSS 3rd-party plugin component. 
    363  * May be overridden as well as configured to enable sharing 3rd-party components 
    364  * with other Wikka installations and other applications. 
    365  */ 
    366 if (!defined('DEFAULT_ONYX_PATH'))                              define('DEFAULT_ONYX_PATH', DEFAULT_3RDPARTY_PLUGIN_PATH.DIRECTORY_SEPARATOR.'onyx-rss'); 
    367 /**#@-*/ 
    368  
    369 /**#@+ 
    370  * String constant used as (configurable) filesystem <b>directory</b> for a component. 
    371  */ 
    372 /** 
    373  * Effective (configurable) <b>directory</b> for Wikka actions. 
    374  * The path takes any optional override into account; used to define a value in 
    375  * the default configuration file. 
    376  */ 
    377 if (!defined('CONFIG_ACTION_PATH')) define('CONFIG_ACTION_PATH', 
    378         (defined('LOCAL_ACTION_PATH') && ($canon_path = validLocalPath(LOCAL_ACTION_PATH, 'dir'))) 
    379                 ? $canon_path 
    380                 : DEFAULT_ACTION_PATH 
    381         ); 
    382 /** 
    383  * Effective (configurable) <b>directory</b> for Wikka handlers. 
    384  * The path takes any optional override into account; used to define a value in 
    385  * the default configuration file. 
    386  */ 
    387 if (!defined('CONFIG_HANDLER_PATH')) define('CONFIG_HANDLER_PATH', 
    388         (defined('LOCAL_HANDLER_PATH') && ($canon_path = validLocalPath(LOCAL_HANDLER_PATH, 'dir'))) 
    389                 ? $canon_path 
    390                 : DEFAULT_HANDLER_PATH 
    391         ); 
    392 /** 
    393  * Effective (configurable) <b>directory</b> for Wikka formatters and highlighters. 
    394  * The path takes any optional override into account; used to define a value in 
    395  * the default configuration file. 
    396  */ 
    397 if (!defined('CONFIG_FORMATTER_PATH')) define('CONFIG_FORMATTER_PATH', 
    398         (defined('LOCAL_FORMATTER_PATH') && ($canon_path = validLocalPath(LOCAL_FORMATTER_PATH, 'dir'))) 
    399                 ? $canon_path 
    400                 : DEFAULT_FORMATTER_PATH 
    401         ); 
    402 /** 
    403  * Effective (configurable) <b>directory</b> for Wikka templates. 
    404  * The path takes any optional override into account; used to define a value in 
    405  * the default configuration file. 
    406  */ 
    407 if (!defined('CONFIG_TEMPLATE_PATH')) define('CONFIG_TEMPLATE_PATH', 
    408         (defined('LOCAL_TEMPLATE_PATH') && ($canon_path = validLocalPath(LOCAL_TEMPLATE_PATH, 'dir'))) 
    409                 ? $canon_path 
    410                 : DEFAULT_TEMPLATE_PATH 
    411         ); 
    412 /** 
    413  * Effective (configurable) <b>directory</b> for 3rd-party components; these components 
    414  * are required for basic Wikka functionality. 
    415  * The path takes any optional override into account; used to define a value in 
    416  * the default configuration file. 
    417  */ 
    418 if (!defined('CONFIG_3RDPARTY_PATH')) define('CONFIG_3RDPARTY_PATH', 
    419         (defined('LOCAL_3RDPARTY_PATH') && ($canon_path = validLocalPath(LOCAL_3RDPARTY_PATH, 'dir'))) 
    420                 ? $canon_path 
    421                 : DEFAULT_3RDPARTY_PATH 
    422         ); 
    423 /** 
    424  * Effective (configurable) <b>directory</b> for 3rd-party core components; these components 
    425  * are required for basic Wikka functionality. 
    426  * The path takes any optional override into account; used to define a value in 
    427  * the default configuration file. 
    428  */ 
    429 if (!defined('CONFIG_3RDPARTY_CORE_PATH')) define('CONFIG_3RDPARTY_CORE_PATH', 
    430         (defined('LOCAL_3RDPARTY_CORE_PATH') && ($canon_path = validLocalPath(LOCAL_3RDPARTY_CORE_PATH, 'dir'))) 
    431                 ? $canon_path 
    432                 : DEFAULT_3RDPARTY_CORE_PATH 
    433         ); 
    434 /** 
    435  * Effective (configurable) <b>directory</b> for 3rd-party plugin components; these components 
    436  * are optional and extend Wikka functionality. 
    437  * The path takes any optional override into account; used to define a value in 
    438  * the default configuration file. 
    439  */ 
    440 if (!defined('CONFIG_3RDPARTY_PLUGIN_PATH')) define('CONFIG_3RDPARTY_PLUGIN_PATH', 
    441         (defined('LOCAL_3RDPARTY_PLUGIN_PATH') && ($canon_path = validLocalPath(LOCAL_3RDPARTY_PLUGIN_PATH, 'dir'))) 
    442                 ? $canon_path 
    443                 : DEFAULT_3RDPARTY_PLUGIN_PATH 
    444         ); 
    445  
    446 /** 
    447  * Effective (configurable) <b>directory</b> for the FeedCreator 3rd-party core component. 
    448  * The path takes any optional override into account; used to define a value in 
    449  * the default configuration file. 
    450  */ 
    451 if (!defined('CONFIG_FEEDCREATOR_PATH')) define('CONFIG_FEEDCREATOR_PATH', 
    452         (defined('LOCAL_FEEDCREATOR_PATH') && ($canon_path = validLocalPath(LOCAL_FEEDCREATOR_PATH, 'dir'))) 
    453                 ? $canon_path 
    454                 : DEFAULT_FEEDCREATOR_PATH 
    455         ); 
    456 /** 
    457  * Effective (configurable) <b>directory</b> for the SafeHTML 3rd-party core component. 
    458  * The path takes any optional override into account; used to define a value in 
    459  * the default configuration file. 
    460  */ 
    461 if (!defined('CONFIG_SAFEHTML_PATH')) define('CONFIG_SAFEHTML_PATH', 
    462         (defined('LOCAL_SAFEHTML_PATH') && ($canon_path = validLocalPath(LOCAL_SAFEHTML_PATH, 'dir'))) 
    463                 ? $canon_path 
    464                 : DEFAULT_SAFEHTML_PATH 
    465         ); 
    466  
    467 /** 
    468  * Effective (configurable) <b>directory</b> for the optional GeSHi 3rd-party plugin package. 
    469  * The path takes any optional override into account; used to define a value in 
    470  * the default configuration file. 
    471  */ 
    472 if (!defined('CONFIG_GESHI_PATH')) define('CONFIG_GESHI_PATH', 
    473         (defined('LOCAL_GESHI_PATH') && ($canon_path = validLocalPath(LOCAL_GESHI_PATH, 'dir'))) 
    474                 ? $canon_path 
    475                 : DEFAULT_GESHI_PATH 
    476         ); 
    477 /** 
    478  * Effective (configurable) <b>directory</b> for the language files for the GeSHi 3rd-party 
    479  * plugin component. 
    480  * The path takes any optional override into account; used to define a value in 
    481  * the default configuration file. 
    482  */ 
    483 if (!defined('CONFIG_GESHI_LANG_PATH')) define('CONFIG_GESHI_LANG_PATH', 
    484         (defined('LOCAL_GESHI_LANG_PATH') && ($canon_path = validLocalPath(LOCAL_GESHI_LANG_PATH, 'dir'))) 
    485                 ? $canon_path 
    486                 : DEFAULT_GESHI_LANG_PATH 
    487         ); 
    488 /** 
    489  * Effective (configurable) <b>directory</b> for the optional Onyx-RSS 3rd-party plugin component. 
    490  * The path takes any optional override into account; used to define a value in 
    491  * the default configuration file. 
    492  */ 
    493 if (!defined('CONFIG_ONYX_PATH')) define('CONFIG_ONYX_PATH', 
    494         (defined('LOCAL_ONYX_PATH') && ($canon_path = validLocalPath(LOCAL_ONYX_PATH, 'dir'))) 
    495                 ? $canon_path 
    496                 : DEFAULT_ONYX_PATH 
    497         ); 
    498 /**#@-*/ 
    499 // ------------------- CONFIGURABLE COMPONENT PATHS DEFINED -------------------- 
    500  
    501 // -------------- DEFINE & DERIVE CONFIGURABLE COMPONENT URI PATHS ------------- 
    502 if ($debug) echo "default 3rd-party component URI paths...<br/>\n"; 
    503 /**#@+ 
    504  * Default for a (configurable) <b>URL path component</b> for a 3rd-party component. 
    505  */ 
    506 /** 
    507  * Default <b>URL path component</b> for the WikiEdit scripts. 
    508  * May be overridden as well as configured to enable sharing 3rd-party components 
    509  * between Wikka installations. 
    510  */ 
    511 if (!defined('DEFAULT_WIKIEDIT_URIPATH'))       define('DEFAULT_WIKIEDIT_URIPATH', filesys2uri(DEFAULT_3RDPARTY_PLUGIN_PATH).'/wikiedit'); 
    512 /** 
    513  * Default <b>URL path component</b> for the FreeMind display applet. 
    514  * May be overridden as well as configured to enable sharing 3rd-party components 
    515  * between Wikka installations. 
    516  */ 
    517 if (!defined('DEFAULT_FREEMIND_URIPATH'))       define('DEFAULT_FREEMIND_URIPATH', filesys2uri(DEFAULT_3RDPARTY_PLUGIN_PATH).'/freemind'); 
    518 /**#@-*/ 
    519  
    520 /**#@+ 
    521  * Default for a (configurable) <b>URL path component</b> for a 3rd-party component. 
    522  */ 
    523 /** 
    524  * Effective default (configurable) <b>URL path component</b> for the WikiEdit 
    525  * scripts. 
    526  * The path takes any optional override into account; used to define a value in 
    527  * the default configuration file. 
    528  */ 
    529 if (!defined('CONFIG_WIKIEDIT_URIPATH'))        define('CONFIG_WIKIEDIT_URIPATH', 
    530         (defined('LOCAL_WIKIEDIT_URIPATH') && ($uri_path = validUriPath(LOCAL_WIKIEDIT_URIPATH)))       // @@@ URI path 
    531                 ? $uri_path 
    532                 : DEFAULT_WIKIEDIT_URIPATH 
    533         ); 
    534 /** 
    535  * Effective default (configurable) <b>URL path component</b> for the FreeMind 
    536  * display applet. 
    537  * The path takes any optional override into account; used to define a value in 
    538  * the default configuration file. 
    539  */ 
    540 if (!defined('CONFIG_FREEMIND_URIPATH'))        define('CONFIG_FREEMIND_URIPATH', 
    541         (defined('LOCAL_FREEMIND_URIPATH') && ($uri_path = validUriPath(LOCAL_FREEMIND_URIPATH)))       // @@@ URI path 
    542                 ? $uri_path 
    543                 : DEFAULT_FREEMIND_URIPATH 
    544         ); 
    545 /**#@-*/ 
    546 // ----------------- CONFIGURABLE COMPONENT URI PATHS DEFINED ------------------ 
    547  
    548 // ------------------------- OTHER CONFIGURABLE DEFAULTS ----------------------- 
    549 /**#@+ 
    550  * String constant used as default for a configurable setting. 
    551  */ 
    552 /** 
    553  * Defines the (configurable) default language. Wikka will attempt to load the 
    554  * corresponding language file. 
    555  * This value is directly used here in wikka.php but also used as the default 
    556  * value in the default configuration file. 
    557  */ 
    558 if (!defined('CONFIG_DEFAULT_LANGUAGE'))        define('CONFIG_DEFAULT_LANGUAGE', 'en'); 
    559 /**#@-*/ 
    560 // ----------------------- END OTHER CONFIGURABLE DEFAULTS --------------------- 
    561  
    562  
    563 // ------------------ DEFINE & DERIVE CONFIGURATION FILE PATHS ----------------- 
    564 if ($debug) echo "configuration file paths...<br/>\n"; 
    565 // ---- requires WIKKA_LIBRARY_PATH to be defined so this section must come after 
    566 //      that constant is derived. 
    567 /**#@+ 
    568  * String constant used as default for the (filesystem) path for a configuration file. 
    569  */ 
    570 /** 
    571  * Default filesystem path for the <b>default</b> configuration <b>file</b>. 
    572  * By default located in the Wikka library directory; this setting is overridable 
    573  * on its own, whether or not the default library location has been overridden. 
    574  */ 
    575 if (!defined('DEFAULT_DEFAULT_CONFIGFILE'))     define('DEFAULT_DEFAULT_CONFIGFILE', WIKKA_LIBRARY_PATH.DIRECTORY_SEPARATOR.'Config.class.php'); 
    576 /** 
    577  * Default filesystem path for the <b>site</b> configuration <b>file</b>. 
    578  * By default located in the Wikka installation directory; this setting is 
    579  * overridable to enable locating it outside the webroot (and/or sharing it with 
    580  * another Wikka installation). 
    581  */ 
    582 if (!defined('DEFAULT_SITE_CONFIGFILE'))        define('DEFAULT_SITE_CONFIGFILE', 'wikka.config.php'); 
    583 /**#@-*/ 
    584  
    585 // FIXED this is an (improved and extended) version of the method introduced in 
    586 // 1.1.6.3 to avoid GetEnv #470 
    587  
    588 /**#@+ 
    589  * String constant defining the effective (filesystem) path for a configuration <b>file</b>. 
    590  */ 
    591 /** 
    592  * Effective filesystem path for the <b>default</b> configuration <b>file</b>. 
    593  * The path takes any optional override into account, and is used directly in 
    594  * Wikka, including in this file. 
    595  */ 
    596 if (!defined('DEFAULT_CONFIGFILE')) define('DEFAULT_CONFIGFILE', 
    597         (defined('LOCAL_DEFAULT_CONFIGFILE') && ($canon_path = validLocalPath(LOCAL_DEFAULT_CONFIGFILE, 'file'))) 
    598                 ? $canon_path 
    599                 : DEFAULT_DEFAULT_CONFIGFILE 
    600         ); 
    601 /** 
    602  * Effective filesystem path for the <b>site</b> configuration <b>file</b>. 
    603  * The path takes any optional override into account, and is used directly in 
    604  * Wikka, including in this file. The file does not need to exist; if it doesn't, 
    605  * the installer will be triggered (which will create the file). 
    606  */ 
    607 if (!defined('SITE_CONFIGFILE')) define('SITE_CONFIGFILE', 
    608         (defined('LOCAL_SITE_CONFIGFILE') && ($canon_path = validLocalPath(LOCAL_SITE_CONFIGFILE, 'file', FALSE))) 
    609                 ? $canon_path 
    610                 : DEFAULT_SITE_CONFIGFILE 
    611         ); 
    612 /**#@-*/ 
    613 // ---------------------- CONFIGURATION FILE PATHS DEFINED --------------------- 
    614  
    615  
     215 */ 
     216if (!defined('WIKKA_LANG_PATH')) define('WIKKA_LANG_PATH', 'lang'); 
     217 
     218/** 
     219  * Default <b>directory</b> where actions bundled with Wikka are 
     220  * stored. 
     221  */ 
     222if(!defined('DEFAULT_ACTION_PATH')) define('DEFAULT_ACTION_PATH', 'plugins/actions'.PATH_DIVIDER.'actions'); 
     223 
     224/** 
     225  * Default <b>directory</b> where handlers bundled with Wikka are 
     226  * stored. 
     227  */ 
     228if(!defined('DEFAULT_HANDLER_PATH')) define('DEFAULT_HANDLER_PATH', 'plugins/handlers'.PATH_DIVIDER.'handlers'); 
     229 
     230/** 
     231  * Default <b>directory</b> where formatters bundled with Wikka are 
     232  * stored. 
     233  */ 
     234if(!defined('DEFAULT_FORMATTER_PATH')) define('DEFAULT_FORMATTER_PATH', 'plugins/formatters'.PATH_DIVIDER.'formatters'); 
     235 
     236/** 
     237  * Default <b>directory</b> where templates bundled with Wikka are 
     238  * stored. 
     239  */ 
     240if(!defined('DEFAULT_TEMPLATE_PATH')) define('DEFAULT_TEMPLATE_PATH', 'plugins/templates'.PATH_DIVIDER.'templates'); 
     241 
     242/** 
     243  * Directory for 3rd-party components 
     244  */ 
     245if(!defined('DEFAULT_3RDPARTY_PATH')) define('DEFAULT_3RDPARTY_PATH', '3rdparty'); 
     246 
     247/** Default <b>directory</b> where 3rdparty core components bundled 
     248  * with Wikka are stored.  These components are required for basic 
     249  * Wikka functionality. 
     250  */ 
     251if(!defined('DEFAULT_3RDPARTY_CORE_PATH')) define('DEFAULT_3RDPARTY_CORE_PATH', DEFAULT_3RDPARTY_PATH.DIRECTORY_SEPARATOR.'core'); 
     252 
     253/** Default <b>directory</b> where 3rdparty plugin components bundled 
     254  * with Wikka are stored.  These components are optional and extend 
     255  * Wikka functionality. 
     256  */ 
     257if(!defined('DEFAULT_3RDPARTY_PLUGIN_PATH')) define('DEFAULT_3RDPARTY_PLUGIN_PATH', DEFAULT_3RDPARTY_PATH.DIRECTORY_SEPARATOR.'plugin'); 
     258 
     259/**  
     260  * Default <b>directory</b> for the FeedCreator 3rd party component. 
     261  */ 
     262if(!defined('DEFAULT_FEEDCREATOR_PATH')) define('DEFAULT_FEEDCREATOR_PATH', DEFAULT_3RDPARTY_CORE_PATH.DIRECTORY_SEPARATOR.'feedcreator'); 
     263 
     264/**  
     265  * Default <b>directory</b> for the SafeHTML 3rd party component. 
     266  */ 
     267if(!defined('DEFAULT_SAFEHTML_PATH')) define('DEFAULT_SAFEHTML_PATH', DEFAULT_3RDPARTY_CORE_PATH.DIRECTORY_SEPARATOR.'safehtml'); 
     268 
     269/**  
     270  * Default <b>directory</b> for the optional GeSHi 3rd party plugin component. 
     271  */ 
     272if(!defined('DEFAULT_GESHI_PATH')) define('DEFAULT_GESHI_PATH', DEFAULT_3RDPARTY_PLUGIN_PATH.DIRECTORY_SEPARATOR.'geshi'); 
     273 
     274/**  
     275  * Default <b>directory</b> for the language files for the GeSHi 3rd 
     276  * party plugin component. 
     277  */ 
     278if(!defined('DEFAULT_GESHI_LANG_PATH')) define('DEFAULT_GESHI_LANG_PATH', DEFAULT_GESHI_PATH.DIRECTORY_SEPARATOR.'geshi'); 
     279 
     280/**  
     281  * Default <b>directory</b> for the optional Onyx-RSS 3rd party 
     282  * plugin component. 
     283  */ 
     284if(!defined('DEFAULT_ONYX_PATH')) define('DEFAULT_ONYX_PATH', DEFAULT_3RDPARTY_PLUGIN_PATH.DIRECTORY_SEPARATOR.'onyx-rss'); 
     285 
     286  /** 
     287   * <b>URL path component</b> pointing to the location of the WikiEdit scripts. 
     288   * This path will be extended by the system with the file name for each of 
     289   * the required scripts. 
     290   */ 
     291if(!defined('DEFAULT_WIKIEDIT_URIPATH')) define('DEFAULT_WIKIEDIT_URIPATH', filesys2uri(DEFAULT_3RDPARTY_PLUGIN_PATH).DIRECTORY_SEPARATOR.'wikiedit'); 
     292 
     293  /** 
     294   * <b>URL path component</b> for the FreeMind display applet. 
     295   * This path will be extended by the system with the file name for the 
     296   * applet's jar archive. 
     297   */ 
     298if(!defined('DEFAULT_FREEMIND_URIPATH')) define('DEFAULT_FREEMIND_URIPATH', filesys2uri(DEFAULT_3RDPARTY_PLUGIN_PATH).DIRECTORY_SEPARATOR.'freemind'); 
     299 
     300// ------------------- COMPONENT PATHS DEFINED -------------------- 
    616301 
    617302// -------------------------------- START TIMER -------------------------------- 
     
    624309// ------------------------------- TIMER STARTED ------------------------------- 
    625310 
    626  
    627311// ----------------------------- GATHER CONFIGURATION -------------------------- 
    628312if ($debug) echo "gather configuration...<br/>\n"; 
     
    633317 * 1. Get the default configuration. 
    634318 */ 
    635 #require_once('libs'.DIRECTORY_SEPARATOR.'Config.class.php'); 
    636 require_once DEFAULT_CONFIGFILE; 
     319require_once('libs'.DIRECTORY_SEPARATOR.'Config.class.php'); 
    637320$DefaultConfig = instantiate('Config'); 
    638321$wakkaDefaultConfig = get_object_vars($DefaultConfig); 
     
    644327$wakkaConfig = array(); // empty array in case there's no user configuration yet 
    645328 
    646 // Get any inherited configuration from Wakka - note this won't be picked up if 
    647 // SITE_CONFIGFILE points elsewhere! We assume that a deliberate overide takes 
    648 // precedence over automatic inheritance. 
     329// Get any inherited configuration from Wakka 
    649330if (file_exists('wakka.config.php')) 
    650331{ 
    651332        rename('wakka.config.php', 'wikka.config.php'); 
    652333} 
    653 if (file_exists(SITE_CONFIGFILE)) 
    654 { 
    655         include SITE_CONFIGFILE;                // fills $wakkaConfig 
    656 } 
     334if(file_exists(SITE_CONFIGFILE)) 
     335{ 
     336        include SITE_CONFIGFILE; 
     337} 
     338 
    657339// migrate some old to new variable names (should come before merge!) 
    658340//TODO move these checks to a directive file to be used by the installer/upgrader, #97 
     
    667349        unset($wakkaConfig['handler_path']); //since 1.1.7 
    668350} 
     351 
    669352// remove obsolete config settings (should come before merge!) 
    670353//TODO move these checks to a directive file to be used by the installer/upgrader, #97 
     
    716399 * Include language file if one exists. 
    717400 * 
    718  * Language files are bundled under <b>lang/</b> (default, overridable) in a 
     401 * Language files are bundled under <b>lang/</b> in a 
    719402 * folder named after their ISO 639-1 code (e.g. 'en' for English). 
    720403 * 
     
    723406 * language strings). 
    724407 */ 
    725 //check if a custom language definition is specified; if not, set a default 
    726 $wakkaConfig['default_lang'] = (isset($wakkaConfig['default_lang'])) ? $wakkaConfig['default_lang'] : CONFIG_DEFAULT_LANGUAGE; 
    727 // setup variables 
    728 $default_lang   = $wakkaConfig['default_lang']; 
    729 $lang_base_dir = WIKKA_LANG_PATH; 
    730 $fallback_lang  = CONFIG_DEFAULT_LANGUAGE;                      // should always be available 
     408$default_lang = $wakkaConfig['default_lang']; 
     409$lang_base_dir = 'lang';  
     410$fallback_lang  = 'en';                 // should always be available 
    731411$default_language_file  = $lang_base_dir.DIRECTORY_SEPARATOR.$default_lang.DIRECTORY_SEPARATOR.$default_lang.'.inc.php'; 
    732412$fallback_language_file = $lang_base_dir.$fallback_lang.DIRECTORY_SEPARATOR.$fallback_lang.'.inc.php'; 
     
    785465        die($language_file_not_found);  # fatalerror - local error message in English because we don't _have_ a language file(!) 
    786466} 
     467 
     468/* 
     469 * Defines the (configurable) default language. Wikka will attempt to 
     470 * oad the corresponding language file.  This value is directly used 
     471 * here in wikka.php but also used as the default value in the default 
     472 * configuration file. 
     473 */ 
     474if (!defined('DEFAULT_FALLBACK_LANGUAGE')) define('DEFAULT_FALLBACK_LANGUAGE' , $fallback_lang); 
     475 
    787476// ---------------------------- END LANGUAGE FILE ------------------------------ 
    788477 
     
    1116805echo $page_output; 
    1117806// --------------------------------- ALL DONE ---------------------------------- 
    1118  
    1119  
    1120 // --------------------------- RELOCATION FUNCTIONS ---------------------------- 
    1121 // These two are needed to validate override paths before we can include the 
    1122 // compatibility library. 
    1123 /** 
    1124  * Check whether a given path is a URL. 
    1125  * We do this by checking whether it has a scheme. 
    1126  * NOTE: parse_url() is pretty dumb and will think a path like 
    1127  * 'J:\Server\XAMPP 1.5.0\var\wikka.config.php' is a URL and parse it, even though 
    1128  * it has <b>backslashes</b> and a single (back)slash after the ':'; so we'll check 
    1129  * for a double slash before letting it do its work! 
    1130  */ 
    1131 function is_uri($path) 
    1132 { 
    1133         // init (assume NOT a uri) 
    1134         $result = FALSE; 
    1135         // URL? 
    1136         if (strstr('//',$path)) 
    1137         { 
    1138                 $a_components = parse_url($path); 
    1139                 if (isset($a_components['scheme'])) 
    1140                 { 
    1141                         $result = TRUE; 
    1142                 } 
    1143 /** 
    1144 echo '<pre>'; 
    1145 print_r($a_components); 
    1146 echo "</pre></br>\n"; 
    1147 /**/ 
    1148         } 
    1149         return $result; 
    1150 } 
    1151 /** 
    1152  * Checks whether a given path is a valid local path. 
    1153  * 
    1154  * Returns a canonicalized absolute path if valid and local, FALSE otherwise. 
    1155  * 
    1156  * @param       string  $path   mandatory: path to be checked 
    1157  * @param       string  $type   mandatory: type of path to check; 'file' or 'dir' 
    1158  * @param       boolean $mustexist      optional: specify whether the file or directory must already exist; default: TRUE 
    1159  * @return      mixed   valid absolute path if valid, FALSE otherwise 
    1160  */ 
    1161 function validLocalPath($path,$type,$must_exist=TRUE) 
    1162 { 
    1163         // URL? 
    1164         if (is_uri($path)) 
    1165         { 
    1166                 $result = FALSE;                                // URL not allowed for local path 
    1167 #echo 'validLocalPath - is a URL!'."<br/>\n"; 
    1168         } 
    1169         else 
    1170         { 
    1171                 // realpath() fails on a non-existant file, so if it doesn't exist 
    1172                 // we create it temporarily to let realpath() do its work 
    1173                 $temp_created = FALSE; 
    1174                 if (!file_exists($path)) 
    1175                 { 
    1176                         // attempt to create it temporarily so realpath() can work on it 
    1177                         $rc = @touch($path); 
    1178                         if ($rc) $temp_created = TRUE; 
    1179                 } 
    1180                 $result = realpath($path);              // canonicalized absolute path 
    1181 /** 
    1182 if (!isset($result)) $result_txt = '(nothing)'; 
    1183 elseif (FALSE === $result) $result_txt = 'FALSE'; 
    1184 else $result_txt = $result; 
    1185 echo 'validLocalPath - realpath() says: '.$result_txt."<br/>\n"; 
    1186 /**/ 
    1187                 // if a temp file was created, clear it up again 
    1188                 if ($temp_created) 
    1189                 { 
    1190                         @unlink($path); 
    1191                 } 
    1192                 // if we still have a path, validate against type and existance requirements 
    1193                 if (FALSE !== $result) 
    1194                 { 
    1195                         switch ($type) 
    1196                         { 
    1197                                 case 'file': 
    1198                                         if ($must_exist && (!file_exists($result) || !is_file($result))) 
    1199                                         { 
    1200                                                 $result = FALSE; 
    1201 #echo 'validLocalPath - not a file or does not exist!'."<br/>\n"; 
    1202                                         } 
    1203                                         break; 
    1204                                 case 'dir': 
    1205                                         if ($must_exist && (!file_exists($result) || !is_dir($result))) 
    1206                                         { 
    1207                                                 $result = FALSE; 
    1208 #echo 'validLocalPath - not a directory or does not exist!'."<br/>\n"; 
    1209                                         } 
    1210                                         break; 
    1211                                 default: 
    1212                                         // wrong $type spec 
    1213                                         $result = FALSE; 
    1214 #echo 'validLocalPath - invalid type parameter'."<br/>\n"; 
    1215                         } 
    1216                 } 
    1217         } 
    1218 /* Debug */ 
    1219 $result_txt = (FALSE === $result) ? 'FALSE' : $result; 
    1220 echo 'validLocalPath - path '.$path.' is really: '.$result_txt."<br/>\n"; 
    1221 /**/ 
    1222         return $result; 
    1223 } 
    1224 // ------------------------- END RELOCATION FUNCTIONS -------------------------- 
    1225807?>