root/releases/0.9.1/includes.php

Revision 1527, 4.7 kB (checked in by ewout, 8 months ago)

Move the gettext library inclusion after setup.php. Resolves #252. Thanks for the patches and investigation, Renato and Rho.

  • Property svn:eol-style set to native
Line 
1 <?php
2
3     // error_reporting(E_ERROR | E_WARNING | E_PARSE);
4
5     // All installation specific parameters should be in a file
6     // that is not part of the standard distribution.
7         //TODO: disabled this message, go directly to installer
8         if (false && !file_exists(dirname(__FILE__)."/config.php")) {
9             $message = <<< END
10 <html>
11 <head>
12     <title>Elgg installation</title>
13 </head>
14 <body>
15     <h1>Elgg isn't ready to run just yet.</h1>
16     <p>
17         There is not a whole lot of work to do to get up and running, but
18         there is a bit. Here's what you have to do:
19     </p>
20     <ol>
21         <li>Read the INSTALL file that came with your installation package.
22         <li><a href="_elggadmin/">Click here to use the visual installer</a>.</li>
23     </ol>
24     <p>
25         If you have any problems, head over to the main Elgg site
26         at <a href="http://elgg.org/">Elgg.org</a>.
27     </p>
28 </body>
29 </html>
30 END;
31             die($message);
32         }
33
34     // Default config values
35         require_once(dirname(__FILE__).'/lib/config-defaults.php');
36     // override config values
37         if (is_readable(dirname(__FILE__).'/config.php')) {
38             require_once(dirname(__FILE__)."/config.php");
39         }
40
41     // Check if should go to install
42         if (empty($CFG->dbname) || empty($CFG->dbuser)) {
43             header('Location: install.php');
44             exit();
45         }
46
47     // Check for .htaccess
48         if (!file_exists(dirname(__FILE__)."/.htaccess")) {
49             $message = <<< END
50 <html>
51 <head>
52     <title>Elgg installation</title>
53 </head>
54 <body>
55     <h1>Elgg still is not ready to run just yet. (Sorry.)</h1>
56     <p>
57         You're going to need to rename the <i>htaccess-dist</i> file that
58         came with your installation (it's in the main installation directory)
59         to <i>.htaccess</i>.
60     </p>
61     <p>
62         If you're using a Windows <i>server</i>, this is a bit of a problem.
63         Windows doesn't like files starting in a period,
64         but there's a workaround: open htaccess-dist in Notepad, click Save As,
65         change the file type pulldown to all files (*.*), and type .htaccess
66         in the filename box.
67     </p>
68     <p>
69         If you're using any other kind of server, all is well with the world.
70         (If you're uncertain, try renaming the file: most servers run on Linux
71         or a similar operating system.)
72     </p>
73     <p>
74         Read the INSTALL file that came with your installation for more information
75         about installing Elgg.
76     </p>
77 </body>
78 </html>
79 END;
80             die($message);
81         }
82
83     // Check config values make sense
84         require_once(dirname(__FILE__).'/lib/sanitychecks.php');
85
86     /***************************************************************************
87     *    HELPER LIBRARIES
88     ****************************************************************************/
89
90     // Load cache lib
91         require_once($CFG->dirroot.'lib/cache/lib.php');
92
93     // Load datalib
94         require_once($CFG->dirroot.'lib/datalib.php');
95
96     // Load elgglib
97         require_once($CFG->dirroot.'lib/elgglib.php');
98
99     // Load constants
100         require_once($CFG->dirroot.'lib/constants.php');
101
102     /***************************************************************************
103     *    CORE FUNCTIONALITY LIBRARIES
104     ****************************************************************************/
105
106     
107     // Load setup.php which will initialize database connections and such like.
108         require_once($CFG->dirroot.'lib/setup.php');
109
110     // Language / internationalisation
111     //@todo All the libraries has a strong dependence with this 'plugin'
112         require_once($CFG->dirroot . "mod/gettext/lib.php");
113
114
115     // Plug-in engine (must be loaded first)
116         require($CFG->dirroot . "lib/engine.php");
117
118     // XML parsing
119         require($CFG->dirroot . "lib/xmllib.php");
120
121     // User functions
122         require_once($CFG->dirroot.'lib/userlib.php');
123
124     // Check database
125         require_once($CFG->dirroot.'lib/dbsetup.php');
126
127     /***************************************************************************
128     *    START-OF-PAGE RUNNING
129     ****************************************************************************/
130
131         if ($allmods = get_list_of_plugins('mod') ) {
132             foreach ($allmods as $mod) {
133                 $mod_init = $mod . '_init';
134                 if (function_exists($mod_init)) {
135                     $mod_init();
136                    }
137            }
138         }
139
140         run("init");
141
142     // Walled garden checking: if we're not logged in,
143     // and walled garden functionality is turned on, redirect to
144     // the logon screen
145         if (!empty($CFG->walledgarden) && (!defined("context") || context != 'external') && !logged_on) {
146             require_login();
147         }
148
149 ?>
Note: See TracBrowser for help on using the browser.