File: /home/thehunarfound/www/sms/lib/bkp_functions.php
<?php
// get admin email address
function getAdminEmail()
{
$admin_email = "imran.ali@knzbrokers.com";
//$admin_email = "jahmed.ansari@gmail.com";
//$admin_email = "mansooralam87@gmail.com";
return $admin_email;
}
// get from email, using in email
function getFromEmail()
{
$from_email = "support@supergized.com";
return $from_email;
}
// get from name, using in email
function getFromName()
{
$from_name = "supergized.com";
return $from_name;
}
function getSite()
{
$site = "www.supergized.com";
//$site = "localhost/new-knz";
return $site;
}
function getSiteURL()
{
$url = "http://".getSite();
return $url;
}
function getHttpsURL()
{
$url = "https://".getSite();
return $url;
}
function getEmailStyle($msg)
{
// email style (fonts and bold font sizes, apply in whole email body material)
$email_style = "<span style='font:12px Verdana'>".$msg."</span>";
return $email_style;
}
function getEmailHeader()
{
//$header = "<br/><a href='".getSiteURL()."' target='_blank'><img src='".getSiteURL()."/images/top.jpg' alt='.' border='0'></a><br/><br/>";
return $header;
}
function getEmailFooter()
{
return $footer;
}
function sendEmail($email, $subject, $message, $applystyle=1, $cc="")
{
$from_name = getFromName();
$from_email = getFromEmail();
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$from_name." <".$from_email.">" . "\r\n";
if(!empty($cc))
{
$headers .= "Cc: $cc" . "\r\n";
}
$message = getEmailHeader().$message.getEmailFooter();
if($applystyle == 1)
{
$message = getEmailStyle($message);
}
@mail($email, $subject, $message, $headers);
}
function getLiveHostID()
{
$id=1;
return $id;
}
function getLiveAdvertiseID()
{
$id=2;
return $id;
}
function getLiveNewsletterID()
{
$id=3;
return $id;
}
?>
<?php
function getDefaultTitle($i=1)
{
$title="Your Content Title$i";
return $title;
}
function getDefaultTitle_es($i=1)
{
$title="Su Titulo Contenido$i";
return $title;
}
function getDefaultContents()
{
$contents="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
return $contents;
}
function getAgentConfigValue($configItem,$template_id)
{
global $db;
$sql="SELECT config_value FROM sg_templates_config WHERE config_item='$configItem' AND template_id='$template_id' ";
$rsConfigItem= $db->ExecuteQuery($sql);
list($config_value)=$rsConfigItem->FetchAsArray();
return $config_value;
}
function getOfficeConfigValue($configItem,$template_id)
{
global $db;
$sql="SELECT config_value FROM sg_templates_config WHERE config_item='$configItem' AND template_id='$template_id' ";
$rsConfigItem= $db->ExecuteQuery($sql);
list($config_value)=$rsConfigItem->FetchAsArray();
return $config_value;
}
function getDefaultNewsDesc()
{
$desc="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur aliquam purus nec nunc viverra laoreet. In hac habitasse platea dictumst. Donec ac magna ante. Vestibulum feugiat mi ut metus mattis lobortis. Aliquam placerat luctus purus, sit amet luctus dui imperdiet eu. Proin vulputate nibh convallis lorem dapibus ornare. Etiam porttitor tincidunt elementum. Aliquam porttitor ultrices nisi, id bibendum felis imperdiet sit amet. Ut ut velit condimentum leo gravida pellentesque sit amet vel mauris. Nunc eget mattis purus. Maecenas porta congue tincidunt. Etiam at nunc velit. Pellentesque quis volutpat turpis. Suspendisse vel tortor nec tortor fermentum viverra vitae vitae felis. Aenean laoreet, mauris ut aliquam vulputate, tellus risus luctus justo, eget venenatis purus dui quis erat. Phasellus placerat, ante ut suscipit mollis, mi orci commodo libero, nec pulvinar eros ante nec sem. Sed euismod, erat eget accumsan sollicitudin, arcu justo pellentesque elit, nec tempus purus turpis eu lacus.";
return $desc;
}
function getDefaultArticleDesc()
{
$desc="Lorem ipsum quisque sed mi lorem, ac convallis lectus. Duis iaculis nunc vitae lorem cursus ut vulputate lacus interdum. Mauris nulla tellus, auctor congue pretium at, tristique vel urna. Maecenas sit amet consequat odio. In scelerisque vehicula sagittis. Praesent interdum tellus nec sem tincidunt mattis. Sed blandit odio ut velit posuere id pellentesque est varius. Praesent at risus vitae est fringilla egestas. Phasellus dapibus tristique eleifend. Donec quis enim sed dui posuere porttitor. Donec in viverra turpis. Nam commodo leo quis turpis tempus fringilla. Aenean ullamcorper neque eget dui sodales cursus.";
return $desc;
}
function getDefaultTestimonialDesc()
{
$desc="Lorem ipsum duis scelerisque lobortis pulvinar. Phasellus rhoncus leo at est lobortis tincidunt. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec ligula velit, semper sed rhoncus scelerisque, volutpat et libero. Integer mi quam, sollicitudin sit amet adipiscing in, lobortis quis mi. Pellentesque in erat in lacus aliquam pulvinar. Fusce venenatis nulla eget nisl semper aliquet. Aliquam erat volutpat. Morbi congue lorem ut risus ultricies posuere. Fusce auctor, leo eget condimentum facilisis, quam metus porttitor risus, laoreet luctus dolor felis a ipsum. Nullam tincidunt lacus eget ipsum pellentesque ut cursus ipsum vulputate. Proin semper, turpis at aliquam pretium, ipsum risus ornare libero, id lobortis magna augue et sapien. Morbi eget tortor nunc, a eleifend nisl.";
return $desc;
}
function getDefaultPropertyDesc()
{
$desc="Lorem ipsum consectetur adipiscing elit. Nunc mattis mi massa. Proin et ligula ipsum, ut feugiat ipsum. Duis posuere consectetur aliquam. Aliquam convallis lacinia eros at mattis. Suspendisse consectetur, felis in iaculis auctor, nisi elit tristique turpis, nec aliquet diam metus ut massa. Donec id dapibus quam. Vestibulum vestibulum viverra justo, vitae accumsan neque viverra eu. Aenean hendrerit gravida lacus at porttitor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin mi eros, cursus vitae volutpat sit amet, venenatis a velit. Sed iaculis, augue vel pellentesque congue, elit leo commodo felis, nec consequat magna erat eget orci. Fusce vulputate vehicula ullamcorper. Praesent eleifend nulla non velit pretium ut eleifend tellus tincidunt. Sed vehicula tincidunt diam, et iaculis mi hendrerit quis. Suspendisse potenti. Ut auctor nunc nec diam ullamcorper viverra. Vivamus blandit urna faucibus massa viverra congue eget dictum est. Donec convallis lobortis lobortis.";
return $desc;
}
function getDefaultContract()
{
$contents="Contractor agrees to work for the Broker as an Independent Contractor, and not as an employee. However, Contractor understands that Broker may be legally responsible and/or liable for the acts and/or omissions of the Contractor, whether intentional or unintentional. All costs, obligations, fines, penalties, liens, judgments and sums levied against or incurred by Contractor in conducting his/her independent business shall be paid solely by Contractor, who will indemnify, defend and hold Broker harmless from any and all costs and obligations. If Broker incurs any legal fees or costs related to Contractors acts and/or omissions, Contractor shall be liable to Broker for same. Contractor will act independently as to the management of his/her time and efforts, and will be responsible for timely payment of all of his/her own expenses, such as industry association dues, licensing renewals, pagers, cellular telephones, etc., as they are incurred. It is expressly understood by the Parties that Broker is not responsible for payment of any such expenses of Contractor.</p>
<p>Contractor understands and agrees that, because Contractor is an Independent Contractor and not an employee of Broker, Broker will not withhold any Federal or State Income Tax, Social Security (FICE) or pay any Federal and State Income taxes to such governmental agency as might otherwise be required. Social Security and other taxes, and for maintaining all expense records as required by law, and represents to Broker that all such amounts will be withheld and paid when due. Contractor shall indemnify, defend and hold Broker harmless from any liability or costs thereof. Contractor further understands and acknowledges that Broker provides NO Workman's Compensation coverage, as Contractor is not an employee of Broker. Contractor hereby specifically waives such coverage and represents to Broker that he/she understands that, if Contractor desires such coverage, Contractor must personally obtain such coverage directly from the State of Florida or an insurance carrier of Contractor's choice, at Contractor's sole expense.";
return $contents;
}
?>
<?php function getFileExtension($filename){
return substr($filename, strrpos($filename, '.'));
}
function generatecode($length=6, $strength=3) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength & 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength & 2) {
$vowels .= "AEUY";
}
if ($strength & 4) {
$consonants .= '23456789';
}
if ($strength & 8) {
$consonants .= '@#$%';
}
$code = '';
$alt = time() % 2;
for ($i = 0; $i < $length; $i++) {
if ($alt == 1) {
$code .= $consonants[(rand() % strlen($consonants))];
$alt = 0;
} else {
$code .= $vowels[(rand() % strlen($vowels))];
$alt = 1;
}
}
return $code;
}
function getSection($id, $selected="", $show_all="", $action="",$class_style="")
{
global $db;
$null_msg = "Select";
if($show_all == "show_all")
{
$null_msg = "Any";
}
if(!empty($class_style))
$class_style="class='$class_style'";
?>
<select name="<?php echo $id?>" id="<?php echo $id?>" <?php echo $action?> <?php echo $class_style?> >
<option value=""><?php echo $null_msg?></option>
<?php $sql = "select property_section_type, website from sg_property_section_types ORDER BY property_section_type ASC ";
$rs = $db->ExecuteQuery($sql);
while(list($property_section_type,$website)=$rs->FetchAsArray())
{
?><option value="<?php echo $property_section_type?>" <?php if($selected == $property_section_type){ echo "selected";} ?>><?php echo $website; ?></option><?php }
?>
</select>
<?php
}
function getLanguage($id, $selected="", $show_all="", $action="",$class_style="")
{
global $db;
$null_msg = "Select Language";
if($show_all == "show_all")
{
$null_msg = "Any";
}
if(!empty($class_style))
$class_style="class='$class_style'";
?>
<select name="<?php echo $id?>" id="<?php echo $id?>" <?php echo $action?> <?php echo $class_style?> >
<option value=""><?php echo $null_msg?></option>
<?php
$sql = "select lang_id, language from sg_agent_language ORDER BY language ASC ";
$rs = $db->ExecuteQuery($sql);
while(list($lang_id, $language)=$rs->FetchAsArray())
{
?><option value="<?php echo $lang_id?>" <?php if($lang_id == '30'){?> selected="selected"<?php }?>><?php echo $language; ?></option><?php
}
?>
</select>
<?php
}
function getBelongTo($id, $selected="", $show_all="", $action="",$class_style="")
{
global $db;
$null_msg = "Select";
if($show_all == "show_all")
{
$null_msg = "Any";
}
if(!empty($class_style))
$class_style="class='$class_style'";
?>
<select name="<?php echo $id?>" id="<?php echo $id?>" <?php echo $action?> <?php echo $class_style?> >
<option value=""><?php echo $null_msg?></option>
<option value="NAR" <?php if($belongto == 'NAR'){?> selected="selected"<?php }?>><?php echo "National Association of Realtors"; ?></option>
<option value="MLS" <?php if($belongto == 'MLS'){?> selected="selected"<?php }?>><?php echo "MLS"; ?></option>
</select>
<?php
}
function getState($id, $selected="", $show_all="", $action="",$class_style="")
{
global $db;
$null_msg = "Select State";
if($show_all == "show_all")
{
$null_msg = "Any";
}
if(!empty($class_style))
$class_style="class='$class_style'";
?>
<select name="<?php echo $id?>" id="<?php echo $id?>" <?php echo $action?> <?php echo $class_style?> >
<option value=""><?php echo $null_msg?></option>
<?php $sql = "select Stateid, StateName from sg_state where country_id='1' order by StateName asc ";
$rs = $db->ExecuteQuery($sql);
while(list($Stateid, $StateName)=$rs->FetchAsArray())
{
?><option value="<?php echo $Stateid?>" <?php if($selected==$Stateid) { echo "selected"; }?>><?php echo $StateName?></option><?php }
?>
</select>
<?php
}
function getCountry($id, $selected="", $show_all="", $action="",$class_style="")
{
global $db;
$null_msg = "Select Country";
if($show_all == "show_all")
{
$null_msg = "Any";
}
if(!empty($class_style))
$class_style="class='$class_style'";
?>
<select name="<?php echo $id?>" id="<?php echo $id?>" <?php echo $action?> <?php echo $class_style?> >
<option value=""><?php echo $null_msg?></option>
<?php $sql = "select id, country_".$_SESSION['sg_lang']." from sg_country ";
$rs = $db->ExecuteQuery($sql);
while(list($id, $country)=$rs->FetchAsArray())
{
?><option value="<?php echo $id?>" <?php if($id==1)echo "selected";?>><?php echo $country?></option><?php }
?>
</select>
<?php }
function getOfficeCountry($id, $selected="", $show_all="", $action="",$class_style="")
{
global $db;
$null_msg = "Select Country";
if($show_all == "show_all")
{
$null_msg = "Any";
}
if(!empty($class_style))
$class_style="class='$class_style'";
?>
<select name="<?php echo $id?>" id="<?php echo $id?>" <?php echo $action?> <?php echo $class_style?> >
<option value=""><?php echo $null_msg?></option>
<?php $sql = "select id, country from sg_country ORDER BY id ";
$rs = $db->ExecuteQuery($sql);
while(list($id, $country)=$rs->FetchAsArray())
{
?><option value="<?php echo $id?>" selected="selected"><?php echo $country?></option><?php }
?>
</select>
<?php }
function str_rand($length = 8, $seeds = 'alphanum')
{
// Possible seeds
$seedings['alpha'] = 'abcdefghijklmnopqrstuvwqyz';
$seedings['numeric'] = '123456789';
$seedings['alphanum'] = 'abcdefghijklmnopqrstuvwqyz123456789';
$seedings['hexidec'] = '123456789abcdef';
// Choose seed
if (isset($seedings[$seeds]))
{
$seeds = $seedings[$seeds];
}
// Seed generator
list($usec, $sec) = explode(' ', microtime());
$seed = (float) $sec + ((float) $usec * 100000);
mt_srand($seed);
// Generate
$str = '';
$seeds_count = strlen($seeds);
for ($i = 0; $length > $i; $i++)
{
$str .= $seeds{mt_rand(0, $seeds_count - 1)};
}
return $str;
}
function getLinkFormat($link="")
{
$link = str_replace("http://", "", $link);
$link = str_replace("https://", "", $link);
$link ="http://".$link;
return $link;
}
function getListenPopupSize()
{
//width, height, left, top
$size = "450, 200, 300, 150";
return $size;
}
function getShowFileLimit()
{
$limit = 4;
return $limit;
}
function getPageID($idfor="")
{
$pgid=0;
if($idfor == "home")
{
$pgid=1;
}
elseif($idfor == "aboutourshow")
{
$pgid=2;
}
elseif($idfor == "yourhost")
{
$pgid=3;
}
elseif($idfor == "upcomingshows")
{
$pgid=4;
}
elseif($idfor == "pastshows")
{
$pgid=5;
}
elseif($idfor == "resourcelink")
{
$pgid=6;
}
elseif($idfor == "news")
{
$pgid=7;
}
elseif($idfor == "advertisewithus")
{
$pgid=8;
}
elseif($idfor == "searchshows")
{
$pgid=9;
}
return $pgid;
}
function getExtension($str)
{
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
function price_format($price)
{
$price = sprintf("%01.2f", $price);
return $price;
}
function getTotalAgents()
{
global $db;
$sql = "SELECT count(agent_id) FROM sg_agents";
$rs = $db->ExecuteQuery($sql);
list($total_agents)=$rs->FetchAsArray();
$total_agents = number_format($total_agents);
return $total_agents;
}
function getTotalOffices()
{
global $db;
$sql = "SELECT count(office_id) FROM sg_offices";
$rs = $db->ExecuteQuery($sql);
list($total_offices)=$rs->FetchAsArray();
$total_offices = number_format($total_offices);
return $total_offices;
}
function getAgentName($agent_id)
{
global $db;
$fullname="";
$sql = "SELECT first_name, last_name FROM sg_agents where agent_id='$agent_id'";
$rs = $db->ExecuteQuery($sql);
list($first_name, $last_name)=$rs->FetchAsArray();
$fullname = ucfirst($first_name)." ".$last_name;
return $fullname;
}
function getOfficeName($office_id)
{
global $db;
$fullname="";
$sql = "SELECT first_name, last_name FROM sg_offices where office_id='$office_id'";
$rs = $db->ExecuteQuery($sql);
list($first_name, $last_name)=$rs->FetchAsArray();
$fullname = ucfirst($first_name)." ".$last_name;
return $fullname;
}
function getAgentWebsiteID($agent_id)
{
global $db;
$sql = "SELECT agent_section_type FROM sg_agents where agent_id='$agent_id'";
$rs = $db->ExecuteQuery($sql);
list($agent_section_type)=$rs->FetchAsArray();
return $agent_section_type;
}
function getOfficeWebsiteID($office_id)
{
global $db;
$sql = "SELECT office_section_type FROM sg_offices where office_id='$office_id'";
$rs = $db->ExecuteQuery($sql);
list($office_section_type)=$rs->FetchAsArray();
return $office_section_type;
}
function getSupergizedPlan($agent_plan_id)
{
global $db;
$sql = "SELECT plan"."_".$_SESSION["sg_lang"]. " FROM sg_plans where id ='$agent_plan_id'";
$rs = $db->ExecuteQuery($sql);
list($plan_name)=$rs->FetchAsArray();
return $plan_name;
}
function getCityName($city_id)
{
global $db;
$sql = "SELECT city FROM sg_city where city_id='$city_id'";
$rs = $db->ExecuteQuery($sql);
list($city)=$rs->FetchAsArray();
return $city;
}
function getStateName($state_id)
{
global $db;
$sql = "SELECT StateName_".$_SESSION['sg_lang']." FROM sg_state where Stateid='$state_id' order by StateName_".$_SESSION['sg_lang']." asc";
$rs = $db->ExecuteQuery($sql);
list($StateName)=$rs->FetchAsArray();
return $StateName;
}
function getCountryName($country_id)
{
global $db;
$sql = "SELECT country_".$_SESSION['sg_lang']." FROM sg_country where id='$country_id'";
$rs = $db->ExecuteQuery($sql);
list($country)=$rs->FetchAsArray();
return $country;
}
function getAccountFee()
{
global $db;
$sql = "SELECT fee_amount FROM sg_subscription_fee where fee_id='1'";
$rs = $db->ExecuteQuery($sql);
list($account_fee)=$rs->FetchAsArray();
return $account_fee;
}
function getResidentailPropertyType($property_type_id)
{
global $db;
$sql = "SELECT property"."_".$_SESSION["sg_lang"]. " FROM sg_property_type where property_id='$property_type_id'";
$rs = $db->ExecuteQuery($sql);
list($property)=$rs->FetchAsArray();
return $property;
}
function getCommercialPropertyType($property_type_id)
{
global $db;
$sql = "SELECT property"."_".$_SESSION["sg_lang"]. " FROM sg_comm_prop_type where property_id='$property_type_id'";
$rs = $db->ExecuteQuery($sql);
list($property)=$rs->FetchAsArray();
return $property;
}
function getBusinessType($business_id)
{
global $db;
$sql = "SELECT business_type"."_".$_SESSION["sg_lang"]. " FROM sg_business_type where business_id='$business_id'";
$rs = $db->ExecuteQuery($sql);
list($business_type)=$rs->FetchAsArray();
return $business_type;
}
function getAgentDomainName($agent_id)
{
global $db;
$domain_name="";
$sql = "SELECT subdomain_name FROM sg_agents where agent_id='$agent_id'";
$rs = $db->ExecuteQuery($sql);
list($subdomain_name)=$rs->FetchAsArray();
return $subdomain_name;
}
function getAgentWebsiteUrl($agent_id)
{
global $db;
$url="";
$sql = "SELECT url FROM sg_agents where agent_id='$agent_id'";
$rs = $db->ExecuteQuery($sql);
list($url)=$rs->FetchAsArray();
return $url;
}
function getOfficeDomainName($office_id)
{
global $db;
$domain_name="";
$sql = "SELECT subdomain_name FROM sg_offices where office_id='$office_id'";
$rs = $db->ExecuteQuery($sql);
list($subdomain_name)=$rs->FetchAsArray();
return $subdomain_name;
}
function getOfficeWebsiteUrl($office_id)
{
global $db;
$url="";
$sql = "SELECT url FROM sg_offices where office_id='$office_id'";
$rs = $db->ExecuteQuery($sql);
list($url)=$rs->FetchAsArray();
return $url;
}
function getAgentAccountStatus($agent_id)
{
global $db;
$agent_account_status="";
$sql = "SELECT status FROM sg_agents where agent_id='$agent_id'";
$rs = $db->ExecuteQuery($sql);
list($agent_account_status)=$rs->FetchAsArray();
return $agent_account_status;
}
function getOfficeAccountStatus($office_id)
{
global $db;
$office_account_status="";
$sql = "SELECT status FROM sg_offices where office_id='$office_id'";
$rs = $db->ExecuteQuery($sql);
list($office_account_status)=$rs->FetchAsArray();
return $office_account_status;
}
function getWebsiteType($id)
{
global $db;
$sql = "SELECT website"."_".$_SESSION["sg_lang"]. " FROM sg_property_section_types where property_section_type='$id'";
$rs = $db->ExecuteQuery($sql);
list($website)=$rs->FetchAsArray();
return $website;
}
function getMonthName($exp_month)
{
if($exp_month == "1")
{
$month = "January";
}
elseif($exp_month == "2")
{
$month = "February";
}
elseif($exp_month == "3")
{
$month = "March";
}
elseif($exp_month == "4")
{
$month = "April";
}
elseif($exp_month == "5")
{
$month = "May";
}
elseif($exp_month == "6")
{
$month = "June";
}
elseif($exp_month == "7")
{
$month = "July";
}
elseif($exp_month == "8")
{
$month = "August";
}
elseif($exp_month == "9")
{
$month = "September";
}
elseif($exp_month == "10")
{
$month = "October";
}
elseif($exp_month == "11")
{
$month = "November";
}
elseif($exp_month == "12")
{
$month = "December";
}
return $month;
}
function getIDForModule($module_id)
{
if($module_id == "7")
{
$column_name = "news_id";
}
elseif($module_id == "8")
{
$column_name = "article_id";
}
elseif($module_id == "21")
{
$column_name = "testimonial_id";
}
elseif($module_id == "28")
{
$column_name = "rep_id";
}elseif($module_id == "29")
{
$column_name = "doc_id";
}elseif($module_id == "11")
{
$column_name = "f_property_id";
}elseif($module_id == "30" || $module_id == "10")
{
$column_name = "hot_property_id";
}
return $column_name;
}
function makeSafe($value) {
$value=trim($value);
$value = htmlentities($value, ENT_QUOTES,"UTF-8");
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
$value = strip_tags($value);
$value = str_replace("\r\n", "", $value);
return $value;
}
function makeClean($value) {
$value=trim($value);
$value = htmlentities($value, ENT_QUOTES,"UTF-8");
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$value = strip_tags($value);
$value = str_replace("\r\n", "", $value);
return $value;
}
// this function will return layout list//
function getTemplateLayout($id,$default_val,$selectedID)
{
global $db;
$sql="SELECT template_id, title FROM sg_layouts";
$rs = $db->ExecuteQuery($sql);
?>
<select id="<?php echo $id;?>" name="<?php echo $id;?>">
<option value="">--Select Layout--</option>
<?php while(list($template_id,$title)=$rs->FetchAsArray())
{?>
<option value="<?php echo $template_id;?>" <?php if($template_id==$selectedID)echo "Selected";?> ><?php echo $title;?> </option>
<?php }?>
</select>
<?php }
?>
<?php
function dateconvert($date,$func) {
if ($func == 1){ //insert conversion
list($day, $month, $year) = split('[/.-]', $date);
$date = "$year-$month-$day";
return $date;
}
if ($func == 2){ //output conversion
list($d_arr, $t_arr) = explode(' ', $date);
list($year, $month, $day) = explode('-', $d_arr);
$date = "$day/$month/$year";
return $date;
}
}
?>
<?php
function getSectionItems($id,$default_val,$selectedIDs_arr,$section="")
{
global $db;
global $arr_item_order;
$sql="SELECT section_item_id, title FROM sg_section_items ORDER BY title ASC";
$rs = $db->ExecuteQuery($sql);
?>
<?php while(list($section_item_id,$title)=$rs->FetchAsArray())
{?>
<input type="checkbox" value="<?php echo $section_item_id;?>"
id="<?php echo $id;?>[]" name="<?php echo $id;?>[]" <?php if(is_array($selectedIDs_arr) && in_array($section_item_id,$selectedIDs_arr))
echo "checked"; ?> OnChange="ShowHideSubItems(<?php echo $section_item_id;?>,<?php echo $section;?>)" > <?php echo $title;?>
<?php if($section==2 || $section==3 || $section==4 ){?>
<div align="right">
<input <?php if(is_array($selectedIDs_arr) && in_array($section_item_id,$selectedIDs_arr)){ ?>
value="<?php echo $arr_item_order[$section_item_id]?>" <?php }?> type="text"
size="2" name="order_<?php echo $section_item_id;?>_<?php echo $section;?>"/>
</div><?php }else echo "<br>";?>
<?php switch($section_item_id)
{
case 1: // for knz logo
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==1)
{?>
Default Image <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }elseif($config_id==2)
{?>
Height <input size="3" type="text" name="<?php echo $config_item;?>_<?php echo $section?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }elseif($config_id==3)
{?>
Width <input size="3" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 1 for KNZ logo
break;
?>
<?php case 2: // for agent name
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==17)
{?>
Default Name <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php } ?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 2 for Agent Name
break;
?>
<?php case 3: // for search form
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==12)
{?>
Style1 <input size="10" <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />
Style2 <input size="10" <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />
Style3 <input size="10" <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />
<?php } ?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 3 for search form
break;
?>
<?php case 4:
global $templateID;
$sql="SELECT social_media_id FROM sg_template_social_medias WHERE template_id='$templateID' AND section_id='$section'";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$arr_social_items="";
while(list($social_media_id)=$rs_detail->FetchAsArray())
{
$arr_social_items[]=$social_media_id;
}
$sql="SELECT social_media_id, social_media, link, default_selected,status FROM sg_social_medias ";
$rs_detail = $db->ExecuteQuery($sql);
?>
<p align="right"><div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(is_array($arr_social_items)){?> style="display:block" <?php }else {?>style="display:none" <?php }?>>
<?php while(list( $social_media_id, $social_media, $link, $default_selected, $status )=$rs_detail->FetchAsArray())
{?>
<input type="checkbox" value="<?php echo $social_media_id;?>"
id="<?php echo $social_media_id;?>" name="social_media_ids_<?php echo $section;?>[]"
<?php if(is_array($arr_social_items) && in_array($social_media_id,$arr_social_items))
{
echo "checked";
}
?> > <?php echo $social_media;?>
<?php } // end of inner while loop ?>
</div>
</p>
<?php
}
else
{
?>
<?php
$sql="SELECT social_media_id, social_media, link, default_selected,status FROM sg_social_medias ";
$rs_detail = $db->ExecuteQuery($sql);
?>
<p align="right"><div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' style="display:none">
<?php while(list( $social_media_id, $social_media, $link, $default_selected, $status )=$rs_detail->FetchAsArray())
{?>
<input type="checkbox" value="<?php echo $social_media_id;?>"
id="<?php echo $social_media_id;?>" name="social_media_ids_<?php echo $section;?>[]"
<?php if($default_selected==1)
{
echo "checked";
}
?> > <?php echo $social_media;?>
<?php } // end of inner while loop ?>
</div>
</p>
<?php } // end of else
break; //
?>
<?php case 6: // for agent slogon
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==18)
{?>
Default Name <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php } ?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 2 for agent slogan
break;
?>
<?php case 7: // for news module
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==14)
{?>
<br /><input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />Title Only <br />
<input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />Title & Description <br />
<input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />Full Detail <br />
<?php }elseif($config_id==28){ ?>
No Of News <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value?>" /><?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 7 for news
break;
?>
<?php case 8: // for article module
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==16)
{?>
<br /><input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />Image & Description <br />
<input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />Title & Description <br />
<input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />Title Only <br />
<?php }elseif($config_id==27){ ?>
No Of Article <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value?>" /> <?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 8 for articles
break;
?>
<?php case 10: // for latest offer module
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==10)
{?>
<br /><input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />Images Only <br />
<input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />Image & Description <br />
<input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />Image & Details <br />
<?php }elseif($config_id==25){ ?>
No Of Latest offer <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value?>" /> <?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 10 for latest offer
break;
?>
<?php case 11: // for featured offer module
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==9)
{?>
<br /><input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />Images Only <br />
<input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />Image & Description <br />
<input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />Image & Details <br />
<?php }elseif($config_id==24){ ?>
No Of Featured Properties <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 11 for featured property
break;
?>
<?php case 13: // for agent image
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==4)
{?>
Default Image <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }elseif($config_id==5)
{?>
Height <input size="3" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }elseif($config_id==6)
{?>
Width <input size="3" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end for agent image
break;
?>
<?php case 16: // for primary menu
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==19)
{?>
Style1 <input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />
Style2 <input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />
Style3 <input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />
<?php } ?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 16 for primary menu
break;
?>
<?php case 17: // for secondary menu
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==20)
{?>
Horizontal <input <?php if($config_value=='H')echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="H" />
Vertical <input <?php if($config_value=='V')echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="V" />
<?php } ?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 17 for secondary menu
break;
?>
<?php case 20: // for banner image
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==21)
{?>
Default Image <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }elseif($config_id==22)
{?>
Height <input size="3" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }elseif($config_id==23)
{?>
Width <input size="3" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value;?>" />
<?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end for banner image
break;
?>
<?php case 21: // for testimonial module
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==13)
{?>
<br /><input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />Image & Description <br />
<input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />Title & Description <br />
<input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />Title Only <br />
<?php }elseif($config_id==29){ ?>
No Of Testimonial <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value?>" /><?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 21 for testimonial
break;
?>
<?php case 26: // for hot offer module
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==11)
{?>
<br /><input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />Images Only <br />
<input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />Image & Description <br />
<input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />Image & Details <br />
<?php }elseif($config_id==26){ ?>
No Of Hot offer <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value?>" />
<?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 26 for latest offer
break;
?>
<?php case 25: // for contents
global $templateID;
$found=false;
if(isset($templateID))
{
$sql="SELECT config_id, config_item, config_value
FROM sg_templates_config
WHERE template_id='$templateID'
AND section_id='$section'
AND item_id=$section_item_id
";
$rs_detail = $db->ExecuteQuery($sql);
if($rs_detail->GetSelectedRows()>0)
{
$found=true;
}
else{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
}
else
{
$sql="SELECT config_id, config_item, config_value FROM sg_default_template_config WHERE item_id=$section_item_id";
$rs_detail = $db->ExecuteQuery($sql);
}
?>
<div id='items_details_<?php echo $section_item_id;?>_<?php echo $section;?>' <?php if(!$found)echo "style='display:none'"; else echo "style='display:block'";?> >
<?php while(list($config_id,$config_item,$config_value)=$rs_detail->FetchAsArray())
{ ?>
<?php if($config_id==7)
{?>
No Of Contents <input size="10" type="text" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="<?php echo $config_value?>" />
<?php }elseif($config_id==8){ ?>
Style1 <input <?php if($config_value==1)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="1" />
Style2 <input <?php if($config_value==2)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="2" />
Style3 <input <?php if($config_value==3)echo "checked";?> type="radio" name="<?php echo $config_item;?>_<?php echo $section;?>" id="<?php echo $config_item;?>" value="3" />
<?php }?>
<?php } //end of inner while loop?>
</div>
<?php
// end case 25 for contents
break;
?>
<?php } // end of switch
?>
<br /> <hr /><br /><br />
<?php } // end of main while loop
?>
<?php }
function getOfficeSectionId($page_id)
{
global $db;
$office_section=0;
if($page_id=="")
$page_id=110000;
$sql="SELECT `office_section` FROM `office_pages` WHERE `page_id` =".$page_id;
$rs=$db->ExecuteQuery($sql);
list($office_section)=$rs->FetchAsArray();
if ($office_section == "") {
$sql="SELECT `office_section` FROM `office_pages` WHERE `office_page_id` =".$page_id;
$rs=$db->ExecuteQuery($sql);
list($office_section)=$rs->FetchAsArray();
}
return $office_section;
}
function getNewsLetterMemberEmail($office_id)
{
global $db;
$sql="SELECT `email` FROM `sg_admin_newslettermembers` WHERE `newslettermember_id` =".$office_id;
$rs=$db->ExecuteQuery($sql);
list($member_email)=$rs->FetchAsArray();
return $member_email;
}
function countryCityFromIP($ipAddr)
{
//function to find country and city name from IP address
//Developed by Roshan Bhattarai
//Visit http://roshanbh.com.np for this script and more.
//verify the IP address for the
ip2long($ipAddr)== -1 || ip2long($ipAddr) === false ? trigger_error("Invalid IP", E_USER_ERROR) : "";
// This notice MUST stay intact for legal use
$ipDetail=array(); //initialize a blank array
//get the XML result from hostip.info
$xml = file_get_contents("http://api.hostip.info/?ip=".$ipAddr);
//get the city name inside the node <gml:name> and </gml:name>
preg_match("@<Hostip>(\s)*<gml:name>(.*?)</gml:name>@si",$xml,$match);
//assing the city name to the array
$ipDetail['city']=$match[2];
//get the country name inside the node <countryName> and </countryName>
preg_match("@<countryName>(.*?)</countryName>@si",$xml,$matches);
//assign the country name to the $ipDetail array
$ipDetail['country']=$matches[1];
//get the country name inside the node <countryName> and </countryName>
preg_match("@<countryAbbrev>(.*?)</countryAbbrev>@si",$xml,$cc_match);
$ipDetail['country_code']=$cc_match[1]; //assing the country code to array
//return the array containing city, country and country code
return $ipDetail;
}
//for encrypt or decrypt
//use same key for decryption
function convert($str,$ky='')
{
if($ky=='')return $str;
$ky=str_replace(chr(32),'',$ky);
if(strlen($ky)<8)exit('key error');
$kl=strlen($ky)<32?strlen($ky):32;
$k=array();for($i=0;$i<$kl;$i++){
$k[$i]=ord($ky{$i})&0x1F;}
$j=0;for($i=0;$i<strlen($str);$i++){
$e=ord($str{$i});
$str{$i}=$e&0xE0?chr($e^$k[$j]):chr($e);
$j++;$j=$j==$kl?0:$j;}
return $str;
}
function getFeatureName($feature_id)
{
global $db;
$sql="SELECT `feature` FROM `sg_features` WHERE `id` = '".$feature_id."' AND `status` = 'Active'";
$rs=$db->ExecuteQuery($sql);
list($feature)=$rs->FetchAsArray();
return $feature;
}
function getPlanName($plan_id)
{
global $db;
$sql="SELECT `plan_en` FROM `sg_plans` WHERE `status` = 'Active' AND `id` =".$plan_id;
$rs=$db->ExecuteQuery($sql);
list($plan_name)=$rs->FetchAsArray();
return $plan_name;
}
function getAgentPlanName($plan_id, $lang)
{
global $db;
$sql="SELECT plan_".$lang." FROM `sg_plans` WHERE `status` = 'Active' AND `id` =".$plan_id;
$rs=$db->ExecuteQuery($sql);
list($plan_name)=$rs->FetchAsArray();
return $plan_name;
}
function getFeatureConfiguration($feature_id,$plan_feature_id)
{
global $db;
// getting default values
$sql="SELECT id,config_item,default_value FROM `sg_features_config_item` WHERE `feature_id` =".$feature_id;
$rs=$db->ExecuteQuery($sql);
list($config_item_id,$config_item,$default_value)=$rs->FetchAsArray();
$sql_check="SELECT `cofig_value` FROM `sg_plans_features_configuration` WHERE `plan_feature_id` = '".$plan_feature_id."' AND `cofig_item_id` = '".$config_item_id."' AND STATUS = 'active'";
$rs=$db->ExecuteQuery($sql_check);
if(list($config_value)=$rs->FetchAsArray())
{
$result= $config_item."|".$config_value."|ConfigValue|".$config_item_id;
}
elseif($config_item_id!="")
{
$result= $config_item."|".$default_value."|DefaultValue|".$config_item_id;
}
else
{
$result=null;
}
$config=array("config_item"=>$config_item,"config_item_id"=>$config_item_id,"config_value"=>$config_value,"default_value"=>$default_value);
return $config;
//return $result;
}
function getAgentPlanId($agent_id)
{
global $db;
$sql="SELECT `agent_plan` FROM `sg_agents` WHERE `agent_id` = ".$agent_id;
$rs=$db->ExecuteQuery($sql);
list($plan_id)=$rs->FetchAsArray();
return $plan_id;
}
function getOfficePlanId($office_id)
{
global $db;
$sql="SELECT `office_plan` FROM `sg_offices` WHERE `office_id` = ".$office_id;
$rs=$db->ExecuteQuery($sql);
list($plan_id)=$rs->FetchAsArray();
return $plan_id;
}
function getPlanFeatureId($feature_for,$agent_plan_id,$feature_id)
{
global $db;
$sql="SELECT * FROM `sg_plans_features` WHERE `plan_id` = '".$agent_plan_id."' AND `feature_for` = '".$feature_for."' AND status='Active' AND `feature_id` =".$feature_id;
$rs=$db->ExecuteQuery($sql);
list($plan_feature_id)=$rs->FetchAsArray();
return $plan_feature_id;
}
function getFeatureConfigValue($plan_feature_id,$feature_id)
{
global $db;
$sql="SELECT `cofig_value` FROM `sg_plans_features_configuration` WHERE `plan_feature_id` ='".$plan_feature_id."'";
$rs=$db->ExecuteQuery($sql);
list($value)=$rs->FetchAsArray();
$sql="SELECT default_value FROM `sg_features_config_item` WHERE `feature_id` =".$feature_id;
$rs=$db->ExecuteQuery($sql);
list($def_value)=$rs->FetchAsArray();
if(empty($value))
return $def_value;
else
return $value;
}
function reDirectUsingJavascript($url)
{
?>
<script type="text/javascript" language="javascript">
window.location='<?php echo $url;?>';
</script>
<?php
}
function countryFirstOption($lang)
{
global $db;
$sql = "select id, country_".$lang." from sg_country where id=1";
$rs = $db->ExecuteQuery($sql);
list($id,$country)=$rs->FetchAsArray();
?>
<option value="<?php echo $id;?>" ><?php echo $country;?></option>
<?php
}
function countryFirstOptionSignup($lang, $country)
{
global $db;
$sql = "select id, country_".$lang." from sg_country where id=1";
$rs = $db->ExecuteQuery($sql);
list($id,$countryname)=$rs->FetchAsArray();
?>
<option value="<?php echo $id;?>" <?php if($id==$country) { echo "selected"; }?> ><?php echo $countryname;?></option>
<?php
}
function RandomValue()
{
$num1 = rand(100000, 999999);
$num2 = rand(1, 9);
$num = $num1 . $num2;
return $num;
}
function getAgentPlanPrice($agent_plan, $agent_section_type)
{
global $db;
if($agent_plan==1 && $agent_section_type!=3)
{
$sql="SELECT `agent_price` FROM `sg_plans` WHERE `id` =1";
//$plan_price = "29.99";
}elseif($agent_plan==2 && $agent_section_type!=3)
{
$sql="SELECT `agent_price` FROM `sg_plans` WHERE `id` =2";
//$plan_price = "49.99";
}elseif($agent_plan==1 && $agent_section_type==3)
{
$sql="SELECT `business_broker_price` FROM `sg_plans` WHERE `id` =1";
//$plan_price = "29.99";
}elseif($agent_plan==2 && $agent_section_type==3)
{
$sql="SELECT `business_broker_price` FROM `sg_plans` WHERE `id` =2";
//$plan_price = "49.99";
}elseif($agent_plan==3 && $agent_section_type!=3)
{
$sql="SELECT `agent_price` FROM `sg_plans` WHERE `id` =3";
//$plan_price = "49.99";
}elseif($agent_plan==4 && $agent_section_type!=3)
{
$sql="SELECT `agent_price` FROM `sg_plans` WHERE `id` =4";
//$plan_price = "49.99";
}
elseif($agent_plan==5 && $agent_section_type!=3)
{
$sql="SELECT `agent_price` FROM `sg_plans` WHERE `id` =5";
//$plan_price = "49.99";
}
$rs=$db->ExecuteQuery($sql);
list($plan_price)=$rs->FetchAsArray();
return $plan_price;
}
function BKPgetAgentPlanPrice($agent_plan, $agent_section_type)
{
global $db;
if($agent_plan==1 && $agent_section_type!=3)
{
$plan_price = "29.99";
}elseif($agent_plan==2 && $agent_section_type!=3)
{
$plan_price = "49.99";
}elseif($agent_plan==1 && $agent_section_type==3)
{
$plan_price = "29.99";
}elseif($agent_plan==2 && $agent_section_type==3)
{
$plan_price = "49.99";
}
return $plan_price;
}
function BestValuePlanPrice($agent_plan)
{
global $db;
if($agent_plan==1)
{
$plan_price = "199";
}elseif($agent_plan==2)
{
$plan_price = "249";
}
return $plan_price;
}
function BestValuePlanPriceExternalLink()
{
$plan_price = "149";
return $plan_price;
}
function spwebPrice()
{
$plan_price = "19.99";
return $plan_price;
}
function OneTimeSetUpFee()
{
$onetime_setupfee = "249.00";
return $onetime_setupfee;
}
function OneTimeSetUpFeeSingleProp()
{
$onetime_setupfee = "50.00";
return $onetime_setupfee;
}
function getOfficePlanPrice($office_plan, $no_of_agents)
{
global $db;
if($office_plan==1 && $no_of_agents==10)
{
$sql="SELECT `office_price_10_agents` FROM `sg_plans` WHERE `id` =1";
//$office_plan_price = "74.99";
}elseif($office_plan==2 && $no_of_agents==10)
{
$sql="SELECT `office_price_10_agents` FROM `sg_plans` WHERE `id` =2";
//$office_plan_price = "109.99";
}
if($office_plan==1 && $no_of_agents==25)
{
$sql="SELECT `office_price_25_agents` FROM `sg_plans` WHERE `id` =1";
//$office_plan_price = "74.99";
}elseif($office_plan==2 && $no_of_agents==25)
{
$sql="SELECT `office_price_25_agents` FROM `sg_plans` WHERE `id` =2";
//$office_plan_price = "109.99";
}
$rs=$db->ExecuteQuery($sql);
list($office_plan_price)=$rs->FetchAsArray();
return $office_plan_price;
}
function BKPgetOfficePlanPrice($office_plan, $office_section_type)
{
global $db;
if($office_plan==1)
{
$office_plan_price = "74.99";
}elseif($office_plan==2)
{
$office_plan_price = "109.99";
}
return $office_plan_price;
}
function dateDiff($start, $end) {
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
function getAgentOfficeId($agent_id)
{
global $db;
$sql="SELECT `office_id` FROM `sg_agents` WHERE `agent_id` = ".$agent_id;
$rs=$db->ExecuteQuery($sql);
list($office_id)=$rs->FetchAsArray();
return $office_id;
}
function getBrowser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
//First get the platform?
if (preg_match('/linux/i', $u_agent)) {
$platform = 'linux';
}
elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {
$platform = 'mac';
}
elseif (preg_match('/windows|win32/i', $u_agent)) {
$platform = 'windows';
}
// Next get the name of the useragent yes seperately and for good reason
if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))
{
$bname = 'Internet Explorer';
$ub = "MSIE";
}
elseif(preg_match('/Firefox/i',$u_agent))
{
$bname = 'Mozilla Firefox';
$ub = "Firefox";
}
elseif(preg_match('/Chrome/i',$u_agent))
{
$bname = 'Google Chrome';
$ub = "Chrome";
}
elseif(preg_match('/Safari/i',$u_agent))
{
$bname = 'Apple Safari';
$ub = "Safari";
}
elseif(preg_match('/Opera/i',$u_agent))
{
$bname = 'Opera';
$ub = "Opera";
}
elseif(preg_match('/Netscape/i',$u_agent))
{
$bname = 'Netscape';
$ub = "Netscape";
}
// finally get the correct version number
$known = array('Version', $ub, 'other');
$pattern = '#(?<browser>' . join('|', $known) .
')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
if (!preg_match_all($pattern, $u_agent, $matches)) {
// we have no matching number just continue
}
// see how many we have
$i = count($matches['browser']);
if ($i != 1) {
//we will have two since we are not using 'other' argument yet
//see if version is before or after the name
if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
$version= $matches['version'][0];
}
else {
$version= $matches['version'][1];
}
}
else {
$version= $matches['version'][0];
}
// check if we have a number
if ($version==null || $version=="") {$version="?";}
return array(
'userAgent' => $u_agent,
'name' => $bname,
'version' => $version,
'platform' => $platform,
'pattern' => $pattern
);
}
function makeseo($text) {
$map = array(
'Ã ' => 'a',
'á' => 'a',
'Ã¥' => 'a',
'â' => 'a',
'è' => 'e',
'é' => 'e',
'ê' => 'e',
'ë' => 'e',
/* removed i/o/u to save myself some time */
'ç' => 'c',
'ñ' => 'n',
'ä' => 'ae',
'ö' => 'oe',
'ü' => 'ue',
'Ã?' => 'Ae',
'Ã?' => 'Ue',
'Ã?' => 'Oe',
'Ã?' => 'ss',
/* now that we are replacing bring the str_replace values */
'-' => '_',
' ' => '-',
'&' => 'and'
);
$text = strtr($text,$map);
$text = preg_replace('/[^-a-zA-Z0-9&\s_]/i' , '', $text);
$text = trim(strtolower($text));
$text = urlencode($text);
return $text;
}
function getPath($url,$relative_path)
{
$urltype=explode(".php",$url);
if(count($urltype)==1)
{
$url=trim($url);
$url=substr($url,1,strlen($url)-2);
$directories=explode("/",$url);
$path="";
$lenth= count($directories);
for($i=1;$i<$lenth;$i++)
$path.="../";
return $path.$relative_path;
}
else
{
return $relative_path;
}
}
/*define('BING_API', 'FD2AFB819B4CB126647EDFF498FA2BF873A28920');
function loadData($url, $ref = false) {
$chImg = curl_init($url);
curl_setopt($chImg, CURLOPT_RETURNTRANSFER, true);
curl_setopt($chImg, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0");
if ($ref) {
curl_setopt($chImg, CURLOPT_REFERER, $ref);
}
$curl_scraped_data = curl_exec($chImg);
curl_close($chImg);
return $curl_scraped_data;
}
function translate($text, $from, $to) {
$data = loadData('http://api.bing.net/json.aspx?AppId=' . BING_API . '&Sources=Translation&Version=2.2&Translation.SourceLanguage=' . $from . '&Translation.TargetLanguage=' . $to . '&Query=' . urlencode($text));
$translated = json_decode($data);
if (sizeof($translated) > 0) {
if (isset($translated->SearchResponse->Translation->Results[0]->TranslatedTerm)) {
return $translated->SearchResponse->Translation->Results[0]->TranslatedTerm;
} else {
return false;
}
} else {
return false;
}
}*/
function translate($serviceno, $servicepwd, $text, $srclang, $trglang) {
$params = "wl_data=".urlencode($text);
$params .= "&wl_errorstyle=1&wl_srclang=".$srclang."&wl_trglang=".$trglang."&wl_password=".$servicepwd;
$host = "http://www.worldlingo.com/".$serviceno."/api";
return do_post_request($host, $params);
}
function do_post_request($url, $data, $optional_headers = null) {
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
}
function getNewsletterLayout($template_id)
{
global $db;
$sql="SELECT `newsletter_layout` FROM `newsletter_layouts` WHERE `template_id` = ".$template_id;
$rs=$db->ExecuteQuery($sql);
list($newsletter_layout)=$rs->FetchAsArray();
return $newsletter_layout;
}
?>