Differences Between: [Versions 311 and 403]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * This script displays one thumbnail of the image in current user's dropbox. 20 * If {@link repository_dropbox::send_thumbnail()} can not display image 21 * the default 64x64 filetype icon is returned 22 * 23 * @package repository_dropbox 24 * @copyright 2012 Marina Glancy 25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 */ 27 28 require(__DIR__.'/../../config.php'); 29 require_once (__DIR__.'/lib.php'); 30 31 $repoid = optional_param('repo_id', 0, PARAM_INT); // Repository ID 32 $contextid = optional_param('ctx_id', SYSCONTEXTID, PARAM_INT); // Context ID 33 $source = optional_param('source', '', PARAM_TEXT); // File path in current user's dropbox 34 35 $thumbnailavailable = isloggedin(); 36 $thumbnailavailable = $thumbnailavailable && $repoid; 37 $thumbnailavailable = $thumbnailavailable && $source; 38 $thumbnailavailable = $thumbnailavailable && ($repo = repository::get_repository_by_id($repoid, $contextid)); 39 $thumbnailavailable = $thumbnailavailable && method_exists($repo, 'send_thumbnail'); 40 if ($thumbnailavailable) { 41 // Try requesting thumbnail and outputting it. 42 // This function exits if thumbnail was retrieved. 43 $repo->send_thumbnail($source); 44 } 45 46 // Send default icon for the file type. 47 $fileicon = file_extension_icon($source, 64); 48 send_file($CFG->dirroot . '/pix/' . $fileicon . '.png', basename($fileicon) . '.png');
title
Description
Body
title
Description
Body
title
Description
Body
title
Body