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


PHP validate::checkvirus方法代码示例

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


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

示例1: filemtime

if ($dispo == "inline" and !in_array($ext, $inline_extensions)) {
    $dispo = "attachment";
}
$modified = filemtime($row_filename);
$etag = '"' . md5($row_filename . $modified) . '"';
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $modified) . " GMT");
header("ETag: {$etag}");
if (!empty($_SERVER["HTTP_IF_NONE_MATCH"]) and $etag == stripslashes($_SERVER["HTTP_IF_NONE_MATCH"]) and !DEBUG) {
    header("HTTP/1.0 304 Not Modified");
    exit;
}
$resize = false;
if (isset($_REQUEST["image_width"]) or isset($_REQUEST["image_height"])) {
    $resize = true;
}
if (!$resize and $result = validate::checkvirus($row_filename)) {
    sys_error("Virus scanner: " . $result, "403 Forbidden");
} else {
    if ($resize) {
        $row_filename = _download_resize($row_filename);
    }
    _download_file($row_filename, $filename, $dispo);
}
function _download_file($row_filename, $filename, $dispo)
{
    if ($fp = fopen($row_filename, "rb")) {
        if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE")) {
            $filename = rawurlencode($filename);
        }
        sys_log_stat("downloads", 1);
        header("Expires: " . gmdate("D, d M Y H:i:s", NOW) . " GMT");
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:31,代码来源:download.php

示例2: displayfile

 static function displayfile($table, $filename, $index = false, $limit = true)
 {
     $size = @filesize($filename);
     $ext = self::getfileext($filename);
     if ($ext == basename($filename)) {
         $ext = self::basename($filename);
     }
     $txt_files = array("ldif", "log", "css", "csv", "eml", "rfc822", "ini", "reg", "tsv", "txt", "ics", "vcf", "lang");
     $code_files = array("bas", "bat", "c", "cmd", "cpp", "csh", "inf", "sh", "vb", "vbe", "xml", "java", "js", "pas", "php", "pl", "vbs", "vcs", "wsh", "tpl", "sql");
     $bin_files = array("doc", "docx", "xls", "xlsx", "ppt", "pptx", "tar", "zip", "gz", "tgz", "pdf", "mp3", "odt", "sxw", "ods", "sxc", "odp", "sxi", "jpg", "jpeg", "tif", "url");
     $html_files = array("htm", "html");
     $return = "";
     $return_html = "";
     $cid = str_replace("simple_", "", $table) . "_" . sha1($filename . $size . @filemtime($filename));
     if ($return = sys_cache_get($cid)) {
         if (!$index and $limit and strlen($return) > FILE_TEXT_LIMIT) {
             $return = substr($return, 0, FILE_TEXT_LIMIT) . " ...";
         }
         return trim($return);
     }
     $type = "";
     if (in_array($ext, $txt_files)) {
         $type = "text";
     } else {
         if (in_array($ext, $code_files)) {
             $type = "code";
         } else {
             if (in_array($ext, $html_files)) {
                 $type = "html";
             } else {
                 if (in_array($ext, $bin_files)) {
                     $type = "bin";
                 }
             }
         }
     }
     if ($type != "" and file_exists($filename)) {
         if ($type == "bin") {
             if (filesize($filename) != 0) {
                 if (!sys_strbegins($filename, SIMPLE_STORE . "/") and $result = validate::checkvirus($filename)) {
                     $return = "ERROR Virus scanner: " . $result;
                 } else {
                     $return = trim(self::preview_bin($filename, $ext));
                 }
             }
         } else {
             $return = trim(file_get_contents($filename, false, null, -1, $limit ? FILE_TEXT_LIMIT : 131072));
         }
         if ($return != "") {
             if ($index) {
                 $rlimit = INDEX_LIMIT;
             } else {
                 $rlimit = FILE_TEXT_LIMIT;
             }
             if ($limit and strlen($return) > $rlimit) {
                 $return = substr($return, 0, $rlimit) . " ...";
             }
             if (!self::detect_utf($return)) {
                 $return = utf8_encode($return);
             }
             if ($type == "html") {
                 $return_html = substr($return, 0, strrpos($return, ">"));
             } else {
                 if ($type != "code") {
                     $return_html = nl2br(strip_tags($return, "<a><b><i>"));
                 } else {
                     $return_html = self::highlight_string($return);
                 }
             }
         }
     }
     if ($return_html == "") {
         $return_html = " ";
     }
     if (!sys_strbegins($return, "ERROR ")) {
         sys_cache_set($cid, $return_html, FILE_TEXT_CACHE);
         if ($index) {
             return $return;
         } else {
             return trim($return_html);
         }
     } else {
         sys_log_message_log("php-fail", "displayfile: " . $return);
     }
     if ($index) {
         return "";
     }
     return sprintf("{t}Cannot create preview for %s{/t}.", $ext);
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:89,代码来源:modify.php


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