Beispiel #1
0
function util_define_timezone()
{
    $loc = conf_read("timezone");
    if (util_empty($loc)) {
        $loc = "Europe/Paris";
    }
    date_default_timezone_set($loc);
}
Beispiel #2
0
function secu_login($pass)
{
    $hash = conf_read("password");
    if (util_empty($pass) || util_empty($hash)) {
        return false;
    }
    if (secu_hash($pass) === $hash) {
        if (session_status() != PHP_SESSION_ACTIVE) {
            session_start();
        }
        $_SESSION["spic_cotime"] = time();
        return true;
    }
    secu_timeout();
    return false;
}
Beispiel #3
0
    if (strcmp($mime, $check["mime"]) == 0) {
        $supported = true;
    }
}
if (!$supported) {
    echo ajax_format($resp, $check["mime"] . " not supported ({$fname}).");
    exit;
}
$ok = false;
if (strcmp($check["mime"], "image/jpeg") == 0) {
    $img = imagecreatefromjpeg($_FILES["pic"]["tmp_name"]);
    $ok = @imagejpeg($img, $path);
} elseif (strcmp($check["mime"], "image/gif") == 0) {
    $img = imagecreatefromgif($_FILES["pic"]["tmp_name"]);
    $ok = @imagegif($img, $path);
} elseif (strcmp($check["mime"], "image/png") == 0) {
    $img = imagecreatefrompng($_FILES["pic"]["tmp_name"]);
    $ok = @imagepng($img, $path);
}
if (!$ok) {
    echo ajax_format($resp, "failed to save {$fname}.");
    exit;
}
$size = filesize($path);
$resp["name"] = $fname;
$resp["URL"] = util_empty(conf_read("url")) ? "err: URL not set" : conf_read("url") . "/" . $fname;
$resp["mine"] = $check["mime"];
$resp["size"] = $size;
$resp["hsize"] = util_human_size($size);
$resp["root"] = util_empty(conf_read("url")) ? "err: URL not set" : conf_read("url");
echo ajax_format($resp, "");
Beispiel #4
0
<?php

/**
 * Spic <https://github.com/ricain/spic>
 * @author Jean Mercadier <jmercadier.fr>
 * @license The MIT License
 */
require_once __DIR__ . "/../../private/lib/conf.lib.php";
require_once __DIR__ . "/../../private/lib/util.lib.php";
header("Content-type: text/css");
$color = conf_read("color");
if (util_empty($color)) {
    $color = "#3A75BC";
}
?>

* {
	outline-color: <?php 
echo $color;
?>
;
}

.head .tab,
.images .row:hover,
input.login[type=submit] {
	background-color: <?php 
echo $color;
?>
;
}
Beispiel #5
0
if ($size == false) {
    header("HTTP/1.0 404 Not Found");
    include __DIR__ . "/private/page/404.page.php";
    exit;
}
$allowed = array("image/gif", "image/jpeg", "image/png");
$supported = false;
foreach ($allowed as $mime) {
    if (strcmp($mime, $size["mime"]) == 0) {
        $supported = true;
    }
}
if (!$supported) {
    header("HTTP/1.0 404 Not Found");
    include __DIR__ . "/private/page/404.page.php";
    exit;
}
if (!util_empty(conf_read("piwikurl")) && !util_empty(conf_read("piwiksiteid")) && !secu_isloged()) {
    include __DIR__ . "/private/api/PiwikTracker.php";
    PiwikTracker::$URL = conf_read("piwikurl");
    $piwikTracker = new PiwikTracker($idSite = intval(conf_read("piwiksiteid")));
    $piwikTracker->doTrackPageView($req . " (" . $size["mime"] . ")");
}
error_reporting(0);
ob_start();
ob_clean();
ob_start("ob_gzhandler");
header("Content-Type: " . $size["mime"]);
ob_end_flush();
readfile($file);
exit;
Beispiel #6
0
util_define_timezone();
$resp = array();
if (isset($_POST["resend"])) {
    $resp["resend"] = $_POST["resend"];
}
if (!secu_isloged() && (!isset($_POST["pass"]) || !secu_login($_POST["pass"]))) {
    echo ajax_format($resp, "wrong password.");
    exit;
}
if (!isset($_POST["file"])) {
    echo ajax_format($resp, "file name missing.");
    exit;
}
$name = basename($_POST["file"]);
$file = dir_pic_path($name);
if (!is_readable($file)) {
    echo ajax_format(array(), "could not open " . $name . " (check permission).");
    exit;
}
$size = getimagesize($file);
if ($size === false) {
    echo ajax_format(array(), "could not open " . $_POST["file"] . ".");
    exit;
}
$resp["name"] = $name;
$resp["type"] = $size["mime"];
$resp["URL"] = util_empty(conf_read("url")) ? "err: URL not set" : conf_read("url") . "/" . $name;
$resp["added"] = date(util_empty(conf_read("timeformat")) ? "d F Y" : conf_read("timeformat"), filemtime($file));
$resp["size"] = util_human_size(filesize($file));
$resp["dimensions"] = $size[0] . 'x' . $size[1];
echo ajax_format($resp);
Beispiel #7
0
/**
 * Spic <https://github.com/ricain/spic>
 * @author Jean Mercadier <jmercadier.fr>
 * @license The MIT License
 */
require_once __DIR__ . "/../lib/dir.lib.php";
require_once __DIR__ . "/../lib/conf.lib.php";
require_once __DIR__ . "/../lib/util.lib.php";
util_define_timezone();
$pics = dir_list();
$url = conf_read("url");
$prefix = conf_read("prefix");
$suffix = conf_read("suffix");
$space = conf_read("allowspace") ? "true" : "false";
$name = conf_read("brandname");
$name = util_empty($name) ? "Spic" : $name;
?>
<!--
- Spic <https://github.com/ricain/spic>
- @author Jean Mercadier <jmercadier.fr>
- @license The MIT License
-->
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo $name;
?>
</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="media/css/desktop.css" media="screen" charset="utf-8" />
Beispiel #8
0
<?php

/**
 * Spic <https://github.com/ricain/spic>
 * @author Jean Mercadier <jmercadier.fr>
 * @license The MIT License
 */
require_once __DIR__ . "/../lib/conf.lib.php";
$col = conf_read("color");
if (util_empty($col)) {
    $col = "#3A75BC";
}
$name = conf_read("brandname");
if (util_empty($name)) {
    $name = "Spic";
}
?>
<!DOCTYPE html>
<html>
<head>
	<title>404 <?php 
echo $name;
?>
</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style media="screen">
		h1 {
			text-align: center;
			color: <?php 
echo $col;
?>
Beispiel #9
0
} else {
    if (isset($_POST["pass"])) {
        if (secu_login($_POST["pass"])) {
            header("Location: .");
            exit;
        }
        $err = "Bad password.";
    }
}
$brand = conf_read("brandname");
if (util_empty($brand)) {
    $brand = "Spic";
}
$welcometext = conf_read("wellcometext");
$col = conf_read("color");
if (util_empty($col)) {
    $col = "#3A75BC";
}
?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
echo $brand;
?>
</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="media/css/login.css" media="screen" charset="utf-8" />
	<link rel="stylesheet" href="media/css/color.css.php" media="screen" charset="utf-8" />
</head>
<body onload="document.getElementById('pass').focus()">