( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
if(!empty($_GET["route"])){
session_start();
$route = $_GET["route"] ;
$_SESSION["joinApp"] =$route;
}
if (!empty($addprofilepicture)) {
$tempuserfile = $_FILES['userfile']['tmp_name'];
$tempuserfile_name = $_FILES['userfile']['name'];
if ( empty($tempuserfile)) {
if(!empty($_GET["route"])){
$route = $_GET["route"] ;
$part = explode('|',$route);
$msg_id = $part[0];
$view = $part[1];
$joinApp = $part[2];
$url = "&msg_id=$msg_id&view=$view";
header("Location: ?mode=editprofilepicture&msg=Invalid File Type!$url") ;
}
else{
$url = "";
header("Location: ?mode=editprofilepicture&msg=Invalid File Type!$url") ;
}
exit();}
if ((!empty($tempuserfile)) && (!empty($tempuserfile_name))) {
$pathinfo = pathinfo($tempuserfile_name, PATHINFO_EXTENSION);
if(!in_array(strtolower($pathinfo), array('jpg','gif','png')))
{
if(!empty($route)){
$route = $route ;
$part = explode('|',$route);
$msg_id = $part[0];
$view = $part[1];
$joinApp = $part[2];
$url = "&msg_id=$msg_id&view=$view";
header("Location: ?mode=editprofilepicture&msg=Invalid File Type!$url") ;
}
else{
$url = "";
header("Location: ?mode=editprofilepicture&msg=Invalid File Type!$url") ;
}
exit();
}
$userfile = $tempuserfile;
$userfile_name = $tempuserfile_name;
}
$newsid = $db->addprofilepicture();
if ((!empty($userfile)) && (!empty($userfile_name))) {
$userfile_name = preg_replace('/[\ ]/', '-', $userfile_name);
$userfile_name = $videouser.$userfile_name;
$dest1 = $PicturePath.$userfile_name;
$date = md5(time);
$copyimage ="v/uploads/gthumbs/$date".$userfile_name;
$copyimage2 ="v/uploads/gallery/$date".$userfile_name;
$final ="$date".$userfile_name;
copy($userfile, $copyimage);
copy($userfile, $copyimage2);
$PicturePath ="v/uploads/gthumbs/";
$db->add_profilePicture($newsid,$final,$PicturePath);
if(!empty($route)){
$route = $route;
$url = "&msg_id=$msg_id&view=$view&joinApp=1";
}
else{
$url = "";
}
header("Location: indexAlone.php?mode=cropP$url&category=alert-primary&msg=Profile+successfully+picture+Added");
}
}
//crop statr
if (!empty($crop)) {
$_POST = filter($_POST);
$msg_id = $_POST['msg_id'];
$action = $_POST['action'];
$msg_id = $db->base64url_decode($msg_id);
$msg_id2 = $_POST['msg_id'];
$photo = $_POST['photo'];
$targ_w = $_POST['w'];
$mag = $_POST['mag'];
$appno = $_POST['appno'];
$targ_h = $_POST['h'];
$quality = 100;
$src = "v/uploads/gthumbs/$photo";
$dst_r = imagecreatetruecolor( $targ_w, $targ_h );
// Set up the appropriate image handling functions based on the original image's mime type
$size = GetImageSize($src);
$mime = $size['mime'];
switch ($size['mime'])
{
case 'image/gif':
// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
// This is maybe not the ideal solution, but IE6 can suck it
$creationFunction = 'ImageCreateFromGif';
$outputFunction = 'ImagePng';
$mime = 'image/png'; // We need to convert GIFs to PNGs
$quality = round(10 - ($quality / 10)); // We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
break;
case 'image/png':
$creationFunction = 'ImageCreateFromPng';
$outputFunction = 'ImagePng';
$quality = round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
break;
default:
$creationFunction = 'ImageCreateFromJpeg';
$outputFunction = 'ImageJpeg';
$quality=100;
break;
}
$img_r = $creationFunction($src);
if (in_array($size['mime'], array('image/gif', 'image/png')))
{
/* exit("ikooooooooooooooooooo");*/
if (!$color)
{
// If this is a GIF or a PNG, we need to set up transparency
imagealphablending($dst_r, false);
imagesavealpha($dst_r, true);
}
else
{
// Fill the background with the specified color for matting purposes
if ($color[0] == '#')
$color = substr($color, 1);
$background = FALSE;
if (strlen($color) == 6)
$background = imagecolorallocate($dst_r, hexdec($color[0].$color[1]), hexdec($color[2].$color[3]), hexdec($color[4].$color[5]));
else if (strlen($color) == 3)
$background = imagecolorallocate($dst_r, hexdec($color[0].$color[0]), hexdec($color[1].$color[1]), hexdec($color[2].$color[2]));
if ($background)
imagefill($dst_r, 0, 0, $background);
}
}
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
$outputFunction($dst_r, $src, $quality);
$msg_id = mysqli_real_escape_string($link,$msg_id);
if(!empty($mag))
{
$db->crop2($msg_id,$action,$appno);
if($action=="meme")
{
header("Location: indexAlone.php?mode=startags&msg_id=$msg_id2&category=alert-success&step=0&action=$action&msg=Photo+cropped+successfully!");
}
else
{
header("Location: index.php?mag=mag&mode=startags&category=alert-success&msg_id=$msg_id2&step=2&action=$action&msg=Photo+cropped+successfully!");
}
}
else
{
$db->crop($msg_id,$action,$appno);
if(!empty($route)){
$route = $route ;
$part = explode('|',$route);
$msg_id = $part[0];
$view = $part[1];
$joinApp = $part[2];
header("Location: openApp.php?mode=conversation&msg_id=$msg_id&view=$view&clearRoute=joinApp"); exit();
}
else{
$url = "";
$msg_idD = $db->base64url_encode($msg_id);
header("Location: indexAlone.php?mode=startags&msg_id=$msg_id2&category=alert-success&step=0&action=$action&msg=Photo+cropped+successfully!");
}
}
}
?><script type="text/javascript">
var searchbox = "santos";
var dataString = 'searchword='+ searchbox;
var form = $("#engineX");
//$("#doLogin",form).attr("disabled","disabled");
var myaccount = $("#myaccountX", form).val();
var AppNo = $("#AppNoX", form).val();
var themeidX = "<?php echo $msg_id ?>";
$.ajax({
type: "POST",
url: mimiServer+"service/social/addfriend_ajax.php?myaccount="+myaccount+"&themeidX="+themeidX+"&type="+myaccount+"",
data: dataString,
cache: false,
success: function(html)
{
/*$("#check").html(html);*/
$("#result").html(html).show();
loadingOut();
}
});
</script><?php if ($Delprofilepicture) {
$db->delprofilepicture($pichaC);
if(!empty($route)){
$url = "&route=$msg_id|$view|JoinApp";
header("Location: indexAlone.php?mode=editprofilepicture$url"); exit();
}
else{
$url = "";
header("Location: indexAlone.php?mode=editprofilepicture$url");
}
}
?>
<table width="100%" border="0">
<tr>
<td valign="top" align="center"><h3 class="title">Add profile picture or logo</h3>
<?php if(!empty($pichaC)) { ?>
<img class="img-circle" src="<?php echo $siteaddress3 ?>taswira.php?quality=70&nocache=1&width=150&height=150&cropratio=1:1&image=/v/uploads/gthumbs/<?php echo $pichaC;?>" /> <?php } else {?>
<img class="img-circle" src="<?php echo $siteaddress3 ?>taswira.php?quality=70<?php /*?>&nocache=1<?php */?>&width=150&height=150&cropratio=1:1&image=/images/user.png" />
<?php } ?>
<?php if(!empty($_GET["route"])){
$route = $_GET["route"] ;
$part = explode('|',$route);
$msg_id = $part[0];
$view = $part[1];
$joinApp = $part[2];
$url = "&msg_id=$msg_id&view=$view&joinApp=1";
}
else{
$url = "";
}?>
<form action="?mode=editprofilepicture<?php echo $url; ?>" method="POST" ENCTYPE="multipart/form-data">
<table height="300" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<input name="route" type="hidden" value="<?php echo $url; ?>">
<span class="style1">
<?php
if (!empty($pichaC)){
?>
<input type="submit" class="btn btn-success " name="Delprofilepicture" value="<?php print "$admin_del"; ?>"> <br>
<?php
}
?> <br>
<input name="userfile" type="file" class="btn btn-info "> <br>
<input type="submit" class="btn btn-warning " name="addprofilepicture" value="Add ">
</td>
</tr>
</table>
</form>