当前位置: 首页>>代码示例>>PHP>>正文


PHP DocumentManager::file_get_mime_type方法代码示例

本文整理汇总了PHP中DocumentManager::file_get_mime_type方法的典型用法代码示例。如果您正苦于以下问题:PHP DocumentManager::file_get_mime_type方法的具体用法?PHP DocumentManager::file_get_mime_type怎么用?PHP DocumentManager::file_get_mime_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocumentManager的用法示例。


在下文中一共展示了DocumentManager::file_get_mime_type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: intval

    Display::display_header($nameTools, 'Dropbox');
    Display::display_error_message(get_lang('YouAreNotAllowedToDownloadThisFile'));
    Display::display_footer();
    exit;
} else {
    /*      DOWNLOAD THE FILE */
    // the user is allowed to download the file
    $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX][] = intval($_GET['id']);
    $work = new Dropbox_Work($_GET['id']);
    $path = dropbox_cnf('sysPath') . '/' . $work->filename;
    //path to file as stored on server
    if (!Security::check_abs_path($path, dropbox_cnf('sysPath') . '/')) {
        exit;
    }
    $file = $work->title;
    $mimetype = DocumentManager::file_get_mime_type(true);
    $fileinfo = pathinfo($file);
    $extension = $fileinfo['extension'];
    if (!empty($extension) && isset($mimetype[$extension]) && $_GET['action'] != 'download') {
        // give hint to browser about filetype
        header('Content-type: ' . $mimetype[$extension] . "\n");
    } else {
        //no information about filetype: force a download dialog window in browser
        header("Content-type: application/octet-stream\n");
    }
    header('Content-Disposition: attachment; filename=' . $file);
    /**
     * Note that if you use these two headers from a previous example:
     * header('Cache-Control: no-cache, must-revalidate');
     * header('Pragma: no-cache');
     * before sending a file to the browser, the "Open" option on Internet Explorer's file download dialog will not work properly. If the user clicks "Open" instead of "Save," the target application will open an empty file, because the downloaded file was not cached. The user will have to save the file to their hard drive in order to use it.
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:dropbox_download.php

示例2: array

/**
 * Script to find a document with a specific title or path in all courses
 */
/**
 * Code init - comment die() call to enable
 */
die;
require '../../inc/global.inc.php';
require_once '../../inc/lib/course.lib.php';
require_once '../../inc/lib/document.lib.php';
if (empty($_GET['doc'])) {
    echo "To add a document name to search, add ?doc=abc to the URL\n";
} else {
    echo "Received param " . $_GET['doc'] . "<br />\n";
}
$allowed_mime_types = DocumentManager::file_get_mime_type(true);
$allowed_extensions = array('doc', 'docx', 'ppt', 'pptx', 'pps', 'ppsx', 'xls', 'xlsx', 'odt', 'odp', 'ods', 'pdf', 'txt', 'rtf', 'msg', 'csv', 'html', 'htm');
$courses_list = CourseManager::get_courses_list();
// Simulating empty specific fields (this is necessary for indexing)
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
$specific_fields = get_specific_field_list();
$specific_fields_values = array();
foreach ($specific_fields as $sf) {
    $specific_fields_values[$sf['code']] = '';
}
$td = Database::get_course_table(TABLE_DOCUMENT);
foreach ($courses_list as $course) {
    $course_dir = $course['directory'] . '/document';
    $title = Database::escape_string($_GET['doc']);
    $sql = "SELECT id, path, session_id FROM {$td} WHERE c_id = " . $course['id'] . " AND path LIKE '%{$title}%' or title LIKE '%{$title}%'";
    $res = Database::query($sql);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:index_all_docs.php

示例3: mime_content_type

 function mime_content_type($filename)
 {
     return DocumentManager::file_get_mime_type((string) $filename);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:4,代码来源:qti2_classes.php

示例4: mdo_add_breadcrump_nav

 function mdo_add_breadcrump_nav()
 {
     global $interbreadcrumb, $langFormats;
     $regs = array();
     // for use with ereg()
     $docurl = api_get_self();
     // should be .../main/xxx/yyy.php
     if (ereg('^(.+[^/\\.]+)/[^/\\.]+/[^/\\.]+.[^/\\.]+$', $docurl, $regs)) {
         $docurl = $regs[1] . '/document/document.php';
     }
     $interbreadcrumb[] = array('url' => $docurl, "name" => get_lang('MdCallingTool'));
     if ($docpath = $this->mdo_path) {
         $docpath = substr($docpath, 0, strrpos($docpath, '/'));
         if (strlen($docpath) > 1) {
             $interbreadcrumb[] = array('url' => $docurl . '?curdirpath=' . urlencode($docpath) . ($this->mdo_group ? '&gidReq=' . $this->mdo_group : ''), "name" => htmlspecialchars(substr($docpath, strrpos($docpath, '/') + 1)));
         }
     }
     // Complete assoclist $langFormats from mime types
     require_once api_get_path(LIBRARY_PATH) . 'xht.lib.php';
     require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
     $sep = $langFormats[0] ? $langFormats[0] : ":";
     $arrFormats = xht_explode_assoclist($langFormats);
     foreach (DocumentManager::file_get_mime_type(TRUE) as $format) {
         if (!isset($arrFormats[$format])) {
             $langFormats .= ",, " . $format . $sep . $format;
         }
     }
     if (!isset($arrFormats["inode/directory"])) {
         $langFormats .= ",, inode/directory" . $sep . "inode/directory";
     }
     if (substr($langFormats, 0, 3) == ",, ") {
         $langFormats = $sep . substr($langFormats, 3);
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:34,代码来源:md_document.php


注:本文中的DocumentManager::file_get_mime_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。