├── Test
├── Fixture
│ ├── empty
│ └── UserFixture.php
└── Case
│ ├── View
│ └── Helper
│ │ └── empty
│ ├── Model
│ ├── Behavior
│ │ └── empty
│ └── UserTest.php
│ └── Controller
│ └── Component
│ └── empty
├── View
├── Layouts
│ ├── js
│ │ └── empty
│ ├── rss
│ │ └── empty
│ ├── xml
│ │ └── empty
│ ├── Emails
│ │ ├── text
│ │ │ └── default.ctp
│ │ └── html
│ │ │ └── default.ctp
│ └── authake.ctp
├── User
│ ├── message.ctp
│ ├── denied.ctp
│ ├── pass.ctp
│ ├── profile.ctp
│ ├── lost_password.ctp
│ ├── verify.ctp
│ ├── register.ctp
│ ├── login.ctp
│ └── index.ctp
├── Elements
│ ├── error.ctp
│ ├── info.ctp
│ ├── success.ctp
│ ├── warning.ctp
│ ├── gotohomepage.ctp
│ └── gotoadminpage.ctp
├── Emails
│ └── html
│ │ ├── register.ctp
│ │ ├── verify.ctp
│ │ └── lost_password.ctp
├── Helper
│ ├── GravatarHelper.php
│ ├── HtmlbisHelper.php
│ ├── htmlbis.php
│ ├── authake.php
│ └── AuthakeHelper.php
├── Groups
│ ├── add.ctp
│ ├── index.ctp
│ ├── edit.ctp
│ └── view.ctp
├── Users
│ ├── add.ctp
│ ├── edit.ctp
│ ├── index.ctp
│ └── view.ctp
├── Authake
│ ├── index.ctp
│ ├── settings.ctp
│ └── help.ctp
└── Rules
│ ├── add.ctp
│ ├── view.ctp
│ ├── edit.ctp
│ └── index.ctp
├── VERSION.md
├── webroot
├── js
│ ├── custom.js
│ ├── vendors.php
│ └── html5shiv.js
├── favicon.ico
├── img
│ ├── adminBack.jpg
│ ├── cake.icon.gif
│ ├── cake.power.gif
│ ├── icons
│ │ ├── add.png
│ │ ├── door.png
│ │ ├── key.png
│ │ ├── lock.png
│ │ ├── time.png
│ │ ├── user.png
│ │ ├── accept.png
│ │ ├── cross.png
│ │ ├── delete.png
│ │ ├── door_in.png
│ │ ├── empty.png
│ │ ├── error.png
│ │ ├── group.png
│ │ ├── house.png
│ │ ├── lock_go.png
│ │ ├── pencil.png
│ │ ├── arrow_up.png
│ │ ├── clock_go.png
│ │ ├── door_open.png
│ │ ├── door_out.png
│ │ ├── group_add.png
│ │ ├── lock_add.png
│ │ ├── lock_edit.png
│ │ ├── lock_open.png
│ │ ├── user_add.png
│ │ ├── user_edit.png
│ │ ├── arrow_down.png
│ │ ├── clock_delete.png
│ │ ├── group_delete.png
│ │ ├── group_edit.png
│ │ ├── information.png
│ │ ├── lock_break.png
│ │ ├── lock_delete.png
│ │ └── user_delete.png
│ ├── glyphicons-halflings.png
│ ├── no-photo-placeholder.png
│ ├── glyphicons-halflings-gray.png
│ └── glyphicons-halflings-white.png
├── .htaccess
├── index.php
├── css.php
├── css
│ └── custom.css
└── test.php
├── Config
└── authake_config.php
├── Controller
├── AuthakeAppController.php
├── Component
│ ├── FilterComponent.php
│ └── AuthakeComponent.php
├── AuthakeController.php
├── GroupsController.php
├── RulesController.php
└── UsersController.php
├── Model
├── Group.php
├── Rule.php
├── AuthakeAppModel.php
└── User.php
├── CHANGELOG.md
├── db
└── authake_clean.sql
└── README.md
/Test/Fixture/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/View/Layouts/js/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/View/Layouts/rss/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/View/Layouts/xml/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Test/Case/View/Helper/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Test/Case/Model/Behavior/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Test/Case/Controller/Component/empty:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/VERSION.md:
--------------------------------------------------------------------------------
1 | Authake plugin version 2.2.3
2 |
--------------------------------------------------------------------------------
/webroot/js/custom.js:
--------------------------------------------------------------------------------
1 | //alert($("body").text());
--------------------------------------------------------------------------------
/View/Layouts/Emails/text/default.ctp:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/webroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/favicon.ico
--------------------------------------------------------------------------------
/webroot/img/adminBack.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/adminBack.jpg
--------------------------------------------------------------------------------
/webroot/img/cake.icon.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/cake.icon.gif
--------------------------------------------------------------------------------
/webroot/img/cake.power.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/cake.power.gif
--------------------------------------------------------------------------------
/webroot/img/icons/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/add.png
--------------------------------------------------------------------------------
/webroot/img/icons/door.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/door.png
--------------------------------------------------------------------------------
/webroot/img/icons/key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/key.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock.png
--------------------------------------------------------------------------------
/webroot/img/icons/time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/time.png
--------------------------------------------------------------------------------
/webroot/img/icons/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/user.png
--------------------------------------------------------------------------------
/webroot/img/icons/accept.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/accept.png
--------------------------------------------------------------------------------
/webroot/img/icons/cross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/cross.png
--------------------------------------------------------------------------------
/webroot/img/icons/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/delete.png
--------------------------------------------------------------------------------
/webroot/img/icons/door_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/door_in.png
--------------------------------------------------------------------------------
/webroot/img/icons/empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/empty.png
--------------------------------------------------------------------------------
/webroot/img/icons/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/error.png
--------------------------------------------------------------------------------
/webroot/img/icons/group.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/group.png
--------------------------------------------------------------------------------
/webroot/img/icons/house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/house.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock_go.png
--------------------------------------------------------------------------------
/webroot/img/icons/pencil.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/pencil.png
--------------------------------------------------------------------------------
/webroot/img/icons/arrow_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/arrow_up.png
--------------------------------------------------------------------------------
/webroot/img/icons/clock_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/clock_go.png
--------------------------------------------------------------------------------
/webroot/img/icons/door_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/door_open.png
--------------------------------------------------------------------------------
/webroot/img/icons/door_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/door_out.png
--------------------------------------------------------------------------------
/webroot/img/icons/group_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/group_add.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock_add.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock_edit.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock_open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock_open.png
--------------------------------------------------------------------------------
/webroot/img/icons/user_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/user_add.png
--------------------------------------------------------------------------------
/webroot/img/icons/user_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/user_edit.png
--------------------------------------------------------------------------------
/webroot/img/icons/arrow_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/arrow_down.png
--------------------------------------------------------------------------------
/webroot/img/icons/clock_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/clock_delete.png
--------------------------------------------------------------------------------
/webroot/img/icons/group_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/group_delete.png
--------------------------------------------------------------------------------
/webroot/img/icons/group_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/group_edit.png
--------------------------------------------------------------------------------
/webroot/img/icons/information.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/information.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock_break.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock_break.png
--------------------------------------------------------------------------------
/webroot/img/icons/lock_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/lock_delete.png
--------------------------------------------------------------------------------
/webroot/img/icons/user_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/icons/user_delete.png
--------------------------------------------------------------------------------
/webroot/img/glyphicons-halflings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/glyphicons-halflings.png
--------------------------------------------------------------------------------
/webroot/img/no-photo-placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/no-photo-placeholder.png
--------------------------------------------------------------------------------
/webroot/img/glyphicons-halflings-gray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/glyphicons-halflings-gray.png
--------------------------------------------------------------------------------
/webroot/img/glyphicons-halflings-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/midorikocak/authake/HEAD/webroot/img/glyphicons-halflings-white.png
--------------------------------------------------------------------------------
/Test/Fixture/UserFixture.php:
--------------------------------------------------------------------------------
1 | 'User', 'records' => true);
4 | }
5 | ?>
--------------------------------------------------------------------------------
/View/User/message.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Html->link(__("Go to homepage"), "/")."
";
6 | ?>
7 |
8 |
--------------------------------------------------------------------------------
/View/Elements/error.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/View/Elements/info.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/View/Elements/success.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/View/Elements/warning.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/View/Layouts/Emails/html/default.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/View/Elements/gotohomepage.ctp:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/webroot/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | RewriteEngine On
3 | RewriteCond %{REQUEST_FILENAME} !-d
4 | RewriteCond %{REQUEST_FILENAME} !-f
5 | RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
6 |
--------------------------------------------------------------------------------
/View/User/denied.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Html->link(__("Go to homepage"), "/")."
";
7 | ?>
8 |
9 |
--------------------------------------------------------------------------------
/View/Elements/gotoadminpage.ctp:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/View/Emails/html/register.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Html->url(array('plugin'=>'authake', 'controller'=>'user', 'action'=>'verify', $code), true);
5 | echo $this->Html->link(__('Click here to verify'), $url);?>
6 |
7 |
8 |
--------------------------------------------------------------------------------
/View/Emails/html/verify.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Html->url(array('plugin'=>'authake', 'controller'=>'user', 'action'=>'verify', $code), true);
5 | echo $this->Html->link(__('Click here to verify'), $url);?>
6 |
7 |
8 |
--------------------------------------------------------------------------------
/View/User/pass.ctp:
--------------------------------------------------------------------------------
1 |
2 | element('gotohomepage'); ?>
3 |
4 | Form->create(null, array('url' => array('controller' => 'user', 'action'=>'pass')));?>
5 |
13 | Form->end(__('Confirm'));?>
14 |
15 |
--------------------------------------------------------------------------------
/View/Emails/html/lost_password.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Html->url(array('plugin'=>'authake', 'controller'=>'user', 'action'=>'pass', $code), true);
5 | echo $this->Html->link(__('Click here to change your password'), $url);?>
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/View/User/profile.ctp:
--------------------------------------------------------------------------------
1 |
2 | element('gotohomepage'); ?>
3 |
4 | Form->create(null, array('url' => array('controller' => 'user', 'action'=>'changemypassword')));?>
5 |
11 | Form->end(__('Change my password now')) ?>
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/View/User/lost_password.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Form->create(null, array('url' => array('controller' => 'user', 'action'=>'lost_password')));?>
6 |
9 |
10 | Form->input('loginoremail', array('label'=>__('Login or email'), 'size'=>'40'));?>
11 |
12 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/View/User/verify.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Form->create(null, array('url' => array('controller' => 'user', 'action'=>'verify')));?>
6 |
9 |
10 | Form->input('code', array('size'=>'40', 'title'=>__('Please insert the code which you received in your e-mail.')));
12 | ?>
13 |
14 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Config/authake_config.php:
--------------------------------------------------------------------------------
1 |
4 | array (
5 | 'useDefaultLayout' => '1',
6 | 'baseUrl' => '/',
7 | 'service' => 'Authake',
8 | 'loginAction' =>
9 | array (
10 | 'plugin' => 'authake',
11 | 'controller' => 'user',
12 | 'action' => 'login',
13 | 'named' =>
14 | array (
15 | ),
16 | 'pass' =>
17 | array (
18 | ),
19 | ),
20 | 'loggedAction' => '/',
21 | 'sessionTimeout' => '604800',
22 | 'defaultDeniedAction' =>
23 | array (
24 | 'plugin' => 'authake',
25 | 'controller' => 'user',
26 | 'action' => 'denied',
27 | 'named' =>
28 | array (
29 | ),
30 | 'pass' =>
31 | array (
32 | ),
33 | ),
34 | 'rulesCacheTimeout' => '300',
35 | 'systemEmail' => 'noreply@example.com',
36 | 'systemReplyTo' => 'noreply@example.com',
37 | 'passwordVerify' => '1',
38 | 'registration' => '1',
39 | 'defaultGroup' => '2',
40 | 'useEmailAsUsername' => '0',
41 | ),
42 | );
43 |
--------------------------------------------------------------------------------
/View/Helper/GravatarHelper.php:
--------------------------------------------------------------------------------
1 | $val )
26 | $url .= ' ' . $key . '="' . $val . '"';
27 | $url .= ' />';
28 | }
29 | return $url;
30 | }
31 | }
32 | ?>
--------------------------------------------------------------------------------
/View/User/register.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Form->create(null, array('url' => array('controller' => 'user', 'action'=>'register')));?>
6 |
9 |
10 | Form->input('login', array('label'=>__('Login'), 'size'=>'12'));
12 | // do not show if we're using emails as usernames
13 | echo $this->Form->input('email', array('label'=>__('Email'), 'size'=>'40'));
14 | echo $this->Form->input('password1', array('type'=>'password', 'label'=>__('Password'), 'value' => '', 'size'=>'12'));
15 | echo $this->Form->input('password2', array('type'=>'password', 'label'=>__('Please, re-enter password'), 'value' => '', 'size'=>'12'));
16 | ?>
17 |
18 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/View/User/login.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Form->create(null, array('url' => array('controller' => 'user', 'action'=>'login')));?>
6 |
15 |
16 | Form->input('login', array('label'=>'Login', 'size'=>'14'));
18 | echo $this->Form->input('password', array('label'=>'Password', 'value' => '', 'size'=>'14'));
19 | ?>
20 |
21 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Controller/AuthakeAppController.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 | App::uses('AppController', 'Controller');
22 | //App::uses('PagesController', 'Controller');
23 | class AuthakeAppController extends AppController {
24 | var $helpers = array('Time', 'Authake.Htmlbis');
25 | function __makePassword($password1, $password2) {
26 |
27 | if ($password1 != $password2)
28 | {
29 | $this->Session->setFlash(__('The two passwords do not match!'), 'error');
30 | return false;
31 | }
32 |
33 | return md5($password1);
34 | }
35 |
36 | function beforeFilter(){
37 | parent::beforeFilter();
38 | $this->layout = 'authake';
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/Model/Group.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 | App::uses('AuthakeAppModel', 'Authake.Model');
22 | class Group extends AuthakeAppModel {
23 | var $name = 'Group';
24 | var $useTable = 'authake_groups';
25 | var $recursive = 1;
26 | var $hasMany = array('Rule' => array('className' => 'Authake.Rule', 'exclusive' => false, 'dependent' => false, 'foreignKey' => 'group_id', 'order' => 'Rule.order ASC' ) );
27 | var $useDbConfig = 'authake';
28 | var $hasAndBelongsToMany = array('User' => array('className' => 'Authake.User', 'joinTable' => 'authake_groups_users', 'foreignKey' => 'group_id', 'associationForeignKey'=> 'user_id', 'order' => 'User.id', 'displayField' => 'login' ) );
29 | }
30 | ?>
--------------------------------------------------------------------------------
/Test/Case/Model/UserTest.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 | App::uses('User','Authake.Model');
23 |
24 | class UserTestCase extends CakeTestCase {
25 |
26 | public $fixtures = array('plugin.authake.user');
27 | public $User;
28 |
29 | public function setUp()
30 | {
31 | parent::setUp();
32 | $this->User = ClassRegistry::init('Authake.User');
33 | }
34 |
35 | public function testObject()
36 | {
37 | $this->assertTrue(is_object($this->User));
38 | }
39 |
40 | public function testLoginData()
41 | {
42 | $login='admin';
43 | $password='admin';
44 | $result = $this->User->getLoginData($login, $password);
45 | $expected = $this->User->getLoginData($login, $password);
46 | $this->assertEquals($expected, $result);
47 | }
48 | }
49 | ?>
--------------------------------------------------------------------------------
/webroot/js/vendors.php:
--------------------------------------------------------------------------------
1 |
12 | * Copyright 2005-2008, Cake Software Foundation, Inc.
13 | * 1785 E. Sahara Avenue, Suite 490-204
14 | * Las Vegas, Nevada 89104
15 | *
16 | * Licensed under The MIT License
17 | * Redistributions of files must retain the above copyright notice.
18 | *
19 | * @filesource
20 | * @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
21 | * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
22 | * @package cake
23 | * @subpackage cake.app.webroot.js
24 | * @since CakePHP(tm) v 0.2.9
25 | * @version $Revision: 6311 $
26 | * @modifiedby $LastChangedBy: phpnut $
27 | * @lastmodified $Date: 2008-01-02 00:33:52 -0600 (Wed, 02 Jan 2008) $
28 | * @license http://www.opensource.org/licenses/mit-license.php The MIT License
29 | */
30 | /**
31 | * Enter description here...
32 | */
33 | $file = $_GET['file'];
34 | $pos = strpos($file, '..');
35 | if ($pos === false) {
36 | if (is_file('../../vendors/javascript/'.$file) && (preg_match('/(\/.+)\\.js/', $file)))
37 | {
38 | readfile('../../vendors/javascript/'.$file);
39 | }
40 | } else {
41 | header('HTTP/1.1 404 Not Found');
42 | }
43 | ?>
--------------------------------------------------------------------------------
/View/Helper/HtmlbisHelper.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 |
23 | App::import('Helper', 'Html');
24 |
25 | class HtmlbisHelper extends HtmlHelper {
26 |
27 | function iconlink($icon, $title, $url = null, $htmlAttributes = array(), $confirmMessage = false) {
28 | $img = parent::image("/authake/img/icons/{$icon}.png", array('title' => $title));
29 | return parent::link($img, $url, am($htmlAttributes, array('escape'=>false)), $confirmMessage, false);
30 | }
31 |
32 | function iconallowdeny($what) {
33 | if ($what == true)
34 | echo "".__('Allow')."";
35 | else
36 | echo "".__('Deny')."";
37 | }
38 | }
39 | ?>
--------------------------------------------------------------------------------
/View/Helper/htmlbis.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 |
23 | App::import('Helper', 'Html');
24 |
25 | class HtmlbisHelper extends HtmlHelper {
26 |
27 | function iconlink($icon, $title, $url = null, $htmlAttributes = array(), $confirmMessage = false) {
28 | $img = parent::image("/authake/img/icons/{$icon}.png", array('title' => $title));
29 | return parent::link($img, $url, am($htmlAttributes, array('escape'=>false)), $confirmMessage, false);
30 | }
31 |
32 | function iconallowdeny($what) {
33 | if ($what == true)
34 | echo $this->image("/authake/img/icons/accept.png", array('title' => __('Allow')));
35 | else
36 | echo $this->image("/authake/img/icons/delete.png", array('title' => __('Deny')));
37 | }
38 | }
39 | ?>
--------------------------------------------------------------------------------
/View/Helper/authake.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 |
23 | class AuthakeHelper extends AppHelper {
24 |
25 | var $helpers = array('Session');
26 |
27 | function getUserId() {
28 | return $this->Session->read('Authake.id');
29 | }
30 |
31 | function isLogged() {
32 | return ($this->getUserId() !== null);
33 | }
34 |
35 | function getLogin() {
36 | return $this->Session->read('Authake.login');
37 | }
38 |
39 | function getGroupIds() {
40 | $gid = $this->Session->read('Authake.group_ids');
41 | return (empty($gid) ? array(0) : $gid);
42 | }
43 |
44 | function getGroupNames() {
45 | $gn = $this->Session->read('Authake.group_names');
46 | return (is_array($gn) ? $gn : array(__('Guest')));
47 | }
48 |
49 | function isMemberOf($gid) {
50 | return in_array($gid, $this->getGroupIds());
51 | }
52 |
53 | }
54 |
55 | ?>
--------------------------------------------------------------------------------
/View/Groups/add.ctp:
--------------------------------------------------------------------------------
1 | Html->addCrumb('New Group', $this->Html->url( null, true )); ?>
2 |
3 |
4 |
5 |
11 |
12 | Form->create('Group');?>
13 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Model/Rule.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 | App::uses('AuthakeAppModel', 'Authake.Model');
22 | class Rule extends AuthakeAppModel {
23 | var $name = 'Rule';
24 | var $useTable = 'authake_rules';
25 | var $belongsTo = array('Group' => array('className' => 'Authake.Group', 'foreignKey' => 'group_id', 'order' => 'Rule.order ASC' ) );
26 | var $useDbConfig = 'authake';
27 | function getRules($group_ids, $cleanRegex = false) {
28 |
29 | if (is_array($group_ids))
30 | {
31 | //if no group get rules for the all users (with group_id is null)
32 | $groups = implode(',', $group_ids);
33 | $conditions = "Rule.group_id IN ({$groups}) OR Rule.group_id is NULL";
34 | }
35 | else
36 | {
37 | $conditions = 'Rule.group_id is NULL';
38 | }
39 |
40 | $fields = '';
41 | $order = 'Rule.order ASC, Rule.group_id ASC';
42 | $data = $this->find('all', array('conditions'=>$conditions, 'fields'=>$fields, 'order'=>$order, 'contain'=>array()));
43 |
44 | if ($cleanRegex)
45 | {
46 | $nb = count($data);
47 |
48 | for ($i=0; $i<$nb; $i++)
49 | {
50 | $data[$i]['Rule']['action'] = str_replace(array('/','*', ' or '), array('\/', '.*', '|'), $data[$i]['Rule']['action']);
51 | }
52 | }
53 |
54 | return $data;
55 | }
56 | }
57 | ?>
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | v2.3.1 (Mar 25, 2012) Mutlu Tevfik Kocak
2 | * Settings are working
3 | * Schema is deleted due to faults
4 |
5 | v2.2.3 (Nov 6, 2012) Mutlu Tevfik Kocak
6 | * Gravatar support
7 | * All new look & feel
8 | * Continuous login failure issue solved
9 | * New markdowns added
10 | * Enum type of rule permissions are removed
11 | * Schema file generated
12 | * New markdown files added
13 |
14 | v2.1 (Jan, 31 2012)
15 | * fixed: this->rquest->data issues
16 | * login using email
17 | * views thanks to Lonardo Pedretti
18 | * fixed: getcontrollers
19 |
20 | v2.0 (Oct 27, 2011) Mutlu Tevfik Kocak
21 |
22 | THIS VERSION RUNS ONLY WITH CAKEPHP 2.0
23 |
24 | * All changes made to run with CakePHP 2.0
25 | * __() translations without true thing
26 | * $components are now $this->Component
27 | * All folder and file names are compatible with CakePHP 2.0
28 | * And many other great things to run with CakePHP 2.0
29 |
30 | v1.3 (Apr 25, 2010) Nik Chankov
31 |
32 | * Repacked the plugin into a single directory. Working with CakePHP 1.3. Adding many settings which could be overwriten within a project.
33 |
34 | v1.13 (feb 26, 2008)
35 |
36 | * The default database ids were buggy, as I forgot to include the auto_increment values when exporting to sql (thanks to Eric)
37 |
38 | v1.12 (feb 25, 2008)
39 |
40 | * Bug (partialy solved) when password changing in user_controller.php (thanks to Kiang, http://twpug.net/)
41 |
42 | v1.11 (feb 19, 2008)
43 |
44 | * Accounts have an expiry date
45 |
46 | v1.10 (feb 14, 2008)
47 |
48 | THE DATABASE CHANGED SO YOU SHOULD REINSTALL ALL THE TABLES
49 |
50 | * Only administrators can modify or make an administrator. Avoid to gain administrator level.
51 | * Accounts can be disabled (Marco Sbragi's suggestion)
52 | * Cometic changes in app_controller.php (everything moved to authake component).
53 | * Possible to set a specific flash message for the rule that denies the access.
54 | * New session timeout feature. Allow to have an illimited cake session, and then choose the application session timeout.
55 |
56 | First release (feb 12, 2008)
57 |
--------------------------------------------------------------------------------
/webroot/js/html5shiv.js:
--------------------------------------------------------------------------------
1 | /*
2 | HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x";
6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;dHtml->addCrumb('New User', $this->Html->url( null, true )); ?>
2 |
3 |
4 |
5 |
11 |
12 | Form->create('User');?>
13 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/View/Authake/index.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
12 |
13 |
14 | Admins
15 |
16 |
17 |
18 |
19 |
20 | Total Users
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
37 | Groups
38 |
39 |
40 |
41 |
42 |
43 | Rules
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
95 |
--------------------------------------------------------------------------------
/Model/AuthakeAppModel.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 | App::uses('AppModel', 'Model');
22 | class AuthakeAppModel extends AppModel {
23 | /**
24 | * Get Enum Values
25 | * Snippet v0.1.3
26 | * http://cakeforge.org/snippet/detail.php?type=snippet&id=112
27 | *
28 | * Gets the enum values for MySQL 4 and 5 to use in selectTag()
29 | */
30 | function getEnumValues($columnName=null, $respectDefault=false) {
31 | if ($columnName==null)
32 | {
33 | return array();
34 | }
35 |
36 | //no field specified
37 | //Get the name of the table
38 | $db =& ConnectionManager::getDataSource($this->useDbConfig);
39 | $tableName = $db->fullTableName($this, false);//Get the values for the specified column (database and version specific, needs testing)
40 | $result = $this->query("SHOW COLUMNS FROM {$tableName} LIKE '{$columnName}'");//figure out where in the result our Types are (this varies between mysql versions)
41 | $types = null;
42 |
43 | if (isset($result[0]['COLUMNS']['Type'] ) )
44 | {
45 | $types = $result[0]['COLUMNS']['Type'];
46 | $default = $result[0]['COLUMNS']['Default'];
47 | }
48 |
49 | //MySQL 5
50 | elseif (isset($result[0][0]['Type'] ) )
51 | {
52 | $types = $result[0][0]['Type'];
53 | $default = $result[0][0]['Default'];
54 | }
55 |
56 | //MySQL 4
57 | else {
58 | return array();
59 | }
60 |
61 | //types return not accounted for
62 | //Get the values
63 | $values = explode('\',\'', preg_replace('/(enum)\(\'(.+?)\'\)/', '\\2', $types) );
64 |
65 | if ($respectDefault)
66 | {
67 | $assoc_values = array("$default"=>Inflector::humanize($default));
68 |
69 | foreach ($values as $value )
70 | {
71 | if ($value==$default)
72 | {
73 | continue;
74 | }
75 |
76 | $assoc_values[$value] = Inflector::humanize($value);
77 | }
78 | }
79 | else
80 | {
81 | $assoc_values = array();
82 |
83 | foreach ($values as $value )
84 | {
85 | $assoc_values[$value] = Inflector::humanize($value);
86 | }
87 | }
88 |
89 | return $assoc_values;
90 | }
91 |
92 | //end getEnumValues
93 | }
94 | ?>
--------------------------------------------------------------------------------
/View/User/index.ctp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 | Authake->Gravatar->get_gravatar($this->Authake->getUserMail(),130,'','',true);
14 | }
15 | ?>
16 |
17 |
18 |
21 |
22 |
23 |
24 | |
25 | (ID {$user['User']['id']})"; ?> |
26 |
27 |
28 | | Groups |
29 |
30 |
34 |
35 |
43 |
44 |
47 | |
48 |
49 |
50 | |
51 | Time->format('d/m/Y H:i', $this->Time->fromString($user['User']['created'])); ?> |
52 |
53 |
54 |
55 |
56 | Form->create('User', array('url' => array('controller' => 'user', 'action'=>'index')));?>
57 |
65 | Form->end(array('div'=>false,'label'=>'Save','class'=>'action input-action btn btn-success'));?>
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/View/Groups/index.ctp:
--------------------------------------------------------------------------------
1 | Html->addCrumb('Groups', $this->Html->url( null, true ));
2 | $up = null;
3 | //echo $this->Html->image($this->Gravatar->get_gravatar('mtkocak@gmail.com'));
4 | ?>
5 |
6 |
7 |
8 |
26 |
27 |
28 |
29 |
32 |
33 | |
34 | Html->link($group['Group']['name'], array('action'=>'view', $group['Group']['id'])); ?>
35 | |
36 |
37 |
69 | |
70 |
71 |
72 |
73 |
74 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/webroot/index.php:
--------------------------------------------------------------------------------
1 | dispatch();
84 | }
85 | if (Configure::read() > 0) {
86 | echo "";
87 | }
88 | ?>
--------------------------------------------------------------------------------
/View/Helper/AuthakeHelper.php:
--------------------------------------------------------------------------------
1 | .
20 | */
21 |
22 | class AuthakeHelper extends AppHelper {
23 |
24 | var $helpers = array('Session','Authake.Gravatar','Html');
25 |
26 | function getUserId() {
27 | return $this->Session->read('Authake.id');
28 | }
29 |
30 | function getUserEmail() {
31 | return $this->Session->read('Authake.email');
32 | }
33 |
34 | function getUserMenu() {
35 | if ( ! Configure::read('Authake.useEmailAsUsername') )
36 | {
37 | $loginName = $this->getLogin();
38 | }
39 | else
40 | {
41 | $loginName = $this->getUserEmail();
42 | }
43 | if($loginName){
44 | $output = '
45 | '.
46 | $this->Gravatar->get_gravatar($this->getUserEmail(),18,'','',true).' '.
47 | $loginName.'
48 |
53 | ';
54 | }
55 | else
56 | {
57 | $output = ''.$this->Html->link(__('Sign Up'), array('plugin'=>'authake','controller'=> 'user', 'action'=>'register')).'';
58 | $output .= ''.$this->Html->link(__('Login'), array('plugin'=>'authake','controller'=> 'user', 'action'=>'login')).'';
59 | }
60 | return $output;
61 | }
62 |
63 | function isLogged() {
64 | return ($this->getUserId() !== null);
65 | }
66 |
67 | function getLogin() {
68 | return $this->Session->read('Authake.login');
69 | }
70 |
71 | function getGroupIds() {
72 | $gid = $this->Session->read('Authake.group_ids');
73 | return (empty($gid) ? array(0) : $gid);
74 | }
75 |
76 | function getGroupNames() {
77 | $gn = $this->Session->read('Authake.group_names');
78 | return (is_array($gn) ? $gn : array(__('Guest')));
79 | }
80 |
81 | function isMemberOf($gid) {
82 | return in_array($gid, $this->getGroupIds());
83 | }
84 |
85 | }
86 |
87 | ?>
--------------------------------------------------------------------------------
/db/authake_clean.sql:
--------------------------------------------------------------------------------
1 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
2 |
3 | CREATE TABLE IF NOT EXISTS `authake_groups` (
4 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
5 | `name` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
6 | PRIMARY KEY (`id`)
7 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;
8 |
9 | INSERT INTO `authake_groups` (`id`, `name`) VALUES
10 | (1, 'Administrators'),
11 | (2, 'Registered users');
12 |
13 | CREATE TABLE IF NOT EXISTS `authake_groups_users` (
14 | `user_id` int(10) unsigned NOT NULL DEFAULT '0',
15 | `group_id` int(10) unsigned NOT NULL DEFAULT '0'
16 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
17 |
18 |
19 | INSERT INTO `authake_groups_users` (`user_id`, `group_id`) VALUES
20 | (1, 1);
21 |
22 | CREATE TABLE IF NOT EXISTS `authake_rules` (
23 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
24 | `name` varchar(256) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Rule description',
25 | `group_id` int(10) unsigned DEFAULT NULL,
26 | `order` int(10) unsigned DEFAULT NULL,
27 | `action` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL,
28 | `permission` tinyint(1) NOT NULL DEFAULT '0',
29 | `forward` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
30 | `message` varchar(512) COLLATE utf8_unicode_ci NOT NULL,
31 | PRIMARY KEY (`id`)
32 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
33 |
34 | INSERT INTO `authake_rules` (`id`, `name`, `group_id`, `order`, `action`, `permission`, `forward`, `message`) VALUES
35 | (1, 'Allow everything for Administrators', 1, 999999, '*', 1, '', ''),
36 | (2, 'Allow anybody to see the home page, the error page, to register, to log in, see profile and log out', null, 200, '/ or /authake/user/* or /register or /login or /logout or /lost-password or /verify(/)?* or /pass(/)?* or /profile or /denied or /pages(/)?* or //pages/*', 1, '', ''),
37 | (4, 'Deny everything for everybody by default (allow to have allow by default then deny)', null, 0, '*', 0, '', 'Access denied!'),
38 | (6, 'Display a message for denied admin page', null, 100, '/authake(/index)? or /authake/users* or /authake/groups* or /authake/rules*', 0, '', 'You are not allowed to access the administration page!');
39 |
40 | CREATE TABLE IF NOT EXISTS `authake_users` (
41 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
42 | `login` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
43 | `password` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
44 | `email` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
45 | `emailcheckcode` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
46 | `passwordchangecode` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
47 | `disable` tinyint(1) NOT NULL COMMENT 'Disable/enable account',
48 | `expire_account` date DEFAULT NULL,
49 | `created` datetime DEFAULT NULL,
50 | `updated` datetime DEFAULT NULL,
51 | PRIMARY KEY (`id`)
52 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
53 |
54 | INSERT INTO `authake_users` (`id`, `login`, `password`, `email`, `emailcheckcode`, `passwordchangecode`, `disable`, `expire_account`, `created`, `updated`) VALUES
55 | (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'root', '', '', 0, NULL, '2008-02-12 12:19:31', '2008-02-12 12:19:31');
56 |
57 |
--------------------------------------------------------------------------------
/webroot/css.php:
--------------------------------------------------------------------------------
1 |
11 | * Copyright 2005-2008, Cake Software Foundation, Inc.
12 | * 1785 E. Sahara Avenue, Suite 490-204
13 | * Las Vegas, Nevada 89104
14 | *
15 | * Licensed under The MIT License
16 | * Redistributions of files must retain the above copyright notice.
17 | *
18 | * @filesource
19 | * @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
20 | * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
21 | * @package cake
22 | * @subpackage cake.app.webroot
23 | * @since CakePHP(tm) v 0.2.9
24 | * @version $Revision: 6311 $
25 | * @modifiedby $LastChangedBy: phpnut $
26 | * @lastmodified $Date: 2008-01-02 00:33:52 -0600 (Wed, 02 Jan 2008) $
27 | * @license http://www.opensource.org/licenses/mit-license.php The MIT License
28 | */
29 | if (!defined('CAKE_CORE_INCLUDE_PATH')) {
30 | header('HTTP/1.1 404 Not Found');
31 | exit('File Not Found');
32 | }
33 | /**
34 | * Enter description here...
35 | */
36 | uses('file');
37 | /**
38 | * Enter description here...
39 | *
40 | * @param unknown_type $path
41 | * @param unknown_type $name
42 | * @return unknown
43 | */
44 | function make_clean_css($path, $name) {
45 | require(VENDORS . 'csspp' . DS . 'csspp.php');
46 | $data = file_get_contents($path);
47 | $csspp = new csspp();
48 | $output = $csspp->compress($data);
49 | $ratio = 100 - (round(strlen($output) / strlen($data), 3) * 100);
50 | $output = " /* file: $name, ratio: $ratio% */ " . $output;
51 | return $output;
52 | }
53 | /**
54 | * Enter description here...
55 | *
56 | * @param unknown_type $path
57 | * @param unknown_type $content
58 | * @return unknown
59 | */
60 | function write_css_cache($path, $content) {
61 | if (!is_dir(dirname($path))) {
62 | mkdir(dirname($path));
63 | }
64 | $cache = new File($path);
65 | return $cache->write($content);
66 | }
67 |
68 | if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) {
69 | die('Wrong file name.');
70 | }
71 |
72 | $filename = 'css/' . $regs[1];
73 | $filepath = CSS . $regs[1];
74 | $cachepath = CACHE . 'css' . DS . str_replace(array('/','\\'), '-', $regs[1]);
75 |
76 | if (!file_exists($filepath)) {
77 | die('Wrong file name.');
78 | }
79 |
80 | if (file_exists($cachepath)) {
81 | $templateModified = filemtime($filepath);
82 | $cacheModified = filemtime($cachepath);
83 |
84 | if ($templateModified > $cacheModified) {
85 | $output = make_clean_css($filepath, $filename);
86 | write_css_cache($cachepath, $output);
87 | } else {
88 | $output = file_get_contents($cachepath);
89 | }
90 | } else {
91 | $output = make_clean_css($filepath, $filename);
92 | write_css_cache($cachepath, $output);
93 | $templateModified = time();
94 | }
95 |
96 | header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT');
97 | header("Content-Type: text/css");
98 | header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT");
99 | header("Cache-Control: cache"); // HTTP/1.1
100 | header("Pragma: cache"); // HTTP/1.0
101 | print $output;
102 | ?>
--------------------------------------------------------------------------------
/View/Layouts/authake.ctp:
--------------------------------------------------------------------------------
1 | Html->docType('html5'); ?>
2 |
3 |
4 |
5 |
6 | Html->charset();
8 | echo $this->Html->meta('icon');
9 | $this->Html->css('/authake/css/bootstrap.min', null, array('inline' => false));
10 | $this->Html->css('/authake/css/custom', null, array('inline' => false));
11 | $this->Html->script('Authake.jquery-latest', array('block' => 'script'));
12 | $this->Html->script('Authake.custom', array('block' => 'script'));
13 | $this->Html->script('Authake.bootstrap.min', array('block' => 'script'));
14 | $this->Html->script('Authake.html5shiv', array('block' => 'script'));
15 |
16 | echo $this->fetch('meta');
17 | echo $this->fetch('css');
18 | echo $this->fetch('script');
19 | ?>
20 |
21 |
22 |
23 |
24 |
25 |
26 |
Authake
27 |
28 | -
29 | Users
30 |
35 |
36 | -
37 | Groups
38 |
43 |
44 | -
45 | Rules
46 |
51 |
52 |
53 |
54 | - Settings
55 | Authake->getUserMenu(); ?>
56 |
57 | - Help
58 |
59 |
60 |
61 |
62 |
63 |
64 | Session->check('Message.flash')):
66 | echo $this->Session->flash();
67 | endif;
68 | ?>
69 | ".$this->Html->getCrumbs(' » ', array(
71 | 'text' => 'Dashboard',
72 | 'url' => array('controller' => 'authake', 'action' => 'index', 'home'),
73 | 'escape' => false
74 | ))."";
75 | echo $this->fetch('content');
76 | ?>
77 |
78 |
80 |
81 |