• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getMime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getMime函数的典型用法代码示例。如果您正苦于以下问题:PHP getMime函数的具体用法?PHP getMime怎么用?PHP getMime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getFiles

        function getFiles(){
         $dirname = 'uploads/';
         $dir = 'uploads/*';
         $files = array();
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         foreach (glob($dir) as $file){
           $t = date("M j, Y g:i a", filemtime($file));
           $m = finfo_file($finfo, $file);
           $m = getMime($m);
           $s = filesize($file);
           $n = basename($file);
           $href = "$dirname$n";
				    echo $s;
           $files[] = array("href"=>$href,"name"=>$n, "size"=>$s, "mime"=>$m, "time"=>$t);

         }
         return $files;
       }
开发者ID:rbirky1,项目名称:cmsc433-php-fileManager,代码行数:18,代码来源:index_2.php


示例2: getFiles

function getFiles(){
         $dirname = 'uploads/';
         $dir = 'uploads/*';
         $files = array();
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         foreach (glob($dir) as $file){
           $n = basename($file);
 // chmod( $dirname . $n, 0777);
           $t = date("M j, Y g:i a", filemtime($file));
           $m = finfo_file($finfo, $file);
           $m = getMime($m);
           $s = filesize($file);

           $href = "$dirname$n";
           $thisFile = new FileU($n, $s, $m, $t, $href);
	   $files[] = clone $thisFile;
	  }
         return $files;
       }
开发者ID:rbirky1,项目名称:cmsc433-php-fileManager,代码行数:19,代码来源:index_4.php


示例3: onlyImages

 /**
  * Pass only images to the uploaded file list.
  * Caution, action performs at the calling time.
  *
  * @param null
  * @return UploadedFiles object
  * @see onlyCompressed
  */
 function onlyImages()
 {
     foreach ($this->http_files as $k => $v) {
         $mime = isset($this->cached_mimes[$k]) ? $this->cached_mimes[$k] : ($this->cached_mimes[$k] = getMime($v['tmp_name']));
         if (($pos = strpos($mime, "image")) === false || $pos != 0) {
             $this->http_error_files[$k][] = array('image', $v['name']);
         }
     }
     return $this;
 }
开发者ID:point,项目名称:cassea,代码行数:18,代码来源:UploadedFiles.php


示例4: cropImage

function cropImage($imgPath, $coordX, $coordY, $coordW, $coordH, $text = NULL)
{
    $data = getMime($imgPath);
    $src_img = $data[0];
    $mime = $data[1];
    $img_width_new = 700;
    $img_height_new = 350;
    $new_image = ImageCreateTrueColor($img_width_new, $img_height_new);
    imagecopyresampled($new_image, $src_img, 0, 0, $coordX, $coordY, $coordW, $coordH, $img_width_new, $img_height_new);
    // New save location
    // code to write text to image
    $black = imagecolorallocate($new_image, 0, 0, 0);
    $white = imagecolorallocate($new_image, 255, 255, 255);
    $font = 'arial.ttf';
    $bbox = imagettfbbox(16, 0, $font, $text);
    $x = $bbox[2] + 20;
    imagefilledrectangle($new_image, 5, 5, $x, 40, $black);
    // Add some shadow to the text
    imagettftext($new_image, 16, 0, 11, 31, $black, $font, $text);
    // Add the text
    imagettftext($new_image, 16, 0, 10, 30, $white, $font, $text);
    $new_file_path = $_SESSION['rootDir'] . '/images/slideShow/' . basename($imgPath);
    return create_image($new_image, $new_file_path, $mime, basename($imgPath), 'slide');
}
开发者ID:vinayadahal,项目名称:new_design,代码行数:24,代码来源:sliderController.php


