Changeset 1080:4f4478e9973d for inc/admin
- 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/admin
- Files:
-
- 3 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) {
Note: See TracChangeset
for help on using the changeset viewer.