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