示例5: stream

 function stream()
 {
     $_REQUEST->setType('action', 'string');
     $mime = getMime($this->path);
     while (ob_get_level() > 0) {
         ob_end_clean();
     }
     //ob_start('contentSize');
     //ob_start('ob_gzhandler');
     $last_modified_time = filemtime($this->path);
     $etag = md5_file($this->path);
     $length = $filesize = filesize($this->path);
     $offset = 0;
     if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || @trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
         header('HTTP/1.1 304 Not Modified');
         exit;
     }
     if (isset($_SERVER['HTTP_RANGE'])) {
         // if the HTTP_RANGE header is set we're dealing with partial content
         // Only supports a single range right now.
         // http://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file
         preg_match('/bytes=(\\d+)-(\\d+)?/', $_SERVER['HTTP_RANGE'], $range);
         $offset = min(intval($range[1]), $filesize - 1);
         // offset starts at 0, hence filesize-1
         if (@intval($range[2]) > 0) {
             $length = min(intval($range[2]), $filesize);
         }
         $length -= $offset;
         header('HTTP/1.1 206 Partial Content');
         header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize);
     }
     header('Etag: "' . $etag . '"');
     header('Content-Length: ' . $length);
     header('Content-Disposition: ' . ($_REQUEST['action'] === 'download' ? 'attachment; ' : '') . 'filename="' . pathinfo($this->path, PATHINFO_BASENAME) . '"');
     header('Content-Transfer-Encoding: binary');
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified_time) . ' GMT');
     header('Content-Type: ' . $mime);
     if ($_REQUEST['action'] == 'download') {
         header('Content-Type: application/force-download', false);
         header('Content-Type: application/download', false);
         header('Content-Description: File Transfer');
     }
     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 2 * 24 * 3600) . ' GMT');
     header('Cache-Control: private, max-age=172801, must-revalidate');
     #header('Cache-Control: no-cache');
     header('Pragma: cache');
     $fp = fopen($this->path, 'rb');
     if ($fp === false) {
         die;
     }
     // error!! FIXME
     fseek($fp, $offset);
     print fread($fp, $length);
     fclose($fp);
     exit;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:56,代码来源:Image.php


示例6: data_uri

            <div class="row">

				<?php 
if (!isset($_GET["file"])) {
    echo "Please choose a file you want to view!";
} else {
    ?>
                <section class="panel">
                          <header class="panel-heading">
                            <?php 
    echo $_GET["file"];
    ?>
                          </header>
                          <div class="panel-body"><video src="<?php 
    echo data_uri("files/" . $_GET["file"], getMime($_GET["file"]));
    ?>
" class="img-responsive" />
                    </div></section>
                              <?php 
}
?>



			</div><!--/.row-->


                  <div class="widget-foot">
                    <!-- Footer goes here -->
                  </div>
开发者ID:vantezzen,项目名称:synchro,代码行数:30,代码来源:watchvideo.php


示例7: printMime

function printMime($what, $listline)
{
    // --------------
    // Prints the Mime icon
    // --------------
    $mime = getMime($listline);
    if ($what == "icon") {
        echo $mime["mime_icon"];
    } elseif ($what == "type") {
        echo $mime["mime_type"];
    }
}
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:12,代码来源:skins.inc.php


示例8: getMime

<?php

function getMime($ext)
{
    $types = ['woff' => 'application/x-font-woff', 'woff2' => 'application/x-font-woff2', 'eot' => 'application/vnd.ms-fontobject', 'svg' => 'image/svg+xml', 'ttf' => 'application/x-font-ttf'];
    if (isset($types[$ext])) {
        return $types[$ext];
    }
}
if (PHP_SAPI == 'cli-server') {
    $file = __DIR__ . $_SERVER['REQUEST_URI'];
    $path = pathinfo($_SERVER['SCRIPT_FILENAME']);
    $mime = getMime($path['extension']);
    if ($mime) {
        header('Content-type: ' . $mime);
        readfile($_SERVER['SCRIPT_FILENAME']);
    } elseif (is_file($file)) {
        return false;
    }
}
require __DIR__ . '/../vendor/autoload.php';
// Instantiate the app
$settings = (require __DIR__ . '/../src/settings.php');
$app = new \Slim\App($settings);
// Set up dependencies
require __DIR__ . '/../src/dependencies.php';
// Register middleware
require __DIR__ . '/../src/middleware.php';
// Register routes
require __DIR__ . '/../src/routes.php';
// Run app
开发者ID:corporateanon,项目名称:cisco-twitter,代码行数:31,代码来源:index.php


示例9: createThumbnail

