function addToMailingList($prefix,$email,$sId)
{
$sql="SELECT email FROM ".$prefix."_newsletterRecipients WHERE email='".$email."' AND sId='".$sId."'";
$result=mysql_query($sql) or die("Selecting Email Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
}
else
{
$sql="INSERT INTO ".$prefix."_newsletterRecipients (email, sId) VALUES ('".$email."', '".$sId."')";
$result=mysql_query($sql) or die("Inserting Email Failed.
Permanent Error: " . mysql_error());
}
}
function getForm($prefix,$Id,$fieldName)
{
$sql="SELECT ".$fieldName." FROM ".$prefix."_forms WHERE formId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Form Field Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0 AND $field!="*")
{
$row=mysql_fetch_array($result);
return $row[$fieldName];
}
}
function getSiteVars($prefix)
{
$result=mysql_query("SELECT * FROM ".$prefix."_vars");
if($result AND mysql_num_rows($result)>0)
{
while($row=mysql_fetch_array($result))
{
$_SESSION['global'][$row['var_name']]=$row['var_val'];
}
}
}
/*
function getSiteSeo($prefix)
{
$result=mysql_query("SELECT * FROM ".$prefix."_seo");
if($result AND mysql_num_rows($result)>0)
{
while($row=mysql_fetch_array($result))
{
$_SESSION['seo'][$row['seo_name']]=$row['seo_val'];
}
}
}
*/
function getSiteSeo($prefix, $site2manage)
{
$result=mysql_query("SELECT * FROM ".$prefix."_seo WHERE website='".$site2manage."'");
if($result AND mysql_num_rows($result)>0)
{
while($row=mysql_fetch_array($result))
{
$_SESSION['seo'][$row['seo_name']]=$row['seo_val'];
}
}
}
function listSiteGalleries($prefix,$siteId)
{
$sql="SELECT * FROM ".$prefix."_galleries WHERE siteId = '$siteId' AND visible='1'";
$result=mysql_query($sql) or die("Selecting Galleries Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="
";
while($row=mysql_fetch_array($result))
{
if($row['galleryPic']) $thumbPic=$row['galleryPic'];
if(!$row['galleryPic']) $thumbPic="noThumb.gif";
if($siteId)
{
$htmlCode.="";
}
else
{
$htmlCode.="";
}
}
$htmlCode.="
";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $htmlCode;
}
function listGalleries($prefix,$a)
{
$sql="SELECT * FROM ".$prefix."_galleries WHERE galleryId LIKE '$a' AND visible='1'";
$result=mysql_query($sql) or die("Selecting Galleries Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
while($row=mysql_fetch_array($result))
{
if($row['galleryPic']) $thumbPic=$row['galleryPic'];
if(!$row['galleryPic']) $thumbPic="noThumb.gif";
if($a=="%")
{
$htmlCode.="";
}
else
{
$htmlCode.="";
}
}
$htmlCode.="
";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $htmlCode;
}
function getGalleryField($prefix,$Id,$fieldName)
{
$sql="SELECT ".$fieldName." FROM ".$prefix."_galleries WHERE galleryId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Field Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0 AND $field!="*")
{
$row=mysql_fetch_array($result);
return $row[$fieldName];
}
}
function getPicField($prefix,$Id,$fieldName)
{
$sql="SELECT ".$fieldName." FROM ".$prefix."_galleryPics WHERE picId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Pic Field Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0 AND $field!="*")
{
$row=mysql_fetch_array($result);
return $row[$fieldName];
}
}
/*
function getGalleryPics($prefix,$Id,$a)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$javaScript="";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $javaScript.$htmlCode;
}
*/
function getgallerystyle($prefix,$Id)
{
$sql="SELECT galleryStyle FROM ".$prefix."_galleries WHERE galleryId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Style Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$row=mysql_fetch_array($result);
return $row['galleryStyle'];
}
}
function getGalleryPics1($prefix,$Id,$a)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
$i=0;
while($row=mysql_fetch_array($result))
{
$htmlCode.="
![\"".base64_decode($row['picTitle'])."\" \"".base64_decode($row['picTitle'])."\"](gallery/".$galleryLocation."/thumbs/".$row[)
\n\n";
if($i==6)
{
$htmlCode.="
";
$i=-1;
}
$i++;
}
$htmlCode.="
";
$javaScript.="";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $javaScript.$htmlCode;
}
function getGalleryPics2($prefix,$Id,$a)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
$i=0;
while($row=mysql_fetch_array($result))
{
$htmlCode.="
![\"".base64_decode($row['picTitle'])."\" \"".base64_decode($row['picTitle'])."\"](gallery/".$galleryLocation."/thumbs/".$row[)
\n\n";
// $htmlCode.="
![\"".base64_decode($row['picTitle'])."\" \"".base64_decode($row['picTitle'])."\"](gallery/".$galleryLocation."/thumbs/".$row[)
\n\n";
if($i==6)
{
$htmlCode.="
";
$i=-1;
}
$i++;
}
$htmlCode.="
";
$javaScript.="";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $javaScript.$htmlCode;
}
function picExist($prefix,$Id,$pId)
{
$galleryLocation=getGalleryField($prefix,base64_encode($Id),"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".$Id."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
$i=0;
while($row=mysql_fetch_array($result))
{
$pic[$i]=$row['picFile'];
$picId[$i]=$row['picId'];
$picTitle[$i]=$row['picTitle'];
$picDescription[$i]=$row['picDescription'];
$i++;
}
for($j=0;$j<$i;$j++)
{
if($pId==$picId[$j])
{
if(($j-1)>=0)$htmlCodePrev="

";
if($j+1<$i) $htmlCodeNext="

";
$htmlCode="
| $htmlCodePrev | ";
if($picTitle[$j]) $htmlCode.=base64_decode($picTitle[$j])." ";
if(!$picTitle[$j]) $htmlCode.=" ";
$htmlCode.=" ";
if($picDescription[$j]) $htmlCode.=str_replace("\r"," ",$picDescription[$j])." ";
$htmlCode.=" | $htmlCodeNext |
";
return $htmlCode;
}
}
}
}
function galleryExist($prefix,$Id)
{
return getGalleryField($prefix,base64_encode($Id),"galleryLocation");
}
function getGalleryPics3($prefix,$Id,$a)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
$i=0;
while($row=mysql_fetch_array($result))
{
$htmlCode.="
![\"".base64_decode($row['picTitle'])."\" \"".base64_decode($row['picTitle'])."\"](gallery/".$galleryLocation."/thumbs/".$row[)
\n\n";
if($i==6)
{
$htmlCode.="
";
$i=-1;
}
$i++;
}
$htmlCode.="
";
$javaScript.="";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $javaScript.$htmlCode;
}
function getGalleryScroll($prefix,$Id,$pId)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
$i=0;
while($row=mysql_fetch_array($result))
{
if($row['picId']==base64_decode($pId))
{
$current=$i;
}
$picId[$i]=$row['picId'];
$picFile[$i]=$row['picFile'];
$picTitle[$i]=$row['picTitle'];
$i++;
}
if(($current-2)==-2) {$q=0; $w=$current+4;}
else if(($current-2)==-1) {$q=0; $w=$current+3;}
else {$q=$current-2; $w=$current+2;}
for($j=$q;$j<=$w;$j++)
{
if($picId[$j]) $htmlCode.="
![\"".base64_decode($picTitle[$j])."\" \"".base64_decode($picTitle[$j])."\"](gallery/".$galleryLocation."/thumbs/".$picFile[$j].")
\n\n";
}
$htmlCode.="
";
}
else
{
$htmlCode="
There are no pictures to list!";
}
return $htmlCode;
}
function getMainPic($prefix,$Id,$pId)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE picId='".base64_decode($pId)."'";
$result=mysql_query($sql) or die("Selecting Gallery Main Picture Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$row=mysql_fetch_array($result);
{
$path="gallery/".$galleryLocation."/fullsize/".$row['picFile'];
@list($width, $height) = getimagesize($path);
if(!file_exists($path))
{
$path="gallery/pics/nothumb.gif";
@list($width, $height) = getimagesize($path);
}
$htmlCode.="
";
}
}
else
{
$htmlCode="
Core Error. Please restart application!
";
}
return $htmlCode;
}
function XgetGalleryPics($prefix,$Id,$a)
{
$galleryLocation=getGalleryField($prefix,$Id,"galleryLocation");
$sql="SELECT * FROM ".$prefix."_galleryPics WHERE gId='".base64_decode($Id)."'";
$result=mysql_query($sql) or die("Selecting Gallery Pictures Failed.
Permanent Error: " . mysql_error());
if ($result AND mysql_num_rows($result)>0)
{
$htmlCode="";
$i=0;
while($row=mysql_fetch_array($result))
{
$htmlCode.="

\n\n";
if($i==6)
{
$htmlCode.="
";
$i=-1;
}
$i++;
}
$htmlCode.="
";
$javaScript.="";
}
else
{
$htmlCode="
There are no galleries created yet!";
}
return $javaScript.$htmlCode;
}
function makeTimeFriendly($login_date,$x)
{
$months="|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec";
// $months="|January|February|March|April|May|June|July|August|September|October|November|December";
$months=explode("|",$months);
$btime=localtime($login_date);
$month=$btime[4]+1;
$year=$btime[5]+1900;
if($btime[2]<10) {$hour="0".$btime[2];$ampm=" AM";}
if($btime[2]==10) {$hour=$btime[2];$ampm=" AM";}
if($btime[2]==11) {$hour=$btime[2];$ampm=" AM";}
if($btime[2]==12) {$hour=$btime[2];$ampm=" AM";}
if($btime[2]>12) {$hour=$btime[2]-12;$ampm=" PM";}
if($hour<10 AND $ampm==" PM") $hour="0".$hour;
if($btime[1]<10) $minute="0".$btime[1];
if($btime[1]>=10) $minute=$btime[1];
if($x==1) return $btime[3].".".$months[$month].".".$year." / ".$hour.":".$minute.$ampm;
if($x==2) return $btime[3].".".$months[$month].".".$year;
if($x==3) return chr(36)."month=".$month.";".chr(36)."day=".$btime[3].";".chr(36)."year=".$year.";";
if($x==4) return $months[$month].".".$btime[3].".".$year." / ".$hour.":".$minute.$ampm;
if($x==5) return $months[$month].".".$btime[3].".".$year;
}
?>