Browse Source

harden tinymceimage request

pull/29/head
Preston Mason 10 years ago
parent
commit
12e02ea06f
3 changed files with 16 additions and 11 deletions
  1. BIN
      cms/data/content.sqlite
  2. BIN
      cms/data/userdata.sqlite
  3. +16
    -11
      cms/includes/tinymceimage.inc.php

BIN
cms/data/content.sqlite View File


BIN
cms/data/userdata.sqlite View File


+ 16
- 11
cms/includes/tinymceimage.inc.php View File

@ -1,15 +1,20 @@
<?php
$img_path = BASE_PATH.MEDIA_DIR;
$fp=opendir($img_path);
while($file = readdir($fp))
{
if(preg_match('/\.jpg$/i', $file) || preg_match('/\.jpeg$/i', $file) || preg_match('/\.png$/i', $file) || preg_match('/\.gif$/i', $file)) {
$images[] = array("title"=>$file, "value"=>BASE_URL . MEDIA_DIR . $file);
if(!defined('IN_INDEX')) exit;
if(isset($_SESSION[$settings['session_prefix'].'user_id'])) {
$img_path = BASE_PATH.MEDIA_DIR;
$fp=opendir($img_path);
while($file = readdir($fp))
{
if(preg_match('/\.jpg$/i', $file) || preg_match('/\.jpeg$/i', $file) || preg_match('/\.png$/i', $file) || preg_match('/\.gif$/i', $file)) {
$images[] = array("title"=>$file, "value"=>BASE_URL . MEDIA_DIR . $file);
}
}
}
closedir($fp);
closedir($fp);
header('Content-type: application/json');
echo json_encode($images);
exit;
header('Content-type: application/json');
echo json_encode($images);
exit;
}
?>

Loading…
Cancel
Save