//========================
//Commonly used functions.
//========================
//Displays the Image within the available area and retaining its original aspect ratio.
//This function is called in frameimage.php,microsite_templates - index.php
//Author : Johnson P Thomas
function displayImage($x,$y,$width,$height,$image)
{
//------------- if x is less than width and y is less than height -----------
If (($x <= $width) && ($y <= $height))
{
?> width==$x?>>
}
//------------- if x is greater than width and y is less than height -----------
elseIf (($x >= $width) && ($y <= $height))
{
$ratio = ($x/$width);
$x = round($x / $ratio);
$y = round($y / $ratio);
?> width==$x?>>
}
//------------- if x is less than width and y is greater than height -----------
elseIf (($x <= $width) && ($y >= $height))
{
$ratio = ($y/$height);
$x = round($x / $ratio);
$y = round($y / $ratio);
?> width==$x?>>
}
//------------- if x is greater than width and y is greater than height -----------
elseIf (($x >= $width) && ($y >= $height))
{
$ratiox = ($x/$width);
$ratioy = ($y/$height);
If ($ratiox > $ratioy){$ratio = $ratiox;} else {$ratio = $ratioy;}
$x = round($x / $ratio);
$y = round($y / $ratio);
?> width==$x?>>
}
//------------- if none of the above conditions are satisfied -----------
else
{
$x = $x; //--- Use the actual width and height -------
$y = $y; //--- Use the actual width and height -------
?> width==$x?>>
}
}
//Displays the Image within the available area and retaining its original aspect ratio.
//This function is called only in gallery/admin/view.php
/* There is only one change compared to the function displayImage. In the function above the code
for displaying image starts with echo "\"../" whereas here it starts with echo "\"". This is because in admin the url is 2 level up .*/
//Author : Johnson P Thomas
function displayImageadmin($x,$y,$width,$height,$image)
{
displayImage($x,$y,$width,$height,$image);
}
//Returns the physical path of filename.
//Author : Sanat.
function mappath($filename) {
$path = $GLOBALS["PATH_TRANSLATED"];
if ($filename == ".") {
return strrev(strstr(strrev($path), "/"));
}
else {
return $path;
}
}
//Redirects the user to a relative url within the same directory.
//Author : Sanat.
function rel_redirect($url) {
$server = $GLOBALS["HTTP_SERVER_VARS"];
$host = $server['HTTP_HOST'];
$dir = substr(dirname($server['PHP_SELF']), 1);
header("Location: http://".$host."/".$dir."/".$url);
}
//Redirects the user to a relative url.
//Author : Sanat.
function rel_redirect1($url) {
$server = $GLOBALS["HTTP_SERVER_VARS"];
$host = $server['HTTP_HOST'];
header("Location: http://".$host."/".$dir."/".$url);
}
function abs_redirect($url)
{
$server = $GLOBALS["HTTP_SERVER_VARS"];
$host = $server['HTTP_HOST'];
header("Location: http://".$host."/".$url);
}
//Returns the original image name from thumbnail
//Author : Karan
function getImageName($filename) {
$pos2 = strrpos($filename,'.');
$imageext = substr($filename,$pos2+1);
$imagename = substr($filename,0,$pos2)."big.".$imageext;
return $imagename;
}
//Returns the number of days in a month
//Author : Robins
function getDays($month,$year)
{
$arrMon = array(31,28,31,30,31,30,31,31,30,31,30,31);
if(($year%4==0 && $year%100 !=0 )|| ($year%400==0))
$arrMon[1]=29;
return($arrMon[$month-1]);
}
//Returns a date in dd-mon-yyyy format
//Author : Robins
function ddMonYy($dt)
{
$dt = getdate(strtotime($dt));
return ($dt['mday']."-".$dt['month']."-".$dt['year']);
}
/*
* To check whether date1 is greater than date2
*returns 1 if date1 is greater than date2
*returns 0 if both are equal
*returns -1 if date1 is less than date2
*Author : Robins
*/
function isGreaterDate($date1,$date2)
{
$tmpDt1 = getdate(strtotime($date1));
$dt1 = $tmpDt1['year'];
if((int)$tmpDt1['mon'] < 10)
$dt1 = $dt1."0".$tmpDt1['mon'];
else
$dt1 = $dt1.$tmpDt1['mon'];
if((int)$tmpDt1['mday'] < 10)
$dt1 = $dt1."0".$tmpDt1['mday'];
else
$dt1 = $dt1.$tmpDt1['mday'];
$tmpDt2 = getdate(strtotime($date2));
$dt2 = $tmpDt2['year'];
if((int)$tmpDt2['mon'] < 10)
$dt2 = $dt2."0".$tmpDt2['mon'];
else
$dt2 = $dt2.$tmpDt2['mon'];
if((int)$tmpDt2['mday'] < 10)
$dt2 = $dt2."0".$tmpDt2['mday'];
else
$dt2 = $dt2.$tmpDt2['mday'];
if((int)$dt1 > (int)$dt2)
return(1);
elseif((int)$dt1 == (int)$dt2)
return(0);
else
return(-1);
}
//For home page
function displayImageHome($x,$y,$width,$height,$image)
{
//------------- if x is less than width and y is less than height -----------
If (($x <= $width) && ($y <= $height))
{
return "";
}
//------------- if x is greater than width and y is less than height -----------
elseIf (($x >= $width) && ($y <= $height))
{
$ratio = ($x/$width);
$x = round($x / $ratio);
$y = round($y / $ratio);
return "";
}
//------------- if x is less than width and y is greater than height -----------
elseIf (($x <= $width) && ($y >= $height))
{
$ratio = ($y/$height);
$x = round($x / $ratio);
$y = round($y / $ratio);
return "";
}
//------------- if x is greater than width and y is greater than height -----------
elseIf (($x >= $width) && ($y >= $height))
{
$ratiox = ($x/$width);
$ratioy = ($y/$height);
If ($ratiox > $ratioy){$ratio = $ratiox;} else {$ratio = $ratioy;}
$x = round($x / $ratio);
$y = round($y / $ratio);
return "";
}
//------------- if none of the above conditions are satisfied -----------
else
{
$x = $x; //--- Use the actual width and height -------
$y = $y; //--- Use the actual width and height -------
return "";
}
}
//this function is used in advsearchresults to display only existing values from tblimage
function getImageInfo($field,$users)
{
$returnString = "";
$DbImage = new Database;
$DbImage->execute ("SELECT distinct a.".$field." FROM tblimage a, tblmember b
where b.regStatus=1
and a.userID not in ($users)
and a.userID=b.userID");
for ($i=0; $i<$DbImage->recordCount; $i++)
{
$returnString = $returnString . $DbImage->Fields["$field"] . ",";
$DbImage->moveNext();
}
$DbImage->close();
$returnString = $returnString . "0";
return $returnString;
}
?>
require "../lib/class.phpmailer.php";
$server = $GLOBALS["HTTP_SERVER_VARS"];
$dir = substr(dirname($server['PHP_SELF']), 1);
$gallery = new Gallery;
$gallery->siteID = $dir;
$gallery->refresh1();
$userId = $gallery->userID;
$DBartist= new Database;
$DBartist->execute("SELECT emailID FROM tbluser WHERE userID = '$userId'");
$DBBio= new Database;
$DBBio->execute("SELECT siteID FROM tblmicrosite WHERE userID = '$userId'");
$galnm = $DBBio->Fields[0];
$artistEmail = @$DBartist->Fields[0];
$DBartist->execute("SELECT firstname, lastname FROM tblmember WHERE userID = '$userId'");
//$DBartist->close();
$artistFname = $DBartist->Fields["firstname"];
$artistLname = $DBartist->Fields["lastname"];
$artistName = "$artistFname $artistLname";
// If posted back
$show=0;
if(@$action=="sendit"){
$mail = new phpmailer;
$mail->From = $userEmail;
$mail->FromName = $userName;
$mail->Subject = "Invitation from $userName to WorldImages";
$mail->AddAddress($friendEmail, $friendName);
$mail->IsSMTP();
$mail->SMTPAuth=false;
$mail->IsHTML(true);
$body = "";
$body = $body . "Dear $friendName,
";
$body = $body . "$userName was browsing through our site and has invited you to visit the following site: