[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 | if (!defined('DC_RC_PATH')) { return; } |
---|
| 13 | |
---|
| 14 | define('DC_AUTH_PAGE','auth.php'); |
---|
| 15 | |
---|
| 16 | class dcPage |
---|
| 17 | { |
---|
[342] | 18 | private static $loaded_js=array(); |
---|
| 19 | |
---|
[0] | 20 | # Auth check |
---|
| 21 | public static function check($permissions) |
---|
| 22 | { |
---|
| 23 | global $core; |
---|
[1187] | 24 | |
---|
[0] | 25 | if ($core->blog && $core->auth->check($permissions,$core->blog->id)) |
---|
| 26 | { |
---|
| 27 | return; |
---|
| 28 | } |
---|
[1187] | 29 | |
---|
[0] | 30 | if (session_id()) { |
---|
| 31 | $core->session->destroy(); |
---|
| 32 | } |
---|
| 33 | http::redirect(DC_AUTH_PAGE); |
---|
| 34 | } |
---|
[1187] | 35 | |
---|
[0] | 36 | # Check super admin |
---|
| 37 | public static function checkSuper() |
---|
| 38 | { |
---|
| 39 | global $core; |
---|
[1187] | 40 | |
---|
[0] | 41 | if (!$core->auth->isSuperAdmin()) |
---|
| 42 | { |
---|
| 43 | if (session_id()) { |
---|
| 44 | $core->session->destroy(); |
---|
| 45 | } |
---|
| 46 | http::redirect(DC_AUTH_PAGE); |
---|
| 47 | } |
---|
| 48 | } |
---|
[1187] | 49 | |
---|
[0] | 50 | # Top of admin page |
---|
[1358] | 51 | public static function open($title='',$head='',$breadcrumb='') |
---|
[0] | 52 | { |
---|
| 53 | global $core; |
---|
[1144] | 54 | |
---|
[0] | 55 | # List of user's blogs |
---|
[2159] | 56 | if ($core->auth->getBlogCount() == 1 || $core->auth->getBlogCount() > 20) |
---|
[0] | 57 | { |
---|
| 58 | $blog_box = |
---|
[999] | 59 | '<p>'.__('Blog:').' <strong title="'.html::escapeHTML($core->blog->url).'">'. |
---|
[0] | 60 | html::escapeHTML($core->blog->name).'</strong>'; |
---|
[1187] | 61 | |
---|
[2159] | 62 | if ($core->auth->getBlogCount() > 20) { |
---|
[0] | 63 | $blog_box .= ' - <a href="blogs.php">'.__('Change blog').'</a>'; |
---|
| 64 | } |
---|
[999] | 65 | $blog_box .= '</p>'; |
---|
[0] | 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 = |
---|
[2005] | 75 | '<p><label for="switchblog" class="classic">'. |
---|
[1309] | 76 | __('Blogs:').'</label> '. |
---|
[0] | 77 | $core->formNonce(). |
---|
[454] | 78 | form::combo('switchblog',$blogs,$core->blog->id). |
---|
[2005] | 79 | '<input type="submit" value="'.__('ok').'" class="hidden-if-js" /></p>'; |
---|
[0] | 80 | } |
---|
[1187] | 81 | |
---|
[36] | 82 | $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode']; |
---|
[1187] | 83 | |
---|
[0] | 84 | # Display |
---|
| 85 | header('Content-Type: text/html; charset=UTF-8'); |
---|
| 86 | echo |
---|
| 87 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. |
---|
| 88 | ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". |
---|
| 89 | '<html xmlns="http://www.w3.org/1999/xhtml" '. |
---|
| 90 | 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. |
---|
| 91 | 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". |
---|
| 92 | "<head>\n". |
---|
| 93 | ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". |
---|
| 94 | ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". |
---|
| 95 | ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". |
---|
[1310] | 96 | ' <meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". |
---|
[489] | 97 | ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". |
---|
[1187] | 98 | |
---|
| 99 | |
---|
[0] | 100 | self::jsLoadIE7(). |
---|
[1586] | 101 | ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; |
---|
[0] | 102 | if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { |
---|
[473] | 103 | echo |
---|
[1586] | 104 | ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; |
---|
[0] | 105 | } |
---|
[237] | 106 | |
---|
[244] | 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) { |
---|
[2160] | 110 | echo |
---|
| 111 | '<link rel="icon" type="image/png" href="images/favicon96-login.png" />'. |
---|
[2161] | 112 | '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />'; |
---|
[244] | 113 | } |
---|
[0] | 114 | echo |
---|
| 115 | self::jsCommon(). |
---|
[1699] | 116 | self::jsToggles(). |
---|
[0] | 117 | $head; |
---|
[1187] | 118 | |
---|
[0] | 119 | # --BEHAVIOR-- adminPageHTMLHead |
---|
| 120 | $core->callBehavior('adminPageHTMLHead'); |
---|
[1187] | 121 | |
---|
[0] | 122 | echo |
---|
| 123 | "</head>\n". |
---|
[36] | 124 | '<body id="dotclear-admin'. |
---|
[1586] | 125 | ($safe_mode ? ' safe-mode' : '').'" class="no-js">'."\n". |
---|
[1187] | 126 | |
---|
[1590] | 127 | '<ul id="prelude">'. |
---|
| 128 | '<li><a href="#content">'.__('Go to the content').'</a></li>'. |
---|
| 129 | '<li><a href="#main-menu">'.__('Go to the menu').'</a></li>'. |
---|
| 130 | '<li><a href="#qx">'.__('Go to search').'</a></li>'. |
---|
| 131 | '</ul>'."\n". |
---|
[2005] | 132 | '<div id="header">'. |
---|
| 133 | '<h1><a href="index.php"><span class="hidden">'.DC_VENDOR_NAME.'</span></a></h1>'."\n"; |
---|
[1187] | 134 | |
---|
[0] | 135 | echo |
---|
[2005] | 136 | '<form action="index.php" method="post" id="top-info-blog">'. |
---|
[0] | 137 | $blog_box. |
---|
[2005] | 138 | '<p><a href="'.$core->blog->url.'" onclick="window.open(this.href);return false;" title="'.__('Go to site'). |
---|
[1947] | 139 | ' ('.__('new window').')'.'">'.__('Go to site').'<img src="images/outgoing.png" alt="" /></a>'. |
---|
[999] | 140 | '</p></form>'. |
---|
[2005] | 141 | '<ul id="top-info-user">'. |
---|
| 142 | '<li><a class="'.(preg_match('/index.php$/',$_SERVER['REQUEST_URI']) ? ' active' : '').'" href="index.php">'.__('My dashboard').'</a></li>'. |
---|
| 143 | '<li><a class="smallscreen'.(preg_match('/preferences.php(\?.*)?$/',$_SERVER['REQUEST_URI']) ? ' active' : ''). |
---|
| 144 | '" href="preferences.php">'.__('My preferences').'</a></li>'. |
---|
[2034] | 145 | '<li><a href="index.php?logout=1" class="logout"><span class="nomobile">'.sprintf(__('Logout %s'),$core->auth->userID()). |
---|
| 146 | '</span><img src="images/logout.png" alt="" /></a></li>'. |
---|
[2005] | 147 | '</ul>'. |
---|
| 148 | '</div>'; // end header |
---|
[1187] | 149 | |
---|
[0] | 150 | echo |
---|
[1741] | 151 | '<div id="wrapper" class="clearfix">'."\n". |
---|
[1946] | 152 | '<div class="hidden-if-no-js collapser-box"><a href="#" id="collapser">'. |
---|
[1867] | 153 | '<img class="collapse-mm" src="images/collapser-hide.png" alt="'.__('Hide main menu').'" />'. |
---|
| 154 | '<img class="expand-mm" src="images/collapser-show.png" alt="'.__('Show main menu').'" />'. |
---|
| 155 | '</a></div>'. |
---|
[1946] | 156 | '<div id="main">'."\n". |
---|
[1741] | 157 | '<div id="content" class="clearfix">'."\n"; |
---|
[1187] | 158 | |
---|
[36] | 159 | # Safe mode |
---|
| 160 | if ($safe_mode) |
---|
[0] | 161 | { |
---|
| 162 | echo |
---|
[2043] | 163 | '<div class="warning"><h3>'.__('Safe mode').'</h3>'. |
---|
[37] | 164 | '<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>'. |
---|
[0] | 165 | '</div>'; |
---|
| 166 | } |
---|
[1187] | 167 | |
---|
[1355] | 168 | // Display breadcrumb (if given) before any error message |
---|
[1357] | 169 | echo $breadcrumb; |
---|
[1355] | 170 | |
---|
[0] | 171 | if ($core->error->flag()) { |
---|
| 172 | echo |
---|
[1384] | 173 | '<div class="error"><p><strong>'.(count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')).'</strong></p>'. |
---|
[0] | 174 | $core->error->toHTML(). |
---|
| 175 | '</div>'; |
---|
| 176 | } |
---|
[2181] | 177 | |
---|
| 178 | if (isset($_SESSION['notifications'])) { |
---|
[2189] | 179 | $types = array("success" => "success", "warning" => "warning-msg", "error" => "error"); |
---|
[2181] | 180 | $notifications = $_SESSION['notifications']; |
---|
| 181 | foreach ($types as $type => $class) { |
---|
| 182 | if (isset($notifications[$type])) { |
---|
| 183 | foreach ($notifications[$type] as $n) { |
---|
| 184 | echo self::getNotification($n,$class); |
---|
| 185 | } |
---|
| 186 | } |
---|
| 187 | } |
---|
| 188 | unset($_SESSION['notifications']); |
---|
| 189 | } |
---|
| 190 | |
---|
[0] | 191 | } |
---|
[2181] | 192 | public static function AddNotice($type,$message) { |
---|
| 193 | $notification = isset($_SESSION['notifications']) ? $_SESSION['notifications']:array(); |
---|
| 194 | $notification[$type][] = array('ts' => time(), 'text' => $message); |
---|
| 195 | $_SESSION['notifications'] = $notification; |
---|
| 196 | } |
---|
| 197 | public static function addSuccessNotice($message) { |
---|
| 198 | self::addNotice("success",$message); |
---|
| 199 | } |
---|
| 200 | public static function addWarningNotice($message) { |
---|
| 201 | self::addNotice("warning",$message); |
---|
| 202 | } |
---|
[2189] | 203 | public static function addErrorNotice($message) { |
---|
| 204 | self::addNotice("error",$message); |
---|
| 205 | } |
---|
[2181] | 206 | protected static function getNotification($msg,$class) { |
---|
| 207 | global $core; |
---|
| 208 | $res = '<p class="'.$class.'">'. |
---|
[2189] | 209 | dt::str(__('[%H:%M:%S]'),$msg['ts'],$core->auth->getInfo('user_tz')).' '.$msg['text']. |
---|
[2181] | 210 | '</p>'; |
---|
| 211 | return $res; |
---|
| 212 | } |
---|
[0] | 213 | public static function close() |
---|
| 214 | { |
---|
[942] | 215 | global $core; |
---|
| 216 | |
---|
[1933] | 217 | if (!$GLOBALS['__resources']['ctxhelp']) { |
---|
| 218 | echo |
---|
[2082] | 219 | '<p id="help-button"><a href="help.php" onclick="window.open(this.href);return false;" title="'. |
---|
| 220 | __('Global help').' ('.__('new window').')">'.__('Global help').'</a></p>'; |
---|
[1933] | 221 | } |
---|
| 222 | |
---|
[0] | 223 | $menu =& $GLOBALS['_menu']; |
---|
[1187] | 224 | |
---|
[0] | 225 | echo |
---|
| 226 | "</div>\n". // End of #content |
---|
| 227 | "</div>\n". // End of #main |
---|
[1187] | 228 | |
---|
[1311] | 229 | '<div id="main-menu">'."\n". |
---|
| 230 | |
---|
| 231 | '<form id="search-menu" action="search.php" method="get">'. |
---|
[1589] | 232 | '<p><label for="qx" class="hidden">'.__('Search:').' </label>'.form::field('qx',30,255,''). |
---|
[1311] | 233 | '<input type="submit" value="'.__('OK').'" /></p>'. |
---|
| 234 | '</form>'; |
---|
[1187] | 235 | |
---|
[0] | 236 | foreach ($menu as $k => $v) { |
---|
| 237 | echo $menu[$k]->draw(); |
---|
| 238 | } |
---|
[1187] | 239 | |
---|
[1140] | 240 | $text = sprintf(__('Thank you for using %s.'),'Dotclear '.DC_VERSION); |
---|
[942] | 241 | |
---|
| 242 | # --BEHAVIOR-- adminPageFooter |
---|
[946] | 243 | $textAlt = $core->callBehavior('adminPageFooter',$core,$text); |
---|
[1140] | 244 | if ($textAlt != '') { |
---|
| 245 | $text = $textAlt; |
---|
| 246 | } |
---|
[1142] | 247 | $text = html::escapeHTML($text); |
---|
[942] | 248 | |
---|
[0] | 249 | echo |
---|
| 250 | '</div>'."\n". // End of #main-menu |
---|
[1946] | 251 | "</div>\n"; // End of #wrapper |
---|
[1861] | 252 | |
---|
[1946] | 253 | echo |
---|
[1793] | 254 | '<div id="footer">'. |
---|
| 255 | '<a href="http://dotclear.org/" title="'.$text.'"><img src="style/dc_logos/w-dotclear90.png" alt="'.$text.'" /></a></div>'."\n". |
---|
[1599] | 256 | '<!-- '."\n". |
---|
| 257 | ' .'."\n". |
---|
| 258 | ' ,;:\'`\'::'."\n". |
---|
| 259 | ' __||'."\n". |
---|
| 260 | ' _____/LLLL\_'."\n". |
---|
| 261 | ' \__________"|'."\n". |
---|
| 262 | ' ~^~^~^~^~^~^~^~^~^~'."\n". |
---|
[1946] | 263 | ' -->'."\n"; |
---|
[1187] | 264 | |
---|
[0] | 265 | if (defined('DC_DEV') && DC_DEV === true) { |
---|
| 266 | echo self::debugInfo(); |
---|
| 267 | } |
---|
[1187] | 268 | |
---|
[0] | 269 | echo |
---|
| 270 | '</body></html>'; |
---|
| 271 | } |
---|
[1187] | 272 | |
---|
[1358] | 273 | public static function openPopup($title='',$head='',$breadcrumb='') |
---|
[0] | 274 | { |
---|
| 275 | global $core; |
---|
[1187] | 276 | |
---|
[0] | 277 | # Display |
---|
| 278 | header('Content-Type: text/html; charset=UTF-8'); |
---|
| 279 | echo |
---|
| 280 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '. |
---|
| 281 | ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n". |
---|
| 282 | '<html xmlns="http://www.w3.org/1999/xhtml" '. |
---|
| 283 | 'xml:lang="'.$core->auth->getInfo('user_lang').'" '. |
---|
| 284 | 'lang="'.$core->auth->getInfo('user_lang').'">'."\n". |
---|
[1311] | 285 | '<meta name="viewport" content="width=device-width, initial-scale=1.0" />'."\n". |
---|
[0] | 286 | "<head>\n". |
---|
| 287 | ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'."\n". |
---|
| 288 | ' <title>'.$title.' - '.html::escapeHTML($core->blog->name).' - '.html::escapeHTML(DC_VENDOR_NAME).' - '.DC_VERSION.'</title>'."\n". |
---|
[1187] | 289 | |
---|
[0] | 290 | ' <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />'."\n". |
---|
| 291 | ' <meta name="GOOGLEBOT" content="NOSNIPPET" />'."\n". |
---|
[1187] | 292 | |
---|
[0] | 293 | self::jsLoadIE7(). |
---|
[1187] | 294 | ' <link rel="stylesheet" href="style/default.css" type="text/css" media="screen" />'."\n"; |
---|
[0] | 295 | if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') { |
---|
[473] | 296 | echo |
---|
[1187] | 297 | ' <link rel="stylesheet" href="style/default-rtl.css" type="text/css" media="screen" />'."\n"; |
---|
[0] | 298 | } |
---|
[1187] | 299 | |
---|
[0] | 300 | echo |
---|
| 301 | self::jsCommon(). |
---|
[1699] | 302 | self::jsToggles(). |
---|
[0] | 303 | $head; |
---|
[1187] | 304 | |
---|
[0] | 305 | # --BEHAVIOR-- adminPageHTMLHead |
---|
| 306 | $core->callBehavior('adminPageHTMLHead'); |
---|
[1187] | 307 | |
---|
[0] | 308 | echo |
---|
| 309 | "</head>\n". |
---|
| 310 | '<body id="dotclear-admin" class="popup">'."\n". |
---|
[1187] | 311 | |
---|
[2046] | 312 | '<h1>'.DC_VENDOR_NAME.'</h1>'."\n"; |
---|
[1187] | 313 | |
---|
[0] | 314 | echo |
---|
| 315 | '<div id="wrapper">'."\n". |
---|
| 316 | '<div id="main">'."\n". |
---|
| 317 | '<div id="content">'."\n"; |
---|
[1187] | 318 | |
---|
[1358] | 319 | // display breadcrumb if given |
---|
| 320 | echo $breadcrumb; |
---|
| 321 | |
---|
[0] | 322 | if ($core->error->flag()) { |
---|
| 323 | echo |
---|
| 324 | '<div class="error"><strong>'.__('Errors:').'</strong>'. |
---|
| 325 | $core->error->toHTML(). |
---|
| 326 | '</div>'; |
---|
| 327 | } |
---|
| 328 | } |
---|
[1187] | 329 | |
---|
[0] | 330 | public static function closePopup() |
---|
| 331 | { |
---|
| 332 | echo |
---|
| 333 | "</div>\n". // End of #content |
---|
| 334 | "</div>\n". // End of #main |
---|
[2046] | 335 | "</div>\n". // End of #wrapper |
---|
[0] | 336 | '<div id="footer"><p> </p></div>'."\n". |
---|
| 337 | '</body></html>'; |
---|
| 338 | } |
---|
[907] | 339 | |
---|
[2166] | 340 | public static function breadcrumb($elements=null,$options=array()) |
---|
[1328] | 341 | { |
---|
[2166] | 342 | $with_home_link = isset($options['home_link'])?$options['home_link']:true; |
---|
[2167] | 343 | $hl = isset($options['hl'])?$options['hl']:true; |
---|
| 344 | $hl_pos = isset($options['hl_pos'])?$options['hl_pos']:-1; |
---|
[1328] | 345 | // First item of array elements should be blog's name, System or Plugins |
---|
[1340] | 346 | $res = '<h2>'.($with_home_link ? |
---|
| 347 | '<a class="go_home" href="index.php"><img src="style/dashboard.png" alt="'.__('Go to dashboard').'" /></a>' : |
---|
| 348 | '<img src="style/dashboard-alt.png" alt="" />'); |
---|
[1328] | 349 | $index = 0; |
---|
[2167] | 350 | if ($hl_pos < 0) { |
---|
| 351 | $hl_pos = count($elements)+$hl_pos; |
---|
[2166] | 352 | } |
---|
[1328] | 353 | foreach ($elements as $element => $url) { |
---|
[2167] | 354 | if ($hl && $index == $hl_pos) { |
---|
[2166] | 355 | $element = sprintf('<span class="page-title">%s</span>',$element); |
---|
| 356 | } |
---|
[1358] | 357 | $res .= ($with_home_link ? ($index == 1 ? ' : ' : ' › ') : ($index == 0 ? ' ' : ' › ')). |
---|
| 358 | ($url ? '<a href="'.$url.'">' : '').$element.($url ? '</a>' : ''); |
---|
[1328] | 359 | $index++; |
---|
| 360 | } |
---|
| 361 | $res .= '</h2>'; |
---|
| 362 | return $res; |
---|
| 363 | } |
---|
| 364 | |
---|
[1548] | 365 | public static function message($msg,$timestamp=true,$div=false,$echo=true,$class='message') |
---|
[907] | 366 | { |
---|
[910] | 367 | global $core; |
---|
[1187] | 368 | |
---|
[907] | 369 | $res = ''; |
---|
| 370 | if ($msg != '') { |
---|
[1548] | 371 | $res = ($div ? '<div class="'.$class.'">' : '').'<p'.($div ? '' : ' class="'.$class.'"').'>'. |
---|
[1161] | 372 | ($timestamp ? dt::str(__('%H:%M:%S:'),null,$core->auth->getInfo('user_tz')).' ' : '').$msg. |
---|
| 373 | '</p>'.($div ? '</div>' : ''); |
---|
[907] | 374 | if ($echo) { |
---|
| 375 | echo $res; |
---|
| 376 | } |
---|
| 377 | } |
---|
| 378 | return $res; |
---|
| 379 | } |
---|
[1187] | 380 | |
---|
[1548] | 381 | public static function success($msg,$timestamp=true,$div=false,$echo=true) |
---|
| 382 | { |
---|
[1927] | 383 | return self::message($msg,$timestamp,$div,$echo,"success"); |
---|
[1548] | 384 | } |
---|
| 385 | |
---|
[1725] | 386 | public static function warning($msg,$timestamp=true,$div=false,$echo=true) |
---|
| 387 | { |
---|
[1927] | 388 | return self::message($msg,$timestamp,$div,$echo,"warning-msg"); |
---|
[1725] | 389 | } |
---|
| 390 | |
---|
[0] | 391 | private static function debugInfo() |
---|
| 392 | { |
---|
| 393 | $global_vars = implode(', ',array_keys($GLOBALS)); |
---|
[1187] | 394 | |
---|
[0] | 395 | $res = |
---|
| 396 | '<div id="debug"><div>'. |
---|
| 397 | '<p>memory usage: '.memory_get_usage().' ('.files::size(memory_get_usage()).')</p>'; |
---|
[1187] | 398 | |
---|
[0] | 399 | if (function_exists('xdebug_get_profiler_filename')) |
---|
| 400 | { |
---|
| 401 | $res .= '<p>Elapsed time: '.xdebug_time_index().' seconds</p>'; |
---|
[1187] | 402 | |
---|
[0] | 403 | $prof_file = xdebug_get_profiler_filename(); |
---|
| 404 | if ($prof_file) { |
---|
| 405 | $res .= '<p>Profiler file : '.xdebug_get_profiler_filename().'</p>'; |
---|
| 406 | } else { |
---|
| 407 | $prof_url = http::getSelfURI(); |
---|
[321] | 408 | $prof_url .= (strpos($prof_url,'?') === false) ? '?' : '&'; |
---|
[0] | 409 | $prof_url .= 'XDEBUG_PROFILE'; |
---|
[321] | 410 | $res .= '<p><a href="'.html::escapeURL($prof_url).'">Trigger profiler</a></p>'; |
---|
[0] | 411 | } |
---|
[1187] | 412 | |
---|
[0] | 413 | /* xdebug configuration: |
---|
| 414 | zend_extension = /.../xdebug.so |
---|
| 415 | xdebug.auto_trace = On |
---|
| 416 | xdebug.trace_format = 0 |
---|
| 417 | xdebug.trace_options = 1 |
---|
| 418 | xdebug.show_mem_delta = On |
---|
| 419 | xdebug.profiler_enable = 0 |
---|
| 420 | xdebug.profiler_enable_trigger = 1 |
---|
| 421 | xdebug.profiler_output_dir = /tmp |
---|
| 422 | xdebug.profiler_append = 0 |
---|
| 423 | xdebug.profiler_output_name = timestamp |
---|
| 424 | */ |
---|
| 425 | } |
---|
[1187] | 426 | |
---|
[0] | 427 | $res .= |
---|
| 428 | '<p>Global vars: '.$global_vars.'</p>'. |
---|
| 429 | '</div></div>'; |
---|
[1187] | 430 | |
---|
[0] | 431 | return $res; |
---|
| 432 | } |
---|
[1187] | 433 | |
---|
[0] | 434 | public static function help($page,$index='') |
---|
| 435 | { |
---|
| 436 | # Deprecated but we keep this for plugins. |
---|
| 437 | } |
---|
[1187] | 438 | |
---|
[0] | 439 | public static function helpBlock() |
---|
| 440 | { |
---|
| 441 | $args = func_get_args(); |
---|
[1458] | 442 | |
---|
| 443 | $args = new ArrayObject($args); |
---|
| 444 | |
---|
| 445 | # --BEHAVIOR-- adminPageHelpBlock |
---|
| 446 | $GLOBALS['core']->callBehavior('adminPageHelpBlock',$args); |
---|
| 447 | |
---|
[0] | 448 | if (empty($args)) { |
---|
| 449 | return; |
---|
| 450 | }; |
---|
[1187] | 451 | |
---|
[0] | 452 | global $__resources; |
---|
| 453 | if (empty($__resources['help'])) { |
---|
| 454 | return; |
---|
| 455 | } |
---|
[1187] | 456 | |
---|
[0] | 457 | $content = ''; |
---|
| 458 | foreach ($args as $v) |
---|
| 459 | { |
---|
| 460 | if (is_object($v) && isset($v->content)) { |
---|
| 461 | $content .= $v->content; |
---|
| 462 | continue; |
---|
| 463 | } |
---|
[1187] | 464 | |
---|
[0] | 465 | if (!isset($__resources['help'][$v])) { |
---|
| 466 | continue; |
---|
| 467 | } |
---|
| 468 | $f = $__resources['help'][$v]; |
---|
| 469 | if (!file_exists($f) || !is_readable($f)) { |
---|
| 470 | continue; |
---|
| 471 | } |
---|
[1187] | 472 | |
---|
[0] | 473 | $fc = file_get_contents($f); |
---|
| 474 | if (preg_match('|<body[^>]*?>(.*?)</body>|ms',$fc,$matches)) { |
---|
| 475 | $content .= $matches[1]; |
---|
| 476 | } else { |
---|
| 477 | $content .= $fc; |
---|
| 478 | } |
---|
| 479 | } |
---|
[1187] | 480 | |
---|
[0] | 481 | if (trim($content) == '') { |
---|
| 482 | return; |
---|
| 483 | } |
---|
[1187] | 484 | |
---|
[1933] | 485 | // Set contextual help global flag |
---|
| 486 | $GLOBALS['__resources']['ctxhelp'] = true; |
---|
| 487 | |
---|
[0] | 488 | echo |
---|
[1573] | 489 | '<div id="help"><hr /><div class="help-content clear"><h3>'.__('Help about this page').'</h3>'. |
---|
[0] | 490 | $content. |
---|
[494] | 491 | '</div>'. |
---|
| 492 | '<div id="helplink"><hr />'. |
---|
| 493 | '<p>'. |
---|
| 494 | sprintf(__('See also %s'),sprintf('<a href="help.php">%s</a>',__('the global help'))). |
---|
[2011] | 495 | '.</p>'. |
---|
[0] | 496 | '</div></div>'; |
---|
| 497 | } |
---|
[1187] | 498 | |
---|
[0] | 499 | public static function jsLoad($src) |
---|
| 500 | { |
---|
[342] | 501 | $escaped_src = html::escapeHTML($src); |
---|
| 502 | if (!isset(self::$loaded_js[$escaped_src])) { |
---|
| 503 | self::$loaded_js[$escaped_src]=true; |
---|
| 504 | return '<script type="text/javascript" src="'.$escaped_src.'"></script>'."\n"; |
---|
| 505 | } |
---|
[0] | 506 | } |
---|
[1187] | 507 | |
---|
[0] | 508 | public static function jsVar($n,$v) |
---|
| 509 | { |
---|
| 510 | return $n." = '".html::escapeJS($v)."';\n"; |
---|
| 511 | } |
---|
[1187] | 512 | |
---|
[1699] | 513 | public static function jsToggles() |
---|
| 514 | { |
---|
| 515 | if($GLOBALS['core']->auth->user_prefs->toggles) { |
---|
| 516 | $unfolded_sections = explode(',',$GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); |
---|
| 517 | foreach ($unfolded_sections as $k=>&$v) { |
---|
| 518 | if ($v == '') { |
---|
| 519 | unset($unfolded_sections[$k]); |
---|
| 520 | } else { |
---|
| 521 | $v = "'".html::escapeJS($v)."':true"; |
---|
| 522 | } |
---|
| 523 | } |
---|
| 524 | } else { |
---|
| 525 | $unfolded_sections=array(); |
---|
| 526 | } |
---|
| 527 | return '<script type="text/javascript">'."\n". |
---|
| 528 | "//<![CDATA[\n". |
---|
| 529 | 'dotclear.unfolded_sections = {'.join(",",$unfolded_sections)."};\n". |
---|
| 530 | "\n//]]>\n". |
---|
| 531 | "</script>\n"; |
---|
| 532 | } |
---|
[0] | 533 | |
---|
| 534 | public static function jsCommon() |
---|
| 535 | { |
---|
[1771] | 536 | $mute_or_no = ''; |
---|
[1841] | 537 | if (empty($GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) { |
---|
[1771] | 538 | $mute_or_no .= |
---|
| 539 | '<script type="text/javascript">'."\n". |
---|
| 540 | "//<![CDATA[\n". |
---|
| 541 | 'jQuery.migrateMute = true;'. |
---|
| 542 | "\n//]]>\n". |
---|
| 543 | "</script>\n"; |
---|
| 544 | } |
---|
| 545 | |
---|
[0] | 546 | return |
---|
| 547 | self::jsLoad('js/jquery/jquery.js'). |
---|
[1771] | 548 | $mute_or_no. |
---|
| 549 | self::jsLoad('js/jquery/jquery-migrate-1.2.1.js'). |
---|
[0] | 550 | self::jsLoad('js/jquery/jquery.biscuit.js'). |
---|
| 551 | self::jsLoad('js/jquery/jquery.bgFade.js'). |
---|
| 552 | self::jsLoad('js/common.js'). |
---|
[447] | 553 | self::jsLoad('js/prelude.js'). |
---|
[1187] | 554 | |
---|
[0] | 555 | '<script type="text/javascript">'."\n". |
---|
| 556 | "//<![CDATA[\n". |
---|
| 557 | self::jsVar('dotclear.nonce',$GLOBALS['core']->getNonce()). |
---|
[1019] | 558 | self::jsVar('dotclear.img_plus_src','images/expand.png'). |
---|
[0] | 559 | self::jsVar('dotclear.img_plus_alt',__('uncover')). |
---|
[1019] | 560 | self::jsVar('dotclear.img_minus_src','images/hide.png'). |
---|
[0] | 561 | self::jsVar('dotclear.img_minus_alt',__('hide')). |
---|
| 562 | self::jsVar('dotclear.img_menu_on','images/menu_on.png'). |
---|
| 563 | self::jsVar('dotclear.img_menu_off','images/menu_off.png'). |
---|
[1187] | 564 | |
---|
[0] | 565 | self::jsVar('dotclear.msg.help', |
---|
[1933] | 566 | __('Need help?')). |
---|
[1302] | 567 | self::jsVar('dotclear.msg.help_hide', |
---|
| 568 | __('Hide')). |
---|
[1556] | 569 | self::jsVar('dotclear.msg.to_select', |
---|
| 570 | __('Select:')). |
---|
[0] | 571 | self::jsVar('dotclear.msg.no_selection', |
---|
| 572 | __('no selection')). |
---|
| 573 | self::jsVar('dotclear.msg.select_all', |
---|
| 574 | __('select all')). |
---|
| 575 | self::jsVar('dotclear.msg.invert_sel', |
---|
[1556] | 576 | __('Invert selection')). |
---|
[0] | 577 | self::jsVar('dotclear.msg.website', |
---|
| 578 | __('Web site:')). |
---|
| 579 | self::jsVar('dotclear.msg.email', |
---|
| 580 | __('Email:')). |
---|
| 581 | self::jsVar('dotclear.msg.ip_address', |
---|
| 582 | __('IP address:')). |
---|
| 583 | self::jsVar('dotclear.msg.error', |
---|
| 584 | __('Error:')). |
---|
| 585 | self::jsVar('dotclear.msg.entry_created', |
---|
| 586 | __('Entry has been successfully created.')). |
---|
| 587 | self::jsVar('dotclear.msg.edit_entry', |
---|
| 588 | __('Edit entry')). |
---|
| 589 | self::jsVar('dotclear.msg.view_entry', |
---|
| 590 | __('view entry')). |
---|
| 591 | self::jsVar('dotclear.msg.confirm_delete_posts', |
---|
| 592 | __("Are you sure you want to delete selected entries (%s)?")). |
---|
[1525] | 593 | self::jsVar('dotclear.msg.confirm_delete_categories', |
---|
| 594 | __("Are you sure you want to delete selected categories (%s)?")). |
---|
[0] | 595 | self::jsVar('dotclear.msg.confirm_delete_post', |
---|
| 596 | __("Are you sure you want to delete this entry?")). |
---|
[1395] | 597 | self::jsVar('dotclear.msg.click_to_unlock', |
---|
[1450] | 598 | __("Click here to unlock the field")). |
---|
[1049] | 599 | self::jsVar('dotclear.msg.confirm_spam_delete', |
---|
| 600 | __('Are you sure you want to delete all spams?')). |
---|
[0] | 601 | self::jsVar('dotclear.msg.confirm_delete_comments', |
---|
| 602 | __('Are you sure you want to delete selected comments (%s)?')). |
---|
| 603 | self::jsVar('dotclear.msg.confirm_delete_comment', |
---|
| 604 | __('Are you sure you want to delete this comment?')). |
---|
| 605 | self::jsVar('dotclear.msg.cannot_delete_users', |
---|
| 606 | __('Users with posts cannot be deleted.')). |
---|
| 607 | self::jsVar('dotclear.msg.confirm_delete_user', |
---|
| 608 | __('Are you sure you want to delete selected users (%s)?')). |
---|
| 609 | self::jsVar('dotclear.msg.confirm_delete_category', |
---|
| 610 | __('Are you sure you want to delete category "%s"?')). |
---|
| 611 | self::jsVar('dotclear.msg.confirm_reorder_categories', |
---|
| 612 | __('Are you sure you want to reorder all categories?')). |
---|
| 613 | self::jsVar('dotclear.msg.confirm_delete_media', |
---|
| 614 | __('Are you sure you want to remove media "%s"?')). |
---|
| 615 | self::jsVar('dotclear.msg.confirm_extract_current', |
---|
| 616 | __('Are you sure you want to extract archive in current directory?')). |
---|
| 617 | self::jsVar('dotclear.msg.confirm_remove_attachment', |
---|
| 618 | __('Are you sure you want to remove attachment "%s"?')). |
---|
| 619 | self::jsVar('dotclear.msg.confirm_delete_lang', |
---|
| 620 | __('Are you sure you want to delete "%s" language?')). |
---|
| 621 | self::jsVar('dotclear.msg.confirm_delete_plugin', |
---|
| 622 | __('Are you sure you want to delete "%s" plugin?')). |
---|
| 623 | self::jsVar('dotclear.msg.use_this_theme', |
---|
| 624 | __('Use this theme')). |
---|
| 625 | self::jsVar('dotclear.msg.remove_this_theme', |
---|
| 626 | __('Remove this theme')). |
---|
| 627 | self::jsVar('dotclear.msg.confirm_delete_theme', |
---|
| 628 | __('Are you sure you want to delete "%s" theme?')). |
---|
[1462] | 629 | self::jsVar('dotclear.msg.confirm_delete_backup', |
---|
| 630 | __('Are you sure you want to delete this backup?')). |
---|
[0] | 631 | self::jsVar('dotclear.msg.zip_file_content', |
---|
| 632 | __('Zip file content')). |
---|
| 633 | self::jsVar('dotclear.msg.xhtml_validator', |
---|
| 634 | __('XHTML markup validator')). |
---|
| 635 | self::jsVar('dotclear.msg.xhtml_valid', |
---|
| 636 | __('XHTML content is valid.')). |
---|
| 637 | self::jsVar('dotclear.msg.xhtml_not_valid', |
---|
| 638 | __('There are XHTML markup errors.')). |
---|
[1861] | 639 | self::jsVar('dotclear.msg.warning_validate_no_save_content', |
---|
[1832] | 640 | __('Attention: an audit of a content not yet registered.')). |
---|
[0] | 641 | self::jsVar('dotclear.msg.confirm_change_post_format', |
---|
| 642 | __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')). |
---|
[1256] | 643 | self::jsVar('dotclear.msg.confirm_change_post_format_noconvert', |
---|
| 644 | __("Warning: post format change will not convert existing content. You will need to apply new format by yourself. Proceed anyway?")). |
---|
[224] | 645 | self::jsVar('dotclear.msg.load_enhanced_uploader', |
---|
| 646 | __('Loading enhanced uploader, please wait.')). |
---|
[1699] | 647 | "\n//]]>\n". |
---|
[0] | 648 | "</script>\n"; |
---|
| 649 | } |
---|
[1187] | 650 | |
---|
[0] | 651 | public static function jsLoadIE7() |
---|
| 652 | { |
---|
| 653 | return |
---|
[1456] | 654 | '<!--[if lt IE 9]>'."\n". |
---|
| 655 | self::jsLoad('js/ie7/IE9.js'). |
---|
[0] | 656 | '<link rel="stylesheet" type="text/css" href="style/iesucks.css" />'."\n". |
---|
| 657 | '<![endif]-->'."\n"; |
---|
| 658 | } |
---|
[1187] | 659 | |
---|
[0] | 660 | public static function jsConfirmClose() |
---|
| 661 | { |
---|
| 662 | $args = func_get_args(); |
---|
| 663 | if (count($args) > 0) { |
---|
| 664 | foreach ($args as $k => $v) { |
---|
| 665 | $args[$k] = "'".html::escapeJS($v)."'"; |
---|
| 666 | } |
---|
| 667 | $args = implode(',',$args); |
---|
| 668 | } else { |
---|
| 669 | $args = ''; |
---|
| 670 | } |
---|
[1187] | 671 | |
---|
[0] | 672 | return |
---|
| 673 | self::jsLoad('js/confirm-close.js'). |
---|
| 674 | '<script type="text/javascript">'."\n". |
---|
| 675 | "//<![CDATA[\n". |
---|
| 676 | "confirmClosePage = new confirmClose(".$args."); ". |
---|
| 677 | "confirmClose.prototype.prompt = '".html::escapeJS(__('You have unsaved changes.'))."'; ". |
---|
| 678 | "\n//]]>\n". |
---|
| 679 | "</script>\n"; |
---|
| 680 | } |
---|
[1187] | 681 | |
---|
[0] | 682 | public static function jsPageTabs($default=null) |
---|
| 683 | { |
---|
| 684 | if ($default) { |
---|
| 685 | $default = "'".html::escapeJS($default)."'"; |
---|
| 686 | } |
---|
[2113] | 687 | |
---|
[0] | 688 | return |
---|
| 689 | self::jsLoad('js/jquery/jquery.pageTabs.js'). |
---|
| 690 | '<script type="text/javascript">'."\n". |
---|
| 691 | "//<![CDATA[\n". |
---|
[2010] | 692 | '$(function() {'."\n". |
---|
[2054] | 693 | '$.pageTabs('.$default.');'."\n". |
---|
[2113] | 694 | '});'. |
---|
[0] | 695 | "\n//]]>\n". |
---|
[2113] | 696 | "</script>\n". |
---|
| 697 | '<!--[if lt IE 8]>'."\n". |
---|
| 698 | self::jsLoad('js/ie7/ie7-hashchange.js'). |
---|
| 699 | '<script type="text/javascript">'."\n". |
---|
| 700 | "//<![CDATA[\n". |
---|
| 701 | '$(window).hashchange();'. |
---|
| 702 | "\n//]]>\n". |
---|
| 703 | "</script>\n". |
---|
| 704 | '<![endif]-->'."\n"; |
---|
[2010] | 705 | } |
---|
[1161] | 706 | |
---|
| 707 | public static function jsModal() |
---|
| 708 | { |
---|
| 709 | return |
---|
| 710 | '<link rel="stylesheet" type="text/css" href="style/modal/modal.css" />'."\n". |
---|
| 711 | self::jsLoad('js/jquery/jquery.modal.js'). |
---|
| 712 | '<script type="text/javascript">'."\n". |
---|
| 713 | "//<![CDATA[\n". |
---|
| 714 | self::jsVar('$.modal.prototype.params.loader_img','style/modal/loader.gif'). |
---|
| 715 | self::jsVar('$.modal.prototype.params.close_img','style/modal/close.png'). |
---|
| 716 | "\n//]]>\n". |
---|
| 717 | "</script>\n"; |
---|
| 718 | } |
---|
| 719 | |
---|
| 720 | public static function jsColorPicker() |
---|
| 721 | { |
---|
| 722 | return |
---|
| 723 | '<link rel="stylesheet" type="text/css" href="style/farbtastic/farbtastic.css" />'."\n". |
---|
| 724 | self::jsLoad('js/jquery/jquery.farbtastic.js'). |
---|
| 725 | self::jsLoad('js/color-picker.js'); |
---|
| 726 | } |
---|
| 727 | |
---|
| 728 | public static function jsDatePicker() |
---|
| 729 | { |
---|
| 730 | return |
---|
| 731 | '<link rel="stylesheet" type="text/css" href="style/date-picker.css" />'."\n". |
---|
| 732 | self::jsLoad('js/date-picker.js'). |
---|
| 733 | '<script type="text/javascript">'."\n". |
---|
| 734 | "//<![CDATA[\n". |
---|
[1187] | 735 | |
---|
[1161] | 736 | "datePicker.prototype.months[0] = '".html::escapeJS(__('January'))."'; ". |
---|
| 737 | "datePicker.prototype.months[1] = '".html::escapeJS(__('February'))."'; ". |
---|
| 738 | "datePicker.prototype.months[2] = '".html::escapeJS(__('March'))."'; ". |
---|
| 739 | "datePicker.prototype.months[3] = '".html::escapeJS(__('April'))."'; ". |
---|
| 740 | "datePicker.prototype.months[4] = '".html::escapeJS(__('May'))."'; ". |
---|
| 741 | "datePicker.prototype.months[5] = '".html::escapeJS(__('June'))."'; ". |
---|
| 742 | "datePicker.prototype.months[6] = '".html::escapeJS(__('July'))."'; ". |
---|
| 743 | "datePicker.prototype.months[7] = '".html::escapeJS(__('August'))."'; ". |
---|
| 744 | "datePicker.prototype.months[8] = '".html::escapeJS(__('September'))."'; ". |
---|
| 745 | "datePicker.prototype.months[9] = '".html::escapeJS(__('October'))."'; ". |
---|
| 746 | "datePicker.prototype.months[10] = '".html::escapeJS(__('November'))."'; ". |
---|
| 747 | "datePicker.prototype.months[11] = '".html::escapeJS(__('December'))."'; ". |
---|
[1187] | 748 | |
---|
[1161] | 749 | "datePicker.prototype.days[0] = '".html::escapeJS(__('Monday'))."'; ". |
---|
| 750 | "datePicker.prototype.days[1] = '".html::escapeJS(__('Tuesday'))."'; ". |
---|
| 751 | "datePicker.prototype.days[2] = '".html::escapeJS(__('Wednesday'))."'; ". |
---|
| 752 | "datePicker.prototype.days[3] = '".html::escapeJS(__('Thursday'))."'; ". |
---|
| 753 | "datePicker.prototype.days[4] = '".html::escapeJS(__('Friday'))."'; ". |
---|
| 754 | "datePicker.prototype.days[5] = '".html::escapeJS(__('Saturday'))."'; ". |
---|
| 755 | "datePicker.prototype.days[6] = '".html::escapeJS(__('Sunday'))."'; ". |
---|
[1187] | 756 | |
---|
[1161] | 757 | "datePicker.prototype.img_src = 'images/date-picker.png'; ". |
---|
[1187] | 758 | |
---|
[1161] | 759 | "datePicker.prototype.close_msg = '".html::escapeJS(__('close'))."'; ". |
---|
| 760 | "datePicker.prototype.now_msg = '".html::escapeJS(__('now'))."'; ". |
---|
[1187] | 761 | |
---|
[1161] | 762 | "\n//]]>\n". |
---|
| 763 | "</script>\n"; |
---|
| 764 | } |
---|
| 765 | |
---|
| 766 | public static function jsToolBar() |
---|
| 767 | { |
---|
| 768 | $res = |
---|
| 769 | '<link rel="stylesheet" type="text/css" href="style/jsToolBar/jsToolBar.css" />'. |
---|
| 770 | '<script type="text/javascript" src="js/jsToolBar/jsToolBar.js"></script>'; |
---|
[1187] | 771 | |
---|
[1161] | 772 | if (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('enable_wysiwyg')) { |
---|
| 773 | $res .= '<script type="text/javascript" src="js/jsToolBar/jsToolBar.wysiwyg.js"></script>'; |
---|
[0] | 774 | } |
---|
[1187] | 775 | |
---|
[1161] | 776 | $res .= |
---|
| 777 | '<script type="text/javascript" src="js/jsToolBar/jsToolBar.dotclear.js"></script>'. |
---|
| 778 | '<script type="text/javascript">'."\n". |
---|
| 779 | "//<![CDATA[\n". |
---|
| 780 | "jsToolBar.prototype.dialog_url = 'popup.php'; ". |
---|
| 781 | "jsToolBar.prototype.iframe_css = '". |
---|
| 782 | 'body{'. |
---|
| 783 | 'font: 12px "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;'. |
---|
| 784 | 'color : #000;'. |
---|
| 785 | 'background: #f9f9f9;'. |
---|
| 786 | 'margin: 0;'. |
---|
| 787 | 'padding : 2px;'. |
---|
| 788 | 'border: none;'. |
---|
| 789 | (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction:rtl;' : ''). |
---|
| 790 | '}'. |
---|
| 791 | 'pre, code, kbd, samp {'. |
---|
| 792 | 'font-family:"Courier New",Courier,monospace;'. |
---|
| 793 | 'font-size : 1.1em;'. |
---|
| 794 | '}'. |
---|
| 795 | 'code {'. |
---|
| 796 | 'color : #666;'. |
---|
| 797 | 'font-weight : bold;'. |
---|
| 798 | '}'. |
---|
| 799 | 'body > p:first-child {'. |
---|
| 800 | 'margin-top: 0;'. |
---|
| 801 | '}'. |
---|
| 802 | "'; ". |
---|
| 803 | "jsToolBar.prototype.base_url = '".html::escapeJS($GLOBALS['core']->blog->host)."'; ". |
---|
| 804 | "jsToolBar.prototype.switcher_visual_title = '".html::escapeJS(__('visual'))."'; ". |
---|
| 805 | "jsToolBar.prototype.switcher_source_title = '".html::escapeJS(__('source'))."'; ". |
---|
| 806 | "jsToolBar.prototype.legend_msg = '". |
---|
| 807 | html::escapeJS(__('You can use the following shortcuts to format your text.'))."'; ". |
---|
| 808 | "jsToolBar.prototype.elements.blocks.options.none = '".html::escapeJS(__('-- none --'))."'; ". |
---|
| 809 | "jsToolBar.prototype.elements.blocks.options.nonebis = '".html::escapeJS(__('-- block format --'))."'; ". |
---|
| 810 | "jsToolBar.prototype.elements.blocks.options.p = '".html::escapeJS(__('Paragraph'))."'; ". |
---|
| 811 | "jsToolBar.prototype.elements.blocks.options.h1 = '".html::escapeJS(__('Level 1 header'))."'; ". |
---|
| 812 | "jsToolBar.prototype.elements.blocks.options.h2 = '".html::escapeJS(__('Level 2 header'))."'; ". |
---|
| 813 | "jsToolBar.prototype.elements.blocks.options.h3 = '".html::escapeJS(__('Level 3 header'))."'; ". |
---|
| 814 | "jsToolBar.prototype.elements.blocks.options.h4 = '".html::escapeJS(__('Level 4 header'))."'; ". |
---|
| 815 | "jsToolBar.prototype.elements.blocks.options.h5 = '".html::escapeJS(__('Level 5 header'))."'; ". |
---|
| 816 | "jsToolBar.prototype.elements.blocks.options.h6 = '".html::escapeJS(__('Level 6 header'))."'; ". |
---|
| 817 | "jsToolBar.prototype.elements.strong.title = '".html::escapeJS(__('Strong emphasis'))."'; ". |
---|
| 818 | "jsToolBar.prototype.elements.em.title = '".html::escapeJS(__('Emphasis'))."'; ". |
---|
| 819 | "jsToolBar.prototype.elements.ins.title = '".html::escapeJS(__('Inserted'))."'; ". |
---|
| 820 | "jsToolBar.prototype.elements.del.title = '".html::escapeJS(__('Deleted'))."'; ". |
---|
| 821 | "jsToolBar.prototype.elements.quote.title = '".html::escapeJS(__('Inline quote'))."'; ". |
---|
| 822 | "jsToolBar.prototype.elements.code.title = '".html::escapeJS(__('Code'))."'; ". |
---|
| 823 | "jsToolBar.prototype.elements.br.title = '".html::escapeJS(__('Line break'))."'; ". |
---|
| 824 | "jsToolBar.prototype.elements.blockquote.title = '".html::escapeJS(__('Blockquote'))."'; ". |
---|
| 825 | "jsToolBar.prototype.elements.pre.title = '".html::escapeJS(__('Preformated text'))."'; ". |
---|
| 826 | "jsToolBar.prototype.elements.ul.title = '".html::escapeJS(__('Unordered list'))."'; ". |
---|
| 827 | "jsToolBar.prototype.elements.ol.title = '".html::escapeJS(__('Ordered list'))."'; ". |
---|
[1187] | 828 | |
---|
[1161] | 829 | "jsToolBar.prototype.elements.link.title = '".html::escapeJS(__('Link'))."'; ". |
---|
| 830 | "jsToolBar.prototype.elements.link.href_prompt = '".html::escapeJS(__('URL?'))."'; ". |
---|
| 831 | "jsToolBar.prototype.elements.link.hreflang_prompt = '".html::escapeJS(__('Language?'))."'; ". |
---|
[1187] | 832 | |
---|
[1161] | 833 | "jsToolBar.prototype.elements.img.title = '".html::escapeJS(__('External image'))."'; ". |
---|
| 834 | "jsToolBar.prototype.elements.img.src_prompt = '".html::escapeJS(__('URL?'))."'; ". |
---|
[1187] | 835 | |
---|
[1161] | 836 | "jsToolBar.prototype.elements.img_select.title = '".html::escapeJS(__('Media chooser'))."'; ". |
---|
| 837 | "jsToolBar.prototype.elements.post_link.title = '".html::escapeJS(__('Link to an entry'))."'; "; |
---|
[1187] | 838 | |
---|
[1161] | 839 | if (!$GLOBALS['core']->auth->check('media,media_admin',$GLOBALS['core']->blog->id)) { |
---|
| 840 | $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n"; |
---|
[0] | 841 | } |
---|
[1187] | 842 | |
---|
[1161] | 843 | $res .= |
---|
| 844 | "\n//]]>\n". |
---|
| 845 | "</script>\n"; |
---|
[1187] | 846 | |
---|
[1161] | 847 | return $res; |
---|
| 848 | } |
---|
| 849 | |
---|
| 850 | public static function jsUpload($params=array(),$base_url=null) |
---|
| 851 | { |
---|
| 852 | if (!$base_url) { |
---|
| 853 | $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/','',$_SERVER['REQUEST_URI']))).'/'; |
---|
[0] | 854 | } |
---|
[1187] | 855 | |
---|
[1161] | 856 | $params = array_merge($params,array( |
---|
| 857 | 'sess_id='.session_id(), |
---|
| 858 | 'sess_uid='.$_SESSION['sess_browser_uid'], |
---|
| 859 | 'xd_check='.$GLOBALS['core']->getNonce() |
---|
[0] | 860 | )); |
---|
[1187] | 861 | |
---|
[1161] | 862 | return |
---|
| 863 | '<script type="text/javascript">'."\n". |
---|
| 864 | "//<![CDATA[\n". |
---|
| 865 | "dotclear.jsUpload = {};\n". |
---|
| 866 | "dotclear.jsUpload.msg = {};\n". |
---|
| 867 | self::jsVar('dotclear.msg.enhanced_uploader_activate',__('Temporarily activate enhanced uploader')). |
---|
| 868 | self::jsVar('dotclear.msg.enhanced_uploader_disable',__('Temporarily disable enhanced uploader')). |
---|
| 869 | self::jsVar('dotclear.jsUpload.msg.limit_exceeded',__('Limit exceeded.')). |
---|
| 870 | self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded',__('File size exceeds allowed limit.')). |
---|
| 871 | self::jsVar('dotclear.jsUpload.msg.canceled',__('Canceled.')). |
---|
| 872 | self::jsVar('dotclear.jsUpload.msg.http_error',__('HTTP Error:')). |
---|
| 873 | self::jsVar('dotclear.jsUpload.msg.error',__('Error:')). |
---|
| 874 | self::jsVar('dotclear.jsUpload.msg.choose_file',__('Choose file')). |
---|
| 875 | self::jsVar('dotclear.jsUpload.msg.choose_files',__('Choose files')). |
---|
| 876 | self::jsVar('dotclear.jsUpload.msg.cancel',__('Cancel')). |
---|
| 877 | self::jsVar('dotclear.jsUpload.msg.clean',__('Clean')). |
---|
| 878 | self::jsVar('dotclear.jsUpload.msg.upload',__('Upload')). |
---|
[1461] | 879 | self::jsVar('dotclear.jsUpload.msg.send',__('Send')). |
---|
| 880 | self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded',__('File successfully uploaded.')). |
---|
[1161] | 881 | self::jsVar('dotclear.jsUpload.msg.no_file_in_queue',__('No file in queue.')). |
---|
| 882 | self::jsVar('dotclear.jsUpload.msg.file_in_queue',__('1 file in queue.')). |
---|
| 883 | self::jsVar('dotclear.jsUpload.msg.files_in_queue',__('%d files in queue.')). |
---|
| 884 | self::jsVar('dotclear.jsUpload.msg.queue_error',__('Queue error:')). |
---|
| 885 | self::jsVar('dotclear.jsUpload.base_url',$base_url). |
---|
| 886 | "\n//]]>\n". |
---|
[1461] | 887 | "</script>\n". |
---|
| 888 | |
---|
| 889 | self::jsLoad('js/jsUpload/vendor/jquery.ui.widget.js'). |
---|
| 890 | self::jsLoad('js/jsUpload/tmpl.js'). |
---|
| 891 | self::jsLoad('js/jsUpload/template-upload.js'). |
---|
| 892 | self::jsLoad('js/jsUpload/template-download.js'). |
---|
| 893 | self::jsLoad('js/jsUpload/load-image.js'). |
---|
| 894 | self::jsLoad('js/jsUpload/jquery.iframe-transport.js'). |
---|
| 895 | self::jsLoad('js/jsUpload/jquery.fileupload.js'). |
---|
| 896 | self::jsLoad('js/jsUpload/jquery.fileupload-process.js'). |
---|
| 897 | self::jsLoad('js/jsUpload/jquery.fileupload-resize.js'). |
---|
| 898 | self::jsLoad('js/jsUpload/jquery.fileupload-ui.js'); |
---|
[0] | 899 | } |
---|
[1144] | 900 | |
---|
[1161] | 901 | public static function jsToolMan() |
---|
| 902 | { |
---|
| 903 | return |
---|
| 904 | '<script type="text/javascript" src="js/tool-man/core.js"></script>'. |
---|
| 905 | '<script type="text/javascript" src="js/tool-man/events.js"></script>'. |
---|
| 906 | '<script type="text/javascript" src="js/tool-man/css.js"></script>'. |
---|
| 907 | '<script type="text/javascript" src="js/tool-man/coordinates.js"></script>'. |
---|
| 908 | '<script type="text/javascript" src="js/tool-man/drag.js"></script>'. |
---|
| 909 | '<script type="text/javascript" src="js/tool-man/dragsort.js"></script>'. |
---|
| 910 | '<script type="text/javascript" src="js/dragsort-tablerows.js"></script>'; |
---|
| 911 | } |
---|
[1144] | 912 | |
---|
[1161] | 913 | public static function jsMetaEditor() |
---|
| 914 | { |
---|
| 915 | return |
---|
| 916 | '<script type="text/javascript" src="js/meta-editor.js"></script>'; |
---|
| 917 | } |
---|
[489] | 918 | } |
---|
[1187] | 919 | ?> |
---|