Dotclear

source: inc/admin/lib.dc.page.php @ 3791:584be24d3601

Revision 3791:584be24d3601, 45.3 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

Various stuff without any impact so it is mandatory, isn'it?

Line 
1<?php
2/**
3 * @package Dotclear
4 * @subpackage Backend
5 *
6 * @copyright Olivier Meunier & Association Dotclear
7 * @copyright GPL-2.0-only
8 */
9
10if (!defined('DC_RC_PATH')) {return;}
11
12define('DC_AUTH_PAGE', 'auth.php');
13
14class dcPage
15{
16    private static $loaded_js     = array();
17    private static $loaded_css    = array();
18    private static $xframe_loaded = false;
19    private static $N_TYPES       = array(
20        "success" => "success",
21        "warning" => "warning-msg",
22        "error"   => "error",
23        "message" => "message",
24        "static"  => "static-msg");
25
26    # Auth check
27    public static function check($permissions)
28    {
29        global $core;
30
31        if ($core->blog && $core->auth->check($permissions, $core->blog->id)) {
32            return;
33        }
34
35        if (session_id()) {
36            $core->session->destroy();
37        }
38        http::redirect(DC_AUTH_PAGE);
39    }
40
41    # Check super admin
42    public static function checkSuper()
43    {
44        global $core;
45
46        if (!$core->auth->isSuperAdmin()) {
47            if (session_id()) {
48                $core->session->destroy();
49            }
50            http::redirect(DC_AUTH_PAGE);
51        }
52    }
53
54    # Top of admin page
55    public static function open($title = '', $head = '', $breadcrumb = '', $options = array())
56    {
57        global $core;
58
59        # List of user's blogs
60        if ($core->auth->getBlogCount() == 1 || $core->auth->getBlogCount() > 20) {
61            $blog_box =
62            '<p>' . __('Blog:') . ' <strong title="' . html::escapeHTML($core->blog->url) . '">' .
63            html::escapeHTML($core->blog->name) . '</strong>';
64
65            if ($core->auth->getBlogCount() > 20) {
66                $blog_box .= ' - <a href="' . $core->adminurl->get("admin.blogs") . '">' . __('Change blog') . '</a>';
67            }
68            $blog_box .= '</p>';
69        } else {
70            $rs_blogs = $core->getBlogs(array('order' => 'LOWER(blog_name)', 'limit' => 20));
71            $blogs    = array();
72            while ($rs_blogs->fetch()) {
73                $blogs[html::escapeHTML($rs_blogs->blog_name . ' - ' . $rs_blogs->blog_url)] = $rs_blogs->blog_id;
74            }
75            $blog_box =
76            '<p><label for="switchblog" class="classic">' .
77            __('Blogs:') . '</label> ' .
78            $core->formNonce() .
79            form::combo('switchblog', $blogs, $core->blog->id) .
80            '<input type="submit" value="' . __('ok') . '" class="hidden-if-js" /></p>';
81        }
82
83        $safe_mode = isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode'];
84
85        # Display
86        $headers = new ArrayObject(array());
87
88        # Content-Type
89        $headers['content-type'] = 'Content-Type: text/html; charset=UTF-8';
90
91        # Referrer Policy for admin pages
92        $headers['referrer'] = 'Referrer-Policy: strict-origin';
93
94        # Prevents Clickjacking as far as possible
95        if (isset($options['x-frame-allow'])) {
96            self::setXFrameOptions($headers, $options['x-frame-allow']);
97        } else {
98            self::setXFrameOptions($headers);
99        }
100
101        # Content-Security-Policy (only if safe mode if not active, it may help)
102        if (!$safe_mode && $core->blog->settings->system->csp_admin_on) {
103            // Get directives from settings if exist, else set defaults
104            $csp = new ArrayObject(array());
105
106                                                                                // SQlite Clearbricks driver does not allow using single quote at beginning or end of a field value
107                                                                                // so we have to use neutral values (localhost and 127.0.0.1) for some CSP directives
108            $csp_prefix = $core->con->driver() == 'sqlite' ? 'localhost ' : ''; // Hack for SQlite Clearbricks driver
109            $csp_suffix = $core->con->driver() == 'sqlite' ? ' 127.0.0.1' : ''; // Hack for SQlite Clearbricks driver
110
111            $csp['default-src'] = $core->blog->settings->system->csp_admin_default ?:
112            $csp_prefix . "'self'" . $csp_suffix;
113            $csp['script-src'] = $core->blog->settings->system->csp_admin_script ?:
114            $csp_prefix . "'self' 'unsafe-inline' 'unsafe-eval'" . $csp_suffix;
115            $csp['style-src'] = $core->blog->settings->system->csp_admin_style ?:
116            $csp_prefix . "'self' 'unsafe-inline'" . $csp_suffix;
117            $csp['img-src'] = $core->blog->settings->system->csp_admin_img ?:
118            $csp_prefix . "'self' data: http://media.dotaddict.org blob:";
119
120            # Cope with blog post preview (via public URL in iframe)
121            if (!is_null($core->blog->host)) {
122                $csp['default-src'] .= ' ' . parse_url($core->blog->host, PHP_URL_HOST);
123                $csp['script-src'] .= ' ' . parse_url($core->blog->host, PHP_URL_HOST);
124                $csp['style-src'] .= ' ' . parse_url($core->blog->host, PHP_URL_HOST);
125            }
126            # Cope with media display in media manager (via public URL)
127            if (!is_null($core->media)) {
128                $csp['img-src'] .= ' ' . parse_url($core->media->root_url, PHP_URL_HOST);
129            }
130            # Allow everything in iframe (used by editors to preview public content)
131            $csp['child-src'] = "*";
132
133            # --BEHAVIOR-- adminPageHTTPHeaderCSP
134            $core->callBehavior('adminPageHTTPHeaderCSP', $csp);
135
136            // Construct CSP header
137            $directives = array();
138            foreach ($csp as $key => $value) {
139                if ($value) {
140                    $directives[] = $key . ' ' . $value;
141                }
142            }
143            if (count($directives)) {
144                if (version_compare(phpversion(), '5.4', '>=')) {
145                    // csp_report.php needs PHP ≥ 5.4
146                    $directives[] = "report-uri " . DC_ADMIN_URL . "csp_report.php";
147                }
148                $report_only    = ($core->blog->settings->system->csp_admin_report_only) ? '-Report-Only' : '';
149                $headers['csp'] = "Content-Security-Policy" . $report_only . ": " . implode(" ; ", $directives);
150            }
151        }
152
153        # --BEHAVIOR-- adminPageHTTPHeaders
154        $core->callBehavior('adminPageHTTPHeaders', $headers);
155        foreach ($headers as $key => $value) {
156            header($value);
157        }
158
159        echo
160        '<!DOCTYPE html>' .
161        '<html lang="' . $core->auth->getInfo('user_lang') . '">' . "\n" .
162        "<head>\n" .
163        '  <meta charset="UTF-8" />' . "\n" .
164        '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />' . "\n" .
165        '  <meta name="GOOGLEBOT" content="NOSNIPPET" />' . "\n" .
166        '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />' . "\n" .
167        '  <title>' . $title . ' - ' . html::escapeHTML($core->blog->name) . ' - ' . html::escapeHTML(DC_VENDOR_NAME) . ' - ' . DC_VERSION . '</title>' . "\n";
168
169        if ($core->auth->user_prefs->interface->darkmode) {
170            echo self::cssLoad('style/default-dark.css');
171        } else {
172            echo self::cssLoad('style/default.css');
173        }
174        if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
175            echo self::cssLoad('style/default-rtl.css');
176        }
177
178        $core->auth->user_prefs->addWorkspace('interface');
179        if (!$core->auth->user_prefs->interface->hide_std_favicon) {
180            echo
181                '<link rel="icon" type="image/png" href="images/favicon96-login.png" />' . "\n" .
182                '<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />' . "\n";
183        }
184
185        if ($core->auth->user_prefs->interface->htmlfontsize) {
186            echo
187            '<script type="text/javascript">' . "\n" .
188            self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" .
189                "</script>\n";
190        }
191
192        echo
193        self::jsCommon() .
194        self::jsToggles() .
195            $head;
196
197        if ($core->auth->user_prefs->interface->hidemoreinfo) {
198            echo
199                '<script type="text/javascript">' . "\n" .
200                'dotclear.hideMoreInfo = true;' . "\n" .
201                "</script>\n";
202        }
203        if ($core->auth->user_prefs->interface->showajaxloader) {
204            echo
205                '<script type="text/javascript">' . "\n" .
206                'dotclear.showAjaxLoader = true;' . "\n" .
207                "</script>\n";
208        }
209
210        # --BEHAVIOR-- adminPageHTMLHead
211        $core->callBehavior('adminPageHTMLHead');
212
213        echo
214        "</head>\n" .
215        '<body id="dotclear-admin' .
216        ($safe_mode ? ' safe-mode' : '') . '" class="no-js' .
217        ($core->auth->user_prefs->interface->dynfontsize ? ' responsive-font' : '') . '">' . "\n" .
218
219        '<ul id="prelude">' .
220        '<li><a href="#content">' . __('Go to the content') . '</a></li>' .
221        '<li><a href="#main-menu">' . __('Go to the menu') . '</a></li>' .
222        '<li><a href="#qx">' . __('Go to search') . '</a></li>' .
223        '<li><a href="#help">' . __('Go to help') . '</a></li>' .
224        '</ul>' . "\n" .
225        '<div id="header" role="banner">' .
226        '<h1><a href="' . $core->adminurl->get("admin.home") . '"><span class="hidden">' . DC_VENDOR_NAME . '</span></a></h1>' . "\n";
227
228        echo
229        '<form action="' . $core->adminurl->get("admin.home") . '" method="post" id="top-info-blog">' .
230        $blog_box .
231        '<p><a href="' . $core->blog->url . '" class="outgoing" title="' . __('Go to site') .
232        '">' . __('Go to site') . '<img src="images/outgoing-link.svg" alt="" /></a>' .
233        '</p></form>' .
234        '<ul id="top-info-user">' .
235        '<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>' .
236        '<li><a class="smallscreen' . (preg_match('/' . preg_quote($core->adminurl->get('admin.user.preferences')) . '(\?.*)?$/', $_SERVER['REQUEST_URI']) ? ' active' : '') .
237        '" href="' . $core->adminurl->get("admin.user.preferences") . '">' . __('My preferences') . '</a></li>' .
238        '<li><a href="' . $core->adminurl->get("admin.home", array('logout' => 1)) . '" class="logout"><span class="nomobile">' . sprintf(__('Logout %s'), $core->auth->userID()) .
239            '</span><img src="images/logout.png" alt="" /></a></li>' .
240            '</ul>' .
241            '</div>'; // end header
242
243        echo
244        '<div id="wrapper" class="clearfix">' . "\n" .
245        '<div class="hidden-if-no-js collapser-box"><button type="button" id="collapser" class="void-btn">' .
246        '<img class="collapse-mm visually-hidden" src="images/collapser-hide.png" alt="' . __('Hide main menu') . '" />' .
247        '<img class="expand-mm visually-hidden" src="images/collapser-show.png" alt="' . __('Show main menu') . '" />' .
248            '</button></div>' .
249            '<div id="main" role="main">' . "\n" .
250            '<div id="content" class="clearfix">' . "\n";
251
252        # Safe mode
253        if ($safe_mode) {
254            echo
255            '<div class="warning" role="alert"><h3>' . __('Safe mode') . '</h3>' .
256            '<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>' .
257                '</div>';
258        }
259
260        // Display breadcrumb (if given) before any error messages
261        echo $breadcrumb;
262
263        // Display notices and errors
264        echo self::notices();
265    }
266
267    public static function notices()
268    {
269        global $core;
270        static $error_displayed = false;
271
272        $res = '';
273
274        // return error messages if any
275        if ($core->error->flag() && !$error_displayed) {
276
277            # --BEHAVIOR-- adminPageNotificationError
278            $notice_error = $core->callBehavior('adminPageNotificationError', $core, $core->error);
279
280            if (isset($notice_error) && !empty($notice_error)) {
281                $res .= $notice_error;
282            } else {
283                $res .= '<div class="error"><p>' .
284                '<strong>' . (count($core->error->getErrors()) > 1 ? __('Errors:') : __('Error:')) . '</strong>' .
285                '</p>' . $core->error->toHTML() . '</div>';
286            }
287            $error_displayed = true;
288        }
289
290        // return notices if any
291        if (isset($_SESSION['notifications'])) {
292            foreach ($_SESSION['notifications'] as $notification) {
293
294                # --BEHAVIOR-- adminPageNotification
295                $notice = $core->callBehavior('adminPageNotification', $core, $notification);
296
297                $res .= (isset($notice) && !empty($notice) ? $notice : self::getNotification($notification));
298            }
299            unset($_SESSION['notifications']);
300        }
301        return $res;
302    }
303
304    public static function addNotice($type, $message, $options = array())
305    {
306        if (isset(self::$N_TYPES[$type])) {
307            $class = self::$N_TYPES[$type];
308        } else {
309            $class = $type;
310        }
311        if (isset($_SESSION['notifications']) && is_array($_SESSION['notifications'])) {
312            $notifications = $_SESSION['notifications'];
313        } else {
314            $notifications = array();
315        }
316
317        $n = array_merge($options, array('class' => $class, 'ts' => time(), 'text' => $message));
318        if ($type != "static") {
319            $notifications[] = $n;
320        } else {
321            array_unshift($notifications, $n);
322        }
323        $_SESSION['notifications'] = $notifications;
324    }
325
326    public static function addSuccessNotice($message, $options = array())
327    {
328        self::addNotice("success", $message, $options);
329    }
330
331    public static function addWarningNotice($message, $options = array())
332    {
333        self::addNotice("warning", $message, $options);
334    }
335
336    public static function addErrorNotice($message, $options = array())
337    {
338        self::addNotice("error", $message, $options);
339    }
340
341    protected static function getNotification($n)
342    {
343        global $core;
344        $tag = (isset($n['divtag']) && $n['divtag']) ? 'div' : 'p';
345        $ts  = '';
346        if (!isset($n['with_ts']) || ($n['with_ts'] == true)) {
347            $ts = dt::str(__('[%H:%M:%S]'), $n['ts'], $core->auth->getInfo('user_tz')) . ' ';
348        }
349        $res = '<' . $tag . ' class="' . $n['class'] . '" role="alert">' . $ts . $n['text'] . '</' . $tag . '>';
350        return $res;
351    }
352
353    public static function close()
354    {
355        global $core;
356
357        if (!$GLOBALS['__resources']['ctxhelp']) {
358            if (!$core->auth->user_prefs->interface->hidehelpbutton) {
359                echo
360                '<p id="help-button"><a href="' . $core->adminurl->get("admin.help") . '" class="outgoing" title="' .
361                __('Global help') . '">' . __('Global help') . '</a></p>';
362            }
363        }
364
365        $menu = &$GLOBALS['_menu'];
366
367        echo
368        "</div>\n" . // End of #content
369        "</div>\n" . // End of #main
370
371        '<div id="main-menu" role="navigation">' . "\n" .
372
373        '<form id="search-menu" action="' . $core->adminurl->get("admin.search") . '" method="get" role="search">' .
374        '<p><label for="qx" class="hidden">' . __('Search:') . ' </label>' . form::field('qx', 30, 255, '') .
375        '<input type="submit" value="' . __('OK') . '" /></p>' .
376            '</form>';
377
378        foreach ($menu as $k => $v) {
379            echo $menu[$k]->draw();
380        }
381
382        $text = sprintf(__('Thank you for using %s.'), 'Dotclear ' . DC_VERSION);
383
384        # --BEHAVIOR-- adminPageFooter
385        $textAlt = $core->callBehavior('adminPageFooter', $core, $text);
386        if ($textAlt != '') {
387            $text = $textAlt;
388        }
389        $text = html::escapeHTML($text);
390
391        echo
392        '</div>' . "\n" . // End of #main-menu
393        "</div>\n";       // End of #wrapper
394
395        echo '<p id="gototop"><a href="#wrapper">' . __('Page top') . '</a></p>' . "\n";
396
397        $figure = "
398  ♥‿♥
399              |    |    |
400             )_)  )_)  )_)
401            )___))___))___)\
402           )____)____)_____)\\
403         _____|____|____|____\\\__
404---------\                   /---------
405  ^^^^^ ^^^^^^^^^^^^^^^^^^^^^
406    ^^^^      ^^^^     ^^^    ^^
407         ^^^^      ^^^
408  ";
409
410        echo
411            '<div id="footer" role="contentinfo">' .
412            '<a href="http://dotclear.org/" title="' . $text . '">' .
413            '<img src="style/dc_logos/w-dotclear90.png" alt="' . $text . '" /></a></div>' . "\n" .
414            "<!-- " . "\n" .
415            $figure .
416            " -->" . "\n";
417
418        if (defined('DC_DEV') && DC_DEV === true) {
419            echo self::debugInfo();
420        }
421
422        echo
423            '</body></html>';
424    }
425
426    public static function openPopup($title = '', $head = '', $breadcrumb = '')
427    {
428        global $core;
429
430        # Display
431        header('Content-Type: text/html; charset=UTF-8');
432
433        # Referrer Policy for admin pages
434        header('Referrer-Policy: strict-origin');
435
436        # Prevents Clickjacking as far as possible
437        header('X-Frame-Options: SAMEORIGIN'); // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+
438
439        echo
440        '<!DOCTYPE html>' .
441        '<html lang="' . $core->auth->getInfo('user_lang') . '">' . "\n" .
442        "<head>\n" .
443        '  <meta charset="UTF-8" />' . "\n" .
444        '  <meta name="viewport" content="width=device-width, initial-scale=1.0" />' . "\n" .
445        '  <title>' . $title . ' - ' . html::escapeHTML($core->blog->name) . ' - ' . html::escapeHTML(DC_VENDOR_NAME) . ' - ' . DC_VERSION . '</title>' . "\n" .
446        '  <meta name="ROBOTS" content="NOARCHIVE,NOINDEX,NOFOLLOW" />' . "\n" .
447        '  <meta name="GOOGLEBOT" content="NOSNIPPET" />' . "\n";
448
449        if ($core->auth->user_prefs->interface->darkmode) {
450            echo self::cssLoad('style/default-dark.css');
451        } else {
452            echo self::cssLoad('style/default.css');
453        }
454        if (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl') {
455            echo self::cssLoad('style/default-rtl.css');
456        }
457
458        $core->auth->user_prefs->addWorkspace('interface');
459        if ($core->auth->user_prefs->interface->htmlfontsize) {
460            echo
461            '<script type="text/javascript">' . "\n" .
462            self::jsVar('dotclear_htmlFontSize', $core->auth->user_prefs->interface->htmlfontsize) . "\n" .
463                "</script>\n";
464        }
465
466        echo
467        self::jsCommon() .
468        self::jsToggles() .
469            $head;
470
471        if ($core->auth->user_prefs->interface->hidemoreinfo) {
472            echo
473                '<script type="text/javascript">' . "\n" .
474                'dotclear.hideMoreInfo = true;' . "\n" .
475                "</script>\n";
476        }
477        if ($core->auth->user_prefs->interface->showajaxloader) {
478            echo
479                '<script type="text/javascript">' . "\n" .
480                'dotclear.showAjaxLoader = true;' . "\n" .
481                "</script>\n";
482        }
483
484        # --BEHAVIOR-- adminPageHTMLHead
485        $core->callBehavior('adminPageHTMLHead');
486
487        echo
488            "</head>\n" .
489            '<body id="dotclear-admin" class="popup' .
490            ($core->auth->user_prefs->interface->dynfontsize ? ' responsive-font' : '') . '">' . "\n" .
491
492            '<h1>' . DC_VENDOR_NAME . '</h1>' . "\n";
493
494        echo
495            '<div id="wrapper">' . "\n" .
496            '<div id="main" role="main">' . "\n" .
497            '<div id="content">' . "\n";
498
499        // display breadcrumb if given
500        echo $breadcrumb;
501
502        // Display notices and errors
503        echo self::notices();
504    }
505
506    public static function closePopup()
507    {
508        echo
509        "</div>\n" . // End of #content
510        "</div>\n" . // End of #main
511        "</div>\n" . // End of #wrapper
512
513        '<p id="gototop"><a href="#wrapper">' . __('Page top') . '</a></p>' . "\n" .
514
515            '<div id="footer" role="contentinfo"><p>&nbsp;</p></div>' . "\n" .
516            '</body></html>';
517    }
518
519    public static function breadcrumb($elements = null, $options = array())
520    {
521        global $core;
522        $with_home_link = isset($options['home_link']) ? $options['home_link'] : true;
523        $hl             = isset($options['hl']) ? $options['hl'] : true;
524        $hl_pos         = isset($options['hl_pos']) ? $options['hl_pos'] : -1;
525        // First item of array elements should be blog's name, System or Plugins
526        $res = '<h2>' . ($with_home_link ?
527            '<a class="go_home" href="' . $core->adminurl->get("admin.home") . '"><img src="style/dashboard.png" alt="' . __('Go to dashboard') . '" /></a>' :
528            '<img src="style/dashboard-alt.png" alt="" />');
529        $index = 0;
530        if ($hl_pos < 0) {
531            $hl_pos = count($elements) + $hl_pos;
532        }
533        foreach ($elements as $element => $url) {
534            if ($hl && $index == $hl_pos) {
535                $element = sprintf('<span class="page-title">%s</span>', $element);
536            }
537            $res .= ($with_home_link ? ($index == 1 ? ' : ' : ' &rsaquo; ') : ($index == 0 ? ' ' : ' &rsaquo; ')) .
538                ($url ? '<a href="' . $url . '">' : '') . $element . ($url ? '</a>' : '');
539            $index++;
540        }
541        $res .= '</h2>';
542        return $res;
543    }
544
545    public static function message($msg, $timestamp = true, $div = false, $echo = true, $class = 'message')
546    {
547        global $core;
548
549        $res = '';
550        if ($msg != '') {
551            $res = ($div ? '<div class="' . $class . '">' : '') . '<p' . ($div ? '' : ' class="' . $class . '"') . '>' .
552                ($timestamp ? dt::str(__('[%H:%M:%S]'), null, $core->auth->getInfo('user_tz')) . ' ' : '') . $msg .
553                '</p>' . ($div ? '</div>' : '');
554            if ($echo) {
555                echo $res;
556            }
557        }
558        return $res;
559    }
560
561    public static function success($msg, $timestamp = true, $div = false, $echo = true)
562    {
563        return self::message($msg, $timestamp, $div, $echo, "success");
564    }
565
566    public static function warning($msg, $timestamp = true, $div = false, $echo = true)
567    {
568        return self::message($msg, $timestamp, $div, $echo, "warning-msg");
569    }
570
571    private static function debugInfo()
572    {
573        $global_vars = implode(', ', array_keys($GLOBALS));
574
575        $res =
576        '<div id="debug"><div>' .
577        '<p>memory usage: ' . memory_get_usage() . ' (' . files::size(memory_get_usage()) . ')</p>';
578
579        if (function_exists('xdebug_get_profiler_filename')) {
580            $res .= '<p>Elapsed time: ' . xdebug_time_index() . ' seconds</p>';
581
582            $prof_file = xdebug_get_profiler_filename();
583            if ($prof_file) {
584                $res .= '<p>Profiler file : ' . xdebug_get_profiler_filename() . '</p>';
585            } else {
586                $prof_url = http::getSelfURI();
587                $prof_url .= (strpos($prof_url, '?') === false) ? '?' : '&';
588                $prof_url .= 'XDEBUG_PROFILE';
589                $res .= '<p><a href="' . html::escapeURL($prof_url) . '">Trigger profiler</a></p>';
590            }
591
592            /* xdebug configuration:
593        zend_extension = /.../xdebug.so
594        xdebug.auto_trace = On
595        xdebug.trace_format = 0
596        xdebug.trace_options = 1
597        xdebug.show_mem_delta = On
598        xdebug.profiler_enable = 0
599        xdebug.profiler_enable_trigger = 1
600        xdebug.profiler_output_dir = /tmp
601        xdebug.profiler_append = 0
602        xdebug.profiler_output_name = timestamp
603         */
604        }
605
606        $res .=
607            '<p>Global vars: ' . $global_vars . '</p>' .
608            '</div></div>';
609
610        return $res;
611    }
612
613    public static function help($page, $index = '')
614    {
615        # Deprecated but we keep this for plugins.
616    }
617
618    public static function helpBlock()
619    {
620        global $core;
621
622        if ($core->auth->user_prefs->interface->hidehelpbutton) {
623            return;
624        }
625
626        $args = func_get_args();
627        $args = new ArrayObject($args);
628
629        # --BEHAVIOR-- adminPageHelpBlock
630        $GLOBALS['core']->callBehavior('adminPageHelpBlock', $args);
631
632        if (empty($args)) {
633            return;
634        };
635
636        global $__resources;
637        if (empty($__resources['help'])) {
638            return;
639        }
640
641        $content = '';
642        foreach ($args as $v) {
643            if (is_object($v) && isset($v->content)) {
644                $content .= $v->content;
645                continue;
646            }
647
648            if (!isset($__resources['help'][$v])) {
649                continue;
650            }
651            $f = $__resources['help'][$v];
652            if (!file_exists($f) || !is_readable($f)) {
653                continue;
654            }
655
656            $fc = file_get_contents($f);
657            if (preg_match('|<body[^>]*?>(.*?)</body>|ms', $fc, $matches)) {
658                $content .= $matches[1];
659            } else {
660                $content .= $fc;
661            }
662        }
663
664        if (trim($content) == '') {
665            return;
666        }
667
668        // Set contextual help global flag
669        $GLOBALS['__resources']['ctxhelp'] = true;
670
671        echo
672        '<div id="help"><hr /><div class="help-content clear"><h3>' . __('Help about this page') . '</h3>' .
673        $content .
674        '</div>' .
675        '<div id="helplink"><hr />' .
676        '<p>' .
677        sprintf(__('See also %s'), sprintf('<a href="' . $core->adminurl->get("admin.help") . '">%s</a>', __('the global help'))) .
678            '.</p>' .
679            '</div></div>';
680    }
681
682    public static function cssLoad($src, $media = 'screen', $v = '')
683    {
684        $escaped_src = html::escapeHTML($src);
685        if (!isset(self::$loaded_css[$escaped_src])) {
686            self::$loaded_css[$escaped_src] = true;
687            $escaped_src                    = self::appendVersion($escaped_src, $v);
688
689            return '<link rel="stylesheet" href="' . $escaped_src . '" type="text/css" media="' . $media . '" />' . "\n";
690        }
691    }
692
693    public static function jsLoad($src, $v = '')
694    {
695        $escaped_src = html::escapeHTML($src);
696        if (!isset(self::$loaded_js[$escaped_src])) {
697            self::$loaded_js[$escaped_src] = true;
698            $escaped_src                   = self::appendVersion($escaped_src, $v);
699            return '<script type="text/javascript" src="' . $escaped_src . '"></script>' . "\n";
700        }
701    }
702
703    private static function appendVersion($src, $v = '')
704    {
705        $src .= (strpos($src, '?') === false ? '?' : '&amp;') . 'v=';
706        if (defined('DC_DEV') && DC_DEV === true) {
707            $src .= md5(uniqid());
708        } else {
709            $src .= ($v === '' ? DC_VERSION : $v);
710        }
711        return $src;
712    }
713
714    public static function jsVar($n, $v)
715    {
716        return $n . " = '" . html::escapeJS($v) . "';\n";
717    }
718
719    public static function jsVars($vars)
720    {
721        $ret = '<script type="text/javascript">' . "\n";
722        foreach ($vars as $var => $value) {
723            $ret .= $var . ' = ' . (is_string($value) ? "'" . html::escapeJS($value) . "'" : $value) . ';' . "\n";
724        }
725        $ret .= "</script>\n";
726
727        return $ret;
728    }
729
730    public static function jsToggles()
731    {
732        if ($GLOBALS['core']->auth->user_prefs->toggles) {
733            $unfolded_sections = explode(',', $GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections);
734            foreach ($unfolded_sections as $k => &$v) {
735                if ($v == '') {
736                    unset($unfolded_sections[$k]);
737                } else {
738                    $v = "'" . html::escapeJS($v) . "':true";
739                }
740            }
741        } else {
742            $unfolded_sections = array();
743        }
744        return '<script type="text/javascript">' . "\n" .
745        'dotclear.unfolded_sections = {' . join(",", $unfolded_sections) . "};\n" .
746            "</script>\n";
747    }
748
749    public static function jsCommon()
750    {
751        $mute_or_no = '';
752        if (empty($GLOBALS['core']->blog) || $GLOBALS['core']->blog->settings->system->jquery_migrate_mute) {
753            $mute_or_no .=
754                '<script type="text/javascript">' . "\n" .
755                'jQuery.migrateMute = true;' . "\n" .
756                "</script>\n";
757        }
758
759        return
760        self::jsLoad('js/jquery/jquery.js') .
761        $mute_or_no .
762        self::jsLoad('js/jquery/jquery-migrate.js') .
763        self::jsLoad('js/jquery/jquery.biscuit.js') .
764        self::jsLoad('js/common.js') .
765        self::jsLoad('js/prelude.js') .
766
767        '<script type="text/javascript">' . "\n" .
768        'jsToolBar = {}, jsToolBar.prototype = { elements : {} };' . "\n" .
769
770        self::jsVar('dotclear.nonce', $GLOBALS['core']->getNonce()) .
771
772        self::jsVar('dotclear.img_plus_src', 'images/expand.png') .
773        self::jsVar('dotclear.img_plus_txt', '►') .
774        self::jsVar('dotclear.img_plus_alt', __('uncover')) .
775        self::jsVar('dotclear.img_minus_src', 'images/hide.png') .
776        self::jsVar('dotclear.img_minus_txt', '▼') .
777        self::jsVar('dotclear.img_minus_alt', __('hide')) .
778        self::jsVar('dotclear.img_menu_on', 'images/menu_on.png') .
779        self::jsVar('dotclear.img_menu_off', 'images/menu_off.png') .
780
781        self::jsVar('dotclear.img_plus_theme_src', 'images/plus-theme.png') .
782        self::jsVar('dotclear.img_plus_theme_txt', '►') .
783        self::jsVar('dotclear.img_plus_theme_alt', __('uncover')) .
784        self::jsVar('dotclear.img_minus_theme_src', 'images/minus-theme.png') .
785        self::jsVar('dotclear.img_minus_theme_txt', '▼') .
786        self::jsVar('dotclear.img_minus_theme_alt', __('hide')) .
787
788        self::jsVar('dotclear.msg.help',
789            __('Need help?')) .
790        self::jsVar('dotclear.msg.new_window',
791            __('new window')) .
792        self::jsVar('dotclear.msg.help_hide',
793            __('Hide')) .
794        self::jsVar('dotclear.msg.to_select',
795            __('Select:')) .
796        self::jsVar('dotclear.msg.no_selection',
797            __('no selection')) .
798        self::jsVar('dotclear.msg.select_all',
799            __('select all')) .
800        self::jsVar('dotclear.msg.invert_sel',
801            __('Invert selection')) .
802        self::jsVar('dotclear.msg.website',
803            __('Web site:')) .
804        self::jsVar('dotclear.msg.email',
805            __('Email:')) .
806        self::jsVar('dotclear.msg.ip_address',
807            __('IP address:')) .
808        self::jsVar('dotclear.msg.error',
809            __('Error:')) .
810        self::jsVar('dotclear.msg.entry_created',
811            __('Entry has been successfully created.')) .
812        self::jsVar('dotclear.msg.edit_entry',
813            __('Edit entry')) .
814        self::jsVar('dotclear.msg.view_entry',
815            __('view entry')) .
816        self::jsVar('dotclear.msg.confirm_delete_posts',
817            __("Are you sure you want to delete selected entries (%s)?")) .
818        self::jsVar('dotclear.msg.confirm_delete_medias',
819            __("Are you sure you want to delete selected medias (%d)?")) .
820        self::jsVar('dotclear.msg.confirm_delete_categories',
821            __("Are you sure you want to delete selected categories (%s)?")) .
822        self::jsVar('dotclear.msg.confirm_delete_post',
823            __("Are you sure you want to delete this entry?")) .
824        self::jsVar('dotclear.msg.click_to_unlock',
825            __("Click here to unlock the field")) .
826        self::jsVar('dotclear.msg.confirm_spam_delete',
827            __('Are you sure you want to delete all spams?')) .
828        self::jsVar('dotclear.msg.confirm_delete_comments',
829            __('Are you sure you want to delete selected comments (%s)?')) .
830        self::jsVar('dotclear.msg.confirm_delete_comment',
831            __('Are you sure you want to delete this comment?')) .
832        self::jsVar('dotclear.msg.cannot_delete_users',
833            __('Users with posts cannot be deleted.')) .
834        self::jsVar('dotclear.msg.confirm_delete_user',
835            __('Are you sure you want to delete selected users (%s)?')) .
836        self::jsVar('dotclear.msg.confirm_delete_blog',
837            __('Are you sure you want to delete selected blogs (%s)?')) .
838        self::jsVar('dotclear.msg.confirm_delete_category',
839            __('Are you sure you want to delete category "%s"?')) .
840        self::jsVar('dotclear.msg.confirm_reorder_categories',
841            __('Are you sure you want to reorder all categories?')) .
842        self::jsVar('dotclear.msg.confirm_delete_media',
843            __('Are you sure you want to remove media "%s"?')) .
844        self::jsVar('dotclear.msg.confirm_delete_directory',
845            __('Are you sure you want to remove directory "%s"?')) .
846        self::jsVar('dotclear.msg.confirm_extract_current',
847            __('Are you sure you want to extract archive in current directory?')) .
848        self::jsVar('dotclear.msg.confirm_remove_attachment',
849            __('Are you sure you want to remove attachment "%s"?')) .
850        self::jsVar('dotclear.msg.confirm_delete_lang',
851            __('Are you sure you want to delete "%s" language?')) .
852        self::jsVar('dotclear.msg.confirm_delete_plugin',
853            __('Are you sure you want to delete "%s" plugin?')) .
854        self::jsVar('dotclear.msg.confirm_delete_plugins',
855            __('Are you sure you want to delete selected plugins?')) .
856        self::jsVar('dotclear.msg.use_this_theme',
857            __('Use this theme')) .
858        self::jsVar('dotclear.msg.remove_this_theme',
859            __('Remove this theme')) .
860        self::jsVar('dotclear.msg.confirm_delete_theme',
861            __('Are you sure you want to delete "%s" theme?')) .
862        self::jsVar('dotclear.msg.confirm_delete_themes',
863            __('Are you sure you want to delete selected themes?')) .
864        self::jsVar('dotclear.msg.confirm_delete_backup',
865            __('Are you sure you want to delete this backup?')) .
866        self::jsVar('dotclear.msg.confirm_revert_backup',
867            __('Are you sure you want to revert to this backup?')) .
868        self::jsVar('dotclear.msg.zip_file_content',
869            __('Zip file content')) .
870        self::jsVar('dotclear.msg.xhtml_validator',
871            __('XHTML markup validator')) .
872        self::jsVar('dotclear.msg.xhtml_valid',
873            __('XHTML content is valid.')) .
874        self::jsVar('dotclear.msg.xhtml_not_valid',
875            __('There are XHTML markup errors.')) .
876        self::jsVar('dotclear.msg.warning_validate_no_save_content',
877            __('Attention: an audit of a content not yet registered.')) .
878        self::jsVar('dotclear.msg.confirm_change_post_format',
879            __('You have unsaved changes. Switch post format will loose these changes. Proceed anyway?')) .
880        self::jsVar('dotclear.msg.confirm_change_post_format_noconvert',
881            __("Warning: post format change will not convert existing content. You will need to apply new format by yourself. Proceed anyway?")) .
882        self::jsVar('dotclear.msg.load_enhanced_uploader',
883            __('Loading enhanced uploader, please wait.')) .
884
885        self::jsVar('dotclear.msg.module_author',
886            __('Author:')) .
887        self::jsVar('dotclear.msg.module_details',
888            __('Details')) .
889        self::jsVar('dotclear.msg.module_support',
890            __('Support')) .
891        self::jsVar('dotclear.msg.module_help',
892            __('Help:')) .
893        self::jsVar('dotclear.msg.module_section',
894            __('Section:')) .
895        self::jsVar('dotclear.msg.module_tags',
896            __('Tags:')) .
897
898        self::jsVar('dotclear.msg.close_notice',
899            __('Hide this notice')) .
900
901            "\n" .
902            "</script>\n";
903    }
904
905    /**
906    @deprecated since version 2.11
907     */
908    public static function jsLoadIE7()
909    {
910        return '';
911    }
912
913    public static function jsConfirmClose()
914    {
915        $args = func_get_args();
916        if (count($args) > 0) {
917            foreach ($args as $k => $v) {
918                $args[$k] = "'" . html::escapeJS($v) . "'";
919            }
920            $args = implode(',', $args);
921        } else {
922            $args = '';
923        }
924
925        return
926        self::jsLoad('js/confirm-close.js') .
927        '<script type="text/javascript">' . "\n" .
928        "confirmClosePage = new confirmClose(" . $args . "); " .
929        "confirmClose.prototype.prompt = '" . html::escapeJS(__('You have unsaved changes.')) . "'; " .
930            "</script>\n";
931    }
932
933    public static function jsPageTabs($default = null)
934    {
935        if ($default) {
936            $default = "'" . html::escapeJS($default) . "'";
937        }
938
939        return
940        self::jsLoad('js/jquery/jquery.pageTabs.js') .
941            '<script type="text/javascript">' . "\n" .
942            '$(function() {' . "\n" .
943            '   $.pageTabs(' . $default . ');' . "\n" .
944            '});' .
945            "</script>\n";
946    }
947
948    public static function jsModal()
949    {
950        return
951        self::jsLoad('js/jquery/jquery.magnific-popup.js');
952    }
953
954    public static function jsColorPicker()
955    {
956        return
957        self::cssLoad('style/farbtastic/farbtastic.css') .
958        self::jsLoad('js/jquery/jquery.farbtastic.js') .
959        self::jsLoad('js/color-picker.js');
960    }
961
962    public static function jsDatePicker()
963    {
964        return
965        self::cssLoad('style/date-picker.css') .
966        self::jsLoad('js/date-picker.js') .
967        '<script type="text/javascript">' . "\n" .
968
969        "datePicker.prototype.months[0] = '" . html::escapeJS(__('January')) . "'; " .
970        "datePicker.prototype.months[1] = '" . html::escapeJS(__('February')) . "'; " .
971        "datePicker.prototype.months[2] = '" . html::escapeJS(__('March')) . "'; " .
972        "datePicker.prototype.months[3] = '" . html::escapeJS(__('April')) . "'; " .
973        "datePicker.prototype.months[4] = '" . html::escapeJS(__('May')) . "'; " .
974        "datePicker.prototype.months[5] = '" . html::escapeJS(__('June')) . "'; " .
975        "datePicker.prototype.months[6] = '" . html::escapeJS(__('July')) . "'; " .
976        "datePicker.prototype.months[7] = '" . html::escapeJS(__('August')) . "'; " .
977        "datePicker.prototype.months[8] = '" . html::escapeJS(__('September')) . "'; " .
978        "datePicker.prototype.months[9] = '" . html::escapeJS(__('October')) . "'; " .
979        "datePicker.prototype.months[10] = '" . html::escapeJS(__('November')) . "'; " .
980        "datePicker.prototype.months[11] = '" . html::escapeJS(__('December')) . "'; " .
981
982        "datePicker.prototype.days[0] = '" . html::escapeJS(__('Monday')) . "'; " .
983        "datePicker.prototype.days[1] = '" . html::escapeJS(__('Tuesday')) . "'; " .
984        "datePicker.prototype.days[2] = '" . html::escapeJS(__('Wednesday')) . "'; " .
985        "datePicker.prototype.days[3] = '" . html::escapeJS(__('Thursday')) . "'; " .
986        "datePicker.prototype.days[4] = '" . html::escapeJS(__('Friday')) . "'; " .
987        "datePicker.prototype.days[5] = '" . html::escapeJS(__('Saturday')) . "'; " .
988        "datePicker.prototype.days[6] = '" . html::escapeJS(__('Sunday')) . "'; " .
989
990        "datePicker.prototype.img_src = 'images/date-picker.png'; " .
991        "datePicker.prototype.img_alt = '" . html::escapeJS(__('Choose date')) . "'; " .
992
993        "datePicker.prototype.close_msg = '" . html::escapeJS(__('close')) . "'; " .
994        "datePicker.prototype.now_msg = '" . html::escapeJS(__('now')) . "'; " .
995
996            "</script>\n";
997    }
998
999    public static function jsToolBar()
1000    {
1001        # Deprecated but we keep this for plugins.
1002    }
1003
1004    public static function jsUpload($params = array(), $base_url = null)
1005    {
1006        if (!$base_url) {
1007            $base_url = path::clean(dirname(preg_replace('/(\?.*$)?/', '', $_SERVER['REQUEST_URI']))) . '/';
1008        }
1009
1010        $params = array_merge($params, array(
1011            'sess_id=' . session_id(),
1012            'sess_uid=' . $_SESSION['sess_browser_uid'],
1013            'xd_check=' . $GLOBALS['core']->getNonce()
1014        ));
1015
1016        return
1017        '<script type="text/javascript">' . "\n" .
1018        "dotclear.jsUpload = {};\n" .
1019        "dotclear.jsUpload.msg = {};\n" .
1020        self::jsVar('dotclear.msg.enhanced_uploader_activate', __('Temporarily activate enhanced uploader')) .
1021        self::jsVar('dotclear.msg.enhanced_uploader_disable', __('Temporarily disable enhanced uploader')) .
1022        self::jsVar('dotclear.jsUpload.msg.limit_exceeded', __('Limit exceeded.')) .
1023        self::jsVar('dotclear.jsUpload.msg.size_limit_exceeded', __('File size exceeds allowed limit.')) .
1024        self::jsVar('dotclear.jsUpload.msg.canceled', __('Canceled.')) .
1025        self::jsVar('dotclear.jsUpload.msg.http_error', __('HTTP Error:')) .
1026        self::jsVar('dotclear.jsUpload.msg.error', __('Error:')) .
1027        self::jsVar('dotclear.jsUpload.msg.choose_file', __('Choose file')) .
1028        self::jsVar('dotclear.jsUpload.msg.choose_files', __('Choose files')) .
1029        self::jsVar('dotclear.jsUpload.msg.cancel', __('Cancel')) .
1030        self::jsVar('dotclear.jsUpload.msg.clean', __('Clean')) .
1031        self::jsVar('dotclear.jsUpload.msg.upload', __('Upload')) .
1032        self::jsVar('dotclear.jsUpload.msg.send', __('Send')) .
1033        self::jsVar('dotclear.jsUpload.msg.file_successfully_uploaded', __('File successfully uploaded.')) .
1034        self::jsVar('dotclear.jsUpload.msg.no_file_in_queue', __('No file in queue.')) .
1035        self::jsVar('dotclear.jsUpload.msg.file_in_queue', __('1 file in queue.')) .
1036        self::jsVar('dotclear.jsUpload.msg.files_in_queue', __('%d files in queue.')) .
1037        self::jsVar('dotclear.jsUpload.msg.queue_error', __('Queue error:')) .
1038        self::jsVar('dotclear.jsUpload.base_url', $base_url) .
1039        "</script>\n" .
1040
1041        self::jsLoad('js/jquery/jquery-ui.custom.js') .
1042        self::jsLoad('js/jsUpload/tmpl.js') .
1043        self::jsLoad('js/jsUpload/template-upload.js') .
1044        self::jsLoad('js/jsUpload/template-download.js') .
1045        self::jsLoad('js/jsUpload/load-image.js') .
1046        self::jsLoad('js/jsUpload/jquery.iframe-transport.js') .
1047        self::jsLoad('js/jsUpload/jquery.fileupload.js') .
1048        self::jsLoad('js/jsUpload/jquery.fileupload-process.js') .
1049        self::jsLoad('js/jsUpload/jquery.fileupload-resize.js') .
1050        self::jsLoad('js/jsUpload/jquery.fileupload-ui.js');
1051    }
1052
1053    public static function jsMetaEditor()
1054    {
1055        return self::jsLoad('js/meta-editor.js');
1056    }
1057
1058    public static function jsFilterControl($show = true)
1059    {
1060        return
1061        self::jsLoad('js/filter-controls.js') .
1062        '<script type="text/javascript">' . "\n" .
1063        self::jsVar('dotclear.msg.show_filters', $show ? 'true' : 'false') . "\n" .
1064        self::jsVar('dotclear.msg.filter_posts_list', __('Show filters and display options')) . "\n" .
1065        self::jsVar('dotclear.msg.cancel_the_filter', __('Cancel filters and display options')) . "\n" .
1066            "</script>";
1067    }
1068
1069    public static function jsLoadCodeMirror($theme = '', $multi = true, $modes = array('css', 'htmlmixed', 'javascript', 'php', 'xml'))
1070    {
1071        $ret =
1072        self::cssLoad('js/codemirror/lib/codemirror.css') .
1073        self::jsLoad('js/codemirror/lib/codemirror.js');
1074        if ($multi) {
1075            $ret .= self::jsLoad('js/codemirror/addon/mode/multiplex.js');
1076        }
1077        foreach ($modes as $mode) {
1078            $ret .= self::jsLoad('js/codemirror/mode/' . $mode . '/' . $mode . '.js');
1079        }
1080        $ret .=
1081        self::jsLoad('js/codemirror/addon/edit/closebrackets.js') .
1082        self::jsLoad('js/codemirror/addon/edit/matchbrackets.js') .
1083        self::cssLoad('js/codemirror/addon/display/fullscreen.css') .
1084        self::jsLoad('js/codemirror/addon/display/fullscreen.js');
1085        if ($theme != '') {
1086            $ret .= self::cssLoad('js/codemirror/theme/' . $theme . '.css');
1087        }
1088        return $ret;
1089    }
1090
1091    public static function jsRunCodeMirror($name, $id, $mode, $theme = '')
1092    {
1093        $ret =
1094            '<script type="text/javascript">' . "\n" .
1095            'var ' . $name . ' = CodeMirror.fromTextArea(' . $id . ',{' . "\n" .
1096            '   mode: "' . $mode . '",' . "\n" .
1097            '   tabMode: "indent",' . "\n" .
1098            '   lineWrapping: 1,' . "\n" .
1099            '   lineNumbers: 1,' . "\n" .
1100            '   matchBrackets: 1,' . "\n" .
1101            '   autoCloseBrackets: 1,' . "\n" .
1102            '   extraKeys: {"F11": function(cm) {cm.setOption("fullScreen",!cm.getOption("fullScreen"));}}';
1103        if ($theme) {
1104            $ret .=
1105                ',' . "\n" .
1106                '   theme: "' . $theme . '"';
1107        }
1108        $ret .= "\n" .
1109            '});' . "\n" .
1110            '</script>';
1111        return $ret;
1112    }
1113
1114    public static function getCodeMirrorThemes()
1115    {
1116        $themes      = array();
1117        $themes_root = dirname(__FILE__) . '/../../admin' . '/js/codemirror/theme/';
1118        if (is_dir($themes_root) && is_readable($themes_root)) {
1119            if (($d = @dir($themes_root)) !== false) {
1120                while (($entry = $d->read()) !== false) {
1121                    if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_readable($themes_root . '/' . $entry)) {
1122                        $themes[] = substr($entry, 0, -4); // remove .css extension
1123                    }
1124                }
1125                sort($themes);
1126            }
1127        }
1128        return $themes;
1129    }
1130
1131    public static function getPF($file)
1132    {
1133        return $GLOBALS['core']->adminurl->get('load.plugin.file', array('pf' => $file));
1134    }
1135
1136    public static function getVF($file)
1137    {
1138        return $GLOBALS['core']->adminurl->get('load.var.file', array('vf' => $file));
1139    }
1140
1141    public static function setXFrameOptions($headers, $origin = null)
1142    {
1143        if (self::$xframe_loaded) {
1144            return;
1145        }
1146
1147        if ($origin !== null) {
1148            $url                        = parse_url($origin);
1149            $headers['x-frame-options'] = sprintf('X-Frame-Options: %s', is_array($url) && isset($url['host']) ?
1150                ("ALLOW-FROM " . (isset($url['scheme']) ? $url['scheme'] . ':' : '') . '//' . $url['host']) :
1151                'SAMEORIGIN');
1152        } else {
1153            $headers['x-frame-options'] = 'X-Frame-Options: SAMEORIGIN'; // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+
1154        }
1155        self::$xframe_loaded = true;
1156    }
1157}
Note: See TracBrowser for help on using the repository browser.

Sites map