亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ondiskhashedstoragemanager.inc.php

?? PHP 知識管理系統(基于樹結構的知識管理系統), 英文原版的PHP源碼。
?? PHP
字號:
<?php
/**
 * $Id: ondiskhashedstoragemanager.inc.php 9222 2008-09-09 20:19:55Z kevin_fourie $
 *
 * Provides storage for contents of documents on disk, using a hashed
 * folder path and the content version as the file name.
 *
 * KnowledgeTree Community Edition
 * Document Management Made Simple
 * Copyright (C) 2008 KnowledgeTree Inc.
 * Portions copyright The Jam Warehouse Software (Pty) Limited
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
 * California 94120-7775, or email info@knowledgetree.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * KnowledgeTree" logo and retain the original copyright notice. If the display of the
 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
 * must display the words "Powered by KnowledgeTree" and retain the original
 * copyright notice.
 * Contributor( s): ______________________________________
 */

require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php');
require_once(KT_LIB_DIR . '/mime.inc.php');
require_once(KT_LIB_DIR . '/documentmanagement/Document.inc');
require_once(KT_LIB_DIR . '/documentmanagement/documentcontentversion.inc.php');
require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php');

class KTOnDiskHashedStorageManager extends KTStorageManager {
    function upload(&$oDocument, $sTmpFilePath, $aOptions = null) {

    	if (!file_exists($sTmpFilePath)) {

            	return new PEAR_Error("$sTmpFilePath does not exist so we can't copy it into the repository! Options: "  . print_r($aOptions,true) );
            }


        $oConfig =& KTConfig::getSingleton();
        $sStoragePath = $this->generateStoragePath($oDocument);
        if (PEAR::isError($sStoragePath)) {
            return $sStoragePath;
        }
        $this->setPath($oDocument, $sStoragePath);
        $oDocument->setFileSize(filesize($sTmpFilePath));
        $sDocumentFileSystemPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oDocument));

        //copy the file accross
        $start_time = KTUtil::getBenchmarkTime();
        $file_size = $oDocument->getFileSize();
        if (OS_WINDOWS) {
            $sDocumentFileSystemPath = str_replace('\\','/',$sDocumentFileSystemPath);
        }
        if ($this->writeToFile($sTmpFilePath, $sDocumentFileSystemPath, $aOptions)) {
            $end_time = KTUtil::getBenchmarkTime();
            global $default;
            $default->log->info(sprintf("Uploaded %d byte file in %.3f seconds", $file_size, $end_time - $start_time));

            //remove the temporary file
            //@unlink($sTmpFilePath);
            if (file_exists($sDocumentFileSystemPath)) {
                return true;
            } else {
            	return new PEAR_Error("$sDocumentFileSystemPath does not exist after write to storage path. Options: " . print_r($aOptions,true));
            }
        } else {
            return new PEAR_Error("Could not write $sTmpFilePath to $sDocumentFileSystemPath with options: " . print_r($aOptions,true));
        }
    }

    /**
     * Upload a temporary file
     *
     * @param unknown_type $sUploadedFile
     * @param unknown_type $sTmpFilePath
     * @return unknown
     */
    function uploadTmpFile($sUploadedFile, $sTmpFilePath) {

        //copy the file accross
        if (OS_WINDOWS) {
            $sTmpFilePath = str_replace('\\','/',$sTmpFilePath);
        }
        if ($this->writeToFile($sUploadedFile, $sTmpFilePath)) {
            if (file_exists($sTmpFilePath)) {
                return true;
            } else {
                return false;
            }
        }
        return false;
    }

    function writeToFile($sTmpFilePath, $sDocumentFileSystemPath, $aOptions = null) {
        // Make it easy to write compressed/encrypted storage
        if(isset($aOptions['copy_upload']) && ($aOptions['copy_upload'] == 'true')) {
            return copy($sTmpFilePath, $sDocumentFileSystemPath);
        }

        if (is_uploaded_file($sTmpFilePath))
            $res = @move_uploaded_file($sTmpFilePath, $sDocumentFileSystemPath);
        else
            $res = @rename($sTmpFilePath, $sDocumentFileSystemPath);

        if ($res === false)
        {
        	$res = @copy($sTmpFilePath, $sDocumentFileSystemPath);
        }

        return $res;
    }

    function getPath(&$oDocument) {
        return $oDocument->getStoragePath();
    }

    function setPath(&$oDocument, $sNewPath) {
        $oDocument->setStoragePath($sNewPath);
    }

    function generateStoragePath(&$oDocument) {
        return $this->generateStoragePathForVersion($oDocument->getContentVersionId());
    }

    function generateStoragePathForVersion($oContentVersion) {
        $iId = KTUtil::getId($oContentVersion);
        $str = (string)$iId;
        if (strlen($str) < 4) {
            $str = sprintf('%s%s', str_repeat('0', 4 - strlen($str)), $str);
        }
        if (strlen($str) % 2 == 1) {
            $str = sprintf('0%s', $str);
        }

        $str = substr($str, 0, -2);

        $dir = preg_replace('#(\d\d)(\d\d)#', '\1/\2', $str);

        // Now, create the directory (including intermediaries)
        $oConfig =& KTConfig::getSingleton();
        $sDocumentRoot = $oConfig->get('urls/documentRoot');

        $path = "";
        foreach(split('/', $dir) as $sDirPart) {
            $path = sprintf('%s/%s', $path, $sDirPart);
            $createPath = sprintf('%s%s', $sDocumentRoot, $path);
            if (!file_exists($createPath)) {
                $res = @mkdir($createPath, 0777, true);
                if ($res === false) {
                    return PEAR::raiseError(_kt("Could not create directory for storage" .': ' . $createPath));
                }
            }
        }
        return sprintf("%s/%d", $dir, $iId);
    }

    function temporaryFile(&$oDocument) {
        $oConfig =& KTConfig::getSingleton();
        return sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oDocument));
    }

    function freeTemporaryFile($sPath) {
        // Storage uses file-on-filesystem for temporaryFile
        return;
    }

    function download($oDocument, $bIsCheckout = false) {
        global $default;

        //get the path to the document on the server
        $docRoot = $default->documentRoot;
        $path = $docRoot .'/'. $oDocument->getStoragePath();

        // Ensure the file exists
        if (file_exists($path)) {
            // Get the mime type
            $mimeId = $oDocument->getMimeTypeID();
            $mimetype = KTMime::getMimeTypeName($mimeId);

            if ($bIsCheckout && $default->fakeMimetype) {
                // note this does not work for "image" types in some browsers
                $mimetype = 'application/x-download';
            }

            $sFileName = $oDocument->getFileName( );
            $iFileSize = $oDocument->getFileSize();

            KTUtil::download($path, $mimetype, $iFileSize, $sFileName);
        } else {
            return false;
        }
    }

    function createFolder($oFolder) {
        // Storage doesn't deal with folders
        return true;
    }

    function removeFolder($oFolder) {
        // Storage doesn't deal with folders
        return true;
    }

    function removeFolderTree($oFolder) {
        // Storage doesn't deal with folders
        return true;
    }

    function downloadVersion($oDocument, $iVersionId) {
        //get the document
        $oContentVersion = KTDocumentContentVersion::get($iVersionId);
        $oConfig =& KTConfig::getSingleton();
        $sPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $this->getPath($oContentVersion));
        $sVersion = sprintf("%d.%d", $oContentVersion->getMajorVersionNumber(), $oContentVersion->getMinorVersionNumber());
        if (file_exists($sPath)) {
            // Get the mime type
            $mimeId = $oContentVersion->getMimeTypeID();
            $mimetype = KTMime::getMimeTypeName($mimeId);

            $sFileName = $sVersion.'-'.$oContentVersion->getFileName( );
            $iFileSize = $oContentVersion->getFileSize();

            KTUtil::download($sPath, $mimetype, $iFileSize, $sFileName);
        } else {
            return false;
        }
    }

    function moveDocument(&$oDocument, $oSourceFolder, $oDestinationFolder) {
        // Storage path isn't based on location folder hierarchy
        return true;
    }

    /**
     * Move a file
     *
     * @param string source path
     * @param string destination path
     */
    function move($sOldDocumentPath, $sNewDocumentPath) {
        global $default;
        if (file_exists($sOldDocumentPath)) {
            //copy the file    to the new destination
            if (rename($sOldDocumentPath, $sNewDocumentPath)) {
                //delete the old one
                //@unlink($sOldDocumentPath);
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }

    function moveFolder($oFolder, $oDestFolder) {
        // Storage path isn't based on folder hierarchy
        return true;
    }

    function renameFolder($oFolder, $sNewName) {
        // Storage path isn't based on folder hierarchy
        return true;
    }

    /**
     * Perform any storage changes necessary to account for a copied
     * document object.
     */
    function copy($oSrcDocument, &$oNewDocument) {
        // we get the Folder object
        $oVersion = $oNewDocument->_oDocumentContentVersion;
        $oConfig =& KTConfig::getSingleton();
        $sDocumentRoot = $oConfig->get('urls/documentRoot');

        $sNewPath = $this->generateStoragePath($oNewDocument);
        $sFullOldPath = sprintf("%s/%s", $sDocumentRoot, $this->getPath($oSrcDocument));
        $sFullNewPath = sprintf("%s/%s", $sDocumentRoot, $sNewPath);

        $res = KTUtil::copyFile($sFullOldPath, $sFullNewPath);
        if (PEAR::isError($res)) { return $res; }
        $oVersion->setStoragePath($sNewPath);
        $oVersion->update();
    }

    function renameDocument(&$oDocument, $oOldContentVersion, $sNewFilename) {
        // Storage isn't based on document name
        return true;
     }

    function delete($oDocument) {
        // Storage doesn't care if the document is deleted
        return true;
    }

    /**
     * Completely remove a document from the Deleted/ folder
     *
     * return boolean true on successful expunge
     */
    function expunge($oDocument) {
    	parent::expunge($oDocument);
    	$oConfig =& KTConfig::getSingleton();
        $sCurrentPath = $this->getPath($oDocument);

        $sDocumentRoot = $oConfig->get('urls/documentRoot');

        $aVersions = KTDocumentContentVersion::getByDocument($oDocument);
        foreach ($aVersions as $oVersion) {
            $sPath = sprintf('%s/%s', $sDocumentRoot, $oVersion->getStoragePath());
            @unlink($sPath);
        }
        return true;
    }

	/**
	 * Completely remove a document version
	 *
	 * return boolean true on successful delete
	 */
	function deleteVersion($oVersion) {
	    $oConfig =& KTConfig::getSingleton();
	    $sDocumentRoot = $oConfig->get('urls/documentRoot');
	    $iContentId = $oVersion->getContentVersionId();
        $oContentVersion = KTDocumentContentVersion::get($iContentId);

	    $sPath = $oContentVersion->getStoragePath();
	    $sFullPath = sprintf("%s/%s", $sDocumentRoot, $sPath);
	    if (file_exists($sFullPath)) {
            unlink($sFullPath);
	    }
	    return true;
	}

    function restore($oDocument) {
        // Storage doesn't care if the document is deleted or restored
        return true;
    }
}

?>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情综合五月婷婷| 色一区在线观看| 不卡免费追剧大全电视剧网站| 色拍拍在线精品视频8848| 欧美电视剧在线观看完整版| 亚洲免费三区一区二区| 激情五月播播久久久精品| 欧美亚洲动漫另类| 国产精品久久久久影院| 激情综合网天天干| 欧美色偷偷大香| 亚洲色图欧美偷拍| 国产不卡免费视频| 欧美精品一区二区三区蜜桃 | 视频一区中文字幕国产| 丁香婷婷综合激情五月色| 日韩视频在线观看一区二区| 亚洲综合清纯丝袜自拍| 成人免费毛片app| 久久久美女艺术照精彩视频福利播放| 一区二区三区国产精品| 91免费在线视频观看| 国产精品无码永久免费888| 国产原创一区二区| 日韩欧美在线综合网| 爽好多水快深点欧美视频| 欧美性淫爽ww久久久久无| 玉足女爽爽91| 91极品美女在线| 亚洲制服欧美中文字幕中文字幕| 91麻豆国产精品久久| 中文字幕亚洲一区二区av在线| 国产精品99久久久久久有的能看 | 91浏览器在线视频| 亚洲摸摸操操av| 色综合久久99| 亚洲图片欧美激情| 色国产综合视频| 亚洲综合精品自拍| 欧美老年两性高潮| 蜜桃视频一区二区三区 | 欧美亚洲动漫另类| 三级久久三级久久久| 日韩一区二区三区三四区视频在线观看| 亚洲高清免费视频| 日韩欧美一级片| 色综合天天在线| 亚洲一区二区综合| 91精品国产91久久久久久一区二区 | 成人欧美一区二区三区视频网页| 97久久精品人人做人人爽| 亚洲永久免费av| 91 com成人网| 国产一区二区三区久久久| 中文乱码免费一区二区| 91久久一区二区| 蜜臀av性久久久久av蜜臀妖精 | 欧美日韩一卡二卡三卡| 日韩激情一二三区| 国产午夜精品久久久久久免费视| 成人午夜电影久久影院| 一区二区三区日本| 2020日本不卡一区二区视频| av网站一区二区三区| 午夜精品久久久久久久99樱桃| 日韩欧美一级在线播放| 北条麻妃一区二区三区| 亚瑟在线精品视频| 精品国产乱码久久久久久夜甘婷婷| 成人aa视频在线观看| 亚洲国产精品精华液网站 | 欧美私模裸体表演在线观看| 久久精品国产亚洲aⅴ| 国产精品久久久久天堂| 欧美日韩国产综合视频在线观看| 国产一区二区伦理片| 亚洲综合激情小说| 久久久久久久久久久99999| 日本道色综合久久| 国产**成人网毛片九色| 丝袜美腿亚洲色图| 亚洲色图一区二区三区| 欧美精品一区二区三区蜜桃视频| 欧美性大战久久久| 成人高清在线视频| 久久精品免费看| 亚洲午夜电影在线| 中文字幕一区日韩精品欧美| 日韩一级高清毛片| 精品视频全国免费看| av福利精品导航| 国产一区二区免费视频| 日本va欧美va精品| 亚洲午夜精品一区二区三区他趣| 国产欧美日韩在线| 日韩精品中文字幕一区二区三区| 91在线视频免费91| 国产成人鲁色资源国产91色综| 亚洲一区二区视频在线观看| 国产日韩欧美一区二区三区乱码| 欧美一区二区久久| 欧美日韩一区二区不卡| 91激情五月电影| 色香色香欲天天天影视综合网| 国产精品一区二区在线看| 麻豆视频一区二区| 日韩高清在线观看| 天堂资源在线中文精品| 亚洲尤物在线视频观看| 一区二区高清在线| 亚洲女女做受ⅹxx高潮| 最新国产精品久久精品| 国产精品青草久久| 国产色一区二区| 国产欧美在线观看一区| 久久这里只有精品首页| 久久综合网色—综合色88| 精品久久99ma| 精品国偷自产国产一区| 久久精品一区二区三区不卡牛牛 | 美女性感视频久久| 麻豆国产精品官网| 久久91精品久久久久久秒播| 久久成人久久鬼色| 国产精品影视在线观看| 成人动漫一区二区三区| 91原创在线视频| 欧美在线小视频| 91精品一区二区三区久久久久久| 欧美一级在线视频| 久久青草国产手机看片福利盒子| 久久精品在这里| 亚洲欧洲综合另类在线| 亚洲一区二区视频在线观看| 日韩电影网1区2区| 精品一区二区三区免费视频| 国产成人啪免费观看软件| 99精品黄色片免费大全| 欧美视频第二页| 日韩免费观看高清完整版| 国产欧美综合色| 有坂深雪av一区二区精品| 天堂在线一区二区| 高清不卡一区二区在线| 一本色道久久加勒比精品 | 欧美三级三级三级爽爽爽| 7777精品伊人久久久大香线蕉 | 91免费国产在线观看| 欧美午夜片在线观看| 精品国产乱码久久久久久久| 中文字幕电影一区| 偷拍亚洲欧洲综合| 粉嫩一区二区三区性色av| 欧美日韩免费高清一区色橹橹| 精品乱码亚洲一区二区不卡| 亚洲三级在线免费| 日韩高清国产一区在线| 成人精品高清在线| 日韩欧美在线网站| 亚洲精品视频免费看| 国产一区在线看| 欧美在线播放高清精品| 久久久美女艺术照精彩视频福利播放| 亚洲免费资源在线播放| 国产成人免费在线视频| 3d动漫精品啪啪| 亚洲精选一二三| 国产成人99久久亚洲综合精品| 欧美日韩成人综合| 中文一区在线播放| 国模一区二区三区白浆| 欧美日韩亚洲另类| 国产精品久久久久久亚洲毛片| 琪琪久久久久日韩精品| 91福利精品视频| 国产精品久久久久7777按摩 | 91麻豆蜜桃一区二区三区| 精品88久久久久88久久久| 视频一区中文字幕| 在线观看日韩av先锋影音电影院| 日本一区二区视频在线| 久久精品国产第一区二区三区| 欧美日韩一区二区三区高清| 亚洲欧美日韩综合aⅴ视频| 国产丶欧美丶日本不卡视频| 欧美岛国在线观看| 日本aⅴ亚洲精品中文乱码| 欧洲亚洲国产日韩| 亚洲精品水蜜桃| 99精品视频在线观看免费| 国产情人综合久久777777| 精品一区二区久久久| 日韩一级片在线观看| 日本亚洲视频在线| 欧美日韩精品三区| 亚洲国产日韩a在线播放| 欧美亚洲综合色| 亚洲国产精品影院| 欧美日韩黄色影视| 日韩中文字幕麻豆|