root/releases/0.9/includes.php

Revision 1463, 4.7 kB (checked in by misja, 10 months ago)

Misja Hoebe <misja@curverider.co.uk> Merge r1456, r1457, r1458, r1459, r1460, r1461, r1462 into 0.9 branch

  • 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 isn't 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 isn't 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     // Language / internationalisation
107     //@todo All the libraries has a strong dependence with this 'plugin'
108         require_once($CFG->dirroot . "mod/gettext/lib.php");
109
110     // Load setup.php which will initialize database connections and such like.
111         require_once($CFG->dirroot.'lib/setup.php');
112
113     // Plug-in engine (must be loaded first)
114         require($CFG->dirroot . "lib/engine.php");
115
116     // XML parsing
117         require($CFG->dirroot . "lib/xmllib.php");
118
119     // User functions
120         require_once($CFG->dirroot.'lib/userlib.php');
121
122     // Check database
123         require_once($CFG->dirroot.'lib/dbsetup.php');
124
125     /***************************************************************************
126     *    START-OF-PAGE RUNNING
127     ****************************************************************************/
128
129         if ($allmods = get_list_of_plugins('mod') ) {
130             foreach ($allmods as $mod) {
131                 $mod_init = $mod . '_init';
132                 if (function_exists($mod_init)) {
133                     $mod_init();
134                    }
135            }
136         }
137
138         run("init");
139
140     // Walled garden checking: if we're not logged in,
141     // and walled garden functionality is turned on, redirect to
142     // the logon screen
143         if (!empty($CFG->walledgarden) && (!defined("context") || context != 'external') && !logged_on) {
144             require_login();
145         }
146
147 ?>
Note: See TracBrowser for help on using the browser.