Changeset 3698:c470a02c7cf4 for inc/prepend.php
- Timestamp:
- 02/11/18 09:57:27 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/prepend.php
r3683 r3698 12 12 13 13 /* Start tick */ 14 define('DC_START_TIME', microtime(true));14 define('DC_START_TIME', microtime(true)); 15 15 16 16 /* ------------------------------------------------------------------------------------------- */ 17 17 # ClearBricks, DotClear classes auto-loader 18 18 if (@is_dir('/usr/lib/clearbricks')) { 19 define('CLEARBRICKS_PATH','/usr/lib/clearbricks');20 } elseif (is_dir(dirname(__FILE__) .'/libs/clearbricks')) {21 define('CLEARBRICKS_PATH',dirname(__FILE__).'/libs/clearbricks');19 define('CLEARBRICKS_PATH', '/usr/lib/clearbricks'); 20 } elseif (is_dir(dirname(__FILE__) . '/libs/clearbricks')) { 21 define('CLEARBRICKS_PATH', dirname(__FILE__) . '/libs/clearbricks'); 22 22 } elseif (isset($_SERVER['CLEARBRICKS_PATH']) && is_dir($_SERVER['CLEARBRICKS_PATH'])) { 23 define('CLEARBRICKS_PATH',$_SERVER['CLEARBRICKS_PATH']);23 define('CLEARBRICKS_PATH', $_SERVER['CLEARBRICKS_PATH']); 24 24 } 25 25 26 26 if (!defined('CLEARBRICKS_PATH') || !is_dir(CLEARBRICKS_PATH)) { 27 28 } 29 30 require CLEARBRICKS_PATH .'/_common.php';31 32 $__autoload['dcCore'] = dirname(__FILE__) .'/core/class.dc.core.php';33 $__autoload['dcAuth'] = dirname(__FILE__) .'/core/class.dc.auth.php';34 $__autoload['dcBlog'] = dirname(__FILE__) .'/core/class.dc.blog.php';35 $__autoload['dcCategories'] = dirname(__FILE__) .'/core/class.dc.categories.php';36 $__autoload['dcError'] = dirname(__FILE__) .'/core/class.dc.error.php';37 $__autoload['dcMeta'] = dirname(__FILE__) .'/core/class.dc.meta.php';38 $__autoload['dcMedia'] = dirname(__FILE__) .'/core/class.dc.media.php';39 $__autoload['dcPostMedia'] = dirname(__FILE__) .'/core/class.dc.postmedia.php';40 $__autoload['dcModules'] = dirname(__FILE__) .'/core/class.dc.modules.php';41 $__autoload['dcPlugins'] = dirname(__FILE__) .'/core/class.dc.plugins.php';42 $__autoload['dcThemes'] = dirname(__FILE__) .'/core/class.dc.themes.php';43 $__autoload['dcRestServer'] = dirname(__FILE__) .'/core/class.dc.rest.php';44 $__autoload['dcNamespace'] = dirname(__FILE__) .'/core/class.dc.namespace.php';45 $__autoload['dcSettings'] = dirname(__FILE__) .'/core/class.dc.settings.php';46 $__autoload['dcTrackback'] = dirname(__FILE__) .'/core/class.dc.trackback.php';47 $__autoload['dcUpdate'] = dirname(__FILE__) .'/core/class.dc.update.php';48 $__autoload['dcUtils'] = dirname(__FILE__) .'/core/class.dc.utils.php';49 $__autoload['dcXmlRpc'] = dirname(__FILE__) .'/core/class.dc.xmlrpc.php';50 $__autoload['dcLog'] = dirname(__FILE__) .'/core/class.dc.log.php';51 $__autoload['dcWorkspace'] = dirname(__FILE__) .'/core/class.dc.workspace.php';52 $__autoload['dcPrefs'] = dirname(__FILE__) .'/core/class.dc.prefs.php';53 $__autoload['dcStore'] = dirname(__FILE__) .'/core/class.dc.store.php';54 $__autoload['dcStoreReader'] = dirname(__FILE__) .'/core/class.dc.store.reader.php';55 $__autoload['dcStoreParser'] = dirname(__FILE__) .'/core/class.dc.store.parser.php';56 $__autoload['rsExtPost'] = dirname(__FILE__) .'/core/class.dc.rs.extensions.php';57 $__autoload['rsExtComment'] = dirname(__FILE__) .'/core/class.dc.rs.extensions.php';58 $__autoload['rsExtDates'] = dirname(__FILE__) .'/core/class.dc.rs.extensions.php';59 $__autoload['rsExtUser'] = dirname(__FILE__) .'/core/class.dc.rs.extensions.php';60 61 $__autoload['dcUpgrade'] = dirname(__FILE__).'/dbschema/upgrade.php';62 63 $__autoload['dcMenu'] = dirname(__FILE__).'/admin/class.dc.menu.php';64 $__autoload['dcFavorites'] = dirname(__FILE__).'/admin/class.dc.favorites.php';65 $__autoload['dcPage'] = dirname(__FILE__).'/admin/lib.dc.page.php';66 $__autoload['adminGenericList'] = dirname(__FILE__).'/admin/lib.pager.php';67 $__autoload['adminPostList'] = dirname(__FILE__).'/admin/lib.pager.php';68 $__autoload['adminPostMiniList'] = dirname(__FILE__).'/admin/lib.pager.php';69 $__autoload['adminCommentList'] = dirname(__FILE__).'/admin/lib.pager.php';70 $__autoload['adminBlogList'] = dirname(__FILE__).'/admin/lib.pager.php';71 $__autoload['adminUserList'] = dirname(__FILE__).'/admin/lib.pager.php';72 $__autoload['dcPager'] = dirname(__FILE__).'/admin/lib.pager.php';73 $__autoload['dcAdminCombos'] = dirname(__FILE__).'/admin/lib.admincombos.php';74 $__autoload['adminModulesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php';75 $__autoload['adminThemesList'] = dirname(__FILE__).'/admin/lib.moduleslist.php';76 $__autoload['dcThemeConfig'] = dirname(__FILE__).'/admin/lib.themeconfig.php';77 $__autoload['dcAdminURL'] = dirname(__FILE__) .'/admin/lib.dc.adminurl.php';78 $__autoload['dcPostsActionsPage'] = dirname(__FILE__) .'/admin/actions/class.dcactionposts.php';79 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__) .'/admin/actions/class.dcactioncomments.php';80 $__autoload['dcBlogsActionsPage'] = dirname(__FILE__).'/admin/actions/class.dcactionblogs.php';81 $__autoload['dcActionsPage'] = dirname(__FILE__) .'/admin/actions/class.dcaction.php';82 83 $__autoload['dcTemplate'] = dirname(__FILE__).'/public/class.dc.template.php';84 $__autoload['context'] = dirname(__FILE__).'/public/lib.tpl.context.php';85 $__autoload['dcUrlHandlers'] = dirname(__FILE__).'/public/lib.urlhandlers.php';27 exit('No clearbricks path defined'); 28 } 29 30 require CLEARBRICKS_PATH . '/_common.php'; 31 32 $__autoload['dcCore'] = dirname(__FILE__) . '/core/class.dc.core.php'; 33 $__autoload['dcAuth'] = dirname(__FILE__) . '/core/class.dc.auth.php'; 34 $__autoload['dcBlog'] = dirname(__FILE__) . '/core/class.dc.blog.php'; 35 $__autoload['dcCategories'] = dirname(__FILE__) . '/core/class.dc.categories.php'; 36 $__autoload['dcError'] = dirname(__FILE__) . '/core/class.dc.error.php'; 37 $__autoload['dcMeta'] = dirname(__FILE__) . '/core/class.dc.meta.php'; 38 $__autoload['dcMedia'] = dirname(__FILE__) . '/core/class.dc.media.php'; 39 $__autoload['dcPostMedia'] = dirname(__FILE__) . '/core/class.dc.postmedia.php'; 40 $__autoload['dcModules'] = dirname(__FILE__) . '/core/class.dc.modules.php'; 41 $__autoload['dcPlugins'] = dirname(__FILE__) . '/core/class.dc.plugins.php'; 42 $__autoload['dcThemes'] = dirname(__FILE__) . '/core/class.dc.themes.php'; 43 $__autoload['dcRestServer'] = dirname(__FILE__) . '/core/class.dc.rest.php'; 44 $__autoload['dcNamespace'] = dirname(__FILE__) . '/core/class.dc.namespace.php'; 45 $__autoload['dcSettings'] = dirname(__FILE__) . '/core/class.dc.settings.php'; 46 $__autoload['dcTrackback'] = dirname(__FILE__) . '/core/class.dc.trackback.php'; 47 $__autoload['dcUpdate'] = dirname(__FILE__) . '/core/class.dc.update.php'; 48 $__autoload['dcUtils'] = dirname(__FILE__) . '/core/class.dc.utils.php'; 49 $__autoload['dcXmlRpc'] = dirname(__FILE__) . '/core/class.dc.xmlrpc.php'; 50 $__autoload['dcLog'] = dirname(__FILE__) . '/core/class.dc.log.php'; 51 $__autoload['dcWorkspace'] = dirname(__FILE__) . '/core/class.dc.workspace.php'; 52 $__autoload['dcPrefs'] = dirname(__FILE__) . '/core/class.dc.prefs.php'; 53 $__autoload['dcStore'] = dirname(__FILE__) . '/core/class.dc.store.php'; 54 $__autoload['dcStoreReader'] = dirname(__FILE__) . '/core/class.dc.store.reader.php'; 55 $__autoload['dcStoreParser'] = dirname(__FILE__) . '/core/class.dc.store.parser.php'; 56 $__autoload['rsExtPost'] = dirname(__FILE__) . '/core/class.dc.rs.extensions.php'; 57 $__autoload['rsExtComment'] = dirname(__FILE__) . '/core/class.dc.rs.extensions.php'; 58 $__autoload['rsExtDates'] = dirname(__FILE__) . '/core/class.dc.rs.extensions.php'; 59 $__autoload['rsExtUser'] = dirname(__FILE__) . '/core/class.dc.rs.extensions.php'; 60 61 $__autoload['dcUpgrade'] = dirname(__FILE__) . '/dbschema/upgrade.php'; 62 63 $__autoload['dcMenu'] = dirname(__FILE__) . '/admin/class.dc.menu.php'; 64 $__autoload['dcFavorites'] = dirname(__FILE__) . '/admin/class.dc.favorites.php'; 65 $__autoload['dcPage'] = dirname(__FILE__) . '/admin/lib.dc.page.php'; 66 $__autoload['adminGenericList'] = dirname(__FILE__) . '/admin/lib.pager.php'; 67 $__autoload['adminPostList'] = dirname(__FILE__) . '/admin/lib.pager.php'; 68 $__autoload['adminPostMiniList'] = dirname(__FILE__) . '/admin/lib.pager.php'; 69 $__autoload['adminCommentList'] = dirname(__FILE__) . '/admin/lib.pager.php'; 70 $__autoload['adminBlogList'] = dirname(__FILE__) . '/admin/lib.pager.php'; 71 $__autoload['adminUserList'] = dirname(__FILE__) . '/admin/lib.pager.php'; 72 $__autoload['dcPager'] = dirname(__FILE__) . '/admin/lib.pager.php'; 73 $__autoload['dcAdminCombos'] = dirname(__FILE__) . '/admin/lib.admincombos.php'; 74 $__autoload['adminModulesList'] = dirname(__FILE__) . '/admin/lib.moduleslist.php'; 75 $__autoload['adminThemesList'] = dirname(__FILE__) . '/admin/lib.moduleslist.php'; 76 $__autoload['dcThemeConfig'] = dirname(__FILE__) . '/admin/lib.themeconfig.php'; 77 $__autoload['dcAdminURL'] = dirname(__FILE__) . '/admin/lib.dc.adminurl.php'; 78 $__autoload['dcPostsActionsPage'] = dirname(__FILE__) . '/admin/actions/class.dcactionposts.php'; 79 $__autoload['dcCommentsActionsPage'] = dirname(__FILE__) . '/admin/actions/class.dcactioncomments.php'; 80 $__autoload['dcBlogsActionsPage'] = dirname(__FILE__) . '/admin/actions/class.dcactionblogs.php'; 81 $__autoload['dcActionsPage'] = dirname(__FILE__) . '/admin/actions/class.dcaction.php'; 82 83 $__autoload['dcTemplate'] = dirname(__FILE__) . '/public/class.dc.template.php'; 84 $__autoload['context'] = dirname(__FILE__) . '/public/lib.tpl.context.php'; 85 $__autoload['dcUrlHandlers'] = dirname(__FILE__) . '/public/lib.urlhandlers.php'; 86 86 87 87 # Clearbricks extensions … … 90 90 /* ------------------------------------------------------------------------------------------- */ 91 91 92 93 92 mb_internal_encoding('UTF-8'); 94 93 … … 97 96 98 97 # CLI_MODE, boolean constant that tell if we are in CLI mode 99 define('CLI_MODE', PHP_SAPI == 'cli');98 define('CLI_MODE', PHP_SAPI == 'cli'); 100 99 101 100 # Disallow every special wrapper 102 if (function_exists('stream_wrapper_unregister')) 103 { 104 foreach (array('http','https','ftp','ftps','ssh2.shell','ssh2.exec', 105 'ssh2.tunnel','ssh2.sftp','ssh2.scp','ogg','expect')as $p) {106 107 101 if (function_exists('stream_wrapper_unregister')) { 102 $special_wrappers = array_intersect(array('http', 'https', 'ftp', 'ftps', 'ssh2.shell', 'ssh2.exec', 103 'ssh2.tunnel', 'ssh2.sftp', 'ssh2.scp', 'ogg', 'expect'), stream_get_wrappers()); 104 foreach ($special_wrappers as $p) { 105 @stream_wrapper_unregister($p); 106 } 108 107 } 109 108 110 109 if (isset($_SERVER['DC_RC_PATH'])) { 111 define('DC_RC_PATH',$_SERVER['DC_RC_PATH']);110 define('DC_RC_PATH', $_SERVER['DC_RC_PATH']); 112 111 } elseif (isset($_SERVER['REDIRECT_DC_RC_PATH'])) { 113 define('DC_RC_PATH',$_SERVER['REDIRECT_DC_RC_PATH']);112 define('DC_RC_PATH', $_SERVER['REDIRECT_DC_RC_PATH']); 114 113 } else { 115 define('DC_RC_PATH',dirname(__FILE__).'/config.php'); 116 } 117 118 if (!is_file(DC_RC_PATH)) 119 { 120 if (strpos($_SERVER['SCRIPT_FILENAME'],'/admin') === false) { 121 $path = 'admin/install/wizard.php'; 122 } else { 123 $path = strpos($_SERVER['PHP_SELF'],'/install') === false ? 'install/wizard.php' : 'wizard.php'; 124 } 125 http::redirect($path); 114 define('DC_RC_PATH', dirname(__FILE__) . '/config.php'); 115 } 116 117 if (!is_file(DC_RC_PATH)) { 118 if (strpos($_SERVER['SCRIPT_FILENAME'], '/admin') === false) { 119 $path = 'admin/install/wizard.php'; 120 } else { 121 $path = strpos($_SERVER['PHP_SELF'], '/install') === false ? 'install/wizard.php' : 'wizard.php'; 122 } 123 http::redirect($path); 126 124 } 127 125 … … 130 128 //*== DC_DEBUG == 131 129 if (!defined('DC_DEBUG')) { 132 define('DC_DEBUG',true);130 define('DC_DEBUG', true); 133 131 } 134 132 if (DC_DEBUG) { 135 ini_set('display_errors',true);136 133 ini_set('display_errors', true); 134 error_reporting(E_ALL | E_STRICT); 137 135 } 138 136 //*/ 139 137 140 138 if (!defined('DC_DEBUG')) { 141 define('DC_DEBUG',false);139 define('DC_DEBUG', false); 142 140 } 143 141 144 142 # Constants 145 define('DC_ROOT', path::real(dirname(__FILE__).'/..'));146 define('DC_VERSION', '2.14-dev');147 define('DC_DIGESTS', dirname(__FILE__).'/digests');148 define('DC_L10N_ROOT', dirname(__FILE__).'/../locales');149 define('DC_L10N_UPDATE_URL', 'http://services.dotclear.net/dc2.l10n/?version=%s');150 define('DC_DISTRIB_PLUGINS', 'aboutConfig,akismet,antispam,attachments,blogroll,blowupConfig,dclegacy,fairTrackbacks,importExport,maintenance,pages,pings,simpleMenu,tags,themeEditor,userPref,widgets,dcLegacyEditor,dcCKEditor,breadcrumb');151 define('DC_DISTRIB_THEMES', 'berlin,blueSilence,blowupConfig,customCSS,default,ductile');152 define('DC_DEFAULT_TPLSET', 'mustek');153 define('DC_DEFAULT_JQUERY', '2.2.4');143 define('DC_ROOT', path::real(dirname(__FILE__) . '/..')); 144 define('DC_VERSION', '2.14-dev'); 145 define('DC_DIGESTS', dirname(__FILE__) . '/digests'); 146 define('DC_L10N_ROOT', dirname(__FILE__) . '/../locales'); 147 define('DC_L10N_UPDATE_URL', 'http://services.dotclear.net/dc2.l10n/?version=%s'); 148 define('DC_DISTRIB_PLUGINS', 'aboutConfig,akismet,antispam,attachments,blogroll,blowupConfig,dclegacy,fairTrackbacks,importExport,maintenance,pages,pings,simpleMenu,tags,themeEditor,userPref,widgets,dcLegacyEditor,dcCKEditor,breadcrumb'); 149 define('DC_DISTRIB_THEMES', 'berlin,blueSilence,blowupConfig,customCSS,default,ductile'); 150 define('DC_DEFAULT_TPLSET', 'mustek'); 151 define('DC_DEFAULT_JQUERY', '2.2.4'); 154 152 155 153 if (!defined('DC_NEXT_REQUIRED_PHP')) { 156 define('DC_NEXT_REQUIRED_PHP','5.5');// Announced in 2.12, will be required in 2.13154 define('DC_NEXT_REQUIRED_PHP', '5.5'); // Announced in 2.12, will be required in 2.13 157 155 } 158 156 159 157 if (!defined('DC_VENDOR_NAME')) { 160 define('DC_VENDOR_NAME','Dotclear');158 define('DC_VENDOR_NAME', 'Dotclear'); 161 159 } 162 160 163 161 if (!defined('DC_XMLRPC_URL')) { 164 define('DC_XMLRPC_URL','%1$sxmlrpc/%2$s');162 define('DC_XMLRPC_URL', '%1$sxmlrpc/%2$s'); 165 163 } 166 164 167 165 if (!defined('DC_SESSION_TTL')) { 168 define('DC_SESSION_TTL',null);166 define('DC_SESSION_TTL', null); 169 167 } 170 168 171 169 if (!defined('DC_ADMIN_SSL')) { 172 define('DC_ADMIN_SSL',false);170 define('DC_ADMIN_SSL', false); 173 171 } 174 172 175 173 if (defined('DC_FORCE_SCHEME_443') && DC_FORCE_SCHEME_443) { 176 174 http::$https_scheme_on_443 = true; 177 175 } 178 176 179 177 if (!defined('DC_DBPERSIST')) { 180 define('DC_DBPERSIST',false);178 define('DC_DBPERSIST', false); 181 179 } 182 180 183 181 if (!defined('DC_UPDATE_URL')) { 184 define('DC_UPDATE_URL','http://download.dotclear.org/versions.xml');182 define('DC_UPDATE_URL', 'http://download.dotclear.org/versions.xml'); 185 183 } 186 184 187 185 if (!defined('DC_UPDATE_VERSION')) { 188 define('DC_UPDATE_VERSION','stable');186 define('DC_UPDATE_VERSION', 'stable'); 189 187 } 190 188 191 189 if (!defined('DC_NOT_UPDATE')) { 192 define('DC_NOT_UPDATE',false);190 define('DC_NOT_UPDATE', false); 193 191 } 194 192 195 193 if (!defined('DC_ALLOW_MULTI_MODULES')) { 196 define('DC_ALLOW_MULTI_MODULES',false);194 define('DC_ALLOW_MULTI_MODULES', false); 197 195 } 198 196 199 197 if (!defined('DC_CRYPT_ALGO')) { 200 define('DC_CRYPT_ALGO','sha1');// As in Dotclear 2.9 and previous198 define('DC_CRYPT_ALGO', 'sha1'); // As in Dotclear 2.9 and previous 201 199 } else { 202 203 if (strlen(crypt::hmac(DC_MASTER_KEY,DC_VENDOR_NAME,DC_CRYPT_ALGO)) < 40) {204 205 __error('Server error','Site temporarily unavailable');206 207 __error('Dotclear error',DC_CRYPT_ALGO.' cryptographic algorithm configured is not strong enough, please change it.');208 209 210 200 // Check length of cryptographic algorithm result and exit if less than 40 characters long 201 if (strlen(crypt::hmac(DC_MASTER_KEY, DC_VENDOR_NAME, DC_CRYPT_ALGO)) < 40) { 202 if (!defined('DC_CONTEXT_ADMIN')) { 203 __error('Server error', 'Site temporarily unavailable'); 204 } else { 205 __error('Dotclear error', DC_CRYPT_ALGO . ' cryptographic algorithm configured is not strong enough, please change it.'); 206 } 207 exit; 208 } 211 209 } 212 210 213 211 if (!defined('DC_VAR')) { 214 define('DC_VAR',path::real(dirname(__FILE__).'/..').'/var');212 define('DC_VAR', path::real(dirname(__FILE__) . '/..') . '/var'); 215 213 } 216 214 // Check existence of var directory 217 215 if (!is_dir(DC_VAR)) { 218 219 220 221 222 223 __error('Server error','Site temporarily unavailable');224 225 __error('Dotclear error',DC_VAR.' directory does not exist. Please create it.');226 227 228 216 // Try to create it 217 @files::makeDir(DC_VAR); 218 if (!is_dir(DC_VAR)) { 219 // Admin must create it 220 if (!defined('DC_CONTEXT_ADMIN')) { 221 __error('Server error', 'Site temporarily unavailable'); 222 } else { 223 __error('Dotclear error', DC_VAR . ' directory does not exist. Please create it.'); 224 } 225 exit; 226 } 229 227 } 230 228 … … 232 230 233 231 try { 234 $core = new dcCore(DC_DBDRIVER,DC_DBHOST,DC_DBNAME,DC_DBUSER,DC_DBPASSWORD,DC_DBPREFIX,DC_DBPERSIST);232 $core = new dcCore(DC_DBDRIVER, DC_DBHOST, DC_DBNAME, DC_DBUSER, DC_DBPASSWORD, DC_DBPREFIX, DC_DBPERSIST); 235 233 } catch (Exception $e) { 236 237 238 239 __('<p>We apologize for this temporary unavailability.<br />'.240 241 242 243 244 ,$e->getCode() == 0 ?245 sprintf(__('<p>This either means that the username and password information in '.246 'your <strong>config.php</strong> file is incorrect or we can\'t contact '.247 'the database server at "<em>%s</em>". This could mean your '.248 'host\'s database server is down.</p> '.249 '<ul><li>Are you sure you have the correct username and password?</li>'.250 '<li>Are you sure that you have typed the correct hostname?</li>'.251 '<li>Are you sure that the database server is running?</li></ul>'.252 '<p>If you\'re unsure what these terms mean you should probably contact '.253 'your host. If you still need help you can always visit the '.254 '<a href="http://forum.dotclear.net/">Dotclear Support Forums</a>.</p>').255 256 __('The following error was encountered while trying to read the database:').'</p><ul><li>'.$e->getMessage().'</li></ul>' :'')257 ,(DC_DBHOST != '' ? DC_DBHOST : 'localhost')258 259 260 ,20);261 234 init_prepend_l10n(); 235 if (!defined('DC_CONTEXT_ADMIN')) { 236 __error(__('Site temporarily unavailable'), 237 __('<p>We apologize for this temporary unavailability.<br />' . 238 'Thank you for your understanding.</p>'), 239 20); 240 } else { 241 __error(__('Unable to connect to database') 242 , $e->getCode() == 0 ? 243 sprintf(__('<p>This either means that the username and password information in ' . 244 'your <strong>config.php</strong> file is incorrect or we can\'t contact ' . 245 'the database server at "<em>%s</em>". This could mean your ' . 246 'host\'s database server is down.</p> ' . 247 '<ul><li>Are you sure you have the correct username and password?</li>' . 248 '<li>Are you sure that you have typed the correct hostname?</li>' . 249 '<li>Are you sure that the database server is running?</li></ul>' . 250 '<p>If you\'re unsure what these terms mean you should probably contact ' . 251 'your host. If you still need help you can always visit the ' . 252 '<a href="http://forum.dotclear.net/">Dotclear Support Forums</a>.</p>') . 253 (DC_DEBUG ? 254 __('The following error was encountered while trying to read the database:') . '</p><ul><li>' . $e->getMessage() . '</li></ul>' : '') 255 , (DC_DBHOST != '' ? DC_DBHOST : 'localhost') 256 ) 257 : '' 258 , 20); 259 } 262 260 } 263 261 264 262 # If we have some __top_behaviors, we load them 265 if (isset($__top_behaviors) && is_array($__top_behaviors)) 266 { 267 foreach ($__top_behaviors as $b) { 268 $core->addBehavior($b[0],$b[1]); 269 } 270 unset($b); 263 if (isset($__top_behaviors) && is_array($__top_behaviors)) { 264 foreach ($__top_behaviors as $b) { 265 $core->addBehavior($b[0], $b[1]); 266 } 267 unset($b); 271 268 } 272 269 273 270 http::trimRequest(); 274 271 try { 275 272 http::unsetGlobals(); 276 273 } catch (Exception $e) { 277 278 279 280 } 281 282 $core->url->registerDefault(array('dcUrlHandlers', 'home'));283 $core->url->registerError(array('dcUrlHandlers', 'default404'));284 $core->url->register('lang', '','^([a-zA-Z]{2}(?:-[a-z]{2})?(?:/page/[0-9]+)?)$',array('dcUrlHandlers','lang'));285 $core->url->register('post', 'post','^post/(.+)$',array('dcUrlHandlers','post'));286 $core->url->register('preview', 'preview','^preview/(.+)$',array('dcUrlHandlers','preview'));287 $core->url->register('category', 'category','^category/(.+)$',array('dcUrlHandlers','category'));288 $core->url->register('archive', 'archive','^archive(/.+)?$',array('dcUrlHandlers','archive'));289 290 $core->url->register('feed', 'feed','^feed/(.+)$',array('dcUrlHandlers','feed'));291 $core->url->register('trackback', 'trackback','^trackback/(.+)$',array('dcUrlHandlers','trackback'));292 $core->url->register('webmention', 'webmention','^webmention(/.+)?$',array('dcUrlHandlers','webmention'));293 $core->url->register('rsd', 'rsd','^rsd$',array('dcUrlHandlers','rsd'));294 $core->url->register('xmlrpc', 'xmlrpc','^xmlrpc/(.+)$',array('dcUrlHandlers','xmlrpc'));274 header('Content-Type: text/plain'); 275 echo $e->getMessage(); 276 exit; 277 } 278 279 $core->url->registerDefault(array('dcUrlHandlers', 'home')); 280 $core->url->registerError(array('dcUrlHandlers', 'default404')); 281 $core->url->register('lang', '', '^([a-zA-Z]{2}(?:-[a-z]{2})?(?:/page/[0-9]+)?)$', array('dcUrlHandlers', 'lang')); 282 $core->url->register('post', 'post', '^post/(.+)$', array('dcUrlHandlers', 'post')); 283 $core->url->register('preview', 'preview', '^preview/(.+)$', array('dcUrlHandlers', 'preview')); 284 $core->url->register('category', 'category', '^category/(.+)$', array('dcUrlHandlers', 'category')); 285 $core->url->register('archive', 'archive', '^archive(/.+)?$', array('dcUrlHandlers', 'archive')); 286 287 $core->url->register('feed', 'feed', '^feed/(.+)$', array('dcUrlHandlers', 'feed')); 288 $core->url->register('trackback', 'trackback', '^trackback/(.+)$', array('dcUrlHandlers', 'trackback')); 289 $core->url->register('webmention', 'webmention', '^webmention(/.+)?$', array('dcUrlHandlers', 'webmention')); 290 $core->url->register('rsd', 'rsd', '^rsd$', array('dcUrlHandlers', 'rsd')); 291 $core->url->register('xmlrpc', 'xmlrpc', '^xmlrpc/(.+)$', array('dcUrlHandlers', 'xmlrpc')); 295 292 296 293 // Should use dcAdminURL class, but only in admin -> to be moved to public/prepend.php and admin/prepend.php ? 297 $core->setPostType('post', 'post.php?id=%d',$core->url->getURLFor('post','%s'),'Posts');294 $core->setPostType('post', 'post.php?id=%d', $core->url->getURLFor('post', '%s'), 'Posts'); 298 295 299 296 # Store upload_max_filesize in bytes … … 301 298 $p_max_size = files::str2bytes(ini_get('post_max_size')); 302 299 if ($p_max_size < $u_max_size) { 303 304 } 305 define('DC_MAX_UPLOAD_SIZE', $u_max_size);306 unset($u_max_size); 300 $u_max_size = $p_max_size; 301 } 302 define('DC_MAX_UPLOAD_SIZE', $u_max_size); 303 unset($u_max_size);unset($p_max_size); 307 304 308 305 # Register supplemental mime types 309 306 files::registerMimeTypes(array( 310 311 'aac'=> 'audio/aac',312 'ogg'=> 'audio/ogg',313 'weba'=> 'audio/webm',314 'm4a'=> 'audio/mp4',315 316 'mp4'=> 'video/mp4',317 'm4p'=> 'video/mp4',318 'webm'=> 'video/webm'319 307 // Audio 308 'aac' => 'audio/aac', 309 'ogg' => 'audio/ogg', 310 'weba' => 'audio/webm', 311 'm4a' => 'audio/mp4', 312 // Video 313 'mp4' => 'video/mp4', 314 'm4p' => 'video/mp4', 315 'webm' => 'video/webm' 316 )); 320 317 321 318 # Shutdown … … 324 321 function __shutdown() 325 322 { 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 } 342 343 function __error($summary, $message,$code=0)323 global $__shutdown; 324 if (is_array($__shutdown)) { 325 foreach ($__shutdown as $f) { 326 if (is_callable($f)) { 327 call_user_func($f); 328 } 329 } 330 } 331 # Explicitly close session before DB connection 332 try { 333 if (session_id()) { 334 session_write_close(); 335 } 336 } catch (Exception $e) {} 337 $GLOBALS['core']->con->close(); 338 } 339 340 function __error($summary, $message, $code = 0) 344 341 { 345 # Error codes 346 # 10 : no config file 347 # 20 : database issue 348 # 30 : blog is not defined 349 # 40 : template files creation 350 # 50 : no default theme 351 # 60 : template processing error 352 # 70 : blog is offline 353 354 if (CLI_MODE) 355 { 356 trigger_error($summary,E_USER_ERROR); 357 exit(1); 358 } 359 else 360 { 361 if (defined('DC_ERRORFILE') && is_file(DC_ERRORFILE)) { 362 include DC_ERRORFILE; 363 } else { 364 include dirname(__FILE__).'/core_error.php'; 365 } 366 exit; 367 } 342 # Error codes 343 # 10 : no config file 344 # 20 : database issue 345 # 30 : blog is not defined 346 # 40 : template files creation 347 # 50 : no default theme 348 # 60 : template processing error 349 # 70 : blog is offline 350 351 if (CLI_MODE) { 352 trigger_error($summary, E_USER_ERROR); 353 exit(1); 354 } else { 355 if (defined('DC_ERRORFILE') && is_file(DC_ERRORFILE)) { 356 include DC_ERRORFILE; 357 } else { 358 include dirname(__FILE__) . '/core_error.php'; 359 } 360 exit; 361 } 368 362 } 369 363 370 364 function init_prepend_l10n() 371 365 { 372 # Loading locales for detected language 373 $dlang = http::getAcceptLanguages(); 374 foreach($dlang as $l) 375 { 376 if ($l == 'en' || l10n::set(dirname(__FILE__).'/../locales/'.$l.'/main') !== false) { 377 l10n::lang($l); 378 break; 379 } 380 } 381 } 366 # Loading locales for detected language 367 $dlang = http::getAcceptLanguages(); 368 foreach ($dlang as $l) { 369 if ($l == 'en' || l10n::set(dirname(__FILE__) . '/../locales/' . $l . '/main') !== false) { 370 l10n::lang($l); 371 break; 372 } 373 } 374 }
Note: See TracChangeset
for help on using the changeset viewer.