( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/includes/processFunctions2.php
<?php
function removeslashes($string)
{
    $string=implode("",explode("\\",$string));
    return stripslashes(trim($string));
}
 
function findSharp($orig, $final) 
{
	$final	= $final * (750.0 / $orig);
	$a		= 52;
	$b		= -0.27810650887573124;
	$c		= .00047337278106508946;
	
	$result = $a + $b * $final + $c * $final * $final;
	
	return max(round($result), 0);
} // findSharp()



function gd_apply_overlay_machine($background, $brand, $amount,$x,$y)
{
 
if (strpos($brand, 'processFont.php') !== false ) { $url = ""; 	

		$fullUrl	= $brand;
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10));
		$type = "0"; // PNG needs a compression level of 0 (no compression) through 9
	 }
else if (strpos($brand, 'gthumbs') !== false ) {$url = "v/uploads/gthumbs/";}
else { $url = "v/uploads/gthumbs/";}
	 
		$brand = basename($brand);
	 
		 $picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		
	switch ($ext)
{
	case '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
		$doSharpen			= FALSE;$type = "1";
		$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 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;$type = "1";
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;


	case 'jpg':
	$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;$type = "1";
	break;
	
		case 'jpeg':
	$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;$type = "1";
	break;

/*	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
*/}	 
 
					 if($type == "1")
					 
					 
					 {   
						$width =600;$height =600;
						$photoFrame2 = imagecreatetruecolor($width, $height);
						imagealphablending($photoFrame2, false);
						imagesavealpha($photoFrame2, true);
						$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
						imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
						$brand = $url . $brand . '';
						$photo2 = $creationFunction($brand);
						imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
						$photoFrame = imagecreatetruecolor($width, $height);
						imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
						imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
						imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
						imagedestroy($photoFrame); 
					
					 
					 
					 
					 }
					 else
					 {
 
/*					if (strpos($layer1, 'route=theUpdate') !== false ) { $type = "Caption";}
					if (strpos($layer1, 'route=theUrl') !== false ) {$type = "Url";}
					if (strpos($layer1, 'route=theName') !== false ) { $type = "Name";}
					if (strpos($layer1, '/filters') !== false ) { $type = "Graphics";} 
					if (strpos($layer1, 'type=profile') !== false ) { $type = "Profile Picture";}
					
					$url = "processFont.php?pichaNi=$themeid$type&route=theUpdate&fontid=443&myfont=&fontcatalogid=254722407698&themeid=443&font_Username=MyriadPro-Semibold.otf&font_Name=HelveticaNeueLTStd-UltLt.otf&font_Url=HelveticaNeueLTStd-UltLt.otf&font_Text=HelveticaNeueLTStd-BdCn.otf&text_w=500&text_h=0&text_x=50&text_y=288&text_align=center&text_size=28&text_color=ffffff&url_color=ffffff&name_color=ffffff&username_color=ffffff&url_size=30&name_size=20&username_size=20&text_pad=30&text_line_height=30&text=Lorem%20Ipsum%20is%20simply%20dummy%20text%20of%20the%20printing,%20digital%20and%20typesetting%20industry&S=1&layer=";
					$fields = array('1' => urlencode($_GET['S']));
					foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
					rtrim($fields_string, '&');
					$ch = curl_init();
					curl_setopt($ch,CURLOPT_URL, $url);
					curl_setopt($ch,CURLOPT_POST, count($fields));
					curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
					$result = curl_exec($ch);
					curl_close($ch);				
*/		
 	 
 				 }

	
	return $background;
}

