Skip to content

Instantly share code, notes, and snippets.

@andrellima
Created March 31, 2011 22:37
Show Gist options
  • Save andrellima/897408 to your computer and use it in GitHub Desktop.
Save andrellima/897408 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
before_filter :authorize, :except => [[:login],[:resetarsenha]]
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => 'cab4b59e1e2ccbfc45e982f398ce8667'
# See ActionController::Base for details
# Uncomment this to filter the contents of submitted sensitive data parameters
# from your application log (in this case, all fields with names like "password").
# filter_parameter_logging :password
protected
def authorize
unless User.find_by_id(session[:user_id])
flash[:notice] = "Por Favor, Logue no sistema."
redirect_to :controller => 'admin', :action => 'login'
end
end
def configure_charsets
headers["Content-Type"] = "text/html; charset=utf-8"
suppress(ActiveRecord::StatementInvalid) do
ActiveRecord::Base.connection.execute 'SET NAMES UTF8'
end
end
end
<!DOCTYPE html>
<html>
<head>
<title>Cec</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :all %>
<%= csrf_meta_tag %>
</head>
<body>
<table WIDTH="100%" HEIGHT="100%">
<tr>
<td VALIGN="MIDDLE" ALIGN="CENTER"><table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="214"><img src="images/logo.jpg" width="214" height="26" /></td>
<td width="70">&nbsp;</td>
<td><table width="566" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><table id = "table" width="566" border="0" cellpadding="0" cellspacing="0" class="fTxtPreto">
<tr>
<td id = "videos" width="65" align="center"><a href="videos.htm" class="fTxtPreto"><em>VÍDEOS</em></a></td>
<td id = "campanha" width="80" align="center"><a href="campanha.htm" class="fTxtPreto"><em>CAMPANHA</em></a></td>
<td id = "colecao" width="67" align="center"><a href="colecao.htm" class="fTxtPreto"><em>COLEÇÃO</em></a></td>
<td id = "produtos" width="80" align="center"><a href="produtos.htm" class="fTxtPreto"><em>PRODUTOS</em></a></td>
<td id = "empresa" width="70" align="center"><a href="empresa.htm" class="fTxtAzul"><em>EMPRESA</em></a></td>
<td id = "franquia" width="73" align="center"><a href="franquia.htm" class="fTxtPreto"><em>FRANQUIA</em></a></td>
<td id = "lojas" width="60" align="center"><a href="lojas.htm" class="fTxtPreto"><em>LOJAS</em></a></td>
<td id = "contato" width="65" align="center"><a href="contato.htm" class="fTxtPreto"><em>CONTATO</em></a></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="bottom">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/div_nada.gif" width="10" height="10" /></td>
</tr>
<tr>
<td height="460" valign="top" class="bAllPreto"><table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50" height="40">&nbsp;</td>
<td>&nbsp;</td>
<td width="50">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="fTxtPreto"><p class="fTxtPretoTit">
<%= yield %> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="50">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/div_nada.gif" width="10" height="10" /></td>
</tr>
<tr>
<td><table width="850" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="271"><img src="images/ico_redessociais.jpg" width="271" height="21" border="0" usemap="#MapMap" /></td>
<td align="right" class="fTxt">© 2011 TODOS OS DIREITOS RESERVADOS</td>
<td width="60" align="center" class="fTxtPreto">SOM</td>
<td width="58"><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="58" height="10">
<param name="movie" value="player.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="player.swf" width="58" height="10">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object></td>
</tr>
</table></td>
</tr>
</table>
<map name="MapMap" id="MapMap">
<area shape="rect" coords="1,3,55,21" href="http://www.lovebag.com.br/" target="_blank" />
<area shape="rect" coords="60,2,76,20" href="http://www.facebook.com/xsas target="_blank" />
<area shape="rect" coords="82,3,98,19" href="http://twitter.com/cosda" target="_blank" />
<area shape="rect" coords="104,2,120,18" href="http://www.orkut.com.br/Main#Profile?rl=mp&amp;uid=4717834855763" target="_blank" />
<area shape="rect" coords="128,4,178,17" href="http://issuu.com/cssd" target="_blank" />
<area shape="rect" coords="184,3,225,19" href="http://www.youtube.com/user/jsnadsjdkj" target="_blank" />
<area shape="rect" coords="231,3,270,17" href="http://www.vimeo.com/user5639261" target="_blank" />
</map> <http://CriarWeb.com>
</td>
</tr>
</body>
</html>
class PublicController < ApplicationController
skip_before_filter :authorize
layout "application"
def contact
render :partial => 'formulario_contato'
end
def send_contact
nome = params[:contato]['nome']
fone = params[:contato]['telefone']
email = params[:contato]['email']
assunto = params[:contato]['assunto']
corpo = params[:contato]['corpo']
UserMailer.contact(nome, fone, email, assunto, corpo).deliver
render :text => '<h1> Formulário enviado com sucesso </h1>'
end
def cadastro_franquia
render :partial => 'formulario_franquias'
end
def send_cadastro_franquia
email = params[:franquia_cadastro]['email']
sexo = params[:franquia_cadastro]['sexo']
nome = params[:franquia_cadastro]['nome']
nascimento = params[:franquia_cadastro]['nascimento']
telefone = params[:franquia_cadastro]['telefone']
celular = params[:franquia_cadastro]['celular']
outro_telefone = params[:franquia_cadastro]['outro_telefone']
endereco = params[:franquia_cadastro]['endereco']
pais = params[:franquia_cadastro]['pais']
uf = params[:franquia_cadastro]['uf']
cidade_de_interesse = params[:franquia_cadastro]['cidade_de_interesse']
capital_de_investimento = params[:franquia_cadastro]['capital_de_investimento']
mensagem = params[:franquia_cadastro]['mensagem']
UserMailer.franquia(email, sexo, nome, nascimento, telefone, celular, outro_telefone, endereco, pais, uf, cidade_de_interesse, capital_de_investimento, mensagem).deliver
render :text => '<h1> Formulário enviado com sucesso </h1>'
end
def contact_sent
render :text => '<h1> Formulário enviado com sucesso </h1>'
end
def gallery_detail
@gallery = Gallery.find(:all, :conditions => {:content_id => params[:id]})
@content = Content.find params[:id]
render :partial => "gallery_detail", :layout => false
end
def content_by_id
@content = Content.find(:first, :conditions => ['id = ?', params[:id]])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment