updated code for demo
@ -1,240 +0,0 @@
|
||||
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require APPPATH . '/libraries/BaseController.php';
|
||||
|
||||
/**
|
||||
* Class : purchaseorder (PurchaseorderController)
|
||||
* User Class to control all user related operations.
|
||||
* @author : VenbaMail Mali
|
||||
* @version : 1.1
|
||||
* @since : 15 Feb 2016
|
||||
*/
|
||||
class assetdetails extends BaseController
|
||||
{
|
||||
/**
|
||||
* This is default constructor of the class
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('assetdetails_model');
|
||||
$this->isLoggedIn();
|
||||
}
|
||||
/**
|
||||
* This function used to load the first screen of the user
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->global['pageTitle'] = 'Siddharth : Asset Details';
|
||||
|
||||
$this->loadViews("assetlisting", $this->global, NULL , NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to load the Supplier list
|
||||
*/
|
||||
function assetListing()
|
||||
{
|
||||
if($this->isAdmin() == TRUE)
|
||||
{
|
||||
$this->loadThis();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('assetdetails_model');
|
||||
|
||||
$searchText = $this->input->post('searchText');
|
||||
$data['searchText'] = $searchText;
|
||||
|
||||
$this->load->library('pagination');
|
||||
|
||||
$count = $this->assetdetails_model->assetListingCount($searchText);
|
||||
|
||||
$returns = $this->paginationCompress ( "assetListing/", $count, 5 );
|
||||
|
||||
$data['userRecords'] = $this->assetdetails_model->assetListing($searchText, $returns["page"], $returns["segment"]);
|
||||
|
||||
$this->global['pageTitle'] = 'Siddharth : Cost Listing';
|
||||
|
||||
$this->loadViews("costListing", $this->global, $data, NULL);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function is used to load the add new supplier */
|
||||
function addasset()
|
||||
{
|
||||
if($this->isAdmin() == TRUE)
|
||||
{
|
||||
$this->loadThis();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('supplier_model');
|
||||
//$data['SupplierName'] = $this->purchaseorder_model->getSupplierName();
|
||||
//$data['users'] = $this->purchaseorder_model->getusers();
|
||||
|
||||
$this->global['pageTitle'] = 'siddharth : AddNew Asset';
|
||||
|
||||
$this->loadViews("addasset", $this->global, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to add new user to the system
|
||||
*/
|
||||
function addNewasset()
|
||||
{
|
||||
if($this->isAdmin() == TRUE)
|
||||
{
|
||||
$this->loadThis();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
//$PO = $this->input->post('SupplierID');
|
||||
|
||||
//$this->form_validation->set_rules('CostCenterID','Supplier Name','trim');
|
||||
$this->form_validation->set_rules('CostName','Address','trim|required|');
|
||||
$this->form_validation->set_rules('Description','Contact Number','trim');
|
||||
|
||||
|
||||
|
||||
if($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->addsupplier();
|
||||
}
|
||||
else
|
||||
{
|
||||
$CostName = ucwords(strtolower($this->input->post('CostName')));
|
||||
$Description = $this->input->post('Description');
|
||||
|
||||
|
||||
|
||||
|
||||
$Cost = array('CostName'=>$CostName, 'Description'=>$Description,'createdDate'=>date('Y-m-d H:i:sa'));
|
||||
|
||||
$this->load->model('assetdetails_model');
|
||||
$result = $this->assetdetails_model->addNewasset($asset);
|
||||
|
||||
if($result > 0)
|
||||
{
|
||||
$this->session->set_flashdata('success', 'New PO created successfully');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error', 'PO Not Create');
|
||||
}
|
||||
|
||||
redirect('codeListing');
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This function is used load user edit information
|
||||
* @param number $userId : Optional : This is user id
|
||||
*/
|
||||
function editOldcost($CostCenterID = NULL)
|
||||
{
|
||||
if($this->isAdmin() == TRUE || $CostCenterID == 1)
|
||||
{
|
||||
$this->loadThis();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($CostCenterID == null)
|
||||
{
|
||||
redirect('costListing');
|
||||
}
|
||||
|
||||
//$data['SupplierName'] = $this->purchaseorder_model->getSupplierName();
|
||||
//$data['users'] = $this->purchaseorder_model->getusers();
|
||||
|
||||
$this->global['pageTitle'] = 'Siddharth : Edit User';
|
||||
|
||||
$this->loadViews("editOldcost", $this->global, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to edit the user information
|
||||
*/
|
||||
function editcost()
|
||||
{
|
||||
if($this->isAdmin() == TRUE)
|
||||
{
|
||||
$this->loadThis();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
//$PO = $this->input->post('PO');
|
||||
|
||||
$this->form_validation->set_rules('CostName','Cost Name','trim|required|');
|
||||
$this->form_validation->set_rules('Description','Description','trim|required|');
|
||||
|
||||
|
||||
if($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->editPO();
|
||||
}
|
||||
else
|
||||
{
|
||||
$CostName = ucwords(strtolower($this->input->post('CostName')));
|
||||
$Description = $this->input->post('Description');
|
||||
|
||||
$Cost = array('CostName'=>$CostName, 'Description'=>$Description,'createdDtm'=>date('Y-m-d H:i:sa'));
|
||||
|
||||
|
||||
|
||||
$Cost = array();
|
||||
|
||||
$result = $this->costcenter_model->editcost($Cost, $CostCentreID);
|
||||
|
||||
if($result == true)
|
||||
{
|
||||
$this->session->set_flashdata('success', 'PO updated successfully');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error', 'PO updation failed');
|
||||
}
|
||||
|
||||
redirect('costListing');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to delete the user using userId
|
||||
* @return boolean $result : TRUE / FALSE
|
||||
*/
|
||||
function deleteUser()
|
||||
{
|
||||
if($this->isAdmin() == TRUE)
|
||||
{
|
||||
echo(json_encode(array('status'=>'access')));
|
||||
}
|
||||
else
|
||||
{
|
||||
$userId = $this->input->post('userId');
|
||||
$userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>date('Y-m-d H:i:sa'));
|
||||
|
||||
$result = $this->user_model->deleteUser($userId, $userInfo);
|
||||
|
||||
if ($result > 0) { echo(json_encode(array('status'=>TRUE))); }
|
||||
else { echo(json_encode(array('status'=>FALSE))); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function pageNotFound()
|
||||
{
|
||||
$this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
|
||||
|
||||
$this->loadViews("404", $this->global, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,49 +0,0 @@
|
||||
# Credits
|
||||
|
||||
The following products were used in the creation of Appunto-Auth. Trademarks and copyrights are property of their respective owners.
|
||||
|
||||
## CodeIgniter
|
||||
http://codeigniter.com/
|
||||
|
||||
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to
|
||||
create full-featured web applications.</p>
|
||||
|
||||
For licensing information, please visit http://codeigniter.com/user_guide/license.html
|
||||
|
||||
## Sencha Ext JS
|
||||
http://www.sencha.com/products/extjs/
|
||||
|
||||
Ext JS is a JavaScript framework for building rich internet applications that work in any web browser.
|
||||
Appunto-Auth uses the GPL version of Ext JS.
|
||||
|
||||
For licensing information, please visit http://www.sencha.com/products/extjs/licensing/
|
||||
|
||||
## Silk Icons
|
||||
http://www.famfamfam.com/lab/icons/silk/
|
||||
|
||||
Silk is a smooth, free icon set, containing over 700 16-by-16 pixel icons in strokably-soft PNG format.
|
||||
|
||||
Silk is licensed under a Creative Commons Attribution 2.5 License.
|
||||
|
||||
## Fugue Icons
|
||||
http://p.yusukekamiyamane.com/
|
||||
|
||||
Icon set by Yusuke Kamiyamane.
|
||||
|
||||
Fugue Icons are licensed under a Creative Commons Attribution 3.0 License.
|
||||
|
||||
## Silk companion icon set
|
||||
http://www.damieng.com/icons/silkcompanion
|
||||
|
||||
Icon set by Damien Guard.
|
||||
|
||||
Silk companion icon set is licensed under a Creative Commons Attribution 2.5 License.
|
||||
|
||||
## Translations
|
||||
|
||||
__portuguese-br__
|
||||
|
||||
CodeIgniter translation: https://github.com/CIBr/CodeIgniter-Portuguese-BR
|
||||
|
||||
Appunto-Auth translation: Loanda Drew and Ricardo Silva
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
# Appunto-Auth license
|
||||
|
||||
####License for all files except for third party files, the app.js and theme.css files
|
||||
|
||||
Appunto Auth is licensed under a version of the MIT license.
|
||||
Please do not remove the copyright and permission notice contained in this file.
|
||||
|
||||
Copyright (c) 2012-2014 Bill Clinton (bclinton@appunto.net)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software in the application/libraries/appunto-auth folder
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#### License for all third party files
|
||||
|
||||
The license of all third party files are governed by the terms of their licenses. Please see
|
||||
the CREDITS.MD file for a list of all third party files.
|
||||
|
||||
#### License for app.js and theme.css files
|
||||
|
||||
Per Sencha requirements, the app.js and theme.css files are governed by the terms of the GPLv3 license.
|
||||
284
app/README.md
@ -1,284 +0,0 @@
|
||||
# Appunto-Auth
|
||||
|
||||
An authentication library for CodeIgniter with a Sencha Ext JS interface and a simple ACL.
|
||||
|
||||
current release 0.1.3
|
||||
|
||||
The goal of Appunto-Auth is to provide the CodeIgniter developer with an authentication and user management
|
||||
system that takes authentication code out of an application's individual controller classes and functions.
|
||||
|
||||
For more information go to http://www.appunto.net/appunto-auth
|
||||
|
||||
<!-- MarkdownTOC depth=3 autolink=true bracket=round -->
|
||||
|
||||
- [Features](#features)
|
||||
- [Installing](#installing)
|
||||
- [CodeIgniter Setup](#codeigniter-setup)
|
||||
- [Download Appunto-Auth](#download-appunto-auth)
|
||||
- [Update Codeigniter configuration files](#update-codeigniter-configuration-files)
|
||||
- [Support for multiple languages](#support-for-multiple-languages)
|
||||
- [Translating Appunto-Auth](#translating-appunto-auth)
|
||||
- [Helpers](#helpers)
|
||||
- [Public Library Functions](#public-library-functions)
|
||||
- [Additional Notes](#additional-notes)
|
||||
- [A note on removing index.php](#a-note-on-removing-indexphp)
|
||||
- [A note on _remap (Remapping Function Calls)](#a-note-on-_remap-remapping-function-calls)
|
||||
- [Limitations](#limitations)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## Features
|
||||
- Administrative interface using ExtJS
|
||||
- Authentication performed in a hook rather than controller code
|
||||
- Simple ACL with roles and permissions
|
||||
- Restrict/Allow access using controller/function paths
|
||||
- Hashes passwords in database using phpass library
|
||||
- Multiple language support
|
||||
|
||||
## Installing
|
||||
|
||||
### CodeIgniter Setup
|
||||
|
||||
Enable CodeIgniter to use the database to store sessions by following the instructions
|
||||
in the _Saving Session Data to a Database_ section of the _Session Class_ page in the CodeIgniter
|
||||
User Guide located at http://codeigniter.com/user_guide/libraries/sessions.html
|
||||
|
||||
- set an __encryption_key__ in CodeIgniter's config/config.php
|
||||
- create the ci_sessions database table
|
||||
- enable the database option in your config.php by setting __sess_use_database__ to TRUE in CodeIgniter's config.php
|
||||
|
||||
video walkthrough of this step here: https://www.youtube.com/watch?v=GlQSNBO2Eg4
|
||||
|
||||
|
||||
### Download Appunto-Auth
|
||||
|
||||
The latest version of Appunto-Auth is available at http://www.appunto.net/appunto-auth/download
|
||||
|
||||
You can download the most recent working build at https://github.com/BillClinton/Appunto-Auth
|
||||
|
||||
The Appunto-Auth download contains 4 folders:
|
||||
```
|
||||
.
|
||||
|-application
|
||||
|-resources
|
||||
|-db
|
||||
|-src
|
||||
```
|
||||
|
||||
#### Copy the application and resources folders to your application folder
|
||||
|
||||
The application folder contains controllers, models, views, helpers, libraries, and config folders.
|
||||
While it is always a good idea to back up your application, the files contained in these folders are in
|
||||
appunto-auth subfolders and should not overwrite anything in your existing CodeIgniter folder structure.
|
||||
|
||||
The files in the language folder are not in an appunto-auth subfolder, but unless you already have a file
|
||||
named appunto_auth_lang.php in one of your language folders (unlikely), you don't have to worry about any
|
||||
language file overwriting
|
||||
|
||||
The files in the resources folder contain javascript, css and images needed by the Appunto-Auth admin interface.
|
||||
|
||||
Copy the downloaded __applications__ and __resources__ folders into your main Codeigniter folder (the folder that
|
||||
contains the system and application folder)
|
||||
|
||||
Your CodeIgniter folder should now look like this:
|
||||
```
|
||||
.
|
||||
|-application
|
||||
|-resources
|
||||
|-system
|
||||
|-user_guide (if you haven't deleted it yet)
|
||||
```
|
||||
|
||||
### Update Codeigniter configuration files
|
||||
|
||||
#### Load the Appunto_auth.php library file in autoload.php
|
||||
Include a reference to the Appunto_auth library in CodeIgniter's config/autoload.php file. CodeIgniter will be calling a method in this library in a post_controller_constructor hook, so it will be needed in every controller. Therefore there is no reason to load it in your individual controllers rather than in the autoload file. Example:
|
||||
|
||||
```
|
||||
$autoload['libraries'] = array('appunto-auth/appunto_auth');
|
||||
```
|
||||
|
||||
#### Import the Appunto-Auth tables
|
||||
Use the table creation script in the __db__ folder to create the Appunto-Auth tables. You can use the command line:
|
||||
|
||||
```
|
||||
mysql -u [db username] -p [db name] < db/create_auth_db.sql
|
||||
```
|
||||
Or just paste the contents of this file into PhpMyAdmin.
|
||||
|
||||
Your database should already contain the ci_session table.
|
||||
|
||||
#### Include Reference to Hook in hooks.php
|
||||
Appunto-Auth authenticates the user in a post_controller_constructor hook. The hook function resides in the Appunto_auth.php
|
||||
library file. A reference to this hook must be included in CodeIgniter's config/hooks.php file using the following format:
|
||||
|
||||
```
|
||||
$hook['post_controller_constructor'] = array(
|
||||
'class' => 'Appunto_auth',
|
||||
'function' => 'require_authentication_hook',
|
||||
'filename' => 'appunto-auth/Appunto_auth.php',
|
||||
'filepath' => 'libraries',
|
||||
'params' => array()
|
||||
);
|
||||
```
|
||||
#### Enable CodeIgniter hooks
|
||||
Enable CodeIgniter hooks by setting __enable_hooks__ to TRUE in your application's config.php
|
||||
|
||||
## Support for multiple languages
|
||||
|
||||
The current release of Appunto-Auth includes one additional language: Brazilian Portuguese. If you translate Appunto-Auth
|
||||
to your native language, I would love to include it in future releases. Please send me the files at code@appunto.net
|
||||
or fork the project and add them yourself using these instructions: http://kbroman.org/github_tutorial/pages/fork.html
|
||||
|
||||
To try the Portuguese translation, change the value of the $config['language'] setting in the CodeIgniter config/config.php
|
||||
file from __english__ to __portuguese-br__
|
||||
|
||||
### Translating Appunto-Auth
|
||||
|
||||
#### Codeigniter language files
|
||||
|
||||
The first step in translating Appunto-Auth is to create or find a translation of the CodeIgniter language files.
|
||||
When you change the language via the $config['language'] setting in the CodeIgniter config/config.php, CodeIgniter
|
||||
libraries will expect these files to be there and you will most likely experience PHP errors if they are not there.
|
||||
|
||||
There are many translations out there for CodeIgniter's language files and you should be able to find one for your language.
|
||||
If not, copy the English files from system/language/english into application/language/your-language to prevent PHP errors. You
|
||||
can then change the text in these files where necessary. If you complete a full translation, please post it and share it with
|
||||
other CodeIgniter developers.
|
||||
|
||||
#### Appunto-Auth Codeigniter language file
|
||||
|
||||
Appunto-Auth's CodeIgniter language files are included in the application/language/[language-name] folders. To add your own
|
||||
translation, create a folder with the name of your language in the application/language/ folder. Copy the
|
||||
appunto_auth_lang.php into your new folder from one of the other language folders and use it as a template.
|
||||
|
||||
__The name of this folder must match the name of the value of the $config['language'] setting in the CodeIgniter config/config.php__
|
||||
|
||||
|
||||
#### Appunto-Auth admin interface language file
|
||||
|
||||
The language files used to translate many of the elements of the admin interface are javascript files located
|
||||
at resources/appunto-auth/lang/ . To translate this into your own language, start with the english.js file and rename it to
|
||||
your-language.js.
|
||||
|
||||
__The name of this file must match the name of the CodeIgniter language folder and the value of the $config['language']
|
||||
setting in the CodeIgniter config/config.php__
|
||||
|
||||
Change the text values from English to your native language, but be very careful about quotes and commas. Javascript can
|
||||
be very finicky and a missed comma or misplaced quote can cause a javascript error that will prevent the application from
|
||||
opening at all. If your admin interface does not load, check your syntax. Please convert all accented and special characters
|
||||
to HTML safe entities using a converter like this: http://www.kidquick.com/JoomlaTools/frenchAccents.htm
|
||||
|
||||
## Helpers
|
||||
|
||||
__appunto_login_box()__
|
||||
|
||||
creates a login dialog
|
||||
|
||||
__anchor_if_permitted($permission,$uri,$title,$attributes)__
|
||||
|
||||
Creates an anchor based on the local URL if user has the appropriate permission. The permission parameter is case
|
||||
sensitive and must match the internal name of a permission you have created in the admin interface for this
|
||||
function to return a link
|
||||
|
||||
This helper uses the anchor() helper function from CodeIgniter's URL Helper so use the guidelines for that function for
|
||||
the 2nd, 3rd and 4th parameters.
|
||||
|
||||
__appunto_username()__
|
||||
|
||||
Returns the user's username, if logged in.
|
||||
|
||||
__appunto_logout_link($show_if_logged_out,$attributes)__
|
||||
|
||||
Creates a logout link based on the logout path defined in the appunto_auth.php config file, using the logout text specified
|
||||
in the appunto_auth_lang.php file.
|
||||
|
||||
If the first parameter is true, a logout link will be returned even if the user is not logged in. Defaults to false.
|
||||
|
||||
The second parameter can contain a list of attributes you would like added to the link. The attributes can be a simple
|
||||
string or an associative array, as defined by the anchor() helper function from CodeIgniter's URL Helper.
|
||||
|
||||
__is_logged_in()__
|
||||
|
||||
Returns true if the user is logged in, false if the user is not logged in.
|
||||
|
||||
## Public Library Functions
|
||||
|
||||
While one of the goals of Appunto-Auth is to take authentication code out of the application's controllers,
|
||||
occasionally situations require some user control within the controller classes, for example if you want your
|
||||
default controller to redirect to another controller depending on the user's permissions.
|
||||
|
||||
These functions can be called using the following syntax:
|
||||
```
|
||||
$this->appunto_auth->function_name()
|
||||
```
|
||||
|
||||
__logged_in()__
|
||||
|
||||
Returns true if the user is logged in, false if the user is not logged in.
|
||||
|
||||
__get_username()__
|
||||
|
||||
Returns the user's username if the user is logged in, false if the user is not logged in.
|
||||
|
||||
__get_user_id()__
|
||||
|
||||
Returns the user's id if the user is logged in, false if the user is not logged in.
|
||||
|
||||
__userHasPermission($permission)__
|
||||
|
||||
The $permission parameter is case sensitive and must match the internal name of a permission you have created in the admin interface.
|
||||
|
||||
Returns true if the user has the specified permission, false if the user is not logged in or does not
|
||||
have the specified permission.
|
||||
|
||||
|
||||
## Additional Notes
|
||||
|
||||
### A note on removing index.php
|
||||
|
||||
You may remove the index.php from your URLs as described in the CodeIgniter user guide, but make sure you alter the rewrite rule to exclude the resources folder so the css and javascript files are not served by the index.php. If you are using the example .htaccess from the user guide:
|
||||
```
|
||||
RewriteEngine on
|
||||
RewriteCond $1 !^(index\.php|images|robots\.txt)
|
||||
RewriteRule ^(.*)$ /index.php/$1 [L]
|
||||
```
|
||||
add resources to the RewriteCond line like this:
|
||||
```
|
||||
RewriteEngine on
|
||||
RewriteCond $1 !^(index\.php|images|robots\.txt|resources)
|
||||
RewriteRule ^(.*)$ /index.php/$1 [L]
|
||||
```
|
||||
If your application is not being served from the root of your domain, be sure to alter the third line with the correct path:
|
||||
```
|
||||
RewriteRule ^(.*)$ /myapplication/index.php/$1 [L]
|
||||
```
|
||||
|
||||
### A note on _remap (Remapping Function Calls)
|
||||
|
||||
CodeIgniter allows the developer to remap function calls as detailed here: https://ellislab.com/codeigniter/user-guide/general/controllers.html#remapping
|
||||
|
||||
If a controller does contain a _remap function, AppuntoAuth's verification procedure will verify the user if the user has
|
||||
necessary permissions to access a function in that controller that matches the user's request path (the normal procedure),
|
||||
or if the user has the necessary permissions to access the _remap function.
|
||||
|
||||
As noted in the CodeIgniter user guide: "If your controller contains a function named _remap(), it will always get called
|
||||
regardless of what your URI contains. It overrides the normal behavior in which the URI determines which function is called,
|
||||
allowing you to define your own function routing rules." Therefore AppuntoAuth assumes any call to a controller with a _remap
|
||||
function could be a call to the _remap function and verifies the user's permissions for the _remap function.
|
||||
|
||||
If additional access levels are desired in a controller with a _remap function, the developer must add them to the controller code.
|
||||
|
||||
### Limitations
|
||||
|
||||
#### MySQL only
|
||||
|
||||
The current release has only been tested on MySQL. I hope to add support for other databases in future releases.
|
||||
|
||||
#### Controllers with the same name
|
||||
|
||||
CodeIgniter allows you to have controllers with the same name as long as they are located in different folders. This is not
|
||||
currently supported by Appunto-Auth and all controller classes in your application must have unique names.
|
||||
|
||||
|
||||
|
||||
@ -1,87 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
$config['site_name'] = 'Appunto Auth';
|
||||
$config['admin_name'] = 'Administrator';
|
||||
$config['admin_email'] = 'admin@website.com';
|
||||
|
||||
|
||||
/**
|
||||
* Appunto Auth version
|
||||
*/
|
||||
$config['appunto_auth_version'] = '0.1.3';
|
||||
|
||||
/**
|
||||
* Admin interface theme. There are two themes:
|
||||
* appunto-auth : the default theme
|
||||
* ext-theme-gray : a neutral gray theme
|
||||
*/
|
||||
$config['appunto_auth_theme'] = 'appunto-auth';
|
||||
//$config['appunto_auth_theme'] = 'ext-theme-gray';
|
||||
|
||||
/**
|
||||
* Behavior for private paths without permissions.
|
||||
*
|
||||
* default: false
|
||||
*
|
||||
* If true, paths marked as private that don't have a permission set will be visible
|
||||
* to any logged in user. This may be useful if you have numerous URIs that should
|
||||
* be accessile to all logged in users, and you don't want to add a permission to each
|
||||
* one.
|
||||
*
|
||||
* If false, paths marked as private that don't have a permission set will be essentially
|
||||
* inaccessible until the admin assigns a permission to that path.
|
||||
*/
|
||||
$config['allow_private_without_permission'] = false;
|
||||
|
||||
/**
|
||||
* PHPPass Settings
|
||||
*
|
||||
* Quote from http://sunnyis.me/blog/secure-passwords/
|
||||
* 'The default arguments specified should be fine for up-to-date installations of PHP.
|
||||
* The first argument specifies the "base-2 logarithm of the iteration count used for
|
||||
* password stretching" and the second argument specifies the use of portable hashes.'
|
||||
*/
|
||||
$config['hash_logarithm'] = 8;
|
||||
$config['hash_use_portable'] = false;
|
||||
|
||||
/**
|
||||
* Database table prefix
|
||||
*
|
||||
* A prefix that will be added to all table names. Leave this blank if your database
|
||||
* doesn't add a prefix to your tables.
|
||||
*/
|
||||
$config['db_table_prefix'] = '';
|
||||
|
||||
/**
|
||||
* Password validation regular expression
|
||||
*
|
||||
* If you change this, be sure to change the appropriate language file to update the error message
|
||||
*
|
||||
* Default: ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z!@#$%^&*()_+-=]{6,16}$
|
||||
*
|
||||
* Password must be at least 6 characters, no more than 16 characters, and must include at
|
||||
* least one upper case letter, one lower case letter, and one numeric digit.
|
||||
*
|
||||
* Note the version that will appear as a javascript string has the backslash escaped.
|
||||
*/
|
||||
$config['password_regex_php'] = "/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z!@#$%^&*()_+-=]{6,16}$/";
|
||||
$config['password_regex_js'] = "^(?=.*\\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z!@#$%^&*()_+-=]{6,16}$";
|
||||
|
||||
/**
|
||||
* The login and logout URLs. You can change these if you create route(s) in config/routes.php
|
||||
* eg. $route['login'] = 'appunto-auth/user/login';
|
||||
*/
|
||||
$config['login_url'] = 'appunto-auth/user/login';
|
||||
$config['logout_url'] = 'appunto-auth/user/logout';
|
||||
|
||||
/**
|
||||
* Keep alive for the admin interface so sessions do not time out, in seconds. Set to 0 if you want no keep-alive
|
||||
* default = 5*60 (5 minutes)
|
||||
*/
|
||||
$config['admin_keepalive'] = 5*60;
|
||||
|
||||
/**
|
||||
* Date/time format
|
||||
*
|
||||
*/
|
||||
$config['datetime_format'] = 'm/d/Y H:i:s';
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,706 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Ui extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/appunto_auth');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function _remap($method,$params = array())
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$func = 'index';
|
||||
if (array_key_exists(0,$params)) $func = $params[0];
|
||||
|
||||
$invalid_function = array ( 'success' => false, 'msg' => 'Invalid action.');
|
||||
|
||||
switch ($method)
|
||||
{
|
||||
case 'admin':
|
||||
// $this->load->helper('appunto-auth_helper'); // helper is being loaded in library
|
||||
switch ($func)
|
||||
{
|
||||
case 'index':
|
||||
echo appunto_auth_admin(); // helper function
|
||||
break;
|
||||
default: $this->appunto_auth->sendResponse($invalid_function);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
|
||||
// $this->load->model('usermodel'); // usermodel is being loaded in library
|
||||
switch ($func)
|
||||
{
|
||||
case 'read':
|
||||
$this->appunto_auth->controller_read($this->usermodel);
|
||||
break;
|
||||
case 'create':
|
||||
$this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
|
||||
$this->form_validation->set_rules('name', 'Name', 'trim|xss_clean');
|
||||
$this->form_validation->set_rules('surname', 'Last name', 'trim|xss_clean');
|
||||
$this->form_validation->set_rules('email', 'Email address', 'trim|required|valid_email|xss_clean');
|
||||
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback__password_strength|callback__hash');
|
||||
|
||||
$this->appunto_auth->controller_create($this->usermodel);
|
||||
break;
|
||||
case 'update':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|xss_clean');
|
||||
$this->form_validation->set_rules('username', 'Username', 'trim|xss_clean');
|
||||
$this->form_validation->set_rules('name', 'Name', 'trim|xss_clean');
|
||||
$this->form_validation->set_rules('surname', 'Last name', 'trim|xss_clean');
|
||||
$this->form_validation->set_rules('email', 'Email address', 'trim|valid_email|xss_clean');
|
||||
|
||||
$this->appunto_auth->controller_update($this->usermodel);
|
||||
break;
|
||||
case 'update_pass':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|xss_clean');
|
||||
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback__password_strength|callback__hash');
|
||||
|
||||
$this->appunto_auth->controller_update($this->usermodel);
|
||||
break;
|
||||
case 'destroy':
|
||||
$this->form_validation->set_rules('id', 'Record ID', 'trim|required|numeric|xss_clean');
|
||||
|
||||
$this->appunto_auth->controller_destroy($this->usermodel);
|
||||
break;
|
||||
case 'roles':
|
||||
$this->form_validation->set_rules('id', 'Record ID', 'trim|required|numeric|xss_clean');
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort = $this->input->get_post('sort', TRUE);
|
||||
|
||||
$id = $this->input->get_post('id', TRUE);
|
||||
|
||||
$property = null;
|
||||
$direction = null;
|
||||
$active_filter = false;
|
||||
|
||||
// get sort params
|
||||
$sort_array = json_decode($sort);
|
||||
if (count($sort_array) > 0)
|
||||
{
|
||||
$property = $sort_array[0]->property;
|
||||
$direction = $sort_array[0]->direction;
|
||||
}
|
||||
|
||||
$result = $this->usermodel->get_user_roles($id,$property,$direction);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'permissions':
|
||||
$this->form_validation->set_rules('id', 'Record ID', 'trim|required|numeric|xss_clean');
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort = $this->input->get_post('sort', TRUE);
|
||||
|
||||
$id = $this->input->get_post('id', TRUE);
|
||||
|
||||
$property = null;
|
||||
$direction = null;
|
||||
$active_filter = false;
|
||||
|
||||
// get sort params
|
||||
$sort_array = json_decode($sort);
|
||||
if (count($sort_array) > 0)
|
||||
{
|
||||
$property = $sort_array[0]->property;
|
||||
$direction = $sort_array[0]->direction;
|
||||
}
|
||||
|
||||
$result = $this->usermodel->get_user_permissions($id,$property,$direction);
|
||||
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'add_role':
|
||||
$this->form_validation->set_rules('id', 'Role ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('user_id', 'User ID', 'trim|required|numeric|xss_clean');
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$role_id = $this->input->get_post('id', TRUE);
|
||||
$user_id = $this->input->get_post('user_id', TRUE);
|
||||
|
||||
$result = $this->usermodel->add_role($role_id,$user_id);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'remove_role':
|
||||
$this->form_validation->set_rules('id', 'Role ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('user_id', 'User ID', 'trim|required|numeric|xss_clean');
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$role_id = $this->input->get_post('id', TRUE);
|
||||
$user_id = $this->input->get_post('user_id', TRUE);
|
||||
|
||||
$result = $this->usermodel->remove_role($role_id,$user_id);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'add_permission':
|
||||
$this->form_validation->set_rules('id', 'Permission ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('user_id', 'User ID', 'trim|required|numeric|xss_clean');
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$permission_id = $this->input->get_post('id', TRUE);
|
||||
$user_id = $this->input->get_post('user_id', TRUE);
|
||||
|
||||
$result = $this->usermodel->add_permission($permission_id,$user_id);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'remove_permission':
|
||||
$this->form_validation->set_rules('id', 'Permission ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('user_id', 'User ID', 'trim|required|numeric|xss_clean');
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$permission_id = $this->input->get_post('id', TRUE);
|
||||
$user_id = $this->input->get_post('user_id', TRUE);
|
||||
|
||||
$result = $this->usermodel->remove_permission($permission_id,$user_id);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
default: $this->appunto_auth->sendResponse($invalid_function);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'role':
|
||||
$this->load->model('appunto-auth/rolemodel');
|
||||
switch ($func)
|
||||
{
|
||||
case 'read':
|
||||
$this->appunto_auth->controller_read($this->rolemodel);
|
||||
break;
|
||||
case 'create':
|
||||
$this->form_validation->set_rules('name', 'Name', 'trim|required|min_length[3]|max_length[32]|xss_clean');
|
||||
$this->form_validation->set_rules('description', 'Description', 'trim|max_length[64]|xss_clean');
|
||||
|
||||
$this->appunto_auth->controller_create($this->rolemodel);
|
||||
break;
|
||||
case 'update':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('name', 'Name', 'trim|min_length[3]|max_length[32]|xss_clean');
|
||||
$this->form_validation->set_rules('description', 'Description', 'trim|max_length[64]|xss_clean');
|
||||
|
||||
$this->appunto_auth->controller_update($this->rolemodel);
|
||||
break;
|
||||
case 'destroy':
|
||||
$rules = 'trim|required|numeric|xss_clean';
|
||||
$rules .= '|callback__validate_role_in_use_by_user';
|
||||
$rules .= '|callback__validate_role_in_use_by_permission';
|
||||
|
||||
$this->form_validation->set_rules('id', 'Record ID', $rules);
|
||||
|
||||
$this->appunto_auth->controller_destroy($this->rolemodel);
|
||||
break;
|
||||
case 'permissions':
|
||||
$this->form_validation->set_rules('id', 'Record ID', 'trim|required|numeric|xss_clean');
|
||||
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sort = $this->input->get_post('sort', TRUE);
|
||||
|
||||
$id = $this->input->get_post('id', TRUE);
|
||||
|
||||
$property = null;
|
||||
$direction = null;
|
||||
$active_filter = false;
|
||||
|
||||
// get sort params
|
||||
$sort_array = json_decode($sort);
|
||||
if (count($sort_array) > 0)
|
||||
{
|
||||
$property = $sort_array[0]->property;
|
||||
$direction = $sort_array[0]->direction;
|
||||
}
|
||||
|
||||
$result = $this->rolemodel->get_role_permissions($id,$property,$direction);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'add_permission':
|
||||
$this->form_validation->set_rules('id', 'Permission ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('role_id', 'Role ID', 'trim|required|numeric|xss_clean');
|
||||
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$permission_id = $this->input->get_post('id', TRUE);
|
||||
$role_id = $this->input->get_post('role_id', TRUE);
|
||||
|
||||
$result = $this->rolemodel->add_permission($permission_id,$role_id);
|
||||
}
|
||||
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
case 'remove_permission':
|
||||
$this->form_validation->set_rules('id', 'Permission ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('role_id', 'Role ID', 'trim|required|numeric|xss_clean');
|
||||
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$permission_id = $this->input->get_post('id', TRUE);
|
||||
$role_id = $this->input->get_post('role_id', TRUE);
|
||||
|
||||
$result = $this->rolemodel->remove_permission($permission_id,$role_id);
|
||||
}
|
||||
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
default: $this->appunto_auth->sendResponse($invalid_function);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'permission':
|
||||
$this->load->model('appunto-auth/permissionmodel');
|
||||
switch ($func)
|
||||
{
|
||||
case 'read':
|
||||
$this->appunto_auth->controller_read($this->permissionmodel);
|
||||
break;
|
||||
case 'create':
|
||||
$this->form_validation->set_rules('name', 'Name', 'trim|required|min_length[3]|max_length[32]|xss_clean');
|
||||
$this->form_validation->set_rules('description', 'Description', 'trim|max_length[64]|xss_clean');
|
||||
|
||||
$this->appunto_auth->controller_create($this->permissionmodel);
|
||||
break;
|
||||
case 'update':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('name', 'Name', 'trim|min_length[3]|max_length[32]|xss_clean');
|
||||
$this->form_validation->set_rules('description', 'Description', 'trim|max_length[64]|xss_clean');
|
||||
|
||||
$this->appunto_auth->controller_update($this->permissionmodel);
|
||||
break;
|
||||
case 'destroy':
|
||||
$rules = 'trim|required|numeric|xss_clean';
|
||||
$rules .= '|callback__validate_permission_in_use_by_user';
|
||||
$rules .= '|callback__validate_permission_in_use_by_role';
|
||||
$rules .= '|callback__validate_permission_in_use_by_path';
|
||||
|
||||
$this->form_validation->set_rules('id', 'Record ID', $rules);
|
||||
|
||||
$this->appunto_auth->controller_destroy($this->permissionmodel);
|
||||
break;
|
||||
default: $this->appunto_auth->sendResponse($invalid_function);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'path':
|
||||
$this->load->model('appunto-auth/pathmodel'); // pathmodel is being loaded in the library
|
||||
switch ($func)
|
||||
{
|
||||
case 'read':
|
||||
$this->appunto_auth->controller_read($this->pathmodel);
|
||||
break;
|
||||
|
||||
case 'verify_paths':
|
||||
// start off by marking all paths unfound.
|
||||
$this->pathmodel->mark_all_unfound();
|
||||
|
||||
$data = array();
|
||||
$controllers = array();
|
||||
|
||||
$dir = APPPATH.'controllers/';
|
||||
$files = scandir($dir);
|
||||
|
||||
$controller_dirs = array_filter($files, function($filename) {
|
||||
$dir = APPPATH.'controllers/'; // not worth making it a global and "use" is only php 5.3+
|
||||
return (is_dir($dir.$filename) && $filename != '..');
|
||||
});
|
||||
|
||||
$new_cnt = 0;
|
||||
$newPaths = array();
|
||||
$failed = array();
|
||||
|
||||
foreach ($controller_dirs as $controller_dir)
|
||||
{
|
||||
// get files in this directory
|
||||
$files = scandir($dir.$controller_dir);
|
||||
$controller_files = array_filter($files, function($filename) {
|
||||
return (substr(strrchr($filename, '.'), 1)=='php') ? true : false;
|
||||
});
|
||||
foreach ($controller_files as $filename)
|
||||
{
|
||||
$this_dir = ($controller_dir == '.') ? $dir : $dir.$controller_dir.'/';
|
||||
|
||||
$classname = ucfirst(substr($filename, 0, strrpos($filename, '.')));
|
||||
|
||||
if (!class_exists($classname)||($classname == 'Ui'))
|
||||
{
|
||||
|
||||
if ($filename != 'ui.php') require_once($this_dir.$filename);
|
||||
|
||||
$classname = ucfirst(substr($filename, 0, strrpos($filename, '.')));
|
||||
$controller = new $classname();
|
||||
$methods = get_class_methods($controller);
|
||||
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
|
||||
$full_path = ($controller_dir=='.') ? $filename : $controller_dir.'/'.$filename;
|
||||
|
||||
if ($this->pathmodel->path_exists($controller_dir,$classname,$method))
|
||||
{
|
||||
$this->pathmodel->mark_found($controller_dir,$classname,$method);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((substr($method,0,1)!='_' && $method!='get_instance') || $method=='_remap') {
|
||||
$this->pathmodel->create_record($controller_dir,$filename,$full_path,$classname,$method,1);
|
||||
$newPaths[$new_cnt] = $full_path;
|
||||
$new_cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array_push($failed, $classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (count($failed)>0)
|
||||
{
|
||||
$msg = 'You have '.count($failed).' controller'.((count($failed)>1) ? 's':'').' with a duplicate name: ';
|
||||
$msg .= "<br>";
|
||||
$msg .= '<b>'.implode(",", $failed).'</b>';
|
||||
$msg .= "<br>";
|
||||
$msg .= $this->lang->line('appunto_no_homonymous_controllers');
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => $msg
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = 'No new paths found.';
|
||||
if ($new_cnt > 0)
|
||||
{
|
||||
$msg = $new_cnt.' new path'.($new_cnt > 1 ? "s":"").' found.';
|
||||
$msg .= '<ul>';
|
||||
foreach ($newPaths as $path)
|
||||
{
|
||||
$msg .= '<li>'.$path.'</li>';
|
||||
}
|
||||
$msg .= '</ul>';
|
||||
}
|
||||
$result = array (
|
||||
'success' => true,
|
||||
'msg' => $msg,
|
||||
'total' => $new_cnt
|
||||
);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('public_flag', 'Visibility (public/private) ', 'trim|numeric|xss_clean');
|
||||
$this->form_validation->set_rules('permission_id', 'Permission ID', 'trim|numeric|xss_clean');
|
||||
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
// return all POST items with XSS filter
|
||||
$data = $this->input->post(NULL, TRUE);
|
||||
|
||||
// disregard this field which may be sent with permission_id change
|
||||
if (isset($data['permission_name'])) unset($data['permission_name']);
|
||||
|
||||
// clear any permissions if we are making this a public path
|
||||
if (isset($data['public_flag']) && $data['public_flag']==1)
|
||||
{
|
||||
$ignore = $this->pathmodel->clear_permissions($data);
|
||||
}
|
||||
|
||||
if (count($data)>1)
|
||||
{
|
||||
$result = $this->pathmodel->update_record($data);
|
||||
}
|
||||
else if (!isset($result))
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => 'No updates attempted.'
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
|
||||
case 'destroy':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|numeric|xss_clean');
|
||||
|
||||
// create array from post data
|
||||
$data = $this->input->post(NULL, TRUE);
|
||||
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
}
|
||||
else if ($this->pathmodel->is_marked_found($data))
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => $this->lang->line('appunto_path_found_in_filesystem')
|
||||
);
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->appunto_auth->controller_destroy($this->pathmodel);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete_not_found':
|
||||
$result = $this->pathmodel->delete_not_found();
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
|
||||
case 'remove_permission':
|
||||
$this->form_validation->set_rules('id', 'ID', 'trim|required|numeric|xss_clean');
|
||||
|
||||
if ($this->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = $this->_validation_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $this->input->post(NULL, TRUE);
|
||||
$result = $this->pathmodel->clear_permissions($data);
|
||||
}
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
|
||||
default: $this->appunto_auth->sendResponse($invalid_function);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'session':
|
||||
$this->load->model('appunto-auth/sessionmodel');
|
||||
switch ($func)
|
||||
{
|
||||
case 'read':
|
||||
$this->appunto_auth->controller_read($this->sessionmodel);
|
||||
break;
|
||||
case 'destroy':
|
||||
$this->form_validation->set_rules('id', 'Record ID', 'trim|required|xss_clean');
|
||||
$this->appunto_auth->controller_destroy($this->sessionmodel);
|
||||
break;
|
||||
default: $this->appunto_auth->sendResponse($invalid_function);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'statusinfo':
|
||||
$info_array = array();
|
||||
|
||||
array_push($info_array, array (
|
||||
'info_item' => 'Codeigniter version',
|
||||
'info_val' => CI_VERSION
|
||||
));
|
||||
array_push($info_array, array (
|
||||
'info_item' => 'Appunto-Auth version',
|
||||
'info_val' => $this->config->item('appunto_auth_version', 'appunto-auth/appunto_auth')
|
||||
));
|
||||
|
||||
$hooks_enabled = $this->config->item('enable_hooks');
|
||||
array_push($info_array, array (
|
||||
'info_item' => 'Hooks enabled',
|
||||
'info_val' => $hooks_enabled,
|
||||
'info_note' => (!$hooks_enabled ? $this->lang->line('appunto_no_hook') : '')
|
||||
));
|
||||
|
||||
$csrf_protection = $this->config->item('csrf_protection');
|
||||
array_push($info_array, array (
|
||||
'info_item' => $this->lang->line('appunto_csrf_protection'),
|
||||
'info_val' => $csrf_protection,
|
||||
'info_note' => (!$csrf_protection ? $this->lang->line('appunto_set_true') : '')
|
||||
));
|
||||
|
||||
|
||||
$sessions_using_database = $this->config->item('sess_use_database');
|
||||
array_push($info_array, array (
|
||||
'info_item' => $this->lang->line('appunto_db_sessions'),
|
||||
'info_val' => $sessions_using_database,
|
||||
'info_note' => (!$sessions_using_database? $this->lang->line('appunto_set_true') : '')
|
||||
));
|
||||
|
||||
$sessions_encrypted = $this->config->item('sess_encrypt_cookie');
|
||||
array_push($info_array, array (
|
||||
'info_item' => $this->lang->line('appunto_encrypted_cookies'),
|
||||
'info_val' => $sessions_encrypted,
|
||||
'info_note' => (!$sessions_encrypted ? $this->lang->line('appunto_set_true') : '')
|
||||
));
|
||||
|
||||
$allow_private_without_permission = $this->config->item('allow_private_without_permission', 'appunto-auth/appunto_auth');
|
||||
array_push($info_array, array (
|
||||
'info_item' => $this->lang->line('appunto_private_sans_perm'),
|
||||
'info_val' => $allow_private_without_permission,
|
||||
'info_note' => ($allow_private_without_permission? $this->lang->line('appunto_private_sans_perm_warn') : '')
|
||||
));
|
||||
|
||||
$result = array (
|
||||
'success' => true,
|
||||
'rows' => $info_array
|
||||
);
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
|
||||
break;
|
||||
|
||||
case 'keep-alive':
|
||||
$result = array (
|
||||
'success' => true
|
||||
);
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => 'Invalid method.'
|
||||
);
|
||||
$this->appunto_auth->sendResponse($result);
|
||||
}
|
||||
}
|
||||
|
||||
function _validation_error()
|
||||
{
|
||||
return array (
|
||||
'success' => false,
|
||||
'msg' => $this->lang->line('appunto_errors_encountered'),
|
||||
'errors' => validation_errors()
|
||||
);
|
||||
}
|
||||
|
||||
function _password_strength($pass)
|
||||
{
|
||||
$pass_regex = $this->config->item('password_regex_php', 'appunto-auth/appunto_auth');
|
||||
|
||||
if (preg_match($pass_regex,$pass)!==1)
|
||||
{
|
||||
$this->form_validation->set_message( '_password_strength', $this->lang->line('appunto_password_strength_fail'));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _validate_permission_in_use_by_user($id)
|
||||
{
|
||||
if ($this->permissionmodel->in_use_by_user($id))
|
||||
{
|
||||
$this->form_validation->set_message(
|
||||
'_validate_permission_in_use_by_user',
|
||||
$this->lang->line('appunto_permission_in_use_by_user')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _validate_permission_in_use_by_role($id)
|
||||
{
|
||||
if ($this->permissionmodel->in_use_by_role($id))
|
||||
{
|
||||
$this->form_validation->set_message(
|
||||
'_validate_permission_in_use_by_role',
|
||||
$this->lang->line('appunto_permission_in_use_by_role')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _validate_permission_in_use_by_path($id)
|
||||
{
|
||||
if ($this->permissionmodel->in_use_by_path($id))
|
||||
{
|
||||
$this->form_validation->set_message(
|
||||
'_validate_permission_in_use_by_path',
|
||||
$this->lang->line('appunto_permission_in_use_by_path')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _validate_role_in_use_by_user($id)
|
||||
{
|
||||
if ($this->rolemodel->in_use_by_user($id))
|
||||
{
|
||||
$this->form_validation->set_message(
|
||||
'_validate_role_in_use_by_user',
|
||||
$this->lang->line('appunto_role_in_use_by_user')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _validate_role_in_use_by_permission($id)
|
||||
{
|
||||
if ($this->rolemodel->in_use_by_permission($id))
|
||||
{
|
||||
$this->form_validation->set_message(
|
||||
'_validate_role_in_use_by_permission',
|
||||
$this->lang->line('appunto_role_in_use_by_permission')
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function _hash($str)
|
||||
{
|
||||
return $this->appunto_auth->hashPassword($str);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,157 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class User extends CI_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/appunto_auth');
|
||||
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
if (isset($_SERVER['HTTP_REFERER']))
|
||||
{
|
||||
$this->session->set_userdata('prev_url', $_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_userdata('prev_url', base_url());
|
||||
}
|
||||
|
||||
|
||||
$this->load->helper('appunto-auth/appunto-auth');
|
||||
|
||||
if ($this->appunto_auth->logged_in()) redirect($this->router->default_controller);
|
||||
|
||||
$data = array();
|
||||
$data['auth_message'] = $this->session->flashdata('auth_message');
|
||||
$data['site_name'] = $this->config->item('site_name', 'appunto-auth/appunto_auth');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET')
|
||||
{
|
||||
$this->load->view('appunto-auth/login',$data);
|
||||
}
|
||||
else if ($_SERVER['REQUEST_METHOD'] == 'POST')
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('username', 'lang:appunto_form_username', 'trim|required|xss_clean');
|
||||
$this->form_validation->set_rules('password', 'lang:appunto_form_password', 'trim|required|xss_clean');
|
||||
|
||||
$username = $this->input->post('username', TRUE);
|
||||
$ip_address = $this->input->ip_address();
|
||||
$user_agent = $this->input->user_agent();
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->usermodel->record_login_attempt($username, $ip_address, 0, $user_agent, 'form validation: '.validation_errors('[',']'));
|
||||
//$uri = $this->input->post('url', TRUE);
|
||||
$this->load->view('appunto-auth/login',$data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = $this->usermodel->getLoginInfo( $this->input->post('username', TRUE) );
|
||||
$pass = $this->input->post('password', TRUE);
|
||||
|
||||
if (($user != false) && $this->appunto_auth->checkPassword($pass,$user->password))
|
||||
{
|
||||
$this->usermodel->record_login_attempt($username, $ip_address, 1, $user_agent, 'successful login');
|
||||
$this->usermodel->update_last_login($username,$ip_address);
|
||||
|
||||
$this->session->set_userdata(array(
|
||||
'user_id' => $user->id,
|
||||
'username' => $user->username,
|
||||
'email' => $user->email,
|
||||
'logged_in' => true
|
||||
));
|
||||
redirect($this->router->default_controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form_validation->set_rules('password', 'lang:appunto_form_password', 'callback__invalid_password');
|
||||
$this->form_validation->run();
|
||||
$this->usermodel->record_login_attempt($username, $ip_address, 0, $user_agent, 'password check: '.validation_errors('[',']'));
|
||||
$this->load->view('appunto-auth/login',$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else die('invalid request method:'.$_SERVER['REQUEST_METHOD']);
|
||||
}
|
||||
|
||||
public function error()
|
||||
{
|
||||
$data = array();
|
||||
$data['site_name'] = $this->config->item('site_name', 'appunto-auth/appunto_auth');
|
||||
$data['auth_message'] = lang('appunto_message_default_error');
|
||||
|
||||
$auth_message = $this->session->flashdata('auth_message');
|
||||
if (isset($auth_message) && strlen($auth_message)>3)
|
||||
{
|
||||
$data['auth_message'] = $auth_message;
|
||||
}
|
||||
|
||||
$this->load->view('error',$data);
|
||||
}
|
||||
|
||||
/*
|
||||
* callback function for form validation
|
||||
*/
|
||||
public function _invalid_password($str)
|
||||
{
|
||||
$this->form_validation->set_message('_invalid_password', lang('appunto_form_invalid_login'));
|
||||
return false;
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->session->set_userdata(array(
|
||||
'user_id' => '',
|
||||
'username' => '',
|
||||
'email' => '',
|
||||
'logged_in' => false
|
||||
));
|
||||
$_SESSION = array();
|
||||
$this->session->set_flashdata('auth_message', lang('appunto_message_logout'));
|
||||
redirect(rtrim(site_url(), "/").'/'.$this->config->item('login_url','appunto-auth/appunto_auth'));
|
||||
}
|
||||
|
||||
// Not yet implemented... will work on this for a future version
|
||||
public function _forgotpassword()
|
||||
{
|
||||
//if ($this->appunto_auth->logged_in()) redirect($this->router->default_controller);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET')
|
||||
{
|
||||
$data = array();
|
||||
$data['site_name'] = $this->config->item('site_name', 'appunto-auth/appunto_auth');
|
||||
|
||||
$auth_message = $this->session->flashdata('auth_message');
|
||||
if (isset($auth_message) && strlen($auth_message)>3)
|
||||
{
|
||||
$data['auth_message'] = $auth_message;
|
||||
}
|
||||
|
||||
$this->load->view('forgotpass',$data);
|
||||
}
|
||||
else if ($_SERVER['REQUEST_METHOD'] == 'POST')
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('username', 'lang:appunto_form_forgot_pw_username', 'trim|required|xss_clean');
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
{
|
||||
$this->load->view('forgotpass');
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
else die('invalid request method');
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file application.php */
|
||||
/* Location: ./application/controllers/application.php */
|
||||
@ -1,274 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Appunto Auth helpers
|
||||
*
|
||||
* A collection of helpers for including Appunto Auth components in your html
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
if ( ! function_exists('appunto_auth_admin'))
|
||||
{
|
||||
function appunto_auth_admin($ext_theme = false)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto_auth');
|
||||
|
||||
$js_config = $CI->appunto_auth->jsConfigItems();
|
||||
|
||||
$base_url = base_url();
|
||||
$site_url = site_url();
|
||||
$site_name = $CI->config->item('site_name', 'appunto-auth/appunto_auth');
|
||||
$theme_dir = $CI->config->item('appunto_auth_theme', 'appunto-auth/appunto_auth');
|
||||
$lang = config_item('language');
|
||||
|
||||
|
||||
$html = <<<APP
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<title>{$site_name}</title>
|
||||
|
||||
<link rel="icon" type="image/ico" href="{$base_url}resources/appunto-auth/favicon.ico"/>
|
||||
|
||||
|
||||
<!-- Application style sheets -->
|
||||
<link rel="stylesheet" type="text/css" href="{$base_url}resources/appunto-auth/css/app.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{$base_url}resources/appunto-auth/css/icons.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{$base_url}resources/appunto-auth/theme/{$theme_dir}/theme.css" />
|
||||
|
||||
{$js_config}
|
||||
|
||||
<!-- Include optional language file -->
|
||||
<script type="text/javascript" src="{$base_url}resources/appunto-auth/lang/{$lang}.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
Ext = window.Ext || {}; Ext.Boot={};
|
||||
</script>
|
||||
<script type="text/javascript" src="{$base_url}resources/appunto-auth/js/app.js"></script>
|
||||
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
APP;
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('appunto_login_box'))
|
||||
{
|
||||
function appunto_login_box($auth_message = false, $css = 'login-form-box')
|
||||
{
|
||||
$CI =& get_instance();
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto-auth/appunto_auth');
|
||||
if (!isset($CI->form_validation)) $CI->load->library('form_validation');
|
||||
|
||||
$CI->load->config('appunto-auth/appunto_auth',true,false); // true to avoid naming collisions, false to not suppress errors
|
||||
$site_name = "<div class='site_name'>".$CI->config->item('site_name', 'appunto-auth/appunto_auth')."</div>";
|
||||
|
||||
$base_url = base_url();
|
||||
$site_url = site_url();
|
||||
|
||||
$label_username = lang('appunto_form_username');
|
||||
$label_password = lang('appunto_form_password');
|
||||
$label_login_button = lang('appunto_form_login_button');
|
||||
$label_logout_button = lang('appunto_form_logout_button');
|
||||
|
||||
$login = array(
|
||||
'name' => 'username',
|
||||
'id' => 'username',
|
||||
'value' => set_value('username'),
|
||||
'maxlength' => 80
|
||||
);
|
||||
$password = array(
|
||||
'name' => 'password',
|
||||
'id' => 'password'
|
||||
);
|
||||
|
||||
$message_div = '';
|
||||
if ($auth_message != false) {
|
||||
$message_div = "<div id='login-form-auth-message' class='login-form-auth-message'>$auth_message</div>";
|
||||
}
|
||||
else if ($CI->appunto_auth->logged_in()) {
|
||||
$message_div = "<div id='login-form-auth-message' class='login-form-auth-message'>You are already logged in.</div>";
|
||||
}
|
||||
|
||||
$validation_errors = validation_errors();
|
||||
|
||||
$field_username = form_input($login);
|
||||
$field_password = form_password($password);
|
||||
$field_uri = form_hidden('uri',set_value('uri',$CI->uri->uri_string()));
|
||||
$login_button = form_submit(array('name'=>'login','value'=>$label_login_button,'id'=>'login-button'));
|
||||
$logout_button = form_submit(array('name'=>'logout','value'=>$label_logout_button,'id'=>'logout-button'));
|
||||
|
||||
$login_form_open = form_open($CI->config->item('login_url', 'appunto-auth/appunto_auth'));
|
||||
$logout_form_open = form_open($CI->config->item('logout_url', 'appunto-auth/appunto_auth'));
|
||||
$form_close = form_close();
|
||||
|
||||
if ($CI->appunto_auth->logged_in()) {
|
||||
|
||||
$html = <<<LOGINBOX
|
||||
<div class="$css">
|
||||
$site_name
|
||||
$logout_form_open
|
||||
$message_div
|
||||
$logout_button
|
||||
$form_close
|
||||
</div>
|
||||
LOGINBOX;
|
||||
|
||||
} else {
|
||||
|
||||
$html = <<<LOGINBOX
|
||||
<div class="$css">
|
||||
$site_name
|
||||
$login_form_open
|
||||
$message_div
|
||||
<div class="login-form-errors">$validation_errors</div>
|
||||
$field_uri
|
||||
<label>$label_username $field_username</label>
|
||||
<label>$label_password $field_password</label>
|
||||
$login_button
|
||||
$form_close
|
||||
</div>
|
||||
LOGINBOX;
|
||||
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Anchor Link (if permitted)
|
||||
*
|
||||
* Creates an anchor based on the local URL if user has the appropriate permission.
|
||||
*
|
||||
* @access public
|
||||
* @param string the permission's internal name
|
||||
* @param string the URL
|
||||
* @param string the link title
|
||||
* @param mixed any attributes
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists('anchor_if_permitted'))
|
||||
{
|
||||
function anchor_if_permitted($permission,$uri = '', $title = '', $attributes = '')
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$CI->load->helper('url');
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto_auth');
|
||||
|
||||
if ($CI->appunto_auth->userHasPermission($permission))
|
||||
{
|
||||
return anchor($uri,$title,$attributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Username (if logged in)
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists('appunto_username'))
|
||||
{
|
||||
function appunto_username()
|
||||
{
|
||||
$CI =& get_instance();
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto_auth');
|
||||
|
||||
$username = $CI->appunto_auth->get_username();
|
||||
|
||||
if ($username != false)
|
||||
{
|
||||
return $username;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* appunto_logout_link
|
||||
*
|
||||
* @access public
|
||||
* @param boolean show even if user is logged out
|
||||
* @param mixed any attributes for anchor helper
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists('appunto_logout_link'))
|
||||
{
|
||||
function appunto_logout_link($show_if_logged_out = false, $attributes = '')
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$CI->load->helper('url');
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto_auth');
|
||||
|
||||
if ($show_if_logged_out == true || $CI->appunto_auth->logged_in() == true)
|
||||
{
|
||||
return anchor($CI->config->item('logout_url', 'appunto-auth/appunto_auth'), lang('appunto_form_logout_button'), $attributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* is_logged_in
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
if ( ! function_exists('is_logged_in'))
|
||||
{
|
||||
function is_logged_in()
|
||||
{
|
||||
$CI =& get_instance();
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto_auth');
|
||||
|
||||
return ($CI->appunto_auth->logged_in() == true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* has_permission
|
||||
*
|
||||
* @access public
|
||||
* @param string the permission's internal name
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists('has_permission'))
|
||||
{
|
||||
function has_permission($permission)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
|
||||
if (!isset($CI->appunto_auth)) $CI->load->library('appunto_auth');
|
||||
|
||||
return ($CI->appunto_auth->userHasPermission($permission) == true);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Text used by login form
|
||||
*/
|
||||
$lang['appunto_form_username'] = 'Login';
|
||||
$lang['appunto_form_password'] = 'Password';
|
||||
$lang['appunto_form_login_button'] = 'Login';
|
||||
$lang['appunto_form_logout_button'] = 'Logout';
|
||||
$lang['appunto_form_forgot_password'] = 'Forgot Password?';
|
||||
$lang['appunto_form_invalid_login'] = 'Invalid username/password combination.';
|
||||
|
||||
/**
|
||||
* Text used by reset password form
|
||||
*/
|
||||
$lang['appunto_form_forgot_pw_username'] = 'Username';
|
||||
$lang['appunto_form_forgot_pw_button'] = 'Send password reset link';
|
||||
|
||||
/**
|
||||
* Messages
|
||||
*/
|
||||
$lang['appunto_message_logout'] = 'You have been successfully logged out.';
|
||||
$lang['appunto_message_default_error'] = 'Authentication Error.';
|
||||
|
||||
/**
|
||||
* Errors used by library's authentication hook
|
||||
*/
|
||||
$lang['appunto_not_authorized'] = 'You are not authorized to perform the requested operation.';
|
||||
$lang['appunto_login_required'] = 'Please login to perform that operation.';
|
||||
$lang['appunto_invalid_path'] = 'You have requested an invalid path.';
|
||||
|
||||
/**
|
||||
* Errors used by admin UI controller
|
||||
*/
|
||||
$lang['appunto_errors_encountered'] = 'Errors were encountered with your request. Please correct them and try again.';
|
||||
$lang['appunto_password_strength_fail'] = 'Password must be at least 6 characters, no more than 16 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit.';
|
||||
$lang['appunto_permission_in_use_by_user'] = 'This permission is currently assigned to one or more users and cannot be deleted.';
|
||||
$lang['appunto_permission_in_use_by_role'] = 'This permission is currently assigned to one or more roles and cannot be deleted.';
|
||||
$lang['appunto_permission_in_use_by_path'] = 'This permission is currently assigned to one or more paths and cannot be deleted.';
|
||||
$lang['appunto_role_in_use_by_user'] = 'This role is currently assigned to one or more users and cannot be deleted. ';
|
||||
$lang['appunto_role_in_use_by_permission'] = 'There are currently one or more permissions assigned to this role and it cannot be deleted.';
|
||||
$lang['appunto_path_found_in_filesystem'] = 'This path cannot be deleted because it was found on your filesystem the last time paths were verified.<br><br>Please refresh paths if you believe you have received this message in error.';
|
||||
$lang['appunto_no_hook'] = 'No authentication is being performed!';
|
||||
$lang['appunto_set_true'] = 'Consider setting this value to true';
|
||||
$lang['appunto_db_sessions'] = 'Sessions using database';
|
||||
$lang['appunto_csrf_protection'] = 'CSRF protection enabled';
|
||||
$lang['appunto_encrypted_cookies'] = 'Sessions using encrypted cookies';
|
||||
$lang['appunto_private_sans_perm'] = 'Private paths without permissions viewable';
|
||||
$lang['appunto_private_sans_perm_warn'] = 'Private paths without defined permissions viewable to any logged in user';
|
||||
$lang['appunto_no_homonymous_controllers'] = 'AppuntoAuth does not support controller classes with the same name in different directories.';
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Text used by login form
|
||||
*/
|
||||
$lang['appunto_form_username'] = 'Login';
|
||||
$lang['appunto_form_password'] = 'Senha';
|
||||
$lang['appunto_form_login_button'] = 'Login';
|
||||
$lang['appunto_form_logout_button'] = 'Logout';
|
||||
$lang['appunto_form_forgot_password'] = 'Esqueceu a senha?';
|
||||
$lang['appunto_form_invalid_login'] = 'Usuário e/ou senha inválidos.';
|
||||
|
||||
/**
|
||||
* Text used by reset password form
|
||||
*/
|
||||
$lang['appunto_form_forgot_pw_username'] = 'Usuário';
|
||||
$lang['appunto_form_forgot_pw_button'] = 'Enviar o link de recuperação de senha';
|
||||
|
||||
/**
|
||||
* Messages
|
||||
*/
|
||||
$lang['appunto_message_logout'] = 'You have been successfully logged out.';
|
||||
$lang['appunto_message_default_error'] = 'Você saiu com sucesso.';
|
||||
|
||||
/**
|
||||
* Errors used by library's authentication hook
|
||||
*/
|
||||
$lang['appunto_not_authorized'] = 'Você não está autorizado a executar esta operação.';
|
||||
$lang['appunto_login_required'] = 'Por favor, identifique-se para executar esta operação.';
|
||||
$lang['appunto_invalid_path'] = 'Você solicitou um caminho inválido.';
|
||||
|
||||
/**
|
||||
* Errors used by admin UI controller
|
||||
*/
|
||||
$lang['appunto_errors_encountered'] = 'Foram encontrados erros com seu pedido. Por favor, corrija-os e tente novamente.';
|
||||
$lang['appunto_password_strength_fail'] = 'Senhas devem ter entre 6 e 16 caracteres, e incluir no mínimo uma letra maiúscula, uma letra minúscula e um dígito numérico';
|
||||
$lang['appunto_permission_in_use_by_user'] = 'Esta permissão está atualmente atribuída a um ou mais usuários e não pode ser apagada.';
|
||||
$lang['appunto_permission_in_use_by_role'] = 'Esta permissão está atualmente atribuída a uma ou mais funções e não pode ser apagada.';
|
||||
$lang['appunto_permission_in_use_by_path'] = 'Esta permissão está atualmente atribuída a um ou mais caminhos e não pode ser apagada.';
|
||||
$lang['appunto_role_in_use_by_user'] = 'Esta função está atualmente atribuída a um ou mais usuários e não pode ser apagada.';
|
||||
$lang['appunto_role_in_use_by_permission'] = 'Atualmente uma ou mais permissões estão atribuídas a esta função e ela não pode ser apagada';
|
||||
$lang['appunto_path_found_in_filesystem'] = 'Este caminho não pode ser apagado porque foi encontrado em seu sistema de arquivos da última vez que os caminhos foram verificadas. <br><br>Atualize caminhos, se você achar que recebeu esta mensagem por engano.';
|
||||
$lang['appunto_no_hook'] = 'Nenhuma autenticação está sendo realizada!';
|
||||
$lang['appunto_set_true'] = 'Defina este valor para "verdadeiro"';
|
||||
$lang['appunto_db_sessions'] = 'Sessões usando banco de dados';
|
||||
$lang['appunto_csrf_protection'] = 'CSRF protection enabled';
|
||||
$lang['appunto_encrypted_cookies'] = 'Sessões usando cookies criptografados';
|
||||
$lang['appunto_private_sans_perm'] = 'Caminhos privados sem permissões visíveis';
|
||||
$lang['appunto_private_sans_perm_warn'] = 'caminhos privados sem permissões definidas visíveis para qualquer usuário conectado';
|
||||
$lang['appunto_no_homonymous_controllers'] = 'AppuntoAuth não suporta classes do controlador com o mesmo nome em diferentes diretórios.';
|
||||
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['cal_su'] = "D";
|
||||
$lang['cal_mo'] = "S";
|
||||
$lang['cal_tu'] = "T";
|
||||
$lang['cal_we'] = "Q";
|
||||
$lang['cal_th'] = "Q";
|
||||
$lang['cal_fr'] = "S";
|
||||
$lang['cal_sa'] = "S";
|
||||
$lang['cal_sun'] = "Dom";
|
||||
$lang['cal_mon'] = "Seg";
|
||||
$lang['cal_tue'] = "Ter";
|
||||
$lang['cal_wed'] = "Qua";
|
||||
$lang['cal_thu'] = "Qui";
|
||||
$lang['cal_fri'] = "Sex";
|
||||
$lang['cal_sat'] = "Sab";
|
||||
$lang['cal_sunday'] = "Domingo";
|
||||
$lang['cal_monday'] = "Segunda";
|
||||
$lang['cal_tuesday'] = "Terça";
|
||||
$lang['cal_wednesday'] = "Quarta";
|
||||
$lang['cal_thursday'] = "Quinta";
|
||||
$lang['cal_friday'] = "Sexta";
|
||||
$lang['cal_saturday'] = "Sábado";
|
||||
$lang['cal_jan'] = "Jan";
|
||||
$lang['cal_feb'] = "Fev";
|
||||
$lang['cal_mar'] = "Mar";
|
||||
$lang['cal_apr'] = "Abr";
|
||||
$lang['cal_may'] = "Mai";
|
||||
$lang['cal_jun'] = "Jun";
|
||||
$lang['cal_jul'] = "Jul";
|
||||
$lang['cal_aug'] = "Ago";
|
||||
$lang['cal_sep'] = "Set";
|
||||
$lang['cal_oct'] = "Out";
|
||||
$lang['cal_nov'] = "Nov";
|
||||
$lang['cal_dec'] = "Dez";
|
||||
$lang['cal_january'] = "Janeiro";
|
||||
$lang['cal_february'] = "Fevereiro";
|
||||
$lang['cal_march'] = "Março";
|
||||
$lang['cal_april'] = "Abril";
|
||||
$lang['cal_mayl'] = "Maio";
|
||||
$lang['cal_june'] = "Junho";
|
||||
$lang['cal_july'] = "Julho";
|
||||
$lang['cal_august'] = "Agosto";
|
||||
$lang['cal_september'] = "Setembro";
|
||||
$lang['cal_october'] = "Outubro";
|
||||
$lang['cal_november'] = "Novembro";
|
||||
$lang['cal_december'] = "Dezembro";
|
||||
|
||||
|
||||
/* End of file calendar_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/calendar_lang.php */
|
||||
@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['date_year'] = "Ano";
|
||||
$lang['date_years'] = "Anos";
|
||||
$lang['date_month'] = "Mês";
|
||||
$lang['date_months'] = "Meses";
|
||||
$lang['date_week'] = "Semana";
|
||||
$lang['date_weeks'] = "Semanas";
|
||||
$lang['date_day'] = "Dia";
|
||||
$lang['date_days'] = "Dias";
|
||||
$lang['date_hour'] = "Hora";
|
||||
$lang['date_hours'] = "Horas";
|
||||
$lang['date_minute'] = "Minuto";
|
||||
$lang['date_minutes'] = "Minutos";
|
||||
$lang['date_second'] = "Segundo";
|
||||
$lang['date_seconds'] = "Segundos";
|
||||
|
||||
$lang['UM12'] = '(UTC -12:00) Ilhas Baker e Howland';
|
||||
$lang['UM11'] = '(UTC -11:00) Fuso horário de Samoa, Niue';
|
||||
$lang['UM10'] = '(UTC -10:00) Horário padrão do Havaí e Aleutas, Ilhas Cook, Taiti';
|
||||
$lang['UM95'] = '(UTC -9:30) Ilhas Marquesas';
|
||||
$lang['UM9'] = '(UTC -9:00) Horário padrão do Alaska, Ilhas Gambier';
|
||||
$lang['UM8'] = '(UTC -8:00) Horário padrão do Pacífico, Ilha Clipperton';
|
||||
$lang['UM7'] = '(UTC -7:00) Horário padrão de Mountain';
|
||||
$lang['UM6'] = '(UTC -6:00) Horário da cidade do México';
|
||||
$lang['UM5'] = '(UTC -5:00) Horário padrão oriental, Horário padrão do Caribe Ocidental';
|
||||
$lang['UM45'] = '(UTC -4:30) Horário padrão da Venezuela';
|
||||
$lang['UM4'] = '(UTC -4:00) Horário padrão do Atlântico, Horário padrão do Caribe Oriental';
|
||||
$lang['UM35'] = '(UTC -3:30) Horário padrão de Terra Nova';
|
||||
$lang['UM3'] = '(UTC -3:00) Argentina, Brasil, Guiana Francesa, Uruguai';
|
||||
$lang['UM2'] = '(UTC -2:00) Geórgia do Sul/Ilhas Sandwich do Sul';
|
||||
$lang['UM1'] = '(UTC -1:00) Açores, Ilhas de Cabo Verde';
|
||||
$lang['UTC'] = '(UTC) Horário padrão de Greenwich, Horário da Europa ocidental';
|
||||
$lang['UP1'] = '(UTC +1:00) Horário da Europa Central, Horário do oeste africano';
|
||||
$lang['UP2'] = '(UTC +2:00) Horário da África Central, Horário da Europa Oriental, Horário de Kaliningrado';
|
||||
$lang['UP3'] = '(UTC +3:00) Horário de Moscou, Horário do leste da África';
|
||||
$lang['UP35'] = '(UTC +3:30) Horário padrão do Irã';
|
||||
$lang['UP4'] = '(UTC +4:00) Horário padrão do Azerbaijão, Horário de Samara';
|
||||
$lang['UP45'] = '(UTC +4:30) Afeganistão';
|
||||
$lang['UP5'] = '(UTC +5:00) Horário padrão do Paquistão, Horário de Ecaterimburgo';
|
||||
$lang['UP55'] = '(UTC +5:30) Horário padrão da Índia, Horário de Sri Lanka';
|
||||
$lang['UP575'] = '(UTC +5:45) Horário do Nepal';
|
||||
$lang['UP6'] = '(UTC +6:00) Horário padrão de Bangladesh, Horário de Butão, Horário de Omsk';
|
||||
$lang['UP65'] = '(UTC +6:30) Ilhas Cocos, Myanmar';
|
||||
$lang['UP7'] = '(UTC +7:00) Horário de Krasnoyarsk, Cambodja, Laos, Tailândia, Vietnã';
|
||||
$lang['UP8'] = '(UTC +8:00) Horário Padrão da Austrália Ocidental, Horário de Beijing, Horário de Irkutsk';
|
||||
$lang['UP875'] = '(UTC +8:45) Horário Padrão Ocidental da Austrália Central';
|
||||
$lang['UP9'] = '(UTC +9:00) Horário padrão do Japão, Horário padrão da Coréia, Horário de Yakutsk';
|
||||
$lang['UP95'] = '(UTC +9:30) Horário padrão da Austrália Central';
|
||||
$lang['UP10'] = '(UTC +10:00) Horário padrão da Austrálian Oriental, Horário de Vladivostok';
|
||||
$lang['UP105'] = '(UTC +10:30) Ilha de Lord Howe';
|
||||
$lang['UP11'] = '(UTC +11:00) Horário de Magadan, Ilhas Salomão, Vanuatu';
|
||||
$lang['UP115'] = '(UTC +11:30) Ilha Norfolk';
|
||||
$lang['UP12'] = '(UTC +12:00) Fiji, Ilhas Gilbert, Horário de Kamchatka, Horário padrão da Nova Zelândia';
|
||||
$lang['UP1275'] = '(UTC +12:45) Horário padrão das ilhas Chatham';
|
||||
$lang['UP13'] = '(UTC +13:00) Horário das ilhas Fênix, Tonga';
|
||||
$lang['UP14'] = '(UTC +14:00) Ilhas Line';
|
||||
|
||||
|
||||
/* End of file date_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/date_lang.php */
|
||||
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['db_invalid_connection_str'] = 'Não foi possível determinar as definições de banco de dados usando a string de conexão fornecida.';
|
||||
$lang['db_unable_to_connect'] = 'Não foi possível conectar ao banco de dados usando as definições fornecidas.';
|
||||
$lang['db_unable_to_select'] = 'Não foi possível selecionar o banco: %s';
|
||||
$lang['db_unable_to_create'] = 'Não foi possível criar o banco: %s';
|
||||
$lang['db_invalid_query'] = 'A query fornecida é inválida.';
|
||||
$lang['db_must_set_table'] = 'Você deve informar a tabela que será usada em sua pesquisa.';
|
||||
$lang['db_must_use_set'] = 'Você deve usar o método "set" para atualizar um registro.';
|
||||
$lang['db_must_use_index'] = 'Você deve especificar um índice para casar em atualizações em lote.';
|
||||
$lang['db_batch_missing_index'] = 'Uma ou mais linhas enviadas para atualização em lote não têm um índice especificado.';
|
||||
$lang['db_must_use_where'] = 'Atualizações não são permitidas sem o uso da cláusula "where".';
|
||||
$lang['db_del_must_use_where'] = 'O comando "delete" não é permitido sem o uso de uma cláusula "where" ou "like".';
|
||||
$lang['db_field_param_missing'] = 'Para buscar campos é necessário informar o nome da tabela como um parâmetro.';
|
||||
$lang['db_unsupported_function'] = 'Este recurso não está disponível para o banco de dados em uso.';
|
||||
$lang['db_transaction_failure'] = 'Falha na transação: Foi feito o rollback.';
|
||||
$lang['db_unable_to_drop'] = 'Não foi possível remover o banco especificado.';
|
||||
$lang['db_unsuported_feature'] = 'Este recurso não é suportado pelo banco de dados em uso.';
|
||||
$lang['db_unsuported_compression'] = 'O formato de compressão de arquivos não é suportado pelo servidor.';
|
||||
$lang['db_filepath_error'] = 'Não foi possível escrever no caminho informado.';
|
||||
$lang['db_invalid_cache_path'] = 'O caminho de cache informado não é válido ou não tem permissão de escrita.';
|
||||
$lang['db_table_name_required'] = 'Um nome de tabela é requisito para esta operação.';
|
||||
$lang['db_column_name_required'] = 'Um nome de coluna é requisito para esta operação.';
|
||||
$lang['db_column_definition_required'] = 'A definição de uma coluna é requisito para esta operação.';
|
||||
$lang['db_unable_to_set_charset'] = 'Não foi possível definir o conjunto de caracteres: %s';
|
||||
$lang['db_error_heading'] = 'Ocorreu um erro de banco de dados';
|
||||
|
||||
/* End of file db_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/db_lang.php */
|
||||
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['email_must_be_array'] = "O método de validação de email deve ser passado como array.";
|
||||
$lang['email_invalid_address'] = "Endreço de email inválido: %s";
|
||||
$lang['email_attachment_missing'] = "Não foi possível localizar o seguinte anexo do email: %s";
|
||||
$lang['email_attachment_unreadable'] = "Não foi possível abrir este anexo: %s";
|
||||
$lang['email_no_recipients'] = "Você deve incluir os destinatários: Para, Cc, ou Cco";
|
||||
$lang['email_send_failure_phpmail'] = "Não foi possível enviar o email utilizando PHP mail(). Talvez o seu servidor não esteja configurado para enviar emails utilizando este método.";
|
||||
$lang['email_send_failure_sendmail'] = "Não foi possível enviar o email utilizando PHP Sendmail. Talvez o seu servidor não esteja configurado para enviar emails utilizando este método.";
|
||||
$lang['email_send_failure_smtp'] = "Não foi possível enviar o email utilizando PHP SMTP. Talvez o seu servidor não esteja configurado para enviar emails utilizando este método.";
|
||||
$lang['email_sent'] = "Sua mensagem foi enviada com sucesso utilizando os seguinte protocolo: %s";
|
||||
$lang['email_no_socket'] = "Não foi possível abrir um soquete para Sendmail. Por favor, confira suas configurações.";
|
||||
$lang['email_no_hostname'] = "Você não especificou um nome de host SMTP.";
|
||||
$lang['email_smtp_error'] = "Foi encontrado a seguinte mensagem de erro SMTP: %s";
|
||||
$lang['email_no_smtp_unpw'] = "Erro: Você deve atribuir um nome de usuário e senha SMTP.";
|
||||
$lang['email_failed_smtp_login'] = "Falhou ao enviar o comando AUTH LOGIN. Erro: %s";
|
||||
$lang['email_smtp_auth_un'] = "Falhou ao autenticar o nome do usuário. Erro: %s";
|
||||
$lang['email_smtp_auth_pw'] = "Falhou ao autenticar a senha. Erro: %s";
|
||||
$lang['email_smtp_data_failure'] = "Não foi possível enviar os dados: %s";
|
||||
$lang['email_exit_status'] = "Status do código de saída: %s";
|
||||
|
||||
|
||||
/* End of file email_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/email_lang.php */
|
||||
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
$lang['required'] = "O campo %s é obrigatório.";
|
||||
$lang['isset'] = "O campo %s deve ter um valor definido.";
|
||||
$lang['valid_email'] = "O campo %s deve conter um endereço de e-mail válido.";
|
||||
$lang['valid_emails'] = "O campo %s deve apenas endereços de e-mail válidos.";
|
||||
$lang['valid_url'] = "O campo %s deve conter uma URL válida.";
|
||||
$lang['valid_ip'] = "O campo %s deve conter um IP válido.";
|
||||
$lang['min_length'] = "O campo %s deve conter pelo menos %s caracteres.";
|
||||
$lang['max_length'] = "O campo %s não deve conter mais de %s caracteres.";
|
||||
$lang['exact_length'] = "O campo %s deve conter exatamente %s caracteres.";
|
||||
$lang['alpha'] = "O campo %s deve conter apenas letras.";
|
||||
$lang['alpha_numeric'] = "O campo %s deve conter apenas caracteres alfanuméricos.";
|
||||
$lang['alpha_dash'] = "O campo %s deve conter apenas caracteres alfanuméricos, sublinhados e traços.";
|
||||
$lang['numeric'] = "O campo %s deve conter apenas números.";
|
||||
$lang['is_numeric'] = "O campo %s deve conter apenas caracteres numéricos.";
|
||||
$lang['integer'] = "O campo %s deve conter um número inteiro.";
|
||||
$lang['regex_match'] = "O campo %s não está no formato correto.";
|
||||
$lang['matches'] = "O campo %s deve ser igual ao campo %s.";
|
||||
$lang['is_unique'] = "O campo %s deve conter um valor único.";
|
||||
$lang['is_natural'] = "O campo %s deve conter apenas números positivos.";
|
||||
$lang['is_natural_no_zero'] = "O campo %s deve conter apenas números maiores que zero.";
|
||||
$lang['decimal'] = "O campo %s deve conter um número decimal.";
|
||||
$lang['less_than'] = "O campo %s deve conter um número menor que %s.";
|
||||
$lang['greater_than'] = "O campo %s deve conter um número maior que %s.";
|
||||
|
||||
/* End of file form_validation_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/form_validation_lang.php */
|
||||
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['ftp_no_connection'] = "Não foi possível encontrar um identificador de conexão válido. Certifique-se de estar conectado antes de efetuar operações de arquivos.";
|
||||
$lang['ftp_unable_to_connect'] = "Não foi possível conectar ao servidor FTP com o nome informado.";
|
||||
$lang['ftp_unable_to_login'] = "Não foi possível autenticar no servidor FTP. Verifique seu nome de usuário e senha.";
|
||||
$lang['ftp_unable_to_makdir'] = "Não foi possível criar o diretório especificado.";
|
||||
$lang['ftp_unable_to_changedir'] = "Não foi possível mudar de diretório.";
|
||||
$lang['ftp_unable_to_chmod'] = "Não foi possível definir as permissões do arquivo. Verifique o endereço informado. Obs: Esta operação só está disponível a partir do PHP 5.";
|
||||
$lang['ftp_unable_to_upload'] = "Não foi possível enviar o arquivo informado. Verifique o endereço.";
|
||||
$lang['ftp_unable_to_download'] = "Não foi possível baixar o arquivo informado. Verifique o endereço.";
|
||||
$lang['ftp_no_source_file'] = "Não foi possível encontrar o arquivo fonte. Verifique o caminho.";
|
||||
$lang['ftp_unable_to_rename'] = "Não foi possível renomear o arquivo.";
|
||||
$lang['ftp_unable_to_delete'] = "Não foi possível remover o arquivo.";
|
||||
$lang['ftp_unable_to_move'] = "Não foi possível mover o arquivo. Verifique se o diretório de destino existe.";
|
||||
|
||||
|
||||
/* End of file ftp_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/ftp_lang.php */
|
||||
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['imglib_source_image_required'] = "Você deve especificar uma imagem fonte nas preferências.";
|
||||
$lang['imglib_gd_required'] = "A biblioteca GD é necessária para este recurso.";
|
||||
$lang['imglib_gd_required_for_props'] = "O servidor deve suportar a biblioteca GD para determinar as propriedades da imagem.";
|
||||
$lang['imglib_unsupported_imagecreate'] = "O servidor não suporta a função GD necessária para processar este tipo de imagem.";
|
||||
$lang['imglib_gif_not_supported'] = "Imagens GIF em geral não são suportadas devido a restrições de licenciamento. Use imagens em JPG ou PNG.";
|
||||
$lang['imglib_jpg_not_supported'] = "Imagens JPG não são suportadas.";
|
||||
$lang['imglib_png_not_supported'] = "Imagens PNG não são suportadas.";
|
||||
$lang['imglib_jpg_or_png_required'] = "O protocolo de redimensionamento de imagens definido nas preferências funciona apenas com imagens JPEG ou PNG.";
|
||||
$lang['imglib_copy_error'] = "Um erro foi encontrado durante a tentativa de substituir o arquivo. Certifique-se de que o diretório tem permissão de escrita.";
|
||||
$lang['imglib_rotate_unsupported'] = "Rotacionar imagens não é suportado pelo servidor.";
|
||||
$lang['imglib_libpath_invalid'] = "O caminho para a biblioteca de imagens não está correto. Defina o caminho correto nas preferências.";
|
||||
$lang['imglib_image_process_failed'] = "O processamento da imagem falhou. Certifique-se se que o servidor suporta o protocolo escolhido e que o caminho para a biblioteca de imagens está correto.";
|
||||
$lang['imglib_rotation_angle_required'] = "Informe um ângulo para rotacionar a imagem.";
|
||||
$lang['imglib_writing_failed_gif'] = "Imagem GIF.";
|
||||
$lang['imglib_invalid_path'] = "O caminho para a imagem não está correto.";
|
||||
$lang['imglib_copy_failed'] = "A rotina de cópia da imagem falhou.";
|
||||
$lang['imglib_missing_font'] = "Não foi possível encontrar a fonte.";
|
||||
$lang['imglib_save_failed'] = "Não foi possível salvar a imagem. Certifique-se de que a imagem e o diretório têm permissão de escrita.";
|
||||
|
||||
|
||||
/* End of file imglib_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/imglib_lang.php */
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['migration_none_found'] = "Nenhuma migration encontrada.";
|
||||
$lang['migration_not_found'] = "Esta migration não foi encontrada.";
|
||||
$lang['migration_multiple_version'] = "Há várias migrations com o mesmo número de versão: %d.";
|
||||
$lang['migration_class_doesnt_exist'] = "A classe de migration \"%s\" não foi encontrada.";
|
||||
$lang['migration_missing_up_method'] = "A classe de migration \"%s\" não tem o método 'up'.";
|
||||
$lang['migration_missing_down_method'] = "A classe de migration \"%s\" não tem o método 'down'.";
|
||||
$lang['migration_invalid_filename'] = "A migration \"%s\" tem um nome de arquivo inválido.";
|
||||
|
||||
|
||||
/* End of file migration_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/migration_lang.php */
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['terabyte_abbr'] = "TB";
|
||||
$lang['gigabyte_abbr'] = "GB";
|
||||
$lang['megabyte_abbr'] = "MB";
|
||||
$lang['kilobyte_abbr'] = "KB";
|
||||
$lang['bytes'] = "Bytes";
|
||||
|
||||
/* End of file number_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/number_lang.php */
|
||||
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['profiler_database'] = 'BANCO DE DADOS';
|
||||
$lang['profiler_controller_info'] = 'CLASSE/MÉTODO';
|
||||
$lang['profiler_benchmarks'] = 'BENCHMARKS';
|
||||
$lang['profiler_queries'] = 'QUERIES';
|
||||
$lang['profiler_get_data'] = 'DADOS GET';
|
||||
$lang['profiler_post_data'] = 'DADOS POST';
|
||||
$lang['profiler_uri_string'] = 'URI STRING';
|
||||
$lang['profiler_memory_usage'] = 'USO DE MEMÓRIA';
|
||||
$lang['profiler_config'] = 'VARIÁBEIS DE CONFIGURAÇÃO';
|
||||
$lang['profiler_session_data'] = 'DADOS DE SESSÃO';
|
||||
$lang['profiler_headers'] = 'CABEÇALHOS HTTP';
|
||||
$lang['profiler_no_db'] = 'O driver do banco de dados não está carregado';
|
||||
$lang['profiler_no_queries'] = 'Não foram executadas queries';
|
||||
$lang['profiler_no_post'] = 'Não existem dados no POST';
|
||||
$lang['profiler_no_get'] = 'Não existem dados no GET';
|
||||
$lang['profiler_no_uri'] = 'Não existem dados URI';
|
||||
$lang['profiler_no_memory'] = 'Uso de memória não disponível';
|
||||
$lang['profiler_no_profiles'] = 'Sem dados de profiler - Todas as sessões de profile foram desabilitadas.';
|
||||
$lang['profiler_section_hide'] = 'Esconder';
|
||||
$lang['profiler_section_show'] = 'Exibir';
|
||||
|
||||
/* End of file profiler_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/profiler_lang.php */
|
||||
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['ut_test_name'] = 'Nome do teste';
|
||||
$lang['ut_test_datatype'] = 'Tipo de dado do teste';
|
||||
$lang['ut_res_datatype'] = 'Tipo de dado esperado';
|
||||
$lang['ut_result'] = 'Resultado';
|
||||
$lang['ut_undefined'] = 'Nome do teste não definido';
|
||||
$lang['ut_file'] = 'Nome do arquivo';
|
||||
$lang['ut_line'] = 'Número da linha';
|
||||
$lang['ut_passed'] = 'Passou';
|
||||
$lang['ut_failed'] = 'Falhou';
|
||||
$lang['ut_boolean'] = 'Boolean';
|
||||
$lang['ut_integer'] = 'Integer';
|
||||
$lang['ut_float'] = 'Float';
|
||||
$lang['ut_double'] = 'Float'; // can be the same as float
|
||||
$lang['ut_string'] = 'String';
|
||||
$lang['ut_array'] = 'Array';
|
||||
$lang['ut_object'] = 'Object';
|
||||
$lang['ut_resource'] = 'Resource';
|
||||
$lang['ut_null'] = 'Null';
|
||||
$lang['ut_notes'] = 'Notas';
|
||||
|
||||
|
||||
/* End of file unit_test_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/unit_test_lang.php */
|
||||
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
$lang['upload_userfile_not_set'] = "Não foi possível encontrar a variável de POST chamada userfile.";
|
||||
$lang['upload_file_exceeds_limit'] = "O arquivo enviado excede o valor máximo permitido no arquivo de configuração do PHP.";
|
||||
$lang['upload_file_exceeds_form_limit'] = "O arquivo enviado excede o valor máximo permitido pelo formulário.";
|
||||
$lang['upload_file_partial'] = "O arquivo foi enviado apenas parcialmente.";
|
||||
$lang['upload_no_temp_directory'] = "O diretório temporário não foi encontrado.";
|
||||
$lang['upload_unable_to_write_file'] = "Não foi possível salvar o arquivo.";
|
||||
$lang['upload_stopped_by_extension'] = "O envio do arquivo foi interrompido por uma extensão.";
|
||||
$lang['upload_no_file_selected'] = "Nenhum arquivo foi selecionado.";
|
||||
$lang['upload_invalid_filetype'] = "O tipo do arquivo selecionado não é permitido.";
|
||||
$lang['upload_invalid_filesize'] = "O tamanho do arquivo selecionado é maior do que o permitido.";
|
||||
$lang['upload_invalid_dimensions'] = "A imagem selecionada excede a largura e altura máximas.";
|
||||
$lang['upload_destination_error'] = "Não foi possível mover o arquivo enviado para seu diretório de destino.";
|
||||
$lang['upload_no_filepath'] = "O diretório de destino não é válido.";
|
||||
$lang['upload_no_file_types'] = "Nenhum tipo permitido de arquivo foi especificado.";
|
||||
$lang['upload_bad_filename'] = "O nome do arquivo selecionado já existe no servidor.";
|
||||
$lang['upload_not_writable'] = "Não há permissão de escrita para o diretório de destino do arquivo.";
|
||||
|
||||
|
||||
/* End of file upload_lang.php */
|
||||
/* Location: ./application/language/portuguese-br/upload_lang.php */
|
||||
@ -1,593 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once('phpass-0.3/PasswordHash.php');
|
||||
|
||||
class Appunto_auth
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
* Load config and url helper.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->CI =& get_instance();
|
||||
|
||||
$this->CI->load->config('appunto-auth/appunto_auth',true,false); // true to avoid naming collisions, false to not suppress errors
|
||||
$this->CI->lang->load('appunto_auth');
|
||||
|
||||
$this->CI->load->database();
|
||||
$this->CI->load->library('session');
|
||||
$this->CI->load->helper('url');
|
||||
$this->CI->load->helper('language');
|
||||
$this->CI->load->helper('appunto-auth/appunto-auth_helper');
|
||||
|
||||
$this->CI->load->model('appunto-auth/pathmodel');
|
||||
$this->CI->load->model('appunto-auth/usermodel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is logged in
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function logged_in()
|
||||
{
|
||||
return ($this->CI->session->userdata('logged_in') == true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username if user is logged in
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function get_username()
|
||||
{
|
||||
if ($this->CI->session->userdata('logged_in') == true)
|
||||
{
|
||||
return ($this->CI->session->userdata('username'));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user id if user is logged in
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function get_user_id()
|
||||
{
|
||||
if ($this->CI->session->userdata('logged_in') == true)
|
||||
{
|
||||
return ($this->CI->session->userdata('user_id'));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to be executed before controller
|
||||
* This hook must be included in CodeIgniter's config/hooks.php file using
|
||||
* the following format:
|
||||
*
|
||||
* $hook['post_controller_constructor'] = array(
|
||||
* 'class' => 'Appunto_auth',
|
||||
* 'function' => 'require_authentication_hook',
|
||||
* 'filename' => 'Appunto_auth.php',
|
||||
* 'filepath' => 'libraries',
|
||||
* 'params' => array()
|
||||
* );
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function require_authentication_hook()
|
||||
{
|
||||
$paths = $this->_getPaths();
|
||||
$ci_dir = $this->CI->router->fetch_directory();
|
||||
$ci_class = $this->CI->router->fetch_class();
|
||||
$ci_method = $this->CI->router->fetch_method();
|
||||
|
||||
$requested_path = $ci_dir.$ci_class.'/'.$ci_method;
|
||||
//log_message('error','path: '.$requested_path);
|
||||
|
||||
$this->CI->session->set_userdata('last_page',$ci_dir.$ci_class.'/'.$ci_method);
|
||||
|
||||
// Test validity of path
|
||||
if (array_key_exists($ci_class,$paths) &&
|
||||
(array_key_exists($ci_method,$paths[$ci_class]) ||
|
||||
array_key_exists('_remap',$paths[$ci_class])))
|
||||
{
|
||||
// if method does not exist, but _remap does, we must authenticate against _remap
|
||||
if (!array_key_exists($ci_method,$paths[$ci_class]) && array_key_exists('_remap',$paths[$ci_class]))
|
||||
{
|
||||
$ci_method = '_remap';
|
||||
}
|
||||
|
||||
// Valid path - store it in a variable for brevity
|
||||
$path = $paths[$ci_class][$ci_method];
|
||||
|
||||
// Test if path is public
|
||||
if ($path['public_flag'] == 1)
|
||||
{
|
||||
// Valid, public path - return
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Valid, private path - make sure user is logged in
|
||||
if ($this->logged_in())
|
||||
{
|
||||
// User is logged in, check if path has required permission
|
||||
if (is_numeric($path['perm']) && $path['perm'] > 0)
|
||||
{
|
||||
// Path has a required permission - check if user has this permission
|
||||
//$user_permissions = $this->_getPermissions();
|
||||
//if (in_array($path['perm'],$user_permissions,true))
|
||||
if ($this->_userHasPermissionId($path['perm']))
|
||||
{
|
||||
// User has Permission - return
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// User does not have required permission
|
||||
$this->_sendError($this->CI->lang->line('appunto_not_authorized'));
|
||||
die;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Path has no required permission - check if config allows private without permission
|
||||
if ($this->CI->config->item('allow_private_without_permission','appunto-auth/appunto_auth'))
|
||||
{
|
||||
// Paths without permissions are viewable by logged-in users
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// User does not have required permission
|
||||
$this->_sendError($this->CI->lang->line('appunto_not_authorized'));
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// User is not logged in
|
||||
if ($requested_path == 'appunto-auth/user/login')
|
||||
{
|
||||
// If you are receiving this error, you have the login path set as private
|
||||
// This must be set as public or users cannot log in
|
||||
$msg = 'Logins are disabled. Contact an Administrator';
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg = $this->CI->lang->line('appunto_login_required');
|
||||
}
|
||||
$this->_sendError($msg,true);
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Path is not in database
|
||||
$this->_sendError($this->CI->lang->line('appunto_invalid_path'));
|
||||
die;
|
||||
}
|
||||
die; //shouldn't arrive here
|
||||
}
|
||||
|
||||
/**
|
||||
* send auth error
|
||||
*
|
||||
* @param string
|
||||
* @return void
|
||||
*/
|
||||
public function _sendError($msg, $login=false)
|
||||
{
|
||||
$ajax = $this->_isAjaxRequest();
|
||||
|
||||
if ($ajax)
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'err' => 'LOGIN',
|
||||
'msg' => $msg
|
||||
);
|
||||
$this->sendResponse($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$view = $login ? 'appunto-auth/login' : 'appunto-auth/error';
|
||||
$data['site_name'] = $this->CI->config->item('site_name', 'appunto-auth/appunto_auth');
|
||||
$data['auth_message'] = $msg;
|
||||
|
||||
echo($this->CI->load->view($view,$data,true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an array of paths.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function _getPaths()
|
||||
{
|
||||
$path_array = array();
|
||||
$result = $this->CI->pathmodel->getAll();
|
||||
|
||||
if (isset($result['rows']) && is_array($result['rows']))
|
||||
{
|
||||
$rows = $result['rows'];
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$perm_id = intval($row->permission_id); //tighten this up *******************************************************
|
||||
$path_array[strtolower($row->ci_controller)][strtolower($row->ci_method)] = array(
|
||||
'public_flag' => $row->public_flag,
|
||||
'perm' => $perm_id,
|
||||
'perm_string' => $row->internal_name
|
||||
);
|
||||
}
|
||||
}
|
||||
return $path_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if user has role.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
/*
|
||||
public function userHasRole($role_id)
|
||||
{
|
||||
$user_id = $this->CI->session->userdata('user_id');
|
||||
|
||||
return ($this->CI->usermodel->verifyRoleById($user_id,$role_id) > 0);
|
||||
}
|
||||
**/
|
||||
|
||||
/**
|
||||
* check if user has permission.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function userHasPermission($permission)
|
||||
{
|
||||
if (!$this->logged_in()) return false; // user can't have the permission if not logged in
|
||||
|
||||
$user_id = $this->CI->session->userdata('user_id');
|
||||
|
||||
return $this->CI->usermodel->verifyPermissionByInternalName($user_id,$permission);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if user has permission.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _userHasPermissionId($permission)
|
||||
{
|
||||
$user_id = $this->CI->session->userdata('user_id');
|
||||
|
||||
return $this->CI->usermodel->verifyPermissionById($user_id,$permission);
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Return an array of user permissions.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _getPermissions()
|
||||
{
|
||||
$user_id = $this->CI->session->userdata('user_id');
|
||||
if (isset($user_id) && is_numeric($user_id) && $user_id > 0)
|
||||
{
|
||||
return $this->CI->usermodel->get_user_permission_array($user_id);
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Javascript snippet with items from the appunto_auth.php config file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsConfigItems()
|
||||
{
|
||||
$js = '<script type="text/javascript">';
|
||||
|
||||
$js .= 'var ci_base_url = "'.base_url().'",';
|
||||
$js .= 'ci_site_url = "'.rtrim(site_url(), "/").'/",';
|
||||
$js .= 'ci_login_url = "'.$this->CI->config->item('login_url','appunto-auth/appunto_auth').'",';
|
||||
$js .= 'ci_logout_url = "'.$this->CI->config->item('logout_url','appunto-auth/appunto_auth').'",';
|
||||
$js .= 'ci_token= "'.$this->CI->config->item('csrf_token_name').'",';
|
||||
$js .= 'ci_cookie= "'.$this->CI->config->item('csrf_cookie_name').'",';
|
||||
$js .= 'admin_keepalive='.$this->CI->config->item('admin_keepalive','appunto-auth/appunto_auth').',';
|
||||
$js .= 'pw_regex = "'.$this->CI->config->item('password_regex_js','appunto-auth/appunto_auth').'",';
|
||||
$js .= 'datetime_format= "'.$this->CI->config->item('datetime_format','appunto-auth/appunto_auth').'";';
|
||||
$js .= '</script>';
|
||||
|
||||
return $js;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to determine if request was submitted via Ajax
|
||||
*
|
||||
* This is a convenience method to identify Ajax requests so responses can be
|
||||
* structured appropriately. It is not intended to provide any additional security.
|
||||
*
|
||||
* Specifically, authentication failures for normal controllers/views will
|
||||
* redirect to the login page or show an error message while authentication
|
||||
* failures for JSON requests will offer an ExtJS login dialog or return an
|
||||
* error message in JSON format;
|
||||
*
|
||||
* This cannot be depended on to return an accurate result since headers can
|
||||
* be faked and some servers may not provide the HTTP_X_REQUESTED_WITH variable.
|
||||
*
|
||||
* For servers that don't provide the HTTP_X_REQUESTED_WITH variable, I suggest
|
||||
* including a flag with AJAX requests and rewritting this function to check for
|
||||
* the flag.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _isAjaxRequest()
|
||||
{
|
||||
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
|
||||
(strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an array of URLs for use in helper.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/*
|
||||
public function include_urls()
|
||||
{
|
||||
|
||||
$urls = array();
|
||||
|
||||
$urls['base'] = base_url();
|
||||
$urls['extjs'] = $this->CI->config->item('extjs_url', 'appunto_auth');
|
||||
|
||||
if (true === $this->CI->config->item('appunto_dev_mode', 'appunto_auth'))
|
||||
{
|
||||
$urls['extjs_lib'] = $urls['extjs'].'ext-dev.js';
|
||||
$urls['app'] = $urls['base'].'app.js';
|
||||
}
|
||||
else
|
||||
{
|
||||
$urls['extjs_lib'] = $urls['extjs'].'ext.js';
|
||||
$urls['app'] = $urls['base'].'resources/appunto-auth/app-all.js';
|
||||
}
|
||||
return $urls;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* return a hash of the user password.
|
||||
*
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
public function hashPassword($password)
|
||||
{
|
||||
$hasher = new PasswordHash(
|
||||
$this->CI->config->item('hash_logarithm', 'appunto-auth/appunto_auth'),
|
||||
$this->CI->config->item('hash_use_portable', 'appunto-auth/appunto_auth')
|
||||
);
|
||||
return $hasher->HashPassword($password);
|
||||
}
|
||||
|
||||
/**
|
||||
* compare a password to a hashed password.
|
||||
*
|
||||
* @param string
|
||||
* @param string
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkPassword($password,$hash)
|
||||
{
|
||||
$hasher = new PasswordHash(
|
||||
$this->CI->config->item('hash_logarithm', 'appunto-auth/appunto_auth'),
|
||||
$this->CI->config->item('hash_use_portable', 'appunto-auth/appunto_auth')
|
||||
);
|
||||
return $hasher->checkPassword($password,$hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check query validity and format result array for queries
|
||||
*
|
||||
* @param array results
|
||||
* @param array callback
|
||||
* @return string JSON encoded response
|
||||
*/
|
||||
function sendResponse($results, $cb = null)
|
||||
{
|
||||
// if callback was sent use it, otherwise check GET
|
||||
$callback = $cb==null ? $this->CI->input->get('callback', TRUE) : $cb;
|
||||
|
||||
if ($callback)
|
||||
{
|
||||
// wrap json encoded response in callback
|
||||
// header('Content-Type: application/x-javascript; charset=utf-8');
|
||||
$result = $callback . '(' . json_encode($results) . ');';
|
||||
} else {
|
||||
// send json encoded response
|
||||
header('Content-Type: application/x-json; charset=utf-8');
|
||||
$result = json_encode($results);
|
||||
}
|
||||
echo $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check query validity and format result array for queries
|
||||
*
|
||||
* @param query
|
||||
* @return array
|
||||
*/
|
||||
function formatQueryResult($query,$total)
|
||||
{
|
||||
if ($query)
|
||||
{
|
||||
$query_result = $query->result();
|
||||
$total = $total;
|
||||
$result = array (
|
||||
'success' => true,
|
||||
'total' => $total,
|
||||
'rows' => $query_result
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => 'Database Error: '.$this->db->_error_message(),
|
||||
'num' => $this->db->_error_number()
|
||||
);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check query validity and format result array for operations
|
||||
*
|
||||
* @param query
|
||||
* @return array
|
||||
*/
|
||||
function formatOperationResult($query, $record = array())
|
||||
{
|
||||
//$this->chromephp->log($extra_params);
|
||||
if ($query)
|
||||
{
|
||||
// query successful
|
||||
$result = array(
|
||||
'success' => true,
|
||||
'msg' => 'Operation successful'
|
||||
);
|
||||
|
||||
if (count($record)>0)
|
||||
{
|
||||
$rows = array(
|
||||
'rows' => $record
|
||||
);
|
||||
$result = array_merge($result,$rows);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// database error
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => 'Database Error: '.$this->db->_error_message(),
|
||||
'num' => $this->db->_error_number()
|
||||
);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* ***** CONTROLLER CODE ****** O__o
|
||||
* Putting code that would normally be controller functions in the library to keep the Paths/permissions
|
||||
* manageable and to make it easier to distribute as a spark.
|
||||
*/
|
||||
function controller_read($model)
|
||||
{
|
||||
$start = $this->CI->input->get_post('start', TRUE);
|
||||
$limit = $this->CI->input->get_post('limit', TRUE);
|
||||
$sort = $this->CI->input->get_post('sort', TRUE);
|
||||
$filter = $this->CI->input->get_post('filter', TRUE);
|
||||
$search = $this->CI->input->get_post('search', TRUE);
|
||||
|
||||
$property = null;
|
||||
$direction = null;
|
||||
$active_filter = false;
|
||||
|
||||
// get sort params
|
||||
$sort_array = json_decode($sort);
|
||||
if (count($sort_array) > 0)
|
||||
{
|
||||
$property = $sort_array[0]->property;
|
||||
$direction = $sort_array[0]->direction;
|
||||
}
|
||||
|
||||
$filters = json_decode($filter);
|
||||
|
||||
$result = $model->enumerate($start,$limit,$property,$direction,$filters,$search);
|
||||
|
||||
$this->sendResponse($result);
|
||||
}
|
||||
|
||||
function controller_create($model)
|
||||
{
|
||||
if ($this->CI->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => $this->CI->lang->line('appunto_errors_encountered'),
|
||||
'errors' => validation_errors()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// return all POST items with XSS filter
|
||||
$data = $this->CI->input->post(NULL, TRUE);
|
||||
|
||||
// get result
|
||||
$result = $model->create_record($data);
|
||||
}
|
||||
$this->sendResponse($result);
|
||||
}
|
||||
|
||||
function controller_update($model)
|
||||
{
|
||||
if ($this->CI->form_validation->run()==FALSE)
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => $this->CI->lang->line('appunto_errors_encountered'),
|
||||
'errors' => validation_errors(),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// return all POST items with XSS filter
|
||||
$data = $this->CI->input->post(NULL, TRUE);
|
||||
|
||||
if (count($data)>1)
|
||||
{
|
||||
$result = $model->update_record($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => 'No updates attempted.'
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->sendResponse($result);
|
||||
}
|
||||
|
||||
function controller_destroy($model)
|
||||
{
|
||||
// create array from post data
|
||||
$data = $this->CI->input->post(NULL, TRUE);
|
||||
|
||||
if (!$this->CI->form_validation->run())
|
||||
{
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => $this->CI->lang->line('appunto_errors_encountered'),
|
||||
'errors' => validation_errors()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $model->delete_record($data);
|
||||
}
|
||||
$this->sendResponse($result);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
# Appunto-Auth license
|
||||
|
||||
####License for all files except for third party files, the app.js and theme.css files
|
||||
|
||||
Appunto Auth is licensed under a version of the MIT license.
|
||||
Please do not remove the copyright and permission notice contained in this file.
|
||||
|
||||
Copyright (c) 2012-2014 Bill Clinton (bclinton@appunto.net)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software in the application/libraries/appunto-auth folder
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#### License for all third party files
|
||||
|
||||
The license of all third party files are governed by the terms of their licenses. Please see
|
||||
the CREDITS.MD file for a list of all third party files.
|
||||
|
||||
#### License for app.js and theme.css files
|
||||
|
||||
Per Sencha requirements, the app.js and theme.css files are governed by the terms of the GPLv3 license.
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,253 +0,0 @@
|
||||
<?php
|
||||
#
|
||||
# Portable PHP password hashing framework.
|
||||
#
|
||||
# Version 0.3 / genuine.
|
||||
#
|
||||
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
|
||||
# the public domain. Revised in subsequent years, still public domain.
|
||||
#
|
||||
# There's absolutely no warranty.
|
||||
#
|
||||
# The homepage URL for this framework is:
|
||||
#
|
||||
# http://www.openwall.com/phpass/
|
||||
#
|
||||
# Please be sure to update the Version line if you edit this file in any way.
|
||||
# It is suggested that you leave the main version number intact, but indicate
|
||||
# your project name (after the slash) and add your own revision information.
|
||||
#
|
||||
# Please do not change the "private" password hashing method implemented in
|
||||
# here, thereby making your hashes incompatible. However, if you must, please
|
||||
# change the hash type identifier (the "$P$") to something different.
|
||||
#
|
||||
# Obviously, since this code is in the public domain, the above are not
|
||||
# requirements (there can be none), but merely suggestions.
|
||||
#
|
||||
class PasswordHash {
|
||||
var $itoa64;
|
||||
var $iteration_count_log2;
|
||||
var $portable_hashes;
|
||||
var $random_state;
|
||||
|
||||
function PasswordHash($iteration_count_log2, $portable_hashes)
|
||||
{
|
||||
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
|
||||
$iteration_count_log2 = 8;
|
||||
$this->iteration_count_log2 = $iteration_count_log2;
|
||||
|
||||
$this->portable_hashes = $portable_hashes;
|
||||
|
||||
$this->random_state = microtime();
|
||||
if (function_exists('getmypid'))
|
||||
$this->random_state .= getmypid();
|
||||
}
|
||||
|
||||
function get_random_bytes($count)
|
||||
{
|
||||
$output = '';
|
||||
if (is_readable('/dev/urandom') &&
|
||||
($fh = @fopen('/dev/urandom', 'rb'))) {
|
||||
$output = fread($fh, $count);
|
||||
fclose($fh);
|
||||
}
|
||||
|
||||
if (strlen($output) < $count) {
|
||||
$output = '';
|
||||
for ($i = 0; $i < $count; $i += 16) {
|
||||
$this->random_state =
|
||||
md5(microtime() . $this->random_state);
|
||||
$output .=
|
||||
pack('H*', md5($this->random_state));
|
||||
}
|
||||
$output = substr($output, 0, $count);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function encode64($input, $count)
|
||||
{
|
||||
$output = '';
|
||||
$i = 0;
|
||||
do {
|
||||
$value = ord($input[$i++]);
|
||||
$output .= $this->itoa64[$value & 0x3f];
|
||||
if ($i < $count)
|
||||
$value |= ord($input[$i]) << 8;
|
||||
$output .= $this->itoa64[($value >> 6) & 0x3f];
|
||||
if ($i++ >= $count)
|
||||
break;
|
||||
if ($i < $count)
|
||||
$value |= ord($input[$i]) << 16;
|
||||
$output .= $this->itoa64[($value >> 12) & 0x3f];
|
||||
if ($i++ >= $count)
|
||||
break;
|
||||
$output .= $this->itoa64[($value >> 18) & 0x3f];
|
||||
} while ($i < $count);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function gensalt_private($input)
|
||||
{
|
||||
$output = '$P$';
|
||||
$output .= $this->itoa64[min($this->iteration_count_log2 +
|
||||
((PHP_VERSION >= '5') ? 5 : 3), 30)];
|
||||
$output .= $this->encode64($input, 6);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function crypt_private($password, $setting)
|
||||
{
|
||||
$output = '*0';
|
||||
if (substr($setting, 0, 2) == $output)
|
||||
$output = '*1';
|
||||
|
||||
$id = substr($setting, 0, 3);
|
||||
# We use "$P$", phpBB3 uses "$H$" for the same thing
|
||||
if ($id != '$P$' && $id != '$H$')
|
||||
return $output;
|
||||
|
||||
$count_log2 = strpos($this->itoa64, $setting[3]);
|
||||
if ($count_log2 < 7 || $count_log2 > 30)
|
||||
return $output;
|
||||
|
||||
$count = 1 << $count_log2;
|
||||
|
||||
$salt = substr($setting, 4, 8);
|
||||
if (strlen($salt) != 8)
|
||||
return $output;
|
||||
|
||||
# We're kind of forced to use MD5 here since it's the only
|
||||
# cryptographic primitive available in all versions of PHP
|
||||
# currently in use. To implement our own low-level crypto
|
||||
# in PHP would result in much worse performance and
|
||||
# consequently in lower iteration counts and hashes that are
|
||||
# quicker to crack (by non-PHP code).
|
||||
if (PHP_VERSION >= '5') {
|
||||
$hash = md5($salt . $password, TRUE);
|
||||
do {
|
||||
$hash = md5($hash . $password, TRUE);
|
||||
} while (--$count);
|
||||
} else {
|
||||
$hash = pack('H*', md5($salt . $password));
|
||||
do {
|
||||
$hash = pack('H*', md5($hash . $password));
|
||||
} while (--$count);
|
||||
}
|
||||
|
||||
$output = substr($setting, 0, 12);
|
||||
$output .= $this->encode64($hash, 16);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function gensalt_extended($input)
|
||||
{
|
||||
$count_log2 = min($this->iteration_count_log2 + 8, 24);
|
||||
# This should be odd to not reveal weak DES keys, and the
|
||||
# maximum valid value is (2**24 - 1) which is odd anyway.
|
||||
$count = (1 << $count_log2) - 1;
|
||||
|
||||
$output = '_';
|
||||
$output .= $this->itoa64[$count & 0x3f];
|
||||
$output .= $this->itoa64[($count >> 6) & 0x3f];
|
||||
$output .= $this->itoa64[($count >> 12) & 0x3f];
|
||||
$output .= $this->itoa64[($count >> 18) & 0x3f];
|
||||
|
||||
$output .= $this->encode64($input, 3);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function gensalt_blowfish($input)
|
||||
{
|
||||
# This one needs to use a different order of characters and a
|
||||
# different encoding scheme from the one in encode64() above.
|
||||
# We care because the last character in our encoded string will
|
||||
# only represent 2 bits. While two known implementations of
|
||||
# bcrypt will happily accept and correct a salt string which
|
||||
# has the 4 unused bits set to non-zero, we do not want to take
|
||||
# chances and we also do not want to waste an additional byte
|
||||
# of entropy.
|
||||
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
$output = '$2a$';
|
||||
$output .= chr(ord('0') + $this->iteration_count_log2 / 10);
|
||||
$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
|
||||
$output .= '$';
|
||||
|
||||
$i = 0;
|
||||
do {
|
||||
$c1 = ord($input[$i++]);
|
||||
$output .= $itoa64[$c1 >> 2];
|
||||
$c1 = ($c1 & 0x03) << 4;
|
||||
if ($i >= 16) {
|
||||
$output .= $itoa64[$c1];
|
||||
break;
|
||||
}
|
||||
|
||||
$c2 = ord($input[$i++]);
|
||||
$c1 |= $c2 >> 4;
|
||||
$output .= $itoa64[$c1];
|
||||
$c1 = ($c2 & 0x0f) << 2;
|
||||
|
||||
$c2 = ord($input[$i++]);
|
||||
$c1 |= $c2 >> 6;
|
||||
$output .= $itoa64[$c1];
|
||||
$output .= $itoa64[$c2 & 0x3f];
|
||||
} while (1);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function HashPassword($password)
|
||||
{
|
||||
$random = '';
|
||||
|
||||
if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
|
||||
$random = $this->get_random_bytes(16);
|
||||
$hash =
|
||||
crypt($password, $this->gensalt_blowfish($random));
|
||||
if (strlen($hash) == 60)
|
||||
return $hash;
|
||||
}
|
||||
|
||||
if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
|
||||
if (strlen($random) < 3)
|
||||
$random = $this->get_random_bytes(3);
|
||||
$hash =
|
||||
crypt($password, $this->gensalt_extended($random));
|
||||
if (strlen($hash) == 20)
|
||||
return $hash;
|
||||
}
|
||||
|
||||
if (strlen($random) < 6)
|
||||
$random = $this->get_random_bytes(6);
|
||||
$hash =
|
||||
$this->crypt_private($password,
|
||||
$this->gensalt_private($random));
|
||||
if (strlen($hash) == 34)
|
||||
return $hash;
|
||||
|
||||
# Returning '*' on error is safe here, but would _not_ be safe
|
||||
# in a crypt(3)-like function used _both_ for generating new
|
||||
# hashes and for validating passwords against existing hashes.
|
||||
return '*';
|
||||
}
|
||||
|
||||
function CheckPassword($password, $stored_hash)
|
||||
{
|
||||
$hash = $this->crypt_private($password, $stored_hash);
|
||||
if ($hash[0] == '*')
|
||||
$hash = crypt($password, $stored_hash);
|
||||
|
||||
return $hash == $stored_hash;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,21 +0,0 @@
|
||||
#
|
||||
# Written by Solar Designer and placed in the public domain.
|
||||
# See crypt_private.c for more information.
|
||||
#
|
||||
CC = gcc
|
||||
LD = $(CC)
|
||||
RM = rm -f
|
||||
CFLAGS = -Wall -O2 -fomit-frame-pointer -funroll-loops
|
||||
LDFLAGS = -s
|
||||
LIBS = -lcrypto
|
||||
|
||||
all: crypt_private-test
|
||||
|
||||
crypt_private-test: crypt_private-test.o
|
||||
$(LD) $(LDFLAGS) $(LIBS) crypt_private-test.o -o $@
|
||||
|
||||
crypt_private-test.o: crypt_private.c
|
||||
$(CC) -c $(CFLAGS) crypt_private.c -DTEST -o $@
|
||||
|
||||
clean:
|
||||
$(RM) crypt_private-test*
|
||||
@ -1,106 +0,0 @@
|
||||
/*
|
||||
* This code exists for the sole purpose to serve as another implementation
|
||||
* of the "private" password hashing method implemened in PasswordHash.php
|
||||
* and thus to confirm that these password hashes are indeed calculated as
|
||||
* intended.
|
||||
*
|
||||
* Other uses of this code are discouraged. There are much better password
|
||||
* hashing algorithms available to C programmers; one of those is bcrypt:
|
||||
*
|
||||
* http://www.openwall.com/crypt/
|
||||
*
|
||||
* Written by Solar Designer <solar at openwall.com> in 2005 and placed in
|
||||
* the public domain.
|
||||
*
|
||||
* There's absolutely no warranty.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#ifdef TEST
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
static char *itoa64 =
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
static void encode64(char *dst, char *src, int count)
|
||||
{
|
||||
int i, value;
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
value = (unsigned char)src[i++];
|
||||
*dst++ = itoa64[value & 0x3f];
|
||||
if (i < count)
|
||||
value |= (unsigned char)src[i] << 8;
|
||||
*dst++ = itoa64[(value >> 6) & 0x3f];
|
||||
if (i++ >= count)
|
||||
break;
|
||||
if (i < count)
|
||||
value |= (unsigned char)src[i] << 16;
|
||||
*dst++ = itoa64[(value >> 12) & 0x3f];
|
||||
if (i++ >= count)
|
||||
break;
|
||||
*dst++ = itoa64[(value >> 18) & 0x3f];
|
||||
} while (i < count);
|
||||
}
|
||||
|
||||
char *crypt_private(char *password, char *setting)
|
||||
{
|
||||
static char output[35];
|
||||
MD5_CTX ctx;
|
||||
char hash[MD5_DIGEST_LENGTH];
|
||||
char *p, *salt;
|
||||
int count_log2, length, count;
|
||||
|
||||
strcpy(output, "*0");
|
||||
if (!strncmp(setting, output, 2))
|
||||
output[1] = '1';
|
||||
|
||||
if (strncmp(setting, "$P$", 3))
|
||||
return output;
|
||||
|
||||
p = strchr(itoa64, setting[3]);
|
||||
if (!p)
|
||||
return output;
|
||||
count_log2 = p - itoa64;
|
||||
if (count_log2 < 7 || count_log2 > 30)
|
||||
return output;
|
||||
|
||||
salt = setting + 4;
|
||||
if (strlen(salt) < 8)
|
||||
return output;
|
||||
|
||||
length = strlen(password);
|
||||
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, salt, 8);
|
||||
MD5_Update(&ctx, password, length);
|
||||
MD5_Final(hash, &ctx);
|
||||
|
||||
count = 1 << count_log2;
|
||||
do {
|
||||
MD5_Init(&ctx);
|
||||
MD5_Update(&ctx, hash, MD5_DIGEST_LENGTH);
|
||||
MD5_Update(&ctx, password, length);
|
||||
MD5_Final(hash, &ctx);
|
||||
} while (--count);
|
||||
|
||||
memcpy(output, setting, 12);
|
||||
encode64(&output[12], hash, MD5_DIGEST_LENGTH);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 3) return 1;
|
||||
|
||||
puts(crypt_private(argv[1], argv[2]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,199 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Groupmodel extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/Appunto_auth');
|
||||
$this->load->database();
|
||||
|
||||
$prefix = $this->config->item('db_table_prefix','appunto-auth/appunto_auth');
|
||||
|
||||
$this->table = $prefix.'appa_group';
|
||||
$this->user_table = $prefix.'appa_user';
|
||||
$this->group_user_table = $prefix.'appa_user_group';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get groups
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function enumerate($offset,$rows,$sort,$dir,$filters)
|
||||
{
|
||||
// define table here for count all results
|
||||
$this->db->from($this->table);
|
||||
$total = $this->db->count_all_results();
|
||||
|
||||
$this->db->select('group.id, group.name,group.description');
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('group.name','ASC');
|
||||
}
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table. ' `group`');
|
||||
|
||||
// format and return result to controller
|
||||
return $this->appunto_auth->formatQueryResult($query,$total);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group
|
||||
*
|
||||
* @return group
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
// define query
|
||||
$this->db->select('group.id, group.name,group.description');
|
||||
|
||||
$this->db->where('group.id',$id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' `group`');
|
||||
|
||||
// format and return result to controller
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group users
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_group_users($id,$sort,$dir)
|
||||
{
|
||||
$this->db->select('if(isnull(ug.group_id),0,1) as inGroup',false);
|
||||
$this->db->select('u.id, u.username, u.email');
|
||||
|
||||
$this->db->join($this->user_table.' u','u.id = ug.user_id and ug.group_id ='.$id,'right');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->group_user_table.' ug');
|
||||
|
||||
return $this->appunto_auth->formatQueryResult($query,$query->num_rows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user groups
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_group_user($user_id,$group_id)
|
||||
{
|
||||
$this->db->select('if(isnull(ug.group_id),0,1) as inGroup',false);
|
||||
$this->db->select('u.id, u.username, u.email');
|
||||
|
||||
$this->db->join($this->group_user_table.' ug','u.id = ug.user_id and ug.group_id ='.$group_id,'left');
|
||||
|
||||
$this->db->where('u.id',$user_id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->user_table.' u');
|
||||
|
||||
return $query->row() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function create_record($data)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->table, $data);
|
||||
|
||||
// get the id to select a full record to return to UI
|
||||
$id = $this->db->insert_id();
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function update_record($data)
|
||||
{
|
||||
// get/set the id and remove it from the data array
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
unset($data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, $data);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function delete_record($data)
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('id', $data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user to a group
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function add_user($user_id,$group_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->group_user_table, array(
|
||||
'user_id' => $user_id,
|
||||
'group_id' => $group_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_group_user($user_id,$group_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a user from a group
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function remove_user($user_id,$group_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->delete($this->group_user_table, array(
|
||||
'user_id' => $user_id,
|
||||
'group_id' => $group_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_group_user($user_id,$group_id));
|
||||
}
|
||||
};
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,264 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Pathmodel extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/Appunto_auth');
|
||||
|
||||
$this->load->database();
|
||||
|
||||
$prefix = $this->config->item('db_table_prefix','appunto-auth/appunto_auth');
|
||||
|
||||
$this->table = $prefix.'appa_path';
|
||||
$this->permission_table = $prefix.'appa_permission';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paths for library auhentication verification
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function getAll()
|
||||
{
|
||||
$this->db->select('path.ci_controller as ci_controller, path.ci_method as ci_method, path.public_flag as public_flag');
|
||||
$this->db->select('perm.id as permission_id, perm.internal_name as internal_name');
|
||||
|
||||
$this->db->join($this->permission_table.' perm','perm.id = path.permission_id','left');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' path');
|
||||
|
||||
// return result
|
||||
return $this->appunto_auth->formatQueryResult($query,$query->num_rows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paths
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function enumerate($offset,$rows,$sort,$dir,$filters)
|
||||
{
|
||||
$this->db->select('path.id, path.dir, path.full_path, path.ci_controller, path.ci_method, path.found, path.public_flag, path.note');
|
||||
$this->db->select('perm.id as permission_id, perm.name as permission_name, perm.internal_name as internal_name');
|
||||
|
||||
$this->db->join($this->permission_table.' perm','perm.id = path.permission_id','left');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' path');
|
||||
|
||||
// add column for grouping by controller directory
|
||||
if ($rows = $query->result())
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
// directory name or controller name if in main controller dir
|
||||
$row->dir_group = ($row->dir == '.') ? $row->ci_controller : $row->dir;
|
||||
}
|
||||
}
|
||||
|
||||
// format and return result to controller
|
||||
return $this->appunto_auth->formatQueryResult($query,$query->num_rows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get path
|
||||
*
|
||||
* @return path
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
// define query
|
||||
$this->db->select('path.id, path.dir, path.ci_controller, path.ci_method, path.found, path.public_flag, path.note');
|
||||
$this->db->select('perm.id as permission_id, perm.name as permission_name');
|
||||
|
||||
$this->db->join($this->permission_table.' perm','perm.id = path.permission_id','left');
|
||||
|
||||
$this->db->where('path.id',$id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' path');
|
||||
|
||||
// format and return result to controller
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create record
|
||||
*
|
||||
* @param int ci_controller
|
||||
* @param int ci_method
|
||||
* @return object
|
||||
*/
|
||||
function create_record($dir, $filename, $full_path, $ci_controller, $ci_method, $found = 0)
|
||||
{
|
||||
$this->db->set('dir', $dir);
|
||||
$this->db->set('filename', $filename);
|
||||
$this->db->set('full_path', $full_path);
|
||||
$this->db->set('ci_controller', $ci_controller);
|
||||
$this->db->set('ci_method', $ci_method);
|
||||
$this->db->set('found', $found);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->insert($this->table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if this path has already been recorded in db
|
||||
*
|
||||
* @param int ci_controller
|
||||
* @param int ci_method
|
||||
* @return boolean
|
||||
*/
|
||||
function path_exists($dir, $ci_controller, $ci_method)
|
||||
{
|
||||
// shouldn't have to reload the database library here but during the
|
||||
// upgrade to 2.2.0 I started getting an error here if it was not present
|
||||
// investigate further later
|
||||
$this->load->database();
|
||||
|
||||
$this->db->where('dir', $dir);
|
||||
$this->db->where('ci_controller', $ci_controller);
|
||||
$this->db->where('ci_method', $ci_method);
|
||||
$this->db->from($this->table);
|
||||
|
||||
if ($this->db->count_all_results() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark Found
|
||||
*
|
||||
* @param int ci_controller
|
||||
* @param int ci_method
|
||||
* @return void
|
||||
*/
|
||||
function mark_found($dir, $ci_controller, $ci_method)
|
||||
{
|
||||
$this->db->where('dir', $dir);
|
||||
$this->db->where('ci_controller', $ci_controller);
|
||||
$this->db->where('ci_method', $ci_method);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, array('found'=>1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark All Unfound
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function mark_all_unfound()
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, array('found'=>0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function update_record($data)
|
||||
{
|
||||
// get/set the id and remove it from the data array
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
unset($data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, $data);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function delete_record($data)
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('id', $data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all paths that are not found
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function delete_not_found()
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('found', 0);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Path marked Found
|
||||
*
|
||||
* @param array
|
||||
* @return boolean
|
||||
*/
|
||||
function is_marked_found($data)
|
||||
{
|
||||
$this->db->select('found');
|
||||
|
||||
// get/set the id
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table);
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
$row = $query->row();
|
||||
if ($row->found == 0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear permissions
|
||||
*
|
||||
* @param array
|
||||
* @return void
|
||||
*/
|
||||
function clear_permissions($data)
|
||||
{
|
||||
// get/set the id and remove it from the data array
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
unset($data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, array('permission_id' => NULL));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
};
|
||||
@ -1,174 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Permissionmodel extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/Appunto_auth');
|
||||
$this->load->database();
|
||||
|
||||
$prefix = $this->config->item('db_table_prefix','appunto-auth/appunto_auth');
|
||||
|
||||
$this->table = $prefix.'appa_permission';
|
||||
$this->path_table = $prefix.'appa_path';
|
||||
$this->user_permission_table = $prefix.'appa_user_permission';
|
||||
$this->role_permission_table = $prefix.'appa_role_permission';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get permissions
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function enumerate($offset,$rows,$sort,$dir,$filters)
|
||||
{
|
||||
// define table here for count all results
|
||||
$this->db->from($this->table);
|
||||
$total = $this->db->count_all_results();
|
||||
|
||||
$this->db->select('p.id, p.name, p.internal_name, p.description');
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('p.name','ASC');
|
||||
}
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' p');
|
||||
|
||||
// format and return result to controller
|
||||
return $this->appunto_auth->formatQueryResult($query,$total);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get permission
|
||||
*
|
||||
* @return permission
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
// define query
|
||||
$this->db->select('p.id, p.name, p.internal_name, p.description');
|
||||
|
||||
$this->db->where('p.id',$id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' p');
|
||||
|
||||
// format and return result to controller
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function create_record($data)
|
||||
{
|
||||
$data['internal_name'] = strtoupper(str_replace(' ','_',$data['name']));
|
||||
|
||||
// execute query
|
||||
$query = $this->db->insert($this->table, $data);
|
||||
|
||||
// get the id to select a full record to return to UI
|
||||
$id = $this->db->insert_id();
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function update_record($data)
|
||||
{
|
||||
// get/set the id and remove it from the data array
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
unset($data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, $data);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function delete_record($data)
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('id', $data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
function in_use_by_user($id)
|
||||
{
|
||||
$this->db->select('permission_id');
|
||||
$this->db->where('permission_id', $id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->user_permission_table);
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function in_use_by_role($id)
|
||||
{
|
||||
$this->db->select('permission_id');
|
||||
$this->db->where('permission_id', $id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->role_permission_table);
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function in_use_by_path($id)
|
||||
{
|
||||
$this->db->select('path.id');
|
||||
$this->db->where('permission_id', $id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->path_table.' path');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
@ -1,230 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Rolemodel extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/Appunto_auth');
|
||||
$this->load->database();
|
||||
|
||||
$prefix = $this->config->item('db_table_prefix','appunto-auth/appunto_auth');
|
||||
|
||||
$this->table = $prefix.'appa_role';
|
||||
$this->permission_table = $prefix.'appa_permission';
|
||||
$this->user_role_table = $prefix.'appa_user_role';
|
||||
$this->role_permission_table = $prefix.'appa_role_permission';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get roles
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function enumerate($offset,$rows,$sort,$dir,$filters)
|
||||
{
|
||||
// define table here for count all results
|
||||
$this->db->from($this->table);
|
||||
$total = $this->db->count_all_results();
|
||||
|
||||
$this->db->select('role.id, role.name,role.description');
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('role.name','ASC');
|
||||
}
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table. ' role');
|
||||
|
||||
// format and return result to controller
|
||||
return $this->appunto_auth->formatQueryResult($query,$total);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get role
|
||||
*
|
||||
* @return role
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
// define query
|
||||
$this->db->select('role.id, role.name, role.description');
|
||||
|
||||
$this->db->where('role.id',$id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' role');
|
||||
|
||||
// format and return result to controller
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get role permissions
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_role_permissions($id,$sort,$dir)
|
||||
{
|
||||
$this->db->select('if(isnull(rp.role_id),0,1) as inRole',false);
|
||||
$this->db->select('p.id, p.name, p.description');
|
||||
|
||||
$this->db->join($this->permission_table.' p','p.id = rp.permission_id and rp.role_id ='.$id,'right');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->role_permission_table.' rp');
|
||||
|
||||
return $this->appunto_auth->formatQueryResult($query,$query->num_rows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user roles
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_role_permission($permission_id,$role_id)
|
||||
{
|
||||
$this->db->select('if(isnull(rp.role_id),0,1) as inRole',false);
|
||||
$this->db->select('p.id, p.name, p.description');
|
||||
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id ='.$role_id,'left');
|
||||
|
||||
$this->db->where('p.id',$permission_id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
return $query->row() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function create_record($data)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->table, $data);
|
||||
|
||||
// get the id to select a full record to return to UI
|
||||
$id = $this->db->insert_id();
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function update_record($data)
|
||||
{
|
||||
// get/set the id and remove it from the data array
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
unset($data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, $data);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function delete_record($data)
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('id', $data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a permission to a role
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function add_permission($permission_id,$role_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->role_permission_table, array(
|
||||
'permission_id' => $permission_id,
|
||||
'role_id' => $role_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_role_permission($permission_id,$role_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a permission from a role
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function remove_permission($permission_id,$role_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->delete($this->role_permission_table, array(
|
||||
'permission_id' => $permission_id,
|
||||
'role_id' => $role_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_role_permission($permission_id,$role_id));
|
||||
}
|
||||
|
||||
function in_use_by_user($id)
|
||||
{
|
||||
$this->db->select('role_id');
|
||||
$this->db->where('role_id', $id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->user_role_table);
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function in_use_by_permission($id)
|
||||
{
|
||||
$this->db->select('role_id');
|
||||
$this->db->where('role_id', $id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->role_permission_table);
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -1,110 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Sessionmodel extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/Appunto_auth');
|
||||
$this->load->database();
|
||||
|
||||
$prefix = $this->config->item('db_table_prefix','appunto-auth/appunto_auth');
|
||||
|
||||
$this->table = $prefix.'ci_sessions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sessions
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function enumerate($offset,$rows=0,$sort,$dir,$filters)
|
||||
{
|
||||
// define table here for count all results
|
||||
$this->db->from($this->table);
|
||||
$total = 0;
|
||||
|
||||
$this->db->select('session_id as id,ip_address,user_agent');
|
||||
$this->db->select("CONCAT( DATE( FROM_UNIXTIME( `last_activity` ) ),' ',TIME( FROM_UNIXTIME( `last_activity` ) ) ) AS last_activity",false);
|
||||
$this->db->select('user_agent,user_data');
|
||||
|
||||
$show_all = 1;
|
||||
if (count($filters)>0)
|
||||
{
|
||||
foreach($filters as $filter)
|
||||
{
|
||||
$property = $filter->property;
|
||||
if ($property == 'show_all') $show_all = $filter->value;
|
||||
}
|
||||
}
|
||||
|
||||
// add limit and get results
|
||||
if ($rows>0) $this->db->limit($rows,$offset);
|
||||
|
||||
$query = $this->db->get();
|
||||
|
||||
$result_array = array();
|
||||
|
||||
if ($rows = $query->result())
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$total++;
|
||||
|
||||
$user_data = unserialize($row->user_data);
|
||||
$user_name = isset($user_data['username']) ? $user_data['username'] : '';
|
||||
$last_page = isset($user_data['last_page']) ? $user_data['last_page'] : '';
|
||||
|
||||
if ( $show_all == 1 || is_array($user_data))
|
||||
{
|
||||
$this_row = array (
|
||||
'id' => $row->id,
|
||||
'username' => $user_name,
|
||||
'last_page' => $last_page,
|
||||
'last_activity' => $row->last_activity,
|
||||
'ip_address' => $row->ip_address,
|
||||
'user_agent' => $row->user_agent
|
||||
);
|
||||
$result_array[] = $this_row;
|
||||
}
|
||||
}
|
||||
|
||||
$result = array (
|
||||
'success' => true,
|
||||
'total' => $total,
|
||||
'rows' => $result_array
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$result = array (
|
||||
'success' => false,
|
||||
'msg' => 'Database Error: '.$this->db->_error_message(),
|
||||
'num' => $this->db->_error_number()
|
||||
);
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function delete_record($data)
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('session_id', $data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
};
|
||||
@ -1,557 +0,0 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Usermodel extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('appunto-auth/Appunto_auth');
|
||||
$this->load->database();
|
||||
|
||||
$prefix = $this->config->item('db_table_prefix','appunto-auth/appunto_auth');
|
||||
|
||||
$this->table = $prefix.'appa_user';
|
||||
$this->role_table = $prefix.'appa_role';
|
||||
$this->user_role_table = $prefix.'appa_user_role';
|
||||
$this->permission_table = $prefix.'appa_permission';
|
||||
$this->user_permission_table = $prefix.'appa_user_permission';
|
||||
$this->role_permission_table = $prefix.'appa_role_permission';
|
||||
$this->user_login_attempt = $prefix.'appa_user_login_attempt';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get users
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function enumerate($offset,$rows,$sort,$dir,$filters,$search)
|
||||
{
|
||||
|
||||
$this->_build_enumerate($offset,$rows,$sort,$dir,$filters,$search);
|
||||
$this->db->from($this->table. ' user');
|
||||
$total = $this->db->count_all_results();
|
||||
$this->db->flush_cache();
|
||||
|
||||
|
||||
$this->_build_enumerate($offset,$rows,$sort,$dir,$filters,$search);
|
||||
$this->db->limit($rows,$offset);
|
||||
$query = $this->db->get($this->table. ' user');
|
||||
$this->db->flush_cache();
|
||||
|
||||
return $this->appunto_auth->formatQueryResult($query,$total);
|
||||
}
|
||||
|
||||
function _build_enumerate($offset,$rows,$sort,$dir,$filters,$search)
|
||||
{
|
||||
$this->db->start_cache();
|
||||
|
||||
$this->db->select('user.id, user.username, user.email, user.active');
|
||||
$this->db->select('user.last_ip, user.last_login, user.created, user.modified');
|
||||
$this->db->select('user.name, user.surname');
|
||||
|
||||
if (!empty($search))
|
||||
{
|
||||
$this->db->like('UPPER(user.username)', strtoupper($search));
|
||||
$this->db->or_like('UPPER(user.name)', strtoupper($search));
|
||||
$this->db->or_like('UPPER(user.surname)', strtoupper($search));
|
||||
$this->db->or_like('UPPER(user.email)', strtoupper($search));
|
||||
}
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('username','ASC');
|
||||
}
|
||||
|
||||
$this->db->stop_cache();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user
|
||||
*
|
||||
* @return user
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
// define query
|
||||
$this->db->select('user.id, user.username, user.email, user.active');
|
||||
$this->db->select('user.last_ip, user.last_login, user.created, user.modified');
|
||||
$this->db->select('user.name, user.surname');
|
||||
|
||||
$this->db->where('user.id',$id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' user');
|
||||
|
||||
// format and return result to controller
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user roles
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_user_roles($id,$sort,$dir)
|
||||
{
|
||||
$this->db->select('if(isnull(ur.user_id),0,1) as hasRole',false);
|
||||
$this->db->select('r.id, r.name, r.description');
|
||||
|
||||
$this->db->join($this->role_table.' r','r.id = ur.role_id and ur.user_id ='.$id,'right');
|
||||
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('hasRole','DESC');
|
||||
$this->db->order_by('role_id','ASC');
|
||||
}
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->user_role_table.' ur');
|
||||
|
||||
return $this->appunto_auth->formatQueryResult($query,$query->num_rows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user roles
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_user_role($role_id,$user_id)
|
||||
{
|
||||
$this->db->select('if(isnull(ur.user_id),0,1) as hasRole',false);
|
||||
$this->db->select('r.id, r.name, r.description');
|
||||
|
||||
$this->db->join($this->user_role_table.' ur','r.id = ur.role_id and ur.user_id ='.$user_id,'left');
|
||||
|
||||
$this->db->where('r.id',$role_id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->role_table.' r');
|
||||
|
||||
return $query->row() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user permissions
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_user_permissions($id,$sort,$dir)
|
||||
{
|
||||
$this->db->select('p.id, p.name, p.description');
|
||||
$this->db->select('if(!isnull(up.user_id) || !isnull(rp.role_id),1,0) as hasPermission',false);
|
||||
$this->db->select('if(isnull(up.user_id),0,1) as userHasPermission',false);
|
||||
$this->db->select('if(isnull(rp.role_id),0,1) as userRoleHasPermission',false);
|
||||
|
||||
$subquery = '(select ur.role_id from '.$this->user_role_table.' ur where ur.user_id ='.$id.')';
|
||||
|
||||
$this->db->join($this->user_permission_table.' up','p.id = up.permission_id and up.user_id ='.$id,'left');
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id IN '.$subquery,'left');
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('userHasPermission','DESC');
|
||||
$this->db->order_by('p.id','ASC');
|
||||
}
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
return $this->appunto_auth->formatQueryResult($query,$query->num_rows());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user permission array
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_user_permission_array($id)
|
||||
{
|
||||
$this->db->select('p.id');
|
||||
|
||||
$subquery = '(select ur.role_id from '.$this->user_role_table. ' ur where ur.user_id ='.$id.')';
|
||||
|
||||
$this->db->join($this->user_permission_table.' up','p.id = up.permission_id and up.user_id ='.$id,'left');
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id IN '.$subquery,'left');
|
||||
|
||||
$this->db->where('((up.user_id IS NOT NULL) || (rp.role_id IS NOT NULL))');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
$permissions = array();
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
array_push($permissions,$row->id);
|
||||
}
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user permission array
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_user_permission_internal_name_array($id)
|
||||
{
|
||||
$this->db->select('p.internal_name');
|
||||
|
||||
$subquery = '(select ur.role_id from '.$this->user_role_table. ' ur where ur.user_id ='.$id.')';
|
||||
|
||||
$this->db->join($this->user_permission_table.' up','p.id = up.permission_id and up.user_id ='.$id,'left');
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id IN '.$subquery,'left');
|
||||
|
||||
$this->db->where('((up.user_id IS NOT NULL) || (rp.role_id IS NOT NULL))');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
$permissions = array();
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
array_push($permissions,$row->internal_name);
|
||||
}
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function verifyPermissionById($u_id,$p_id)
|
||||
{
|
||||
$this->db->select('p.id, p.name');
|
||||
|
||||
$subquery = '(select ur.role_id from '.$this->user_role_table. ' ur where ur.user_id ='.$u_id.')';
|
||||
|
||||
$this->db->join($this->user_permission_table.' up','p.id = up.permission_id and up.user_id ='.$u_id,'left');
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id IN '.$subquery,'left');
|
||||
|
||||
$this->db->where('((up.user_id IS NOT NULL) || (rp.role_id IS NOT NULL))');
|
||||
|
||||
$this->db->where('p.id',$p_id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
return ($query->num_rows() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function verifyPermissionByInternalName($u_id,$p_name)
|
||||
{
|
||||
$this->db->select('p.id, p.name');
|
||||
|
||||
$subquery = '(select ur.role_id from '.$this->user_role_table. ' ur where ur.user_id ='.$u_id.')';
|
||||
|
||||
$this->db->join($this->user_permission_table.' up','p.id = up.permission_id and up.user_id ='.$u_id,'left');
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id IN '.$subquery,'left');
|
||||
|
||||
$this->db->where('((up.user_id IS NOT NULL) || (rp.role_id IS NOT NULL))');
|
||||
|
||||
// Let's make this case sensitive
|
||||
//$this->db->where('UPPER(p.internal_name) = UPPER("'.$p_name.'")');
|
||||
$this->db->where('p.internal_name = "'.$p_name.'"');
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
return ($query->num_rows() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user permission
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function get_user_permission($permission_id,$id)
|
||||
{
|
||||
$this->db->select('p.id, p.name, p.description');
|
||||
$this->db->select('if(!isnull(up.user_id) || !isnull(rp.role_id),1,0) as hasPermission',false);
|
||||
$this->db->select('if(isnull(up.user_id),0,1) as userHasPermission',false);
|
||||
$this->db->select('if(isnull(rp.role_id),0,1) as userRoleHasPermission',false);
|
||||
|
||||
$subquery = '(select ur.role_id from '.$this->user_role_table.' ur where ur.user_id ='.$id.')';
|
||||
|
||||
$this->db->join($this->user_permission_table.' up','p.id = up.permission_id and up.user_id ='.$id,'left');
|
||||
$this->db->join($this->role_permission_table.' rp','p.id = rp.permission_id and rp.role_id IN '.$subquery,'left');
|
||||
|
||||
$this->db->where('p.id',$permission_id);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->permission_table.' p');
|
||||
|
||||
return $query->row() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user with password for login verification
|
||||
*
|
||||
* @return user
|
||||
*/
|
||||
function getLoginInfo($login)
|
||||
{
|
||||
// define query
|
||||
$this->db->select('user.id, user.username, user.email, user.password');
|
||||
|
||||
$this->db->where('user.username',$login);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->table.' user');
|
||||
|
||||
// format and return result to controller
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
return $query->row();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Create record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function create_record($data)
|
||||
{
|
||||
/**
|
||||
* MySQL doesn't allow more than one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
|
||||
* (Error Code : 1293) in versions before 5.6. We can get around this by making the default of the created
|
||||
* column "0000-00-00 00:00:00" and inserting null into this column.
|
||||
*
|
||||
* CodeIgniter Active Record doesn't like "nulls" when inserting an array of values, so we have to switch to
|
||||
* the $this->db->set syntax
|
||||
*/
|
||||
$this->db->set('username',$data['username']);
|
||||
$this->db->set('password',$data['password']);
|
||||
$this->db->set('email',$data['email']);
|
||||
$this->db->set('active',$data['active']);
|
||||
$this->db->set('created', null);
|
||||
|
||||
// optional fields
|
||||
if (isset($data['name'])) $this->db->set('name',$data['name']);
|
||||
if (isset($data['surname']))$this->db->set('surname',$data['surname']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->insert($this->table);
|
||||
|
||||
// get newly created record
|
||||
$record = $this->get($this->db->insert_id());
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,array($record[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function update_record($data)
|
||||
{
|
||||
// get/set the id and remove it from the data array
|
||||
$id = $data['id'];
|
||||
$this->db->where('id', $id);
|
||||
unset($data['id']);
|
||||
|
||||
// remove password confirmation field
|
||||
if (isset($data['password2'])) unset($data['password2']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->update($this->table, $data);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function delete_record($data)
|
||||
{
|
||||
// get/set the id
|
||||
$this->db->where('id', $data['id']);
|
||||
|
||||
// execute query
|
||||
$query = $this->db->delete($this->table);
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a role to a user
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function add_role($role_id,$user_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->user_role_table, array(
|
||||
'role_id' => $role_id,
|
||||
'user_id' => $user_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_user_role($role_id,$user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a role from a user
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function remove_role($role_id,$user_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->delete($this->user_role_table, array(
|
||||
'role_id' => $role_id,
|
||||
'user_id' => $user_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_user_role($role_id,$user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a permission to a user
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function add_permission($permission_id,$user_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->user_permission_table, array(
|
||||
'permission_id' => $permission_id,
|
||||
'user_id' => $user_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_user_permission($permission_id,$user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a permission from a user
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function remove_permission($permission_id,$user_id)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->delete($this->user_permission_table, array(
|
||||
'permission_id' => $permission_id,
|
||||
'user_id' => $user_id
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query,$this->get_user_permission($permission_id,$user_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a permission to a user
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function record_login_attempt($username, $ip_address, $success, $user_agent, $note)
|
||||
{
|
||||
// execute query
|
||||
$query = $this->db->insert($this->user_login_attempt, array(
|
||||
'username' => $username,
|
||||
'ip_address' => $ip_address,
|
||||
'success' => $success,
|
||||
'user_agent' => $user_agent,
|
||||
'note' => $note
|
||||
));
|
||||
|
||||
// return formatted result
|
||||
return $this->appunto_auth->formatOperationResult($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a permission to a user
|
||||
*
|
||||
* @param array
|
||||
* @return object
|
||||
*/
|
||||
function update_last_login($username,$ip_address)
|
||||
{
|
||||
$this->load->helper('date');
|
||||
|
||||
$this->db->set('last_ip',$ip_address);
|
||||
$this->db->set('last_login',date('Y-m-d H:i:s',now()));
|
||||
|
||||
$this->db->where('username',$username);
|
||||
|
||||
$query = $this->db->update($this->table);
|
||||
}
|
||||
/**
|
||||
* Get login attempts
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function login_attempts($offset,$rows,$sort,$dir,$filters)
|
||||
{
|
||||
|
||||
$this->db->select('username, ip_address, success, user_agent, note, attempt_time');
|
||||
|
||||
if (count($filters)>0)
|
||||
{
|
||||
foreach($filters as $filter)
|
||||
{
|
||||
$property = $filter->property;
|
||||
if ($property == 'active') $active = $filter->value;
|
||||
}
|
||||
}
|
||||
|
||||
/* cache where clause to get around CI's active record _reset_select()
|
||||
* see http://codeigniter.com/forums/viewthread/212111/#999732
|
||||
*/
|
||||
$this->db->start_cache();
|
||||
|
||||
$total = $this->db->count_all_results($this->user_login_attempt);
|
||||
|
||||
if (!empty($sort) && !empty($dir))
|
||||
{
|
||||
$this->db->order_by('UPPER('.$sort.')',$dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->order_by('attempt_time','DESC');
|
||||
}
|
||||
|
||||
// execute query
|
||||
$query = $this->db->get($this->user_login_attempt,$rows,$offset);
|
||||
|
||||
$this->db->flush_cache();
|
||||
|
||||
// format and return result to controller
|
||||
return $this->appunto_auth->formatQueryResult($query,$total);
|
||||
}
|
||||
};
|
||||
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php if (isset($site_name)) echo $site_name ?><?php if (isset($auth_message)) echo ' - '.$auth_message ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>resources/appunto-auth/css/login.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="login-form-box">
|
||||
<?php if (isset($auth_message)) { ?>
|
||||
<div class="login-form-auth-message"><?php echo $auth_message ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,10 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php if (isset($site_name)) echo $site_name ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>resources/appunto-auth/css/login.css" />
|
||||
</head>
|
||||
<body>
|
||||
<?php echo appunto_login_box($auth_message) ?>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,173 +0,0 @@
|
||||
--
|
||||
-- Tables for Appunto Auth
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_path`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_path` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`dir` varchar(256) NOT NULL,
|
||||
`filename` varchar(120) NOT NULL,
|
||||
`full_path` varchar(256) NOT NULL,
|
||||
`ci_controller` varchar(256) NOT NULL,
|
||||
`ci_method` varchar(256) NOT NULL,
|
||||
`found` tinyint(1) NOT NULL,
|
||||
`public_flag` tinyint(1) NOT NULL,
|
||||
`permission_id` int(11) DEFAULT NULL,
|
||||
`note` varchar(60) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `permission_id` (`permission_id`),
|
||||
KEY `dir` (`dir`(255)),
|
||||
KEY `ci_controller` (`ci_controller`(255)),
|
||||
KEY `ci_method` (`ci_method`(255))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_permission`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_permission` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(32) COLLATE utf8_bin NOT NULL,
|
||||
`internal_name` varchar(60) COLLATE utf8_bin NOT NULL,
|
||||
`description` varchar(64) COLLATE utf8_bin DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `internal_name` (`internal_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_role`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_role` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(32) NOT NULL,
|
||||
`description` varchar(64) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_role_permission`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_role_permission` (
|
||||
`role_id` int(11) NOT NULL,
|
||||
`permission_id` int(11) NOT NULL,
|
||||
KEY `role_id` (`role_id`),
|
||||
KEY `permission_id` (`permission_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_user`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_user` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`password` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`email` varchar(120) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`name` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`surname` varchar(60) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`last_ip` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`last_login` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `username` (`username`),
|
||||
KEY `email` (`email`),
|
||||
KEY `name` (`name`),
|
||||
KEY `surname` (`surname`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_user_login_attempt`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_user_login_attempt` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`attempt_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`username` varchar(120) DEFAULT NULL,
|
||||
`ip_address` varchar(120) NOT NULL,
|
||||
`success` tinyint(1) NOT NULL,
|
||||
`user_agent` varchar(180) DEFAULT NULL,
|
||||
`note` varchar(80) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `attempt_time` (`attempt_time`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_user_permission`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_user_permission` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`permission_id` int(11) NOT NULL,
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `permission_id` (`permission_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `appa_user_role`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `appa_user_role` (
|
||||
`user_id` int(11) NOT NULL,
|
||||
`role_id` int(11) NOT NULL,
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `role_id` (`role_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
|
||||
--
|
||||
-- Constraints for table `appa_path`
|
||||
--
|
||||
ALTER TABLE `appa_path`
|
||||
ADD CONSTRAINT `appa_path_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `appa_permission` (`id`) ON UPDATE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `appa_role_permission`
|
||||
--
|
||||
ALTER TABLE `appa_role_permission`
|
||||
ADD CONSTRAINT `appa_role_permission_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `appa_role` (`id`),
|
||||
ADD CONSTRAINT `appa_role_permission_ibfk_2` FOREIGN KEY (`permission_id`) REFERENCES `appa_permission` (`id`);
|
||||
|
||||
--
|
||||
-- Constraints for table `appa_user_permission`
|
||||
--
|
||||
ALTER TABLE `appa_user_permission`
|
||||
ADD CONSTRAINT `appa_user_permission_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `appa_permission` (`id`),
|
||||
ADD CONSTRAINT `appa_user_permission_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `appa_user` (`id`) ON DELETE CASCADE;
|
||||
|
||||
--
|
||||
-- Constraints for table `appa_user_role`
|
||||
--
|
||||
ALTER TABLE `appa_user_role`
|
||||
ADD CONSTRAINT `appa_user_role_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `appa_role` (`id`),
|
||||
ADD CONSTRAINT `appa_user_role_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `appa_user` (`id`) ON DELETE CASCADE;
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
# AppuntoAuth/resources
|
||||
|
||||
This folder contains resources (such as images) needed by the application. This file can
|
||||
be removed if not needed.
|
||||
@ -1,144 +0,0 @@
|
||||
.app-header {
|
||||
background:#4F0101 url(logo/appunto_auth_logo_app_header.gif) 22px 6px no-repeat !important;
|
||||
}
|
||||
.controller-frame {
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
.admin-logout-button {
|
||||
color : #fff;
|
||||
font-size: 15px;
|
||||
margin : 12px 24px;
|
||||
}
|
||||
/* Status View Classes */
|
||||
.status-info {
|
||||
margin: 30px 0 0 30px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.status-info td {
|
||||
padding: 4px 12px;
|
||||
}
|
||||
.info-note {
|
||||
background:url(icons/error.png) 3px 2px no-repeat !important;
|
||||
padding-left: 24px !important;
|
||||
}
|
||||
/* User View Classes */
|
||||
.user-inactive div.x-grid-cell-inner {
|
||||
background:url(icons/delete.png) 22px 3px no-repeat !important;
|
||||
color: #777;
|
||||
}
|
||||
.user-active div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 22px 3px no-repeat !important;
|
||||
color: #777;
|
||||
}
|
||||
.user-has-role div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 3px 3px no-repeat !important;
|
||||
}
|
||||
.has-permission div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 3px 3px no-repeat !important;
|
||||
}
|
||||
.user-has-permission div.x-grid-cell-inner {
|
||||
background:url(icons/user.png) 22px 3px no-repeat !important;
|
||||
}
|
||||
.user-role-has-permission div.x-grid-cell-inner {
|
||||
background:url(icons/shield.png) 22px 3px no-repeat !important;
|
||||
}
|
||||
.appunto-list .empty {
|
||||
font-family: tahoma, arial, verdana, sans-serif;
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
/* Controller View Classes */
|
||||
.controller-view .ci-controller {
|
||||
border: 1px solid #ccc;
|
||||
width: 94%;
|
||||
float: left;
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
margin: 8px 12px;
|
||||
padding: 1px;
|
||||
background: #e2e2e2; /* Old browsers */
|
||||
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
|
||||
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2UyZTJlMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
|
||||
background: -moz-linear-gradient(top, #e2e2e2 0%, #ffffff 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e2e2e2), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #e2e2e2 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #e2e2e2 0%,#ffffff 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, #e2e2e2 0%,#ffffff 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, #e2e2e2 0%,#ffffff 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e2e2e2', endColorstr='#ffffff',GradientType=0 ); /* IE6-8 */
|
||||
}
|
||||
.controller-selected{
|
||||
}
|
||||
.controller-view .ci-controller div.selection{
|
||||
background: url(images/ci_unselected.gif) no-repeat;
|
||||
margin-right:6px;
|
||||
width: 54px;
|
||||
height: 72px;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
.controller-view .controller-selected div.selection {
|
||||
background: url(images/ci_selected.gif);
|
||||
width: 54px;
|
||||
height: 72px;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
.controller-view .ci-controller .controller-info {
|
||||
display: inline;
|
||||
overflow: hidden;
|
||||
vertical-align: top;
|
||||
}
|
||||
.controller-view .ci-controller .method-info {
|
||||
padding: 6px 0 10px 10px;
|
||||
display: inline;
|
||||
}
|
||||
.controller-view .ci-controller .method-info {
|
||||
float: right;
|
||||
width: 108px;
|
||||
border-left: 1px dotted #ccc;
|
||||
}
|
||||
.controller-view .ci-controller .method-info table td {
|
||||
padding-right: 4px;
|
||||
}
|
||||
.controller-rollover{
|
||||
border: 1px solid #aaa !important;
|
||||
padding: 1px !important;
|
||||
}
|
||||
.controller-view .ci-controller .controller-name,
|
||||
.controller-view .ci-controller .controller-dir {
|
||||
display: block;
|
||||
}
|
||||
.controller-view .ci-controller .controller-name {
|
||||
font-weight: bold;
|
||||
margin-top: 6px;
|
||||
}
|
||||
/* Path View Classes */
|
||||
.path-not-found div.x-grid-cell-inner {
|
||||
background:url(icons/error.png) 3px 2px no-repeat !important;
|
||||
}
|
||||
.path-public div.x-grid-cell-inner {
|
||||
background: url(icons/world_link.png) 2px 1px no-repeat !important;
|
||||
padding-left: 24px;
|
||||
}
|
||||
.path-private div.x-grid-cell-inner {
|
||||
background: url(icons/page_delete.png) 2px 1px no-repeat !important;
|
||||
padding-left: 24px;
|
||||
}
|
||||
.menu-title {
|
||||
display: block;
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
background-color: #4F0101;
|
||||
}
|
||||
/* Role View Classes */
|
||||
.permission-in-role div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 3px 2px no-repeat !important;
|
||||
}
|
||||
/* toolbar drop-down button */
|
||||
.view-selection-button span {
|
||||
font-size: 11px !important;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
@ -1,125 +0,0 @@
|
||||
.appunto-auth-viewport {
|
||||
background-color: #4F4F4F;
|
||||
}
|
||||
.app-header {
|
||||
background:#4F0101 url(images/appunto_auth_logo_app_header.gif) 22px 6px no-repeat !important;
|
||||
}
|
||||
.controller-frame {
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
/* User View Classes */
|
||||
.user-inactive div.x-grid-cell-inner {
|
||||
background:url(icons/delete.png) 22px 3px no-repeat !important;
|
||||
color: #777;
|
||||
}
|
||||
.user-active div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 22px 3px no-repeat !important;
|
||||
color: #777;
|
||||
}
|
||||
.user-has-role div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 3px 3px no-repeat !important;
|
||||
}
|
||||
.has-permission div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 3px 3px no-repeat !important;
|
||||
}
|
||||
.user-has-permission div.x-grid-cell-inner {
|
||||
background:url(icons/user.png) 22px 3px no-repeat !important;
|
||||
}
|
||||
.user-role-has-permission div.x-grid-cell-inner {
|
||||
background:url(icons/shield.png) 22px 3px no-repeat !important;
|
||||
}
|
||||
.appunto-list .empty {
|
||||
font-family: tahoma, arial, verdana, sans-serif;
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
/* Controller View Classes */
|
||||
.controller-view .ci-controller {
|
||||
border: 1px solid #ccc;
|
||||
width: 94%;
|
||||
float: left;
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
margin: 8px 12px;
|
||||
padding: 1px;
|
||||
background: #e2e2e2; /* Old browsers */
|
||||
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
|
||||
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2UyZTJlMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
|
||||
background: -moz-linear-gradient(top, #e2e2e2 0%, #ffffff 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e2e2e2), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #e2e2e2 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #e2e2e2 0%,#ffffff 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, #e2e2e2 0%,#ffffff 100%); /* IE10+ */
|
||||
background: linear-gradient(to bottom, #e2e2e2 0%,#ffffff 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e2e2e2', endColorstr='#ffffff',GradientType=0 ); /* IE6-8 */
|
||||
}
|
||||
.controller-selected{
|
||||
}
|
||||
.controller-view .ci-controller div.selection{
|
||||
background: url(images/ci_unselected.gif) no-repeat;
|
||||
margin-right:6px;
|
||||
width: 54px;
|
||||
height: 72px;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
.controller-view .controller-selected div.selection {
|
||||
background: url(images/ci_selected.gif);
|
||||
width: 54px;
|
||||
height: 72px;
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
.controller-view .ci-controller .controller-info {
|
||||
display: inline;
|
||||
overflow: hidden;
|
||||
vertical-align: top;
|
||||
}
|
||||
.controller-view .ci-controller .method-info {
|
||||
padding: 6px 0 10px 10px;
|
||||
display: inline;
|
||||
}
|
||||
.controller-view .ci-controller .method-info {
|
||||
float: right;
|
||||
width: 108px;
|
||||
border-left: 1px dotted #ccc;
|
||||
}
|
||||
.controller-view .ci-controller .method-info table td {
|
||||
padding-right: 4px;
|
||||
}
|
||||
.controller-rollover{
|
||||
border: 1px solid #aaa !important;
|
||||
padding: 1px !important;
|
||||
}
|
||||
.controller-view .ci-controller .controller-name,
|
||||
.controller-view .ci-controller .controller-dir {
|
||||
display: block;
|
||||
}
|
||||
.controller-view .ci-controller .controller-name {
|
||||
font-weight: bold;
|
||||
margin-top: 6px;
|
||||
}
|
||||
/* Path View Classes */
|
||||
.path-not-found div.x-grid-cell-inner {
|
||||
background:url(icons/error.png) 3px 2px no-repeat !important;
|
||||
}
|
||||
.path-public div.x-grid-cell-inner {
|
||||
background: url(icons/world_link.png) 2px 1px no-repeat !important;
|
||||
padding-left: 24px;
|
||||
}
|
||||
.path-private div.x-grid-cell-inner {
|
||||
background: url(icons/page_delete.png) 2px 1px no-repeat !important;
|
||||
padding-left: 24px;
|
||||
}
|
||||
.menu-title {
|
||||
display: block;
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
color: #fff;
|
||||
background-color: #4F0101;
|
||||
}
|
||||
/* Role View Classes */
|
||||
.permission-in-role div.x-grid-cell-inner {
|
||||
background:url(icons/accept.png) 3px 2px no-repeat !important;
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
/* Tab icons */
|
||||
.transmit {
|
||||
background-image:url(icons/transmit.png) !important;
|
||||
}
|
||||
.user {
|
||||
background-image:url(icons/user.png) !important;
|
||||
}
|
||||
.shield {
|
||||
background-image:url(icons/shield.png) !important;
|
||||
}
|
||||
.lock {
|
||||
background-image:url(icons/lock.png) !important;
|
||||
}
|
||||
.map {
|
||||
background-image:url(icons/map.png) !important;
|
||||
}
|
||||
.monitor {
|
||||
background-image:url(icons/monitor.png) !important;
|
||||
}
|
||||
/* Users */
|
||||
.user-add {
|
||||
background-image:url(icons/user_add.png) !important;
|
||||
}
|
||||
.user-edit {
|
||||
background-image:url(icons/user_edit.png) !important;
|
||||
}
|
||||
.user-delete {
|
||||
background-image:url(icons/user_delete.png) !important;
|
||||
}
|
||||
.key {
|
||||
background-image:url(icons/key.png) !important;
|
||||
}
|
||||
/* Roles */
|
||||
.shield-add {
|
||||
background-image:url(icons/shield_add.png) !important;
|
||||
}
|
||||
.shield-go {
|
||||
background-image:url(icons/shield_go.png) !important;
|
||||
}
|
||||
.shield-delete {
|
||||
background-image:url(icons/shield_delete.png) !important;
|
||||
}
|
||||
/* Permissions */
|
||||
.lock-add {
|
||||
background-image:url(icons/lock_add.png) !important;
|
||||
}
|
||||
.lock-edit {
|
||||
background-image:url(icons/lock_edit.png) !important;
|
||||
}
|
||||
.lock-delete {
|
||||
background-image:url(icons/lock_delete.png) !important;
|
||||
}
|
||||
/* Sessions */
|
||||
.monitor-delete {
|
||||
background-image:url(icons/monitor_delete.png) !important;
|
||||
}
|
||||
/* Misc */
|
||||
.exclamation {
|
||||
background-image:url(icons/exclamation.png) !important;
|
||||
}
|
||||
.delete {
|
||||
background-image:url(icons/delete.png) !important;
|
||||
}
|
||||
.accept {
|
||||
background-image:url(icons/accept.png) !important;
|
||||
}
|
||||
.world-link {
|
||||
background-image:url(icons/world_link.png) !important;
|
||||
}
|
||||
.page-delete {
|
||||
background-image:url(icons/page_delete.png) !important;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 781 B |
|
Before Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 666 B |
|
Before Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 824 B |
|
Before Width: | Height: | Size: 815 B |
|
Before Width: | Height: | Size: 861 B |
|
Before Width: | Height: | Size: 804 B |
|
Before Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 691 B |
|
Before Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 758 B |
|
Before Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 775 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 746 B |
|
Before Width: | Height: | Size: 767 B |
|
Before Width: | Height: | Size: 833 B |
|
Before Width: | Height: | Size: 957 B |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 910 B |
@ -1,127 +0,0 @@
|
||||
var Language =
|
||||
{
|
||||
override:
|
||||
{
|
||||
// Global
|
||||
name : 'Name', //used in headers for various entities
|
||||
description : 'Description', //used in headers for various entities
|
||||
refresh : 'Refresh', // reload the data
|
||||
result : 'Result',
|
||||
save : 'Save',
|
||||
cancel : 'Cancel',
|
||||
yes : 'Yes',
|
||||
no : 'No',
|
||||
field_required : 'This field is required',
|
||||
|
||||
// Application tabs
|
||||
tab_status : 'Status',
|
||||
tab_users : 'Users',
|
||||
tab_user_roles : 'User Roles',
|
||||
tab_permissions : 'Permissions yo',
|
||||
tab_paths : 'Paths',
|
||||
tab_sessions : 'Sessions',
|
||||
|
||||
// User list
|
||||
username : 'Username',
|
||||
name : 'Name',
|
||||
surname : 'Last name',
|
||||
email : 'Email',
|
||||
password : 'Password',
|
||||
password_confirm : 'Confirm password',
|
||||
password_change : 'Change password',
|
||||
password_match : 'Passwords do not match',
|
||||
user_set_active : 'Set user as active',
|
||||
active : 'Active', // Whether or not this user has been activated or deactivated
|
||||
user_add : 'Add user',
|
||||
user_edit : 'Edit user',
|
||||
user_delete : 'Delete user',
|
||||
user_delete_confirm : 'Are you sure you want to delete this user?',
|
||||
user_activate : 'Activate user',
|
||||
user_deactivate : 'Deactivate user',
|
||||
last_ip : 'Last IP',
|
||||
last_login : 'Last Login',
|
||||
created : 'Created',
|
||||
modified : 'Modified',
|
||||
never : 'Never',
|
||||
user_select : 'Select a user',
|
||||
user_select_or : 'Select a User or select <b>Show All</b> above.',
|
||||
user_no_roles : 'No roles are assigned to this user. Select <b>Show All</b> for a list of available roles',
|
||||
user_no_perm : 'No permissions are assigned to this user. Select <b>Show All</b> for a list of available permissions',
|
||||
user_role_list : 'User roles',
|
||||
user_role_list_for : 'User roles for', //will be followed by username
|
||||
user_role_add : 'Add user to role',
|
||||
user_role_remove : 'Remove user from role',
|
||||
user_perm_list : 'Application permissions',
|
||||
user_perm_list_for : 'Application permissions for', //wilbe followed by username
|
||||
user_perm_add : 'Grant user permission',
|
||||
user_perm_remove : 'Revoke user permission',
|
||||
user_role_view_all : 'Show all roles',
|
||||
user_role_view_selected : 'Show only roles for the selected user',
|
||||
user_perm_view_all : 'Show all permissions',
|
||||
user_perm_view_selected : 'Show only permissions for the selected user',
|
||||
granted_to : 'Granted to', // permission is granted to user or to the user's role
|
||||
grant_role : 'Role',
|
||||
grant_user : 'User',
|
||||
user_perm_granted_role : 'permission granted through role',
|
||||
user_perm_granted_user : 'permission granted to user',
|
||||
|
||||
|
||||
// Role list
|
||||
role_add : 'Add role',
|
||||
role_edit : 'Edit role',
|
||||
role_delete : 'Delete role',
|
||||
role_delete_confirm : 'Are you sure you want to delete this role?',
|
||||
role_perm_view_all : 'Show all permissions',
|
||||
role_perm_view_selected : 'Show only permissions for the selected role',
|
||||
role_perm_for : 'Permissions for',
|
||||
role_select : 'Select a Role or select <b>Show All</b> above.',
|
||||
role_perm_add : 'Add permission to role',
|
||||
role_perm_remove : 'Remove permission from role',
|
||||
|
||||
// Permission list
|
||||
perm_internal_name : 'Internal Name',
|
||||
perm_add : 'Add permission',
|
||||
perm_edit : 'Edit permission',
|
||||
perm_delete : 'Delete permission',
|
||||
perm_delete_confirm : 'Are you sure you want to delete this permission?',
|
||||
|
||||
|
||||
// Path list
|
||||
path_tab_controllers : 'Controllers',
|
||||
path_tab_paths : 'Paths',
|
||||
controller_methods : 'methods',
|
||||
controller_public : 'public',
|
||||
controller_private : 'private',
|
||||
path_verify : 'Verifing application paths',
|
||||
path_refreshing : 'Refreshing paths',
|
||||
path_public : 'Public',
|
||||
path_private : 'Private',
|
||||
path_method : 'Method', // A Codeigniter function inside a controller
|
||||
path_path : 'Path',
|
||||
path_access : 'Access', // Header for public/private column
|
||||
path_permission : 'Permission',
|
||||
path_permissions : 'Permissions',
|
||||
path_set_public : 'Make path public',
|
||||
path_set_private : 'Make path private',
|
||||
path_set_permission : 'Set Permission',
|
||||
path_remove_permission : 'Remove Permission',
|
||||
path_delete : 'Delete Path',
|
||||
path_not_found_1 : 'This method was not found in the Controller but a record of it exists in the database.',
|
||||
path_not_found_2 : 'You may delete the record of this path.',
|
||||
|
||||
// Session List
|
||||
session_username : 'Username',
|
||||
session_last_activity : 'Last Activity',
|
||||
session_ip_address : 'IP Address',
|
||||
session_user_agent : 'User Agent', // User-Agent string returned by user's browser
|
||||
session_view_all : 'Show all sessions',
|
||||
session_view_logged_in : 'Show only logged in sessions',
|
||||
session_delete : 'Delete Session',
|
||||
session_delete_confirm : 'Are you sure you want to delete this session?',
|
||||
session_delete_user : 'user', // used in delete confirmation window title eg: "user: Bob Jones"
|
||||
|
||||
|
||||
// dummy val so I don't forget to remove trailing comma
|
||||
dummy : ''
|
||||
}
|
||||
};
|
||||
@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Translation by Loanda Drew and Ricardo Silva
|
||||
*/
|
||||
var Language =
|
||||
{
|
||||
override:
|
||||
{
|
||||
// Global
|
||||
name : 'Nome', //used in headers for various entities
|
||||
description : 'Descrição', //used in headers for various entities
|
||||
refresh : 'Atualizar', // reload the data
|
||||
result : 'Resultado',
|
||||
save : 'Salvar',
|
||||
cancel : 'Cancelar',
|
||||
yes : 'Sim',
|
||||
no : 'Não',
|
||||
field_required : 'Este campo é obrigatório',
|
||||
|
||||
// Application tabs
|
||||
tab_status : 'Status',
|
||||
tab_users : 'Usuários',
|
||||
tab_user_roles : 'Funções do usuário',
|
||||
tab_permissions : 'Permissões',
|
||||
tab_paths : 'Caminhos',
|
||||
tab_sessions : 'Sessões',
|
||||
|
||||
// usuário list
|
||||
username : 'Usuário',
|
||||
name : 'Nome',
|
||||
surname : 'Sobrenome',
|
||||
email : 'Email',
|
||||
password : 'Senha',
|
||||
password_confirm : 'Confirmar senha',
|
||||
password_change : 'Alterar senha',
|
||||
password_match : 'Senhas não combinam',
|
||||
user_set_active : 'Configurar usuário como ativo',
|
||||
active : 'Ativo', // Whether or not this User has been activated or deactivated
|
||||
user_add : 'Adicionar usuário',
|
||||
user_edit : 'Editar usuário',
|
||||
user_delete : 'Apagar usuário',
|
||||
user_delete_confirm : 'Tem certeza que deseja apagar este usuário?',
|
||||
user_activate : 'Ativar usuário',
|
||||
user_deactivate : 'Desativar usuário',
|
||||
last_ip : 'Último IP',
|
||||
last_login : 'Último Login',
|
||||
created : 'Criado',
|
||||
modified : 'Modificado',
|
||||
never : 'Nunca',
|
||||
user_select : 'Selecione um usuário',
|
||||
user_select_or : 'Selecione um usuário ou <b>Mostre Todos</b> acima.',
|
||||
user_no_roles : 'Nenhuma função está associada a este usuário. Selecione <b>Mostrar Todos</b> para ver as funções disponíveis.',
|
||||
user_no_perm : 'Nenhuma permissão está associada a este usuário. Selecione <b>Mostrar Todos</b> para ver as permissões disponíveis.',
|
||||
user_role_list : 'funções de usuário',
|
||||
user_role_list_for : 'funções de usuário para', //will be followed by username
|
||||
user_role_add : 'Adicionar usuário a função',
|
||||
user_role_remove : 'Remover usuário da função',
|
||||
user_perm_list : 'Permissões do aplicativo',
|
||||
user_perm_list_for : 'Permissões do aplicativo para', //will be followed by username
|
||||
user_perm_add : 'Conceder permissão ao usuário',
|
||||
user_perm_remove : 'Remover permissão do usuário',
|
||||
user_role_view_all : 'Mostrar todas as funções',
|
||||
user_role_view_selected : 'Mostrar apenas as funções do usuário selecionado',
|
||||
user_perm_view_all : 'Mostrar todas as permissões',
|
||||
user_perm_view_selected : 'Mostrar apenas as permissões do usuário selecionado',
|
||||
granted_to : 'Concedido a', // permission is granted to user or to the user's role
|
||||
grant_role : 'Função',
|
||||
grant_user : 'Usuário',
|
||||
user_perm_granted_role : 'permissão concedida via função',
|
||||
user_perm_granted_user : 'permissão concedida ao usuário',
|
||||
|
||||
|
||||
// Role list
|
||||
role_add : 'Adicionar função',
|
||||
role_edit : 'Editar função',
|
||||
role_delete : 'Apagar função',
|
||||
role_delete_confirm : 'Tem certeza que deseja apagar esta função?',
|
||||
role_perm_view_all : 'Mostrar todas as permissões',
|
||||
role_perm_view_selected : 'Mostrar apenas as permisões da função selecionada',
|
||||
role_perm_for : 'Permissões para',
|
||||
role_select : 'Selecionar uma Função ou <b>Mostrar Todas</b> acima.',
|
||||
role_perm_add : 'Adicionar permissão à função',
|
||||
role_perm_remove : 'Remover perissão da função',
|
||||
|
||||
// Permission list
|
||||
perm_internal_name : 'Nome Interno',
|
||||
perm_add : 'Adicionar permissão',
|
||||
perm_edit : 'Editar permissão',
|
||||
perm_delete : 'Apagar permissão',
|
||||
perm_delete_confirm : 'Tem certeza que deseja apagar esta permissão?',
|
||||
|
||||
// Path list
|
||||
path_tab_controllers : 'Controladores',
|
||||
path_tab_paths : 'Caminhos',
|
||||
controller_methods : 'métodos',
|
||||
controller_public : 'público',
|
||||
controller_private : 'privado',
|
||||
path_verify : 'Verificando caminhos do aplicativo',
|
||||
path_refreshing : 'Atualizando caminhos',
|
||||
path_public : 'Público',
|
||||
path_private : 'Privado',
|
||||
path_method : 'Método', // A Codeigniter function inside a controller
|
||||
path_path : 'Caminho',
|
||||
path_access : 'Acesso', // Header for public/private column
|
||||
path_permission : 'Permissão',
|
||||
path_permissions : 'Permissões',
|
||||
path_set_public : 'Tornar caminho público',
|
||||
path_set_private : 'Tornar caminho privado',
|
||||
path_set_permission : 'Configurar permissão',
|
||||
path_remove_permission : 'Remover Permissão',
|
||||
path_delete : 'Apagar caminho',
|
||||
path_not_found_1 : 'Este método não foi encontrado no controlador, mas existe um registro dele no banco de dados.',
|
||||
path_not_found_2 : 'Você pode apagar o registro deste caminho.',
|
||||
|
||||
// Session List
|
||||
session_username : 'usuário',
|
||||
session_last_activity : 'Última Atividade',
|
||||
session_ip_address : 'Endereço de IP',
|
||||
session_user_agent : 'User Agent', // User Agent string returned by usuário's browser
|
||||
session_view_all : 'Mostrar todas as sessões',
|
||||
session_view_logged_in : 'Mostrar apenas as sessões ativas',
|
||||
session_delete : 'Apagar sessão',
|
||||
session_delete_confirm : 'Tem certeza que deseja apagar esta sessão?',
|
||||
session_delete_user : 'usuário', // used in delete confirmation window title eg: "user: Bob Jones"
|
||||
|
||||
|
||||
// dummy val so I don't forget to remove trailing comma
|
||||
dummy : ''
|
||||
}
|
||||
};
|
||||
@ -1,72 +0,0 @@
|
||||
/* Tab icons */
|
||||
.transmit {
|
||||
background-image:url(icons/transmit.png) !important;
|
||||
}
|
||||
.user {
|
||||
background-image:url(icons/user.png) !important;
|
||||
}
|
||||
.shield {
|
||||
background-image:url(icons/shield.png) !important;
|
||||
}
|
||||
.lock {
|
||||
background-image:url(icons/lock.png) !important;
|
||||
}
|
||||
.map {
|
||||
background-image:url(icons/map.png) !important;
|
||||
}
|
||||
.monitor {
|
||||
background-image:url(icons/monitor.png) !important;
|
||||
}
|
||||
/* Users */
|
||||
.user-add {
|
||||
background-image:url(icons/user_add.png) !important;
|
||||
}
|
||||
.user-edit {
|
||||
background-image:url(icons/user_edit.png) !important;
|
||||
}
|
||||
.user-delete {
|
||||
background-image:url(icons/user_delete.png) !important;
|
||||
}
|
||||
.key {
|
||||
background-image:url(icons/key.png) !important;
|
||||
}
|
||||
/* Roles */
|
||||
.shield-add {
|
||||
background-image:url(icons/shield_add.png) !important;
|
||||
}
|
||||
.shield-go {
|
||||
background-image:url(icons/shield_go.png) !important;
|
||||
}
|
||||
.shield-delete {
|
||||
background-image:url(icons/shield_delete.png) !important;
|
||||
}
|
||||
/* Permissions */
|
||||
.lock-add {
|
||||
background-image:url(icons/lock_add.png) !important;
|
||||
}
|
||||
.lock-edit {
|
||||
background-image:url(icons/lock_edit.png) !important;
|
||||
}
|
||||
.lock-delete {
|
||||
background-image:url(icons/lock_delete.png) !important;
|
||||
}
|
||||
/* Sessions */
|
||||
.monitor-delete {
|
||||
background-image:url(icons/monitor_delete.png) !important;
|
||||
}
|
||||
/* Misc */
|
||||
.exclamation {
|
||||
background-image:url(icons/exclamation.png) !important;
|
||||
}
|
||||
.delete {
|
||||
background-image:url(icons/delete.png) !important;
|
||||
}
|
||||
.accept {
|
||||
background-image:url(icons/accept.png) !important;
|
||||
}
|
||||
.world-link {
|
||||
background-image:url(icons/world_link.png) !important;
|
||||
}
|
||||
.page-delete {
|
||||
background-image:url(icons/page_delete.png) !important;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 781 B |
|
Before Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 666 B |
|
Before Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 824 B |
|
Before Width: | Height: | Size: 815 B |
|
Before Width: | Height: | Size: 861 B |
|
Before Width: | Height: | Size: 804 B |
|
Before Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 691 B |
|
Before Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 702 B |
|
Before Width: | Height: | Size: 758 B |
|
Before Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 775 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 746 B |
|
Before Width: | Height: | Size: 767 B |
|
Before Width: | Height: | Size: 833 B |
|
Before Width: | Height: | Size: 957 B |