/** Apply a PNG overlay */
function gd_apply_effect($background, $brand, $amount)
{

if ($_GET['action']=="cards")
		
		 {
			 $width = 640;  $height = 430;	
				
					 
		 
		 }
		 else
		 
		 {
			   if (!empty($_GET['description']))
		
		 {
			 $width = 640;  $height = 400;	 
		 }
		 else
		 
		 {
			  $width = 600;  $height = 666;	
		 }
		 
		 }
	


	// Get the size and MIME type of the requested image
/*$size	= GetImageSize($docRoot . $image);
$mime	= $size['mime'];*/
 

 
	$photoFrame2 = imagecreatetruecolor($width, $height);
	
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 
	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$mag = $brand;
	
 
		
 
 
		$brand = 'filters/effects/' . $brand . '.png';
		$photo2 = imagecreatefrompng($brand);
		 
	
	
	/*include("mags/switch.php"); */
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */
/** Apply a PNG overlay */
function gd_apply_overlay($background, $brand, $amount)
{

if ($_GET['action']=="cards")
		
		 {
			 $width = 640;  $height = 430;	
				
					 
		 
		 }
		 else
		 
		 {
			   if (!empty($_GET['description']))
		
		 {
			 $width = 640;  $height = 400;	 
		 }
		 else
		 
		 {
			  $width = 600;  $height = 666;	
		 }
		 
		 }
	


	// Get the size and MIME type of the requested image
/*$size	= GetImageSize($docRoot . $image);
$mime	= $size['mime'];*/
 

 
	$photoFrame2 = imagecreatetruecolor($width, $height);
	
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 
	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$mag = $brand;
	
 
 		$brand = 'filters/mood/$brand.png';
		$photo2 = imagecreatefrompng($brand);
		 
	
	
	/*include("mags/switch.php"); */
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */


function gd_apply_logo($background, $brand, $amount,$x,$y,$w,$h)
{

$width = 600;  $height = 600;	

	// Get the size and MIME type of the requested image
/*$size	= GetImageSize($docRoot . $image);
$mime	= $size['mime'];*/
 

 
	$photoFrame2 = imagecreatetruecolor($width, $height);
	
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 
	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$mag = $brand;
	
 
		
 
 
		$brand = 'v/uploads/gthumbs/' . $brand;
		$photo2 = imagecreatefromjpeg($brand);
		 
	
	
	/*include("mags/switch.php"); */
	imagecopyresampled($photoFrame2, $photo2, $x, $y, 0,0, $w, $h, $width, $height);
	
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */
 
 
 /** Apply a PNG overlay */
function gd_apply_overlay2($background, $brand, $amount,$x,$y)
{

 
		 $picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		 
	switch ($ext)
{
	case '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
		$doSharpen			= FALSE;
		$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 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
}	 
 
 	$width =600;$height =600;
	$photoFrame2 = imagecreatetruecolor($width, $height);
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$brand = 'v/uploads/gthumbs/' . $brand . '';
	$photo2 = $creationFunction($brand);
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 

	
	return $background;
}

function gd_apply_overlay4($background, $brand, $amount)
{


$picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		 
	switch ($ext)
{
	case '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
		$doSharpen			= FALSE;
		$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 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
}	 
 	$width =600;$height =600;
	$photoFrame2 = imagecreatetruecolor($width, $height);
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$brand = 'v/uploads/gthumbs/' . $brand . '';
	$photo2 = $creationFunction($brand);
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
 function gd_apply_overlay6($background, $brand, $amount)
{


$picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		 
	switch ($ext)
{
	case '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
		$doSharpen			= FALSE;
		$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 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
}	 
 	$width =600;$height =600;
	$photoFrame2 = imagecreatetruecolor($width, $height);
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$brand = 'brands/' . $brand . '';
	$photo2 = $creationFunction($brand);
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */
function hex_to_rgb($hex) {
    // remove '#'
    if(substr($hex,0,1) == '#')
        $hex = substr($hex,1) ;

    // expand short form ('fff') color to long form ('ffffff')
    if(strlen($hex) == 3) {
        $hex = substr($hex,0,1) . substr($hex,0,1) .
               substr($hex,1,1) . substr($hex,1,1) .
               substr($hex,2,1) . substr($hex,2,1) ;
    }

    if(strlen($hex) != 6)
        fatal_error('Error: Invalid color "'.$hex.'"') ;

    // convert from hexidecimal number systems
    $rgb['red'] = hexdec(substr($hex,0,2)) ;
    $rgb['green'] = hexdec(substr($hex,2,2)) ;
    $rgb['blue'] = hexdec(substr($hex,4,2)) ;

    return $rgb ;
}


function fatal_error($message)
{
    // send an image
    if(function_exists('ImageCreate'))
    {
        $width = ImageFontWidth(5) * strlen($message) + 10 ;
        $height = ImageFontHeight(5) + 10 ;
        if($image = ImageCreate($width,$height))
        {
            $background = ImageColorAllocate($image,255,255,255) ;
            $text_color = ImageColorAllocate($image,0,0,0) ;
            ImageString($image,5,5,5,$message,$text_color) ;
            header('Content-type: image/png') ;
            ImagePNG($image) ;
            ImageDestroy($image) ;
            exit ;
        }
    }

    // send 500 code
    header("HTTP/1.0 500 Internal Server Error") ;
    print($message) ;
    exit ;
}
/*if(!$image || !$box)
{
    fatal_error('Error: The server could not create this image.') ;
}
*/ 
 function dummyText()
{
	if(!empty($_GET['context']))
	{
	$text = $_GET['context']." *".$_GET['cl']; 
	 
	
	}
	else
	{
			$text = "The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog *".$_GET['cl']; 
	}

	
	
		 
	  return $text;
	  } 
	  
	   function realText()
{
	 $text = mysqli_real_escape_string($link,$_GET['context']) ;  
	$text  = removeslashes($text);	
	return $text;
	  }
	  
	  
	    
	 
	 
 function username()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
				if(!empty($_GET['convoId']) && $_GET['context'] != "undefined")
					{
					   $convoId = $_GET['convoId']; 	
					$rs_settings = mysqli_query($link,"select * from tweets where id=$convoId");	
								 while ($row_settings = mysqli_fetch_array($rs_settings)) {
								 
							  $un = strtolower($row_settings['screen_name']);
							  
							return removeslashes($un);	
							  
							 }
					
					}
					else
					{
						$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani");

									 while ($row_settings = mysqli_fetch_array($rs_settings)) {
									 
								  $un = strtolower($row_settings['user_name']);
								  
								return removeslashes($un);	
								  
								 }
					}
	
	
 	 
		 }

 function user()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	

						if(!empty($_GET['convoId']) && $_GET['context'] != "undefined")
					{
					   $convoId = $_GET['convoId']; 	
					$rs_settings = mysqli_query($link,"select * from tweets where id=$convoId");	
								 while ($row_settings = mysqli_fetch_array($rs_settings)) {
								 
							  $ca = strtolower($row_settings['user_name']);
							  
							return removeslashes($ca);	
							  
							 }
					
					}
					else
					{
						$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani");
									 while ($row_settings = mysqli_fetch_array($rs_settings)) {
									 
								 	   $ca =  $row_settings['catalogname'] ;
	  									return removeslashes($ca);
								  
								 }
					}


 	  }

 function yanani($yanani)
{
	 
 $rs_settings = mysqli_query($link,"select * from users where catalogid=$yanani"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 
	  $user_name = strtolower($row_settings['user_name']);
	  return removeslashes($user_name);
	  
	 } }
 function slug()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 
	  return $slug = strtolower($row_settings['slug']);
	  
	 } }

 function bio()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
			 $description = strtolower($row_settings['description']);
			 if(empty($description)){ $description=  "Visit thebrand.co.ke/".$row_settings['user_name']." for updates";} 
			 else{
				 $description = strtolower($row_settings['description']);
				 }
		 
	  
	  return  removeslashes($description);
	  
	 } }


 function profilepicture()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from profilepicture where catalogid=$nani and type='1' limit 0,1"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 
	  return $picture = strtolower($row_settings['picture']);
	  
	 } }

 function findStartag($startag)
{
 	$rs_settings = mysqli_query($link,"select * from profilepicture where title='$startag' limit 0,1"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 $newsid = $row_settings['id'];
		 $yanani = $row_settings['catalogid'];
		 $nani = $_GET['nani'];
		 if($nani!=$yanani)
		 {
			 $viewnum = $row_settings['viewnum'];
		 $viewnum = $viewnum+1;
		 mysqli_query("update profilepicture set viewnum=$viewnum where id='$newsid'");  
			 
			 
			 }
		
		 $picture = explode('.',$row_settings['picture']);
         $picture = $picture[0];
		 $picture = $row_settings['picture'];
		 $theme = $row_settings['description'];
		 $overlay = $row_settings['overlay'];
		 $yanani = $row_settings['catalogid'];
		 $fx = $row_settings['fx'];
		 $x = $row_settings['x'];
		 $y = $row_settings['y'];
	  return $picture."|".$theme."|".$overlay."|".$yanani."|".$x."|".$y."|".$fx."|";
	  
	 } }

 function openGallery($startag)
{
 	$rs_settings = mysqli_query($link,"select * from profilepicture where title='$startag' and type=3  limit 0,1"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 $newsid = $row_settings['id'];
		 $yanani = $row_settings['catalogid'];
		 $nani = $_GET['nani'];
		 if($nani!=$yanani)
		 {
			 $viewnum = $row_settings['viewnum'];
		 $viewnum = $viewnum+1;
		 mysqli_query("update profilepicture set viewnum=$viewnum where id='$newsid'");  
			 
			 
			 }
		
		 $picture = explode('.',$row_settings['picture']);
         $picture = $picture[0];
         $picture = $row_settings['picture'];
		 $theme = $row_settings['description'];
		 $overlay = $row_settings['overlay'];
		 $yanani = $row_settings['catalogid'];
		 $fx = $row_settings['fx'];
		 $x = $row_settings['x'];
		 $y = $row_settings['y'];
	  return $picture."|".$theme."|".$overlay."|".$yanani."|".$x."|".$y."|".$fx."|";
	  
	 } }

 function AppOwner()
{
	$AppNo = $_GET['AppNo']; 
	 
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$AppNo"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 
		  return $cat = strtolower($row_settings['catalogname']);
	  
	 } }
	 function country()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysqli_fetch_array($rs_settings)) {
		 
	  return $country = strtolower($row_settings['country']);
	  
	 } }
	  

