updated code

This commit is contained in:
saravanakumar_kandasami 2017-11-21 14:56:39 +05:30
parent 9b228965b6
commit 7d72a0b91a
4847 changed files with 581795 additions and 0 deletions

12
Apollo/api/.htaccess Normal file
View File

@ -0,0 +1,12 @@
ErrorDocument 404 index.php
# SetEnv CI_ENV production
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
</IfModule>

206
Apollo/api/README.MD Normal file
View File

@ -0,0 +1,206 @@
Esta e uma tradução do Readme do projeto [CodeIgniter Rest Server](https://github.com/chriskacerguis/codeigniter-restserver/)
de [Chris Kacerguis](https://github.com/chriskacerguis)
A tradução foi feita por [Daniel Coder](https://github.com/netofire) nesse fork [aqui](https://github.com/netofire/codeigniter-restserver/blob/master/README_pt_BR.MD)
# CodeIgniter Rest Server
Implementação completa de um servidor RESTful para CodeIgniter usando uma biblioteca, um arquivo config e um controller.
## Requisitos
1. PHP 5.4+
2. CodeIgniter 3.0+
_Nota: para suporte à versão 1.7.x baixe a v2.2 da aba de Downloads_
## Atualização importante na vs. 4.0.0
Note que a versão 4.0.0 está em andamento, e é considerada uma versão "breaking change". Como o CI 3.1.0 agora tem suporte nativo ao Composer, esta biblioteca está sendo criada baseada no composer.
Dê uma olhada no branch "development" e veja o que está acontecendo.
## Instalação
Arraste os arquivos **application/libraries/Format.php** e **application/libraries/REST_Controller.php** para dentro do diretório da sua aplicação. Para usar `require_once` no topo dos seus controllers pra carregá-los dentro do escopo. Adicionalmente, copie o arquivo **rest.php** de **application/config** para o diretório de configuração de sua aplicação.
## Tratando Requisições
Quando seu controller extende de `REST_Controller`, os nomes dos métodos vão ser sufixados com o método HTTP usado para acessar a requisição. Se você está fazendo uma chamada HTTP `GET` para `/books`, por exemplo, será chamado o método `Books#index_get()`.
Isso permite a você implementar uma interface RESTful facilmente:
```php
class Books extends REST_Controller
{
public function index_get()
{
// Display all books
}
public function index_post()
{
// Create a new book
}
}
```
`REST_Controller` também suporta os métodos `PUT` e `DELETE`, permitindo a você implementar uma real interface RESTful.
Acessar parâmetros também é fácil. Apenas use o nome do método HTTP como um método:
```php
$this->get('blah'); // parâmetro GET
$this->post('blah'); // parâmetro POST
$this->put('blah'); // parâmetro PUT
```
A especificação HTTP para requisições do tipo DELETE impede o uso de parâmetros. Para estas requisições, você pode adicionar itens à URL:
```php
public function index_delete($id)
{
$this->response([
'returned from delete:' => $id,
]);
}
```
Se parâmetros de consulta (query strings) são passados através da URL, independentemente de ser de uma requisição GET, podem ser obtidos através do método `query`:
```php
$this->query('blah'); // Query param
```
## Content Types
`REST_Controller` suporta vários tipos de formato request/response, incluindo XML, JSON and PHP serializado. Por padrão, a classe vai checar a URL e procurar por um formato seja como uma extensão ou um segmento separado.
Isso significa que suas URLs podem ser assim:
```
http://example.com/books.json
http://example.com/books?format=json
```
Isso pode ser ruim de trabalhar junto com segmentos URI, então, a recomendado usar um cabeçalho HTTP `Accept`:
```bash
$ curl -H "Accept: application/json" http://example.com
```
Qualquer resposta (response) que você faça na classe (veja [responses](#responses) para mais detalhes) serão serializadas no formato solicitado.
## Respostas (responses)
A classe provê um método `response()` que permite retornar os dados no formato solicitado pelo usuário.
Retornar um objeto / array / string / etc é simples:
```php
public function index_get()
{
$this->response($this->db->get('books')->result());
}
```
Isto automaticamente vai retornar uma resposta `HTTP 200 OK`. Você pode especificar o status HTTP no segundo parâmetro:
```php
public function index_post()
{
// ...cria um novo livro
$this->response($book, 201); // Envia HTTP 201 Created
}
```
Se você não especificar um código de resposta e o resultado retornado for avaliado como `== FALSE` (um array ou string vazia, por exemplo), o código de resposta será automaticamente setado para `404 Not Found`:
```php
$this->response([]); // HTTP 404 Not Found
```
## Suporte multi-idioma
Se sua aplicação utiliza arquivos de idioma para dar suporte a múltiplas localidades, a classe `REST_Controller` vai automaticamente analisar o cabeçalho HTTP `Accept-Language` e prover os idiomas(s) nas actions. Esta informação pode ser encontrada no objeto `$this->response->lang`:
```php
public function __construct()
{
parent::__construct();
if (is_array($this->response->lang))
{
$this->load->language('application', $this->response->lang[0]);
}
else
{
$this->load->language('application', $this->response->lang);
}
}
```
## Autenticação
Esta classe também implementa suporte para autenticação básica via HTTP e/ou a autenticação digest HTTP (mais segura).
Você pode habilitar a autenticação básica setando `$config['rest_auth']` para `'basic'`. A diretiva `$config['rest_valid_logiVns']` serve para você setar os usernames e passwords habilitados a acessar seu sistema. A classe vai automaticamente enviar todos os cabeçalhos corretos pra abrir o diálogo de autenticação:
```php
$config['rest_valid_logins'] = ['username' => 'password', 'outra_pessoa' => 'seguro123'];
```
Habilitar a autenticação do tipo 'digest' é igualmente simples. Configure os logins permitidos no arquivo de config, como acima e sete `$config['rest_auth']` para `'digest'`. A classe vai automaticamente enviar os cabeçalhos para habilitar a autenticação 'digest'.
Se você está amarrando esta biblioteca em um endpoint AJAX, onde os clientes autenticam com sessões PHP, você provavelmente não vai gostar nem da autenticação básica nem da 'digest'. Neste caso, você pode dizer para a biblioteca REST qual variável de sessão PHP deve ser checada. Se a variável existir, o usuário está autorizado. É responsabilidade da sua aplicação setar tal variável. Vocẽ pode definir a variável em ``$config['auth_source']``. Então, dizer à biblioteca para usar uma variável de sessão, setando ``$config['rest_auth']`` para ``session``.
Todos os três métodos de autenticação podem ficar mais seguros usando uma lista de IPs permitidos. Se você habilitar `$config['rest_ip_whitelist_enabled']` no seu arquivo de configuração, você pode setar uma lista de IPs permitidos.
Qualquer cliente conectando à sua API será verificado usando o array de IPs. Se eles estiverem na lista, terão o acesso permitido. Caso contrário, não. A lista de Ips é uma string separada por vírgulas:
```php
$config['rest_ip_whitelist'] = '123.456.789.0, 987.654.32.1';
```
Seus IPs locais (`127.0.0.1` e `0.0.0.0`) são permitidos por padrão.
## Chaves de API
Em adição aos métodos de autenticação acima, a classe `REST_Controller` também suporta o uso de chaves API. Habilitar é simples. Habilite no seu arquivo **config/rest.php**:
```php
$config['rest_enable_keys'] = TRUE;
```
Você vai precisar criar uma tabela de banco de dados para armazenar e acessar as chaves. `REST_Controller` vai automaticamente assumir que você possui uma tabela como esta:
```sql
CREATE TABLE `keys` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`key` VARCHAR(40) NOT NULL,
`level` INT(2) NOT NULL,
`ignore_limits` TINYINT(1) NOT NULL DEFAULT '0',
`date_created` INT(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```
A classe vai procurar por um cabeçalho HTTP com a chave da API a cada requisição. Uma chave inválida ou ausente irá resultar em um erro `HTTP 403 Forbidden`.
Por padrão, o HTTP será `X-API-KEY`. Isto pode ser configurado no arquivo **config/rest.php**.
```bash
$ curl -X POST -H "X-API-KEY: sua_chave_aqui" http://example.com/books
```
## Outra Documentação / Tutoriais
* [NetTuts: Working with RESTful Services in CodeIgniter](http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/)
## Contribuições
Este projeto foi originalmente escrito por Phil Sturgeon, no entanto o seu envolvimento foi excluído visto que ele não estava mais usando-o. A partir de 20/11/2013 o desenvolvimento e suporte são feitos por Chris Kacerguis.
Pull Requests são as melhores maneiras de consertar bugs e adicionar ferramentas. Eu sei que muitos de vocês usam, então por favor, contribua se você tem melhorias a serem feitas, e eu continuarei a realizar versões com o passar do tempo.
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/chriskacerguis/codeigniter-restserver/master/LICENSE)

View File

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

View File

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

11
Apollo/api/application/cache/index.html vendored Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,135 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database', 'JWT');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();

View File

@ -0,0 +1,513 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://angularjs/api';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = 'rodrigo';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| This is particularly useful for portability between UNIX-based OSes,
| (usually \n) and Windows (\r\n).
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';

View File

@ -0,0 +1,108 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| Exit Status Codes
|--------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
//define constant name for role
defined('SUPER_ADMIN') OR define('SUPER_ADMIN','R004');
defined('ADMIN') OR define('ADMIN','R003');
defined('EMPLOYEE') OR define('EMPLOYEE','R002');
defined('STUDENT') OR define('STUDENT','R001');
//encript database table name
defined('LOGIN') OR define('LOGIN','T_Login');
defined('BRANCH') OR define('BRANCH','T_BranchMaster');
defined('STAFF') OR define('STAFF','T_StaffDetails');
defined('STAFF_BRANCH') OR define('STAFF_BRANCH','T_Staff_BranchAccess');
defined('UNIVERSITY') OR define('UNIVERSITY','T_UniversityMaster');
defined('COURSE') OR define('COURSE','T_CourseMaster');
defined('COURSE_FEES') OR define('COURSE_FEES','T_Course_Fees_Details');
defined('LEAD_DETAILS') OR define('LEAD_DETAILS','T_Lead_Details');
defined('LEAD_TRACKING') OR define('LEAD_TRACKING','T_Lead_Tracking');
defined('LEAD_TRACKING_FOLLOWUP') OR define('LEAD_TRACKING_FOLLOWUP','T_Lead_Tracking_Followup');
defined('PICK_LIST_DETAILS') OR define('PICK_LIST_DETAILS','T_PickListDetails');
//end of database table name
//encripted password -> md5
defined('ENCR_PASSWORD') OR define('ENCR_PASSWORD','7594aacdb21d8a9b29f71ea9163a5730');
//end of encripted password

View File

@ -0,0 +1,96 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificats in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'venbainfotech.com',
'username' => 'kasirama_Apollo',
'password' => 'apollo1234',
'database' => 'kasirama_ApolloDEV',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

View File

@ -0,0 +1,24 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$_doctypes = array(
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
);

View File

@ -0,0 +1,103 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д/' => 'D',
'/д/' => 'd',
'/Ð|Ď|Đ|Δ/' => 'Dj',
'/ð|ď|đ|δ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);

View File

@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/hooks.html
|
*/

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
*/
$config = array(
'default' => array(
'hostname' => '127.0.0.1',
'port' => '11211',
'weight' => '1',
),
);

View File

@ -0,0 +1,84 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default for security reasons.
| You should enable migrations whenever you intend to do a schema migration
| and disable it back when you're done.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| Migrations table
|--------------------------------------------------------------------------
|
| This is the name of the table that will store the current migrations state.
| When migrations runs it will store in a database table which migration
| level the system is at. It then compares the migration level in this
| table to the $config['migration_version'] if they are not the same it
| will migrate up. This must be set.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';

View File

@ -0,0 +1,183 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('audio/x-aiff', 'audio/aiff'),
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => array('video/mp4', 'video/x-f4v'),
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);

View File

@ -0,0 +1,14 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/user_guide/general/profiling.html
|
*/

View File

@ -0,0 +1,596 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| HTTP protocol
|--------------------------------------------------------------------------
|
| Set to force the use of HTTPS for REST API calls
|
*/
$config['force_https'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Output Format
|--------------------------------------------------------------------------
|
| The default format of the response
|
| 'array': Array data structure
| 'csv': Comma separated file
| 'json': Uses json_encode(). Note: If a GET query string
| called 'callback' is passed, then jsonp will be returned
| 'html' HTML using the table library in CodeIgniter
| 'php': Uses var_export()
| 'serialized': Uses serialize()
| 'xml': Uses simplexml_load_string()
|
*/
$config['rest_default_format'] = 'json';
/*
|--------------------------------------------------------------------------
| REST Supported Output Formats
|--------------------------------------------------------------------------
|
| The following setting contains a list of the supported/allowed formats.
| You may remove those formats that you don't want to use.
| If the default format $config['rest_default_format'] is missing within
| $config['rest_supported_formats'], it will be added silently during
| REST_Controller initialization.
|
*/
$config['rest_supported_formats'] = [
'json',
'array',
'csv',
'html',
'jsonp',
'php',
'serialized',
'xml',
];
/*
|--------------------------------------------------------------------------
| REST Status Field Name
|--------------------------------------------------------------------------
|
| The field name for the status inside the response
|
*/
$config['rest_status_field_name'] = 'status';
/*
|--------------------------------------------------------------------------
| REST Message Field Name
|--------------------------------------------------------------------------
|
| The field name for the message inside the response
|
*/
$config['rest_message_field_name'] = 'error';
/*
|--------------------------------------------------------------------------
| Enable Emulate Request
|--------------------------------------------------------------------------
|
| Should we enable emulation of the request (e.g. used in Mootools request)
|
*/
$config['enable_emulate_request'] = TRUE;
/*
|--------------------------------------------------------------------------
| REST Realm
|--------------------------------------------------------------------------
|
| Name of the password protected REST API displayed on login dialogs
|
| e.g: My Secret REST API
|
*/
$config['rest_realm'] = 'REST API';
/*
|--------------------------------------------------------------------------
| REST Login
|--------------------------------------------------------------------------
|
| Set to specify the REST API requires to be logged in
|
| FALSE No login required
| 'basic' Unsecure login
| 'digest' More secure login
| 'session' Check for a PHP session variable. See 'auth_source' to set the
| authorization key
|
*/
$config['rest_auth'] = '';
/*
|--------------------------------------------------------------------------
| REST Login Source
|--------------------------------------------------------------------------
|
| Is login required and if so, the user store to use
|
| '' Use config based users or wildcard testing
| 'ldap' Use LDAP authentication
| 'library' Use a authentication library
|
| Note: If 'rest_auth' is set to 'session' then change 'auth_source' to the name of the session variable
|
*/
$config['auth_source'] = 'logado';
/*
|--------------------------------------------------------------------------
| Allow Authentication and API Keys
|--------------------------------------------------------------------------
|
| Where you wish to have Basic, Digest or Session login, but also want to use API Keys (for limiting
| requests etc), set to TRUE;
|
*/
$config['allow_auth_and_keys'] = TRUE;
/*
|--------------------------------------------------------------------------
| REST Login Class and Function
|--------------------------------------------------------------------------
|
| If library authentication is used define the class and function name
|
| The function should accept two parameters: class->function($username, $password)
| In other cases override the function _perform_library_auth in your controller
|
| For digest authentication the library function should return already a stored
| md5(username:restrealm:password) for that username
|
| e.g: md5('admin:REST API:1234') = '1e957ebc35631ab22d5bd6526bd14ea2'
|
*/
$config['auth_library_class'] = '';
$config['auth_library_function'] = '';
/*
|--------------------------------------------------------------------------
| Override auth types for specific class/method
|--------------------------------------------------------------------------
|
| Set specific authentication types for methods within a class (controller)
|
| Set as many config entries as needed. Any methods not set will use the default 'rest_auth' config value.
|
| e.g:
|
| $config['auth_override_class_method']['deals']['view'] = 'none';
| $config['auth_override_class_method']['deals']['insert'] = 'digest';
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
| $config['auth_override_class_method']['dashboard']['*'] = 'none|digest|basic';
|
| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within. An asterisk may also be used to specify an authentication method for an entire classes methods. Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end of the method name)
| Acceptable values are; 'none', 'digest' and 'basic'.
|
*/
$config['auth_override_class_method']['autenticador']['*'] = 'none';
// $config['auth_override_class_method']['deals']['insert'] = 'digest';
// $config['auth_override_class_method']['accounts']['user'] = 'basic';
// $config['auth_override_class_method']['dashboard']['*'] = 'basic';
// ---Uncomment list line for the wildard unit test
// $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic';
/*
|--------------------------------------------------------------------------
| Override auth types for specfic 'class/method/HTTP method'
|--------------------------------------------------------------------------
|
| example:
|
| $config['auth_override_class_method_http']['deals']['view']['get'] = 'none';
| $config['auth_override_class_method_http']['deals']['insert']['post'] = 'none';
| $config['auth_override_class_method_http']['deals']['*']['options'] = 'none';
*/
// ---Uncomment list line for the wildard unit test
// $config['auth_override_class_method_http']['wildcard_test_cases']['*']['options'] = 'basic';
/*
|--------------------------------------------------------------------------
| REST Login Usernames
|--------------------------------------------------------------------------
|
| Array of usernames and passwords for login, if ldap is configured this is ignored
|
*/
$config['rest_valid_logins'] = ['admin' => '1234'];
/*
|--------------------------------------------------------------------------
| Global IP Whitelisting
|--------------------------------------------------------------------------
|
| Limit connections to your REST server to whitelisted IP addresses
|
| Usage:
| 1. Set to TRUE and select an auth option for extreme security (client's IP
| address must be in whitelist and they must also log in)
| 2. Set to TRUE with auth set to FALSE to allow whitelisted IPs access with no login
| 3. Set to FALSE but set 'auth_override_class_method' to 'whitelist' to
| restrict certain methods to IPs in your whitelist
|
*/
$config['rest_ip_whitelist_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST IP Whitelist
|--------------------------------------------------------------------------
|
| Limit connections to your REST server with a comma separated
| list of IP addresses
|
| e.g: '123.456.789.0, 987.654.32.1'
|
| 127.0.0.1 and 0.0.0.0 are allowed by default
|
*/
$config['rest_ip_whitelist'] = '';
/*
|--------------------------------------------------------------------------
| Global IP Blacklisting
|--------------------------------------------------------------------------
|
| Prevent connections to the REST server from blacklisted IP addresses
|
| Usage:
| 1. Set to TRUE and add any IP address to 'rest_ip_blacklist'
|
*/
$config['rest_ip_blacklist_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST IP Blacklist
|--------------------------------------------------------------------------
|
| Prevent connections from the following IP addresses
|
| e.g: '123.456.789.0, 987.654.32.1'
|
*/
$config['rest_ip_blacklist'] = '';
/*
|--------------------------------------------------------------------------
| REST Database Group
|--------------------------------------------------------------------------
|
| Connect to a database group for keys, logging, etc. It will only connect
| if you have any of these features enabled
|
*/
$config['rest_database_group'] = 'default';
/*
|--------------------------------------------------------------------------
| REST API Keys Table Name
|--------------------------------------------------------------------------
|
| The table name in your database that stores API keys
|
*/
$config['rest_keys_table'] = 'keys';
/*
|--------------------------------------------------------------------------
| REST Enable Keys
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API will look for a column name called 'key'.
| If no key is provided, the request will result in an error. To override the
| column name see 'rest_key_column'
|
| Default table schema:
| CREATE TABLE `keys` (
| `id` INT(11) NOT NULL AUTO_INCREMENT,
| `user_id` INT(11) NOT NULL,
| `key` VARCHAR(40) NOT NULL,
| `level` INT(2) NOT NULL,
| `ignore_limits` TINYINT(1) NOT NULL DEFAULT '0',
| `is_private_key` TINYINT(1) NOT NULL DEFAULT '0',
| `ip_addresses` TEXT NULL DEFAULT NULL,
| `date_created` INT(11) NOT NULL,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_keys'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Table Key Column Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_keys', specify the
| column name to match e.g. my_key
|
*/
$config['rest_key_column'] = 'key';
/*
|--------------------------------------------------------------------------
| REST API Limits method
|--------------------------------------------------------------------------
|
| Specify the method used to limit the API calls
|
| Available methods are :
| $config['rest_limits_method'] = 'IP_ADDRESS'; // Put a limit per ip address
| $config['rest_limits_method'] = 'API_KEY'; // Put a limit per api key
| $config['rest_limits_method'] = 'METHOD_NAME'; // Put a limit on method calls
| $config['rest_limits_method'] = 'ROUTED_URL'; // Put a limit on the routed URL
|
*/
$config['rest_limits_method'] = 'ROUTED_URL';
/*
|--------------------------------------------------------------------------
| REST Key Length
|--------------------------------------------------------------------------
|
| Length of the created keys. Check your default database schema on the
| maximum length allowed
|
| Note: The maximum length is 40
|
*/
$config['rest_key_length'] = 40;
/*
|--------------------------------------------------------------------------
| REST API Key Variable
|--------------------------------------------------------------------------
|
| Custom header to specify the API key
| Note: Custom headers with the X- prefix are deprecated as of
| 2012/06/12. See RFC 6648 specification for more details
|
*/
$config['rest_key_name'] = 'X-API-KEY';
/*
|--------------------------------------------------------------------------
| REST Enable Logging
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API will log actions based on the column names 'key', 'date',
| 'time' and 'ip_address'. This is a general rule that can be overridden in the
| $this->method array for each controller
|
| Default table schema:
| CREATE TABLE `logs` (
| `id` INT(11) NOT NULL AUTO_INCREMENT,
| `uri` VARCHAR(255) NOT NULL,
| `method` VARCHAR(6) NOT NULL,
| `params` TEXT DEFAULT NULL,
| `api_key` VARCHAR(40) NOT NULL,
| `ip_address` VARCHAR(45) NOT NULL,
| `time` INT(11) NOT NULL,
| `rtime` FLOAT DEFAULT NULL,
| `authorized` VARCHAR(1) NOT NULL,
| `response_code` smallint(3) DEFAULT '0',
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_logging'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST API Logs Table Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_logging', specify the
| table name to match e.g. my_logs
|
*/
$config['rest_logs_table'] = 'logs';
/*
|--------------------------------------------------------------------------
| REST Method Access Control
|--------------------------------------------------------------------------
| When set to TRUE, the REST API will check the access table to see if
| the API key can access that controller. 'rest_enable_keys' must be enabled
| to use this
|
| Default table schema:
| CREATE TABLE `access` (
| `id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
| `key` VARCHAR(40) NOT NULL DEFAULT '',
| `all_access` TINYINT(1) NOT NULL DEFAULT '0',
| `controller` VARCHAR(50) NOT NULL DEFAULT '',
| `date_created` DATETIME DEFAULT NULL,
| `date_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/
$config['rest_enable_access'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST API Access Table Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_access', specify the
| table name to match e.g. my_access
|
*/
$config['rest_access_table'] = 'access';
/*
|--------------------------------------------------------------------------
| REST API Param Log Format
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API log parameters will be stored in the database as JSON
| Set to FALSE to log as serialized PHP
|
*/
$config['rest_logs_json_params'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Enable Limits
|--------------------------------------------------------------------------
|
| When set to TRUE, the REST API will count the number of uses of each method
| by an API key each hour. This is a general rule that can be overridden in the
| $this->method array in each controller
|
| Default table schema:
| CREATE TABLE `limits` (
| `id` INT(11) NOT NULL AUTO_INCREMENT,
| `uri` VARCHAR(255) NOT NULL,
| `count` INT(10) NOT NULL,
| `hour_started` INT(11) NOT NULL,
| `api_key` VARCHAR(40) NOT NULL,
| PRIMARY KEY (`id`)
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
| To specify the limits within the controller's __construct() method, add per-method
| limits with:
|
| $this->method['METHOD_NAME']['limit'] = [NUM_REQUESTS_PER_HOUR];
|
| See application/controllers/api/example.php for examples
*/
$config['rest_enable_limits'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST API Limits Table Name
|--------------------------------------------------------------------------
|
| If not using the default table schema in 'rest_enable_limits', specify the
| table name to match e.g. my_limits
|
*/
$config['rest_limits_table'] = 'limits';
/*
|--------------------------------------------------------------------------
| REST Ignore HTTP Accept
|--------------------------------------------------------------------------
|
| Set to TRUE to ignore the HTTP Accept and speed up each request a little.
| Only do this if you are using the $this->rest_format or /format/xml in URLs
|
*/
$config['rest_ignore_http_accept'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST AJAX Only
|--------------------------------------------------------------------------
|
| Set to TRUE to allow AJAX requests only. Set to FALSE to accept HTTP requests
|
| Note: If set to TRUE and the request is not AJAX, a 505 response with the
| error message 'Only AJAX requests are accepted.' will be returned.
|
| Hint: This is good for production environments
|
*/
$config['rest_ajax_only'] = FALSE;
/*
|--------------------------------------------------------------------------
| REST Language File
|--------------------------------------------------------------------------
|
| Language file to load from the language directory
|
*/
$config['rest_language'] = 'portuguese-brazilian';
/*
|--------------------------------------------------------------------------
| CORS Check
|--------------------------------------------------------------------------
|
| Set to TRUE to enable Cross-Origin Resource Sharing (CORS). Useful if you
| are hosting your API on a different domain from the application that
| will access it through a browser
|
*/
$config['check_cors'] = true;
/*
|--------------------------------------------------------------------------
| CORS Allowable Headers
|--------------------------------------------------------------------------
|
| If using CORS checks, set the allowable headers here
|
*/
$config['allowed_cors_headers'] = [
'Origin',
'X-Requested-With',
'Content-Type',
'Accept',
'Access-Control-Request-Method',
'Authorization'
];
/*
|--------------------------------------------------------------------------
| CORS Allowable Methods
|--------------------------------------------------------------------------
|
| If using CORS checks, you can set the methods you want to be allowed
|
*/
$config['allowed_cors_methods'] = [
'GET',
'POST',
'OPTIONS',
'PUT',
'PATCH',
'DELETE'
];
/*
|--------------------------------------------------------------------------
| CORS Allow Any Domain
|--------------------------------------------------------------------------
|
| Set to TRUE to enable Cross-Origin Resource Sharing (CORS) from any
| source domain
|
*/
$config['allow_any_cors_domain'] = true;
/*
|--------------------------------------------------------------------------
| CORS Allowable Domains
|--------------------------------------------------------------------------
|
| Used if $config['check_cors'] is set to TRUE and $config['allow_any_cors_domain']
| is set to FALSE. Set all the allowable domains within the array
|
| e.g. $config['allowed_origins'] = ['http://www.example.com', 'https://spa.example.com']
|
*/
$config['allowed_cors_origins'] = [];

View File

@ -0,0 +1,87 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = TRUE;
/*
| -------------------------------------------------------------------------
| Sample REST API Routes
| -------------------------------------------------------------------------
*/
$route['login'] = 'Login_Controller/login';
$route['employee'] = 'Employee_Controller/employee';
$route['getEmployeeList'] = 'Employee_Controller/getEmployeeList';
$route['getRoleDetails'] = 'Employee_Controller/getRoleDetails';
$route['getMasterBranchDetails'] = 'Employee_Controller/getMasterBranchDetails';
$route['chkEmpExistDetail'] = 'Employee_Controller/check_exist';
$route['insertEmployee'] = 'Employee_Controller/addEmployee';
$route['chkUpdateEmpExistDetail'] = 'Employee_Controller/check_update_exist';
$route['updateEmpExistDetail'] = 'Employee_Controller/updateEmployee';
$route['getEmpBranchDetails'] = 'Employee_Controller/getEmpBranchDetails';
$route['updateEmpBranchDetail'] = 'Employee_Controller/updateEmpBranchDetail';
$route['autenticadors'] = 'autenticador/index'; // Example 4
$route['addBranchDetails'] = 'Branch_Controller/addBranchDetails';
$route['getBranchDetails'] = 'Branch_Controller/getBranchDetails';
$route['updateBranchDetails'] = 'Branch_Controller/updateBranchDetails';
$route['getTrackingLeadDetails'] = 'Call_Tracking_Controller/getTrackingLeadDetails';
$route['addLeadTrackingDetails'] = 'Call_Tracking_Controller/addLeadTrackingDetails';
$route['getTrackingDetails'] = 'Call_Tracking_Controller/getTrackingDetails';
$route['updateFollowupDetails'] = 'Call_Tracking_Controller/updateFollowupDetails';
$route['loadFollowupDetails'] = 'Call_Tracking_Controller/loadFollowupDetails';

View File

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
':question:' => array('question.gif', '19', '19', 'question')
);

View File

@ -0,0 +1,214 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains four arrays of user agent data. It is used by the
| User Agent Class to help identify browser, platform, robot, and
| mobile device data. The array keys are used to identify the device
| and the array values are used to set the actual name of the item.
*/
$platforms = array(
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser'
);
$mobiles = array(
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile'
);
// There are hundreds of bots but these are the most common.
$robots = array(
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot'
);

View File

@ -0,0 +1,70 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/REST_Controller.php';
class Autenticador extends REST_Controller {
public function index_post()
{
$email = $this->post('email');
$password = $this->post('password');
$this->db->where('email', $email);
// $this->db->where('password', $password);
$usuario = $this->db->get('tbl_users')->first_row();
if ($usuario) {
$key = $this->config->item('encryption_key');
$token = $this->jwt->encode(array(
'id'=>$usuario->email,
'nome'=>$usuario->email,
'email'=>$usuario->email,
'admin'=>TRUE,
'iat'=> strtotime("now"),
'exp'=> strtotime("+2 hours")
), $key);
$message = ['token' => $token];
$this->set_response($message, REST_Controller::HTTP_ACCEPTED);
}
else
{
// Set the response and exit
$this->response([
'status' => FALSE,
'message' => 'Usuario ou senha errados'
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function sair_get()
{
try {
$key = $this->config->item('encryption_key');
$token = $this->input->get_request_header('Authorization');
$token = str_replace('Bearer ','',$token);
$token = $this->jwt->decode($token, $key);
} catch (Exception $e) {
$token = FALSE;
$erro = 'Erro: '.$e->getMessage();
}
if ($token == FALSE) {
$this->response([
'status' => FALSE,
'message' => $erro
], REST_Controller::HTTP_UNAUTHORIZED);
}
else{
$this->set_response([
'status' => TRUE,
'message' => $token->nome.' saiu com sucesso'], REST_Controller::HTTP_OK);
}
}
}
/* End of file Autenticador.php */
/* Location: ./application/controllers/Autenticador.php */

View File

@ -0,0 +1,143 @@
<?php
/**
* Created by PhpStorm.
* User: kms
* Date: 11/13/17
* Time: 7:40 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Branch_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
$this->methods['addBranchDetails_get']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['addBranchDetails_post']['limit'] = 100; // 100 requests per hour per user/key
$this->methods['addBranchDetails_delete']['limit'] = 50; // 50 requests per hour per user/key
$this->methods['getBranchDetails_post']['limit'] = 500; // 50 requests per hour per user/key
$this->methods['updateBranchDetails_post']['limit'] = 500;
// load the model
$this->load->model('Branch_model', 'branch_model');
}
/*
* This method used to add branch details
* created by kms
* */
public function addBranchDetails_post()
{
$details['BranchCode'] = $this->post('branchCode');
$details['BranchName'] = $this->post('branchName');
$details['LogoPath'] = $this->post('logo');
$details['MobileNumber'] = $this->post('primaryPhone');
$details['AlternateNumber'] = $this->post('secondaryPhone');
$details['LandlineNumber'] = $this->post('landLine');
$details['Address'] = $this->post('address');
$details['EmailID'] = $this->post('email');
$details['CreatedBy'] = $this->post('createdBy');
$details['IsActive'] = $this->post('status');
$branchDetails = $this->branch_model->addBranch($details);// Check if the users data store contains users (in case the database result returns NULL)
if ($branchDetails)
{
$branchDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($branchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* get branch details
* created by kms
* */
public function getBranchDetails_post()
{
$requestedBy = $this->post('requestedBy');
$getBranch = $this->branch_model->getBranch($requestedBy);
if ($getBranch)
{
$getBranch['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* update the branch details
* created by kms
* */
public function updateBranchDetails_post()
{
$branchCode = $this->post('branchCode');
$details['BranchName'] = $this->post('branchName');
$details['LogoPath'] = $this->post('logo');
$details['MobileNumber'] = $this->post('primaryPhone');
$details['AlternateNumber'] = $this->post('secondaryPhone');
$details['LandlineNumber'] = $this->post('landLine');
$details['Address'] = $this->post('address');
$details['EmailID'] = $this->post('email');
$details['IsActive'] = $this->post('status');
$details['UpdatedBy'] = $this->post('updatedBy');
$details['UpdatedOn'] = date("Y-m-d", time());
$updateDetails = $this->branch_model->updateBranch($details,$branchCode);// Check if the users data store contains users (in case the database result returns NULL)
if ($updateDetails)
{
$updateDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}

View File

@ -0,0 +1,221 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/15/17
* Time: 5:41 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Call_Tracking_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
$this->methods['getTrackingLeadDetails_get']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['getTrackingLeadDetails_post']['limit'] = 1000; // 100 requests per hour per user/key
$this->methods['getTrackingLeadDetails_delete']['limit'] = 50; // 50 requests per hour per user/key
$this->methods['addTrackingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
$this->methods['getTrackingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
$this->methods['updateFollowupDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
$this->methods['loadFollowupDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
// load the model
$this->load->model('Calltracking_model', 'Calltracking_model');
}
/*
* get lead details with mobile number
* created by kms
* */
public function getTrackingLeadDetails_post()
{
$requestedBy = $this->post('requestedBy');
$mobileNumber = $this->post('mobileNumber');
$getLeadDetails = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber);
if ($getLeadDetails)
{
$getLeadDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getLeadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* add tracking lead details
* created by kms
* */
public function addLeadTrackingDetails_post()
{
//store lead details
$lead_details['LeadName'] = $this->post('studentName');
$lead_details['MobileNumber'] = $this->post('mobileNumber');
$lead_details['IsNewEnquiry'] = $this->post('enquiryStatus');
$lead_details['CreatedBy'] = $this->post('createdBy');
//store tracking details
$tracking_details['University'] = $this->post('universityID');
$tracking_details['Course'] = $this->post('courseName');
$tracking_details['ActivityStatus'] = $this->post('activity');
$tracking_details['AssignedTo'] = $this->post('assignedTo');
$tracking_details['StatusCode'] = $this->post('status');
$tracking_details['ReferredBy'] = $this->post('referedBy');
$tracking_details['CreatedBy'] = $this->post('createdBy');
//store tracking followup details
$tracking_followup_details['FollowupOn'] = $this->post('date');
$tracking_followup_details['FollowupComments'] = $this->post('comments');
$tracking_followup_details['CreatedBy'] = $this->post('createdBy');
$leadDetails = $this->Calltracking_model->addleadDetails($lead_details,$tracking_details,$tracking_followup_details);// Check if the users data store contains users (in case the database result returns NULL)
if ($leadDetails)
{
$leadDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($leadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* get tracking details
* created by kms
* */
public function getTrackingDetails_post()
{
$search['requestedBy'] = $this->post('requestedBy');
$search['requestedDept'] = $this->post('requestedDept');
$search['searchDate'] = $this->post('searchDate');
$search['searchMobileNumber'] = $this->post('searchMobileNumber');
$search['searchName']= $this->post('searchName');
$getTrackedDetails = $this->Calltracking_model->getTrackingDetails($search);
if ($getTrackedDetails)
{
$getTrackedDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getTrackedDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* update tracking followup details
* created by kms
* */
public function updateFollowupDetails_post()
{
//store followup details for update
$update_followup_details['TrackingID'] = $this->post('trackingID');
$update_followup_details['UpdatedBy'] = $this->post('updatedBy');
$update_followup_details['StatusCode'] = $this->post('status');
// store followup details for insert
$followup_details['TrackingID'] = $this->post('trackingID');
$followup_details['FollowupOn'] = $this->post('date');
$followup_details['CreatedBy'] = $this->post('updatedBy');
$followup_details['FollowupComments'] = $this->post('comments');
$updateDetails = $this->Calltracking_model->updateFollowupDetails($update_followup_details,$followup_details);// Check if the users data store contains users (in case the database result returns NULL)
if ($updateDetails)
{
$updateDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* load followup details
* created by kms
* */
public function loadFollowupDetails_post()
{
$get_details['TrackingID'] = $this->post('trackingID');
$get_details['UpdatedBy'] = $this->post('updatedBy');
$getLoadDetails = $this->Calltracking_model->getLoadFollowupDetails($get_details);
if ($getLoadDetails)
{
$getLoadDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getLoadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No records found!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}

View File

@ -0,0 +1,317 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Employee_Controller extends REST_Controller {
/*
* get employee details
* params:
* created by kdk
* */
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
// $this->methods['employee_get']['limit'] = 500; // 500 requests per hour per user/key
// $this->methods['employee_post']['limit'] = 100; // 100 requests per hour per user/key
// $this->methods['employee_delete']['limit'] = 50; // 50 requests per hour per user/key
$this->methods['getRoleDetails_post']['limit'] = 100;
$this->methods['getMasterBranchDetails_post']['limit'] = 100;
$this->methods['addEmployee_post']['limit'] = 100;
$this->methods['check_exist_post']['limit'] = 100;
$this->methods['check_update_exist_post']['limit'] = 100;
$this->methods['updateEmployee_post']['limit'] = 100;
$this->methods['updateEmpBranchDetail_post']['limit'] = 100;
// load the employee model
$this->load->model('Employee_model', 'employee_model');
}
//This method used to get employee Details
public function employee_post()
{
$empLoginID = $this->post('employeeLoginID');
$employeeDetails = $this->employee_model->get_emp_detail( $empLoginID );// Check if the employee exist
if ($employeeDetails)
{
$employeeDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($employeeDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// get all employee details
public function getEmployeeList_post() {
$reqData = $this->post('data');
$loginUserId = $reqData['localUserID'];
$loginUserBranchId = $reqData['localBranchID'];
$loginUserType = $reqData['localType'];
$employeeListDetails = $this->employee_model->get_employee_list( $loginUserId, $loginUserBranchId, $loginUserType );// Check if the employee exist
if ($employeeListDetails)
{
$employeeListDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($employeeListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// get role details
public function getRoleDetails_post() {
$reqRoleID = $this->post('reqRoleID');
$resRoleDetails = $this->employee_model->get_req_role_detail( $reqRoleID );// Check if the employee exist
if ($resRoleDetails)
{
$resRoleDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($resRoleDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// get branch details
public function getMasterBranchDetails_post () {
$reqRoleID = $this->post('reqRoleID');
$reqUserID = $this->post('reqUserID');
$resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID );// Check if the employee exist
if ($resMasterBranchDetails)
{
$resMasterBranchDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($resMasterBranchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// check exist values details
public function check_exist_post() {
$data = $this->post('data');
$checkData = $this->post('check');
$checkRes = $this->employee_model->check_exist( $data, $checkData );// Check if the employee exist
if ($checkRes)
{
$checkRes['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// add employee
public function addEmployee_post() {
$data = $this->post('data');
$createdBy = $this->post('createdBy');
$req['StaffID'] = $data['employeeId'];
$req['Firstname'] = $data['firstname'];
$req['Lastname'] = $data['lastname'];
$req['Fathername'] = $data['fathername'];
$req['EmailID'] = $data['emailId'];
$req['MotherName'] = $data['mothername'];
$req['MobileNumber'] = $data['primaryPhone'];
$req['AlternateNumber'] = $data['secondaryPhone'];
$req['Gender'] = $data['gender'];
$req['DOB'] = $data['dateofbirth'];
// $req['DOB'] = $data['dateofbirth'];
$req['PresentAddress'] = $data['address2'];
$req['PermanentAddress'] = $data['address1'];
$req['AadharNumber'] = $data['aadharNumber'];
$req['OtherID'] = $data['otherId'];
$req['OtherIDDetails'] = $data['otherIdDetails'];
$req['Qualification'] = $data['qualificaion'];
$req['BranchCode'] = $data['homeBranch'];
$req['IsActive'] = $data['switchsetting'];
$req['DOJ'] = $data['dateofjoining'];
// $req['DOJ'] = $data['dateofjoining'];
$req['ListCode'] = $data['role'];
$req['CreatedBy'] = $createdBy;
// print_r($req);exit();
$employeeAdd = $this->employee_model->add_employee( $req, $createdBy );// Check if the employee exist
if ($employeeAdd)
{
$employeeAdd['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($employeeAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function check_update_exist_post() {
$exceptId = $this->post('exceptId');
$datas = $this->post('datas');
$checkFor = $this->post('check');
$checkRes = $this->employee_model->check_update_exist( $exceptId, $datas, $checkFor );// Check if the employee exist
if ($checkRes)
{
$checkRes['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// update employee details
public function updateEmployee_post () {
$data = $this->post('data');
$updatedBy = $this->post('updatedBy');
$updateStaff = $data['StaffID'];
$req['Firstname'] = $data['Firstname'];
$req['Lastname'] = $data['Lastname'];
$req['Fathername'] = $data['Fathername'];
$req['EmailID'] = $data['EmailID'];
$req['MotherName'] = $data['MotherName'];
$req['MobileNumber'] = $data['MobileNumber'];
$req['AlternateNumber'] = $data['AlternateNumber'];
$req['Gender'] = $data['Gender'];
$req['DOB'] = date('d-m-Y', strtotime($data['DOB']) );
// $req['DOB'] = $data['dateofbirth'];
$req['PresentAddress'] = $data['PresentAddress'];
$req['PermanentAddress'] = $data['PermanentAddress'];
$req['AadharNumber'] = $data['AadharNumber'];
$req['OtherID'] = $data['OtherID'];
$req['OtherIDDetails'] = $data['OtherIDDetails'];
$req['Qualification'] = $data['Qualification'];
// $req['BranchCode'] = $data['BranchCode'];
$req['IsActive'] = $data['IsActive'];
$req['DOJ'] = date('d-m-Y', strtotime($data['DOJ']) );
// $req['DOJ'] = $data['dateofjoining'];
// $req['ListCode'] = $data['ListCode'];
$req['UpdatedBy'] = $updatedBy;
$date = date('Y-m-d H:i:s');
$req['UpdatedOn'] = $date;
// print_r($req);exit();
$employeeUpdate = $this->employee_model->update_employee( $req, $updateStaff );// Check if the employee exist
if ($employeeUpdate)
{
$employeeUpdate['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($employeeUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// get employee branch details
public function getEmpBranchDetails_post() {
$staffID = $this->post('staffID');
$employeeBranch = $this->employee_model->get_employee_branch( $staffID );// Check if the employee exist
if ($employeeBranch)
{
$employeeBranch['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($employeeBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
// update employee branch
public function updateEmpBranchDetail_post() {
$empFor = $this->post('empFor');
$reqBanch['BranchCode'] = $this->post('updateBranch');
$req['ListCode'] = $this->post('updateRole');
$req['UpdatedBy'] = $this->post('updateBy');
$date = date('Y-m-d H:i:s');
$req['UpdatedOn'] = $date;
$updateBranch = $this->employee_model->upate_employee_branch( $empFor, $reqBanch, $req );// Check if the employee exist
if ($updateBranch)
{
$updateBranch['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($updateBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}

View File

@ -0,0 +1,63 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Login_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
$this->methods['login_get']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['login_post']['limit'] = 100; // 100 requests per hour per user/key
$this->methods['login_delete']['limit'] = 50; // 50 requests per hour per user/key
$this->load->model('Login_model', 'login_model');
}
//This method used to get Login
public function login_post()
{
$userMobile = $this->post('userMobile');
$password = $this->post('password');
$loginDetails = $this->login_model->login( $userMobile, $password);// Check if the users data store contains users (in case the database result returns NULL)
if ($loginDetails)
{
$LoginDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($loginDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}

View File

@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Rest_server extends CI_Controller {
public function index()
{
$this->load->helper('url');
$this->load->view('rest_server');
}
}

View File

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Teste extends CI_Controller {
public function index()
{
$email = 'rodrigo54mix@gmail.com';
$senha = '123';
$this->db->where('email', $email);
$this->db->where('senha', $senha);
$usuario = $this->db->get('admin')->first_row();
$key = $this->config->item('encryption_key');
$exp = strtotime("-2 hours");
$iat = strtotime("now");
$nbf = strtotime("+3 hours");
$token = $this->jwt->encode(array(
'id'=>$usuario->id,
'name'=>$usuario->nome,
'admin'=>true,
'iat'=>$iat,
'exp'=>$exp
), $key);
echo "<pre>";
echo $token;
echo "<br><br>";
echo 'time: '.time();
echo "<br>";
echo 'iate: '.$iat;
echo "<br>";
echo 'nbf : '.$nbf;
echo "<br>";
echo 'exp : '.$exp;
echo "<br><br>";
echo "</pre>";
// if ($iat > time()) {
// echo 'Não é possível lidar com token antes de ' . date(DateTime::ISO8601, time());
// echo "<br>";
// }
if (time() >= $exp) {
echo "Expired token";
echo "<br>";
}
echo "<pre>";
print_r ($usuario);
echo "</pre>";
echo "<br>";
var_dump( $this->jwt->decode($token,$key) );
echo "<br>";
}
public function sair(){
$this->session->sess_destroy();
redirect('','refresh');
}
}
/* End of file Teste.php */
/* Location: ./application/controllers/Teste.php */

View File

@ -0,0 +1,27 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->helper('url');
$this->load->view('welcome_message');
}
}

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,41 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/REST_Controller.php';
class MY_Controller extends REST_Controller {
public $userdata;
public $debug = false;
/*
| verificação se existe um token
| no header de Authorization
| caso não exita ou não seja valido
| emite erro unautorizado
*/
public function early_checks()
{
try {
$key = $this->config->item('encryption_key');
$token = $this->input->get_request_header('Authorization');
$token = str_replace('Bearer ','',$token);
$token = $this->jwt->decode($token, $key);
$this->userdata = $token;
} catch (Exception $e) {
$token = FALSE;
$erro = 'Erro: '.$e->getMessage();
}
if ($token == FALSE && $this->debug == false) {
$this->response([
'status' => FALSE,
'message' => $erro
], REST_Controller::HTTP_UNAUTHORIZED);
}
}
}
/* End of file MY_Controller.php */
/* Location: ./application/core/MY_Controller.php */

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Bulgarian language
*/
$lang['text_rest_invalid_api_key'] = 'Невалиден API ключ %s';
$lang['text_rest_invalid_credentials'] = 'Невалидни данни за достъп';
$lang['text_rest_ip_denied'] = 'Отказан IP адрес';
$lang['text_rest_ip_unauthorized'] = 'Неоторизиран IP адрес';
$lang['text_rest_unauthorized'] = 'Неоторизиран достъп';
$lang['text_rest_ajax_only'] = 'Само AJAX заявки са разрешени';
$lang['text_rest_api_key_unauthorized'] = 'API ключът не е оторизиран зо достъп до заявения контролер';
$lang['text_rest_api_key_permissions'] = 'API ключът няма достатъчно права';
$lang['text_rest_api_key_time_limit'] = 'API ключът е изполван с превишаване на времевия лимит за този метод';
$lang['text_rest_ip_address_time_limit'] = 'За текущия IP адрес е превишен времевия лимит за изпълнение на метода';
$lang['text_rest_unknown_method'] = 'Неизвестен метод';
$lang['text_rest_unsupported'] = 'Неподдържан протокол';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,16 @@
<?php
/*
* Dutch language
*/
$lang['text_rest_invalid_api_key'] = 'Ongeldige API sleutel %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Ongeldige gegevens';
$lang['text_rest_ip_denied'] = 'IP-adres geweigerd';
$lang['text_rest_ip_unauthorized'] = 'IP-adres niet toegestaan';
$lang['text_rest_unauthorized'] = 'Niet toegestaan';
$lang['text_rest_ajax_only'] = 'Alleen AJAX requests zijn toegestaan';
$lang['text_rest_api_key_unauthorized'] = 'De API sleutel heeft geen toegang tot de gevraagde informatie';
$lang['text_rest_api_key_permissions'] = 'De API sleutel heeft niet genoeg bevoegdheden';
$lang['text_rest_api_key_time_limit'] = 'De API sleutel heeft de tijdslimiet bereikt';
$lang['text_rest_ip_address_time_limit'] = 'Het IP-adres heeft de tijdslimiet bereikt';
$lang['text_rest_unknown_method'] = 'Onbekende actie';
$lang['text_rest_unsupported'] = 'Protocol wordt niet ondersteund';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* English language
*/
$lang['text_rest_invalid_api_key'] = 'Invalid API key %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Invalid credentials';
$lang['text_rest_ip_denied'] = 'IP denied';
$lang['text_rest_ip_unauthorized'] = 'IP unauthorized';
$lang['text_rest_unauthorized'] = 'Unauthorized';
$lang['text_rest_ajax_only'] = 'Only AJAX requests are allowed';
$lang['text_rest_api_key_unauthorized'] = 'This API key does not have access to the requested controller';
$lang['text_rest_api_key_permissions'] = 'This API key does not have enough permissions';
$lang['text_rest_api_key_time_limit'] = 'This API key has reached the time limit for this method';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';
$lang['text_rest_unknown_method'] = 'Unknown method';
$lang['text_rest_unsupported'] = 'Unsupported protocol';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* French language
*/
$lang['text_rest_invalid_api_key'] = 'La clef d\'API %s est invalide'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Authentification invalide';
$lang['text_rest_ip_denied'] = 'IP refusée';
$lang['text_rest_ip_unauthorized'] = 'IP non-autorisée';
$lang['text_rest_unauthorized'] = 'Non autorisé';
$lang['text_rest_ajax_only'] = 'Seul les requêtes AJAX sont autorisées';
$lang['text_rest_api_key_unauthorized'] = 'Cette clef d\'API n\'a pas accès au contrôleur demandé';
$lang['text_rest_api_key_permissions'] = 'Cette clef d\'API n\'a pas les permissions requises';
$lang['text_rest_api_key_time_limit'] = 'Cette clef d\'API a atteint sa limite de temps pour cette méthode';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Méthode inconnue';
$lang['text_rest_unsupported'] = 'Protocole non-supporté';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* German language
*/
$lang['text_rest_invalid_api_key'] = 'Ungültiger API Schlüssel %s'; // %s is the REST API key | %s ist der REST API Schlüssel
$lang['text_rest_invalid_credentials'] = 'Ungültige Zugangsdaten';
$lang['text_rest_ip_denied'] = 'IP abgelehnt';
$lang['text_rest_ip_unauthorized'] = 'IP nicht autorisiert';
$lang['text_rest_unauthorized'] = 'Nicht autorisiert';
$lang['text_rest_ajax_only'] = 'Nur AJAX-Anfragen zulässig';
$lang['text_rest_api_key_unauthorized'] = 'Dieser API Schlüssel hat keinen Zugriff auf den angeforderten Controller';
$lang['text_rest_api_key_permissions'] = 'Dieser API Schlüssel besitzt die erforderlichen Rechte nicht';
$lang['text_rest_api_key_time_limit'] = 'Dieser API Schlüssel ist abgelaufen';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Unbekannte Methode';
$lang['text_rest_unsupported'] = 'Protokoll nicht unterstützt';

View File

@ -0,0 +1,18 @@
<?php
/*
* Greek language
*/
$lang['text_rest_invalid_api_key'] = 'Λάθος API key %s'; // %s είναι το REST API key
$lang['text_rest_invalid_credentials'] = 'Μή έγκυρα διαπιστευτήρια';
$lang['text_rest_ip_denied'] = 'Άρνηση πρόσβασης της διεύθηνσης IP';
$lang['text_rest_ip_unauthorized'] = 'Μη εξουσιοδοτημένη διεύθυνση IP';
$lang['text_rest_unauthorized'] = 'Άρνηση Πρόσβασης. Μη εξουσιοδοτημένο';
$lang['text_rest_ajax_only'] = 'Μόνο AJAX requests επιτρέπονται';
$lang['text_rest_api_key_unauthorized'] = 'Αυτό το API key δεν έχει πρόσβαση στον συγκεκριμένο controller';
$lang['text_rest_api_key_permissions'] = 'Αυτό το API key δεν έχει αρκετά δικαιώματα';
$lang['text_rest_api_key_time_limit'] = 'Αυτό το API key έχει φτάσει στο μέγιστο όριο requests για την συγκεκριμένη μέθοδο';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Άγνωστη μέθοδος';
$lang['text_rest_unsupported'] = 'Το συγκεκριμένο πρωτόκολλο δεν υποστηρίζεται';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* English language
*/
$lang['text_rest_invalid_api_key'] = 'Kunci API %s , tidak valid'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Hak kredensial tidak valid';
$lang['text_rest_ip_denied'] = 'IP ditolak';
$lang['text_rest_ip_unauthorized'] = 'IP tidak diberi kuasa';
$lang['text_rest_unauthorized'] = 'Tidak diberi kuasa';
$lang['text_rest_ajax_only'] = 'Hanya AJAX requests yang diperbolehkan';
$lang['text_rest_api_key_unauthorized'] = 'Kunci API ini tidak memiliki akses ke Controller yang diminta';
$lang['text_rest_api_key_permissions'] = 'Kunci API ini tidak memiliki izin akses yang cukup';
$lang['text_rest_api_key_time_limit'] = 'Kunci API ini telah mencapai batas waktu untuk mengakses metode ini';
$lang['text_rest_ip_address_time_limit'] = 'Alamat API ini telah mencapai batas waktu untuk mengakses metode ini';
$lang['text_rest_unknown_method'] = 'Metode yang tidak ketahui';
$lang['text_rest_unsupported'] = 'Protokol tidak mendukung';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,16 @@
<?php
/*
* Italian language
*/
$lang['text_rest_invalid_api_key'] = 'API key %s non valida'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Credenziali non valide';
$lang['text_rest_ip_denied'] = 'IP non consentito';
$lang['text_rest_ip_unauthorized'] = 'IP non autorizzato';
$lang['text_rest_unauthorized'] = 'Non autorizzato';
$lang['text_rest_ajax_only'] = 'Sono ammesse solo richieste AJAX';
$lang['text_rest_api_key_unauthorized'] = 'Questa API key non ha accesso al controller richiesto';
$lang['text_rest_api_key_permissions'] = 'Questa API key non dispone di autorizzazioni sufficienti';
$lang['text_rest_api_key_time_limit'] = 'Questa API key ha raggiunto il limite di tempo per questo metodo';
$lang['text_rest_ip_address_time_limit'] = 'Questo indirizzo IP ha raggiunto il limite di tempo per questo metodo';
$lang['text_rest_unknown_method'] = 'Metodo sconosciuto';
$lang['text_rest_unsupported'] = 'Protocollo non supportato';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Brazilian portuguese language
*/
$lang['text_rest_invalid_api_key'] = 'Chave da API %s inválida'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Credenciais inválidas';
$lang['text_rest_ip_denied'] = 'IP proibido';
$lang['text_rest_ip_unauthorized'] = 'IP não autorizado';
$lang['text_rest_unauthorized'] = 'Não autorizado';
$lang['text_rest_ajax_only'] = 'Apenas chamadas AJAX são permitidas';
$lang['text_rest_api_key_unauthorized'] = 'Esta chave da API não tem acesso ao controller solicitado';
$lang['text_rest_api_key_permissions'] = 'Esta chave da API não tem permissões suficientes';
$lang['text_rest_api_key_time_limit'] = 'Esta chave da API já atingiu o tempo limite para este método';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Método desconhecido';
$lang['text_rest_unsupported'] = 'Sem suporte para este protocolo';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Romanian language
*/
$lang['text_rest_invalid_api_key'] = 'Cheie API invalidă %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Acreditări invalide';
$lang['text_rest_ip_denied'] = 'IP respins';
$lang['text_rest_ip_unauthorized'] = 'IP neautorizat';
$lang['text_rest_unauthorized'] = 'Neautorizat';
$lang['text_rest_ajax_only'] = 'Doar cererile AJAX sunt acceptate';
$lang['text_rest_api_key_unauthorized'] = 'Această cheie API nu are acees la controller-ul solicitat';
$lang['text_rest_api_key_permissions'] = 'Această cheie API nu are suficiente permisiuni';
$lang['text_rest_api_key_time_limit'] = 'Această cheie API a atins limita de timp pentru această metodă';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Metodă necunoscută';
$lang['text_rest_unsupported'] = 'Protocol neacceptat';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Serbian language
*/
$lang['text_rest_invalid_api_key'] = 'Неправилан *API* кључ %s'; // %s је *REST API* кључ
$lang['text_rest_invalid_credentials'] = 'Неодговарајући кориснички улазни подаци';
$lang['text_rest_ip_denied'] = '*IP* одбијен';
$lang['text_rest_ip_unauthorized'] = '*IP* неауторизован';
$lang['text_rest_unauthorized'] = 'Неауторизовано';
$lang['text_rest_ajax_only'] = 'Једино *AJAX* захтеви су дозвољени';
$lang['text_rest_api_key_unauthorized'] = 'Овај *API* кључ нема овлашћења за захтевани контролер';
$lang['text_rest_api_key_permissions'] = 'Овај *API* кључ нема дозвољен степен овлашћења';
$lang['text_rest_api_key_time_limit'] = 'Овај *API* кључ је прекорачио временски лимит за дати метод';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Непознат метод';
$lang['text_rest_unsupported'] = 'Неподржан протокол';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Serbian language
*/
$lang['text_rest_invalid_api_key'] = 'Nepravilan API klju&#269; %s'; // %s je REST API ključ
$lang['text_rest_invalid_credentials'] = 'Neodgovaraju&#263;i korisni&#269;ki ulazni podaci';
$lang['text_rest_ip_denied'] = 'IP odbijen';
$lang['text_rest_ip_unauthorized'] = 'IP neautorizovan';
$lang['text_rest_unauthorized'] = 'Neautorizovano';
$lang['text_rest_ajax_only'] = 'Jedino AJAX zahtevi su dozvoljeni';
$lang['text_rest_api_key_unauthorized'] = 'Ovaj API klju&#269; nema ovla&#353;&#263;enje za zahtevani kontroler';
$lang['text_rest_api_key_permissions'] = 'Ovaj API klju&#269; nema dozvoljen stepen ovla&#353;&#263;enja';
$lang['text_rest_api_key_time_limit'] = 'Ovaj API klju&#269; je prekora&#269;io vremenski limit za dati metod';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'Nepoznat metod';
$lang['text_rest_unsupported'] = 'Nepodr&#382;an protokol';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Simple Chinese language
*/
$lang['text_rest_invalid_api_key'] = '无效的 API key %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = '无效的凭证';
$lang['text_rest_ip_denied'] = 'IP 地址被拒绝';
$lang['text_rest_ip_unauthorized'] = 'IP 地址未认证';
$lang['text_rest_unauthorized'] = '未认证';
$lang['text_rest_ajax_only'] = '只允许 AJAX 类型的请求';
$lang['text_rest_api_key_unauthorized'] = '此 API key无法存取指定的 controller';
$lang['text_rest_api_key_permissions'] = '此 API key没有足够的权限';
$lang['text_rest_api_key_time_limit'] = '此 API key已经超过有效期限';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = '未知的方法';
$lang['text_rest_unsupported'] = '不支持的请求方法';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Spanish language
*/
$lang['text_rest_invalid_api_key'] = 'API key %s No valida'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Credenciales Invalidas';
$lang['text_rest_ip_denied'] = 'IP denegada';
$lang['text_rest_ip_unauthorized'] = 'IP no autorizada';
$lang['text_rest_unauthorized'] = 'Acceso no autorizado';
$lang['text_rest_ajax_only'] = 'Solo peticiones ajax permitidas';
$lang['text_rest_api_key_unauthorized'] = 'Esta clave de API no tiene acceso al controlador solicitado';
$lang['text_rest_api_key_permissions'] = 'Esta clave de API no tiene suficientes permisos';
$lang['text_rest_api_key_time_limit'] = 'Esta clave de API ha alcanzado el límite de tiempo para este método';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = 'método desconocido';
$lang['text_rest_unsupported'] = 'Protocolo no soportado';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Traditional Chinese language
*/
$lang['text_rest_invalid_api_key'] = '無效的 API 金鑰 %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = '無效的憑證';
$lang['text_rest_ip_denied'] = 'IP 位置被拒絕';
$lang['text_rest_ip_unauthorized'] = 'IP 位置未認證';
$lang['text_rest_unauthorized'] = '未認證';
$lang['text_rest_ajax_only'] = '只有 AJAX 類型請求被允許';
$lang['text_rest_api_key_unauthorized'] = '這個 API 金鑰沒有辦法存取指定的 controller';
$lang['text_rest_api_key_permissions'] = '這個 API 金鑰沒有具備足夠權限';
$lang['text_rest_api_key_time_limit'] = '這個 API 金鑰已經超過有效期限';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';//todo translate
$lang['text_rest_unknown_method'] = '未知的方法';
$lang['text_rest_unsupported'] = '不支援的通訊協定';

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/*
* Turkish language
*/
$lang['text_rest_invalid_api_key'] = 'Geçersiz API anahtarı %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Geçersiz kimlik';
$lang['text_rest_ip_denied'] = 'IP reddedildi';
$lang['text_rest_ip_unauthorized'] = 'Yetkisiz IP';
$lang['text_rest_unauthorized'] = 'İzinsiz';
$lang['text_rest_ajax_only'] = 'Sadece AJAX isteklerine izin verildi';
$lang['text_rest_api_key_unauthorized'] = 'Ulaşılmak istenilen controllera API anahtarının erişim yetkisi bulunmamaktadır';
$lang['text_rest_api_key_permissions'] = 'Bu API anahtarının yeterli yetkisi bulunmamaktadır';
$lang['text_rest_api_key_time_limit'] = 'API anahtarı bu metod için zaman sınırına ulaştı.';
$lang['text_rest_ip_address_time_limit'] = 'IP adresi bu metod için zaman sınırına ulaştı.';
$lang['text_rest_unknown_method'] = 'Bilinmeyen metod';
$lang['text_rest_unsupported'] = 'Desteklenmeyen protokol';

View File

@ -0,0 +1,524 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Format class
* Help convert between various formats such as XML, JSON, CSV, etc.
*
* @author Phil Sturgeon, Chris Kacerguis, @softwarespot
* @license http://www.dbad-license.org/
*/
class Format {
/**
* Array output format
*/
const ARRAY_FORMAT = 'array';
/**
* Comma Separated Value (CSV) output format
*/
const CSV_FORMAT = 'csv';
/**
* Json output format
*/
const JSON_FORMAT = 'json';
/**
* HTML output format
*/
const HTML_FORMAT = 'html';
/**
* PHP output format
*/
const PHP_FORMAT = 'php';
/**
* Serialized output format
*/
const SERIALIZED_FORMAT = 'serialized';
/**
* XML output format
*/
const XML_FORMAT = 'xml';
/**
* Default format of this class
*/
const DEFAULT_FORMAT = self::JSON_FORMAT; // Couldn't be DEFAULT, as this is a keyword
/**
* CodeIgniter instance
*
* @var object
*/
private $_CI;
/**
* Data to parse
*
* @var mixed
*/
protected $_data = [];
/**
* Type to convert from
*
* @var string
*/
protected $_from_type = NULL;
/**
* DO NOT CALL THIS DIRECTLY, USE factory()
*
* @param NULL $data
* @param NULL $from_type
* @throws Exception
*/
public function __construct($data = NULL, $from_type = NULL)
{
// Get the CodeIgniter reference
$this->_CI = &get_instance();
// Load the inflector helper
$this->_CI->load->helper('inflector');
// If the provided data is already formatted we should probably convert it to an array
if ($from_type !== NULL)
{
if (method_exists($this, '_from_'.$from_type))
{
$data = call_user_func([$this, '_from_'.$from_type], $data);
}
else
{
throw new Exception('Format class does not support conversion from "'.$from_type.'".');
}
}
// Set the member variable to the data passed
$this->_data = $data;
}
/**
* Create an instance of the format class
* e.g: echo $this->format->factory(['foo' => 'bar'])->to_csv();
*
* @param mixed $data Data to convert/parse
* @param string $from_type Type to convert from e.g. json, csv, html
*
* @return object Instance of the format class
*/
public function factory($data, $from_type = NULL)
{
// $class = __CLASS__;
// return new $class();
return new static($data, $from_type);
}
// FORMATTING OUTPUT ---------------------------------------------------------
/**
* Format data as an array
*
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @return array Data parsed as an array; otherwise, an empty array
*/
public function to_array($data = NULL)
{
// If no data is passed as a parameter, then use the data passed
// via the constructor
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
// Cast as an array if not already
if (is_array($data) === FALSE)
{
$data = (array) $data;
}
$array = [];
foreach ((array) $data as $key => $value)
{
if (is_object($value) === TRUE || is_array($value) === TRUE)
{
$array[$key] = $this->to_array($value);
}
else
{
$array[$key] = $value;
}
}
return $array;
}
/**
* Format data as XML
*
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @param NULL $structure
* @param string $basenode
* @return mixed
*/
public function to_xml($data = NULL, $structure = NULL, $basenode = 'xml')
{
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
if ($structure === NULL)
{
$structure = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$basenode />");
}
// Force it to be something useful
if (is_array($data) === FALSE && is_object($data) === FALSE)
{
$data = (array) $data;
}
foreach ($data as $key => $value)
{
//change false/true to 0/1
if (is_bool($value))
{
$value = (int) $value;
}
// no numeric keys in our xml please!
if (is_numeric($key))
{
// make string key...
$key = (singular($basenode) != $basenode) ? singular($basenode) : 'item';
}
// replace anything not alpha numeric
$key = preg_replace('/[^a-z_\-0-9]/i', '', $key);
if ($key === '_attributes' && (is_array($value) || is_object($value)))
{
$attributes = $value;
if (is_object($attributes))
{
$attributes = get_object_vars($attributes);
}
foreach ($attributes as $attribute_name => $attribute_value)
{
$structure->addAttribute($attribute_name, $attribute_value);
}
}
// if there is another array found recursively call this function
elseif (is_array($value) || is_object($value))
{
$node = $structure->addChild($key);
// recursive call.
$this->to_xml($value, $node, $key);
}
else
{
// add single node.
$value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
$structure->addChild($key, $value);
}
}
return $structure->asXML();
}
/**
* Format data as HTML
*
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @return mixed
*/
public function to_html($data = NULL)
{
// If no data is passed as a parameter, then use the data passed
// via the constructor
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
// Cast as an array if not already
if (is_array($data) === FALSE)
{
$data = (array) $data;
}
// Check if it's a multi-dimensional array
if (isset($data[0]) && count($data) !== count($data, COUNT_RECURSIVE))
{
// Multi-dimensional array
$headings = array_keys($data[0]);
}
else
{
// Single array
$headings = array_keys($data);
$data = [$data];
}
// Load the table library
$this->_CI->load->library('table');
$this->_CI->table->set_heading($headings);
foreach ($data as $row)
{
// Suppressing the "array to string conversion" notice
// Keep the "evil" @ here
$row = @array_map('strval', $row);
$this->_CI->table->add_row($row);
}
return $this->_CI->table->generate();
}
/**
* @link http://www.metashock.de/2014/02/create-csv-file-in-memory-php/
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @param string $delimiter The optional delimiter parameter sets the field
* delimiter (one character only). NULL will use the default value (,)
* @param string $enclosure The optional enclosure parameter sets the field
* enclosure (one character only). NULL will use the default value (")
* @return string A csv string
*/
public function to_csv($data = NULL, $delimiter = ',', $enclosure = '"')
{
// Use a threshold of 1 MB (1024 * 1024)
$handle = fopen('php://temp/maxmemory:1048576', 'w');
if ($handle === FALSE)
{
return NULL;
}
// If no data is passed as a parameter, then use the data passed
// via the constructor
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
// If NULL, then set as the default delimiter
if ($delimiter === NULL)
{
$delimiter = ',';
}
// If NULL, then set as the default enclosure
if ($enclosure === NULL)
{
$enclosure = '"';
}
// Cast as an array if not already
if (is_array($data) === FALSE)
{
$data = (array) $data;
}
// Check if it's a multi-dimensional array
if (isset($data[0]) && count($data) !== count($data, COUNT_RECURSIVE))
{
// Multi-dimensional array
$headings = array_keys($data[0]);
}
else
{
// Single array
$headings = array_keys($data);
$data = [$data];
}
// Apply the headings
fputcsv($handle, $headings, $delimiter, $enclosure);
foreach ($data as $record)
{
// If the record is not an array, then break. This is because the 2nd param of
// fputcsv() should be an array
if (is_array($record) === FALSE)
{
break;
}
// Suppressing the "array to string conversion" notice.
// Keep the "evil" @ here.
$record = @ array_map('strval', $record);
// Returns the length of the string written or FALSE
fputcsv($handle, $record, $delimiter, $enclosure);
}
// Reset the file pointer
rewind($handle);
// Retrieve the csv contents
$csv = stream_get_contents($handle);
// Close the handle
fclose($handle);
return $csv;
}
/**
* Encode data as json
*
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @return string Json representation of a value
*/
public function to_json($data = NULL)
{
// If no data is passed as a parameter, then use the data passed
// via the constructor
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
// Get the callback parameter (if set)
$callback = $this->_CI->input->get('callback');
if (empty($callback) === TRUE)
{
return json_encode($data);
}
// We only honour a jsonp callback which are valid javascript identifiers
elseif (preg_match('/^[a-z_\$][a-z0-9\$_]*(\.[a-z_\$][a-z0-9\$_]*)*$/i', $callback))
{
// Return the data as encoded json with a callback
return $callback.'('.json_encode($data).');';
}
// An invalid jsonp callback function provided.
// Though I don't believe this should be hardcoded here
$data['warning'] = 'INVALID JSONP CALLBACK: '.$callback;
return json_encode($data);
}
/**
* Encode data as a serialized array
*
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @return string Serialized data
*/
public function to_serialized($data = NULL)
{
// If no data is passed as a parameter, then use the data passed
// via the constructor
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
return serialize($data);
}
/**
* Format data using a PHP structure
*
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
* to the constructor
* @return mixed String representation of a variable
*/
public function to_php($data = NULL)
{
// If no data is passed as a parameter, then use the data passed
// via the constructor
if ($data === NULL && func_num_args() === 0)
{
$data = $this->_data;
}
return var_export($data, TRUE);
}
// INTERNAL FUNCTIONS
/**
* @param string $data XML string
* @return array XML element object; otherwise, empty array
*/
protected function _from_xml($data)
{
return $data ? (array) simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA) : [];
}
/**
* @param string $data CSV string
* @param string $delimiter The optional delimiter parameter sets the field
* delimiter (one character only). NULL will use the default value (,)
* @param string $enclosure The optional enclosure parameter sets the field
* enclosure (one character only). NULL will use the default value (")
* @return array A multi-dimensional array with the outer array being the number of rows
* and the inner arrays the individual fields
*/
protected function _from_csv($data, $delimiter = ',', $enclosure = '"')
{
// If NULL, then set as the default delimiter
if ($delimiter === NULL)
{
$delimiter = ',';
}
// If NULL, then set as the default enclosure
if ($enclosure === NULL)
{
$enclosure = '"';
}
return str_getcsv($data, $delimiter, $enclosure);
}
/**
* @param string $data Encoded json string
* @return mixed Decoded json string with leading and trailing whitespace removed
*/
protected function _from_json($data)
{
return json_decode(trim($data));
}
/**
* @param string $data Data to unserialize
* @return mixed Unserialized data
*/
protected function _from_serialize($data)
{
return unserialize(trim($data));
}
/**
* @param string $data Data to trim leading and trailing whitespace
* @return string Data with leading and trailing whitespace removed
*/
protected function _from_php($data)
{
return trim($data);
}
}

View File

@ -0,0 +1,194 @@
<?php
/**
* JSON Web Token implementation
*
* Minimum implementation used by Realtime auth, based on this spec:
* http://self-issued.info/docs/draft-jones-json-web-token-01.html.
*
* @author Neuman Vong <neuman@twilio.com>
* @minor changes for codeigniter <b3457m0d3@interr0bang.net>
*/
class JWT
{
public static $timestamp = null;
/**
* @param string $jwt The JWT
* @param string|null $key The secret key
* @param bool $verify Don't skip verification process
*
* @return object The JWT's payload as a PHP object
*/
public function decode($jwt, $key = null, $verify = true)
{
$timestamp = is_null(static::$timestamp) ? time() : static::$timestamp;
$tks = explode('.', $jwt);
if (count($tks) != 3) {
throw new UnexpectedValueException('Wrong number of segments');
}
list($headb64, $payloadb64, $cryptob64) = $tks;
if (null === ($header = $this->jsonDecode($this->urlsafeB64Decode($headb64)))
) {
throw new UnexpectedValueException('Invalid segment encoding');
}
if (null === $payload = $this->jsonDecode($this->urlsafeB64Decode($payloadb64))
) {
throw new UnexpectedValueException('Invalid segment encoding');
}
$sig = $this->urlsafeB64Decode($cryptob64);
if ($verify) {
if (empty($header->alg)) {
throw new DomainException('Empty algorithm');
}
if ($sig != $this->sign("$headb64.$payloadb64", $key, $header->alg)) {
throw new UnexpectedValueException('Signature verification failed');
}
}
// Check if the nbf if it is defined. This is the time that the
// token can actually be used. If it's not yet that time, abort.
if (isset($payload->nbf) && $payload->nbf > $timestamp) {
throw new UnexpectedValueException(
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->nbf)
);
}
// Check that this token has been created before 'now'. This prevents
// using tokens that have been created for later use (and haven't
// correctly used the nbf claim).
if (isset($payload->iat) && $payload->iat > $timestamp) {
throw new UnexpectedValueException(
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->iat)
);
}
// Check if this token has expired.
if (isset($payload->exp) && $timestamp >= $payload->exp) {
throw new UnexpectedValueException('Expired token');
}
return $payload;
}
/**
* @param object|array $payload PHP object or array
* @param string $key The secret key
* @param string $algo The signing algorithm
*
* @return string A JWT
*/
public function encode($payload, $key, $algo = 'HS256')
{
$header = array('typ' => 'jwt', 'alg' => $algo);
$segments = array();
$segments[] = $this->urlsafeB64Encode($this->jsonEncode($header));
$segments[] = $this->urlsafeB64Encode($this->jsonEncode($payload));
$signing_input = implode('.', $segments);
$signature = $this->sign($signing_input, $key, $algo);
$segments[] = $this->urlsafeB64Encode($signature);
return implode('.', $segments);
}
/**
* @param string $msg The message to sign
* @param string $key The secret key
* @param string $method The signing algorithm
*
* @return string An encrypted message
*/
public function sign($msg, $key, $method = 'HS256')
{
$methods = array(
'HS256' => 'sha256',
'HS384' => 'sha384',
'HS512' => 'sha512',
);
if (empty($methods[$method])) {
throw new DomainException('Algorithm not supported');
}
return hash_hmac($methods[$method], $msg, $key, true);
}
/**
* @param string $input JSON string
*
* @return object Object representation of JSON string
*/
public function jsonDecode($input)
{
$obj = json_decode($input);
if (function_exists('json_last_error') && $errno = json_last_error()) {
$this->handleJsonError($errno);
}
else if ($obj === null && $input !== 'null') {
throw new DomainException('Null result with non-null input');
}
return $obj;
}
/**
* @param object|array $input A PHP object or array
*
* @return string JSON representation of the PHP object or array
*/
public function jsonEncode($input)
{
$json = json_encode($input);
if (function_exists('json_last_error') && $errno = json_last_error()) {
$this->handleJsonError($errno);
}
else if ($json === 'null' && $input !== null) {
throw new DomainException('Null result with non-null input');
}
return $json;
}
/**
* @param string $input A base64 encoded string
*
* @return string A decoded string
*/
public function urlsafeB64Decode($input)
{
$remainder = strlen($input) % 4;
if ($remainder) {
$padlen = 4 - $remainder;
$input .= str_repeat('=', $padlen);
}
return base64_decode(strtr($input, '-_', '+/'));
}
/**
* @param string $input Anything really
*
* @return string The base64 encode of what you passed in
*/
public function urlsafeB64Encode($input)
{
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
}
/**
* @param int $errno An error number from json_last_error()
*
* @return void
*/
private function handleJsonError($errno)
{
$messages = array(
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
);
throw new DomainException(isset($messages[$errno])
? $messages[$errno]
: 'Unknown JSON error: ' . $errno
);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,67 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Admin_model extends CI_Model {
public function totais($tabela)
{
return $this->db->count_all($tabela);
}
public function getAll_usuarios($tipo)
{
$this->db->select('*');
$this->db->from('usuarios');
$this->db->join('tipo_usuario', 'tipo_usuario.id = usuarios.id_tipo');
$this->db->where('tipo_usuario.descricao',$tipo);
return $this->db->count_all_results();
}
public function getUsuariosInscritos()
{
$this->db->select('DISTINCT(`id_usuario`)');
$this->db->from('eventos_usuario');
return $this->db->get()->num_rows();
}
public function getEventos($id = null)
{
$this->db->select('DISTINCT(e.id), e.descricao, e.vagas, e.inscritos, e.palestrante, e.sala, e.titulo, a.descricao as area, h.descricao as horario, d.descricao as data, t.descricao as tipo, c.descricao as campus');
$this->db->from('eventos e');
$this->db->join('areas a', 'a.id = e.id_area', 'inner');
$this->db->join('horario h', 'h.id = e.id_horario', 'inner');
$this->db->join('dia d', 'd.id = e.id_data', 'inner');
$this->db->join('tipo_evento t', 't.id = e.id_tipo', 'inner');
$this->db->join('campus c', 'c.id = e.id_unidade', 'inner');
if ( $id != null ){
$this->db->where('e.id', $id);
return $this->db->get('eventos')->first_row();
} else {
return $this->db->get('eventos')->result();
}
}
public function getTotalCurso($curso)
{
$this->db->select('DISTINCT(u.id)');
$this->db->from('usuarios u');
$this->db->join('cursos c', 'c.id = u.id_curso', 'inner');
$this->db->where('c.descricao', $curso);
return $this->db->count_all_results();
}
public function lista_usuarios_evento($id_evento)
{
$this->db->select('DISTINCT(b.cpf),b.nome, b.email, b.id as id_usuario, a.presenca, a.id_evento as id_evento');
$this->db->from('eventos_usuario a');
$this->db->join('usuarios b','b.id = a.id_usuario','inner');
$this->db->where('a.id_evento', $id_evento);
$this->db->order_by('nome','ASC');
$query = $this->db->get();
return $query->result();
}
}
/* End of file Admin_model.php */
/* Location: ./application/models/Admin_model.php */

View File

@ -0,0 +1,97 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/13/17
* Time: 8:03 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Branch_model extends CI_Model {
/*
* add branch details
* params:branchcode,branchname,email,address,mobilenumber,activestatus
* created by kms
* */
public function addBranch($arrayDetails=null)
{
$this->db->select('BranchCode');
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
if($this->db->get(BRANCH)->first_row()){
$result['BranchStatus'] = false;
$result['message'] = "This branch code is already exist!";
}
else{
$this->db->insert(BRANCH, $arrayDetails);
if($this->db->affected_rows() == '1'){
$result['branchStatus'] = true;
$result['message'] = "Successfully branch details added";
}
else {
$result['branchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
return $result;
}
/*
* get branch details
* parama id
* created by kms
* */
public function getBranch()
{
$this->db->select('BranchCode,BranchName,LogoPath,MobileNumber,AlternateNumber,LandlineNumber,Address,EmailID,CreatedOn,IsActive');
$this->db->order_by('CreatedOn','DESC');
$branchDetails = $this->db->get(BRANCH);
if($branchDetails->result()){
$result['branchStatus'] = true;
$result['details'] = $branchDetails->result();
}
else {
$result['branchStatus'] = false;
$result['message'] = "No records found!";
}
return $result;
}
/*
* update branch details
* created by kms
* */
public function updateBranch($arrayDetails=null,$branchCode=null)
{
$this->db->where('BranchCode',$branchCode);
$upateStatus=$this->db->update(BRANCH, $arrayDetails);
if($upateStatus){
$result['branchStatus'] = true;
$result['message'] = "Successfully branch details updated";
}
else {
$result['branchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
}

View File

@ -0,0 +1,376 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/15/17
* Time: 5:49 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Calltracking_model extends CI_Model {
/*
* get lead details
* @params mobile number,requestedby
* created by kms
* */
public function getLeadDetails($requestedBy=null,$mobileNumber=null)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = LT.University');
$this->db->join(COURSE.' as CU', 'CU.CourseID = LT.Course');
$this->db->where('LD.MobileNumber',$mobileNumber);
$leadDet=$this->db->get()->last_row();
$result_array = [];
if($leadDet){
$result_array['existLeadDetails']=$leadDet;
}
else{
$leadDet['LeadName']="";
$leadDet['MobileNumber']=$mobileNumber;
$leadDet['IsNewEnquiry']="1";
$leadDet['UniversityID']="";
$leadDet['UniversityName']="";
$leadDet['CourseID']="";
$leadDet['CourseName']="";
$leadDet['ActivityStatus']="";
$leadDet['AssignedTo']="";
$leadDet['StatusCode']="";
$result_array['existLeadDetails']=$leadDet;
}
// store lead,university and course details in comman array
$result_array['universityDetails']=$this->getUniversityDetails();
$result_array['activityDetails']=$this->getActivityDetails();
$result_array['statusDetails']=$this->getStatus();
$result_array['staffDetails']=$this->getStaff("1");
return $result_array;
}
/*
* get university details
* created by kms
* */
public function getUniversityDetails()
{
$this->db->select('UniversityID,UniversityName');
$this->db->order_by('UniversityID','ASC');
$unviversityDetails = $this->db->get(UNIVERSITY);
if($unviversityDetails->result()){
$result_university = array();
foreach ($unviversityDetails->result() as $row)
{
$university_array['universityStatus'] = true;
$university_array['universityID'] = $row->UniversityID;
$university_array['universityName'] = $row->UniversityName;
$university_array['courseDetails']= $this->getCourseDetails($row->UniversityID);
$result_university[]=$university_array;
}
}
else {
$university_array['universityStatus'] = false;
$university_array['message'] = "No records found!";
$university_array['universityID'] = "";
$university_array['universityName'] = "";
$university_array['courseDetails']= "";
$result_university[]=$university_array;
}
return $result_university;
}
/*
* get course details
* @params university id
* created by kms
* */
public function getCourseDetails($universityID=null)
{
$this->db->select('CourseID,CourseName');
$this->db->where('UniversityID',$universityID);
$this->db->order_by('CourseID','ASC');
$courseDetails = $this->db->get(COURSE);
return $courseDetails->result();
}
/*
* get activity details
* created by kms
* */
public function getActivityDetails()
{
$this->db->select('ListCode,ListName');
$this->db->where('ListGroup','2');
$this->db->order_by('ListCode','ASC');
$activity = $this->db->get(PICK_LIST_DETAILS);
return $activity->result();
}
/*
* get status details
* created by kms
* */
public function getStatus()
{
$this->db->select('ListCode,ListName');
$this->db->where('ListCode !=','S003');
$this->db->where('ListGroup','1');
$this->db->order_by('ListCode','ASC');
$status = $this->db->get(PICK_LIST_DETAILS);
return $status->result();
}
/*
* get staff details
* created by kms
*
* */
public function getStaff($status=null)
{
$this->db->select('LO.ID,ST.StaffID,ST.Firstname');
$this->db->from(LOGIN.' as LO');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->where('LO.IsActive',$status);
$staffDetails=$this->db->get();
if($staffDetails){
$result_staff = array();
foreach ($staffDetails->result() as $row)
{
$university_array['loginId'] = $row->ID;
$university_array['staffName'] = $row->StaffID.'-'.$row->Firstname;
$result_staff[]=$university_array;
}
}
else{
$result_staff[]="";
}
return $result_staff;
}
/*
* add lead details
* created by kms
* */
public function addleadDetails($lead_Details=null,$track_Details=null,$followup_Details=null)
{
$this->db->insert(LEAD_DETAILS, $lead_Details);
// this if for insert lead details
if($this->db->affected_rows() == '1'){
// get and store insert id from db
$track_Details['LeadID']=$this->db->insert_id();
$this->db->insert(LEAD_TRACKING, $track_Details);
// this if for insert tracking details
if($this->db->affected_rows() == '1'){
$followup_Details['TrackingID']=$this->db->insert_id();
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details);
// this if for insert follow up details
if($this->db->affected_rows() == '1'){
$result['leadStatus'] = true;
$result['message'] = "Successfully lead details added";
}
else{
$result['leadStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
else{
$result['leadStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
else {
$result['leadStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
/*
* get all tracked details
* created by kms
* */
public function getTrackingDetails($search=null)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,PLD.ListCode,PLD.ListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = LT.University');
$this->db->join(COURSE.' as CU', 'CU.CourseID = LT.Course');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$leadDet=$this->db->get();
if($this->db->affected_rows()==0){
$result_array['trackingStatus']=false;
$result_array['trackingDetails']="";
}
else{
if($leadDet){
$result_array = array();
$result_array['trackingStatus']=true;
foreach ($leadDet->result() as $row)
{
$tracking_array["LeadID"]=$row->LeadID;
$tracking_array["LeadName"]=$row->LeadName;
$tracking_array["MobileNumber"]=$row->MobileNumber;
$tracking_array["IsNewEnquiry"]=$row->IsNewEnquiry;
$tracking_array["TrackingID"]=$row->TrackingID;
$tracking_array["ActivityStatus"]=$row->ActivityStatus;
$tracking_array["AssignedTo"]=$row->AssignedTo;
$tracking_array["Firstname"]=$row->Firstname;
$tracking_array["StatusCode"]=$row->StatusCode;
$tracking_array["statusListName"]=$row->statusListName;
$tracking_array["UniversityID"]=$row->UniversityID;
$tracking_array["UniversityName"]=$row->UniversityName;
$tracking_array["CourseID"]=$row->CourseID;
$tracking_array["CourseName"]=$row->CourseName;
$tracking_array["ListCode"]=$row->ListCode;
$tracking_array["ListName"]=$row->ListName;
$tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
$result_array['statusDetails']=$this->getStatus();
$result_array['trackingDetails']=$result;
}
}
return $result_array;
}
/*
* get tracking followup Details
* @params tracking id
* created by kms
* */
public function getTrackingFollowup($trackingId=null)
{
$this->db->select('InteractionId,TrackingID,FollowupOn,FollowupComments,CreatedOn');
$this->db->where('TrackingID',$trackingId);
$this->db->order_by('InteractionId','DESC');
$trackingDetails = $this->db->get(LEAD_TRACKING_FOLLOWUP);
return $trackingDetails->result();
}
/*
* update followup details
* created by kms
* */
public function updateFollowupDetails($updateDetails=null,$insertDetails=null)
{
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertDetails);
// this if for insert follow up details
if($this->db->affected_rows() == '1'){
$this->db->where('TrackingID',$updateDetails['TrackingID']);
$upateStatus=$this->db->update(LEAD_TRACKING, $updateDetails);
$result['followupStatus'] = true;
$result['trackingID'] = $updateDetails['TrackingID'];
$result['message'] = "Successfully followup details added";
}
else{
$result['followupStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
/*
* get tracking information when page is loading
* created by kms
* */
public function getLoadFollowupDetails($trackingID)
{
$this->db->select('LD.LeadID,LD.LeadName,LD.MobileNumber,LD.IsNewEnquiry,LT.TrackingID,LT.ActivityStatus,LT.AssignedTo,LT.StatusCode,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,ST.StaffID,ST.Firstname,PLD1.ListCode as statusListCode,PLD1.ListName as statusListName,PLD.ListCode,PLD.ListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = LT.University');
$this->db->join(COURSE.' as CU', 'CU.CourseID = LT.Course');
$this->db->join(LOGIN.' as LO', 'LO.ID = LT.AssignedTo');
$this->db->join(STAFF.' as ST', 'ST.StaffID = LO.StaffID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LT.TrackingID',$trackingID['TrackingID']);
$leadDet=$this->db->get();
if($leadDet){
$result_array = array();
$result_array['followupStatus']=true;
foreach ($leadDet->result() as $row)
{
$tracking_array["LeadID"]=$row->LeadID;
$tracking_array["LeadName"]=$row->LeadName;
$tracking_array["MobileNumber"]=$row->MobileNumber;
$tracking_array["IsNewEnquiry"]=$row->IsNewEnquiry;
$tracking_array["TrackingID"]=$row->TrackingID;
$tracking_array["ActivityStatus"]=$row->ActivityStatus;
$tracking_array["AssignedTo"]=$row->AssignedTo;
$tracking_array["Firstname"]=$row->Firstname;
$tracking_array["StatusCode"]=$row->StatusCode;
$tracking_array["statusListName"]=$row->statusListName;
$tracking_array["UniversityID"]=$row->UniversityID;
$tracking_array["UniversityName"]=$row->UniversityName;
$tracking_array["CourseID"]=$row->CourseID;
$tracking_array["CourseName"]=$row->CourseName;
$tracking_array["ListCode"]=$row->ListCode;
$tracking_array["ListName"]=$row->ListName;
$tracking_array["followupDetails"]=$this->getTrackingFollowup($row->TrackingID);
$result[]=$tracking_array;
}
$result_array['trackingDetails']=$result;
$result_array['statusDetails']=$this->getStatus();
$result_array['trackingDetails']=$result;
}
else{
$result_array['followupStatus']=false;
$result_array['trackingDetails']="";
}
return $result_array;
}
}

View File

@ -0,0 +1,452 @@
<?php
/**
* Date: 11/9/17
* Time: 5:28 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Employee_model extends CI_Model
{
/*
* get user login details
* params:email,password
* created by kdk
* */
/*
* get Employee Details, Employee Branch Details
*/
// get single employee details
public function get_emp_detail($empLoginID = null)
{
$this->db->select('StaffID');
$this->db->from(LOGIN);
$this->db->where('ID', $empLoginID);
$loginEmpDetail = $this->db->get()->first_row();
if ($loginEmpDetail) {
$EmpId = $loginEmpDetail->StaffID;
$this->db->select('t1.*');
$this->db->from('' . STAFF . ' as t1');
$this->db->where('t1.StaffID', $EmpId);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$responseDetails = $this->db->get()->first_row();
$result['empStatus'] = true;
// print_r($result['details']);exit();
if ($responseDetails->ListCode == SUPER_ADMIN) {
// print_r($result['details']->ListCode);exit();
// get branch details for super admin
$responseDetails->BranchCode = 'All';
$result['details'] = $responseDetails;
// print_r($result['details']);exit();
$this->db->select('t3.BranchCode, t3.BranchName');
$this->db->from('' . STAFF_BRANCH . ' as t2');
$this->db->where('t2.StaffID', $EmpId);
$this->db->where('t2.IsActive', 1);
$this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT');
$this->db->where('t3.IsActive', 1);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$branchDetails = $this->db->get();
$getArrs = $branchDetails->result();
$SS['BranchCode'] = 'All';
$SS['BranchName'] = 'All';
array_push($getArrs, $SS);
// print_r($getArrs);exit();
$result['branchStatus'] = true;
$result['branch_details'] = $getArrs;
} else {
// get branch details for admin & staff
$result['details'] = $responseDetails;
$this->db->select('t3.BranchCode, t3.BranchName');
$this->db->from('' . STAFF_BRANCH . ' as t2');
$this->db->where('t2.StaffID', $EmpId);
$this->db->where('t2.IsActive', 1);
$this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT');
$this->db->where('t3.IsActive', 1);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$branchDetails = $this->db->get();
$result['branchStatus'] = true;
$result['branch_details'] = $branchDetails->result();
}
} else {
$result['empStatus'] = false;
$result['message'] = "Something Went Wrong, Please try Again !!";
}
return $result;
}
// get employee list based on login user
public function get_employee_list($loginUserId, $loginUserBranchId, $loginUserType)
{
// echo $loginUserId, $loginUserBranchId, $loginUserType; exit();
if ($loginUserType == SUPER_ADMIN) {
// list for super admin
if ($loginUserBranchId == 'All') {
// for getting all branch details
$staffId = $this->selfGetEmpId($loginUserId);
$this->db->select('*');
$this->db->order_by('CreatedOn', 'DESC');
$this->db->from(STAFF);
// not for SuperAdmin and Student Role code
$this->db->where_not_in('StaffID', $staffId);
// $this->db->where('BranchCode', $loginUserBranchId);
$empDetails = $this->db->get();
$checkArr = $empDetails->result();
if (count($checkArr) > 0) {
$results['employeeList'] = true;
$results['employees_details'] = $empDetails->result();
} else {
$results['employeeList'] = false;
$results['message'] = 'No record found';
}
} else {
$staffId = $this->selfGetEmpId($loginUserId);
$this->db->select('*');
$this->db->order_by('CreatedOn', 'DESC');
$this->db->from(STAFF);
// not for SuperAdmin and Student Role code
$this->db->where_not_in('StaffID', $staffId);
$this->db->where('BranchCode', $loginUserBranchId);
$empDetails = $this->db->get();
$checkArr = $empDetails->result();
if (count($checkArr) > 0) {
$results['employeeList'] = true;
$results['employees_details'] = $empDetails->result();
} else {
$results['employeeList'] = false;
$results['message'] = 'No record found';
}
}
} else if ($loginUserType == ADMIN) {
// list for admin
$staffId = $this->selfGetEmpId($loginUserId);
$this->db->select('*');
$this->db->from(STAFF);
$this->db->order_by('CreatedOn', 'DESC');
// not for SuperAdmin and Student Role code
$this->db->where_not_in('StaffID', $staffId);
$this->db->where('BranchCode', $loginUserBranchId);
$this->db->where('ListCode', EMPLOYEE);
$empDetails = $this->db->get();
$checkArr = $empDetails->result();
if (count($checkArr) > 0) {
$results['employeeList'] = true;
$results['employees_details'] = $empDetails->result();
} else {
$results['employeeList'] = false;
}
} else {
$results['employeeList'] = false;
}
return $results;
}
// get role details based on login user
public function get_req_role_detail($reqRoleId)
{
// echo $reqRoleId;exit();
if ($reqRoleId == SUPER_ADMIN) {
// res for SuperAdmin
$this->db->select('ListCode, ListName');
$this->db->from(PICK_LIST_DETAILS);
// not for SuperAdmin and Student Role code
$this->db->where_not_in('ListCode', $reqRoleId);
$this->db->where_not_in('ListCode', 'R001');
// end : not for SuperAdmin and Student Role code
$this->db->where('ListGroup', 0);
$this->db->where('IsActive', 1);
$roleDetails = $this->db->get();
$result['RoleDetailStatus'] = true;
$result['role_details'] = $roleDetails->result();
} else {
// res for Admin
$this->db->select('ListCode, ListName');
$this->db->from(PICK_LIST_DETAILS);
// not for SuperAdmin and Admin and Student Role code
$this->db->where_not_in('ListCode', $reqRoleId);
$this->db->where_not_in('ListCode', 'R001');
$this->db->where_not_in('ListCode', 'R004');
// end : not for SuperAdmin and Admin and Student Role code
$this->db->where('ListGroup', 0);
$this->db->where('IsActive', 1);
$roleDetails = $this->db->get();
$result['RoleDetailStatus'] = true;
$result['role_details'] = $roleDetails->result();
}
return $result;
}
// get branch details based on login user
public function get_req_master_branch_detail($reqRoleId, $reqUserID)
{
if ($reqRoleId == SUPER_ADMIN) {
// res for SuperAdmin
$this->db->select('BranchCode, BranchName');
$this->db->from(BRANCH);
$this->db->where('IsActive', 1);
$mBranchDetails = $this->db->get();
$results['MeasterBranchDetailStatus'] = true;
$results['branch_details'] = $mBranchDetails->result();
} else {
// res for Admin
$staffId = $this->selfGetEmpId($reqUserID);
$subQuery = "SELECT t1.BranchCode, t1.BranchName
FROM T_BranchMaster as t1
LEFT JOIN T_Staff_BranchAccess as t2 ON t2.StaffID = '$staffId'
WHERE t2.BranchCode = t1.BranchCode
AND t1.IsActive = 1
AND t2.IsActive = 1";
$mBranchDetails = $this->db->query($subQuery);
$results['MeasterBranchDetailStatus'] = true;
$results['branch_details'] = $mBranchDetails->result();
}
return $results;
}
// check exist
public function check_exist($data, $checkData)
{
if ($checkData == 'employeeId') {
// check for employee id
$this->db->select('*');
$this->db->from(STAFF);
$this->db->where('StaffID', $data);
if ($this->db->get()->first_row()) {
$result['existEmpId'] = true;
$result['message'] = "This Employee ID is already exist!";
} else {
$result['existEmpId'] = false;
}
} else if ($checkData == 'mobileNumber') {
// check for mobile number
$this->db->select('*');
$this->db->from(STAFF);
$this->db->where('MobileNumber', $data);
if ($this->db->get()->first_row()) {
$result['existMobile'] = true;
$result['message'] = "This Mobile Number is already exist!";
} else {
$result['existMobile'] = false;
}
} else if ($checkData == 'emailId') {
// check for email id
$this->db->select('*');
$this->db->from(STAFF);
$this->db->where('EmailID', $data);
if ($this->db->get()->first_row()) {
$result['existEmailId'] = true;
$result['message'] = "This EmailId is already exist!";
} else {
$result['existEmailId'] = false;
}
} else {
}
return $result;
}
// add employee
public function add_employee($empArr, $createdBy)
{
$this->db->insert(STAFF, $empArr);
if ($this->db->affected_rows() == '1') {
$branchArr['StaffID'] = $empArr['StaffID'];
$branchArr['BranchCode'] = $empArr['BranchCode'];
$branchArr['IsActive'] = $empArr['IsActive'];
$branchArr['CreatedBy'] = $createdBy;
$this->db->insert(STAFF_BRANCH, $branchArr);
if ($this->db->affected_rows() == '1') {
$loginArr['StaffID'] = $empArr['StaffID'];
$loginArr['ListCode'] = $empArr['ListCode'];
$loginArr['MobileNumber'] = $empArr['MobileNumber'];
$loginArr['EmailId'] = $empArr['EmailID'];
$loginArr['IsActive'] = $empArr['IsActive'];
$loginArr['CreatedBy'] = $createdBy;
$loginArr['Password'] = ENCR_PASSWORD;
$this->db->insert(LOGIN, $loginArr);
if ($this->db->affected_rows() == '1') {
$result['addEmpStatus'] = true;
$result['message'] = "Successfully employee details added";
} else {
$result['addEmpStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
} else {
$result['addEmpStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
} else {
$result['addEmpStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
// check existing data while update
public function check_update_exist($exceptId, $datas, $checkFor)
{
if ($checkFor == 'mobileNumber') {
// check update for mobile number
$this->db->select('*');
$this->db->from(STAFF);
$this->db->where('MobileNumber', $datas);
$this->db->where_not_in('StaffID', $exceptId);
if ($this->db->get()->first_row()) {
$result['existMobile'] = true;
$this->db->select('MobileNumber');
$this->db->from(STAFF);
$this->db->where('StaffID', $exceptId);
$result['resetValue'] = $this->db->get()->first_row();
$result['message'] = "This Mobile Number is already exist!";
} else {
$result['existMobile'] = false;
}
} else if ($checkFor == 'emailId') {
// check update for email
$this->db->select('*');
$this->db->from(STAFF);
$this->db->where('EmailID', $datas);
$this->db->where_not_in('StaffID', $exceptId);
if ($this->db->get()->first_row()) {
$result['existEmailId'] = true;
$this->db->select('EmailID');
$this->db->from(STAFF);
$this->db->where('StaffID', $exceptId);
$result['resetValue'] = $this->db->get()->first_row();
$result['message'] = "This EmailId is already exist!";
} else {
$result['existEmailId'] = false;
}
} else {
}
return $result;
}
// update employee personal details
public function update_employee($empArr, $updateFor)
{
$this->db->where('StaffID', $updateFor);
$this->db->update(STAFF, $empArr);
if ($this->db->affected_rows() == '1') {
$result['updateEmpStatus'] = true;
$result['message'] = "Successfully employee details Udated";
// $branchArr['BranchCode'] = $empArr['BranchCode'];
// $branchArr['IsActive'] = $empArr['IsActive'];
// $branchArr['CreatedBy'] = $createdBy;
// $this->db->where('StaffID',$updateFor);
// $this->db->insert(STAFF_BRANCH, $branchArr);
// if($this->db->affected_rows() == '1'){
// $loginArr['StaffID'] = $empArr['StaffID'];
// $loginArr['ListCode'] = $empArr['ListCode'];
// $loginArr['MobileNumber'] = $empArr['MobileNumber'];
// $loginArr['EmailId'] = $empArr['EmailID'];
// $loginArr['IsActive'] = $empArr['IsActive'];
// $loginArr['CreatedBy'] = $createdBy;
// $loginArr['Password'] = ENCR_PASSWORD;
// $this->db->insert(LOGIN, $loginArr);
// if($this->db->affected_rows() == '1'){
// $result['addEmpStatus'] = true;
// $result['message'] = "Successfully employee details added";
// } else {
// $result['addEmpStatus'] = false;
// $result['message'] = "Something went wrong.please try again";
// }
// } else {
// $result['addEmpStatus'] = false;
// $result['message'] = "Something went wrong.please try again";
// }
} else {
$result['updateEmpStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
// get employee branch details
public function get_employee_branch($staffId)
{
$this->db->select('t1.BranchCode, t1.BranchName');
$this->db->from('' . BRANCH . ' as t1');
$this->db->join('' . STAFF_BRANCH . ' as t2', 't2.BranchCode = t1.BranchCode', 'LEFT');
$this->db->where('t2.StaffID', $staffId);
$this->db->where('t2.IsActive', 1);
$this->db->where('t1.IsActive', 1);
$branchDetails = $this->db->get();
$checkArr = $branchDetails->result();
if (count($checkArr) > 0) {
$this->db->select('t3.ListCode, t3.ListName');
$this->db->from('' . PICK_LIST_DETAILS . ' as t3');
$this->db->join('' . STAFF . ' as t4', 't4.ListCode = t3.ListCode', 'LEFT');
$this->db->where('t4.StaffID', $staffId);
$roleDetails = $this->db->get();
$result['empBranchDetails'] = true;
$result['role_details'] = $roleDetails->result();
$result['branch_details'] = $branchDetails->result();
} else {
$result['empBranchDetails'] = false;
}
return $result;
}
// update employee branch details
public function upate_employee_branch($empFor, $reqBanch, $req)
{
$this->db->where('StaffID', $empFor);
$this->db->update(STAFF, $req);
// update role to staff table
if ($this->db->affected_rows() == '1') {
$this->db->where('StaffID', $empFor);
$this->db->update(LOGIN, $req);
// echo $this->db->affected_rows();exit();
// update role to login table
if ($this->db->affected_rows() == '1') {
// $this->db->where('StaffID', "'$empFor'");
// $this->db->update(STAFF, $reqBanch);
$branchCode = $reqBanch['BranchCode'];
$sql = "UPDATE ".STAFF." SET BranchCode='$branchCode' WHERE StaffID='$empFor'";
// update branch to staff table
if ($this->db->query($sql) == '1') {
// $this->db->where('StaffID', $empFor);
// $this->db->update(STAFF_BRANCH, $reqBanch);
$sql1 = "UPDATE ".STAFF_BRANCH." SET BranchCode='$branchCode' WHERE StaffID='$empFor'";
// update branch to staff_branch table
if ($this->db->query($sql1) == '1') {
$result['updateEmpbranchStatus'] = true;
$result['message'] = "Successfully employee branch details Updated";
} else {
$result['updateEmpbranchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
} else {
$result['updateEmpbranchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
} else {
$result['updateEmpbranchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
} else {
$result['updateEmpbranchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
public function selfGetEmpId($sID)
{
$this->db->select('StaffID');
$this->db->from(LOGIN);
$this->db->where('ID', $sID);
$roleDetails = $this->db->get()->first_row();
return $roleDetails->StaffID;
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/9/17
* Time: 5:28 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Login_model extends CI_Model
{
/*
* get user login details
* params:email,password
* created by karthi
* */
/*
* Default login venba@123 -> 7594aacdb21d8a9b29f71ea9163a5730
*/
public function login($mobile = null, $password = null)
{
$this->db->select('t1.MobileNumber, t1.Password');
$this->db->from('' . LOGIN . ' as t1');
$this->db->where('t1.MobileNumber', $mobile);
$this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$this->db->where('t1.IsActive', 1);
$this->db->where('t2.IsActive', 1);
$loginDetails = $this->db->get(LOGIN)->first_row();
if ($loginDetails) {
if ($mobile == $loginDetails->MobileNumber) {
if ($password == $loginDetails->Password) {
//print_r($loginDetails);exit();
$this->db->select('t1.MobileNumber, t1.ListCode, t1.ID, t2.BranchCode');
$this->db->from('' . LOGIN . ' as t1');
$this->db->where('t1.MobileNumber', $mobile);
$this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$responseDetails = $this->db->get()->first_row();
if ($responseDetails->ListCode == SUPER_ADMIN) {
// For First time Super admin login, will set all branch detail
$result['loginStatus'] = true;
$responseDetails->BranchCode = 'All';
$result['details'] = $responseDetails;
} else {
$result['loginStatus'] = true;
$result['details'] = $responseDetails;
}
} else {
$result['loginStatus'] = false;
$result['message'] = "Please Enter Valid Password !!";
}
} else {
$result['loginStatus'] = false;
$result['message'] = "Please Enter Register Mobile Number !!";
}
} else {
$result['loginStatus'] = false;
$result['message'] = "Something Went Wrong, Please try Again !!";
}
/*$this->db->join('areas a', 'a.id = e.id_area', 'inner');
$this->db->join('horario h', 'h.id = e.id_horario', 'inner');
$this->db->join('dia d', 'd.id = e.id_data', 'inner');
$this->db->join('tipo_evento t', 't.id = e.id_tipo', 'inner');
$this->db->join('campus c', 'c.id = e.id_unidade', 'inner');
if ( $id != null ){
$this->db->where('e.id', $id);
return $this->db->get('eventos')->first_row();
} else {
return $this->db->get('eventos')->result();
}*/
return $result;
}
}

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nDatabase error: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
An uncaught Exception was encountered
Type: <?php echo get_class($exception), "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $exception->getFile(), "\n"; ?>
Line Number: <?php echo $exception->getLine(); ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
A PHP Error was encountered
Severity: <?php echo $severity, "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $filepath, "\n"; ?>
Line Number: <?php echo $line; ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Database Error</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@ -0,0 +1,32 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>An uncaught Exception was encountered</h4>
<p>Type: <?php echo get_class($exception); ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $exception->getFile(); ?></p>
<p>Line Number: <?php echo $exception->getLine(); ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file']; ?><br />
Line: <?php echo $error['line']; ?><br />
Function: <?php echo $error['function']; ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

View File

@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file'] ?><br />
Line: <?php echo $error['line'] ?><br />
Function: <?php echo $error['function'] ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,222 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>REST Server Tests</title>
<style>
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #FFF;
margin: 40px;
font: 16px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
word-wrap: break-word;
}
a {
color: #039;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 24px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 16px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#body {
margin: 0 15px 0 15px;
}
p.footer {
text-align: right;
font-size: 16px;
border-top: 1px solid #D0D0D0;
line-height: 32px;
padding: 0 10px 0 10px;
margin: 20px 0 0 0;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
</style>
</head>
<body>
<div id="container">
<h1>REST Server Tests</h1>
<div id="body">
<h2><a href="<?php echo site_url(); ?>">Home</a></h2>
<p>
See the article
<a href="http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/" target="_blank">
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
</a>
</p>
<p>
The master project repository is
<a href="https://github.com/chriskacerguis/codeigniter-restserver" target="_blank">
https://github.com/chriskacerguis/codeigniter-restserver
</a>
</p>
<p>
Click on the links to check whether the REST server is working.
</p>
<ol>
<li><a href="<?php echo site_url('api/example/users'); ?>">Users</a> - defaulting to JSON</li>
<li><a href="<?php echo site_url('api/example/users/format/csv'); ?>">Users</a> - get it in CSV</li>
<li><a href="<?php echo site_url('api/example/users/id/1'); ?>">User #1</a> - defaulting to JSON (users/id/1)</li>
<li><a href="<?php echo site_url('api/example/users/1'); ?>">User #1</a> - defaulting to JSON (users/1)</li>
<li><a href="<?php echo site_url('api/example/users/id/1.xml'); ?>">User #1</a> - get it in XML (users/id/1.xml)</li>
<li><a href="<?php echo site_url('api/example/users/id/1/format/xml'); ?>">User #1</a> - get it in XML (users/id/1/format/xml)</li>
<li><a href="<?php echo site_url('api/example/users/id/1?format=xml'); ?>">User #1</a> - get it in XML (users/id/1?format=xml)</li>
<li><a href="<?php echo site_url('api/example/users/1.xml'); ?>">User #1</a> - get it in XML (users/1.xml)</li>
<li><a id="ajax" href="<?php echo site_url('api/example/users/format/json'); ?>">Users</a> - get it in JSON (AJAX request)</li>
<li><a href="<?php echo site_url('api/example/users.html'); ?>">Users</a> - get it in HTML (users.html)</li>
<li><a href="<?php echo site_url('api/example/users/format/html'); ?>">Users</a> - get it in HTML (users/format/html)</li>
<li><a href="<?php echo site_url('api/example/users?format=html'); ?>">Users</a> - get it in HTML (users?format=html)</li>
</ol>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>'.CI_VERSION.'</strong>' : '' ?></p>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.js"></script>
<script>
// Create an 'App' namespace
var App = App || {};
// Basic rest module using an IIFE as a way of enclosing private variables
App.rest = (function restModule(window) {
// Fields
var _alert = window.alert;
var _JSON = window.JSON;
// Cache the jQuery selector
var _$ajax = null;
// Cache the jQuery object
var $ = null;
// Methods (private)
/**
* Called on Ajax done
*
* @return {undefined}
*/
function _ajaxDone(data) {
// The 'data' parameter is an array of objects that can be iterated over
_alert(_JSON.stringify(data, null, 2));
}
/**
* Called on Ajax fail
*
* @return {undefined}
*/
function _ajaxFail() {
_alert('Oh no! A problem with the Ajax request!');
}
/**
* On Ajax request
*
* @param {jQuery} $element Current element selected
* @return {undefined}
*/
function _ajaxEvent($element) {
$.ajax({
// URL from the link that was 'clicked' on
url: $element.attr('href')
})
.done(_ajaxDone)
.fail(_ajaxFail);
}
/**
* Bind events
*
* @return {undefined}
*/
function _bindEvents() {
// Namespace the 'click' event
_$ajax.on('click.app.rest.module', function (event) {
event.preventDefault();
// Pass this to the Ajax event function
_ajaxEvent($(this));
});
}
/**
* Cache the DOM node(s)
*
* @return {undefined}
*/
function _cacheDom() {
_$ajax = $('#ajax');
}
// Public API
return {
/**
* Initialise the following module
*
* @param {object} jQuery Reference to jQuery
* @return {undefined}
*/
init: function init(jQuery) {
$ = jQuery;
// Cache the DOM and bind event(s)
_cacheDom();
_bindEvents();
}
};
}(window));
// DOM ready event
$(function domReady($) {
// Initialise the App module
App.rest.init($);
});
</script>
</body>
</html>

View File

@ -0,0 +1,101 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #FFF;
margin: 40px;
font: 16px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
word-wrap: break-word;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 24px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 16px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#body {
margin: 0 15px 0 15px;
}
p.footer {
text-align: right;
font-size: 16px;
border-top: 1px solid #D0D0D0;
line-height: 32px;
padding: 0 10px 0 10px;
margin: 20px 0 0 0;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
</style>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<h2><a href="<?php echo site_url('rest-server'); ?>">REST Server Tests</a></h2>
<?php if (file_exists(FCPATH.'documentation/index.html')) : ?>
<h2><a href="<?php echo base_url('documentation/index.html'); ?>" target="_blank">REST Server Documentation</a></h2>
<?php endif ?>
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/Welcome.php</code>
<?php if (file_exists(FCPATH.'user_guide/index.html')) : ?>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="<?php echo base_url('user_guide/index.html'); ?>" target="_blank">User Guide</a>.</p>
<?php endif ?>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>'.CI_VERSION.'</strong>' : '' ?></p>
</div>
</body>
</html>

22
Apollo/api/composer.json Normal file
View File

@ -0,0 +1,22 @@
{
"description": "The CodeIgniter framework",
"name": "codeigniter/framework",
"type": "project",
"homepage": "https://codeigniter.com",
"license": "MIT",
"support": {
"forum": "http://forum.codeigniter.com/",
"wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
"irc": "irc://irc.freenode.net/codeigniter",
"source": "https://github.com/bcit-ci/CodeIgniter"
},
"require": {
"php": ">=5.2.4"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"
},
"require-dev": {
"mikey179/vfsStream": "1.1.*"
}
}

51
Apollo/api/composer.lock generated Normal file
View File

@ -0,0 +1,51 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "425582499c09ce5b5eebb2abb6dc2111",
"content-hash": "163eb4764cfceda4201e2d993dd1e79d",
"packages": [],
"packages-dev": [
{
"name": "mikey179/vfsStream",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/mikey179/vfsStream.git",
"reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mikey179/vfsStream/zipball/fc0fe8f4d0b527254a2dc45f0c265567c881d07e",
"reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"org\\bovigo\\vfs": "src/main/php"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD"
],
"homepage": "http://vfs.bovigo.org/",
"time": "2012-08-25 12:49:29"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.2.4"
},
"platform-dev": []
}

327
Apollo/api/index.php Normal file
View File

@ -0,0 +1,327 @@
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
*
* 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.
*
* 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.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/
/*
|---------------------------------------------------------------
| DEFAULT TIMEZONE
|---------------------------------------------------------------
|
| Set the default timezone for date/time functions to use if
| none is set on the server.
|
*/
setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Fortaleza');
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*/
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
*---------------------------------------------------------------
*
* Different environments will require different levels of error reporting.
* By default development will show errors but testing and live will hide them.
*/
switch (ENVIRONMENT)
{
case 'development':
error_reporting(-1);
ini_set('display_errors', 1);
break;
case 'testing':
case 'production':
ini_set('display_errors', 0);
if (version_compare(PHP_VERSION, '5.3', '>='))
{
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
}
else
{
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
}
break;
default:
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'The application environment is not set correctly.';
exit(1); // EXIT_ERROR
}
/*
*---------------------------------------------------------------
* SYSTEM DIRECTORY NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" directory.
* Set the path if it is not in the same directory as this file.
*/
$system_path = 'system';
/*
*---------------------------------------------------------------
* APPLICATION DIRECTORY NAME
*---------------------------------------------------------------
*
* If you want this front controller to use a different "application"
* directory than the default one you can set its name here. The directory
* can also be renamed or relocated anywhere on your server. If you do,
* use an absolute (full) server path.
* For more info please see the user guide:
*
* https://codeigniter.com/user_guide/general/managing_apps.html
*
* NO TRAILING SLASH!
*/
$application_folder = 'application';
/*
*---------------------------------------------------------------
* VIEW DIRECTORY NAME
*---------------------------------------------------------------
*
* If you want to move the view directory out of the application
* directory, set the path to it here. The directory can be renamed
* and relocated anywhere on your server. If blank, it will default
* to the standard location inside your application directory.
* If you do move this, use an absolute (full) server path.
*
* NO TRAILING SLASH!
*/
$view_folder = '';
/*
* --------------------------------------------------------------------
* DEFAULT CONTROLLER
* --------------------------------------------------------------------
*
* Normally you will set your default controller in the routes.php file.
* You can, however, force a custom routing by hard-coding a
* specific controller class/function here. For most applications, you
* WILL NOT set your routing here, but it's an option for those
* special instances where you might want to override the standard
* routing in a specific front controller that shares a common CI installation.
*
* IMPORTANT: If you set the routing here, NO OTHER controller will be
* callable. In essence, this preference limits your application to ONE
* specific controller. Leave the function name blank if you need
* to call functions dynamically via the URI.
*
* Un-comment the $routing array below to use this feature
*/
// The directory name, relative to the "controllers" directory. Leave blank
// if your controller is not in a sub-directory within the "controllers" one
// $routing['directory'] = '';
// The controller class file name. Example: mycontroller
// $routing['controller'] = '';
// The controller function you wish to be called.
// $routing['function'] = '';
/*
* -------------------------------------------------------------------
* CUSTOM CONFIG VALUES
* -------------------------------------------------------------------
*
* The $assign_to_config array below will be passed dynamically to the
* config class when initialized. This allows you to set custom config
* items or override any default config values found in the config.php file.
* This can be handy as it permits you to share one application between
* multiple front controller files, with each file containing different
* config values.
*
* Un-comment the $assign_to_config array below to use this feature
*/
// $assign_to_config['name_of_config_item'] = 'value of config item';
// --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
/*
* ---------------------------------------------------------------
* Resolve the system path for increased reliability
* ---------------------------------------------------------------
*/
// Set the current directory correctly for CLI requests
if (defined('STDIN'))
{
chdir(dirname(__FILE__));
}
if (($_temp = realpath($system_path)) !== FALSE)
{
$system_path = $_temp.DIRECTORY_SEPARATOR;
}
else
{
// Ensure there's a trailing slash
$system_path = strtr(
rtrim($system_path, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
).DIRECTORY_SEPARATOR;
}
// Is the system path correct?
if ( ! is_dir($system_path))
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
exit(3); // EXIT_CONFIG
}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// Path to the system directory
define('BASEPATH', $system_path);
// Path to the front controller (this file) directory
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
// Name of the "system" directory
define('SYSDIR', basename(BASEPATH));
// The path to the "application" directory
if (is_dir($application_folder))
{
if (($_temp = realpath($application_folder)) !== FALSE)
{
$application_folder = $_temp;
}
else
{
$application_folder = strtr(
rtrim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
}
}
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
{
$application_folder = BASEPATH.strtr(
trim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
}
else
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
exit(3); // EXIT_CONFIG
}
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
// The path to the "views" directory
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
{
$view_folder = APPPATH.'views';
}
elseif (is_dir($view_folder))
{
if (($_temp = realpath($view_folder)) !== FALSE)
{
$view_folder = $_temp;
}
else
{
$view_folder = strtr(
rtrim($view_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
}
}
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
{
$view_folder = APPPATH.strtr(
trim($view_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
);
}
else
{
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
exit(3); // EXIT_CONFIG
}
define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
/*
* --------------------------------------------------------------------
* LOAD THE BOOTSTRAP FILE
* --------------------------------------------------------------------
*
* And away we go...
*/
require_once BASEPATH.'core/CodeIgniter.php';

View File

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

View File

@ -0,0 +1,133 @@
<?php
/**
* CodeIgniter
*
* An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
*
* 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.
*
* 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.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Benchmark Class
*
* This class enables you to mark points and calculate the time difference
* between them. Memory consumption can also be displayed.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
*/
class CI_Benchmark {
/**
* List of all benchmark markers
*
* @var array
*/
public $marker = array();
/**
* Set a benchmark marker
*
* Multiple calls to this function can be made so that several
* execution points can be timed.
*
* @param string $name Marker name
* @return void
*/
public function mark($name)
{
$this->marker[$name] = microtime(TRUE);
}
// --------------------------------------------------------------------
/**
* Elapsed time
*
* Calculates the time difference between two marked points.
*
* If the first parameter is empty this function instead returns the
* {elapsed_time} pseudo-variable. This permits the full system
* execution time to be shown in a template. The output class will
* swap the real value for this variable.
*
* @param string $point1 A particular marked point
* @param string $point2 A particular marked point
* @param int $decimals Number of decimal places
*
* @return string Calculated elapsed time on success,
* an '{elapsed_string}' if $point1 is empty
* or an empty string if $point1 is not found.
*/
public function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
{
if ($point1 === '')
{
return '{elapsed_time}';
}
if ( ! isset($this->marker[$point1]))
{
return '';
}
if ( ! isset($this->marker[$point2]))
{
$this->marker[$point2] = microtime(TRUE);
}
return number_format($this->marker[$point2] - $this->marker[$point1], $decimals);
}
// --------------------------------------------------------------------
/**
* Memory Usage
*
* Simply returns the {memory_usage} marker.
*
* This permits it to be put it anywhere in a template
* without the memory being calculated until the end.
* The output class will swap the real value for this variable.
*
* @return string '{memory_usage}'
*/
public function memory_usage()
{
return '{memory_usage}';
}
}

Some files were not shown because too many files have changed in this diff Show More