Пример #1
0
/**
*include自定义类
*@param $file file
*@return null
*/
function import($file)
{
    $_file = LIB_PATH . '/Extend/' . $file;
    if (file_exists($_file)) {
        include $_file;
    } else {
        sys_error("Error : The file of \"" . $_file . "\" not exist!!!");
    }
}
Пример #2
0
<?php

/**
 * @package Simple Groupware
 * @link http://www.simple-groupware.de
 * @copyright Simple Groupware Solutions Thomas Bley 2002-2012
 * @license GPLv2
 */
define("NOCONTENT", true);
define("NOSESSION", true);
require "index.php";
if (empty($_REQUEST["item"]) or empty($_REQUEST["action"]) or empty($_REQUEST["folder"]) or !isset($_REQUEST["subitem"])) {
    sys_error("Missing parameters.", "403 Forbidden");
}
sys_check_auth();
if (empty($_REQUEST["field"])) {
    $field = "filedata";
} else {
    $field = ltrim($_REQUEST["field"], "_");
}
$folder = folder_from_path($_REQUEST["folder"]);
if (strtolower($_REQUEST["action"]) == "lock") {
    ajax::file_lock($folder, $_REQUEST["item"], $field, $_REQUEST["subitem"]);
    header("Cache-Control: private, max-age=1, must-revalidate");
    header("Expires: " . gmdate("D, d M Y H:i:s", NOW) . " GMT");
    header("Content-Type: text/xml; charset=utf-8");
    header("Lock-Token: <opaquelocktoken:1>");
    echo '<?xml version="1.0" encoding="utf-8"?>
<D:prop xmlns:D="DAV:">
<D:lockdiscovery><D:activelock>
<D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype>
Пример #3
0
    $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");
        header("Content-Type: " . ($dispo == "inline" ? "image/jpg" : "application/octet-stream") . "; charset=utf-8");
Пример #4
0
/**
 * @package Simple Groupware
 * @link http://www.simple-groupware.de
 * @copyright Simple Groupware Solutions Thomas Bley 2002-2012
 * @license GPLv2
 */
define("NOCONTENT", true);
require "index.php";
if (empty($_SESSION["folder"])) {
    exit;
}
if (!empty($_REQUEST["filename"])) {
    $filename = SIMPLE_CACHE . "/thumbs/" . basename($_REQUEST["filename"]);
    if (!file_exists($filename)) {
        sys_error("File not found.");
    }
    $modified = filemtime($filename);
    $etag = '"' . md5($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;
    }
    header("Content-Type: image/png");
    header("Expires: " . gmdate("D, d M Y H:i:s", NOW) . " GMT");
    header("Content-Length: " . (int) filesize($filename));
    readfile($filename);
}
if (!empty($_REQUEST["type"]) and $_REQUEST["type"] == "bar" and !empty($_REQUEST["stat"]) and !empty($_REQUEST["style"]) and !empty($_REQUEST["data"])) {
Пример #5
0
function _upload_create_file($db_path, $target_lnk, $path, $filename)
{
    list($id, $left, $unused) = _upload_process_folder_string($db_path . "/");
    if ($left != 0 or $id == 0) {
        sys_error("path not found", "409 Conflict");
    }
    $ftype = db_select_value("simple_sys_tree", "ftype", "id=@id@", array("id" => $id));
    if (db_get_right($id, "write") and !empty($ftype) and $ftype == "files") {
        list($target, $a_filename) = sys_build_filename($filename, "simple_files");
        dirs_checkdir($target);
        $target .= sys_get_pathnum($id) . "/";
        dirs_checkdir($target);
        $target .= md5($id) . $a_filename;
        if ($fp = fopen("php://input", "r") and $ft = fopen($target, "wb")) {
            while (!feof($fp)) {
                fwrite($ft, fread($fp, 8192));
            }
            fclose($fp);
            fclose($ft);
            $a_id = sql_genID("simple_files") * 100;
            $data = array("id" => $a_id, "folder" => $id, "dsize" => filesize($target), "filedata" => "|" . $target . "|", "filename" => $filename, "rread_users" => "|anonymous|", "rwrite_users" => "|anonymous|", "history" => t("{t}Item created by %s at %s{/t}", $_SESSION["username"], sys_date(t("{t}m/d/y g:i:s a{/t}"))) . "\n");
            $error_sql = db_insert("simple_files", $data);
            if ($error_sql == "") {
                db_update_treesize("simple_files", $id);
                $fields = array("filename" => "text", "filedata" => "files", "folder" => "id", "id" => "id");
                db_search_update("simple_files", $a_id, array(), $fields);
                sys_log_stat("new_records", 1);
                file_put_contents($target_lnk, $path . "/" . $a_id . "_0__" . $filename . "\n" . $target, LOCK_EX);
                _upload_success();
            }
        }
    }
    sys_error("cant write new", "403 Forbidden");
}
Пример #6
0
function fatal_handler()
{
    $errfile = "unknown file";
    $errstr = "shutdown";
    $errno = E_CORE_ERROR;
    $errline = 0;
    $error = error_get_last();
    //var_dump($error);die();
    if ($error !== NULL) {
        $errno = $error["type"];
        $errfile = $error["file"];
        $errline = $error["line"];
        $errstr = $error["message"];
        sys_error($errno, $errstr, $errfile, $errline);
    }
}