Changeset 1080:4f4478e9973d for inc
- Timestamp:
- 12/18/12 14:36:48 (13 years ago)
- Branch:
- twig
- Parents:
- 1079:e3bf3d268635 (diff), 1077:e80b1a400723 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- inc
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.dc.page.php
r1049 r1080 49 49 50 50 # Top of admin page 51 public static function open($title='', $head='') 52 { 53 global $core; 54 55 # List of user's blogs 56 if ($core->auth->blog_count == 1 || $core->auth->blog_count > 20) 57 { 58 $blog_box = 59 '<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'. 60 html::escapeHTML($core->blog->name).'</strong>'; 61 62 if ($core->auth->blog_count > 20) { 63 $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>'; 64 } 65 $blog_box .= '</p>'; 66 } 67 else 68 { 69 $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); 70 $blogs = array(); 71 while ($rs_blogs->fetch()) { 72 $blogs[html::escapeHTML($rs_blogs->blog_name.' - '.$rs_blogs->blog_url)] = $rs_blogs->blog_id; 73 } 74 $blog_box = 75 '<p><label for="switchblog" class="classic">'. 76 __('Blogs:').' '. 77 $core->formNonce(). 78 form::combo('switchblog',$blogs,$core->blog->id). 79 '</label></p>'. 80 '<noscript><p><input type="submit" value="'.__('ok').'" /></p></noscript>'; 81 } 82 83 $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; 84 85 # Display 86 header('Content-Type: text/html; charset=UTF-8'); 87 echo 88 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 89 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 90 '<html xmlns="http://www.w3.org/1999/xhtml" '. 91 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 92 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 93 "<head>\n". 94 ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 95 ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 96 97 ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 98 ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 99 100 self::jsLoadIE7(). 101 ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; 102 if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 103 echo 104 ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; 105 } 106 107 $core->auth->user_prefs->addWorkspace('interface'); 108 $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; 109 if (!$user_ui_hide_std_favicon) { 110 echo '<link rel="icon" type="image/png" href="images/favicon.png" />'; 111 } 112 113 echo 114 self::jsCommon(). 115 $head; 116 117 # --BEHAVIOR-- adminPageHTMLHead 118 $core->callBehavior('adminPageHTMLHead'); 119 120 echo 121 "</head>\n". 122 '<body id="dotclear-admin'. 123 ($safe_mode ? ' safe-mode' : ''). 124 '">'."\n". 125 126 '<div id="header">'. 127 '<ul id="prelude"><li><a href="#content">'.__('Go to the content').'</a></li><li><a href="#main-menu">'.__('Go to the menu').'</a></li></ul>'."\n". 128 '<div id="top"><h1><a href="index.php">'.DC_VENDOR_NAME.'</a></h1></div>'."\n"; 129 130 echo 131 '<div id="info-boxes">'. 132 '<div id="info-box1">'. 133 '<form action="index.php" method="post">'. 134 $blog_box. 135 '<p><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site').' ('.__('new window').')'.'">'.__('Go to site').' <img src="images/outgoing.png" alt="" /></a>'. 136 '</p></form>'. 137 '</div>'. 138 '<div id="info-box2">'. 139 '<a'.(preg_match('/index.php$/',$_SERVER['REQUEST_URI']) ? ' class="active"' : '').' href="index.php">'.__('My dashboard').'</a>'. 140 '<span> | </span><a'.(preg_match('/preferences.php(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' class="active"' : '').' href="preferences.php">'.__('My preferences').'</a>'. 141 '<span> | </span><a href="index.php?logout=1" class="logout">'.sprintf(__('Logout %s'),$core->auth->userID()).' <img src="images/logout.png" alt="" /></a>'. 142 '</div>'. 143 '</div>'. 144 '</div>'; 145 146 echo 147 '<div id="wrapper">'."\n". 148 '<div id="main">'."\n". 149 '<div id="content">'."\n"; 150 151 # Safe mode 152 if ($safe_mode) 153 { 154 echo 155 '<div class="error"><h3>'.__('Safe mode').'</h3>'. 156 '<p>'.__('You are in safe mode. All plugins have been temporarily disabled. Remind to log out then log in again normally to get back all functionalities').'</p>'. 157 '</div>'; 158 } 51 public static function open($title='',$head='',$popup=false) 52 { 53 global $core, $_ctx; 54 55 $_ctx->popup = (boolean) $popup; 56 $_ctx->page_header = $head; 57 $_ctx->setPageTitle($title); 58 59 ob_start(); 60 } 61 62 public static function close() 63 { 64 $res = ob_get_contents(); 65 ob_end_clean(); 66 67 global $core, $_ctx; 159 68 160 69 if ($core->error->flag()) { 161 echo 162 '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</p></strong>'. 163 $core->error->toHTML(). 164 '</div>'; 165 } 166 } 167 168 public static function close() 169 { 170 global $core; 171 172 $menu =& $GLOBALS['_menu']; 173 174 echo 175 "</div>\n". // End of #content 176 "</div>\n". // End of #main 177 178 '<div id="main-menu">'."\n"; 179 180 foreach ($menu as $k => $v) { 181 echo $menu[$k]->draw(); 182 } 183 184 $text = sprintf(__('Thank you for using %s.'),'<a href="http://dotclear.org/">Dotclear '.DC_VERSION.'</a>'); 185 186 # --BEHAVIOR-- adminPageFooter 187 $textAlt = $core->callBehavior('adminPageFooter',$core,$text); 188 189 echo 190 '</div>'."\n". // End of #main-menu 191 '<div id="footer"><p>'.($textAlt != '' ? $textAlt : $text).'</p></div>'."\n". 192 "</div>\n"; // End of #wrapper 193 194 if (defined('DC_DEV') && DC_DEV === true) { 195 echo self::debugInfo(); 196 } 197 198 echo 199 '</body></html>'; 200 } 201 202 public static function openPopup($title='', $head='') 203 { 204 global $core; 205 206 # Display 207 header('Content-Type: text/html; charset=UTF-8'); 208 echo 209 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 210 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 211 '<html xmlns="http://www.w3.org/1999/xhtml" '. 212 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 213 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 214 "<head>\n". 215 ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 216 ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 217 218 ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 219 ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 220 221 self::jsLoadIE7(). 222 ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; 223 if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 224 echo 225 ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; 226 } 227 228 echo 229 self::jsCommon(). 230 $head; 231 232 # --BEHAVIOR-- adminPageHTMLHead 233 $core->callBehavior('adminPageHTMLHead'); 234 235 echo 236 "</head>\n". 237 '<body id="dotclear-admin" class="popup">'."\n". 238 239 '<div id="top"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n"; 240 241 echo 242 '<div id="wrapper">'."\n". 243 '<div id="main">'."\n". 244 '<div id="content">'."\n"; 245 246 if ($core->error->flag()) { 247 echo 248 '<div class="error"><strong>'.__('Errors:').'</strong>'. 249 $core->error->toHTML(). 250 '</div>'; 251 } 70 foreach($core->error->getErrors() as $e) { 71 $_ctx->addError($e); 72 } 73 } 74 $_ctx->page_content = $res; 75 $core->tpl->display('page_layout.html.twig'); 76 } 77 78 public static function openPopup($title='',$head='') 79 { 80 self::open($title,$head,true); 252 81 } 253 82 254 83 public static function closePopup() 255 84 { 256 echo 257 "</div>\n". // End of #content 258 "</div>\n". // End of #main 259 '<div id="footer"><p> </p></div>'."\n". 260 "</div>\n". // End of #wrapper 261 '</body></html>'; 85 self::close(); 262 86 } 263 87 … … 278 102 } 279 103 280 private static function debugInfo()281 {282 $global_vars = implode(', ',array_keys($GLOBALS));283 284 $res =285 '<div id="debug"><div>'.286 '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>';287 288 if (function_exists('xdebug_get_profiler_filename'))289 {290 $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>';291 292 $prof_file = xdebug_get_profiler_filename();293 if ($prof_file) {294 $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>';295 } else {296 $prof_url = http::getSelfURI();297 $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&';298 $prof_url .= 'XDEBUG_PROFILE';299 $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>';300 }301 302 /* xdebug configuration:303 zend_extension = /.../xdebug.so304 xdebug.auto_trace = On305 xdebug.trace_format = 0306 xdebug.trace_options = 1307 xdebug.show_mem_delta = On308 xdebug.profiler_enable = 0309 xdebug.profiler_enable_trigger = 1310 xdebug.profiler_output_dir = /tmp311 xdebug.profiler_append = 0312 xdebug.profiler_output_name = timestamp313 */314 }315 316 $res .=317 '<p>Global vars: '.$global_vars.'</p>'.318 '</div></div>';319 320 return $res;321 }322 323 104 public static function help($page,$index='') 324 105 { … … 400 181 self::jsVar('dotclear.nonce',$GLOBALS['core']->getNonce()). 401 182 402 self::jsVar('dotclear.img_plus_src','images/ expand.png').183 self::jsVar('dotclear.img_plus_src','images/plus.png'). 403 184 self::jsVar('dotclear.img_plus_alt',__('uncover')). 404 self::jsVar('dotclear.img_minus_src','images/ hide.png').185 self::jsVar('dotclear.img_minus_src','images/minus.png'). 405 186 self::jsVar('dotclear.img_minus_alt',__('hide')). 406 187 self::jsVar('dotclear.img_menu_on','images/menu_on.png'). … … 433 214 self::jsVar('dotclear.msg.confirm_delete_post', 434 215 __("Are you sure you want to delete this entry?")). 435 self::jsVar('dotclear.msg.confirm_spam_delete',436 __('Are you sure you want to delete all spams?')).437 216 self::jsVar('dotclear.msg.confirm_delete_comments', 438 217 __('Are you sure you want to delete selected comments (%s)?')). … … 689 468 "//<![CDATA[\n". 690 469 "dotclear.candyUpload = {};\n". 691 self::jsVar('dotclear.msg.activate_enhanced_uploader',__(' Temporarily activate enhanced uploader')).692 self::jsVar('dotclear.msg.disable_enhanced_uploader',__(' Temporarily disable enhanced uploader')).470 self::jsVar('dotclear.msg.activate_enhanced_uploader',__('Activate enhanced uploader')). 471 self::jsVar('dotclear.msg.disable_enhanced_uploader',__('Disable enhanced uploader')). 693 472 self::jsVar('$._candyUpload.prototype.locales.file_uploaded',__('File successfully uploaded.')). 694 473 self::jsVar('$._candyUpload.prototype.locales.max_file_size',__('Maximum file size allowed:')). -
inc/admin/prepend.php
r1069 r1080 375 375 } 376 376 } 377 378 # Add admin default templates path 379 $core->tpl->getLoader()->addPath(dirname(__FILE__).'/default-templates'); 380 # Set admin context 381 $_ctx = new dcAdminContext($core); 382 $core->tpl->addExtension($_ctx); 383 384 # --BEHAVIOR-- adminPrepend 385 $core->callBehavior('adminPrepend',$core,$_ctx); 377 386 ?> -
inc/admin/prepend.php
r1056 r1080 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 define('DC_CONTEXT_ADMIN',true); 14 13 15 require_once dirname(__FILE__).'/../prepend.php'; 14 16 … … 19 21 // HTTP/1.0 20 22 header("Pragma: no-cache"); 21 22 define('DC_CONTEXT_ADMIN',true);23 23 24 24 function dc_valid_fav($url) { -
inc/prepend.php
r1069 r1080 12 12 13 13 /* ------------------------------------------------------------------------------------------- */ 14 # ClearBricks, DotClear classes auto-loader14 # ClearBricks, Twig, DotClear classes auto-loader 15 15 if (@is_dir('/usr/lib/clearbricks')) { 16 16 define('CLEARBRICKS_PATH','/usr/lib/clearbricks'); … … 46 46 $__autoload['dcWorkspace'] = dirname(__FILE__).'/core/class.dc.workspace.php'; 47 47 $__autoload['dcPrefs'] = dirname(__FILE__).'/core/class.dc.prefs.php'; 48 $__autoload['dcTwigPage'] = dirname(__FILE__).'/core/class.dc.twig.page.php'; 48 49 49 50 $__autoload['rsExtPost'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; … … 52 53 $__autoload['rsExtUser'] = dirname(__FILE__).'/core/class.dc.rs.extensions.php'; 53 54 55 $__autoload['dcAdminContext'] = dirname(__FILE__).'/admin/class.dc.admincontext.php'; 54 56 $__autoload['dcMenu'] = dirname(__FILE__).'/admin/class.dc.menu.php'; 55 57 $__autoload['dcPage'] = dirname(__FILE__).'/admin/lib.dc.page.php'; … … 63 65 $__autoload['context'] = dirname(__FILE__).'/public/lib.tpl.context.php'; 64 66 $__autoload['dcUrlHandlers'] = dirname(__FILE__).'/public/lib.urlhandlers.php'; 67 $__autoload['dcForm'] = dirname(__FILE__).'/admin/class.dc.form.php'; 68 $__autoload['dcFormExtension'] = dirname(__FILE__).'/admin/class.dc.form.php'; 65 69 66 70 # Clearbricks extensions 67 71 html::$absolute_regs[] = '/(<param\s+name="movie"\s+value=")(.*?)(")/msu'; 68 72 html::$absolute_regs[] = '/(<param\s+name="FlashVars"\s+value=".*?(?:mp3|flv)=)(.*?)(&|")/msu'; 73 74 if (@is_dir('/usr/lib/twig')) { 75 define('TWIG_PATH','/usr/lib/twig'); 76 } elseif (is_dir(dirname(__FILE__).'/libs/twig')) { 77 define('TWIG_PATH',dirname(__FILE__).'/libs/twig'); 78 } elseif (isset($_SERVER['TWIG_PATH']) && is_dir($_SERVER['TWIG_PATH'])) { 79 define('TWIG_PATH',$_SERVER['TWIG_PATH']); 80 } 81 82 if (!defined('TWIG_PATH') || !is_dir(TWIG_PATH)) { 83 exit('No Twig path defined'); 84 } 85 require TWIG_PATH.'/Autoloader.php'; 86 Twig_Autoloader::register(); 87 69 88 /* ------------------------------------------------------------------------------------------- */ 70 89 -
inc/prepend.php
r1014 r1080 181 181 } catch (Exception $e) { 182 182 init_prepend_l10n(); 183 __error(__('Unable to connect to database') 184 ,$e->getCode() == 0 ? 185 sprintf(__('<p>This either means that the username and password information in '. 186 'your <strong>config.php</strong> file is incorrect or we can\'t contact '. 187 'the database server at "<em>%s</em>". This could mean your '. 188 'host\'s database server is down.</p> '. 189 '<ul><li>Are you sure you have the correct username and password?</li>'. 190 '<li>Are you sure that you have typed the correct hostname?</li>'. 191 '<li>Are you sure that the database server is running?</li></ul>'. 192 '<p>If you\'re unsure what these terms mean you should probably contact '. 193 'your host. If you still need help you can always visit the '. 194 '<a href="http://forum.dotclear.net/">Dotclear Support Forums</a>.</p>'). 195 (DC_DEBUG ? 196 __('The following error was encountered while trying to read the database:').'</p><ul><li>'.$e->getMessage().'</li></ul>' : '') 197 ,(DC_DBHOST != '' ? DC_DBHOST : 'localhost') 198 ) 199 : '' 200 ,20); 183 if (!defined('DC_CONTEXT_ADMIN')) { 184 __error(__('Site temporarily unavailable'), 185 __('<p>We apologize for this temporary unavailability.<br />'. 186 'Thank you for your understanding.</p>'), 187 20); 188 } else { 189 __error(__('Unable to connect to database') 190 ,$e->getCode() == 0 ? 191 sprintf(__('<p>This either means that the username and password information in '. 192 'your <strong>config.php</strong> file is incorrect or we can\'t contact '. 193 'the database server at "<em>%s</em>". This could mean your '. 194 'host\'s database server is down.</p> '. 195 '<ul><li>Are you sure you have the correct username and password?</li>'. 196 '<li>Are you sure that you have typed the correct hostname?</li>'. 197 '<li>Are you sure that the database server is running?</li></ul>'. 198 '<p>If you\'re unsure what these terms mean you should probably contact '. 199 'your host. If you still need help you can always visit the '. 200 '<a href="http://forum.dotclear.net/">Dotclear Support Forums</a>.</p>'). 201 (DC_DEBUG ? 202 __('The following error was encountered while trying to read the database:').'</p><ul><li>'.$e->getMessage().'</li></ul>' : '') 203 ,(DC_DBHOST != '' ? DC_DBHOST : 'localhost') 204 ) 205 : '' 206 ,20); 207 } 201 208 } 202 209
Note: See TracChangeset
for help on using the changeset viewer.