Changeset 3730:5c45a5df9a59 for inc/public/prepend.php
- Timestamp:
- 03/08/18 17:58:39 (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
inc/public/prepend.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inc/public/prepend.php
r3260 r3730 12 12 13 13 if (!empty($_GET['pf'])) { 14 require dirname(__FILE__).'/../load_plugin_file.php';15 exit;14 require dirname(__FILE__) . '/../load_plugin_file.php'; 15 exit; 16 16 } 17 17 18 18 if (!empty($_GET['vf'])) { 19 require dirname(__FILE__).'/../load_var_file.php';20 exit;19 require dirname(__FILE__) . '/../load_var_file.php'; 20 exit; 21 21 } 22 22 23 23 if (!isset($_SERVER['PATH_INFO'])) { 24 $_SERVER['PATH_INFO'] = '';24 $_SERVER['PATH_INFO'] = ''; 25 25 } 26 26 27 require_once dirname(__FILE__) .'/../prepend.php';28 require_once dirname(__FILE__) .'/rs.extension.php';27 require_once dirname(__FILE__) . '/../prepend.php'; 28 require_once dirname(__FILE__) . '/rs.extension.php'; 29 29 30 30 # Loading blog 31 31 if (defined('DC_BLOG_ID')) { 32 try {33 $core->setBlog(DC_BLOG_ID);34 } catch (Exception $e) {35 init_prepend_l10n();36 __error(__('Database problem')37 ,DC_DEBUG ?38 __('The following error was encountered while trying to read the database:').'</p><ul><li>'.$e->getMessage().'</li></ul>' :39 __('Something went wrong while trying to read the database.')40 ,620);41 }32 try { 33 $core->setBlog(DC_BLOG_ID); 34 } catch (Exception $e) { 35 init_prepend_l10n(); 36 __error(__('Database problem') 37 , DC_DEBUG ? 38 __('The following error was encountered while trying to read the database:') . '</p><ul><li>' . $e->getMessage() . '</li></ul>' : 39 __('Something went wrong while trying to read the database.') 40 , 620); 41 } 42 42 } 43 43 44 44 if ($core->blog->id == null) { 45 __error(__('Blog is not defined.')46 ,__('Did you change your Blog ID?')47 ,630);45 __error(__('Blog is not defined.') 46 , __('Did you change your Blog ID?') 47 , 630); 48 48 } 49 49 50 if ((boolean) !$core->blog->status) {51 $core->unsetBlog();52 __error(__('Blog is offline.')53 ,__('This blog is offline. Please try again later.')54 ,670);50 if ((boolean) !$core->blog->status) { 51 $core->unsetBlog(); 52 __error(__('Blog is offline.') 53 , __('This blog is offline. Please try again later.') 54 , 670); 55 55 } 56 56 57 57 # Loading media 58 58 try { 59 $core->media = new dcMedia($core);59 $core->media = new dcMedia($core); 60 60 } catch (Exception $e) {} 61 61 … … 63 63 $_ctx = new context(); 64 64 try { 65 $core->tpl = new dcTemplate(DC_TPL_CACHE,'$core->tpl',$core);65 $core->tpl = new dcTemplate(DC_TPL_CACHE, '$core->tpl', $core); 66 66 } catch (Exception $e) { 67 __error(__('Can\'t create template files.')68 ,$e->getMessage()69 ,640);67 __error(__('Can\'t create template files.') 68 , $e->getMessage() 69 , 640); 70 70 } 71 71 72 72 # Loading locales 73 73 $_lang = $core->blog->settings->system->lang; 74 $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en';74 $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en'; 75 75 76 76 l10n::lang($_lang); 77 if (l10n::set(dirname(__FILE__) .'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') {78 l10n::set(dirname(__FILE__).'/../../locales/en/date');77 if (l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/date') === false && $_lang != 'en') { 78 l10n::set(dirname(__FILE__) . '/../../locales/en/date'); 79 79 } 80 l10n::set(dirname(__FILE__) .'/../../locales/'.$_lang.'/public');81 l10n::set(dirname(__FILE__) .'/../../locales/'.$_lang.'/plugins');80 l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/public'); 81 l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/plugins'); 82 82 83 83 // Set lexical lang 84 dcUtils::setlexicalLang('public', $_lang);84 dcUtils::setlexicalLang('public', $_lang); 85 85 86 86 # Loading plugins 87 87 try { 88 $core->plugins->loadModules(DC_PLUGINS_ROOT,'public',$_lang);88 $core->plugins->loadModules(DC_PLUGINS_ROOT, 'public', $_lang); 89 89 } catch (Exception $e) {} 90 90 … … 95 95 # Defining theme if not defined 96 96 if (!isset($__theme)) { 97 $__theme = $core->blog->settings->system->theme;97 $__theme = $core->blog->settings->system->theme; 98 98 } 99 99 100 100 if (!$core->themes->moduleExists($__theme)) { 101 $__theme = $core->blog->settings->system->theme = 'default';101 $__theme = $core->blog->settings->system->theme = 'default'; 102 102 } 103 103 104 $__parent_theme = $core->themes->moduleInfo($__theme, 'parent');104 $__parent_theme = $core->themes->moduleInfo($__theme, 'parent'); 105 105 if ($__parent_theme) { 106 if (!$core->themes->moduleExists($__parent_theme)) {107 $__theme = $core->blog->settings->system->theme= 'default';108 $__parent_theme = null;109 }106 if (!$core->themes->moduleExists($__parent_theme)) { 107 $__theme = $core->blog->settings->system->theme = 'default'; 108 $__parent_theme = null; 109 } 110 110 } 111 111 112 112 # If theme doesn't exist, stop everything 113 113 if (!$core->themes->moduleExists($__theme)) { 114 __error(__('Default theme not found.')115 ,__('This either means you removed your default theme or set a wrong theme '.116 'path in your blog configuration. Please check theme_path value in '.117 'about:config module or reinstall default theme. ('.$__theme.')')118 ,650);114 __error(__('Default theme not found.') 115 , __('This either means you removed your default theme or set a wrong theme ' . 116 'path in your blog configuration. Please check theme_path value in ' . 117 'about:config module or reinstall default theme. (' . $__theme . ')') 118 , 650); 119 119 } 120 120 121 121 # Loading _public.php file for selected theme 122 $core->themes->loadNsFile($__theme, 'public');122 $core->themes->loadNsFile($__theme, 'public'); 123 123 124 124 # Loading translations for selected theme 125 125 if ($__parent_theme) { 126 $core->themes->loadModuleL10N($__parent_theme,$_lang,'main');126 $core->themes->loadModuleL10N($__parent_theme, $_lang, 'main'); 127 127 } 128 $core->themes->loadModuleL10N($__theme, $_lang,'main');128 $core->themes->loadModuleL10N($__theme, $_lang, 'main'); 129 129 130 130 # --BEHAVIOR-- publicPrepend 131 $core->callBehavior('publicPrepend', $core);131 $core->callBehavior('publicPrepend', $core); 132 132 133 133 # Prepare the HTTP cache thing 134 134 $mod_files = get_included_files(); 135 $mod_ts = array();136 $mod_ts[] = $core->blog->upddt;135 $mod_ts = array(); 136 $mod_ts[] = $core->blog->upddt; 137 137 138 138 $__theme_tpl_path = array( 139 $core->blog->themes_path.'/'.$__theme.'/tpl'139 $core->blog->themes_path . '/' . $__theme . '/tpl' 140 140 ); 141 141 if ($__parent_theme) { 142 $__theme_tpl_path[] = $core->blog->themes_path.'/'.$__parent_theme.'/tpl';142 $__theme_tpl_path[] = $core->blog->themes_path . '/' . $__parent_theme . '/tpl'; 143 143 } 144 $tplset = $core->themes->moduleInfo($core->blog->settings->system->theme, 'tplset');145 if (!empty($tplset) && is_dir(dirname(__FILE__) .'/default-templates/'.$tplset)) {146 $core->tpl->setPath(147 $__theme_tpl_path,148 dirname(__FILE__).'/default-templates/'.$tplset,149 $core->tpl->getPath());144 $tplset = $core->themes->moduleInfo($core->blog->settings->system->theme, 'tplset'); 145 if (!empty($tplset) && is_dir(dirname(__FILE__) . '/default-templates/' . $tplset)) { 146 $core->tpl->setPath( 147 $__theme_tpl_path, 148 dirname(__FILE__) . '/default-templates/' . $tplset, 149 $core->tpl->getPath()); 150 150 } else { 151 $core->tpl->setPath(152 $__theme_tpl_path,153 $core->tpl->getPath());151 $core->tpl->setPath( 152 $__theme_tpl_path, 153 $core->tpl->getPath()); 154 154 } 155 155 $core->url->mode = $core->blog->settings->system->url_scan; 156 156 157 157 try { 158 # --BEHAVIOR-- publicBeforeDocument159 $core->callBehavior('publicBeforeDocument',$core);158 # --BEHAVIOR-- publicBeforeDocument 159 $core->callBehavior('publicBeforeDocument', $core); 160 160 161 $core->url->getDocument();161 $core->url->getDocument(); 162 162 163 # --BEHAVIOR-- publicAfterDocument164 $core->callBehavior('publicAfterDocument',$core);163 # --BEHAVIOR-- publicAfterDocument 164 $core->callBehavior('publicAfterDocument', $core); 165 165 } catch (Exception $e) { 166 __error($e->getMessage()167 ,__('Something went wrong while loading template file for your blog.')168 ,660);166 __error($e->getMessage() 167 , __('Something went wrong while loading template file for your blog.') 168 , 660); 169 169 }
Note: See TracChangeset
for help on using the changeset viewer.