if ($_GET['gratitude'] == "start")  {
$uploaddir = 'v/uploads/raw/';
$image ="images/gratitude.jpg";
$date	= md5(date('D, d M Y H:i:s'));
$upload =  $date.basename($image);

$uploadfile = $uploaddir .$upload; 

 copy($image,$uploadfile);
 
 $user      = user();
$owner     = AppOwner();
 $AppNo = $_GET['AppNo'];
 $nani = $_GET['nani'];


$db->addgratitude($user,$owner,$AppNo,$nani,$upload);
$pic = $upload;
 
}	 
	 
	

 
 
 function showUpdate($nani) 
	{

/*error_reporting(0);*/
include_once 'real/service/social/includes/tolink.php';
include_once 'real/service/social/includes/textlink.php';
include_once 'real/service/social/includes/htmlcode.php';
include_once 'real/service/social/includes/Expand_URL.php';
require("const.inc.php");   
 $newquery = mysqli_query("SELECT M.msg_id, M.newsid, M.catalogid_fk, M.original,M.isdisplay,M.episodeid,M.yanani, M.message, M.created, U.user_name,U.slug,M.uploads,M.type, U.user_name FROM reporta M, users U where M.catalogid_fk=U.catalogid and M.catalogid_fk='$nani' order by M.msg_id desc limit 1 ");
  $data = mysqli_fetch_array($newquery);
		



if($data)
{
	 $url=$data['message']; 
$returns = 'none';
if(eregi("youtu",$url) or eregi("youtube",$url)){
        if(eregi("v=",$url))
    $splits = explode("=",$url);
    else
    $splits = explode("be/",$url);

        if(!empty($splits[1])){
			if(preg_match("/feature/i", $splits[1])){
			$splits[1] = str_replace("&feature","",$splits[1]);	
			}
                $returns = '<iframe width="100%" height="400" src="http://www.youtube.com/embed/'.$splits[1].'" frameborder="0"></iframe>';
        }
} else if(eregi("vimeo",$url)){
        $splits = explode("com/",$url);
        $returns = '<iframe src="http://player.vimeo.com/video/'.$splits[1].'?title=0&amp;byline=0&amp;portrait=0" width="100%" height="400" frameborder="0"></iframe>';
}
	
	 
 $msg_id=$data['msg_id'];
 $orimessage=$data['message'];

 $message=$db-> $data['message'] ; 
 $message= preg_replace('/\*(\\w+)/', "",$message );
 $message=tolink(htmlcode($message));
 
  $time=$data['created'];  $msg_created=$data['created'];
$mtime=date("c", $time);
  $user_name=$data['user_name'];
 $profile=$data['slug'];
  $uploads=$data['uploads'];
 $msg_catalogid=$data['catalogid_fk'];
$msg_yanani=$data['yanani'];
  $msg_slug=$data['slug'];
  $msg_slug=$data['slug'];
  $nani=$data['type'];
  $photoDisplay=$data['original'];
  
$msg_newsid=$data['msg_id'];
  if($nani==13) { $msg_newsid=$data['newsid'];$msg_id=$data['newsid']; }
  $forChannel=$data['msg_id'];
    $forText=$data['msg_id'];
	 $forVideo=$data['msg_id'];
	 $forLove=$data['msg_id'];
   $msgidLove=$data['msg_id'];
	 $photoDisplay=$data['original'];
$isdisplay=$data['isdisplay'];
  $episodeid=$data['episodeid'];
$actualID=$data['msg_id'];
 
 
  if(!empty($_SESSION['TwitterUsername']))
		{
			include 'twitter/EpiTwitter/EpiCurl.php';
			include 'twitter/EpiTwitter/EpiOAuth.php';
			include 'twitter/EpiTwitter/EpiTwitter.php';
			include 'twitter/EpiTwitter/TwitterConfig.php';
			include("Connections/videoondemand.php");
			include("twitter/db.php");
			
			$message=mysql_real_escape_string($orimessage);
			 $message=stripslashes($message);
			$pic = " $siteaddress3/taswira.php?width=500&quality=70&image=/v/uploads/raw/$photoDisplay";  
 
 
			  $TwitterUsername=$_SESSION['TwitterUsername'];
			$tw_sql=mysqli_query($connection,"SELECT oauth_token,oauth_token_secret FROM users WHERE tel='$msg_catalogid'");
			$row=mysqli_fetch_array($tw_sql,MYSQLI_ASSOC);
			$oauth_token=$row["oauth_token"];
			$oauth_token_secret=$row["oauth_token_secret"];
			 
			$Twitter = new EpiTwitter($consumer_key, $consumer_secret);
			$Twitter->setToken($oauth_token,$oauth_token_secret);
			$status=$Twitter->post_statusesUpdate(array('status' => $message.$pic));
			/*echo $status->id_str;*/
			 
			}	
?>

 <img src="<?php echo $siteaddress3 ?>taswira.php?width=600&quality=100&image=/v/uploads/raw/<?php echo $photoDisplay ?>" width="100%"  /> 
<?php
}	
else

{
	
	exit("posted already");
	}		 
			 
      
       
    } 
 
 
 
 
 
 
 
 
 
 
 
 
	  	
	
 

 if ($_GET['gratitude'] == "posted")  {

if (!empty($_GET['context'])) 
{
 $text = realText();
 
}
else
{
	 $text = mysqli_real_escape_string($link,$_GET['cl']);
}
 
	
preg_match('/\>(\\w+)/',$_GET['context'],$vida);
$vida =$vida[1];
//is it video or not
//is it video or not
if ($vida  == "video") 
{ //it is video hurraaaay

include("mags/video.php"); 
exit();}



if ($vida != "video") 
{ //its not
$uploaddir = 'v/uploads/raw/';

$picture     = profilepicture();
if(!empty($picture)) 
{
	
	
					if(!empty($_GET["postDirect"])) 
				{
					$image ="v/uploads/raw/$picture";
				}
				else
				{
					$image ="v/uploads/gthumbs/$picture";
					}
					
	
	
}
else
{
$picme = rand(1,10);
if($picme == 1) { $image ="images/backgrounds/bg-4.jpg"; } 
if($picme == 2) { $image ="images/backgrounds/bold.jpg";} 
if($picme == 3) { $image ="images/backgrounds/dusk.jpg"; } 
if($picme == 4) { $image ="images/backgrounds/bg-2.jpg"; } 
if($picme == 5) { $image ="images/backgrounds/bg-3.jpg"; } 
if($picme == 6) { $image ="images/backgrounds/frost.jpg"; } 
if($picme == 7) { $image ="images/backgrounds/sky.jpg";} 
if($picme == 8) { $image ="images/backgrounds/sunset.jpg"; } 
if($picme == 9) { $image ="images/backgrounds/sunset2.jpg"; } 
if($picme == 10) { $image ="images/backgrounds/sunset3.jpg"; }
/*$image ="images/backgrounds/bg-4.jpg"; */
} 
 

$date	= md5(time());
/*$upload =  $date.basename($image);*/
 
$upload =  $date.".jpg";
$uploadfile = $uploaddir .$upload; 



if (!empty($_GET['cl'])) { 
$pic =$_GET['pic'];
gd_filter_image('v/uploads/gthumbs/' . $pic, $_GET['filter']); }
else
{
	copy($image,$uploadfile);  
}
	


 $user      = user();
$owner     = AppOwner();
 $AppNo = mysqli_real_escape_string($link,$_GET['AppNo']);
 $nani = mysqli_real_escape_string($link,$_GET['nani']);
		
if (!empty($_GET['context'])) 
		{
		 $text = realText();
		 $text = str_replace("\n" , ' ',$context);
		  $text = str_replace("\r" , ' ',$context);
$uploads="";
 
 if (empty($_GET['display'])) {
$db->Insert_UpdateX($nani,$text,$uploads,$AppNo,$upload,$owner); 		
	
 }
	
		}		
		
	if (!empty($_GET['cl'])) 
		{
		$text = dummyText(); 
		}		
			
	 
		
 
$pic = $upload;
 
} 
 


 
if ($pic && $_GET['filter']) {

 if (!empty($_GET['fire'])) {
 
	$AppNo = mysqli_real_escape_string($link,$_GET['AppNo']);
	$cl = mysqli_real_escape_string($link,$_GET['cl']);
	$overlay = mysqli_real_escape_string($link,$_GET['overlay']);
	$pic = $_GET['pic'];
	$x = $_GET['x'];
	$fx = $_GET['fx'];
	$mytitle = $_GET['mytitle'];
	$y = $_GET['y'];
	$msg_id = $_GET['msg_id'];
	$msg_id = $db->base64url_decode($msg_id);
	$mytitle = $_GET['mytitle'];
	$fx = $_GET['fx'];
	
	
	
	
	
	if(!empty($fx))
	{
 
 
		$db->mag8($pic,$fx,$msg_id,$ren);
		
	}
		else
	{
		$db->mag7($pic,$AppNo,$cl,$overlay,$mytitle,$x,$y,$msg_id);
		}



 
	}

		
 $mag = $_GET['mag'];	
 	$id = substr($pic, 5, 1);
	
	
	if (!empty($_GET['cl'])) { 
$pic =$_GET['pic'];

/*gd_filter_image($image, "blank"); */
gd_filter_image('v/uploads/gthumbs/' . $pic, $_GET['filter']); }
else
{
	gd_filter_image('v/uploads/raw/' . $pic, $_GET['filter']);
}
	
	
	  

 //end no vida
 }	 

}

 

?>