Esempio n. 1
0
        break;
    case 'medialib_create_dir':
        $insert = $db->insert('uploads_dir', array('name'), array($_POST['name']));
        if ($insert) {
            $r = $db->fetch('uploads_dir', false, false, 'id', 'DESC');
            echo $r[0]['id'];
        }
        break;
    case 'medialib_do_upload':
        include '../classes/uploads.php';
        $uploads = new Uploads();
        $tmp_name = $_FILES['file_to_upload']['tmp_name'];
        $name = $_FILES['file_to_upload']['name'];
        $type = 'image';
        $dir = $_POST['dir'];
        $upload = $uploads->upload($tmp_name, $name, $type, $dir, 'control');
        if ($upload) {
            echo '<img src="style/images/tick.png" /><br />' . $name . ' ' . $lang->get_phrase('uploaded_successfully') . '
			
			<script>
			$("#files_list").load("jq_actions.php?action=medialib_showfiles&dir=' . $dir . '");
			</script>
			';
        } else {
            echo 'an error has occured';
        }
        break;
    case 'medialib_showfiles':
        $dir = $_GET['dir'];
        $page = $_GET['page'];
        if (empty($page)) {