Files
adminer/plugins/frames.php

29 lines
764 B
PHP
Raw Normal View History

2011-02-17 09:23:13 +01:00
<?php
2011-02-17 21:22:21 +01:00
/** Allow using Adminer inside a frame (disables ClickJacking protection)
2015-09-08 09:23:25 -07:00
* @link https://www.adminer.org/plugins/#use
2017-02-27 13:43:33 +01:00
* @author Jakub Vrana, https://www.vrana.cz/
2018-01-14 11:03:54 +01:00
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
2011-02-17 09:23:13 +01:00
*/
class AdminerFrames {
2011-08-11 17:06:42 +02:00
/** @access protected */
2011-02-17 21:22:21 +01:00
var $sameOrigin;
2025-02-21 13:53:18 +01:00
2011-02-17 21:22:21 +01:00
/**
* @param bool allow running from the same origin only
*/
2015-08-15 17:04:21 +02:00
function __construct($sameOrigin = false) {
2011-02-17 21:22:21 +01:00
$this->sameOrigin = $sameOrigin;
}
2025-02-21 13:53:18 +01:00
2011-02-17 09:23:13 +01:00
function headers() {
2011-02-17 21:22:21 +01:00
if ($this->sameOrigin) {
header("X-Frame-Options: SameOrigin");
} elseif (function_exists('header_remove')) {
header_remove("X-Frame-Options");
2011-02-17 21:22:21 +01:00
}
2011-02-17 09:23:13 +01:00
}
2025-02-21 13:53:18 +01:00
2011-02-17 09:23:13 +01:00
}