virt2/api/soft/tinymce/4.3.12/plugins/image/search.php

31 lines
754 B
PHP
Raw Normal View History

<?php
require_once('config.php');
require_once('functions.php');
if(!defined('LIBRARY_FOLDER_PATH')){
define('LIBRARY_FOLDER_PATH', 'uploads/');
}
if(!defined('LIBRARY_FOLDER_PATH')){
$pageURL = 'http';
if(isset($_SERVER["HTTPS"]) AND $_SERVER["HTTPS"] == "on"){
$pageURL .= "s";
}
$pageURL .= "://";
if($_SERVER["SERVER_PORT"] != "80"){
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}else{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
if(preg_match("/(.*)\/search\.php/",$pageURL,$matches)){
define('LIBRARY_FOLDER_URL', $matches[1] . '/uploads/');
}
}
$output = SearchFiles(LIBRARY_FOLDER_PATH);
header("Content-type: text/plain;");
echo json_encode($output);
exit();