include($_SERVER['DOCUMENT_ROOT']."/.data/sql-head.php");
$dbc = my_connect();
$langs=array("de","en","ja");
if ($_SERVER['HTTP_HOST']=="en.j-dorama.de")
$mylang="en";
else if ($_SERVER['HTTP_HOST']=="ja.j-dorama.de")
$mylang="ja";
else
$mylang="de";
if (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)=="ja" && $_SERVER['HTTP_REFERER']!="" && substr($_SERVER['HTTP_REFERER'],0,21)!="http://ja.j-dorama.de" && substr($_SERVER['HTTP_REFERER'],0,22)!="http://www.j-dorama.de" && substr($_SERVER['HTTP_REFERER'],0,21)!="http://en.j-dorama.de" && $mylang!="ja") {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://ja.j-dorama.de".$_SERVER['REQUEST_URI']);
exit(0);
} else {
if (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)!="de" && (substr($_SERVER['HTTP_REFERER'],0,23)=="http://www.facebook.com" || substr($_SERVER['HTTP_REFERER'],0,21)=="http://m.facebook.com") && $mylang=="de") {
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://en.j-dorama.de".$_SERVER['REQUEST_URI']);
exit(0);
}
}
require($_SERVER['DOCUMENT_ROOT']."/.data/login-functions.php");
$linktranslate = array (
" "=>"-",
"."=>"",
","=>"",
"~"=>"-",
"("=>"",
")"=>"",
"&"=>"",
"!"=>"",
"'"=>"",
"?"=>"",
":"=>"",
"%"=>""
);
include("$mylang.tr");
if ($_SERVER['HTTP_HOST']=="test.j-dorama.de")
$imgdir="http://test-img.j-dorama.de";
else
$imgdir="http://img.j-dorama.de";
function br2nl($string) {
return preg_replace('/
]*>/i',"",$string);
}
function show_loginform($jmp) {
global $tr;
?>
echo $tr["lost_password"];?> echo $tr["register"];?>
}
function trans($lang,$word) {
include("$lang.tr");
return $tr[$word];
}
function transall($word) {
global $langs;
foreach ($langs as $lang) {
include ("$lang.tr");
$result["$lang"]=$tr["$word"];
}
return $result;
}
function notransall($word) {
global $langs;
foreach ($langs as $lang) {
$result["$lang"]=$word;
}
return $result;
}
function transadd($arr, $word) {
global $langs;
foreach ($langs as $lang) {
$result["$lang"]=$arr["$lang"].$word;
}
return $result;
}
function addtrans($word,$arr) {
global $langs;
foreach ($langs as $lang) {
$result["$lang"]=$word.$arr["$lang"];
}
return $result;
}
function transjoin($arr1, $sep, $arr2) {
global $langs;
foreach ($langs as $lang) {
$result["$lang"]=$arr1["$lang"].$sep.$arr2["$lang"];
}
return $result;
}
function Pages($ab, $prefix, $postfix, $total, $next) {
global $tr;
echo $tr["page"].": ";
if ($ab>0) {
$nab=$ab-20;
if ($nab<0) $nab=0;
echo "< ";
}
$i=1;
while($total>0) {
$seite=($i-1)*20;
if ($seite!=$ab) {
echo "$i ";
} else {
echo "$i ";
}
$total=$total-20;
$i++;
}
if ($next==1) {
$nab=$ab+20;
echo ">";
}
}
function BildTable($result,$linkprefix, $linkpostfix, $bildprefix,$grenze,$altattr) {
global $imgdir,$linktranslate,$mylang,$tr;
if (($mylang=="ja") && ($linkprefix=="/d/")) {
$tableext=" cellspacing=\"0\" cellpadding=\"0\" style=\"border-width:1px;border-style:dashed;border-color:#FF0000;\"";
$tdext=" style=\"border-width:1px;border-style:dashed;border-color:#FF0000;\"";
}
echo "\n";
$i=0;
while (($res=$result->fetch()) && (($grenze==0) || ($i<$grenze))) {
if (($i%2)==0) echo "\n";
$alt="";
foreach ($altattr as $alter)
$alt.=" $res[$alter]";
$alt = trim($alt);
$linktext = "$res[attr_1]".(isset($res[attr_1])?"
":"")."$res[attr_2]";
$linktext .= (isset($res[attr_3]))?"
$res[attr_3]":"";
$linktext .= (isset($res[attr_4]))?"
$res[attr_4]":"";
$linkname=strtr(strtolower($res[attr_2]),$linktranslate);
if (($mylang=="ja") && ($linkprefix=="/d/"))
echo "$linktext | \n";
else
echo " | \n$linktext | \n";
$i++;
if (($i%2)==0) echo "
\n";
if ($i==$grenze && ($result->fetch())) $next=1;
}
while (($i%2)!=0) {
echo " | | ";
$i++;
if (($i%2)==0) echo "";
}
echo "
";
return $next;
}
//$commr holds a specific SELECT * from comments
function commprint($commr)
{
global $tr;
foreach($commr as $res)
{
if ($res[url]!="")
$commentfrom= "$res[name] ".$tr[wroteat]." $res[edatum]:";
else
$commentfrom= "$res[name] ".$tr[wroteat]." $res[edatum]:";
$comment=preg_replace("/\[SPOILER=([^\]]+)\]/","[".$tr["show spoiler"]."]",$res[comment]);
echo "$comment
";
}
}
function commentform($url)
{
global $tr,$recapwrong,$uid;
if ($recapwrong==1)
echo "".$tr["captchawrong"]."";
echo "";
}
function zodiac_sign($bday)
{
global $tr;
$dayindex=array(20,19,21,20,21,21,23,23,23,23,22,22);
$bday=date_parse($bday);
$bmonth=$bday["month"]-1;
$bday=$bday["day"];
if ($bday<$dayindex["$bmonth"])
$bmonth--;
if ($bmonth<0)
$bmonth=11;
return $tr["zodiac$bmonth"];
}
//sql must be available at the time of calling commentinsert
function commentinsert($obj_id,$name,$email,$url,$comment,$type)
{
global $dbc,$mylang,$_POST,$_SERVER,$recapwrong,$uid;
if ($name!="" && $comment!="")
{
if (!isset($uid)) {
spamcheck($name,$url,$comment);
require_once('recaptchalib.php');
$privatekey = "6LePlgIAAAAAAGQ4jjzTEY2F3Dckn9UHosEt6U6V";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
} else {
$name=get_username($uid);
$email=get_usermail($uid);
$url="http://".$_SERVER['HTTP_HOST']."/u/$uid/";
}
if (!isset($resp) || $resp->is_valid) {
$newName = htmlspecialchars($name);
$newEmail = htmlspecialchars($email);
$newUrl = htmlspecialchars($url);
$newComment = nl2br(htmlspecialchars(stripslashes($comment)));
$res=$dbc->prepare("INSERT INTO comments (`obj_id`,`name`,`email`,`url`,`comment`,`type`,`lang`,`date`) VALUES (:obj_id,:name,:email,:url,:comment,\"$type\",\"$mylang\",NOW());");
$res->bindParam(":obj_id",$obj_id);
$res->bindParam(":name", $newName);
$res->bindParam(":email", $newEmail);
$res->bindParam(":url", $newUrl);
$res->bindParam(":comment", $newComment);
$res->execute();
mail("daniel@klostein.com","Neuer Kommentar!","Hallo Daniel,
$name,$email,$url hat einen Kommentar hinterlassen:
$comment
http://$_SERVER[HTTP_HOST]/$type-$_GET[id].html","From: info@j-dorama.de \r\nReply-To: info@danielfranz.de\r\n");
}
}
}
function spamcheck($name,$url,$content)
{
global $tr;
$spam=0;
$contentspam=array("http://","href","door48.txt","spam base","[*map","Hello! Good Site! Thanks you!");
$contentregex=array("^(\w* ){1,2}site\. Thank[^<]{1,8}\s*$");
$namespam=array("purchase","viagra","www.","click here","name","blackjack","free","viagra"," pills","insurance","mortage","ticket","marlboro","lights","gucci","handbag","replica","credit card","consolidation","cialis","levitra","ringtone","stalker","dress","real estate","phentermine","pharmacy","online","camel","information","cheap","meridia","order","hoodia","hydrocodone","discount","zithromax","xenical","generic","accutane","adipex","valium","ultram","vicodin","xanax","clenbuterol","cipro","propecia","nexium","tramadol","adderall","ephedra","fioricet","cigarette","chesterfield","coupon","davidoff","dunhill","eclipse","flavor","herbal","lamisil","tablet","alprazolam","costume","halloween","download","fake","airline","laptop","notebook","stainlesssteel","watch","masturbat","milf","bitch","defloration","adware","spyware","dreamgirls","income","investment","royalty","windows","bowling","mortgage","casino","payment","strip","poker");
$namespamequals=array("soma","buysoma","ambien","buyambien","girl");
$urlspam=array("insure","slots","xxx","pills","viagra","fora.pl","search.cnn.com","financeinfo","www.zendurl.com","www.freewebtown.com/bestbuynet","sex","url", "facebook.com");
foreach ($contentspam as $cs)
if (($spam==0) && (stristr($content,$cs)))
$spam=1;
$cc=str_replace("\n","",$content);
if ($spam==0)
foreach ($contentregex as $cr)
if (($spam==0) && (preg_match("/$cr/",$cc,$erg)==1))
$spam=1;
if ($spam==0)
foreach ($namespamequals as $nse)
if (($spam==0) && ($name==$nse))
$spam=1;
if ($spam==0)
foreach ($namespam as $ns)
if (($spam==0) && (stristr($name,$ns)))
$spam=1;
if ($spam==0)
foreach ($urlspam as $us)
if (($spam==0) && (stristr($url,$us)))
$spam=1;
if ($spam==1) {
echo $tr["spammsg"];
die(0);
}
}
function ajax_field($value,$pass=0) {
if (is_numeric($pass)) { ?>
value=" echo $value; ?>" onfocus="if(this.value==' echo $value; ?>') {this.value='';this.style.color='#000000';}" onblur="if(this.value=='') {this.value=' echo $value; ?>'; this.style.color='#999999';}" style="color:#999999;"
} else { ?>
value=" echo $value; ?>" onfocus="show_pass(' echo $pass; ?>',1);" style="color:#999999;"
}
}
function str_common($str1,$str2)
{
$i=0;
while ($str1[$i]==$str2[$i] && $i<2)
$i++;
return $i+1;
}
function insertlogos()
{
$m_anz=22;
$f_anz=25;
$m=0;
$f=0;
$used=array(array(),array());
for ($i=0;$i<6;$i++) {
echo "";
if ($i<3 && ($m<3 || $f<3)) {
$gender=rand(0,1);
} else {
if ($m==3)
$gender=1;
else
$gender=0;
}
$m+=($gender == 0);
$f+=($gender == 1);
$number=rand(0,($gender==0?$m_anz-1:$f_anz-1));
while (in_array($number+1,$used[$gender]))
$number=($number+1)%($gender==0?$m_anz:$f_anz);
$url[$gender]=($gender==0?"m":"f")."/".($number+1).".jpg";
$used[$gender][($gender==0?$m:$f)]=$number+1;
echo "
";
echo "
";
}
}
function Bild_Upload($type,$id)
{
?>
Bild upload
}
function Summary_Edit($id,$text)
{
?>
Text bearbeiten
}
function Songs_Edit($id,$names,$songs)
{
?>
Songs bearbeiten
}
?>