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