This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add this to any `view` recommended is View/Layouts/default.ctp | |
/* | |
WWW_ROOT generally refers to your webroot directory | |
DS is usually '/' | |
$this->params['controller'] returns controller name in lowercase | |
$this->params['action'] returns action name in lowercase | |
Refer | |
* http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//(function(){ | |
//Refer http://code.google.com/apis/picasaweb/docs/2.0/reference.html | |
// Album url can be obtained by getting the rss feed of a Public or Limited album | |
var album_url = "https://picasaweb.google.com/data/feed/base/user/104873802064687726116/albumid/5710488196657525265?"+ // The base url | |
//Query Parameters | |
"alt=json"+ // Options are json and rss , | |
"&kind=photo"+ | |
"&authkey=Gv1sRgCIC0zJCjrbqplwE"+//Necessary only because the album's visibility is Limited , link only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>jQSlide</title> | |
</head> | |
<body> | |
<img src="" id="slide_show_pic" alt=""> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script type="text/javascript"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What if you wanted to test a single line of code in php ? | |
# Simple | |
echo "<?php phpinfo();" | /path/to/php | |
# Since I am using XAMPP | |
# The following works | |
echo "<?php phpinfo();" | /opt/lampp/bin/php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Auth { | |
/** | |
* @author K.Gautam | |
* @version 0.1 | |
* @todo ability to add configuration. | |
*/ | |
protected $CI=NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'Zend.php'; | |
require_once 'Zend/Uri/Exception.php'; | |
require_once 'Zend/Uri/Http.php'; | |
require_once 'Zend/Uri/Mailto.php'; | |
abstract class Zend_Uri | |
{ | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Test extends Controller { | |
function Test() { | |
parent::Controller() | |
$this->load->library('Acl'); | |
define('ROLE', '1'); | |
define('RESOURCE', '1'); | |
} | |
function index() { | |
if (!$this->acl->can_read(ROLE, RESOURCE)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO `user_resources` (`id`, `name`, `description`, `parentId`) VALUES | |
(1, 'test', 'Acl Test Controller', NULLL) | |
INSERT INTO `user_roles` (`id`, `name`, `description`, `parentId`) VALUES | |
(1, 'test', 'Acl Test Role', NULLL) | |
INSERT INTO `user_permissions` (`id` ,`role` ,`resource` ,`read` ,`write` ,`modify` ,`delete` ,`publish`) | |
VALUES (NULL , '1', '1', '1', '1', '0', '0', '0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `user_resources` ( | |
`id` INT NOT NULL AUTO_INCREMENT | |
, `name` VARCHAR(255) | |
, `description` VARCHAR(255) | |
, `parentId` INT DEFAULT NULL | |
, PRIMARY KEY (`id`) | |
); | |
CREATE TABLE `user_roles` ( | |
`id` INT NOT NULL AUTO_INCREMENT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
require_once BASEPATH .'libraries/Zend/Acl.php'; | |
class Acl extends Zend_Acl { | |
function __construct() { | |
$CI = &get_instance(); | |
$this->acl = new Zend_Acl(); | |
$CI->db->order_by('ParentId', 'ASC'); //Get the roles | |
$query = $CI->db->get('user_roles'); |