//========================
//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;
}
?>
//if the membership is cancelled then redirect him to cancelledmember.php
$DBRedirect = new Database;
$DBRedirect->execute("select regStatus from tblmember where regStatus=2 and userID=".$userId);
if ($DBRedirect->recordCount > 0)
{
echo "";
}
$DBRedirect->close();
?>
//added by karan to check if the e-com functionality of platinum member is enabled
//require("../lib/ecomcheck.php");
//added by karan to display message for cancelled member
require("../lib/msgcancel.php");
?>
Gallery of Fish Paintings from Worldimages
//-- Left bar --->
require("left.php");?>
=$DBBio->Fields["galleryname"]?>
//--------------------- Code for Image Display ---------------
//----------------- Coded by Johnson ---------------------
$DBImg = new Database;
$selectSql = " select imageName,BuyURL,thumbNailURL,imageID from tblimage where userId = $USERID and displayhome=1 order by productrank";
$DBImg->execute($selectSql);
//--------------- Variable Declaration for Image Display -----------
$noOfImages = 3; //----------- Assign the no of images ----------
//--- If the no of images in db is less than noOfImages then take the no from db.-----
If ($DBImg->recordCount < $noOfImages) {$noOfImages = $DBImg->recordCount;}
for ($i=1; $i<=$noOfImages; $i++)
{
?>
if ($noOfImages != 0)
{?>
Enter Gallery
}
else
{?>
 
}?>
$DBStatus = new Database;
$DBStatus->execute("select regStatus from tblmember where regStatus=2 and userID=".$gallery->userID);
if ($DBStatus->recordCount > 0)
{
echo "