function createThumbnail($imgPath)
{
    $data = getMime($imgPath);
    $src_img = $data[0];
    $mime = $data[1];
    $img_width = imageSX($src_img);
    $img_height = imageSY($src_img);
    $new_size = ($img_width + $img_height) / ($img_width * ($img_height / 200));
    $img_width_new = $img_width * $new_size;
    $img_height_new = $img_height * $new_size;
    $new_image = ImageCreateTrueColor($img_width_new, $img_height_new);
    $background = imagecolorallocate($new_image, 0, 0, 0);
    imagecolortransparent($new_image, $background);
    imagealphablending($new_image, false);
    imagesavealpha($new_image, true);
    imagecopyresampled($new_image, $src_img, 0, 0, 0, 0, $img_width_new, $img_height_new, $img_width, $img_height);
    // New save location
    $new_file_path = $_SESSION['rootDir'] . '/images/thumb/' . basename($imgPath);
    return create_image($new_image, $new_file_path, $mime, basename($imgPath));
}
开发者ID:vinayadahal,项目名称:new_design,代码行数:20,代码来源:tripController.php


示例10: sortContent


//.........这里部分代码省略.........
    if (isset($folderList) && sizeof($folderList)>0) {
        //$tempTree=array();
        foreach ($folderList as $key => $obj) {
            //$tempTree ['all-obj'] = $obj;
            $tempTree ['text'] = $obj['FOLDER_NAME'];
            $tempTree ['id'] = $obj['FOLDER_UID'];
            $tempTree ['folderID'] = $obj['FOLDER_UID'];
            $tempTree ['cls'] = 'folder';
            $tempTree ['draggable'] = true;
            $tempTree ['name'] = $obj['FOLDER_NAME'];
            $tempTree ['type'] = "Directory";
            $tempTree ['is_file'] = false;
            $tempTree ['appDocCreateDate'] = $obj['FOLDER_CREATE_DATE'];
            $tempTree ['qtip'] ='<strong>Directory: </strong>'.$obj['FOLDER_NAME'].
            '<br /><strong>Create Date:</strong> '.$obj['FOLDER_CREATE_DATE'].'';
            $tempTree ['is_writable'] =true;
            $tempTree ['is_chmodable'] =true;
            $tempTree ['is_readable'] =true;
            $tempTree ['is_deletable'] =true;

            if ((isset($_POST['option']) )&& ($_POST['option'] == "gridDocuments")) {
                $tempTree ['icon'] = "/images/documents/extension/folder.png";
            }
            $processListTree [] = $tempTree;
            $tempTree=array();
        }
    } else {
        if ($_POST ['node'] == '/') {
        }
    }

    if (isset($folderContent)) {
        foreach ($folderContent as $key => $obj) {
            $mimeInformation = getMime($obj["APP_DOC_FILENAME"]);

            $tempTree["text"] = $obj["APP_DOC_FILENAME"];
            $tempTree["name"] = $obj["APP_DOC_FILENAME"];
            $tempTree["type"] = $mimeInformation["description"];
            $tempTree["icon"] = $mimeInformation["icon"];

            $tempTree ['appdocid'] = $obj['APP_DOC_UID'];
            $tempTree ['id'] = $obj['APP_DOC_UID_VERSION'];
            $tempTree ['cls'] = 'file';
            //$tempTree ['draggable'] = true;
            $tempTree ['leaf'] = true;
            $tempTree ['is_file'] = true;
            //if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
            //}
            $tempTree ['docVersion'] = $obj['DOC_VERSION'];
            $tempTree ['appUid'] = $obj['APP_UID'];
            $tempTree ['usrUid'] = $obj['USR_UID'];
            $tempTree ['appDocType'] = ucfirst(strtolower($obj['APP_DOC_TYPE']));
            $tempTree ['appDocCreateDate'] = $obj['APP_DOC_CREATE_DATE'];
            $tempTree ['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
            $tempTree ['appDocTags'] = $obj['APP_DOC_TAGS'];
            $tempTree ['appDocTitle'] = $obj['APP_DOC_TITLE'];
            $tempTree ['appDocComment'] = $tempTree ['qtip'] = $obj['APP_DOC_COMMENT'];
            $tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
            if (isset($obj['APP_NUMBER'])) {
                $tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
            } else {
                $tempTree ['appLabel'] = "No case related";
            }
            $tempTree ['proTitle'] = $obj['PRO_TITLE'];
            $tempTree ['appDocVersionable'] = 0;
            if (isset($obj['OUT_DOC_VERSIONING'])) {
开发者ID:rrsc,项目名称:processmaker,代码行数:67,代码来源:appFolderAjax.php


示例11: expandNode


//.........这里部分代码省略.........
                    $tempTree ['is_writable'] =true;
                    $tempTree ['is_chmodable'] =true;
                    $tempTree ['is_readable'] =true;
                    $tempTree ['is_deletable'] =true;
        
                    if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
                        $tempTree ['icon'] = "/images/documents/extension/bz2.png";
                    }*/
        //$tempTree ['leaf'] = true;
        //$tempTree ['optionType'] = "category";
        //$tempTree['allowDrop']=false;
        //$tempTree ['singleClickExpand'] = false;
        /*
        if ($key != "No Category") {
            $tempTree ['expanded'] = true;
        } else {
            //$tempTree ['expanded'] = false;
            $tempTree ['expanded'] = true;
        }
        */
        /*$processListTree [] = $tempTree;
              $tempTree=array();
          }*/
    } else {
        if ($_POST['node'] == '/') {
            //$tempTree=array();
            //$processListTree [] = array();
        }
    }
    if (isset($folderContent)) {
        foreach ($folderContent as $key => $obj) {
            $tempTree['text'] = $obj['APP_DOC_FILENAME'];
            $tempTree['name'] = $obj['APP_DOC_FILENAME'];
            $mimeInformation = getMime($obj['APP_DOC_FILENAME']);
            $tempTree['type'] = $mimeInformation['description'];
            $tempTree['icon'] = $mimeInformation['icon'];
            if (isset($obj['OUT_DOC_GENERATE'])) {
                if ($obj['OUT_DOC_GENERATE'] == "BOTH") {
                    $arrayType = array("PDF", "DOC");
                } else {
                    $arrayType = array($obj['OUT_DOC_GENERATE']);
                }
                foreach ($arrayType as $keyType => $fileType) {
                    $tempTree['text' . $fileType] = $obj['APP_DOC_FILENAME'] . "." . strtolower($fileType);
                    $tempTree['name' . $fileType] = $obj['APP_DOC_FILENAME'] . "." . strtolower($fileType);
                    $mimeInformation = getMime($obj['APP_DOC_FILENAME'] . "." . strtolower($fileType));
                    $tempTree['type' . $fileType] = $mimeInformation['description'];
                    $tempTree['icon' . $fileType] = $mimeInformation['icon'];
                }
            }
            $tempTree['appdocid'] = $obj['APP_DOC_UID'];
            $tempTree['id'] = $obj['APP_DOC_UID_VERSION'];
            $tempTree['cls'] = 'file';
            //$tempTree ['draggable'] = true;
            $tempTree['leaf'] = true;
            $tempTree['is_file'] = true;
            //if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
            //}
            $tempTree['docVersion'] = $obj['DOC_VERSION'];
            $tempTree['appUid'] = $obj['APP_UID'];
            $tempTree['usrUid'] = $obj['USR_UID'];
            $tempTree['appDocType'] = ucfirst(strtolower($obj['APP_DOC_TYPE']));
            $tempTree['appDocCreateDate'] = $obj['APP_DOC_CREATE_DATE'];
            $tempTree['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
            $tempTree['appDocTags'] = $obj['APP_DOC_TAGS'];
            $tempTree['appDocTitle'] = $obj['APP_DOC_TITLE'];
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:67,代码来源:appFolderAjax.php


示例12: inlineAdd

 public function inlineAdd($path)
 {
     if (!is_file($path) || !is_readable($path)) {
         $this->errMsg('invalidFile', $path);
         return false;
     }
     $filename = basename($path);
     $this->attachmentName[] = $filename;
     $this->attachmentType[] = getMime($path);
     $this->attachmentPath[] = $path;
     $this->attachSize += filesize($path);
     $this->attachDispos[] = "inline";
     if ($this->attachSize >= max(sizeFromString(ini_get("memory_limit")), 4 * 1048576)) {
         $this->memoryLimit = true;
     }
 }
开发者ID:point,项目名称:cassea,代码行数:16,代码来源:MailObject.php


示例13: array

             $json = array();
         }
         $groups = array();
         $error = false;
         $ts3 = TeamSpeak3::factory("serverquery://" . QUERYUSER . ":" . QUERYPASS . "@" . IP . ":" . QUERYPORT . "/?server_port=" . SERVERPORT . "&nickname=" . urlencode('Icon Sync'));
         foreach ($ts3->serverGroupList() as $sg) {
             if ($sg['iconid']) {
                 try {
                     $groups[$sg['sgid']] = $sg->iconDownload();
                 } catch (TeamSpeak3_Exception $e) {
                 }
             }
         }
         foreach ($groups as $sgid => $binary) {
             if (!empty($binary)) {
                 $type = getMime($binary);
                 if ($type != 'application/octet-stream') {
                     file_put_contents('icons/' . $sgid . '.' . $type, $binary);
                     $json[$sgid] = 'icons/' . $sgid . '.' . $type;
                 }
             }
         }
         file_put_contents('config/icons.json', json_encode($json));
     } catch (Exception $e) {
         echo json_encode(FALSE);
         $error = true;
     }
     if (!$error) {
         echo json_encode(TRUE);
     }
 } else {
开发者ID:Multivit4min,项目名称:GroupAssigner,代码行数:31,代码来源:api.php


示例14: getMime

 public function getMime($file = null)
 {
     return getMime($file);
 }
开发者ID:oriolet,项目名称:bootils,代码行数:4,代码来源:Core.php


示例15: getMime

    }
    return '';
}
function getMime($ext)
{
    include 'boot/mime_types.php';
    if (!array_key_exists($ext, $mimeTypes)) {
        $mime = 'application/octet-stream';
    } else {
        $mime = $mimeTypes[$ext];
    }
    return $mime;
}
$url = str_replace('/public', '', query_path());
$ext = getExt($url);
$mime = getMime($ext);
function getFile($url)
{
    $hostDir = BuCore::fstab('staticHostDir') . '/' . HTTP_HOST;
    $prjDir = BuCore::fstab('staticPrj');
    $coreDir = BuCore::fstab('staticCore');
    foreach (array($hostDir, $prjDir, $coreDir) as $v) {
        if (file_exists($v . $url)) {
            return $v . $url;
        }
    }
}
$file = getFile($url);
if ($file) {
    $fp = fopen($file, 'rb');
    header("Content-Type: " . $mime);
开发者ID:najomi,项目名称:najomi.org,代码行数:31,代码来源:file_loader.php


示例16: sendMail

function sendMail($mailto, $subject, &$mail, $mailfrom = "", $header = "", $isHTML = true, $attach = "")
{
    # mailto = destination mail, accepts extended version (name <mail>) and comma delimited list
    # subject = subject line
    # mail = template with the fill mail >>>OBJECT<<<
    # mailfrom = "from" mail
    # header (optional) = headers, you might or might not fill a Content-Type
    # isHTML = if true, adds proper Content-Type
    # attach = filename for attachment
    $subject = str_replace("\n", "", $subject);
    // bye exploit
    $subject = str_replace("\r", "", $subject);
    // bye exploit
    if (preg_match('!\\S!u', $subject) !== 0) {
        $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
    }
    if ($mailfrom == "" && strpos($mailto, ",") === false) {
        $mailfrom = $mailto;
    }
    // no mailfrom, use mailti
    if ($header != "" && $header[strlen($header) - 1] != "\n") {
        $header .= "\n";
    }
    // add \n at the end of the last line of pre-defined header
    $mailfrom = str_replace("\n", "", $mailfrom);
    // bye exploit
    if (strpos(strtoupper($header), "RETURN-PATH:") === false && isMail($mailfrom, true)) {
        // no R-P, add if possible
        $header .= "Return-path: {$mailfrom}\n";
    }
    if (strpos(strtoupper($header), "REPLY-TO:") === false && isMail($mailfrom, true)) {
        // no R-T, add if possible
        $header .= "Reply-To: {$mailfrom}\n";
    }
    if (strpos(strtoupper($header), "FROM:") === false && isMail($mailfrom, true)) {
        // no FROM, add if possible
        $header .= "From: {$mailfrom}\n";
    }
    if ($isHTML || $attach != "") {
        // HTML mode with attachment
        $isHTML = true;
        $bound = "--=XYZ_" . md5(date("dmYis")) . "_ZYX";
        $bnext = "--=NextPart_XYZ_" . md5(date("dm")) . ".E0_PART";
        $header .= "Content-Type:multipart/" . ($attach != "" ? "mixed" : "alternative") . "; boundary=\"{$bound}\"\n";
    } else {
        // not HTML nor with attachment
        $header .= "Content-Type:text/plain; charset=utf-8\n";
    }
    $header .= "MIME-Version: 1.0\n";
    $header .= "x-mailer: PresciaMailer\n";
    $mail->assign("IP", CONS_IP);
    $mail->assign("HOUR", date("H:i"));
    $mail->assign("DATA", date("d/m/Y"));
    $mail->assign("DATE", date("m/d/Y"));
    $corpo = $mail->techo();
    if ($attach != "" && is_file($attach)) {
        // deal with attachment
        //Open file and convert to base64
        $fOpen = fopen($attach, "rb");
        $fAtach = fread($fOpen, filesize($attach));
        $ext = explode(".", $attach);
        $ext = array_pop($ext);
        $fAtach = base64_encode($fAtach);
        fclose($fOpen);
        $fAtach = chunk_split($fAtach);
        $corpoplain = preg_replace("/( ){2,}/", " ", cleanHTML($corpo));
        // Add multipart message
        $sBody = "This is a multipart MIME message.\n\n";
        $sBody .= "--{$bound}\n";
        $sBody .= "Content-Type: multipart/alternative; boundary=\"{$bnext}\"\n\n\n";
        $sBody .= "--{$bnext}\n" . "Content-Type: text/plain; charset=utf-8\n\n" . $corpoplain . "\n\n" . "--{$bnext}\n";
        $sBody .= "Content-Type:text/html; charset=utf-8\n\n";
        $sBody .= "{$corpo} \n\n";
        $sBody .= "--{$bnext}--\n\n";
        $sBody .= "--{$bound}\n";
        $fname = explode("/", str_replace("\\", "/", $attach));
        $sBody .= "Content-Disposition: attachment; filename=" . array_pop($fname) . "\n";
        if (!function_exists("getMime")) {
            include_once CONS_PATH_INCLUDE . "getMime.php";
        }
        $sBody .= "Content-Type: " . getMime($ext) . "\n";
        $sBody .= "Content-Transfer-Encoding: base64\n\n{$fAtach}\n";
        $sBody .= "--{$bound}--\n\n";
    } else {
        if ($isHTML) {
            $corpoplain = preg_replace("/( ){2,}/", " ", stripHTML($corpo));
            $sBody = "This is a multipart MIME message.\n\n";
            $sBody .= "--{$bound}\n" . "Content-Type: text/plain; charset=utf-8\n\n" . $corpoplain . "\n\n" . "--{$bound}\n" . "Content-Type: text/html; charset=utf-8\n\n" . $corpo . "\n\n" . "--{$bound}--\n";
        } else {
            $sBody = $corpo;
        }
    }
    if (substr($subject, 0, 3) == "NS:") {
        $sBody .= chr(0);
    }
    // Newsletter character flag
    if (preg_match('@^([^<]*)<([^>]*)>(.?)$@i', $mailfrom, $matches) == 1) {
        $mailfrom = $matches[2];
    }
    // removes expanded mail mode
//.........这里部分代码省略.........
开发者ID:Prescia,项目名称:Prescia,代码行数:101,代码来源:sendMail.php


示例17: sort_list

function sort_list($list)
{
    // --------------
    // This function sorts the list of directories and files
    // Written by Slynderdale
    // --------------
    // -------------------------------------------------------------------------
    // Global variables and settings
    // -------------------------------------------------------------------------
    global $net2ftp_globals;
    // -------------------------------------------------------------------------
    // If the list is empty, return immediately
    // -------------------------------------------------------------------------
    if ($net2ftp_globals["sort"] == "" || is_array($list) == false || sizeof($list) <= 1) {
        return $list;
    }
    // -------------------------------------------------------------------------
    // Default values
    // -------------------------------------------------------------------------
    // Sort flags
    if ($net2ftp_globals["sort"] == "size") {
        $sortflag = SORT_NUMERIC;
    } else {
        $sortflag = SORT_REGULAR;
    }
    // Sort ascending or descending
    if ($net2ftp_globals["sortorder"] == "ascending") {
        $sortfunction = "asort";
    } else {
        $sortfunction = "arsort";
    }
    // -------------------------------------------------------------------------
    // Create a temporary array $temp which contains only the key $i and the value based on which the sorting is done
    // -------------------------------------------------------------------------
    // ------------------------------------
    // Sorting according to name, size, owner, group, permissions
    // ------------------------------------
    if ($net2ftp_globals["sort"] != "mtime" && $net2ftp_globals["sort"] != "type") {
        for ($i = 1; $i <= sizeof($list); $i++) {
            $temp[$i] = strtolower($list[$i][$net2ftp_globals["sort"]]);
        }
    } elseif ($net2ftp_globals["sort"] == "mtime") {
        for ($i = 1; $i <= sizeof($list); $i++) {
            // Some FTP servers return the date and time in a non-standard format
            // For example: "Apr 06 12:57". Transform this to "06 April 2005 12:57"
            if (preg_match("/([a-zA-Z]{3})[ ]+([0-9]{1,2})[ ]+([0-9]{1,2}:[0-9]{2})/", $list[$i]["mtime"], $regs) == true) {
                $month = $regs[1];
                $day = $regs[2];
                $hour = $regs[3];
                $year = date("Y");
                if ($month == "Jan") {
                    $month = "January";
                } elseif ($month == "Feb") {
                    $month = "February";
                } elseif ($month == "Mar") {
                    $month = "March";
                } elseif ($month == "Apr") {
                    $month = "April";
                } elseif ($month == "May") {
                    $month = "May";
                } elseif ($month == "Jun") {
                    $month = "June";
                } elseif ($month == "Jul") {
                    $month = "July";
                } elseif ($month == "Aug") {
                    $month = "August";
                } elseif ($month == "Sep") {
                    $month = "September";
                } elseif ($month == "Oct") {
                    $month = "October";
                } elseif ($month == "Nov") {
                    $month = "November";
                } elseif ($month == "Dec") {
                    $month = "December";
                }
                $mtime_correct = "{$day} {$month} {$year} {$hour}";
                $temp[$i] = strtotime($mtime_correct);
            } else {
                $temp[$i] = strtotime($list[$i]["mtime"]);
            }
        }
        // end for
    } elseif ($net2ftp_globals["sort"] == "type") {
        for ($i = 1; $i <= sizeof($list); $i++) {
            $mime = getMime($list[$i]);
            $temp[$i] = $mime["mime_type"];
        }
        // end for
    }
    // -------------------------------------------------------------------------
    // Execute the sorting on the $temp array
    // -------------------------------------------------------------------------
    $sortfunction($temp, $sortflag);
    // -------------------------------------------------------------------------
    // Fill the $return array
    // -------------------------------------------------------------------------
    $i = 1;
    while (list($tname, $tvalue) = each($temp)) {
        $return[$i] = $list[$tname];
        $i++;
//.........这里部分代码省略.........
开发者ID:NN-Dev-Team,项目名称:Nordic-Network,代码行数:101,代码来源:browse.inc.php


示例18: file2base64

function file2base64($value)
{
    if (is_dir($value)) {
        return false;
    } else {
        $mime = getMime($value);
        $fd = fopen($value, 'rb');
        $size = filesize($value);
        fclose($fd);
        $result['base64'] = base64_encode(file_get_contents($value));
        $result['mime'] = $mime;
        $result['name'] = basename($value);
        $result['size'] = $size;
        return $result;
    }
}
开发者ID:oriolet,项目名称:bootils,代码行数:16,代码来源:Files.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getMimeType函数代码示例发布时间:2022-05-15
下一篇:
PHP getMicrotime函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap