Changeset 1155:49ba58cbf593 for inc/admin
- Timestamp:
- 04/09/13 09:15:41 (12 years ago)
- Branch:
- twig
- Parents:
- 1154:e85c1417b8a4 (diff), 1143:fbf575ae9bda (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. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.dc.page.php
r1142 r1155 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->fillPageTitle($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.'),'Dotclear '.DC_VERSION); 185 186 # --BEHAVIOR-- adminPageFooter 187 $textAlt = $core->callBehavior('adminPageFooter',$core,$text); 188 if ($textAlt != '') { 189 $text = $textAlt; 190 } 191 $text = html::escapeHTML($text); 192 193 echo 194 '</div>'."\n". // End of #main-menu 195 '<div id="footer"><a href="http://dotclear.org/" title="'.$text.'"><img src="style/dc_logo_footer.png" alt="'.$text.'" /></a></div>'."\n". 196 "</div>\n"; // End of #wrapper 197 198 if (defined('DC_DEV') && DC_DEV === true) { 199 echo self::debugInfo(); 200 } 201 202 echo 203 '</body></html>'; 204 } 205 206 public static function openPopup($title='', $head='') 207 { 208 global $core; 209 210 # Display 211 header('Content-Type: text/html; charset=UTF-8'); 212 echo 213 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. 214 ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". 215 '<html xmlns="http://www.w3.org/1999/xhtml" '. 216 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. 217 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". 218 "<head>\n". 219 ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". 220 ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". 221 222 ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". 223 ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". 224 225 self::jsLoadIE7(). 226 ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; 227 if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { 228 echo 229 ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; 230 } 231 232 echo 233 self::jsCommon(). 234 $head; 235 236 # --BEHAVIOR-- adminPageHTMLHead 237 $core->callBehavior('adminPageHTMLHead'); 238 239 echo 240 "</head>\n". 241 '<body id="dotclear-admin" class="popup">'."\n". 242 243 '<div id="top"><h1>'.DC_VENDOR_NAME.'</h1></div>'."\n"; 244 245 echo 246 '<div id="wrapper">'."\n". 247 '<div id="main">'."\n". 248 '<div id="content">'."\n"; 249 250 if ($core->error->flag()) { 251 echo 252 '<div class="error"><strong>'.__('Errors:').'</strong>'. 253 $core->error->toHTML(). 254 '</div>'; 255 } 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); 256 81 } 257 82 258 83 public static function closePopup() 259 84 { 260 echo 261 "</div>\n". // End of #content 262 "</div>\n". // End of #main 263 '<div id="footer"><p> </p></div>'."\n". 264 "</div>\n". // End of #wrapper 265 '</body></html>'; 85 self::close(); 266 86 } 267 87 … … 279 99 } 280 100 } 281 return $res;282 }283 284 private static function debugInfo()285 {286 $global_vars = implode(', ',array_keys($GLOBALS));287 288 $res =289 '<div id="debug"><div>'.290 '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>';291 292 if (function_exists('xdebug_get_profiler_filename'))293 {294 $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>';295 296 $prof_file = xdebug_get_profiler_filename();297 if ($prof_file) {298 $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>';299 } else {300 $prof_url = http::getSelfURI();301 $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&';302 $prof_url .= 'XDEBUG_PROFILE';303 $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>';304 }305 306 /* xdebug configuration:307 zend_extension = /.../xdebug.so308 xdebug.auto_trace = On309 xdebug.trace_format = 0310 xdebug.trace_options = 1311 xdebug.show_mem_delta = On312 xdebug.profiler_enable = 0313 xdebug.profiler_enable_trigger = 1314 xdebug.profiler_output_dir = /tmp315 xdebug.profiler_append = 0316 xdebug.profiler_output_name = timestamp317 */318 }319 320 $res .=321 '<p>Global vars: '.$global_vars.'</p>'.322 '</div></div>';323 324 101 return $res; 325 102 } -
inc/admin/lib.dc.page.php
r1089 r1155 173 173 self::jsLoad('js/jquery/jquery.biscuit.js'). 174 174 self::jsLoad('js/jquery/jquery.bgFade.js'). 175 self::jsLoad('js/jquery/jquery.constantfooter.js').176 175 self::jsLoad('js/common.js'). 177 176 self::jsLoad('js/prelude.js').
Note: See TracChangeset
for help on using the changeset viewer.