Skip to content

Instantly share code, notes, and snippets.

View francisrod01's full-sized avatar
🎯
Focusing

Francis (dele/he/him) francisrod01

🎯
Focusing
View GitHub Profile
@francisrod01
francisrod01 / admin_add.ctp
Created July 11, 2013 01:32
Foco nesse validaSenha(), veja se ele não atrapalha algo. ;)
<?php
// menu lateral
echo $this->element($pages_dir . '/menu-topo/usuarios');
?>
<div class="users form">
<?php echo $this->Form->create('User', array('type'=>'file')); ?>
<fieldset>
@francisrod01
francisrod01 / AppCtontroller.php
Last active December 19, 2015 18:48
Primeiro o /Lib/LoadConfig/static.php depois o /Controller/UsersController.php
App::import('Lib', 'LoadConfigs', array('file' => 'static.php'));
class AppController extends Controller {
..
@francisrod01
francisrod01 / MailSenderComponent.php
Created July 17, 2013 13:25
EmailComponent for CakePHP 2.3
<?php
// Controlles/Component/MailSenderComponent.php
App::uses('CakeEmail', 'Network/Email');
Class MailSenderComponent extends Component {
public function sendmail($subject, $titleMail, $name, $email, $message) {
<?php
class Cep {
public function get_cep_cidade($tId, $city)
{
$this->db->select('cep_cidade.nome, cep_estado.id, cep_estado.id_uf');
$this->db->from('cep_cidade');
$this->db->join(
'cep_estado',
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Array
(
[0] => Array
(
[Local] => Array
(
[id] => 40
[user_id] => 1
[neighborhood_id] =>
[city_id] => 6015
Array
(
[Agencia] => Array
(
[joins] => Array
(
[0] => Array
(
[table] => cidades
[alias] => Cidade
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Constructor_lib {
function __construct() {
$this->CI =& get_instance();
}
function create_controller_files($tables = NULL, $create = FALSE) {
if(!$tables) $tables = $this->CI->db->list_tables();
@francisrod01
francisrod01 / PermissionsArrayComponent.php
Last active August 29, 2015 14:01
CakePHP - Check Permissions action
<?php
/**
* @todo CakePHP Permissions Array by Kevin Wentworth (Saco Design, Inc.)
* @todo Handles retrieving all ACL Permissions and storing them in an array.
* @todo Comments and bug reports welcome at kevin at sacode sign dot com
*
* @licensed Licensed under UYOR (Use at Your Own Risk)
* @link http://www.mainelydesign.com/blog/view/getting-all-acl-permissions-in-one-lookup-cakephp-1-3#null
*/
@francisrod01
francisrod01 / AdministratorController.php
Created June 21, 2014 23:04
CakePHP 2.4 - Carrego um controller para o administrator com new Controller()
App::import('Controller', 'Users');
App::import('Controller', 'Business');
class AdministratorController extends AppController {
public function panel_profile() {
switch ($this->userDataGroupID) {
// Case Group is Developer's
case 1 :
$Users = new UsersController;