Initial commit
11
.htaccess
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
ErrorDocument 404 /error/notfound
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
|
||||||
|
RewriteRule ^(.*)$ index.php?url=$1 [QSA,PT,L]
|
||||||
|
|
||||||
|
</IfModule>
|
||||||
8
adapt.sh
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
cd originals/
|
||||||
|
for f in *
|
||||||
|
do
|
||||||
|
echo "Processing $f"
|
||||||
|
|
||||||
|
mkdir ../upload/$f
|
||||||
|
cp $f ../upload/$f/$f
|
||||||
|
done
|
||||||
19
backend.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
define('ROOT', dirname(__FILE__));
|
||||||
|
define('DOMAINPATH',(isset($_SERVER['HTTPS'])?'https':'http').'://'.$_SERVER['HTTP_HOST'].'/');
|
||||||
|
|
||||||
|
require_once (ROOT . DS . 'inc' . DS . 'core.php');
|
||||||
|
|
||||||
|
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
|
||||||
|
if($_GET['getimage'])
|
||||||
|
{
|
||||||
|
$url = $_GET['getimage'];
|
||||||
|
|
||||||
|
echo json_encode($pm->uploadImageFromURL($url));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo json_encode(array('status'=>'ERR'));
|
||||||
2360
classes/easyphpthumbnail.php
Normal file
494
classes/html.php
Normal file
@@ -0,0 +1,494 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class HTML {
|
||||||
|
|
||||||
|
private $js = array();
|
||||||
|
|
||||||
|
function shortenUrls($data) {
|
||||||
|
$data = preg_replace_callback('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', array(get_class($this), '_fetchTinyUrl'), $data);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _fetchTinyUrl($url) {
|
||||||
|
$ch = curl_init();
|
||||||
|
$timeout = 5;
|
||||||
|
curl_setopt($ch, CURLOPT_URL, 'http://tinyurl.com/api-create.php?url=' . $url[0]);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
|
||||||
|
$data = curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
return '<a href="' . $data . '" target = "_blank" >' . $data . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function code($data,$class='markdown')
|
||||||
|
{
|
||||||
|
return '<pre><code class="'.$class.'">'.$data.'</code></pre>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function form($data,$submitvalue="Speichern",$action="",$submitname="submit")
|
||||||
|
{
|
||||||
|
return '<form enctype="multipart/form-data" method="POST" onsubmit="doCheck();" action="'.$action.'">'.$data.'<br/><input type="submit" name="'.$submitname.'" value="'.$submitvalue.'" /> </form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function number($z,$nachkommastellen=0)
|
||||||
|
{
|
||||||
|
return number_format($z, $nachkommastellen, ',', '.');
|
||||||
|
}
|
||||||
|
|
||||||
|
function span($data,$id="",$class="",$zusatz="")
|
||||||
|
{
|
||||||
|
return '<span id="'.$id.'" class="'.$class.'" '.$zusatz.'>'.$data.'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function textarea($name,$data='',$cols=50,$rows=10,$forcewysiwyg=false)
|
||||||
|
{
|
||||||
|
$cs = new CubeshopModel;
|
||||||
|
if($_SESSION['user'] && ($cs->hasUserItem('bbcode') || $forcewysiwyg))
|
||||||
|
$textarea = $this->getWYSIWYGEditor($name,$data);
|
||||||
|
else $textarea = '<textarea name="'.$name.'" cols="'.$cols.'" rows="'.$rows.'">'.$data.'</textarea>';
|
||||||
|
|
||||||
|
return $textarea;
|
||||||
|
}
|
||||||
|
|
||||||
|
function center($data)
|
||||||
|
{
|
||||||
|
return '<center>'.$data.'</center>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayError($e)
|
||||||
|
{
|
||||||
|
$text = addslashes($this->error($e));
|
||||||
|
return '<script>$(document).ready(function(){error("'.$text.'");});</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function displaySuccess($e)
|
||||||
|
{
|
||||||
|
$text = addslashes($this->success($e));
|
||||||
|
return '<script>$(document).ready(function(){error("'.$text.'");});</script>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function clear()
|
||||||
|
{
|
||||||
|
return '<div class="clear"></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function menu($arr, $id = "", $class = "")
|
||||||
|
{
|
||||||
|
aasort($arr, 'priority');
|
||||||
|
$o = '<ul id="' . $id . '" class="' . $class . '">';
|
||||||
|
foreach ($arr as $key => $val)
|
||||||
|
{
|
||||||
|
if ($val['active'])
|
||||||
|
$c = 'active';
|
||||||
|
else
|
||||||
|
$c = '';
|
||||||
|
|
||||||
|
$o.= '<li class="menu_item" page="'.strtolower($key).'" id="page_' . strtolower($key) . '"><a href="' . DS . strtolower($key) . '" class="' . $c . ' '.$val['class'].'">' . $val['text'] . '</a></li>';
|
||||||
|
}
|
||||||
|
$o.= '</ul>';
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function strong($text,$id = "", $class = "")
|
||||||
|
{
|
||||||
|
return '<strong class="'.$class.'" id="'.$id.'">'.$text.'</strong>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function dfn($text,$desc,$id = "", $class = "")
|
||||||
|
{
|
||||||
|
return '<dfn class="'.$class.'" id="'.$id.'" title="'.$desc.'">'.$text.'</dfn>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function tip($text,$id = "", $class = "")
|
||||||
|
{
|
||||||
|
return '<span class="tip '.$class.'" id="'.$id.'">'.$text.'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function submenu($arr, $id = "", $class = "") {
|
||||||
|
if (!is_array($arr))
|
||||||
|
return false;
|
||||||
|
$o = '<ul id="' . $id . '" class="' . $class . '">';
|
||||||
|
foreach ($arr as $key => $val) {
|
||||||
|
if ($val['active'])
|
||||||
|
$c = 'active';
|
||||||
|
else
|
||||||
|
$c = '';
|
||||||
|
$o.= '<li id="sub_' . strtolower($val['action']) . '"><a href="' . DS . $val['base'] . DS . strtolower($val['action']) . '" class="' . $c . '">' . $val['text'] . '</a></li>';
|
||||||
|
}
|
||||||
|
$o.= '</ul>';
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $timestamp = zeitpunt des ablaufens in unix timestamp
|
||||||
|
*/
|
||||||
|
function countdown($timestamp,$prestring="",$id=0,$allownegative=false)
|
||||||
|
{
|
||||||
|
$a = new Algorithms();
|
||||||
|
if(!$id) $id = $a->getRandomHash(8);
|
||||||
|
$seconds = $timestamp-time();
|
||||||
|
//return '<span id="'.$id.'"><script>countdown("#'.$id.'",'.$timestamp.',"'.$prestring.'",'.(time()*1000).',0);</script></span>';
|
||||||
|
return '<span id="'.$id.'"><script>countdown("#'.$id.'","","'.$prestring.'",'.($seconds*1000).',"'.$allownegative.'");</script></span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitize($data)
|
||||||
|
{
|
||||||
|
return mysql_real_escape_string($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function specialchars($text,$utf8=0)
|
||||||
|
{
|
||||||
|
return htmlspecialchars($text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
|
* @param string $type
|
||||||
|
* @param string $id
|
||||||
|
* @param string $class
|
||||||
|
* @param int $size
|
||||||
|
*/
|
||||||
|
function input($name, $value = '', $type = 'text', $id = '', $class = '', $size = '20',$onClick='',$extra='')
|
||||||
|
{
|
||||||
|
return '<input type="' . $type . '" onClick="'.$onClick.'" value="' . $value . '" class="' . $class . '" id="' . $id . '" name="' . $name . '" size="' . $size . '" '.$extra.' />';
|
||||||
|
}
|
||||||
|
|
||||||
|
function button($name,$value,$onclick="return true;",$id='',$class="button")
|
||||||
|
{
|
||||||
|
return '<input type="button" name="'.$name.'" value="'.$value.'" id="'.$id.'" class="'.$class.'" onClick="'.$onclick.'"/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonGoTo($value,$link,$id='',$class='')
|
||||||
|
{
|
||||||
|
return '<a href="'.$link.'" id="'.$id.'" class="button '.$class.'">'.$value.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param array $data the multidimensional array
|
||||||
|
* @param bool $header should the first line be a <th> element instead of <td>?
|
||||||
|
* @param string $width
|
||||||
|
* @param string $id the ID of the table
|
||||||
|
* @param string $class the class of the table
|
||||||
|
* @param string $tdclass the class of every td element
|
||||||
|
*/
|
||||||
|
function table($data, $header = 1, $width = '100%', $id = '', $class = '', $tdclass = 'text_top', $evenwidth=1,$trclass='')
|
||||||
|
{
|
||||||
|
if (!is_array($data))
|
||||||
|
return false;
|
||||||
|
$t = '<table width="' . $width . '" id="' . $id . '" class="' . $class . '">';
|
||||||
|
foreach ($data as $key => $val)
|
||||||
|
{
|
||||||
|
if ($key == 0 && $header)
|
||||||
|
$td = 'th'; else
|
||||||
|
$td = 'td class="' . $tdclass . '"';
|
||||||
|
$t.='<tr class="'.$trclass.'">';
|
||||||
|
if($evenwidth) $w = floor(100/count($val)).'%';
|
||||||
|
foreach ($val as $j => $tdata)
|
||||||
|
{
|
||||||
|
if($evenwidth) $w = floor(100/count($val)).'%';
|
||||||
|
else $w = 'auto';
|
||||||
|
if(is_array($tdata))
|
||||||
|
{
|
||||||
|
$text = $tdata['text'];
|
||||||
|
if($tdata['header']) $td = 'th';
|
||||||
|
if($tdata['width']) $w=$tdata['width'];
|
||||||
|
if($tdata['class']) $tdclass .= ' '.$tdata['class'];
|
||||||
|
if($tdata['id']) $tid = $tdata['id'];
|
||||||
|
if($tdata['colspan']) $colspan = 'colspan="'.$tdata['colspan'].'"';
|
||||||
|
$tdata = $text;
|
||||||
|
}
|
||||||
|
$t.='<' . $td . ' '.$colspan.' width="'.$w.'" class="'.$tclass.'" id="'.$tid.'">' . $tdata . '</' . $td . '>';
|
||||||
|
$class='';
|
||||||
|
$tid='';
|
||||||
|
$colspan='';
|
||||||
|
}
|
||||||
|
$t.='</tr>';
|
||||||
|
}
|
||||||
|
$t.='</table>';
|
||||||
|
|
||||||
|
return $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param $err is the error code equivalent of /config/errors.php
|
||||||
|
* if $err is not numeric or not found in errors.php, its printed as text
|
||||||
|
* @param $class is the html tag class
|
||||||
|
*/
|
||||||
|
|
||||||
|
function error($err, $class = 'error',$backbutton=false)
|
||||||
|
{
|
||||||
|
global $error;
|
||||||
|
if (is_numeric($err) && $error[$err])
|
||||||
|
$err = $error[$err];
|
||||||
|
if($backbutton)
|
||||||
|
$bb = '<br/><a href="#" onClick="history.back();return false;">Zurück..</a>';
|
||||||
|
return '<span class="' . $class . '">' . $err . '</span>'.$bb;
|
||||||
|
}
|
||||||
|
|
||||||
|
function arrayToString($arr)
|
||||||
|
{
|
||||||
|
if(!is_array($arr)) return false;
|
||||||
|
foreach($arr as $a)
|
||||||
|
{
|
||||||
|
$o.=$a.';';
|
||||||
|
}
|
||||||
|
$o = substr($o,0,-1);
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function success($msg, $class = 'success')
|
||||||
|
{
|
||||||
|
return '<span class="' . $class . '">' . $msg . '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToLocation($location = '/', $force = true) {
|
||||||
|
$script = '<script>window.location.href="' . $location . '"</script>';
|
||||||
|
if ($force)
|
||||||
|
exit($script);
|
||||||
|
else
|
||||||
|
return $script;
|
||||||
|
}
|
||||||
|
|
||||||
|
function link($text, $path, $prompt = null, $confirmMessage = "Bist du sicher?",$class="")
|
||||||
|
{
|
||||||
|
$path = str_replace(' ', '-', $path);
|
||||||
|
if ($prompt) {
|
||||||
|
$data = '<a class="'.$class.'" href="' . BASE_PATH . '/' . $path . '" onclick="return confirm(\'' . $confirmMessage . '\')">' . $text . '</a>';
|
||||||
|
} else {
|
||||||
|
$data = '<a class="'.$class.'" href="' . BASE_PATH . '/' . $path . '">' . $text . '</a>';
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function liste($lines,$ulid='')
|
||||||
|
{
|
||||||
|
if(!is_array($lines)) return false;
|
||||||
|
$o = '<ul id="'.$ulid.'">';
|
||||||
|
foreach($lines as $line)
|
||||||
|
$o.='<li>'.$line.'</li>';
|
||||||
|
$o.= '</ul>';
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getArrowRight()
|
||||||
|
{
|
||||||
|
return '<img src="/css/imgs/arrow_right.png" height="20px" /> ';
|
||||||
|
}
|
||||||
|
|
||||||
|
function includeJs($fileName) {
|
||||||
|
$data = '<script src="' . BASE_PATH . '/js/' . $fileName . '.js"></script>';
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function includeCss($fileName) {
|
||||||
|
$data = '<style href="' . BASE_PATH . '/css/' . $fileName . '.css"></script>';
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInfoMessage($message,$text=false)
|
||||||
|
{
|
||||||
|
$message = str_replace('"', "'", $message);
|
||||||
|
$message = str_replace("'", "\'", $message);
|
||||||
|
return '<img class="tooltip" title="'.(($message)).'" src="/css/imgs/info.png" />';
|
||||||
|
//return '<span onmouseover="Tip(\''.$message.'\')" onmouseout="UnTip()">'.($text?$text:'<img src="/css/imgs/info.png" />').'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function BBCode($Text)
|
||||||
|
{
|
||||||
|
//$Text = utf8_encode($Text);
|
||||||
|
// Replace any html brackets with HTML Entities to prevent executing HTML or script
|
||||||
|
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
|
||||||
|
$Text = str_replace("<", "<", $Text);
|
||||||
|
$Text = str_replace(">", ">", $Text);
|
||||||
|
|
||||||
|
// Convert new line chars to html <br /> tags
|
||||||
|
$Text = nl2br($Text);
|
||||||
|
|
||||||
|
// Set up the parameters for a URL search string
|
||||||
|
$URLSearchString = " a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'";
|
||||||
|
// Set up the parameters for a MAIL search string
|
||||||
|
$MAILSearchString = $URLSearchString . " a-zA-Z0-9\.@";
|
||||||
|
|
||||||
|
// Perform URL Search
|
||||||
|
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/", '<a href=\'$1\' target=\'_blank\'>$1</a>', $Text);
|
||||||
|
$Text = preg_replace("(\[url\=([$URLSearchString]*)\](.+?)\[/url\])", '<a href=\'$1\' target=\'_blank\'>$2</a>', $Text);
|
||||||
|
//$Text = preg_replace("(\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[/url\])", '<a href="$1" target="_blank">$2</a>', $Text);
|
||||||
|
|
||||||
|
// Perform MAIL Search
|
||||||
|
$Text = preg_replace("(\[mail\]([$MAILSearchString]*)\[/mail\])", '<a href=\'mailto:$1\'>$1</a>', $Text);
|
||||||
|
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.+?)\[\/mail\]/", '<a href=\'mailto:$1\'>$2</a>', $Text);
|
||||||
|
|
||||||
|
// Check for bold text
|
||||||
|
$Text = preg_replace("(\[b\](.+?)\[\/b])is",'<strong>$1</strong>',$Text);
|
||||||
|
|
||||||
|
// Check for H1-H3
|
||||||
|
$Text = preg_replace("(\[h1\](.+?)\[\/h1])is",'<h1>$1</h1>',$Text);
|
||||||
|
$Text = preg_replace("(\[h2\](.+?)\[\/h2])is",'<h2>$1</h2>',$Text);
|
||||||
|
$Text = preg_replace("(\[h3\](.+?)\[\/h3])is",'<h3>$1</h3>',$Text);
|
||||||
|
|
||||||
|
// Check for Italics text
|
||||||
|
$Text = preg_replace("(\[i\](.+?)\[\/i\])is",'<em>$1</em>',$Text);
|
||||||
|
|
||||||
|
// Check for Underline text
|
||||||
|
$Text = preg_replace("(\[u\](.+?)\[\/u\])is",'<span style=\'text-decoration: underline;\'>$1</span>',$Text);
|
||||||
|
|
||||||
|
// Check for strike-through text
|
||||||
|
$Text = preg_replace("(\[s\](.+?)\[\/s\])is",'<span style=\'text-decoration: line-through;\'>$1</span>',$Text);
|
||||||
|
|
||||||
|
// Check for over-line text
|
||||||
|
$Text = preg_replace("(\[o\](.+?)\[\/o\])is",'<span style=\'text-decoration: overline;\'>$1</span>',$Text);
|
||||||
|
|
||||||
|
// Check for colored text
|
||||||
|
$Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style='color: $1'>$2</span>",$Text);
|
||||||
|
|
||||||
|
// Check for sized text
|
||||||
|
$Text = preg_replace("(\[size=(.+?)\](.+?)\[\/size\])is","<span style='font-size: $1px'>$2</span>",$Text);
|
||||||
|
|
||||||
|
// Check for list text
|
||||||
|
$Text = preg_replace("/\[ul\](.+?)\[\/ul\]/is", '<ul class=\'listbullet\'>$1</ul>' ,$Text);
|
||||||
|
$Text = preg_replace("/\[list\](.+?)\[\/list\]/is", '<ul class=\'listbullet\'>$1</ul>' ,$Text);
|
||||||
|
$Text = preg_replace("/\[list=1\](.+?)\[\/list\]/is", '<ul class=\'listdecimal\'>$1</ul>' ,$Text);
|
||||||
|
$Text = preg_replace("/\[list=i\](.+?)\[\/list\]/s", '<ul class=\'listlowerroman\'>$1</ul>' ,$Text);
|
||||||
|
$Text = preg_replace("/\[list=I\](.+?)\[\/list\]/s", '<ul class=\'listupperroman\'>$1</ul>' ,$Text);
|
||||||
|
$Text = preg_replace("/\[list=a\](.+?)\[\/list\]/s", '<ul class=\'listloweralpha\'>$1</ul>' ,$Text);
|
||||||
|
$Text = preg_replace("/\[list=A\](.+?)\[\/list\]/s", '<ul class=\'listupperalpha\'>$1</ul>' ,$Text);
|
||||||
|
$Text = str_replace("[*]", "<li>", $Text);
|
||||||
|
$Text = preg_replace("/\[li\](.+?)\[\/li\]/s", '<li>$1</li>' ,$Text);
|
||||||
|
|
||||||
|
// Check for font change text
|
||||||
|
$Text = preg_replace("(\[font=(.+?)\](.+?)\[\/font\])","<span style='font-family: $1;'>$2</span>",$Text);
|
||||||
|
|
||||||
|
$Text = preg_replace("(\[code=(.+?)\](.+?)\[\/code])is","<pre>$1 code:<code class=\"$1\">$2</code></pre>",$Text);
|
||||||
|
$Text = preg_replace("(\[code\](.+?)\[\/code])is","<pre>Code:<code class=\"markdown\">$1</code></pre>",$Text);
|
||||||
|
|
||||||
|
$Text = preg_replace("(\[spoiler](.+?)\[\/spoiler])is","<div class='spoiler'><input type='button' value='Spoiler anzeigen' onClick=\"$(this).parent().children('.spoiltext').fadeIn();\"/><div class='spoiltext markdown invisible'>$1</div></div>",$Text);
|
||||||
|
//$Text = preg_replace("(\[b\](.+?)\[\/b])is",'<strong>$1</strong>',$Text);
|
||||||
|
|
||||||
|
// // Declare the format for [code] layout
|
||||||
|
// $CodeLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||||
|
// <tr>
|
||||||
|
// <td class="quotecodeheader"> Code:</td>
|
||||||
|
// </tr>
|
||||||
|
// <tr>
|
||||||
|
// <td class="codebody">$1</td>
|
||||||
|
// </tr>
|
||||||
|
// </table>';
|
||||||
|
// // Check for [code] text
|
||||||
|
// $Text = preg_replace("/\[code\](.+?)\[\/code\]/is","$CodeLayout", $Text);
|
||||||
|
// // Declare the format for [php] layout
|
||||||
|
// $phpLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||||
|
// <tr>
|
||||||
|
// <td class="quotecodeheader"> Code:</td>
|
||||||
|
// </tr>
|
||||||
|
// <tr>
|
||||||
|
// <td class="codebody">$1</td>
|
||||||
|
// </tr>
|
||||||
|
// </table>';
|
||||||
|
// // Check for [php] text
|
||||||
|
// $Text = preg_replace("/\[php\](.+?)\[\/php\]/is",$phpLayout, $Text);
|
||||||
|
|
||||||
|
// Declare the format for [quote] layout
|
||||||
|
$QuoteLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<td class="quotecodeheader"> Quote:</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="quotebody">$1</td>
|
||||||
|
</tr>
|
||||||
|
</table>';
|
||||||
|
|
||||||
|
// Check for [quote] text
|
||||||
|
$Text = preg_replace("/\[quote\](.+?)\[\/quote\]/is", $this->tip('Zitat:')."<code>$1</code>", $Text);
|
||||||
|
$Text = preg_replace("(\[quote\=([$URLSearchString]*)\](.+?)\[/quote\])", $this->tip('Zitat von $1:')."<code>$2</code>", $Text);
|
||||||
|
|
||||||
|
// Images
|
||||||
|
// [img]pathtoimage[/img]
|
||||||
|
$Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src=\'$1\'>', $Text);
|
||||||
|
|
||||||
|
// [img=widthxheight]image source[/img]
|
||||||
|
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src=\'$3\' height=\'$2\' width=\'$1\'>', $Text);
|
||||||
|
|
||||||
|
return $Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProgressBar($percent,$alternatetext="",$width='100%',$id="")
|
||||||
|
{
|
||||||
|
if($percent<0)$percent = 0;
|
||||||
|
if($percent>100)$percent = 100;
|
||||||
|
if(!$alternatetext) $alternatetext = $percent.'%';
|
||||||
|
return '<div width="'.$width.'" class="progressbar_wrapper"><strong style="color:black;float:left;margin-left:50%;margin-top:4px;">'.$alternatetext.'</strong>
|
||||||
|
<div style="width:'.$percent.'%" class="progressbar_progress"></div>
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContentBox($content,$title='',$id='',$class='',$bid='',$collapse=true,$start=0)
|
||||||
|
{
|
||||||
|
$flip = $start?'flip':'';
|
||||||
|
if($collapse)
|
||||||
|
$control = '<a class="contentbox_toggle right '.$flip.'" href="#" onClick="return false;"><img title="Aus/Einfahren" src="/css/imgs/contentBoxenArrow.png" class="flip" /></a>';
|
||||||
|
if($start)
|
||||||
|
$invis = 'invisible';
|
||||||
|
$o = '<div id="'.$bid.'" class="content_box '.$class.'">
|
||||||
|
<div class="content_box_header">'.$control.$title.'</div>
|
||||||
|
<div id="'.$id.'" class="'.$invis.' content_box_content">'.$content.'</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function div($data,$id='',$class='')
|
||||||
|
{
|
||||||
|
return '<div id="'.$id.'" class="'.$class.'">'.$data.'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function select($name,$data=null,$selected=null,$id='')
|
||||||
|
{
|
||||||
|
$o = '<select id="'.$id.'" name="'.$name.'">';
|
||||||
|
if(is_array($data))
|
||||||
|
foreach($data as $key=>$val)
|
||||||
|
{
|
||||||
|
if($selected==$key) $sel = ' selected';
|
||||||
|
else $sel = '';
|
||||||
|
$o.='<option value="'.$key.'" '.$sel.'>'.$val.'</option>';
|
||||||
|
}
|
||||||
|
$o.= '</select>';
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <form onsubmit="doCheck();">
|
||||||
|
* @param type $name
|
||||||
|
* @param type $value
|
||||||
|
* @param type $height
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getWYSIWYGEditor($name,$value='',$height='150px')
|
||||||
|
{
|
||||||
|
$o = '<div class="richeditor">
|
||||||
|
<div class="editbar">
|
||||||
|
<button title="bold" onclick="doClick(\'bold\');" type="button"><b>B</b></button>
|
||||||
|
<button title="italic" onclick="doClick(\'italic\');" type="button"><i>I</i></button>
|
||||||
|
<button title="underline" onclick="doClick(\'underline\');" type="button"><u>U</u></button>
|
||||||
|
<button title="hyperlink" onclick="doLink();" type="button" style="background-image:url(\'/css/imgs/url.gif\');"></button>
|
||||||
|
<button title="image" onclick="doImage();" type="button" style="background-image:url(\'/css/imgs/img.gif\');"></button>
|
||||||
|
<button title="list" onclick="doClick(\'InsertUnorderedList\');" type="button" style="background-image:url(\'/css/imgs/icon_list.gif\');"></button>
|
||||||
|
<button title="color" onclick="showColorGrid2(\'none\')" type="button" style="background-image:url(\'/css/imgs/colors.gif\');"></button><span id="colorpicker201" class="colorpicker201"></span>
|
||||||
|
<button title="quote" onclick="doQuote();" type="button" style="background-image:url(\'/css/imgs/icon_quote.png\');"></button>
|
||||||
|
<button title="switch to source" type="button" onclick="javascript:SwitchEditor()" style="background-image:url(\'/css/imgs/icon_html.gif\');"></button>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<textarea id="'.$name.'" name="'.$name.'" style="height:'.$height.';width:100%;">'.$value.'</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
initEditor("'.$name.'", true);
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
63
classes/image.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Image
|
||||||
|
{
|
||||||
|
function getImage($hash,$size=false)
|
||||||
|
{
|
||||||
|
$path = ROOT.DS.'upload'.DS.$hash.DS;
|
||||||
|
$fullpath = ROOT.DS.'upload'.DS.$hash.DS.$hash;
|
||||||
|
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
$type = $pm->isTypeAllowed($pm->getTypeOfFile($fullpath));
|
||||||
|
|
||||||
|
if(!$type) return false;
|
||||||
|
|
||||||
|
if(is_array($size))
|
||||||
|
{
|
||||||
|
$width = $size[0];
|
||||||
|
$height = $size[1];
|
||||||
|
}
|
||||||
|
else if($size)
|
||||||
|
{
|
||||||
|
$width = $size;
|
||||||
|
$height = $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($width && $height && $type!='gif')
|
||||||
|
$filename = $width.'x'.$height.'_'.$hash;
|
||||||
|
else
|
||||||
|
$filename = $hash;
|
||||||
|
|
||||||
|
if(file_exists($path.$filename))
|
||||||
|
return '/'.$filename;
|
||||||
|
|
||||||
|
|
||||||
|
$thumb = new easyphpthumbnail;
|
||||||
|
if($width==$height)
|
||||||
|
$thumb -> Thumbsize = $width;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$size = getimagesize($fullpath);
|
||||||
|
if(($width/$height)==($size[0]/$size[1]))
|
||||||
|
{
|
||||||
|
$thumb -> Thumbwidth = $width;
|
||||||
|
$thumb -> Thumbheight = $height;
|
||||||
|
}
|
||||||
|
else if($width>$height)
|
||||||
|
$thumb -> Thumbsize = $height;
|
||||||
|
else
|
||||||
|
$thumb -> Thumbsize = $width;
|
||||||
|
//$thumb -> Thumbwidth = $width;
|
||||||
|
//$thumb -> Thumbheight = $height;
|
||||||
|
}
|
||||||
|
$thumb -> Inflate = false;
|
||||||
|
$thumb -> Thumblocation = $path;
|
||||||
|
//$thumb -> Thumbsaveas = $type;
|
||||||
|
$thumb -> Thumbfilename = $filename;
|
||||||
|
$thumb -> Createthumb($fullpath,'file');
|
||||||
|
|
||||||
|
//var_dump($thumb -> Thumblocation.$thumb -> Thumbfilename);
|
||||||
|
|
||||||
|
return '/'.$filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
classes/model.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model class for all models
|
||||||
|
*
|
||||||
|
* @author Christian
|
||||||
|
*/
|
||||||
|
class Model// extends SQLQuery
|
||||||
|
{
|
||||||
|
protected $_model;
|
||||||
|
|
||||||
|
function __construct($id=0)
|
||||||
|
{
|
||||||
|
$this->_model = substr(get_class($this),0,-5);
|
||||||
|
$this->_table = strtolower($this->_model);
|
||||||
|
$this->_id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function __destruct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
1
classes/simpleimage.php
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?php /* * File: SimpleImage.php * Author: Simon Jarvis * Copyright: 2006 Simon Jarvis * Date: 08/11/06 * Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * 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: * http://www.gnu.org/licenses/gpl.html * */ class SimpleImage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } ?> - See more at: http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/#sthash.joVxmPce.h95fwn7M.dpuf
|
||||||
BIN
css/imgs/Thumbs.db
Normal file
BIN
css/imgs/bg.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
css/imgs/content.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
css/imgs/footer.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
css/imgs/header.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
css/imgs/header_empty.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
css/imgs/header_logo.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
css/imgs/hs_logo.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
216
css/main.css
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
/*
|
||||||
|
* HTML5 Boilerplate
|
||||||
|
*
|
||||||
|
* What follows is the result of much research on cross-browser styling.
|
||||||
|
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
|
||||||
|
* Kroc Camen, and the H5BP dev community and team.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Base styles: opinionated defaults
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
html,
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-size: 1em;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #00e;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:visited {
|
||||||
|
color: #551a8b;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #06e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove the gap between images and the bottom of their containers: h5bp.com/i/440
|
||||||
|
*/
|
||||||
|
|
||||||
|
img {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove default fieldset styles.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allow only vertical resizing of textareas.
|
||||||
|
*/
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Author's custom styles
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Helper classes
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/* Prevent callout */
|
||||||
|
|
||||||
|
.nocallout {
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pressed {
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A hack for HTML5 contenteditable attribute on mobile */
|
||||||
|
|
||||||
|
textarea[contenteditable] {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A workaround for S60 3.x and 5.0 devices which do not animated gif images if
|
||||||
|
they have been set as display: none */
|
||||||
|
|
||||||
|
.gifhidden {
|
||||||
|
position: absolute;
|
||||||
|
left: -100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Image replacement
|
||||||
|
*/
|
||||||
|
|
||||||
|
.ir {
|
||||||
|
background-color: transparent;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
border: 0;
|
||||||
|
direction: ltr;
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: left;
|
||||||
|
text-indent: -999em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ir br {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide from both screenreaders and browsers: h5bp.com/u
|
||||||
|
*/
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none !important;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide only visually, but have it available for screenreaders: h5bp.com/v
|
||||||
|
*/
|
||||||
|
|
||||||
|
.visuallyhidden {
|
||||||
|
border: 0;
|
||||||
|
clip: rect(0 0 0 0);
|
||||||
|
height: 1px;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extends the .visuallyhidden class to allow the element to be focusable
|
||||||
|
* when navigated to via the keyboard: h5bp.com/p
|
||||||
|
*/
|
||||||
|
|
||||||
|
.visuallyhidden.focusable:active,
|
||||||
|
.visuallyhidden.focusable:focus {
|
||||||
|
clip: auto;
|
||||||
|
height: auto;
|
||||||
|
margin: 0;
|
||||||
|
overflow: visible;
|
||||||
|
position: static;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide visually and from screenreaders, but maintain layout
|
||||||
|
*/
|
||||||
|
|
||||||
|
.invisible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clearfix helper
|
||||||
|
* Used to contain floats: h5bp.com/q
|
||||||
|
*/
|
||||||
|
|
||||||
|
.clearfix:before,
|
||||||
|
.clearfix:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clearfix:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For IE 6/7 only
|
||||||
|
* Include this rule to trigger hasLayout and contain floats.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.clearfix {
|
||||||
|
*zoom: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
EXAMPLE Media Queries for Responsive Design.
|
||||||
|
Theses examples override the primary ('mobile first') styles.
|
||||||
|
Modify as content requires.
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
@media only screen and (min-width: 800px) {
|
||||||
|
/* Style adjustments for viewports that meet the condition */
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
||||||
|
only screen and (min-resolution: 144dpi) {
|
||||||
|
/* Style adjustments for viewports that meet the condition */
|
||||||
|
}
|
||||||
396
css/normalize.css
vendored
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
/*! normalize.css v2.1.0 | MIT License | git.io/normalize */
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
HTML5 display definitions
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct `block` display not defined in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
article,
|
||||||
|
aside,
|
||||||
|
details,
|
||||||
|
figcaption,
|
||||||
|
figure,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
hgroup,
|
||||||
|
main,
|
||||||
|
nav,
|
||||||
|
section,
|
||||||
|
summary {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct `inline-block` display not defined in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
audio,
|
||||||
|
canvas,
|
||||||
|
video {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent modern browsers from displaying `audio` without controls.
|
||||||
|
* Remove excess height in iOS 5 devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
audio:not([controls]) {
|
||||||
|
display: none;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Base
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Set default font family to sans-serif.
|
||||||
|
* 2. Prevent iOS text size adjust after orientation change, without disabling
|
||||||
|
* user zoom.
|
||||||
|
*/
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: sans-serif; /* 1 */
|
||||||
|
-webkit-text-size-adjust: 100%; /* 2 */
|
||||||
|
-ms-text-size-adjust: 100%; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove default margin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Links
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address `outline` inconsistency between Chrome and other browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a:focus {
|
||||||
|
outline: thin dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Improve readability when focused and also mouse hovered in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
a:active,
|
||||||
|
a:hover {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Typography
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address variable `h1` font-size and margin within `section` and `article`
|
||||||
|
* contexts in Firefox 4+, Safari 5, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
margin: 0.67em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in IE 8/9, Safari 5, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
abbr[title] {
|
||||||
|
border-bottom: 1px dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in Safari 5 and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
dfn {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address differences between Firefox and other browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
hr {
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
box-sizing: content-box;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address styling not present in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
mark {
|
||||||
|
background: #ff0;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct font family set oddly in Safari 5 and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
pre,
|
||||||
|
samp {
|
||||||
|
font-family: monospace, serif;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Improve readability of pre-formatted text in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set consistent quote types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
q {
|
||||||
|
quotes: "\201C" "\201D" "\2018" "\2019";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address inconsistent and variable font size in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Embedded content
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove border when inside `a` element in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
img {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Correct overflow displayed oddly in IE 9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
svg:not(:root) {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Figures
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address margin not present in IE 8/9 and Safari 5.
|
||||||
|
*/
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Forms
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define consistent border, margin, and padding.
|
||||||
|
*/
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: 1px solid #c0c0c0;
|
||||||
|
margin: 0 2px;
|
||||||
|
padding: 0.35em 0.625em 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct `color` not being inherited in IE 8/9.
|
||||||
|
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
||||||
|
*/
|
||||||
|
|
||||||
|
legend {
|
||||||
|
border: 0; /* 1 */
|
||||||
|
padding: 0; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Correct font family not being inherited in all browsers.
|
||||||
|
* 2. Correct font size not being inherited in all browsers.
|
||||||
|
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
font-family: inherit; /* 1 */
|
||||||
|
font-size: 100%; /* 2 */
|
||||||
|
margin: 0; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
|
||||||
|
* the UA stylesheet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
input {
|
||||||
|
line-height: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address inconsistent `text-transform` inheritance for `button` and `select`.
|
||||||
|
* All other form control elements do not inherit `text-transform` values.
|
||||||
|
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
|
||||||
|
* Correct `select` style inheritance in Firefox 4+ and Opera.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
||||||
|
* and `video` controls.
|
||||||
|
* 2. Correct inability to style clickable `input` types in iOS.
|
||||||
|
* 3. Improve usability and consistency of cursor style between image-type
|
||||||
|
* `input` and others.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button,
|
||||||
|
html input[type="button"], /* 1 */
|
||||||
|
input[type="reset"],
|
||||||
|
input[type="submit"] {
|
||||||
|
-webkit-appearance: button; /* 2 */
|
||||||
|
cursor: pointer; /* 3 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-set default cursor for disabled elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button[disabled],
|
||||||
|
html input[disabled] {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Address box sizing set to `content-box` in IE 8/9.
|
||||||
|
* 2. Remove excess padding in IE 8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="checkbox"],
|
||||||
|
input[type="radio"] {
|
||||||
|
box-sizing: border-box; /* 1 */
|
||||||
|
padding: 0; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
|
||||||
|
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
|
||||||
|
* (include `-moz` to future-proof).
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="search"] {
|
||||||
|
-webkit-appearance: textfield; /* 1 */
|
||||||
|
-moz-box-sizing: content-box;
|
||||||
|
-webkit-box-sizing: content-box; /* 2 */
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove inner padding and search cancel button in Safari 5 and Chrome
|
||||||
|
* on OS X.
|
||||||
|
*/
|
||||||
|
|
||||||
|
input[type="search"]::-webkit-search-cancel-button,
|
||||||
|
input[type="search"]::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove inner padding and border in Firefox 4+.
|
||||||
|
*/
|
||||||
|
|
||||||
|
button::-moz-focus-inner,
|
||||||
|
input::-moz-focus-inner {
|
||||||
|
border: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. Remove default vertical scrollbar in IE 8/9.
|
||||||
|
* 2. Improve readability and alignment in all browsers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
overflow: auto; /* 1 */
|
||||||
|
vertical-align: top; /* 2 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Tables
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove most spacing between table cells.
|
||||||
|
*/
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
201
css/pictshare.css
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
* {
|
||||||
|
border:0 none;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
A {
|
||||||
|
color: #74BDDE;
|
||||||
|
text-decoration : underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
BODY{
|
||||||
|
|
||||||
|
text-align:center;
|
||||||
|
z-index: -1;
|
||||||
|
position: absolute;
|
||||||
|
background: url(imgs/bg.png) no-repeat scroll left top;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.input{
|
||||||
|
color: black;
|
||||||
|
background-color: #74BDDE;
|
||||||
|
/*border: 1px solid black;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.red{
|
||||||
|
color:red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.black{
|
||||||
|
color:black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue{
|
||||||
|
color:blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr{
|
||||||
|
border: 0px; /* F<>r Firefox und Opera */
|
||||||
|
border-top: solid 1px #707F90;
|
||||||
|
border-bottom: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#overall {
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
top: 70px;
|
||||||
|
left: 70px;
|
||||||
|
font-family : Calibri, Arial,sans-serif,Tahoma,Georgia,"Times New Roman",serif;
|
||||||
|
color : #74BDDE;
|
||||||
|
width:786px;
|
||||||
|
text-align:left;
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bg{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index:-1;
|
||||||
|
position:absolute;
|
||||||
|
background: white url(imgs/bild.png) no-repeat scroll left top;
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header{
|
||||||
|
background: transparent url(imgs/header_logo.png) no-repeat scroll center top;
|
||||||
|
width: 100%;
|
||||||
|
height: 154px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content{
|
||||||
|
min-height: 400px;
|
||||||
|
background:transparent url(imgs/content.png) repeat-y scroll center top;
|
||||||
|
padding:10px;
|
||||||
|
max-width:100%;
|
||||||
|
max-height: 100%
|
||||||
|
}
|
||||||
|
|
||||||
|
.content
|
||||||
|
{
|
||||||
|
background:transparent url(imgs/content.png) repeat-y scroll center top;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#content li{
|
||||||
|
list-style-type:square;
|
||||||
|
margin-left:20px;
|
||||||
|
padding-bottom:5px;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
#menu {
|
||||||
|
height:36px;
|
||||||
|
/*padding:0 0 0 20px;*/
|
||||||
|
width:100%;
|
||||||
|
background:transparent url(imgs/content.png) repeat-y scroll center top;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu LI {
|
||||||
|
list-style-type:none;
|
||||||
|
text-transform:capitalize;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu LI A, #menu LI A:visited{
|
||||||
|
font-family : Calibri, "Tahoma Bold","Tahoma Fett";
|
||||||
|
font-weight:bold;
|
||||||
|
color:#000;
|
||||||
|
float:left;
|
||||||
|
margin:0;
|
||||||
|
padding:9px;
|
||||||
|
position:relative;
|
||||||
|
text-align:center;
|
||||||
|
text-transform:capitalize;
|
||||||
|
text-decoration : none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
clear:both;
|
||||||
|
height:1px;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
STRONG {
|
||||||
|
color:#74BDDE;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1{
|
||||||
|
/*line-height:0px;*/
|
||||||
|
color: #74BDDE;
|
||||||
|
margin: 3px;
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2{
|
||||||
|
/*line-height:0px;*/
|
||||||
|
color: #74BDDE;
|
||||||
|
margin: 3px;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3{
|
||||||
|
/*line-height:0px;*/
|
||||||
|
color: #74BDDE;
|
||||||
|
margin: 3px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer A {
|
||||||
|
color: #74BDDE;
|
||||||
|
text-decoration : underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer{
|
||||||
|
color: #74BDDE;
|
||||||
|
font-size: 10px;
|
||||||
|
width: 100%;
|
||||||
|
height:29px;
|
||||||
|
background:transparent url(imgs/footer.png) no-repeat scroll center top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error{
|
||||||
|
color: #990033;
|
||||||
|
margin: 3px;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.links{
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mitte{
|
||||||
|
display: block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rechts{
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.kleiner{
|
||||||
|
width: 60%;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small_header {
|
||||||
|
margin-top: 10px;
|
||||||
|
background: #2A507B;
|
||||||
|
/*background:#FFFFFF url(imgs/menu_bg.gif) repeat-x scroll left top;*/
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.minitext{
|
||||||
|
color : #fff;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
165
inc/core.php
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function __autoload($className)
|
||||||
|
{
|
||||||
|
if (file_exists(ROOT . DS . 'models' . DS . strtolower($className) . '.php'))
|
||||||
|
require_once(ROOT . DS . 'models' . DS . strtolower($className) . '.php');
|
||||||
|
if (file_exists(ROOT . DS . 'classes' . DS . strtolower($className) . '.php'))
|
||||||
|
require_once(ROOT . DS . 'classes' . DS . strtolower($className) . '.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
function stripSlashesDeep($value)
|
||||||
|
{
|
||||||
|
$value = is_array($value) ? array_map('stripSlashesDeep', $value) : stripslashes($value);
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeMagicQuotes()
|
||||||
|
{
|
||||||
|
if ( get_magic_quotes_gpc() )
|
||||||
|
{
|
||||||
|
$_GET = stripSlashesDeep($_GET );
|
||||||
|
$_POST = stripSlashesDeep($_POST );
|
||||||
|
$_COOKIE = stripSlashesDeep($_COOKIE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function aasort (&$array, $key)
|
||||||
|
{
|
||||||
|
$sorter=array();
|
||||||
|
$ret=array();
|
||||||
|
reset($array);
|
||||||
|
foreach ($array as $ii => $va) {
|
||||||
|
$sorter[$ii]=$va[$key];
|
||||||
|
}
|
||||||
|
asort($sorter);
|
||||||
|
foreach ($sorter as $ii => $va) {
|
||||||
|
$ret[$ii]=$array[$ii];
|
||||||
|
}
|
||||||
|
$array=$ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function callHook()
|
||||||
|
{
|
||||||
|
global $url;
|
||||||
|
global $default;
|
||||||
|
$urlArray = explode("/",$url);
|
||||||
|
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
|
||||||
|
$u1 = preg_replace("/[^a-zA-Z0-9._]+/", "", $urlArray[0]);
|
||||||
|
$u2 = preg_replace("/[^a-zA-Z0-9._]+/", "", $urlArray[1]);
|
||||||
|
|
||||||
|
if(isImage($u1)) // render the image
|
||||||
|
renderImage($u1);
|
||||||
|
else if($u1=='store' || $u1=='originals') //render also with legacy urls
|
||||||
|
renderImage($u2);
|
||||||
|
else if(isResizedImage($u1,$u2)) // resize and render
|
||||||
|
renderResizedImage($u1,$u2);
|
||||||
|
else if($u1=='thumbs')
|
||||||
|
renderLegacyResized($u2);
|
||||||
|
else if(!$u1)
|
||||||
|
{
|
||||||
|
if($_POST['submit']==$pm->translate(3))
|
||||||
|
$o=$pm->ProcessUploads();
|
||||||
|
else
|
||||||
|
$o.= $pm->renderUploadForm();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
header("HTTP/1.0 404 Not Found");
|
||||||
|
|
||||||
|
|
||||||
|
$vars['content'] = $o;
|
||||||
|
$vars['slogan'] = $pm->translate(2);
|
||||||
|
|
||||||
|
render($vars);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderLegacyResized($path)
|
||||||
|
{
|
||||||
|
|
||||||
|
$a = explode('_',$path);
|
||||||
|
if(count($a)!=2) return false;
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
|
||||||
|
$hash = $a[1];
|
||||||
|
$size = $a[0];
|
||||||
|
|
||||||
|
if(!$pm->hashExists($hash)) return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
renderResizedImage($size,$hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderImage($hash,$file=false)
|
||||||
|
{
|
||||||
|
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
if(!$file) $file = DS.$hash;
|
||||||
|
$path = ROOT.DS.'upload'.DS.$hash.$file;
|
||||||
|
$type = $pm->isTypeAllowed($pm->getTypeOfFile($path));
|
||||||
|
|
||||||
|
if($pm->countResizedImages($hash)>MAX_RESIZED_IMAGES) //if the number of max resized images is reached, just show the real one
|
||||||
|
$path = ROOT.DS.'upload'.DS.$hash.DS.$hash;
|
||||||
|
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'jpg':
|
||||||
|
header ("Content-type: image/jpeg");
|
||||||
|
$im = imagecreatefromjpeg($path);
|
||||||
|
imagejpeg($im);
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
header ("Content-type: image/png");
|
||||||
|
$im = imagecreatefrompng($path);
|
||||||
|
imagepng($im);
|
||||||
|
break;
|
||||||
|
case 'gif':
|
||||||
|
header ("Content-type: image/gif");
|
||||||
|
$im = imagecreatefromgif($path);
|
||||||
|
imagegif($im);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderResizedImage($size,$hash)
|
||||||
|
{
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
$im = new Image();
|
||||||
|
|
||||||
|
if(is_numeric($size))
|
||||||
|
$path = $im->getImage($hash,$size);
|
||||||
|
else
|
||||||
|
$path = $im->getImage($hash,explode('x',$size));
|
||||||
|
|
||||||
|
renderImage($hash,$path);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isImage($hash)
|
||||||
|
{
|
||||||
|
$pm = new PictshareModel();
|
||||||
|
if(!$hash) return false;
|
||||||
|
return $pm->hashExists($hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isResizedImage($resize,$hash)
|
||||||
|
{
|
||||||
|
if(!isImage($hash) || !$resize || !$hash) return false;
|
||||||
|
$a = explode('x',$resize);
|
||||||
|
if(!is_numeric($resize) && count($a)!=2) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function render($variables=null)
|
||||||
|
{
|
||||||
|
if(is_array($variables))
|
||||||
|
extract($variables);
|
||||||
|
include (ROOT . DS . 'template.php');
|
||||||
|
}
|
||||||
21
index.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// shall we log all uploaders IP addresses?
|
||||||
|
define('LOG_UPLOADER', true);
|
||||||
|
|
||||||
|
//how many resizes may one image have?
|
||||||
|
define('MAX_RESIZED_IMAGES',10);
|
||||||
|
|
||||||
|
//don't change stuff beyond this point
|
||||||
|
define('DOMAINPATH',(isset($_SERVER['HTTPS'])?'https':'http').'://'.$_SERVER['HTTP_HOST'].'/');
|
||||||
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
define('ROOT', dirname(__FILE__));
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE);
|
||||||
|
ini_set('display_errors','On');
|
||||||
|
|
||||||
|
include_once(ROOT.DS.'inc'.DS.'core.php');
|
||||||
|
$url = $_GET['url'];
|
||||||
|
removeMagicQuotes();
|
||||||
|
$GLOBALS['params'] = explode('/', $_GET['url']);
|
||||||
|
callHook();
|
||||||
385
js/helper.js
Normal file
@@ -0,0 +1,385 @@
|
|||||||
|
/**
|
||||||
|
* MBP - Mobile boilerplate helper functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(document) {
|
||||||
|
|
||||||
|
window.MBP = window.MBP || {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix for iPhone viewport scale bug
|
||||||
|
* http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]');
|
||||||
|
MBP.ua = navigator.userAgent;
|
||||||
|
|
||||||
|
MBP.scaleFix = function() {
|
||||||
|
if (MBP.viewportmeta && /iPhone|iPad|iPod/.test(MBP.ua) && !/Opera Mini/.test(MBP.ua)) {
|
||||||
|
MBP.viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0';
|
||||||
|
document.addEventListener('gesturestart', MBP.gestureStart, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.gestureStart = function() {
|
||||||
|
MBP.viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized hide address bar for iOS & Android
|
||||||
|
* (c) Scott Jehl, scottjehl.com
|
||||||
|
* MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
// If we split this up into two functions we can reuse
|
||||||
|
// this function if we aren't doing full page reloads.
|
||||||
|
|
||||||
|
// If we cache this we don't need to re-calibrate everytime we call
|
||||||
|
// the hide url bar
|
||||||
|
MBP.BODY_SCROLL_TOP = false;
|
||||||
|
|
||||||
|
// So we don't redefine this function everytime we
|
||||||
|
// we call hideUrlBar
|
||||||
|
MBP.getScrollTop = function() {
|
||||||
|
var win = window;
|
||||||
|
var doc = document;
|
||||||
|
|
||||||
|
return win.pageYOffset || doc.compatMode === 'CSS1Compat' && doc.documentElement.scrollTop || doc.body.scrollTop || 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// It should be up to the mobile
|
||||||
|
MBP.hideUrlBar = function() {
|
||||||
|
var win = window;
|
||||||
|
|
||||||
|
// if there is a hash, or MBP.BODY_SCROLL_TOP hasn't been set yet, wait till that happens
|
||||||
|
if (!location.hash && MBP.BODY_SCROLL_TOP !== false) {
|
||||||
|
win.scrollTo( 0, MBP.BODY_SCROLL_TOP === 1 ? 0 : 1 );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.hideUrlBarOnLoad = function() {
|
||||||
|
var win = window;
|
||||||
|
var doc = win.document;
|
||||||
|
var bodycheck;
|
||||||
|
|
||||||
|
// If there's a hash, or addEventListener is undefined, stop here
|
||||||
|
if ( !location.hash && win.addEventListener ) {
|
||||||
|
|
||||||
|
// scroll to 1
|
||||||
|
window.scrollTo( 0, 1 );
|
||||||
|
MBP.BODY_SCROLL_TOP = 1;
|
||||||
|
|
||||||
|
// reset to 0 on bodyready, if needed
|
||||||
|
bodycheck = setInterval(function() {
|
||||||
|
if ( doc.body ) {
|
||||||
|
clearInterval( bodycheck );
|
||||||
|
MBP.BODY_SCROLL_TOP = MBP.getScrollTop();
|
||||||
|
MBP.hideUrlBar();
|
||||||
|
}
|
||||||
|
}, 15 );
|
||||||
|
|
||||||
|
win.addEventListener('load', function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
// at load, if user hasn't scrolled more than 20 or so...
|
||||||
|
if (MBP.getScrollTop() < 20) {
|
||||||
|
// reset to hide addr bar at onload
|
||||||
|
MBP.hideUrlBar();
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fast Buttons - read wiki below before using
|
||||||
|
* https://github.com/h5bp/mobile-boilerplate/wiki/JavaScript-Helper
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.fastButton = function(element, handler, pressedClass) {
|
||||||
|
this.handler = handler;
|
||||||
|
// styling of .pressed is defined in the project's CSS files
|
||||||
|
this.pressedClass = typeof pressedClass === 'undefined' ? 'pressed' : pressedClass;
|
||||||
|
|
||||||
|
if (element.length && element.length > 1) {
|
||||||
|
for (var singleElIdx in element) {
|
||||||
|
this.addClickEvent(element[singleElIdx]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.addClickEvent(element);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.fastButton.prototype.handleEvent = function(event) {
|
||||||
|
event = event || window.event;
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
case 'touchstart': this.onTouchStart(event); break;
|
||||||
|
case 'touchmove': this.onTouchMove(event); break;
|
||||||
|
case 'touchend': this.onClick(event); break;
|
||||||
|
case 'click': this.onClick(event); break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.fastButton.prototype.onTouchStart = function(event) {
|
||||||
|
var element = event.target || event.srcElement;
|
||||||
|
event.stopPropagation();
|
||||||
|
element.addEventListener('touchend', this, false);
|
||||||
|
document.body.addEventListener('touchmove', this, false);
|
||||||
|
this.startX = event.touches[0].clientX;
|
||||||
|
this.startY = event.touches[0].clientY;
|
||||||
|
|
||||||
|
element.className+= ' ' + this.pressedClass;
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.fastButton.prototype.onTouchMove = function(event) {
|
||||||
|
if (Math.abs(event.touches[0].clientX - this.startX) > 10 ||
|
||||||
|
Math.abs(event.touches[0].clientY - this.startY) > 10) {
|
||||||
|
this.reset(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.fastButton.prototype.onClick = function(event) {
|
||||||
|
event = event || window.event;
|
||||||
|
var element = event.target || event.srcElement;
|
||||||
|
if (event.stopPropagation) {
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
this.reset(event);
|
||||||
|
this.handler.apply(event.currentTarget, [event]);
|
||||||
|
if (event.type == 'touchend') {
|
||||||
|
MBP.preventGhostClick(this.startX, this.startY);
|
||||||
|
}
|
||||||
|
var pattern = new RegExp(' ?' + this.pressedClass, 'gi');
|
||||||
|
element.className = element.className.replace(pattern, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.fastButton.prototype.reset = function(event) {
|
||||||
|
var element = event.target || event.srcElement;
|
||||||
|
rmEvt(element, 'touchend', this, false);
|
||||||
|
rmEvt(document.body, 'touchmove', this, false);
|
||||||
|
|
||||||
|
var pattern = new RegExp(' ?' + this.pressedClass, 'gi');
|
||||||
|
element.className = element.className.replace(pattern, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.fastButton.prototype.addClickEvent = function(element) {
|
||||||
|
addEvt(element, 'touchstart', this, false);
|
||||||
|
addEvt(element, 'click', this, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.preventGhostClick = function(x, y) {
|
||||||
|
MBP.coords.push(x, y);
|
||||||
|
window.setTimeout(function() {
|
||||||
|
MBP.coords.splice(0, 2);
|
||||||
|
}, 2500);
|
||||||
|
};
|
||||||
|
|
||||||
|
MBP.ghostClickHandler = function(event) {
|
||||||
|
if (!MBP.hadTouchEvent && MBP.dodgyAndroid) {
|
||||||
|
// This is a bit of fun for Android 2.3...
|
||||||
|
// If you change window.location via fastButton, a click event will fire
|
||||||
|
// on the new page, as if the events are continuing from the previous page.
|
||||||
|
// We pick that event up here, but MBP.coords is empty, because it's a new page,
|
||||||
|
// so we don't prevent it. Here's we're assuming that click events on touch devices
|
||||||
|
// that occur without a preceding touchStart are to be ignored.
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var i = 0, len = MBP.coords.length; i < len; i += 2) {
|
||||||
|
var x = MBP.coords[i];
|
||||||
|
var y = MBP.coords[i + 1];
|
||||||
|
if (Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// This bug only affects touch Android 2.3 devices, but a simple ontouchstart test creates a false positive on
|
||||||
|
// some Blackberry devices. https://github.com/Modernizr/Modernizr/issues/372
|
||||||
|
// The browser sniffing is to avoid the Blackberry case. Bah
|
||||||
|
MBP.dodgyAndroid = ('ontouchstart' in window) && (navigator.userAgent.indexOf('Android 2.3') != -1);
|
||||||
|
|
||||||
|
if (document.addEventListener) {
|
||||||
|
document.addEventListener('click', MBP.ghostClickHandler, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
addEvt(document.documentElement, 'touchstart', function() {
|
||||||
|
MBP.hadTouchEvent = true;
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
MBP.coords = [];
|
||||||
|
|
||||||
|
// fn arg can be an object or a function, thanks to handleEvent
|
||||||
|
// read more about the explanation at: http://www.thecssninja.com/javascript/handleevent
|
||||||
|
function addEvt(el, evt, fn, bubble) {
|
||||||
|
if ('addEventListener' in el) {
|
||||||
|
// BBOS6 doesn't support handleEvent, catch and polyfill
|
||||||
|
try {
|
||||||
|
el.addEventListener(evt, fn, bubble);
|
||||||
|
} catch(e) {
|
||||||
|
if (typeof fn == 'object' && fn.handleEvent) {
|
||||||
|
el.addEventListener(evt, function(e){
|
||||||
|
// Bind fn as this and set first arg as event object
|
||||||
|
fn.handleEvent.call(fn,e);
|
||||||
|
}, bubble);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ('attachEvent' in el) {
|
||||||
|
// check if the callback is an object and contains handleEvent
|
||||||
|
if (typeof fn == 'object' && fn.handleEvent) {
|
||||||
|
el.attachEvent('on' + evt, function(){
|
||||||
|
// Bind fn as this
|
||||||
|
fn.handleEvent.call(fn);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
el.attachEvent('on' + evt, fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function rmEvt(el, evt, fn, bubble) {
|
||||||
|
if ('removeEventListener' in el) {
|
||||||
|
// BBOS6 doesn't support handleEvent, catch and polyfill
|
||||||
|
try {
|
||||||
|
el.removeEventListener(evt, fn, bubble);
|
||||||
|
} catch(e) {
|
||||||
|
if (typeof fn == 'object' && fn.handleEvent) {
|
||||||
|
el.removeEventListener(evt, function(e){
|
||||||
|
// Bind fn as this and set first arg as event object
|
||||||
|
fn.handleEvent.call(fn,e);
|
||||||
|
}, bubble);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ('detachEvent' in el) {
|
||||||
|
// check if the callback is an object and contains handleEvent
|
||||||
|
if (typeof fn == 'object' && fn.handleEvent) {
|
||||||
|
el.detachEvent("on" + evt, function() {
|
||||||
|
// Bind fn as this
|
||||||
|
fn.handleEvent.call(fn);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
el.detachEvent('on' + evt, fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Autogrow
|
||||||
|
* http://googlecode.blogspot.com/2009/07/gmail-for-mobile-html5-series.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.autogrow = function(element, lh) {
|
||||||
|
function handler(e) {
|
||||||
|
var newHeight = this.scrollHeight;
|
||||||
|
var currentHeight = this.clientHeight;
|
||||||
|
if (newHeight > currentHeight) {
|
||||||
|
this.style.height = newHeight + 3 * textLineHeight + 'px';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var setLineHeight = (lh) ? lh : 12;
|
||||||
|
var textLineHeight = element.currentStyle ? element.currentStyle.lineHeight : getComputedStyle(element, null).lineHeight;
|
||||||
|
|
||||||
|
textLineHeight = (textLineHeight.indexOf('px') == -1) ? setLineHeight : parseInt(textLineHeight, 10);
|
||||||
|
|
||||||
|
element.style.overflow = 'hidden';
|
||||||
|
element.addEventListener ? element.addEventListener('input', handler, false) : element.attachEvent('onpropertychange', handler);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable CSS active pseudo styles in Mobile Safari
|
||||||
|
* http://alxgbsn.co.uk/2011/10/17/enable-css-active-pseudo-styles-in-mobile-safari/
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.enableActive = function() {
|
||||||
|
document.addEventListener('touchstart', function() {}, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent default scrolling on document window
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.preventScrolling = function() {
|
||||||
|
document.addEventListener('touchmove', function(e) {
|
||||||
|
if (e.target.type === 'range') { return; }
|
||||||
|
e.preventDefault();
|
||||||
|
}, false);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent iOS from zooming onfocus
|
||||||
|
* https://github.com/h5bp/mobile-boilerplate/pull/108
|
||||||
|
* Adapted from original jQuery code here: http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.preventZoom = function() {
|
||||||
|
var formFields = document.querySelectorAll('input, select, textarea');
|
||||||
|
var contentString = 'width=device-width,initial-scale=1,maximum-scale=';
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < formFields.length; i++) {
|
||||||
|
formFields[i].onfocus = function() {
|
||||||
|
MBP.viewportmeta.content = contentString + '1';
|
||||||
|
};
|
||||||
|
formFields[i].onblur = function() {
|
||||||
|
MBP.viewportmeta.content = contentString + '10';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iOS Startup Image helper
|
||||||
|
*/
|
||||||
|
|
||||||
|
MBP.startupImage = function() {
|
||||||
|
var portrait;
|
||||||
|
var landscape;
|
||||||
|
var pixelRatio;
|
||||||
|
var head;
|
||||||
|
var link1;
|
||||||
|
var link2;
|
||||||
|
|
||||||
|
pixelRatio = window.devicePixelRatio;
|
||||||
|
head = document.getElementsByTagName('head')[0];
|
||||||
|
|
||||||
|
if (navigator.platform === 'iPad') {
|
||||||
|
portrait = pixelRatio === 2 ? 'img/startup/startup-tablet-portrait-retina.png' : 'img/startup/startup-tablet-portrait.png';
|
||||||
|
landscape = pixelRatio === 2 ? 'img/startup/startup-tablet-landscape-retina.png' : 'img/startup/startup-tablet-landscape.png';
|
||||||
|
|
||||||
|
link1 = document.createElement('link');
|
||||||
|
link1.setAttribute('rel', 'apple-touch-startup-image');
|
||||||
|
link1.setAttribute('media', 'screen and (orientation: portrait)');
|
||||||
|
link1.setAttribute('href', portrait);
|
||||||
|
head.appendChild(link1);
|
||||||
|
|
||||||
|
link2 = document.createElement('link');
|
||||||
|
link2.setAttribute('rel', 'apple-touch-startup-image');
|
||||||
|
link2.setAttribute('media', 'screen and (orientation: landscape)');
|
||||||
|
link2.setAttribute('href', landscape);
|
||||||
|
head.appendChild(link2);
|
||||||
|
} else {
|
||||||
|
portrait = pixelRatio === 2 ? "img/startup/startup-retina.png" : "img/startup/startup.png";
|
||||||
|
portrait = screen.height === 568 ? "img/startup/startup-retina-4in.png" : portrait;
|
||||||
|
link1 = document.createElement('link');
|
||||||
|
link1.setAttribute('rel', 'apple-touch-startup-image');
|
||||||
|
link1.setAttribute('href', portrait);
|
||||||
|
head.appendChild(link1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//hack to fix letterboxed full screen web apps on 4" iPhone / iPod
|
||||||
|
if ((navigator.platform === 'iPhone' || 'iPod') && (screen.height === 568)) {
|
||||||
|
if (MBP.viewportmeta) {
|
||||||
|
MBP.viewportmeta.content = MBP.viewportmeta.content
|
||||||
|
.replace(/\bwidth\s*=\s*320\b/, 'width=320.1')
|
||||||
|
.replace(/\bwidth\s*=\s*device-width\b/, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})(document);
|
||||||
4
js/jquery-2.1.0.min.js
vendored
Normal file
0
js/main.js
Normal file
24
js/plugins.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// Avoid `console` errors in browsers that lack a console.
|
||||||
|
(function() {
|
||||||
|
var method;
|
||||||
|
var noop = function noop() {};
|
||||||
|
var methods = [
|
||||||
|
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
|
||||||
|
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
|
||||||
|
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
|
||||||
|
'timeStamp', 'trace', 'warn'
|
||||||
|
];
|
||||||
|
var length = methods.length;
|
||||||
|
var console = (window.console = window.console || {});
|
||||||
|
|
||||||
|
while (length--) {
|
||||||
|
method = methods[length];
|
||||||
|
|
||||||
|
// Only stub undefined methods.
|
||||||
|
if (!console[method]) {
|
||||||
|
console[method] = noop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}());
|
||||||
|
|
||||||
|
// Place any Zepto/helper plugins in here.
|
||||||
4
js/vendor/modernizr-2.6.2.min.js
vendored
Normal file
2
js/vendor/zepto.min.js
vendored
Normal file
482
models/pictsharemodel.php
Normal file
@@ -0,0 +1,482 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class PictshareModel extends Model
|
||||||
|
{
|
||||||
|
function backend($params)
|
||||||
|
{
|
||||||
|
return array('status'=>'ok');
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderUploadForm()
|
||||||
|
{
|
||||||
|
$maxfilesize = (int)(ini_get('upload_max_filesize'));
|
||||||
|
return '
|
||||||
|
<div class="clear"></div>
|
||||||
|
<strong>'.$this->translate(0).': '.$maxfilesize.'MB / File</strong><br>
|
||||||
|
<strong>'.$this->translate(1).'</strong>
|
||||||
|
<br><br>
|
||||||
|
<FORM enctype="multipart/form-data" method="post">
|
||||||
|
<div id="formular">
|
||||||
|
<strong>'.$this->translate(4).': </strong><input class="input" type="file" name="pic[]" multiple><div class="clear"></div>
|
||||||
|
<div class="clear"></div><br>
|
||||||
|
</div>
|
||||||
|
<INPUT style="font-size:15px;font-weight:bold;background-color:#74BDDE;padding:3px;" type="submit" id="submit" name="submit" value="'.$this->translate(3).'">
|
||||||
|
</FORM>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNewHash($type,$length=10)
|
||||||
|
{
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
$hash = substr(md5(time().$type.rand(1,1000000).microtime()),0,$length).'.'.$type;
|
||||||
|
if(!$this->hashExists($hash)) return $hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hashExists($hash)
|
||||||
|
{
|
||||||
|
return is_dir(ROOT.DS.'upload'.DS.$hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
function countResizedImages($hash)
|
||||||
|
{
|
||||||
|
$fi = new FilesystemIterator(ROOT.DS.'upload'.DS.$hash.DS, FilesystemIterator::SKIP_DOTS);
|
||||||
|
return iterator_count($fi);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTypeOfFile($url)
|
||||||
|
{
|
||||||
|
$fi = new finfo(FILEINFO_MIME);
|
||||||
|
$type = $fi->buffer(file_get_contents($url));
|
||||||
|
|
||||||
|
$arr = explode(';', trim($type));
|
||||||
|
if(count($arr)>1)
|
||||||
|
{
|
||||||
|
$a2 = explode('/', $arr[0]);
|
||||||
|
return $a2[1];
|
||||||
|
}
|
||||||
|
$a2 = explode('/', $type);
|
||||||
|
return $a2[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
function isTypeAllowed($type)
|
||||||
|
{
|
||||||
|
switch($type)
|
||||||
|
{
|
||||||
|
case 'x-png': return 'png';
|
||||||
|
case 'png': return 'png';
|
||||||
|
case 'jpeg': return 'jpg';
|
||||||
|
case 'pjpeg': return 'jpg';
|
||||||
|
case 'gif': return 'gif';
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function uploadImageFromURL($url)
|
||||||
|
{
|
||||||
|
$type = $this->getTypeOfFile($url);
|
||||||
|
$type = $this->isTypeAllowed($type);
|
||||||
|
if(!$type)
|
||||||
|
return array('status'=>'ERR','reason'=>'wrong filetype');
|
||||||
|
$hash = $this->getNewHash($type);
|
||||||
|
mkdir(ROOT.DS.'upload'.DS.$hash);
|
||||||
|
$file = ROOT.DS.'upload'.DS.$hash.DS.$hash;
|
||||||
|
$status = file_put_contents($file, file_get_contents($url));
|
||||||
|
|
||||||
|
//remove all exif data from jpeg
|
||||||
|
if($type=='jpg')
|
||||||
|
{
|
||||||
|
$res = imagecreatefromjpeg($file);
|
||||||
|
imagejpeg($res, $file, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LOG_UPLOADER)
|
||||||
|
{
|
||||||
|
$fh = fopen(ROOT.DS.'upload'.DS.'uploads.txt', 'a');
|
||||||
|
fwrite($fh, time().';'.$url.';'.$hash.';'.$_SERVER['REMOTE_ADDR']."\n");
|
||||||
|
fclose($fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('status'=>'OK','type'=>$type,'hash'=>$hash,'url'=>DOMAINPATH.$hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ProcessUploads()
|
||||||
|
{
|
||||||
|
$im = new Image();
|
||||||
|
$i = 0;
|
||||||
|
foreach ($_FILES["pic"]["error"] as $key => $error)
|
||||||
|
{
|
||||||
|
if ($error == UPLOAD_ERR_OK)
|
||||||
|
{
|
||||||
|
$dup_id = $this->isDuplicate($_FILES["pic"]["tmp_name"][$key]);
|
||||||
|
if(!$dup_id)
|
||||||
|
{
|
||||||
|
$data = $this->uploadImageFromURL($_FILES["pic"]["tmp_name"][$key],false);
|
||||||
|
if($data['hash'])
|
||||||
|
$this->saveSHAOfFile($_FILES["pic"]["tmp_name"][$key],$data['hash']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$data = array('hash'=>$dup_id,'status'=>'OK');
|
||||||
|
|
||||||
|
if($data['status']=='OK')
|
||||||
|
{
|
||||||
|
$o.= '<h2>'.$this->translate(4).' '.++$i.'</h2><a target="_blank" href="'.DOMAINPATH.$data['hash'].'"><img src="'.DOMAINPATH.'300/'.$data['hash'].'" /></a><br/>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$html = new HTML();
|
||||||
|
//if($i==1)$html->goToLocation('/i/info/'.$data['hash']);
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveSHAOfFile($filepath,$hash)
|
||||||
|
{
|
||||||
|
$sha_file = ROOT.DS.'upload'.DS.'hashes.csv';
|
||||||
|
$sha = sha1_file($filepath);
|
||||||
|
$fp = fopen($sha_file,'a');
|
||||||
|
fwrite($fp,"$sha;$hash\n");
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDuplicate($file)
|
||||||
|
{
|
||||||
|
$sha_file = ROOT.DS.'upload'.DS.'hashes.csv';
|
||||||
|
$sha = sha1_file($file);
|
||||||
|
if(!file_exists($sha_file)) return false;
|
||||||
|
$fp = fopen($sha_file,'r');
|
||||||
|
while (($line = fgets($fp)) !== false)
|
||||||
|
{
|
||||||
|
$line = trim($line);
|
||||||
|
if(!$line) contine;
|
||||||
|
$sha_upload = substr($line,0,40);
|
||||||
|
if($sha_upload==$sha) //when it's a duplicate return the hash of the original file
|
||||||
|
{
|
||||||
|
fclose($fp);
|
||||||
|
return substr($line,41);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetPictureDimensions($bildname)
|
||||||
|
{
|
||||||
|
$size = getimagesize($bildname);
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
function translate($index,$params="")
|
||||||
|
{
|
||||||
|
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
||||||
|
//$lang = 'en';
|
||||||
|
switch ($lang){
|
||||||
|
case "de":
|
||||||
|
$words[0] = 'Maximale Dateigröße';
|
||||||
|
$words[1] = 'Es können auch mehrere Bilder auf einmal ausgewählt werden!';
|
||||||
|
$words[2] = 'einfach, gratis, genial';
|
||||||
|
$words[3] = 'Foto hinaufladen';
|
||||||
|
$words[4] = 'Bild';
|
||||||
|
$words[5] = 'Die Datei '.$params[0].' kann nicht hinaufgeladen werden, da der Dateityp "'.$params[1].'" nicht unterstützt wird.';
|
||||||
|
$words[6] = 'Fehler beim Upload von '.$params;
|
||||||
|
$words[7] = 'Bild "'.$params.'"" wurde erfolgreich hochgeladen';
|
||||||
|
$words[8] = 'Skaliert auf';
|
||||||
|
$words[9] = 'Kleinansicht';
|
||||||
|
$words[10] = 'für Verlinkungen und Miniaturvorschau in Foren';
|
||||||
|
$words[11] = 'Allgemeiner Fehler';
|
||||||
|
$words[12] = 'Fehler 404 - nicht gefunden';
|
||||||
|
$words[13] = 'Fehler 403 - nicht erlaubt';
|
||||||
|
$words[14] = 'Kein refferer';
|
||||||
|
$words[15] = 'Verlinkte Seiten';
|
||||||
|
$words[16] = 'Hinweis: Zugriffe über pictshare.net werden nicht gerechnet';
|
||||||
|
$words[17] = 'Dieses Bild wurde '.$params[0].' mal von '.$params[1].' verschiedenen IPs gesehen und hat '.$params[2].' Traffic verursacht';
|
||||||
|
$words[18] = 'Dieses Bild wurde von folgenden Ländern aufgerufen: ';
|
||||||
|
$words[19] = $params[0].' Aufrufe aus '.$params[1];
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$words[0] = 'Max filesize';
|
||||||
|
$words[1] = 'You can select multiple pictures at once!';
|
||||||
|
$words[2] = 'easy, free, engenious';
|
||||||
|
$words[3] = 'Upload';
|
||||||
|
$words[4] = 'Picture';
|
||||||
|
$words[5] = 'The file '.$params[0].' can\'t be uploaded since the filetype "'.$params[1].'" is not supported.';
|
||||||
|
$words[6] = 'Error uploading '.$params;
|
||||||
|
$words[7] = 'Picture "'.$params.'"" was uploaded successfully';
|
||||||
|
$words[8] = 'Scaled to';
|
||||||
|
$words[9] = 'Thumbnail';
|
||||||
|
$words[10] = 'for pasting in Forums, etc..';
|
||||||
|
$words[11] = 'Unspecified error';
|
||||||
|
$words[12] = 'Error 404 - not found';
|
||||||
|
$words[13] = 'Error 403 - not allowed';
|
||||||
|
$words[14] = 'No referrer';
|
||||||
|
$words[15] = 'Linked sites';
|
||||||
|
$words[16] = 'Note: Views from pictshare.net will not be counted';
|
||||||
|
$words[17] = 'Was seen '.$params[0].' times by '.$params[1].' unique IPs and produced '.$params[2].' traffic';
|
||||||
|
$words[18] = 'This picture was seen from the following countries: ';
|
||||||
|
$words[19] = $params[0].' views from '.$params[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $words[$index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function AddWatermark($bildname,$type)
|
||||||
|
{
|
||||||
|
$watermark = imagecreatefrompng('inc/wasserzeichen.png');
|
||||||
|
$watermark_width = imagesx($watermark);
|
||||||
|
$watermark_height = imagesy($watermark);
|
||||||
|
|
||||||
|
if($type=='image/png' ||$type == 'png')
|
||||||
|
$image = imagecreatefrompng($bildname);
|
||||||
|
else if($type=='image/jpeg' ||$type == 'jpg')
|
||||||
|
$image = imagecreatefromjpeg($bildname);
|
||||||
|
else if($type=='image/gif' ||$type == 'gif')
|
||||||
|
$image = imagecreatefromgif($bildname);
|
||||||
|
else exit("Dateityp nicht erkannt");
|
||||||
|
|
||||||
|
$size = getimagesize($bildname);
|
||||||
|
$dest_x = $size[0] - $watermark_width - 5;
|
||||||
|
$dest_y = $size[1] - $watermark_height - 5;
|
||||||
|
|
||||||
|
imagesavealpha($watermark,true);
|
||||||
|
|
||||||
|
//imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
|
||||||
|
imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);
|
||||||
|
|
||||||
|
//$black = imagecolorallocate($image, 0, 0, 0);
|
||||||
|
//imagecolortransparent($image, $black);
|
||||||
|
|
||||||
|
imagesavealpha($image,true);
|
||||||
|
|
||||||
|
if($type=='image/png'|| $type == 'png')
|
||||||
|
imagepng($image,$bildname,5);
|
||||||
|
else if($type=='image/jpeg'|| $type == 'jpg')
|
||||||
|
imagejpeg($image,$bildname,100);
|
||||||
|
else if($type=='image/gif'|| $type == 'gif')
|
||||||
|
imagegif($image,$bildname);
|
||||||
|
}
|
||||||
|
|
||||||
|
function BildResize($filename,$max_hoehe,$max_breite,$output)
|
||||||
|
{
|
||||||
|
$image = new Imagick($filename);
|
||||||
|
$image->adaptiveResizeImage($max_hoehe,$max_breite);
|
||||||
|
$im->imageWriteFile (fopen ($output, "wb"));
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
///////////////////////////
|
||||||
|
|
||||||
|
// Set a maximum height and width
|
||||||
|
$width = $max_breite;
|
||||||
|
$height = $max_hoehe;
|
||||||
|
|
||||||
|
// Get new dimensions
|
||||||
|
list($width_orig, $height_orig) = getimagesize($filename);
|
||||||
|
$size = getimagesize($filename);
|
||||||
|
$ratio_orig = $width_orig/$height_orig;
|
||||||
|
if($width_orig < $width && $height_orig < $height)
|
||||||
|
{
|
||||||
|
$width = $width_orig;
|
||||||
|
$height = $height_orig;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($width/$height > $ratio_orig)
|
||||||
|
$width = $height*$ratio_orig;
|
||||||
|
else
|
||||||
|
$height = $width/$ratio_orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resample
|
||||||
|
$image_p = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
|
if($size['mime']=='image/jpeg')
|
||||||
|
$image = imagecreatefromjpeg($filename);
|
||||||
|
else if($size['mime']=='image/png')
|
||||||
|
$image = imagecreatefrompng($filename);
|
||||||
|
else if($size['mime']=='image/gif')
|
||||||
|
$image = imagecreatefromgif($filename);
|
||||||
|
else if($size['mime']=='image/bmp')
|
||||||
|
$image = imagecreatefromwbmp($filename);
|
||||||
|
else exit('Bildart nicht unterstützt');
|
||||||
|
|
||||||
|
imagesavealpha($image,true);
|
||||||
|
|
||||||
|
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
|
||||||
|
|
||||||
|
// Output
|
||||||
|
$file = $output;
|
||||||
|
|
||||||
|
imagesavealpha($image_p,true);
|
||||||
|
|
||||||
|
if($size['mime']=='image/jpeg')
|
||||||
|
imagejpeg($image_p, $file, 100);
|
||||||
|
else if($size['mime']=='image/png')
|
||||||
|
imagepng($image_p, $file, 5);
|
||||||
|
else if($size['mime']=='image/gif')
|
||||||
|
imagegif($image_p, $file);
|
||||||
|
//else if($size['mime']=='image/bmp')
|
||||||
|
//$image = imagecreatefromwbmp($filename);
|
||||||
|
else exit('Bildart nicht unterstützt');
|
||||||
|
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUniqueIPs($hash,$type)
|
||||||
|
{
|
||||||
|
$db = new SQLite3("pictures.db");
|
||||||
|
$results = $db->query("SELECT DISTINCT(ip) FROM views WHERE hash = '$hash' OR hash = '$hash.$type'");
|
||||||
|
$i = 0;
|
||||||
|
while ($row = $results->fetchArray())
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderGraphOfImage($hash,$type)
|
||||||
|
{
|
||||||
|
$db = new SQLite3("pictures.db");
|
||||||
|
$results = $db->query("SELECT * FROM views WHERE hash = '$hash' OR hash = '$hash.$type' ORDER BY time ASC");
|
||||||
|
$first = false;
|
||||||
|
$count = 0;
|
||||||
|
while ($row = $results->fetchArray())
|
||||||
|
{
|
||||||
|
$count++;
|
||||||
|
$index = floor(($row['time']+7200)/3600);
|
||||||
|
if(!$first)
|
||||||
|
$first = $index;
|
||||||
|
$data[$index]++;
|
||||||
|
$ref = $row['referrer'];
|
||||||
|
if($ref=='-')
|
||||||
|
$a[2] = $this->translate(14);
|
||||||
|
else
|
||||||
|
$a = explode('/', $ref);
|
||||||
|
$domains[$a[2]]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$count) return;
|
||||||
|
|
||||||
|
$lasttime = $first*3600;
|
||||||
|
|
||||||
|
foreach ($domains as $dom => $count)
|
||||||
|
{
|
||||||
|
$doms[] = "['$dom', $count]";
|
||||||
|
}
|
||||||
|
$doms = implode(',', $doms);
|
||||||
|
|
||||||
|
foreach($data as $time=>$count)
|
||||||
|
{
|
||||||
|
$time *=3600;
|
||||||
|
$difh = (($time-$lasttime)/3600)-1;
|
||||||
|
if($difh>0)
|
||||||
|
for($i=0;$i<$difh;$i++)
|
||||||
|
$d[] = '['.(($lasttime+(($i+1)*3600))*1000).', 0]';
|
||||||
|
$d[] = '['.($time*1000).', '.$count.']';
|
||||||
|
$lasttime = $time;
|
||||||
|
}
|
||||||
|
array_pop($d);
|
||||||
|
$d = implode(',', $d);
|
||||||
|
|
||||||
|
$o = "$(function () {
|
||||||
|
$('#container').highcharts({
|
||||||
|
chart: {
|
||||||
|
zoomType: 'x',
|
||||||
|
type: 'spline'
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Views of this image compared to time'
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'datetime',
|
||||||
|
maxZoom: 3600000,
|
||||||
|
title: {
|
||||||
|
text: null
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
title: {
|
||||||
|
text: 'Views / Hour'
|
||||||
|
},
|
||||||
|
min: 0
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
crosshairs: true,
|
||||||
|
|
||||||
|
pointFormat: '<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b><br/>',
|
||||||
|
|
||||||
|
},
|
||||||
|
plotOptions: {
|
||||||
|
spline: {
|
||||||
|
lineWidth: 4,
|
||||||
|
states: {
|
||||||
|
hover: {
|
||||||
|
lineWidth: 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
marker: {
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: 'Views',
|
||||||
|
data: [$d]
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
var chart;
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
// Build the chart
|
||||||
|
$('#pie').highcharts({
|
||||||
|
chart: {
|
||||||
|
plotBackgroundColor: null,
|
||||||
|
plotBorderWidth: null,
|
||||||
|
plotShadow: false
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Referring sites'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
pointFormat: '{series.name}: <b>{point.y} = {point.percentage:.2f}%</b>'
|
||||||
|
},
|
||||||
|
plotOptions: {
|
||||||
|
pie: {
|
||||||
|
allowPointSelect: true,
|
||||||
|
cursor: 'pointer',
|
||||||
|
dataLabels: {
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
showInLegend: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
type: 'pie',
|
||||||
|
name: '".$this->translate(15)."',
|
||||||
|
data: [
|
||||||
|
$doms
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});";
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
42
template.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--[if IEMobile 7 ]> <html class="no-js iem7"> <![endif]-->
|
||||||
|
<!--[if (gt IEMobile 7)|!(IEMobile)]><!--> <html class="no-js"> <!--<![endif]-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title><?php echo $title; ?></title>
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="HandheldFriendly" content="True">
|
||||||
|
<meta name="MobileOptimized" content="320">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta http-equiv="cleartype" content="on">
|
||||||
|
<?php echo $meta; ?>
|
||||||
|
<link rel="stylesheet" href="/css/normalize.css">
|
||||||
|
<link rel="stylesheet" href="/css/pictshare.css">
|
||||||
|
<script src="/js/vendor/modernizr-2.6.2.min.js"></script>
|
||||||
|
<!--<script src="/js/highslide-full.js"></script>-->
|
||||||
|
<script type="text/javascript" src="/js/jquery-2.1.0.min.js"></script>
|
||||||
|
<TITLE>PictShare - Free picture hosting</TITLE>
|
||||||
|
|
||||||
|
<meta name="description" content="Free picture sharing, linking and tracking">
|
||||||
|
<meta name="keywords" content="picture, share, hosting, free">
|
||||||
|
<meta name="robots" content="index, follow">
|
||||||
|
<meta name="copyright" content="Haschek Solutions">
|
||||||
|
<meta name="language" content="EN,DE">
|
||||||
|
<meta name="author" content="Haschek Solutions">
|
||||||
|
<meta name="distribution" content="global">
|
||||||
|
<meta name="rating" content="general">
|
||||||
|
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
<div class="mitte" id="overall">
|
||||||
|
<a href="/"><div id="header">
|
||||||
|
<div style="padding:15px;"><div class="rechts"><?php echo $slogan; ?></div></div>
|
||||||
|
</div></a>
|
||||||
|
<div id="content">
|
||||||
|
<?php echo $content?>
|
||||||
|
</div>
|
||||||
|
<div class="content"><center>(c)<?php echo date("y");?> by<br/><a href="http://haschek-solutions.com" target="_blank"><img height="30" src="/css/imgs/hs_logo.png" /></a></center></div>
|
||||||
|
<div id="footer"></div>
|
||||||
|
</div>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||