0) { $mn_seo=$a[0]; }else{ $continue=false; } break; case 'artigo': $a=explode_url($url_path[0],"artigo"); $sql="SELECT * FROM artigo WHERE cod_artigo='".$a[0]."'"; $db=mysql_query($sql); if (mysql_num_rows($db)>0) { $id_seo=$a[0]; }else{ $continue=false; } break; } array_shift($url_path); if (count($url_path)==0){ $continue=false; } } $url=fullPageURL(); $sql="SELECT * FROM links WHERE link_pt like '$url' OR link_en like '$url' OR link_ao like '$url' OR link_br like '$url' LIMIT 1"; $db=mysql_query($sql); if(mysql_num_rows($db)>0){ $url_bd=mysql_fetch_assoc($db); if($url_bd["link_pt"]==$url){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_pt"]); exit; }elseif($url_bd["link_en"]==$url){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_en"]); exit; }elseif($url_bd["link_ao"]==$url){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_ao"]); exit; }else{ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_br"]); exit; } }else{ $sql="SELECT * FROM links WHERE cod_menu='".(int)$mn_seo."' AND cod_artigo='".(int)$id_seo."' LIMIT 1"; $db=mysql_query($sql); if(mysql_num_rows($db)>0){ $url_bd=mysql_fetch_assoc($db); if($url_bd["link_pt"]!=""){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_pt"]); exit; }elseif($url_bd["link_en"]!=""){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_en"]); exit; }elseif($url_bd["link_ao"]!=""){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_ao"]); exit; }elseif($url_bd["link_br"]!=""){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$url_bd["link_novo_br"]); exit; } } } /*#########*/ } $artigo=array(); $artigos=array(); if (in_array(_op_,array("menu","artigo"))){ if($cod_template==''){ $sql="SELECT * FROM menu WHERE cod_menu='".$_GET["mn"]."'"; $db=mysql_query($sql, $_SERVER["loba"]); if (mysql_num_rows($db)>0) { $cod_template=mysql_result($db, 0, 'cod_template'); } } $sql="SELECT * FROM template WHERE cod_template='$cod_template'"; $db=mysql_query($sql, $_SERVER["loba"]); if (mysql_num_rows($db)>0){ $template=mysql_result($db,0,_op_); $processador=mysql_result($db,0,'p_'._op_); }else{ die("template ERROR"); } }elseif(_op_=="search"){ $template='search.php'; $processador='search.php'; }elseif(_op_=="newsletter"){ $template='home.php'; $processador='home.php'; }else{ $template='home.php'; $processador='home.php'; } if(isset($_GET["private"]) && $_GET["private"]==1){ setcookie("private", 1, time() + 1800, '/'); // 1800 = 30 min $id=$_GET["id"]; $sourceid=$_GET["sourceid"]; $campanha=$_GET["campanha"]; $url_cookie = strtok(fullPageURL(), '?'); goto_url($url_cookie.'?sourceid='.$sourceid.'&id='.$id.'&campanha='.$campanha);die(); } $whereMenu="activo='1' AND "; if($_COOKIE["private"]==1){ $whereMenu="(activo='1' OR privado='1') AND "; } $menu=array(); $criar_submenu=0; $sql="SELECT * FROM menu WHERE ".lang_query("menu")."!='' AND $whereMenu precedente='0' AND rodape='0' AND top='0' AND cod_template!='40' ORDER BY ordem DESC, cod_menu DESC"; $db=mysql_query($sql, $_SERVER["loba"]); while($b=mysql_fetch_array($db)){ $sql2="SELECT * FROM menu WHERE ".lang_query("menu")."!='' AND $whereMenu precedente='".$b["cod_menu"]."' AND cod_template!='44' ORDER BY ordem DESC, cod_menu DESC"; $db2=mysql_query($sql2, $_SERVER["loba"]); while($a=mysql_fetch_array($db2)){ if($a["cod_template"]==40 AND $criar_submenu==0){ $criar_submenu=1; $c["url"]=seo_menu($b["cod_menu"]); $c["portfolio"]=1; $c["cod_template"]=40; $c["menu_"._lang_]=get_opcao("menu_"._lang_); $b["submenu"][]=$c; }elseif($a["cod_template"]!=40){ $a["portfolio"]=0; $a["url"]=seo_menu($a["cod_menu"]); $b["submenu"][]=$a; } } $b["url"]=seo_menu($b["cod_menu"]); $menu[]=$b; } //echo "
";
//print_r($menu);
//exit;
$portfolio=0;
foreach($menu as $mn){
	if($mn["cod_menu"]==$menu_caminho[0] AND $mn["submenu"]!=array() AND !isset($menu_caminho[1])){
		foreach($mn["submenu"] as $sub){
			if($sub["portfolio"]==1){
				$portfolio=1;
			}
		}
	}
}
if($portfolio==1){
	$sql="SELECT * FROM template WHERE cod_template='40' ORDER BY cod_template DESC LIMIT 1";
	$db=mysql_query($sql, $_SERVER["loba"]);
	while($a=mysql_fetch_array($db)){
		$processador=$a["p_menu"];
		$template=$a["menu"];
	}
}

$menu_rodape=array();
$sql="SELECT * FROM menu WHERE ".lang_query("menu")."!='' AND $whereMenu precedente='0' AND rodape='1' ORDER BY ordem DESC, cod_menu DESC";
$db=mysql_query($sql, $_SERVER["loba"]);
while($b=mysql_fetch_array($db)){
	$b["url"]=seo_menu($b["cod_menu"]);
	$menu_rodape[]=$b;
}
$menu_top=array();
$sql="SELECT * FROM menu WHERE ".lang_query("menu")."!='' AND $whereMenu precedente='0' AND top='1' ORDER BY ordem DESC, cod_menu DESC";
$db=mysql_query($sql, $_SERVER["loba"]);
while($b=mysql_fetch_array($db)){
	$b["url"]=seo_menu($b["cod_menu"]);
	$menu_top[]=$b;
}
$contactos_rodape=array();
$sql="SELECT * FROM contacto WHERE activo='1' AND mercado='"._lang_."' ORDER BY ordem DESC, cod_contacto DESC LIMIT 3";
$db=mysql_query($sql, $_SERVER["loba"]);
while($b=mysql_fetch_array($db)){
	$contactos_rodape[]=$b;
}

$campanha = "";
if(isset($_GET["sourceid"]) && isset($_GET["campanha"]) && isset($_GET["id"])){
	$hash_compare = md5('ds9f8dsg9fsdgsd'.$_GET["id"]);
	if($_GET["sourceid"] == $hash_compare){
		if($_GET["campanha"] == "apiccaps"){
			$sql = "SELECT * from appicaps where cod_id = ".mysql_real_escape_string($_GET["id"])." LIMIT 1";
			$db=mysql_query($sql, $_SERVER["loba"]);
			if(mysql_num_rows($db) > 0){
				$user_campanha = mysql_fetch_assoc($db);
				$campanha = "apiccaps";
			}
		}
	}
}

$error_newsletter=array();
$enviado_newsletter=array();
$error_promo=array();
$nenviado_promo=false;
$enviado_promo=false;
if(isset($_POST["form_promo"])&& $_POST["form_promo"]=="1"){
	
	$array['nome']=$_POST['nome'];
	$array['email']=$_POST['email'];
	$array['telefone']=$_POST["telefone"];
	$array['horas']=$_POST['horas'];
	$array['mensagem']=$_POST['obs'];
	$array['forma'] = $_POST["promo_hidden"];
	$array["data"] = date("Y-m-d H:i:s");
	
	//echo '
';print_r($array);exit;
	//validar dados
	/*if (strlen($array['nome'])==0){
		$error[]='- '.get_traducao("nome");
	}
	if (strlen($array['email'])==0){
		$error[]='- '.get_traducao("email");
	}elseif ($array['email']!='' AND !ereg("[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$", $array['email'])){
		$error[]='- '.get_traducao("erro_email");
	}
	if ($array['assunto']==0){
		$error[]='- '.get_traducao("assunto");
	}
	if (strlen($array['mensagem'])==0){
		$error[]='- '.get_traducao("mensagem");
	}*/
	if (true){
		/*$sql="SELECT * FROM assuntos WHERE cod_assunto='".$array["assunto"]."' ORDER BY ordem DESC, cod_assunto DESC LIMIT 1";
		$db=mysql_query($sql, $_SERVER["loba"]);
		while($a=mysql_fetch_array($db)){
			$assunto=$a;
		}*/
		$subject = "Pedido de contacto de " . $_POST["nome"] . " - APPICAPS";
		$msg='
		Nome: '.$array["nome"].'
Email: '.$array["email"].'
Telefone: '.$array["telefone"].'
Forma de contacto: '.$array["forma"].'
Horario: '.$array["horas"].'
Mensagem:
'.$array["mensagem"].'

Data: '.$array["data"].' '; if(send_email("LOBA", "comercial@loba.pt", $subject, $msg, $array["email"], $assunto["nome"], $assunto["email"])){ //send_email("LOBA", $assunto["email"], $subject, $msg, $array["email"], $assunto["nome"], $assunto["email"]); $enviado=true; $sql2 = 'UPDATE appicaps SET preenchido=1 WHERE cod_id='.$d["cod_id"].''; mysql_query($sql2); //echo seo_menu(_mn_);exit; $enviado_newsletter[]="Entraremos em contacto brevemente."; //goto_url(seo_artigo(_mn_,_id_).'?enviado=1'); $sql2 = "UPDATE appicaps SET preenchido=1, email='".$array["email"]."', telefone='".$array["telefone"]."' WHERE cod_id=".$_GET["id"]; mysql_query($sql2); $array=array(); }else{ echo 'nao enviado';exit; $nenviado=true; } } } /*if(isset($_POST["accao"])&& $_POST["accao"]=="subscricao"){ $array['newsletter_email']=$_POST['newsletter_email']; //validar dados if (strlen($array['newsletter_email'])==0){ $error_newsletter[]=get_traducao("preencher_email"); }elseif(!preg_match("/[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/", $array['newsletter_email'], $matches)){ $error_newsletter[]=get_traducao("erro_email"); } if($error_newsletter==array()){ $sql="SELECT * FROM oempro_subscribers_663 WHERE EmailAddress='".$array['newsletter_email']."'"; $db=mysql_query($sql, $_SERVER["azmail"]); if (mysql_num_rows($db)>0){ $error_newsletter[]=get_traducao("email_registado"); }else { $sql="INSERT INTO `oempro_subscribers_663` (`EmailAddress` , `CustomField1309`, `SubscriptionStatus`) VALUES ('".$array['newsletter_email']."', '"._lang_."', 'Subscribed')"; if(mysql_query($sql, $_SERVER["azmail"])){ $enviado_newsletter[]=get_traducao("email_com_sucesso"); }else{ $error_newsletter[]=get_traducao("erro_email_newsletter"); } } mysql_close($_SERVER["azmail"]); } }*/ if(_op_=="newsletter"){ if($_GET["r"]=="sucesso"){ $enviado_newsletter[]=get_traducao("email_com_sucesso"); }elseif($_GET["r"]=="pending"){ $error_newsletter[]=get_traducao("email_pending"); }elseif($_GET["r"]=="erro" && $_GET["e"]==9){ $error_newsletter[]=get_traducao("email_registado"); }elseif($_GET["r"]=="erro" && $_GET["e"]==5){ $error_newsletter[]=get_traducao("erro_email"); } } /* menu actual */ if (_mn_) { $sql = "SELECT * FROM menu WHERE cod_menu='" . _mn_ . "' LIMIT 1"; $db = mysql_query($sql); $menu_atual = mysql_fetch_assoc($db); $menu_atual["url"] = seo_menu($menu_atual["cod_menu"]); } $file_processador='include/processador/'.$processador; if (file_exists($file_processador)){ include($file_processador); }else{ die("ERRO ao carregar o processador ->".$file_processador); } if(_id_){ if($artigo["imagem"]!=""){ $imagem_fb=_url_.'imagens/'.$artigo["imagem"]; }elseif($blocos[0]["portfolio"][0]["imagem"]){ $imagem_fb=_url_.'imagens/'.$blocos[0]["portfolio"][0]["imagem"]; }elseif($artigo["imagem_listagem"]){ $imagem_fb=_url_.'imagens/'.$artigo["imagem_listagem"]; //print $imagem_fb; }else{ $imagem_fb=_url_."images/loba.jpg"; } } //load template... include("include/layout/html_inicial.php"); if ($template==''){ include("include/layout/home.php"); }else{ include("include/layout/".$template.""); } include("include/layout/html_final.php"); //phpinfo(); ?>