| [0] | 1 | <?php | 
|---|
|  | 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- | 
|---|
|  | 3 | # | 
|---|
|  | 4 | # This file is part of Dotclear 2. | 
|---|
|  | 5 | # | 
|---|
| [1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear | 
|---|
| [0] | 7 | # Licensed under the GPL version 2.0 license. | 
|---|
|  | 8 | # See LICENSE file or | 
|---|
|  | 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 
|---|
|  | 10 | # | 
|---|
|  | 11 | # -- END LICENSE BLOCK ----------------------------------------- | 
|---|
|  | 12 |  | 
|---|
|  | 13 | if (!empty($_GET['pf'])) { | 
|---|
|  | 14 | require dirname(__FILE__).'/../load_plugin_file.php'; | 
|---|
|  | 15 | exit; | 
|---|
|  | 16 | } | 
|---|
|  | 17 |  | 
|---|
|  | 18 | if (!isset($_SERVER['PATH_INFO'])) { | 
|---|
|  | 19 | $_SERVER['PATH_INFO'] = ''; | 
|---|
|  | 20 | } | 
|---|
|  | 21 |  | 
|---|
|  | 22 | require_once dirname(__FILE__).'/../prepend.php'; | 
|---|
|  | 23 | require_once dirname(__FILE__).'/rs.extension.php'; | 
|---|
|  | 24 |  | 
|---|
|  | 25 | # Loading blog | 
|---|
|  | 26 | if (defined('DC_BLOG_ID')) { | 
|---|
|  | 27 | try { | 
|---|
|  | 28 | $core->setBlog(DC_BLOG_ID); | 
|---|
|  | 29 | } catch (Exception $e) { | 
|---|
|  | 30 | init_prepend_l10n(); | 
|---|
|  | 31 | __error(__('Database problem') | 
|---|
|  | 32 | ,DC_DEBUG ? | 
|---|
|  | 33 | __('The following error was encountered while trying to read the database:').'</p><ul><li>'.$e->getMessage().'</li></ul>' : | 
|---|
|  | 34 | __('Something went wrong while trying to read the database.') | 
|---|
| [921] | 35 | ,620); | 
|---|
| [0] | 36 | } | 
|---|
|  | 37 | } | 
|---|
|  | 38 |  | 
|---|
|  | 39 | if ($core->blog->id == null) { | 
|---|
|  | 40 | __error(__('Blog is not defined.') | 
|---|
|  | 41 | ,__('Did you change your Blog ID?') | 
|---|
| [921] | 42 | ,630); | 
|---|
| [0] | 43 | } | 
|---|
|  | 44 |  | 
|---|
|  | 45 | if ((boolean)!$core->blog->status) { | 
|---|
|  | 46 | $core->unsetBlog(); | 
|---|
|  | 47 | __error(__('Blog is offline.') | 
|---|
|  | 48 | ,__('This blog is offline. Please try again later.') | 
|---|
| [921] | 49 | ,670); | 
|---|
| [0] | 50 | } | 
|---|
|  | 51 |  | 
|---|
|  | 52 | # Loading media | 
|---|
|  | 53 | try { | 
|---|
|  | 54 | $core->media = new dcMedia($core); | 
|---|
|  | 55 | } catch (Exception $e) {} | 
|---|
|  | 56 |  | 
|---|
|  | 57 | # Creating template context | 
|---|
|  | 58 | $_ctx = new context(); | 
|---|
|  | 59 | try { | 
|---|
|  | 60 | $core->tpl = new dcTemplate(DC_TPL_CACHE,'$core->tpl',$core); | 
|---|
|  | 61 | } catch (Exception $e) { | 
|---|
|  | 62 | __error(__('Can\'t create template files.') | 
|---|
|  | 63 | ,$e->getMessage() | 
|---|
| [921] | 64 | ,640); | 
|---|
| [0] | 65 | } | 
|---|
|  | 66 |  | 
|---|
|  | 67 | # Loading locales | 
|---|
|  | 68 | $_lang = $core->blog->settings->system->lang; | 
|---|
|  | 69 | $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_lang) ? $_lang : 'en'; | 
|---|
|  | 70 |  | 
|---|
| [1949] | 71 | l10n::lang($_lang); | 
|---|
| [0] | 72 | if (l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') { | 
|---|
|  | 73 | l10n::set(dirname(__FILE__).'/../../locales/en/date'); | 
|---|
|  | 74 | } | 
|---|
|  | 75 | l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/public'); | 
|---|
|  | 76 | l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/plugins'); | 
|---|
|  | 77 |  | 
|---|
|  | 78 | # Loading plugins | 
|---|
|  | 79 | try { | 
|---|
|  | 80 | $core->plugins->loadModules(DC_PLUGINS_ROOT,'public',$_lang); | 
|---|
|  | 81 | } catch (Exception $e) {} | 
|---|
|  | 82 |  | 
|---|
|  | 83 | # Loading themes | 
|---|
|  | 84 | $core->themes = new dcThemes($core); | 
|---|
|  | 85 | $core->themes->loadModules($core->blog->themes_path); | 
|---|
|  | 86 |  | 
|---|
|  | 87 | # Defining theme if not defined | 
|---|
|  | 88 | if (!isset($__theme)) { | 
|---|
|  | 89 | $__theme = $core->blog->settings->system->theme; | 
|---|
|  | 90 | } | 
|---|
|  | 91 |  | 
|---|
|  | 92 | if (!$core->themes->moduleExists($__theme)) { | 
|---|
|  | 93 | $__theme = $core->blog->settings->system->theme = 'default'; | 
|---|
|  | 94 | } | 
|---|
|  | 95 |  | 
|---|
|  | 96 | $__parent_theme = $core->themes->moduleInfo($__theme,'parent'); | 
|---|
|  | 97 | if ($__parent_theme) { | 
|---|
|  | 98 | if (!$core->themes->moduleExists($__parent_theme)) { | 
|---|
|  | 99 | $__theme = $core->blog->settings->system->theme = 'default'; | 
|---|
|  | 100 | $__parent_theme = null; | 
|---|
|  | 101 | } | 
|---|
|  | 102 | } | 
|---|
|  | 103 |  | 
|---|
|  | 104 | # If theme doesn't exist, stop everything | 
|---|
|  | 105 | if (!$core->themes->moduleExists($__theme)) { | 
|---|
|  | 106 | __error(__('Default theme not found.') | 
|---|
|  | 107 | ,__('This either means you removed your default theme or set a wrong theme '. | 
|---|
|  | 108 | 'path in your blog configuration. Please check theme_path value in '. | 
|---|
|  | 109 | 'about:config module or reinstall default theme. ('.$__theme.')') | 
|---|
| [921] | 110 | ,650); | 
|---|
| [0] | 111 | } | 
|---|
|  | 112 |  | 
|---|
|  | 113 | # Loading _public.php file for selected theme | 
|---|
|  | 114 | $core->themes->loadNsFile($__theme,'public'); | 
|---|
|  | 115 |  | 
|---|
| [420] | 116 | # Loading translations for selected theme | 
|---|
|  | 117 | if ($__parent_theme) { | 
|---|
|  | 118 | $core->themes->loadModuleL10N($__parent_theme,$_lang,'main'); | 
|---|
|  | 119 | } | 
|---|
|  | 120 | $core->themes->loadModuleL10N($__theme,$_lang,'main'); | 
|---|
|  | 121 |  | 
|---|
| [0] | 122 | # --BEHAVIOR-- publicPrepend | 
|---|
|  | 123 | $core->callBehavior('publicPrepend',$core); | 
|---|
|  | 124 |  | 
|---|
|  | 125 | # Prepare the HTTP cache thing | 
|---|
|  | 126 | $mod_files = get_included_files(); | 
|---|
|  | 127 | $mod_ts = array(); | 
|---|
|  | 128 | $mod_ts[] = $core->blog->upddt; | 
|---|
|  | 129 |  | 
|---|
|  | 130 | $__theme_tpl_path = array( | 
|---|
|  | 131 | $core->blog->themes_path.'/'.$__theme.'/tpl' | 
|---|
|  | 132 | ); | 
|---|
|  | 133 | if ($__parent_theme) { | 
|---|
|  | 134 | $__theme_tpl_path[] = $core->blog->themes_path.'/'.$__parent_theme.'/tpl'; | 
|---|
|  | 135 | } | 
|---|
|  | 136 |  | 
|---|
|  | 137 | $core->tpl->setPath( | 
|---|
|  | 138 | $__theme_tpl_path, | 
|---|
|  | 139 | dirname(__FILE__).'/default-templates', | 
|---|
|  | 140 | $core->tpl->getPath()); | 
|---|
|  | 141 |  | 
|---|
|  | 142 | $core->url->mode = $core->blog->settings->system->url_scan; | 
|---|
|  | 143 |  | 
|---|
|  | 144 | try { | 
|---|
|  | 145 | # --BEHAVIOR-- publicBeforeDocument | 
|---|
|  | 146 | $core->callBehavior('publicBeforeDocument',$core); | 
|---|
|  | 147 |  | 
|---|
|  | 148 | $core->url->getDocument(); | 
|---|
|  | 149 |  | 
|---|
|  | 150 | # --BEHAVIOR-- publicAfterDocument | 
|---|
|  | 151 | $core->callBehavior('publicAfterDocument',$core); | 
|---|
|  | 152 | } catch (Exception $e) { | 
|---|
|  | 153 | __error($e->getMessage() | 
|---|
|  | 154 | ,__('Something went wrong while loading template file for your blog.') | 
|---|
| [921] | 155 | ,660); | 
|---|
| [0] | 156 | } | 
|---|
|  | 157 | ?> | 
|---|