Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
system/
|
||||
storage/logs/*
|
||||
!storage/logs/index.html
|
||||
1
application/.htaccess
Normal file
1
application/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
1
application/cache/.htaccess
vendored
Normal file
1
application/cache/.htaccess
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
10
application/cache/index.html
vendored
Normal file
10
application/cache/index.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
116
application/config/autoload.php
Normal file
116
application/config/autoload.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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. Helper files
|
||||
| 4. Custom config files
|
||||
| 5. Language files
|
||||
| 6. Models
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Packges
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
||||
|
|
||||
*/
|
||||
|
||||
$autoload['packages'] = array();
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Libraries
|
||||
| -------------------------------------------------------------------
|
||||
| These are the classes located in the system/libraries folder
|
||||
| or in your application/libraries folder.
|
||||
|
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
|
||||
*/
|
||||
|
||||
$autoload['libraries'] = array();
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Helper Files
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
|
||||
$autoload['helper'] = array();
|
||||
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| 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('model1', 'model2');
|
||||
|
|
||||
*/
|
||||
|
||||
$autoload['model'] = array();
|
||||
|
||||
|
||||
/* End of file autoload.php */
|
||||
/* Location: ./application/config/autoload.php */
|
||||
370
application/config/config.php
Normal file
370
application/config/config.php
Normal file
@@ -0,0 +1,370 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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'] = 'index.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URI PROTOCOL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item determines which server global should be used to retrieve the
|
||||
| URI string. The default setting of 'AUTO' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'AUTO' Default - auto detects
|
||||
| 'PATH_INFO' Uses the PATH_INFO
|
||||
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||
|
|
||||
*/
|
||||
$config['uri_protocol'] = 'AUTO';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL suffix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||
| For more information please see the user guide:
|
||||
|
|
||||
| http://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.
|
||||
|
|
||||
*/
|
||||
$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:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/core_classes.html
|
||||
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed URL Characters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This lets you specify with a regular expression 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.
|
||||
|
|
||||
| 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'; // experimental not currently in use
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you have enabled error logging, you can set an error threshold to
|
||||
| determine what gets logged. Threshold options are:
|
||||
| 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
|
||||
|
|
||||
| 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/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['log_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| system/cache/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['cache_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class or the Session class you
|
||||
| MUST set an encryption key. See the user guide for info.
|
||||
|
|
||||
*/
|
||||
$config['encryption_key'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_cookie_name' = the name you want for the cookie
|
||||
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
||||
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||
| when the browser window is closed
|
||||
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||
| 'sess_use_database' = Whether to save the session data to a database
|
||||
| 'sess_table_name' = The name of the session database table
|
||||
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
|
|
||||
*/
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_expire_on_close'] = FALSE;
|
||||
$config['sess_encrypt_cookie'] = FALSE;
|
||||
$config['sess_use_database'] = FALSE;
|
||||
$config['sess_table_name'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = TRUE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookie_prefix' = Set a 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' = Cookies will only be set if a secure HTTPS connection exists.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = "";
|
||||
$config['cookie_domain'] = "";
|
||||
$config['cookie_path'] = "/";
|
||||
$config['cookie_secure'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global XSS Filtering
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether the XSS filter is always active when GET, POST or
|
||||
| COOKIE data is encountered
|
||||
|
|
||||
*/
|
||||
$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.
|
||||
*/
|
||||
$config['csrf_protection'] = FALSE;
|
||||
$config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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.
|
||||
|
|
||||
| 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 'gmt'. This pref tells the system whether to use
|
||||
| your server's local time as the master 'now' reference, or convert it to
|
||||
| GMT. 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)
|
||||
|
|
||||
*/
|
||||
$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 the HTTP_X_FORWARDED_FOR
|
||||
| header in order to properly identify the visitor's IP address.
|
||||
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
||||
|
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
||||
|
||||
|
||||
/* End of file config.php */
|
||||
/* Location: ./application/config/config.php */
|
||||
41
application/config/constants.php
Normal file
41
application/config/constants.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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.
|
||||
|
|
||||
*/
|
||||
define('FILE_READ_MODE', 0644);
|
||||
define('FILE_WRITE_MODE', 0666);
|
||||
define('DIR_READ_MODE', 0755);
|
||||
define('DIR_WRITE_MODE', 0777);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Stream Modes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These modes are used when working with fopen()/popen()
|
||||
|
|
||||
*/
|
||||
|
||||
define('FOPEN_READ', 'rb');
|
||||
define('FOPEN_READ_WRITE', 'r+b');
|
||||
define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
define('FOPEN_WRITE_CREATE', 'ab');
|
||||
define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
|
||||
/* End of file constants.php */
|
||||
/* Location: ./application/config/constants.php */
|
||||
69
application/config/database.php
Normal file
69
application/config/database.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['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 type. ie: mysql. Currently supported:
|
||||
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Active Record 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
|
||||
| ['autoinit'] Whether or not to automatically initialize the database.
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $active_record variables lets you determine whether or not to load
|
||||
| the active record class
|
||||
*/
|
||||
|
||||
$active_group = 'default';
|
||||
$active_record = TRUE;
|
||||
|
||||
$db['default']['hostname'] = 'localhost';
|
||||
$db['default']['username'] = '';
|
||||
$db['default']['password'] = '';
|
||||
$db['default']['database'] = '';
|
||||
$db['default']['dbdriver'] = 'mysql';
|
||||
$db['default']['dbprefix'] = '';
|
||||
$db['default']['pconnect'] = TRUE;
|
||||
$db['default']['db_debug'] = TRUE;
|
||||
$db['default']['cache_on'] = FALSE;
|
||||
$db['default']['cachedir'] = '';
|
||||
$db['default']['char_set'] = 'utf8';
|
||||
$db['default']['dbcollat'] = 'utf8_general_ci';
|
||||
$db['default']['swap_pre'] = '';
|
||||
$db['default']['autoinit'] = TRUE;
|
||||
$db['default']['stricton'] = FALSE;
|
||||
|
||||
|
||||
/* End of file database.php */
|
||||
/* Location: ./application/config/database.php */
|
||||
370
application/config/development/config.php
Normal file
370
application/config/development/config.php
Normal file
@@ -0,0 +1,370 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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://video.cmap.co.kr:8080/a/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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 'AUTO' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'AUTO' Default - auto detects
|
||||
| 'PATH_INFO' Uses the PATH_INFO
|
||||
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||
|
|
||||
*/
|
||||
$config['uri_protocol'] = 'AUTO';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL suffix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||
| For more information please see the user guide:
|
||||
|
|
||||
| http://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.
|
||||
|
|
||||
*/
|
||||
$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:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/core_classes.html
|
||||
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed URL Characters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This lets you specify with a regular expression 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.
|
||||
|
|
||||
| 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'; // experimental not currently in use
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you have enabled error logging, you can set an error threshold to
|
||||
| determine what gets logged. Threshold options are:
|
||||
| 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
|
||||
|
|
||||
| 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'] = 4;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/logs/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['log_path'] = FCPATH. 'storage/logs/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| system/cache/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['cache_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class or the Session class you
|
||||
| MUST set an encryption key. See the user guide for info.
|
||||
|
|
||||
*/
|
||||
$config['encryption_key'] = '7dj8bvfJkvMiYZqQ0yB7mBT4vfb49s2Z';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_cookie_name' = the name you want for the cookie
|
||||
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
||||
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||
| when the browser window is closed
|
||||
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||
| 'sess_use_database' = Whether to save the session data to a database
|
||||
| 'sess_table_name' = The name of the session database table
|
||||
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
|
|
||||
*/
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_expire_on_close'] = FALSE;
|
||||
$config['sess_encrypt_cookie'] = FALSE;
|
||||
$config['sess_use_database'] = FALSE;
|
||||
$config['sess_table_name'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = TRUE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookie_prefix' = Set a 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' = Cookies will only be set if a secure HTTPS connection exists.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = "";
|
||||
$config['cookie_domain'] = "";
|
||||
$config['cookie_path'] = "/";
|
||||
$config['cookie_secure'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global XSS Filtering
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether the XSS filter is always active when GET, POST or
|
||||
| COOKIE data is encountered
|
||||
|
|
||||
*/
|
||||
$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.
|
||||
*/
|
||||
$config['csrf_protection'] = FALSE;
|
||||
$config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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.
|
||||
|
|
||||
| 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 'gmt'. This pref tells the system whether to use
|
||||
| your server's local time as the master 'now' reference, or convert it to
|
||||
| GMT. 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)
|
||||
|
|
||||
*/
|
||||
$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 the HTTP_X_FORWARDED_FOR
|
||||
| header in order to properly identify the visitor's IP address.
|
||||
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
||||
|
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
||||
|
||||
|
||||
/* End of file config.php */
|
||||
/* Location: ./application/config/config.php */
|
||||
69
application/config/development/database.php
Normal file
69
application/config/development/database.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['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 type. ie: mysql. Currently supported:
|
||||
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Active Record 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
|
||||
| ['autoinit'] Whether or not to automatically initialize the database.
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $active_record variables lets you determine whether or not to load
|
||||
| the active record class
|
||||
*/
|
||||
|
||||
$active_group = 'default';
|
||||
$active_record = TRUE;
|
||||
|
||||
$db['default']['hostname'] = 'localhost';
|
||||
$db['default']['username'] = 'root';
|
||||
$db['default']['password'] = '';
|
||||
$db['default']['database'] = 'CROSSMAP_VIDEO';
|
||||
$db['default']['dbdriver'] = 'mysql';
|
||||
$db['default']['dbprefix'] = '';
|
||||
$db['default']['pconnect'] = TRUE;
|
||||
$db['default']['db_debug'] = TRUE;
|
||||
$db['default']['cache_on'] = FALSE;
|
||||
$db['default']['cachedir'] = '';
|
||||
$db['default']['char_set'] = 'utf8mb4';
|
||||
$db['default']['dbcollat'] = 'utf8mb4_general_ci';
|
||||
$db['default']['swap_pre'] = '';
|
||||
$db['default']['autoinit'] = TRUE;
|
||||
$db['default']['stricton'] = FALSE;
|
||||
|
||||
|
||||
/* End of file database.php */
|
||||
/* Location: ./application/config/database.php */
|
||||
15
application/config/doctypes.php
Normal file
15
application/config/doctypes.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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">',
|
||||
'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">'
|
||||
);
|
||||
|
||||
/* End of file doctypes.php */
|
||||
/* Location: ./application/config/doctypes.php */
|
||||
64
application/config/foreign_chars.php
Normal file
64
application/config/foreign_chars.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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',
|
||||
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
|
||||
'/ç|ć|ĉ|ċ|č/' => 'c',
|
||||
'/Ð|Ď|Đ/' => 'D',
|
||||
'/ð|ď|đ/' => 'd',
|
||||
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E',
|
||||
'/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e',
|
||||
'/Ĝ|Ğ|Ġ|Ģ/' => 'G',
|
||||
'/ĝ|ğ|ġ|ģ/' => 'g',
|
||||
'/Ĥ|Ħ/' => 'H',
|
||||
'/ĥ|ħ/' => 'h',
|
||||
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I',
|
||||
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i',
|
||||
'/Ĵ/' => 'J',
|
||||
'/ĵ/' => 'j',
|
||||
'/Ķ/' => 'K',
|
||||
'/ķ/' => 'k',
|
||||
'/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L',
|
||||
'/ĺ|ļ|ľ|ŀ|ł/' => 'l',
|
||||
'/Ñ|Ń|Ņ|Ň/' => 'N',
|
||||
'/ñ|ń|ņ|ň|ʼn/' => 'n',
|
||||
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O',
|
||||
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o',
|
||||
'/Ŕ|Ŗ|Ř/' => 'R',
|
||||
'/ŕ|ŗ|ř/' => 'r',
|
||||
'/Ś|Ŝ|Ş|Š/' => 'S',
|
||||
'/ś|ŝ|ş|š|ſ/' => 's',
|
||||
'/Ţ|Ť|Ŧ/' => 'T',
|
||||
'/ţ|ť|ŧ/' => 't',
|
||||
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U',
|
||||
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
|
||||
'/Ý|Ÿ|Ŷ/' => 'Y',
|
||||
'/ý|ÿ|ŷ/' => 'y',
|
||||
'/Ŵ/' => 'W',
|
||||
'/ŵ/' => 'w',
|
||||
'/Ź|Ż|Ž/' => 'Z',
|
||||
'/ź|ż|ž/' => 'z',
|
||||
'/Æ|Ǽ/' => 'AE',
|
||||
'/ß/'=> 'ss',
|
||||
'/IJ/' => 'IJ',
|
||||
'/ij/' => 'ij',
|
||||
'/Œ/' => 'OE',
|
||||
'/ƒ/' => 'f'
|
||||
);
|
||||
|
||||
/* End of file foreign_chars.php */
|
||||
/* Location: ./application/config/foreign_chars.php */
|
||||
16
application/config/hooks.php
Normal file
16
application/config/hooks.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/hooks.html
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of file hooks.php */
|
||||
/* Location: ./application/config/hooks.php */
|
||||
10
application/config/index.html
Normal file
10
application/config/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
197
application/config/ion_auth.php
Normal file
197
application/config/ion_auth.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Ion Auth
|
||||
* Author: Ben Edmunds
|
||||
* ben.edmunds@gmail.com
|
||||
* @benedmunds
|
||||
*
|
||||
* Added Awesomeness: Phil Sturgeon
|
||||
*
|
||||
* Created: 10.01.2009
|
||||
*
|
||||
* Description: Modified auth system based on redux_auth with extensive customization. This is basically what Redux Auth 2 should be.
|
||||
* Original Author name has been kept but that does not mean that the method has not been modified.
|
||||
*
|
||||
* Requirements: PHP5 or above
|
||||
*
|
||||
* @package CodeIgniter-Ion-Auth
|
||||
* @author Ben Edmunds
|
||||
* @link http://github.com/benedmunds/CodeIgniter-Ion-Auth
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Database group name option.
|
||||
| -------------------------------------------------------------------------
|
||||
| Allows to select a specific group for the database connection
|
||||
|
|
||||
| Default is empty: uses default group defined in CI's configuration
|
||||
| (see application/config/database.php, $active_group variable)
|
||||
*/
|
||||
$config['database_group_name'] = '';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Tables.
|
||||
| -------------------------------------------------------------------------
|
||||
| Database table names.
|
||||
*/
|
||||
$config['tables']['users'] = 'app_users';
|
||||
$config['tables']['groups'] = 'app_usergroups';
|
||||
$config['tables']['users_groups'] = 'app_users_groups';
|
||||
$config['tables']['login_attempts'] = 'app_login_attempts';
|
||||
|
||||
/*
|
||||
| Users table column and Group table column you want to join WITH.
|
||||
|
|
||||
| Joins from users.id
|
||||
| Joins from groups.id
|
||||
*/
|
||||
$config['join']['users'] = 'user_id';
|
||||
$config['join']['groups'] = 'group_id';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Hash Method (sha1 or bcrypt)
|
||||
| -------------------------------------------------------------------------
|
||||
| Bcrypt is available in PHP 5.3+
|
||||
|
|
||||
| IMPORTANT: Based on the recommendation by many professionals, it is highly recommended to use
|
||||
| bcrypt instead of sha1.
|
||||
|
|
||||
| NOTE: If you use bcrypt you will need to increase your password column character limit to (80)
|
||||
|
|
||||
| Below there is "default_rounds" setting. This defines how strong the encryption will be,
|
||||
| but remember the more rounds you set the longer it will take to hash (CPU usage) So adjust
|
||||
| this based on your server hardware.
|
||||
|
|
||||
| If you are using Bcrypt the Admin password field also needs to be changed in order to login as admin:
|
||||
| $2y$: $2y$08$200Z6ZZbp3RAEXoaWcMA6uJOFicwNZaqk4oDhqTUiFXFe63MG.Daa
|
||||
| $2a$: $2a$08$6TTcWD1CJ8pzDy.2U3mdi.tpl.nYOR1pwYXwblZdyQd9SL16B7Cqa
|
||||
|
|
||||
| Be careful how high you set max_rounds, I would do your own testing on how long it takes
|
||||
| to encrypt with x rounds.
|
||||
|
|
||||
| salt_prefix: Used for bcrypt. Versions of PHP before 5.3.7 only support "$2a$" as the salt prefix
|
||||
| Versions 5.3.7 or greater should use the default of "$2y$".
|
||||
*/
|
||||
$config['hash_method'] = 'bcrypt'; // sha1 or bcrypt, bcrypt is STRONGLY recommended
|
||||
$config['default_rounds'] = 8; // This does not apply if random_rounds is set to true
|
||||
$config['random_rounds'] = FALSE;
|
||||
$config['min_rounds'] = 5;
|
||||
$config['max_rounds'] = 9;
|
||||
$config['salt_prefix'] = version_compare(PHP_VERSION, '5.3.7', '<') ? '$2a$' : '$2y$';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Authentication options.
|
||||
| -------------------------------------------------------------------------
|
||||
| maximum_login_attempts: This maximum is not enforced by the library, but is
|
||||
| used by $this->ion_auth->is_max_login_attempts_exceeded().
|
||||
| The controller should check this function and act
|
||||
| appropriately. If this variable set to 0, there is no maximum.
|
||||
*/
|
||||
$config['site_title'] = "Example.com"; // Site Title, example.com
|
||||
$config['admin_email'] = "admin@example.com"; // Admin Email, admin@example.com
|
||||
$config['default_group'] = 'members'; // Default group, use name
|
||||
$config['admin_group'] = 'admin'; // Default administrators group, use name
|
||||
$config['identity'] = 'email'; // You can use any unique column in your table as identity column. The values in this column, alongside password, will be used for login purposes
|
||||
$config['min_password_length'] = 8; // Minimum Required Length of Password
|
||||
$config['max_password_length'] = 20; // Maximum Allowed Length of Password
|
||||
$config['email_activation'] = FALSE; // Email Activation for registration
|
||||
$config['manual_activation'] = FALSE; // Manual Activation for registration
|
||||
$config['remember_users'] = TRUE; // Allow users to be remembered and enable auto-login
|
||||
$config['user_expire'] = 86500; // How long to remember the user (seconds). Set to zero for no expiration - see sess_expiration in CodeIgniter Session Config for session expiration
|
||||
$config['user_extend_on_login'] = FALSE; // Extend the users cookies every time they auto-login
|
||||
$config['track_login_attempts'] = TRUE; // Track the number of failed login attempts for each user or ip.
|
||||
$config['track_login_ip_address'] = TRUE; // Track login attempts by IP Address, if FALSE will track based on identity. (Default: TRUE)
|
||||
$config['maximum_login_attempts'] = 3; // The maximum number of failed login attempts.
|
||||
$config['lockout_time'] = 600; /* The number of seconds to lockout an account due to exceeded attempts
|
||||
You should not use a value below 60 (1 minute) */
|
||||
$config['forgot_password_expiration'] = 0; // The number of seconds after which a forgot password request will expire. If set to 0, forgot password requests will not expire.
|
||||
$config['recheck_timer'] = 0; /* The number of seconds after which the session is checked again against database to see if the user still exists and is active.
|
||||
Leave 0 if you don't want session recheck. if you really think you need to recheck the session against database, we would
|
||||
recommend a higher value, as this would affect performance */
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Cookie options.
|
||||
| -------------------------------------------------------------------------
|
||||
| remember_cookie_name Default: remember_code
|
||||
| identity_cookie_name Default: identity
|
||||
*/
|
||||
$config['remember_cookie_name'] = 'remember_code';
|
||||
$config['identity_cookie_name'] = 'identity';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Email options.
|
||||
| -------------------------------------------------------------------------
|
||||
| email_config:
|
||||
| 'file' = Use the default CI config or use from a config file
|
||||
| array = Manually set your email config settings
|
||||
*/
|
||||
$config['use_ci_email'] = FALSE; // Send Email using the builtin CI email class, if false it will return the code and the identity
|
||||
$config['email_config'] = array(
|
||||
'mailtype' => 'html',
|
||||
);
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Email templates.
|
||||
| -------------------------------------------------------------------------
|
||||
| Folder where email templates are stored.
|
||||
| Default: auth/
|
||||
*/
|
||||
$config['email_templates'] = 'auth/email/';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Activate Account Email Template
|
||||
| -------------------------------------------------------------------------
|
||||
| Default: activate.tpl.php
|
||||
*/
|
||||
$config['email_activate'] = 'activate.tpl.php';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Forgot Password Email Template
|
||||
| -------------------------------------------------------------------------
|
||||
| Default: forgot_password.tpl.php
|
||||
*/
|
||||
$config['email_forgot_password'] = 'forgot_password.tpl.php';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Forgot Password Complete Email Template
|
||||
| -------------------------------------------------------------------------
|
||||
| Default: new_password.tpl.php
|
||||
*/
|
||||
$config['email_forgot_password_complete'] = 'new_password.tpl.php';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Salt options
|
||||
| -------------------------------------------------------------------------
|
||||
| salt_length Default: 22
|
||||
|
|
||||
| store_salt: Should the salt be stored in the database?
|
||||
| This will change your password encryption algorithm,
|
||||
| default password, 'password', changes to
|
||||
| fbaa5e216d163a02ae630ab1a43372635dd374c0 with default salt.
|
||||
*/
|
||||
$config['salt_length'] = 22;
|
||||
$config['store_salt'] = FALSE;
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Message Delimiters.
|
||||
| -------------------------------------------------------------------------
|
||||
*/
|
||||
$config['delimiters_source'] = 'config'; // "config" = use the settings defined here, "form_validation" = use the settings defined in CI's form validation library
|
||||
$config['message_start_delimiter'] = '<p>'; // Message start delimiter
|
||||
$config['message_end_delimiter'] = '</p>'; // Message end delimiter
|
||||
$config['error_start_delimiter'] = '<p>'; // Error message start delimiter
|
||||
$config['error_end_delimiter'] = '</p>'; // Error message end delimiter
|
||||
41
application/config/migration.php
Normal file
41
application/config/migration.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable Migrations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migrations are disabled by default but should be enabled
|
||||
| whenever you intend to do a schema migration.
|
||||
|
|
||||
*/
|
||||
$config['migration_enabled'] = FALSE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is used to set migration version that the file system should be on.
|
||||
| If you run $this->migration->latest() 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/';
|
||||
|
||||
|
||||
/* End of file migration.php */
|
||||
/* Location: ./application/config/migration.php */
|
||||
106
application/config/mimes.php
Normal file
106
application/config/mimes.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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.
|
||||
|
|
||||
*/
|
||||
|
||||
$mimes = array( 'hqx' => 'application/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'),
|
||||
'bin' => 'application/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' => 'application/x-photoshop',
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/x-download'),
|
||||
'ai' => 'application/postscript',
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'),
|
||||
'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',
|
||||
'php' => 'application/x-httpd-php',
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => 'application/x-javascript',
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => 'audio/x-aiff',
|
||||
'aiff' => 'audio/x-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-windows-bmp'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => 'text/css',
|
||||
'html' => 'text/html',
|
||||
'htm' => 'text/html',
|
||||
'shtml' => 'text/html',
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => 'text/xml',
|
||||
'xsl' => 'text/xml',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => 'video/x-msvideo',
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => 'application/msword',
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json')
|
||||
);
|
||||
|
||||
|
||||
/* End of file mimes.php */
|
||||
/* Location: ./application/config/mimes.php */
|
||||
370
application/config/production/config.php
Normal file
370
application/config/production/config.php
Normal file
@@ -0,0 +1,370 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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://allstarz7.cafe24.com/a/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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 'AUTO' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'AUTO' Default - auto detects
|
||||
| 'PATH_INFO' Uses the PATH_INFO
|
||||
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||
|
|
||||
*/
|
||||
$config['uri_protocol'] = 'AUTO';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL suffix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||
| For more information please see the user guide:
|
||||
|
|
||||
| http://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.
|
||||
|
|
||||
*/
|
||||
$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:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/core_classes.html
|
||||
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed URL Characters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This lets you specify with a regular expression 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.
|
||||
|
|
||||
| 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'; // experimental not currently in use
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you have enabled error logging, you can set an error threshold to
|
||||
| determine what gets logged. Threshold options are:
|
||||
| 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
|
||||
|
|
||||
| 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'] = 4;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/logs/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['log_path'] = FCPATH. 'storage/logs/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| system/cache/ folder. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['cache_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class or the Session class you
|
||||
| MUST set an encryption key. See the user guide for info.
|
||||
|
|
||||
*/
|
||||
$config['encryption_key'] = 'Awg73xJTSsutaXshigjYQ3Ik6DdMM4xt';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_cookie_name' = the name you want for the cookie
|
||||
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
||||
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||
| when the browser window is closed
|
||||
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||
| 'sess_use_database' = Whether to save the session data to a database
|
||||
| 'sess_table_name' = The name of the session database table
|
||||
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
|
|
||||
*/
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_expire_on_close'] = FALSE;
|
||||
$config['sess_encrypt_cookie'] = FALSE;
|
||||
$config['sess_use_database'] = FALSE;
|
||||
$config['sess_table_name'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = TRUE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookie_prefix' = Set a 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' = Cookies will only be set if a secure HTTPS connection exists.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = "";
|
||||
$config['cookie_domain'] = "";
|
||||
$config['cookie_path'] = "/";
|
||||
$config['cookie_secure'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global XSS Filtering
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether the XSS filter is always active when GET, POST or
|
||||
| COOKIE data is encountered
|
||||
|
|
||||
*/
|
||||
$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.
|
||||
*/
|
||||
$config['csrf_protection'] = FALSE;
|
||||
$config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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.
|
||||
|
|
||||
| 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 'gmt'. This pref tells the system whether to use
|
||||
| your server's local time as the master 'now' reference, or convert it to
|
||||
| GMT. 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)
|
||||
|
|
||||
*/
|
||||
$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 the HTTP_X_FORWARDED_FOR
|
||||
| header in order to properly identify the visitor's IP address.
|
||||
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
||||
|
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
||||
|
||||
|
||||
/* End of file config.php */
|
||||
/* Location: ./application/config/config.php */
|
||||
86
application/config/production/database.php
Normal file
86
application/config/production/database.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['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 type. ie: mysql. Currently supported:
|
||||
mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Active Record 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
|
||||
| ['autoinit'] Whether or not to automatically initialize the database.
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $active_record variables lets you determine whether or not to load
|
||||
| the active record class
|
||||
*/
|
||||
|
||||
$active_group = 'default';
|
||||
$active_record = TRUE;
|
||||
|
||||
$db['default']['hostname'] = 'localhost';
|
||||
$db['default']['username'] = 'crossmap';
|
||||
$db['default']['password'] = 'oI#B^!lcr@pL';
|
||||
$db['default']['database'] = 'crossmap';
|
||||
$db['default']['dbdriver'] = 'mysql';
|
||||
$db['default']['dbprefix'] = '';
|
||||
$db['default']['pconnect'] = FALSE;
|
||||
$db['default']['db_debug'] = (ENVIRONMENT !== 'production');
|
||||
$db['default']['cache_on'] = FALSE;
|
||||
$db['default']['cachedir'] = '';
|
||||
$db['default']['char_set'] = 'utf8';
|
||||
$db['default']['dbcollat'] = 'utf8_general_ci';
|
||||
$db['default']['swap_pre'] = '';
|
||||
$db['default']['autoinit'] = TRUE;
|
||||
$db['default']['stricton'] = FALSE;
|
||||
|
||||
|
||||
$db['auth']['hostname'] = 'localhost';
|
||||
$db['auth']['username'] = 'alex';
|
||||
$db['auth']['password'] = 'McZQLLgF333Zcx54';
|
||||
$db['auth']['database'] = 'CMEDIA_AUTH';
|
||||
$db['auth']['dbdriver'] = 'mysql';
|
||||
$db['auth']['dbprefix'] = '';
|
||||
$db['auth']['pconnect'] = FALSE;
|
||||
$db['auth']['db_debug'] = (ENVIRONMENT !== 'production');
|
||||
$db['auth']['cache_on'] = FALSE;
|
||||
$db['auth']['cachedir'] = '';
|
||||
$db['auth']['char_set'] = 'utf8mb4';
|
||||
$db['auth']['dbcollat'] = 'utf8mb4_general_ci';
|
||||
$db['auth']['swap_pre'] = '';
|
||||
$db['auth']['autoinit'] = TRUE;
|
||||
$db['auth']['stricton'] = FALSE;
|
||||
|
||||
|
||||
/* End of file database.php */
|
||||
/* Location: ./application/config/database.php */
|
||||
17
application/config/profiler.php
Normal file
17
application/config/profiler.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/profiling.html
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of file profiler.php */
|
||||
/* Location: ./application/config/profiler.php */
|
||||
261
application/config/rest.php
Normal file
261
application/config/rest.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| What format should the data be returned in by default?
|
||||
|
|
||||
| Default: xml
|
||||
|
|
||||
*/
|
||||
$config['rest_default_format'] = 'json';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable emulate request
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Should we enable emulation of the request (e.g. used in Mootools request)?
|
||||
|
|
||||
| Default: false
|
||||
|
|
||||
*/
|
||||
$config['enable_emulate_request'] = TRUE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Realm
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Name for the password protected REST API displayed on login dialogs
|
||||
|
|
||||
| E.g: My Secret REST API
|
||||
|
|
||||
*/
|
||||
$config['rest_realm'] = 'REST API';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Is login required and if so, which type of login?
|
||||
|
|
||||
| '' = no login required, 'basic' = unsecure login, 'digest' = more secure login
|
||||
|
|
||||
*/
|
||||
$config['rest_auth'] = false;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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.
|
||||
|
|
||||
| example:
|
||||
|
|
||||
| $config['auth_override_class_method']['deals']['view'] = 'none';
|
||||
| $config['auth_override_class_method']['deals']['insert'] = 'digest';
|
||||
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
|
||||
|
|
||||
| Here 'deals' and 'accounts' are controller names, 'view', 'insert' and 'user' are methods within. (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']['deals']['view'] = 'none';
|
||||
// $config['auth_override_class_method']['deals']['insert'] = 'digest';
|
||||
// $config['auth_override_class_method']['accounts']['user'] = 'basic';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login usernames
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Array of usernames and passwords for login
|
||||
|
|
||||
| array('admin' => '1234')
|
||||
|
|
||||
*/
|
||||
$config['rest_valid_logins'] = array('radioapp' => 'BgFhH3bepzHK535s');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Database Group
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Connect to a database group for keys, logging, etc. It will only connect
|
||||
| if you have any of these features enabled.
|
||||
|
|
||||
| 'default'
|
||||
|
|
||||
*/
|
||||
$config['rest_database_group'] = 'default';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Keys Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The table name in your database that stores API Keys.
|
||||
|
|
||||
| 'keys'
|
||||
|
|
||||
*/
|
||||
$config['rest_keys_table'] = 'app_keys';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to true REST_Controller will look for a key and match it to the DB.
|
||||
| If no key is provided, the request will return an error.
|
||||
|
|
||||
| FALSE
|
||||
|
||||
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=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_keys'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Key Length
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| How long should created keys be? Double check this in your db schema.
|
||||
|
|
||||
| Default: 32
|
||||
| Max: 40
|
||||
|
|
||||
*/
|
||||
$config['rest_key_length'] = 40;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Key Variable
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Which variable will provide us the API Key
|
||||
|
|
||||
| Default: X-API-KEY
|
||||
|
|
||||
*/
|
||||
$config['rest_key_name'] = 'X-API-KEY';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Logs Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The table name in your database that stores logs.
|
||||
|
|
||||
| 'logs'
|
||||
|
|
||||
*/
|
||||
$config['rest_logs_table'] = 'logs';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Logging
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to true REST_Controller will log actions based on key, date,
|
||||
| time and IP address. This is a general rule that can be overridden in the
|
||||
| $this->method array in each controller.
|
||||
|
|
||||
| FALSE
|
||||
|
|
||||
CREATE TABLE `logs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`uri` varchar(255) NOT NULL,
|
||||
`method` varchar(6) NOT NULL,
|
||||
`params` text NOT NULL,
|
||||
`api_key` varchar(40) NOT NULL,
|
||||
`ip_address` varchar(15) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`authorized` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_logging'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Limits Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The table name in your database that stores limits.
|
||||
|
|
||||
| 'logs'
|
||||
|
|
||||
*/
|
||||
$config['rest_limits_table'] = 'limits';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Limits
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to true REST_Controller 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.
|
||||
|
|
||||
| FALSE
|
||||
|
|
||||
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=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_limits'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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
|
||||
|
|
||||
| FALSE
|
||||
|
|
||||
*/
|
||||
$config['rest_ignore_http_accept'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST AJAX Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to TRUE to only allow AJAX requests. If TRUE and the request is not
|
||||
| coming from AJAX, a 505 response with the error message "Only AJAX
|
||||
| requests are accepted." will be returned. This is good for production
|
||||
| environments. Set to FALSE to also accept HTTP requests.
|
||||
|
|
||||
| FALSE
|
||||
|
|
||||
*/
|
||||
$config['rest_ajax_only'] = FALSE;
|
||||
|
||||
/* End of file config.php */
|
||||
/* Location: ./system/application/config/rest.php */
|
||||
46
application/config/routes.php
Normal file
46
application/config/routes.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/routing.html
|
||||
|
|
||||
| -------------------------------------------------------------------------
|
||||
| RESERVED ROUTES
|
||||
| -------------------------------------------------------------------------
|
||||
|
|
||||
| There area two 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 what URI segments to use if those provided
|
||||
| in the URL cannot be matched to a valid route.
|
||||
|
|
||||
*/
|
||||
|
||||
$route['default_controller'] = "welcome";
|
||||
$route['404_override'] = '';
|
||||
|
||||
|
||||
/* End of file routes.php */
|
||||
/* Location: ./application/config/routes.php */
|
||||
66
application/config/smileys.php
Normal file
66
application/config/smileys.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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 simileys. For example:
|
||||
| :-) and :) use the same image replacement.
|
||||
|
|
||||
| Please see user guide for more info:
|
||||
| http://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', 'excaim'),
|
||||
':question:' => array('question.gif', '19', '19', 'question') // no comma after last item
|
||||
|
||||
);
|
||||
|
||||
/* End of file smileys.php */
|
||||
/* Location: ./application/config/smileys.php */
|
||||
178
application/config/user_agents.php
Normal file
178
application/config/user_agents.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php if ( ! defined('BASEPATH')) 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 6.0' => 'Windows Longhorn',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'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' => 'Unknown Windows OS',
|
||||
'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'
|
||||
);
|
||||
|
||||
|
||||
// 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(
|
||||
'Flock' => 'Flock',
|
||||
'Chrome' => 'Chrome',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => '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'
|
||||
);
|
||||
|
||||
$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",
|
||||
'hiptop' => "Danger Hiptop",
|
||||
'nec-' => "NEC",
|
||||
'panasonic' => "Panasonic",
|
||||
'philips' => "Philips",
|
||||
'sagem' => "Sagem",
|
||||
'sanyo' => "Sanyo",
|
||||
'spv' => "SPV",
|
||||
'zte' => "ZTE",
|
||||
'sendo' => "Sendo",
|
||||
|
||||
// Operating Systems
|
||||
'symbian' => "Symbian",
|
||||
'SymbianOS' => "SymbianOS",
|
||||
'elaine' => "Palm",
|
||||
'palm' => "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",
|
||||
|
||||
// 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',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'askjeeves' => 'AskJeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos'
|
||||
);
|
||||
|
||||
/* End of file user_agents.php */
|
||||
/* Location: ./application/config/user_agents.php */
|
||||
60
application/controllers/api/admin.php
Normal file
60
application/controllers/api/admin.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
require APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
class Admin extends REST_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
public function login_get()
|
||||
{
|
||||
if ($login = $this->get('login')) {
|
||||
parse_str(base64_decode($login), $user);
|
||||
$this->session->set_userdata($user);
|
||||
if($this->session->userdata('username')) {
|
||||
header('location:'. ($this->get('redirect') ? $this->get('redirect') : '/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function loginCheck() {
|
||||
return $this->session->userdata('username');
|
||||
}
|
||||
|
||||
public function station_schedule_get()
|
||||
{
|
||||
if ($this->loginCheck()) {
|
||||
$this->load->model('station_schedule_model');
|
||||
if(!$this->get('categoryId') || !$this->get('dayName')) {
|
||||
$this->res(402, 'Preconfigure required');
|
||||
}else {
|
||||
$schedules = $this->station_schedule_model->findSchedulesByCategoryIdAndDayName($this->get('categoryId'), $this->get('dayName'))->result();
|
||||
$this->res(200, 'Success', $schedules);
|
||||
}
|
||||
} else {
|
||||
$this->res(401, 'Not authorized');
|
||||
}
|
||||
}
|
||||
|
||||
public function station_schedule_post()
|
||||
{
|
||||
if ($this->loginCheck()) {
|
||||
$this->load->model('station_schedule_model');
|
||||
if(!$this->post('categoryId') || !$this->post('dayName') || !$this->post('data')) {
|
||||
$this->res(402, 'Preconfigure required');
|
||||
}else {
|
||||
$schedules = $this->station_schedule_model
|
||||
->insertSchedules($this->post('categoryId'), $this->post('dayName'), json_decode($this->post('data'), true));
|
||||
$this->res(200, 'Success', $schedules);
|
||||
}
|
||||
} else {
|
||||
$this->res(401, 'Not authorized');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
228
application/controllers/api/auth.php
Normal file
228
application/controllers/api/auth.php
Normal file
@@ -0,0 +1,228 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Keys Controller
|
||||
*
|
||||
* This is a basic Key Management REST controller to make and delete keys.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Rest Server
|
||||
* @category Controller
|
||||
* @author Phil Sturgeon
|
||||
* @link http://philsturgeon.co.uk/code/
|
||||
*/
|
||||
|
||||
// This can be removed if you use __autoload() in config.php
|
||||
require APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
class Auth extends REST_Controller
|
||||
{
|
||||
protected $methods = array(
|
||||
'index_put' => array('level' => 10, 'limit' => 10),
|
||||
'index_delete' => array('level' => 10),
|
||||
'level_post' => array('level' => 10),
|
||||
'regenerate_post' => array('level' => 10),
|
||||
);
|
||||
|
||||
/**
|
||||
* Key Create
|
||||
*
|
||||
* Insert a key into the database.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function login_post()
|
||||
{
|
||||
if ($this->_check_login($this->request->body->username, $this->request->body->userpass)) {
|
||||
$key = self::_generate_key();
|
||||
$level = $this->put('level') ? $this->put('level') : 1;
|
||||
$ignore_limits = $this->put('ignore_limits') ? $this->put('ignore_limits') : 1;
|
||||
$this->rest->db->where('username', $this->request->body->username)->delete(config_item('rest_keys_table'));
|
||||
if (self::_insert_key($key, array('level' => $level, 'ignore_limits' => $ignore_limits, 'username' => $this->request->body->username))) {
|
||||
$this->res(200, 'Success', array('accessToken' => $key)); // 201 = Created
|
||||
}
|
||||
} else {
|
||||
$this->res(403, 'Invalid Username and Password');
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Key Delete
|
||||
*
|
||||
* Remove a key from the database to stop it working.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index_delete()
|
||||
{
|
||||
$key = $this->delete('key');
|
||||
|
||||
// Does this key even exist?
|
||||
if (!self::_key_exists($key)) {
|
||||
// NOOOOOOOOO!
|
||||
$this->response(array('status' => 0, 'error' => 'Invalid API Key.'), 400);
|
||||
}
|
||||
|
||||
// Kill it
|
||||
self::_delete_key($key);
|
||||
|
||||
// Tell em we killed it
|
||||
$this->response(array('status' => 1, 'success' => 'API Key was deleted.'), 200);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Update Key
|
||||
*
|
||||
* Change the level
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function level_post()
|
||||
{
|
||||
$key = $this->post('key');
|
||||
$new_level = $this->post('level');
|
||||
|
||||
// Does this key even exist?
|
||||
if (!self::_key_exists($key)) {
|
||||
// NOOOOOOOOO!
|
||||
$this->response(array('error' => 'Invalid API Key.'), 400);
|
||||
}
|
||||
|
||||
// Update the key level
|
||||
if (self::_update_key($key, array('level' => $new_level))) {
|
||||
$this->response(array('status' => 1, 'success' => 'API Key was updated.'), 200); // 200 = OK
|
||||
} else {
|
||||
$this->response(array('status' => 0, 'error' => 'Could not update the key level.'), 500); // 500 = Internal Server Error
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Update Key
|
||||
*
|
||||
* Change the level
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function suspend_post()
|
||||
{
|
||||
$key = $this->post('key');
|
||||
|
||||
// Does this key even exist?
|
||||
if (!self::_key_exists($key)) {
|
||||
// NOOOOOOOOO!
|
||||
$this->response(array('error' => 'Invalid API Key.'), 400);
|
||||
}
|
||||
|
||||
// Update the key level
|
||||
if (self::_update_key($key, array('level' => 0))) {
|
||||
$this->response(array('status' => 1, 'success' => 'Key was suspended.'), 200); // 200 = OK
|
||||
} else {
|
||||
$this->response(array('status' => 0, 'error' => 'Could not suspend the user.'), 500); // 500 = Internal Server Error
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Regenerate Key
|
||||
*
|
||||
* Remove a key from the database to stop it working.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function regenerate_post()
|
||||
{
|
||||
$old_key = $this->post('key');
|
||||
$key_details = self::_get_key($old_key);
|
||||
|
||||
// The key wasnt found
|
||||
if (!$key_details) {
|
||||
// NOOOOOOOOO!
|
||||
$this->response(array('status' => 0, 'error' => 'Invalid API Key.'), 400);
|
||||
}
|
||||
|
||||
// Build a new key
|
||||
$new_key = self::_generate_key();
|
||||
|
||||
// Insert the new key
|
||||
if (self::_insert_key($new_key, array('level' => $key_details->level, 'ignore_limits' => $key_details->ignore_limits))) {
|
||||
// Suspend old key
|
||||
self::_update_key($old_key, array('level' => 0));
|
||||
|
||||
$this->response(array('status' => 1, 'key' => $new_key), 201); // 201 = Created
|
||||
} else {
|
||||
$this->response(array('status' => 0, 'error' => 'Could not save the key.'), 500); // 500 = Internal Server Error
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/* Helper Methods */
|
||||
|
||||
private function _generate_key()
|
||||
{
|
||||
$this->load->helper('security');
|
||||
|
||||
do {
|
||||
$salt = do_hash(time() . mt_rand());
|
||||
$new_key = substr($salt, 0, config_item('rest_key_length'));
|
||||
}
|
||||
|
||||
// Already in the DB? Fail. Try again
|
||||
while (self::_key_exists($new_key));
|
||||
|
||||
return $new_key;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/* Private Data Methods */
|
||||
|
||||
private function _get_key($key)
|
||||
{
|
||||
return $this->rest->db->where('key', $key)->get(config_item('rest_keys_table'))->row();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
private function _key_exists($key)
|
||||
{
|
||||
return $this->rest->db->where('key', $key)->count_all_results(config_item('rest_keys_table')) > 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
private function _insert_key($key, $data)
|
||||
{
|
||||
|
||||
$data['key'] = $key;
|
||||
$data['date_created'] = function_exists('now') ? now() : time();
|
||||
|
||||
return $this->rest->db->set($data)->insert(config_item('rest_keys_table'));
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
private function _update_key($key, $data)
|
||||
{
|
||||
return $this->rest->db->where('key', $key)->update(config_item('rest_keys_table'), $data);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
private function _delete_key($key)
|
||||
{
|
||||
return $this->rest->db->where('key', $key)->delete(config_item('rest_keys_table'));
|
||||
}
|
||||
}
|
||||
54
application/controllers/api/radio.php
Normal file
54
application/controllers/api/radio.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
require APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
class Radio extends REST_Controller
|
||||
{
|
||||
private $tokenChecked;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('RadioService', array(), 'radioService');
|
||||
$this->tokenChecked = $this->radioService->checkToken();
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
echo 'Invalid Access';
|
||||
}
|
||||
|
||||
public function schedule_get()
|
||||
{
|
||||
if (is_null($this->tokenChecked)) {
|
||||
$this->res(200, 'Success', $this->radioService->getSchedule($this->get('categoryId'), $this->get('day')));
|
||||
} else if ($this->tokenChecked == 402) {
|
||||
$this->res(402, 'Token expired');
|
||||
} else if ($this->tokenChecked == 401){
|
||||
$this->res(401, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
public function category_get()
|
||||
{
|
||||
if (is_null($this->tokenChecked)) {
|
||||
$this->res(200, 'Success', $this->radioService->getCategory($this->radioService->getAppId($this->get('appId'))));
|
||||
} else if ($this->tokenChecked == 402) {
|
||||
$this->res(402, 'Token expired');
|
||||
} else if ($this->tokenChecked == 401){
|
||||
$this->res(401, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
public function app_get()
|
||||
{
|
||||
if (is_null($this->tokenChecked)) {
|
||||
$this->res(200, 'Success', $this->radioService->getApp($this->radioService->getAppId($this->get('appId'))));
|
||||
} else if ($this->tokenChecked == 402) {
|
||||
$this->res(402, 'Token expired');
|
||||
} else if ($this->tokenChecked == 401){
|
||||
$this->res(401, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
866
application/controllers/auth.php
Normal file
866
application/controllers/auth.php
Normal file
@@ -0,0 +1,866 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Class Auth
|
||||
* @property Ion_auth|Ion_auth_model $ion_auth The ION Auth spark
|
||||
* @property CI_Form_validation $form_validation The form validation library
|
||||
*/
|
||||
class Auth extends MY_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
$this->load->library(array('ion_auth', 'form_validation'));
|
||||
$this->load->helper(array('url', 'language'));
|
||||
|
||||
$this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));
|
||||
|
||||
$this->lang->load('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect if needed, otherwise display the user list
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
if (!$this->ion_auth->logged_in())
|
||||
{
|
||||
// redirect them to the login page
|
||||
redirect('auth/login', 'refresh');
|
||||
}
|
||||
else if (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
|
||||
{
|
||||
// redirect them to the home page because they must be an administrator to view this
|
||||
return show_error('You must be an administrator to view this page.');
|
||||
}
|
||||
else
|
||||
{
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
|
||||
|
||||
//list the users
|
||||
$this->data['users'] = $this->ion_auth->users()->result();
|
||||
foreach ($this->data['users'] as $k => $user)
|
||||
{
|
||||
$this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
|
||||
}
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'index', $this->data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the user in
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
$this->data['title'] = $this->lang->line('login_heading');
|
||||
|
||||
// validate form input
|
||||
$this->form_validation->set_rules('identity', str_replace(':', '', $this->lang->line('login_identity_label')), 'required');
|
||||
$this->form_validation->set_rules('password', str_replace(':', '', $this->lang->line('login_password_label')), 'required');
|
||||
|
||||
if ($this->form_validation->run() === TRUE)
|
||||
{
|
||||
// check to see if the user is logging in
|
||||
// check for "remember me"
|
||||
$remember = (bool)$this->input->post('remember');
|
||||
|
||||
if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
|
||||
{
|
||||
//if the login is successful
|
||||
//redirect them back to the home page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect('/', 'refresh');
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the login was un-successful
|
||||
// redirect them back to the login page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect('auth/login', 'refresh'); // use redirects instead of loading views for compatibility with MY_Controller libraries
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// the user is not logging in so display the login page
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
|
||||
|
||||
$this->data['identity'] = array('name' => 'identity',
|
||||
'id' => 'identity',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('identity'),
|
||||
);
|
||||
$this->data['password'] = array('name' => 'password',
|
||||
'id' => 'password',
|
||||
'type' => 'password',
|
||||
);
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'login', $this->data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the user out
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
$this->data['title'] = "Logout";
|
||||
|
||||
// log the user out
|
||||
$logout = $this->ion_auth->logout();
|
||||
|
||||
// redirect them to the login page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect('auth/login', 'refresh');
|
||||
}
|
||||
|
||||
/**
|
||||
* Change password
|
||||
*/
|
||||
public function change_password()
|
||||
{
|
||||
$this->form_validation->set_rules('old', $this->lang->line('change_password_validation_old_password_label'), 'required');
|
||||
$this->form_validation->set_rules('new', $this->lang->line('change_password_validation_new_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[new_confirm]');
|
||||
$this->form_validation->set_rules('new_confirm', $this->lang->line('change_password_validation_new_password_confirm_label'), 'required');
|
||||
|
||||
if (!$this->ion_auth->logged_in())
|
||||
{
|
||||
redirect('auth/login', 'refresh');
|
||||
}
|
||||
|
||||
$user = $this->ion_auth->user()->row();
|
||||
|
||||
if ($this->form_validation->run() === FALSE)
|
||||
{
|
||||
// display the form
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
|
||||
|
||||
$this->data['min_password_length'] = $this->config->item('min_password_length', 'ion_auth');
|
||||
$this->data['old_password'] = array(
|
||||
'name' => 'old',
|
||||
'id' => 'old',
|
||||
'type' => 'password',
|
||||
);
|
||||
$this->data['new_password'] = array(
|
||||
'name' => 'new',
|
||||
'id' => 'new',
|
||||
'type' => 'password',
|
||||
'pattern' => '^.{' . $this->data['min_password_length'] . '}.*$',
|
||||
);
|
||||
$this->data['new_password_confirm'] = array(
|
||||
'name' => 'new_confirm',
|
||||
'id' => 'new_confirm',
|
||||
'type' => 'password',
|
||||
'pattern' => '^.{' . $this->data['min_password_length'] . '}.*$',
|
||||
);
|
||||
$this->data['user_id'] = array(
|
||||
'name' => 'user_id',
|
||||
'id' => 'user_id',
|
||||
'type' => 'hidden',
|
||||
'value' => $user->id,
|
||||
);
|
||||
|
||||
// render
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'change_password', $this->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$identity = $this->session->userdata('identity');
|
||||
|
||||
$change = $this->ion_auth->change_password($identity, $this->input->post('old'), $this->input->post('new'));
|
||||
|
||||
if ($change)
|
||||
{
|
||||
//if the password was successfully changed
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
$this->logout();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect('auth/change_password', 'refresh');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forgot password
|
||||
*/
|
||||
public function forgot_password()
|
||||
{
|
||||
// setting validation rules by checking whether identity is username or email
|
||||
if ($this->config->item('identity', 'ion_auth') != 'email')
|
||||
{
|
||||
$this->form_validation->set_rules('identity', $this->lang->line('forgot_password_identity_label'), 'required');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form_validation->set_rules('identity', $this->lang->line('forgot_password_validation_email_label'), 'required|valid_email');
|
||||
}
|
||||
|
||||
|
||||
if ($this->form_validation->run() === FALSE)
|
||||
{
|
||||
$this->data['type'] = $this->config->item('identity', 'ion_auth');
|
||||
// setup the input
|
||||
$this->data['identity'] = array('name' => 'identity',
|
||||
'id' => 'identity',
|
||||
);
|
||||
|
||||
if ($this->config->item('identity', 'ion_auth') != 'email')
|
||||
{
|
||||
$this->data['identity_label'] = $this->lang->line('forgot_password_identity_label');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->data['identity_label'] = $this->lang->line('forgot_password_email_identity_label');
|
||||
}
|
||||
|
||||
// set any errors and display the form
|
||||
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'forgot_password', $this->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$identity_column = $this->config->item('identity', 'ion_auth');
|
||||
$identity = $this->ion_auth->where($identity_column, $this->input->post('identity'))->users()->row();
|
||||
|
||||
if (empty($identity))
|
||||
{
|
||||
|
||||
if ($this->config->item('identity', 'ion_auth') != 'email')
|
||||
{
|
||||
$this->ion_auth->set_error('forgot_password_identity_not_found');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ion_auth->set_error('forgot_password_email_not_found');
|
||||
}
|
||||
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect("auth/forgot_password", 'refresh');
|
||||
}
|
||||
|
||||
// run the forgotten password method to email an activation code to the user
|
||||
$forgotten = $this->ion_auth->forgotten_password($identity->{$this->config->item('identity', 'ion_auth')});
|
||||
|
||||
if ($forgotten)
|
||||
{
|
||||
// if there were no errors
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect("auth/login", 'refresh'); //we should display a confirmation page here instead of the login page
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect("auth/forgot_password", 'refresh');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset password - final step for forgotten password
|
||||
*
|
||||
* @param string|null $code The reset code
|
||||
*/
|
||||
public function reset_password($code = NULL)
|
||||
{
|
||||
if (!$code)
|
||||
{
|
||||
show_404();
|
||||
}
|
||||
|
||||
$user = $this->ion_auth->forgotten_password_check($code);
|
||||
|
||||
if ($user)
|
||||
{
|
||||
// if the code is valid then display the password reset form
|
||||
|
||||
$this->form_validation->set_rules('new', $this->lang->line('reset_password_validation_new_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[new_confirm]');
|
||||
$this->form_validation->set_rules('new_confirm', $this->lang->line('reset_password_validation_new_password_confirm_label'), 'required');
|
||||
|
||||
if ($this->form_validation->run() === FALSE)
|
||||
{
|
||||
// display the form
|
||||
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
|
||||
|
||||
$this->data['min_password_length'] = $this->config->item('min_password_length', 'ion_auth');
|
||||
$this->data['new_password'] = array(
|
||||
'name' => 'new',
|
||||
'id' => 'new',
|
||||
'type' => 'password',
|
||||
'pattern' => '^.{' . $this->data['min_password_length'] . '}.*$',
|
||||
);
|
||||
$this->data['new_password_confirm'] = array(
|
||||
'name' => 'new_confirm',
|
||||
'id' => 'new_confirm',
|
||||
'type' => 'password',
|
||||
'pattern' => '^.{' . $this->data['min_password_length'] . '}.*$',
|
||||
);
|
||||
$this->data['user_id'] = array(
|
||||
'name' => 'user_id',
|
||||
'id' => 'user_id',
|
||||
'type' => 'hidden',
|
||||
'value' => $user->id,
|
||||
);
|
||||
$this->data['csrf'] = $this->_get_csrf_nonce();
|
||||
$this->data['code'] = $code;
|
||||
|
||||
// render
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'reset_password', $this->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// do we have a valid request?
|
||||
if ($this->_valid_csrf_nonce() === FALSE || $user->id != $this->input->post('user_id'))
|
||||
{
|
||||
|
||||
// something fishy might be up
|
||||
$this->ion_auth->clear_forgotten_password_code($code);
|
||||
|
||||
show_error($this->lang->line('error_csrf'));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// finally change the password
|
||||
$identity = $user->{$this->config->item('identity', 'ion_auth')};
|
||||
|
||||
$change = $this->ion_auth->reset_password($identity, $this->input->post('new'));
|
||||
|
||||
if ($change)
|
||||
{
|
||||
// if the password was successfully changed
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect("auth/login", 'refresh');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect('auth/reset_password/' . $code, 'refresh');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the code is invalid then send them back to the forgot password page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect("auth/forgot_password", 'refresh');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the user
|
||||
*
|
||||
* @param int $id The user ID
|
||||
* @param string|bool $code The activation code
|
||||
*/
|
||||
public function activate($id, $code = FALSE)
|
||||
{
|
||||
if ($code !== FALSE)
|
||||
{
|
||||
$activation = $this->ion_auth->activate($id, $code);
|
||||
}
|
||||
else if ($this->ion_auth->is_admin())
|
||||
{
|
||||
$activation = $this->ion_auth->activate($id);
|
||||
}
|
||||
|
||||
if ($activation)
|
||||
{
|
||||
// redirect them to the auth page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect("auth", 'refresh');
|
||||
}
|
||||
else
|
||||
{
|
||||
// redirect them to the forgot password page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
redirect("auth/forgot_password", 'refresh');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate the user
|
||||
*
|
||||
* @param int|string|null $id The user ID
|
||||
*/
|
||||
public function deactivate($id = NULL)
|
||||
{
|
||||
if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
|
||||
{
|
||||
// redirect them to the home page because they must be an administrator to view this
|
||||
return show_error('You must be an administrator to view this page.');
|
||||
}
|
||||
|
||||
$id = (int)$id;
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->form_validation->set_rules('confirm', $this->lang->line('deactivate_validation_confirm_label'), 'required');
|
||||
$this->form_validation->set_rules('id', $this->lang->line('deactivate_validation_user_id_label'), 'required|alpha_numeric');
|
||||
|
||||
if ($this->form_validation->run() === FALSE)
|
||||
{
|
||||
// insert csrf check
|
||||
$this->data['csrf'] = $this->_get_csrf_nonce();
|
||||
$this->data['user'] = $this->ion_auth->user($id)->row();
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'deactivate_user', $this->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
// do we really want to deactivate?
|
||||
if ($this->input->post('confirm') == 'yes')
|
||||
{
|
||||
// do we have a valid request?
|
||||
if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
|
||||
{
|
||||
return show_error($this->lang->line('error_csrf'));
|
||||
}
|
||||
|
||||
// do we have the right userlevel?
|
||||
if ($this->ion_auth->logged_in() && $this->ion_auth->is_admin())
|
||||
{
|
||||
$this->ion_auth->deactivate($id);
|
||||
}
|
||||
}
|
||||
|
||||
// redirect them back to the auth page
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user
|
||||
*/
|
||||
public function create_user()
|
||||
{
|
||||
$this->data['title'] = $this->lang->line('create_user_heading');
|
||||
|
||||
if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
|
||||
{
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
|
||||
$tables = $this->config->item('tables', 'ion_auth');
|
||||
$identity_column = $this->config->item('identity', 'ion_auth');
|
||||
$this->data['identity_column'] = $identity_column;
|
||||
|
||||
// validate form input
|
||||
$this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'trim|required');
|
||||
$this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'), 'trim|required');
|
||||
if ($identity_column !== 'email')
|
||||
{
|
||||
$this->form_validation->set_rules('identity', $this->lang->line('create_user_validation_identity_label'), 'trim|required|is_unique[' . $tables['users'] . '.' . $identity_column . ']');
|
||||
$this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'trim|required|valid_email');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'trim|required|valid_email|is_unique[' . $tables['users'] . '.email]');
|
||||
}
|
||||
$this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'trim');
|
||||
$this->form_validation->set_rules('company', $this->lang->line('create_user_validation_company_label'), 'trim');
|
||||
$this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
|
||||
$this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
|
||||
|
||||
if ($this->form_validation->run() === TRUE)
|
||||
{
|
||||
$email = strtolower($this->input->post('email'));
|
||||
$identity = ($identity_column === 'email') ? $email : $this->input->post('identity');
|
||||
$password = $this->input->post('password');
|
||||
|
||||
$additional_data = array(
|
||||
'first_name' => $this->input->post('first_name'),
|
||||
'last_name' => $this->input->post('last_name'),
|
||||
'company' => $this->input->post('company'),
|
||||
'phone' => $this->input->post('phone'),
|
||||
);
|
||||
}
|
||||
if ($this->form_validation->run() === TRUE && $this->ion_auth->register($identity, $password, $email, $additional_data))
|
||||
{
|
||||
// check to see if we are creating the user
|
||||
// redirect them back to the admin page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect("auth", 'refresh');
|
||||
}
|
||||
else
|
||||
{
|
||||
// display the create user form
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
|
||||
|
||||
$this->data['first_name'] = array(
|
||||
'name' => 'first_name',
|
||||
'id' => 'first_name',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('first_name'),
|
||||
);
|
||||
$this->data['last_name'] = array(
|
||||
'name' => 'last_name',
|
||||
'id' => 'last_name',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('last_name'),
|
||||
);
|
||||
$this->data['identity'] = array(
|
||||
'name' => 'identity',
|
||||
'id' => 'identity',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('identity'),
|
||||
);
|
||||
$this->data['email'] = array(
|
||||
'name' => 'email',
|
||||
'id' => 'email',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('email'),
|
||||
);
|
||||
$this->data['company'] = array(
|
||||
'name' => 'company',
|
||||
'id' => 'company',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('company'),
|
||||
);
|
||||
$this->data['phone'] = array(
|
||||
'name' => 'phone',
|
||||
'id' => 'phone',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('phone'),
|
||||
);
|
||||
$this->data['password'] = array(
|
||||
'name' => 'password',
|
||||
'id' => 'password',
|
||||
'type' => 'password',
|
||||
'value' => $this->form_validation->set_value('password'),
|
||||
);
|
||||
$this->data['password_confirm'] = array(
|
||||
'name' => 'password_confirm',
|
||||
'id' => 'password_confirm',
|
||||
'type' => 'password',
|
||||
'value' => $this->form_validation->set_value('password_confirm'),
|
||||
);
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'create_user', $this->data);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Redirect a user checking if is admin
|
||||
*/
|
||||
public function redirectUser(){
|
||||
if ($this->ion_auth->is_admin()){
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
redirect('/', 'refresh');
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a user
|
||||
*
|
||||
* @param int|string $id
|
||||
*/
|
||||
public function edit_user($id)
|
||||
{
|
||||
$this->data['title'] = $this->lang->line('edit_user_heading');
|
||||
|
||||
if (!$this->ion_auth->logged_in() || (!$this->ion_auth->is_admin() && !($this->ion_auth->user()->row()->id == $id)))
|
||||
{
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
|
||||
$user = $this->ion_auth->user($id)->row();
|
||||
$groups = $this->ion_auth->groups()->result_array();
|
||||
$currentGroups = $this->ion_auth->get_users_groups($id)->result();
|
||||
|
||||
// validate form input
|
||||
$this->form_validation->set_rules('first_name', $this->lang->line('edit_user_validation_fname_label'), 'trim|required');
|
||||
$this->form_validation->set_rules('last_name', $this->lang->line('edit_user_validation_lname_label'), 'trim|required');
|
||||
$this->form_validation->set_rules('phone', $this->lang->line('edit_user_validation_phone_label'), 'trim|required');
|
||||
$this->form_validation->set_rules('company', $this->lang->line('edit_user_validation_company_label'), 'trim|required');
|
||||
|
||||
if (isset($_POST) && !empty($_POST))
|
||||
{
|
||||
// do we have a valid request?
|
||||
if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
|
||||
{
|
||||
show_error($this->lang->line('error_csrf'));
|
||||
}
|
||||
|
||||
// update the password if it was posted
|
||||
if ($this->input->post('password'))
|
||||
{
|
||||
$this->form_validation->set_rules('password', $this->lang->line('edit_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
|
||||
$this->form_validation->set_rules('password_confirm', $this->lang->line('edit_user_validation_password_confirm_label'), 'required');
|
||||
}
|
||||
|
||||
if ($this->form_validation->run() === TRUE)
|
||||
{
|
||||
$data = array(
|
||||
'first_name' => $this->input->post('first_name'),
|
||||
'last_name' => $this->input->post('last_name'),
|
||||
'company' => $this->input->post('company'),
|
||||
'phone' => $this->input->post('phone'),
|
||||
);
|
||||
|
||||
// update the password if it was posted
|
||||
if ($this->input->post('password'))
|
||||
{
|
||||
$data['password'] = $this->input->post('password');
|
||||
}
|
||||
|
||||
// Only allow updating groups if user is admin
|
||||
if ($this->ion_auth->is_admin())
|
||||
{
|
||||
// Update the groups user belongs to
|
||||
$groupData = $this->input->post('groups');
|
||||
|
||||
if (isset($groupData) && !empty($groupData))
|
||||
{
|
||||
|
||||
$this->ion_auth->remove_from_group('', $id);
|
||||
|
||||
foreach ($groupData as $grp)
|
||||
{
|
||||
$this->ion_auth->add_to_group($grp, $id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// check to see if we are updating the user
|
||||
if ($this->ion_auth->update($user->id, $data))
|
||||
{
|
||||
// redirect them back to the admin page if admin, or to the base url if non admin
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
$this->redirectUser();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// redirect them back to the admin page if admin, or to the base url if non admin
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
$this->redirectUser();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// display the edit user form
|
||||
$this->data['csrf'] = $this->_get_csrf_nonce();
|
||||
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
|
||||
|
||||
// pass the user to the view
|
||||
$this->data['user'] = $user;
|
||||
$this->data['groups'] = $groups;
|
||||
$this->data['currentGroups'] = $currentGroups;
|
||||
|
||||
$this->data['first_name'] = array(
|
||||
'name' => 'first_name',
|
||||
'id' => 'first_name',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('first_name', $user->first_name),
|
||||
);
|
||||
$this->data['last_name'] = array(
|
||||
'name' => 'last_name',
|
||||
'id' => 'last_name',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('last_name', $user->last_name),
|
||||
);
|
||||
$this->data['company'] = array(
|
||||
'name' => 'company',
|
||||
'id' => 'company',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('company', $user->company),
|
||||
);
|
||||
$this->data['phone'] = array(
|
||||
'name' => 'phone',
|
||||
'id' => 'phone',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('phone', $user->phone),
|
||||
);
|
||||
$this->data['password'] = array(
|
||||
'name' => 'password',
|
||||
'id' => 'password',
|
||||
'type' => 'password'
|
||||
);
|
||||
$this->data['password_confirm'] = array(
|
||||
'name' => 'password_confirm',
|
||||
'id' => 'password_confirm',
|
||||
'type' => 'password'
|
||||
);
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'edit_user', $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new group
|
||||
*/
|
||||
public function create_group()
|
||||
{
|
||||
$this->data['title'] = $this->lang->line('create_group_title');
|
||||
|
||||
if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
|
||||
{
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
|
||||
// validate form input
|
||||
$this->form_validation->set_rules('group_name', $this->lang->line('create_group_validation_name_label'), 'trim|required|alpha_dash');
|
||||
|
||||
if ($this->form_validation->run() === TRUE)
|
||||
{
|
||||
$new_group_id = $this->ion_auth->create_group($this->input->post('group_name'), $this->input->post('description'));
|
||||
if ($new_group_id)
|
||||
{
|
||||
// check to see if we are creating the group
|
||||
// redirect them back to the admin page
|
||||
$this->session->set_flashdata('message', $this->ion_auth->messages());
|
||||
redirect("auth", 'refresh');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// display the create group form
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
|
||||
|
||||
$this->data['group_name'] = array(
|
||||
'name' => 'group_name',
|
||||
'id' => 'group_name',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('group_name'),
|
||||
);
|
||||
$this->data['description'] = array(
|
||||
'name' => 'description',
|
||||
'id' => 'description',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('description'),
|
||||
);
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'create_group', $this->data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a group
|
||||
*
|
||||
* @param int|string $id
|
||||
*/
|
||||
public function edit_group($id)
|
||||
{
|
||||
// bail if no group id given
|
||||
if (!$id || empty($id))
|
||||
{
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
|
||||
$this->data['title'] = $this->lang->line('edit_group_title');
|
||||
|
||||
if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
|
||||
{
|
||||
redirect('auth', 'refresh');
|
||||
}
|
||||
|
||||
$group = $this->ion_auth->group($id)->row();
|
||||
|
||||
// validate form input
|
||||
$this->form_validation->set_rules('group_name', $this->lang->line('edit_group_validation_name_label'), 'required|alpha_dash');
|
||||
|
||||
if (isset($_POST) && !empty($_POST))
|
||||
{
|
||||
if ($this->form_validation->run() === TRUE)
|
||||
{
|
||||
$group_update = $this->ion_auth->update_group($id, $_POST['group_name'], $_POST['group_description']);
|
||||
|
||||
if ($group_update)
|
||||
{
|
||||
$this->session->set_flashdata('message', $this->lang->line('edit_group_saved'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('message', $this->ion_auth->errors());
|
||||
}
|
||||
redirect("auth", 'refresh');
|
||||
}
|
||||
}
|
||||
|
||||
// set the flash data error message if there is one
|
||||
$this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
|
||||
|
||||
// pass the user to the view
|
||||
$this->data['group'] = $group;
|
||||
|
||||
$readonly = $this->config->item('admin_group', 'ion_auth') === $group->name ? 'readonly' : '';
|
||||
|
||||
$this->data['group_name'] = array(
|
||||
'name' => 'group_name',
|
||||
'id' => 'group_name',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('group_name', $group->name),
|
||||
$readonly => $readonly,
|
||||
);
|
||||
$this->data['group_description'] = array(
|
||||
'name' => 'group_description',
|
||||
'id' => 'group_description',
|
||||
'type' => 'text',
|
||||
'value' => $this->form_validation->set_value('group_description', $group->description),
|
||||
);
|
||||
|
||||
$this->_render_page('auth' . DIRECTORY_SEPARATOR . 'edit_group', $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array A CSRF key-value pair
|
||||
*/
|
||||
public function _get_csrf_nonce()
|
||||
{
|
||||
$this->load->helper('string');
|
||||
$key = random_string('alnum', 8);
|
||||
$value = random_string('alnum', 20);
|
||||
$this->session->set_flashdata('csrfkey', $key);
|
||||
$this->session->set_flashdata('csrfvalue', $value);
|
||||
|
||||
return array($key => $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool Whether the posted CSRF token matches
|
||||
*/
|
||||
public function _valid_csrf_nonce(){
|
||||
$csrfkey = $this->input->post($this->session->flashdata('csrfkey'));
|
||||
if ($csrfkey && $csrfkey === $this->session->flashdata('csrfvalue')){
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $view
|
||||
* @param array|null $data
|
||||
* @param bool $returnhtml
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function _render_page($view, $data = NULL, $returnhtml = FALSE)//I think this makes more sense
|
||||
{
|
||||
|
||||
$this->viewdata = (empty($data)) ? $this->data : $data;
|
||||
|
||||
$view_html = $this->load->view($view, $this->viewdata, $returnhtml);
|
||||
|
||||
// This will return html on 3rd argument being true
|
||||
if ($returnhtml)
|
||||
{
|
||||
return $view_html;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
10
application/controllers/index.html
Normal file
10
application/controllers/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
27
application/controllers/welcome.php
Normal file
27
application/controllers/welcome.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends MY_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 http://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('welcome_message');
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
8
application/core/MY_Controller.php
Normal file
8
application/core/MY_Controller.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class MY_Controller extends CI_Controller {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
9
application/core/MY_Model.php
Normal file
9
application/core/MY_Model.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class MY_Model extends CI_Model {
|
||||
|
||||
public function __consturct() {
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
}
|
||||
10
application/core/index.html
Normal file
10
application/core/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
62
application/errors/error_404.php
Normal file
62
application/errors/error_404.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>404 Page Not Found</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection{ background-color: #E13300; color: white; }
|
||||
::moz-selection{ background-color: #E13300; color: white; }
|
||||
::webkit-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;
|
||||
-webkit-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>
|
||||
62
application/errors/error_db.php
Normal file
62
application/errors/error_db.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Database Error</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection{ background-color: #E13300; color: white; }
|
||||
::moz-selection{ background-color: #E13300; color: white; }
|
||||
::webkit-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;
|
||||
-webkit-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>
|
||||
62
application/errors/error_general.php
Normal file
62
application/errors/error_general.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Error</title>
|
||||
<style type="text/css">
|
||||
|
||||
::selection{ background-color: #E13300; color: white; }
|
||||
::moz-selection{ background-color: #E13300; color: white; }
|
||||
::webkit-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;
|
||||
-webkit-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>
|
||||
10
application/errors/error_php.php
Normal file
10
application/errors/error_php.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<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>
|
||||
|
||||
</div>
|
||||
10
application/errors/index.html
Normal file
10
application/errors/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/helpers/index.html
Normal file
10
application/helpers/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/hooks/index.html
Normal file
10
application/hooks/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/index.html
Normal file
10
application/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
145
application/language/english/auth_lang.php
Normal file
145
application/language/english/auth_lang.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Name: Auth Lang - English
|
||||
*
|
||||
* Author: Ben Edmunds
|
||||
* ben.edmunds@gmail.com
|
||||
* @benedmunds
|
||||
*
|
||||
* Author: Daniel Davis
|
||||
* @ourmaninjapan
|
||||
*
|
||||
* Location: http://github.com/benedmunds/ion_auth/
|
||||
*
|
||||
* Created: 03.09.2013
|
||||
*
|
||||
* Description: English language file for Ion Auth example views
|
||||
*
|
||||
*/
|
||||
|
||||
// Errors
|
||||
$lang['error_csrf'] = 'This form post did not pass our security checks.';
|
||||
|
||||
// Login
|
||||
$lang['login_heading'] = 'Login';
|
||||
$lang['login_subheading'] = 'Please login with your email/username and password below.';
|
||||
$lang['login_identity_label'] = 'Email/Username:';
|
||||
$lang['login_password_label'] = 'Password:';
|
||||
$lang['login_remember_label'] = 'Remember Me:';
|
||||
$lang['login_submit_btn'] = 'Login';
|
||||
$lang['login_forgot_password'] = 'Forgot your password?';
|
||||
|
||||
// Index
|
||||
$lang['index_heading'] = 'Users';
|
||||
$lang['index_subheading'] = 'Below is a list of the users.';
|
||||
$lang['index_fname_th'] = 'First Name';
|
||||
$lang['index_lname_th'] = 'Last Name';
|
||||
$lang['index_email_th'] = 'Email';
|
||||
$lang['index_groups_th'] = 'Groups';
|
||||
$lang['index_status_th'] = 'Status';
|
||||
$lang['index_action_th'] = 'Action';
|
||||
$lang['index_active_link'] = 'Active';
|
||||
$lang['index_inactive_link'] = 'Inactive';
|
||||
$lang['index_create_user_link'] = 'Create a new user';
|
||||
$lang['index_create_group_link'] = 'Create a new group';
|
||||
|
||||
// Deactivate User
|
||||
$lang['deactivate_heading'] = 'Deactivate User';
|
||||
$lang['deactivate_subheading'] = 'Are you sure you want to deactivate the user \'%s\'';
|
||||
$lang['deactivate_confirm_y_label'] = 'Yes:';
|
||||
$lang['deactivate_confirm_n_label'] = 'No:';
|
||||
$lang['deactivate_submit_btn'] = 'Submit';
|
||||
$lang['deactivate_validation_confirm_label'] = 'confirmation';
|
||||
$lang['deactivate_validation_user_id_label'] = 'user ID';
|
||||
|
||||
// Create User
|
||||
$lang['create_user_heading'] = 'Create User';
|
||||
$lang['create_user_subheading'] = 'Please enter the user\'s information below.';
|
||||
$lang['create_user_fname_label'] = 'First Name:';
|
||||
$lang['create_user_lname_label'] = 'Last Name:';
|
||||
$lang['create_user_company_label'] = 'Company Name:';
|
||||
$lang['create_user_identity_label'] = 'Identity:';
|
||||
$lang['create_user_email_label'] = 'Email:';
|
||||
$lang['create_user_phone_label'] = 'Phone:';
|
||||
$lang['create_user_password_label'] = 'Password:';
|
||||
$lang['create_user_password_confirm_label'] = 'Confirm Password:';
|
||||
$lang['create_user_submit_btn'] = 'Create User';
|
||||
$lang['create_user_validation_fname_label'] = 'First Name';
|
||||
$lang['create_user_validation_lname_label'] = 'Last Name';
|
||||
$lang['create_user_validation_identity_label'] = 'Identity';
|
||||
$lang['create_user_validation_email_label'] = 'Email Address';
|
||||
$lang['create_user_validation_phone_label'] = 'Phone';
|
||||
$lang['create_user_validation_company_label'] = 'Company Name';
|
||||
$lang['create_user_validation_password_label'] = 'Password';
|
||||
$lang['create_user_validation_password_confirm_label'] = 'Password Confirmation';
|
||||
|
||||
// Edit User
|
||||
$lang['edit_user_heading'] = 'Edit User';
|
||||
$lang['edit_user_subheading'] = 'Please enter the user\'s information below.';
|
||||
$lang['edit_user_fname_label'] = 'First Name:';
|
||||
$lang['edit_user_lname_label'] = 'Last Name:';
|
||||
$lang['edit_user_company_label'] = 'Company Name:';
|
||||
$lang['edit_user_email_label'] = 'Email:';
|
||||
$lang['edit_user_phone_label'] = 'Phone:';
|
||||
$lang['edit_user_password_label'] = 'Password: (if changing password)';
|
||||
$lang['edit_user_password_confirm_label'] = 'Confirm Password: (if changing password)';
|
||||
$lang['edit_user_groups_heading'] = 'Member of groups';
|
||||
$lang['edit_user_submit_btn'] = 'Save User';
|
||||
$lang['edit_user_validation_fname_label'] = 'First Name';
|
||||
$lang['edit_user_validation_lname_label'] = 'Last Name';
|
||||
$lang['edit_user_validation_email_label'] = 'Email Address';
|
||||
$lang['edit_user_validation_phone_label'] = 'Phone';
|
||||
$lang['edit_user_validation_company_label'] = 'Company Name';
|
||||
$lang['edit_user_validation_groups_label'] = 'Groups';
|
||||
$lang['edit_user_validation_password_label'] = 'Password';
|
||||
$lang['edit_user_validation_password_confirm_label'] = 'Password Confirmation';
|
||||
|
||||
// Create Group
|
||||
$lang['create_group_title'] = 'Create Group';
|
||||
$lang['create_group_heading'] = 'Create Group';
|
||||
$lang['create_group_subheading'] = 'Please enter the group information below.';
|
||||
$lang['create_group_name_label'] = 'Group Name:';
|
||||
$lang['create_group_desc_label'] = 'Description:';
|
||||
$lang['create_group_submit_btn'] = 'Create Group';
|
||||
$lang['create_group_validation_name_label'] = 'Group Name';
|
||||
$lang['create_group_validation_desc_label'] = 'Description';
|
||||
|
||||
// Edit Group
|
||||
$lang['edit_group_title'] = 'Edit Group';
|
||||
$lang['edit_group_saved'] = 'Group Saved';
|
||||
$lang['edit_group_heading'] = 'Edit Group';
|
||||
$lang['edit_group_subheading'] = 'Please enter the group information below.';
|
||||
$lang['edit_group_name_label'] = 'Group Name:';
|
||||
$lang['edit_group_desc_label'] = 'Description:';
|
||||
$lang['edit_group_submit_btn'] = 'Save Group';
|
||||
$lang['edit_group_validation_name_label'] = 'Group Name';
|
||||
$lang['edit_group_validation_desc_label'] = 'Description';
|
||||
|
||||
// Change Password
|
||||
$lang['change_password_heading'] = 'Change Password';
|
||||
$lang['change_password_old_password_label'] = 'Old Password:';
|
||||
$lang['change_password_new_password_label'] = 'New Password (at least %s characters long):';
|
||||
$lang['change_password_new_password_confirm_label'] = 'Confirm New Password:';
|
||||
$lang['change_password_submit_btn'] = 'Change';
|
||||
$lang['change_password_validation_old_password_label'] = 'Old Password';
|
||||
$lang['change_password_validation_new_password_label'] = 'New Password';
|
||||
$lang['change_password_validation_new_password_confirm_label'] = 'Confirm New Password';
|
||||
|
||||
// Forgot Password
|
||||
$lang['forgot_password_heading'] = 'Forgot Password';
|
||||
$lang['forgot_password_subheading'] = 'Please enter your %s so we can send you an email to reset your password.';
|
||||
$lang['forgot_password_email_label'] = '%s:';
|
||||
$lang['forgot_password_submit_btn'] = 'Submit';
|
||||
$lang['forgot_password_validation_email_label'] = 'Email Address';
|
||||
$lang['forgot_password_identity_label'] = 'Identity';
|
||||
$lang['forgot_password_email_identity_label'] = 'Email';
|
||||
$lang['forgot_password_email_not_found'] = 'No record of that email address.';
|
||||
$lang['forgot_password_identity_not_found'] = 'No record of that username.';
|
||||
|
||||
// Reset Password
|
||||
$lang['reset_password_heading'] = 'Change Password';
|
||||
$lang['reset_password_new_password_label'] = 'New Password (at least %s characters long):';
|
||||
$lang['reset_password_new_password_confirm_label'] = 'Confirm New Password:';
|
||||
$lang['reset_password_submit_btn'] = 'Change';
|
||||
$lang['reset_password_validation_new_password_label'] = 'New Password';
|
||||
$lang['reset_password_validation_new_password_confirm_label'] = 'Confirm New Password';
|
||||
10
application/language/english/index.html
Normal file
10
application/language/english/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
79
application/language/english/ion_auth_lang.php
Normal file
79
application/language/english/ion_auth_lang.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Name: Ion Auth Lang - English
|
||||
*
|
||||
* Author: Ben Edmunds
|
||||
* ben.edmunds@gmail.com
|
||||
* @benedmunds
|
||||
*
|
||||
* Location: http://github.com/benedmunds/ion_auth/
|
||||
*
|
||||
* Created: 03.14.2010
|
||||
*
|
||||
* Description: English language file for Ion Auth messages and errors
|
||||
*
|
||||
*/
|
||||
|
||||
// Account Creation
|
||||
$lang['account_creation_successful'] = 'Account Successfully Created';
|
||||
$lang['account_creation_unsuccessful'] = 'Unable to Create Account';
|
||||
$lang['account_creation_duplicate_email'] = 'Email Already Used or Invalid';
|
||||
$lang['account_creation_duplicate_identity'] = 'Identity Already Used or Invalid';
|
||||
$lang['account_creation_missing_default_group'] = 'Default group is not set';
|
||||
$lang['account_creation_invalid_default_group'] = 'Invalid default group name set';
|
||||
|
||||
|
||||
// Password
|
||||
$lang['password_change_successful'] = 'Password Successfully Changed';
|
||||
$lang['password_change_unsuccessful'] = 'Unable to Change Password';
|
||||
$lang['forgot_password_successful'] = 'Password Reset Email Sent';
|
||||
$lang['forgot_password_unsuccessful'] = 'Unable to email the Reset Password link';
|
||||
|
||||
// Activation
|
||||
$lang['activate_successful'] = 'Account Activated';
|
||||
$lang['activate_unsuccessful'] = 'Unable to Activate Account';
|
||||
$lang['deactivate_successful'] = 'Account De-Activated';
|
||||
$lang['deactivate_unsuccessful'] = 'Unable to De-Activate Account';
|
||||
$lang['activation_email_successful'] = 'Activation Email Sent. Please check your inbox or spam';
|
||||
$lang['activation_email_unsuccessful'] = 'Unable to Send Activation Email';
|
||||
$lang['deactivate_current_user_unsuccessful']= 'You cannot De-Activate your self.';
|
||||
|
||||
// Login / Logout
|
||||
$lang['login_successful'] = 'Logged In Successfully';
|
||||
$lang['login_unsuccessful'] = 'Incorrect Login';
|
||||
$lang['login_unsuccessful_not_active'] = 'Account is inactive';
|
||||
$lang['login_timeout'] = 'Temporarily Locked Out. Try again later.';
|
||||
$lang['logout_successful'] = 'Logged Out Successfully';
|
||||
|
||||
// Account Changes
|
||||
$lang['update_successful'] = 'Account Information Successfully Updated';
|
||||
$lang['update_unsuccessful'] = 'Unable to Update Account Information';
|
||||
$lang['delete_successful'] = 'User Deleted';
|
||||
$lang['delete_unsuccessful'] = 'Unable to Delete User';
|
||||
|
||||
// Groups
|
||||
$lang['group_creation_successful'] = 'Group created Successfully';
|
||||
$lang['group_already_exists'] = 'Group name already taken';
|
||||
$lang['group_update_successful'] = 'Group details updated';
|
||||
$lang['group_delete_successful'] = 'Group deleted';
|
||||
$lang['group_delete_unsuccessful'] = 'Unable to delete group';
|
||||
$lang['group_delete_notallowed'] = 'Can\'t delete the administrators\' group';
|
||||
$lang['group_name_required'] = 'Group name is a required field';
|
||||
$lang['group_name_admin_not_alter'] = 'Admin group name can not be changed';
|
||||
|
||||
// Activation Email
|
||||
$lang['email_activation_subject'] = 'Account Activation';
|
||||
$lang['email_activate_heading'] = 'Activate account for %s';
|
||||
$lang['email_activate_subheading'] = 'Please click this link to %s.';
|
||||
$lang['email_activate_link'] = 'Activate Your Account';
|
||||
|
||||
// Forgot Password Email
|
||||
$lang['email_forgotten_password_subject'] = 'Forgotten Password Verification';
|
||||
$lang['email_forgot_password_heading'] = 'Reset Password for %s';
|
||||
$lang['email_forgot_password_subheading'] = 'Please click this link to %s.';
|
||||
$lang['email_forgot_password_link'] = 'Reset Your Password';
|
||||
|
||||
// New Password Email
|
||||
$lang['email_new_password_subject'] = 'New Password';
|
||||
$lang['email_new_password_heading'] = 'New Password for %s';
|
||||
$lang['email_new_password_subheading'] = 'Your password has been reset to: %s';
|
||||
10
application/language/index.html
Normal file
10
application/language/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
161
application/language/korean/auth_lang.php
Normal file
161
application/language/korean/auth_lang.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Name: Auth Lang - Korean
|
||||
*
|
||||
* Author: Yoon, Seongsu
|
||||
* sople1@snooey.net
|
||||
* @sople1
|
||||
*
|
||||
* Location: http://github.com/benedmunds/ion_auth/
|
||||
*
|
||||
* Created: 2013-07-03
|
||||
*
|
||||
* Description: Korean language file for Ion Auth example views
|
||||
*
|
||||
*/
|
||||
|
||||
// Errors
|
||||
$lang['error_csrf'] = '폼 전송값이 보안 검사를 통과하지 못했습니다.';
|
||||
|
||||
// Login
|
||||
$lang['login_heading'] = '로그인';
|
||||
$lang['login_subheading'] = '이메일이나 계정명으로 로그인 하세요.';
|
||||
$lang['login_identity_label'] = '이메일/계정명:';
|
||||
$lang['login_password_label'] = '비밀번호:';
|
||||
$lang['login_remember_label'] = '기억하기:';
|
||||
$lang['login_submit_btn'] = '로그인';
|
||||
$lang['login_forgot_password'] = '비밀번호를 잊으셨습니까?';
|
||||
|
||||
// Index
|
||||
$lang['index_heading'] = '사용자';
|
||||
$lang['index_subheading'] = '사용자 목록입니다.';
|
||||
$lang['index_fname_th'] = '이름';
|
||||
$lang['index_lname_th'] = '성';
|
||||
$lang['index_email_th'] = '이메일';
|
||||
$lang['index_groups_th'] = '그룹';
|
||||
$lang['index_status_th'] = '상태';
|
||||
$lang['index_action_th'] = '활동';
|
||||
$lang['index_active_link'] = '활성화';
|
||||
$lang['index_inactive_link'] = '비활성화';
|
||||
$lang['index_create_user_link'] = '새 사용자를 만듭니다';
|
||||
$lang['index_create_group_link'] = '새 그룹을 만듭니다';
|
||||
|
||||
// Deactivate User
|
||||
$lang['deactivate_heading'] = '사용자 비활성화';
|
||||
$lang['deactivate_subheading'] = '\'%s\' 사용자를 비활성화 하시겠습니까?';
|
||||
$lang['deactivate_confirm_y_label'] = '예:';
|
||||
$lang['deactivate_confirm_n_label'] = '아니요:';
|
||||
$lang['deactivate_submit_btn'] = '전송';
|
||||
$lang['deactivate_validation_confirm_label'] = '정보 확인';
|
||||
$lang['deactivate_validation_user_id_label'] = '사용자 ID';
|
||||
|
||||
// Create User
|
||||
$lang['create_user_heading'] = '사용자 만들기';
|
||||
$lang['create_user_subheading'] = '사용자 정보를 입력해 주세요.';
|
||||
$lang['create_user_fname_label'] = '이름:';
|
||||
$lang['create_user_lname_label'] = '성:';
|
||||
$lang['create_user_identity_label'] = 'Identity:';
|
||||
$lang['create_user_company_label'] = '회사명:';
|
||||
$lang['create_user_email_label'] = '이메일:';
|
||||
$lang['create_user_phone_label'] = '전화번호:';
|
||||
$lang['create_user_password_label'] = '비밀번호:';
|
||||
$lang['create_user_password_confirm_label'] = '비밀번호 재입력:';
|
||||
$lang['create_user_submit_btn'] = '사용자 만들기';
|
||||
$lang['create_user_validation_fname_label'] = '이름';
|
||||
$lang['create_user_validation_lname_label'] = '성';
|
||||
$lang['create_user_validation_identity_label'] = 'Identity';
|
||||
$lang['create_user_validation_email_label'] = '이메일 주소';
|
||||
$lang['create_user_validation_phone1_label'] = '전화번호 앞자리';
|
||||
$lang['create_user_validation_phone2_label'] = '전화번호 중간자리';
|
||||
$lang['create_user_validation_phone3_label'] = '전화번호 마지막자리';
|
||||
$lang['create_user_validation_company_label'] = '회사명';
|
||||
$lang['create_user_validation_password_label'] = '비밀번호';
|
||||
$lang['create_user_validation_password_confirm_label'] = '비밀번호 재입력';
|
||||
|
||||
// Edit User
|
||||
$lang['edit_user_heading'] = '사용자 정보 수정';
|
||||
$lang['edit_user_subheading'] = '사용자 정보를 입력해 주세요.';
|
||||
$lang['edit_user_fname_label'] = '이름:';
|
||||
$lang['edit_user_lname_label'] = '성:';
|
||||
$lang['edit_user_company_label'] = '회사명:';
|
||||
$lang['edit_user_email_label'] = '이메일:';
|
||||
$lang['edit_user_phone_label'] = '전화번호:';
|
||||
$lang['edit_user_password_label'] = '비밀번호: (바꾸려면 입력)';
|
||||
$lang['edit_user_password_confirm_label'] = '비밀번호 재입력: (바꾸려면 입력)';
|
||||
$lang['edit_user_groups_heading'] = '소속 그룹';
|
||||
$lang['edit_user_submit_btn'] = '정보 저장';
|
||||
$lang['edit_user_validation_fname_label'] = '이름';
|
||||
$lang['edit_user_validation_lname_label'] = '성';
|
||||
$lang['edit_user_validation_email_label'] = '이메일 주소';
|
||||
$lang['edit_user_validation_phone1_label'] = '전화번호 앞자리';
|
||||
$lang['edit_user_validation_phone2_label'] = '전화번호 중간자리';
|
||||
$lang['edit_user_validation_phone3_label'] = '전화번호 마지막자리';
|
||||
$lang['edit_user_validation_company_label'] = '회사명';
|
||||
$lang['edit_user_validation_groups_label'] = '그룹';
|
||||
$lang['edit_user_validation_password_label'] = '비밀번호';
|
||||
$lang['edit_user_validation_password_confirm_label'] = '비밀번호 입력';
|
||||
|
||||
// Create Group
|
||||
$lang['create_group_title'] = '그룹 만들기';
|
||||
$lang['create_group_heading'] = '그룹 만들기';
|
||||
$lang['create_group_subheading'] = '그룹 정보를 입력하세요.';
|
||||
$lang['create_group_name_label'] = '그룹명:';
|
||||
$lang['create_group_desc_label'] = '설명:';
|
||||
$lang['create_group_submit_btn'] = '그룹 만들기';
|
||||
$lang['create_group_validation_name_label'] = '그룹명';
|
||||
$lang['create_group_validation_desc_label'] = '설명';
|
||||
|
||||
// Edit Group
|
||||
$lang['edit_group_title'] = '그룹 정보 수정';
|
||||
$lang['edit_group_saved'] = '그룹이 저장되었습니다';
|
||||
$lang['edit_group_heading'] = '그룹 정보 수정';
|
||||
$lang['edit_group_subheading'] = '그룹 정보를 입력해 주세요.';
|
||||
$lang['edit_group_name_label'] = '그룹명:';
|
||||
$lang['edit_group_desc_label'] = '설명:';
|
||||
$lang['edit_group_submit_btn'] = '정보 저장';
|
||||
$lang['edit_group_validation_name_label'] = '그룹명';
|
||||
$lang['edit_group_validation_desc_label'] = '설명';
|
||||
|
||||
// Change Password
|
||||
$lang['change_password_heading'] = '비밀번호 바꾸기';
|
||||
$lang['change_password_old_password_label'] = '옛 비밀번호:';
|
||||
$lang['change_password_new_password_label'] = '새 비밀번호 (최소 %s 자 이상):';
|
||||
$lang['change_password_new_password_confirm_label'] = '새 비밀번호 재입력:';
|
||||
$lang['change_password_submit_btn'] = '바꾸기';
|
||||
$lang['change_password_validation_old_password_label'] = '옛 비밀번호';
|
||||
$lang['change_password_validation_new_password_label'] = '새 비밀번호';
|
||||
$lang['change_password_validation_new_password_confirm_label'] = '새 비밀번호 재입력';
|
||||
|
||||
// Forgot Password
|
||||
$lang['forgot_password_heading'] = '비밀번호 찾기';
|
||||
$lang['forgot_password_subheading'] = '비밀번호를 찾으려면 %s을 입력하세요. 재설정 방법을 보내드립니다.';
|
||||
$lang['forgot_password_email_label'] = '%s:';
|
||||
$lang['forgot_password_submit_btn'] = '보내기';
|
||||
$lang['forgot_password_validation_email_label'] = '이메일 주소';
|
||||
$lang['forgot_password_username_identity_label'] = '계정명';
|
||||
$lang['forgot_password_email_identity_label'] = '이메일';
|
||||
$lang['forgot_password_email_not_found'] = 'No record of that email address.';
|
||||
$lang['forgot_password_identity_not_found'] = 'No record of that username address.';
|
||||
|
||||
// Reset Password
|
||||
$lang['reset_password_heading'] = '비밀번호 바꾸기';
|
||||
$lang['reset_password_new_password_label'] = '새 비밀번호 (최소 %s 자 이상):';
|
||||
$lang['reset_password_new_password_confirm_label'] = '새 비밀번호 재입력:';
|
||||
$lang['reset_password_submit_btn'] = '바꾸기';
|
||||
$lang['reset_password_validation_new_password_label'] = '새 비밀번호';
|
||||
$lang['reset_password_validation_new_password_confirm_label'] = '새 비밀번호 재입력';
|
||||
|
||||
// Activation Email
|
||||
$lang['email_activate_heading'] = '%s 계정 활성화';
|
||||
$lang['email_activate_subheading'] = '다음 링크를 클릭하여 %s로 접근해 주십시오.';
|
||||
$lang['email_activate_link'] = '계정 활성화';
|
||||
|
||||
// Forgot Password Email
|
||||
$lang['email_forgot_password_heading'] = '%s 계정 비밀번호 변경';
|
||||
$lang['email_forgot_password_subheading'] = '다음 링크를 클릭하여 %s로 접근해 주십시오.';
|
||||
$lang['email_forgot_password_link'] = '비밀번호 변경';
|
||||
|
||||
// New Password Email
|
||||
$lang['email_new_password_heading'] = '%s 비밀번호 초기화';
|
||||
$lang['email_new_password_subheading'] = '계정 비밀번호가 %s 로 변경되었습니다.';
|
||||
|
||||
10
application/language/korean/index.html
Normal file
10
application/language/korean/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
78
application/language/korean/ion_auth_lang.php
Normal file
78
application/language/korean/ion_auth_lang.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Name: Ion Auth Lang - Korean
|
||||
*
|
||||
* Author: Yoon, Seongsu
|
||||
* sople1@snooey.net
|
||||
* @sople1
|
||||
*
|
||||
* Location: http://github.com/benedmunds/ion_auth/
|
||||
*
|
||||
* Created: 2013-07-03
|
||||
*
|
||||
* Description: Korean language file for Ion Auth messages and errors
|
||||
*
|
||||
*/
|
||||
|
||||
// Account Creation
|
||||
$lang['account_creation_successful'] = '계정을 만들었습니다';
|
||||
$lang['account_creation_unsuccessful'] = '계정을 만들 수 없습니다';
|
||||
$lang['account_creation_duplicate_email'] = '이 이메일은 사용중이거나 올바르지 않습니다';
|
||||
$lang['account_creation_duplicate_identity'] = '이 계정명은 사용중이거나 올바르지 않습니다';
|
||||
|
||||
// TODO Please Translate
|
||||
$lang['account_creation_missing_default_group'] = 'Default group is not set';
|
||||
$lang['account_creation_invalid_default_group'] = 'Invalid default group name set';
|
||||
|
||||
// Password
|
||||
$lang['password_change_successful'] = '비밀번호를 바꾸었습니다';
|
||||
$lang['password_change_unsuccessful'] = '비밀번호를 바꿀 수 없습니다';
|
||||
$lang['forgot_password_successful'] = '비밀번호 재설정 이메일을 보냈습니다';
|
||||
$lang['forgot_password_unsuccessful'] = '비밀번호를 재설정할 수 없습니다.';
|
||||
|
||||
// Activation
|
||||
$lang['activate_successful'] = '계정을 활성화하였습니다';
|
||||
$lang['activate_unsuccessful'] = '계정을 활성화할 수 없습니다';
|
||||
$lang['deactivate_successful'] = '계정을 비활성화하였습니다';
|
||||
$lang['deactivate_unsuccessful'] = '계정을 비활성화할 수 없습니다';
|
||||
$lang['activation_email_successful'] = '계정 활성화 이메일을 보냈습니다';
|
||||
$lang['activation_email_unsuccessful'] = '계정 활성화 이메일을 보날 수 없습니다';
|
||||
$lang['deactivate_current_user_unsuccessful']= 'You cannot De-Activate your self.';
|
||||
|
||||
// Login / Logout
|
||||
$lang['login_successful'] = '로그인 하였습니다';
|
||||
$lang['login_unsuccessful'] = '로그인할 수 없습니다';
|
||||
$lang['login_unsuccessful_not_active'] = '계정이 비활성화 되어 로그인할 수 없습니다';
|
||||
$lang['login_timeout'] = '계정이 잠시 잠긴 것 같습니다. 잠시 후에 다시 시도해 주세요.';
|
||||
$lang['logout_successful'] = '로그아웃을 하였습니다';
|
||||
|
||||
// Account Changes
|
||||
$lang['update_successful'] = '계정 정보를 업데이트 하였습니다';
|
||||
$lang['update_unsuccessful'] = '계정 정보를 업데이트할 수 없습니다';
|
||||
$lang['delete_successful'] = '사용자를 삭제하였습니다';
|
||||
$lang['delete_unsuccessful'] = '사용자를 삭제할 수 없습니다';
|
||||
|
||||
// Groups
|
||||
$lang['group_creation_successful'] = '그룹을 생성하였습니다';
|
||||
$lang['group_already_exists'] = '이미 사용 중인 그룹명입니다';
|
||||
$lang['group_update_successful'] = '그룹에 대한 세부 정보를 업데이트 하였습니다';
|
||||
$lang['group_delete_successful'] = '그룹을 삭제했습니다';
|
||||
$lang['group_delete_unsuccessful'] = '그룹을 삭제할 수 없습니다';
|
||||
$lang['group_delete_notallowed'] = 'Can\'t delete the administrators\' group';
|
||||
$lang['group_name_required'] = '그룹 이름을 입력해 주십시오';
|
||||
$lang['group_name_admin_not_alter'] = 'Admin group name can not be changed';
|
||||
|
||||
// Activation Email
|
||||
$lang['email_activation_subject'] = '계정 활성화 방법을 보내드립니다';
|
||||
$lang['email_activate_heading'] = 'Activate account for %s';
|
||||
$lang['email_activate_subheading'] = 'Please click this link to %s.';
|
||||
$lang['email_activate_link'] = 'Activate Your Account';
|
||||
// Forgot Password Email
|
||||
$lang['email_forgotten_password_subject'] = '잊어버린 비밀번호를 찾는 절차를 보내드립니다';
|
||||
$lang['email_forgot_password_heading'] = 'Reset Password for %s';
|
||||
$lang['email_forgot_password_subheading'] = 'Please click this link to %s.';
|
||||
$lang['email_forgot_password_link'] = 'Reset Your Password';
|
||||
// New Password Email
|
||||
$lang['email_new_password_subject'] = '새 비밀번호를 보내드립니다';
|
||||
$lang['email_new_password_heading'] = 'New Password for %s';
|
||||
$lang['email_new_password_subheading'] = 'Your password has been reset to: %s';
|
||||
231
application/libraries/Bcrypt.php
Normal file
231
application/libraries/Bcrypt.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Bcrypt
|
||||
*
|
||||
* Requirements: PHP5 or above
|
||||
*
|
||||
* @package CodeIgniter-Ion-Auth
|
||||
* @author Ben Edmunds
|
||||
* @link http://github.com/benedmunds/CodeIgniter-Ion-Auth
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Class Bcrypt
|
||||
*/
|
||||
class Bcrypt
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $rounds;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $salt_prefix;
|
||||
|
||||
/**
|
||||
* @var int|string|null
|
||||
*/
|
||||
private $randomState;
|
||||
|
||||
/**
|
||||
* Bcrypt constructor.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($params = array('rounds' => 7, 'salt_prefix' => '$2y$'))
|
||||
{
|
||||
|
||||
if (CRYPT_BLOWFISH != 1)
|
||||
{
|
||||
throw new Exception("bcrypt not supported in this installation. See http://php.net/crypt");
|
||||
}
|
||||
|
||||
$this->rounds = $params['rounds'];
|
||||
$this->salt_prefix = $params['salt_prefix'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $input
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public function hash($input)
|
||||
{
|
||||
$hash = crypt($input, $this->getSalt());
|
||||
|
||||
if (strlen($hash) > 13)
|
||||
{
|
||||
return $hash;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $input
|
||||
* @param string $existingHash
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function verify($input, $existingHash)
|
||||
{
|
||||
$hash = crypt($input, $existingHash);
|
||||
return $this->hashEquals($existingHash, $hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Polyfill for hash_equals()
|
||||
* Code mainly taken from hash_equals() compat function of CodeIgniter 3
|
||||
*
|
||||
* @param string $known_string
|
||||
* @param string $user_string
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function hashEquals($known_string, $user_string)
|
||||
{
|
||||
// For CI3 or PHP >= 5.6
|
||||
if (function_exists('hash_equals'))
|
||||
{
|
||||
return hash_equals($known_string, $user_string);
|
||||
}
|
||||
|
||||
// For CI2 with PHP < 5.6
|
||||
// Code from CI3 https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/compat/hash.php
|
||||
if (!is_string($known_string))
|
||||
{
|
||||
trigger_error('hash_equals(): Expected known_string to be a string, ' . strtolower(gettype($known_string)) . ' given', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
else if (!is_string($user_string))
|
||||
{
|
||||
trigger_error('hash_equals(): Expected user_string to be a string, ' . strtolower(gettype($user_string)) . ' given', E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
else if (($length = strlen($known_string)) !== strlen($user_string))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$diff = 0;
|
||||
for ($i = 0; $i < $length; $i++)
|
||||
{
|
||||
$diff |= ord($known_string[$i]) ^ ord($user_string[$i]);
|
||||
}
|
||||
|
||||
return ($diff === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getSalt()
|
||||
{
|
||||
$salt = sprintf($this->salt_prefix . '%02d$', $this->rounds);
|
||||
|
||||
$bytes = $this->getRandomBytes(16);
|
||||
|
||||
$salt .= $this->encodeBytes($bytes);
|
||||
|
||||
return $salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $count
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getRandomBytes($count)
|
||||
{
|
||||
$bytes = '';
|
||||
|
||||
if (function_exists('openssl_random_pseudo_bytes') &&
|
||||
(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN'))
|
||||
{
|
||||
// OpenSSL slow on Win
|
||||
$bytes = openssl_random_pseudo_bytes($count);
|
||||
}
|
||||
|
||||
if ($bytes === '' && @is_readable('/dev/urandom') &&
|
||||
($hRand = @fopen('/dev/urandom', 'rb')) !== FALSE)
|
||||
{
|
||||
$bytes = fread($hRand, $count);
|
||||
fclose($hRand);
|
||||
}
|
||||
|
||||
if (strlen($bytes) < $count)
|
||||
{
|
||||
$bytes = '';
|
||||
|
||||
if ($this->randomState === NULL)
|
||||
{
|
||||
$this->randomState = microtime();
|
||||
if (function_exists('getmypid'))
|
||||
{
|
||||
$this->randomState .= getmypid();
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $count; $i += 16)
|
||||
{
|
||||
$this->randomState = md5(microtime() . $this->randomState);
|
||||
|
||||
if (PHP_VERSION >= '5')
|
||||
{
|
||||
$bytes .= md5($this->randomState, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$bytes .= pack('H*', md5($this->randomState));
|
||||
}
|
||||
}
|
||||
|
||||
$bytes = substr($bytes, 0, $count);
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $input
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function encodeBytes($input)
|
||||
{
|
||||
// The following is code from the PHP Password Hashing Framework
|
||||
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
|
||||
$output = '';
|
||||
$i = 0;
|
||||
do
|
||||
{
|
||||
$c1 = ord($input[$i++]);
|
||||
$output .= $itoa64[$c1 >> 2];
|
||||
$c1 = ($c1 & 0x03) << 4;
|
||||
if ($i >= 16)
|
||||
{
|
||||
$output .= $itoa64[$c1];
|
||||
break;
|
||||
}
|
||||
|
||||
$c2 = ord($input[$i++]);
|
||||
$c1 |= $c2 >> 4;
|
||||
$output .= $itoa64[$c1];
|
||||
$c1 = ($c2 & 0x0f) << 2;
|
||||
|
||||
$c2 = ord($input[$i++]);
|
||||
$c1 |= $c2 >> 6;
|
||||
$output .= $itoa64[$c1];
|
||||
$output .= $itoa64[$c2 & 0x3f];
|
||||
} while (1);
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
267
application/libraries/Format.php
Normal file
267
application/libraries/Format.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/**
|
||||
* Format class
|
||||
*
|
||||
* Help convert between various formats such as XML, JSON, CSV, etc.
|
||||
*
|
||||
* @author Phil Sturgeon
|
||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||
*/
|
||||
class Format {
|
||||
|
||||
// Array to convert
|
||||
protected $_data = array();
|
||||
|
||||
// View filename
|
||||
protected $_from_type = null;
|
||||
|
||||
/**
|
||||
* Returns an instance of the Format object.
|
||||
*
|
||||
* echo $this->format->factory(array('foo' => 'bar'))->to_xml();
|
||||
*
|
||||
* @param mixed general date to be converted
|
||||
* @param string data format the file was provided in
|
||||
* @return Factory
|
||||
*/
|
||||
public function factory($data, $from_type = null)
|
||||
{
|
||||
// Stupid stuff to emulate the "new static()" stuff in this libraries PHP 5.3 equivilent
|
||||
$class = __CLASS__;
|
||||
return new $class($data, $from_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not use this directly, call factory()
|
||||
*/
|
||||
public function __construct($data = null, $from_type = null)
|
||||
{
|
||||
get_instance()->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(array($this, '_from_' . $from_type), $data);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
throw new Exception('Format class does not support conversion from "' . $from_type . '".');
|
||||
}
|
||||
}
|
||||
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
public function to_data() {
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
// FORMATING OUTPUT ---------------------------------------------------------
|
||||
|
||||
public function to_array($data = null)
|
||||
{
|
||||
// If not just null, but nopthing is provided
|
||||
if ($data === null and ! func_num_args())
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
$array = array();
|
||||
|
||||
foreach ((array) $data as $key => $value)
|
||||
{
|
||||
if (is_object($value) or is_array($value))
|
||||
{
|
||||
$array[$key] = $this->to_array($value);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$array[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
// Format XML for output
|
||||
public function to_xml($data = null, $structure = null, $basenode = 'xml')
|
||||
{
|
||||
if ($data === null and ! func_num_args())
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// turn off compatibility mode as simple xml throws a wobbly if you don't.
|
||||
if (ini_get('zend.ze1_compatibility_mode') == 1)
|
||||
{
|
||||
ini_set('zend.ze1_compatibility_mode', 0);
|
||||
}
|
||||
|
||||
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) AND ! is_object($data))
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
foreach ($data as $key => $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 there is another array found recrusively call this function
|
||||
if (is_array($value) || is_object($value))
|
||||
{
|
||||
$node = $structure->addChild($key);
|
||||
|
||||
// recrusive 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 HTML for output
|
||||
public function to_html()
|
||||
{
|
||||
$data = $this->_data;
|
||||
|
||||
// Multi-dimentional array
|
||||
if (isset($data[0]))
|
||||
{
|
||||
$headings = array_keys($data[0]);
|
||||
}
|
||||
|
||||
// Single array
|
||||
else
|
||||
{
|
||||
$headings = array_keys($data);
|
||||
$data = array($data);
|
||||
}
|
||||
|
||||
$ci = get_instance();
|
||||
$ci->load->library('table');
|
||||
|
||||
$ci->table->set_heading($headings);
|
||||
|
||||
foreach ($data as &$row)
|
||||
{
|
||||
$ci->table->add_row($row);
|
||||
}
|
||||
|
||||
return $ci->table->generate();
|
||||
}
|
||||
|
||||
// Format HTML for output
|
||||
public function to_csv()
|
||||
{
|
||||
$data = $this->_data;
|
||||
|
||||
// Multi-dimentional array
|
||||
if (isset($data[0]))
|
||||
{
|
||||
$headings = array_keys($data[0]);
|
||||
}
|
||||
|
||||
// Single array
|
||||
else
|
||||
{
|
||||
$headings = array_keys($data);
|
||||
$data = array($data);
|
||||
}
|
||||
|
||||
$output = implode(',', $headings).PHP_EOL;
|
||||
foreach ($data as &$row)
|
||||
{
|
||||
$output .= '"'.implode('","', $row).'"'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Encode as JSON
|
||||
public function to_json()
|
||||
{
|
||||
return json_encode($this->_data, JSON_NUMERIC_CHECK);
|
||||
}
|
||||
|
||||
// Encode as Serialized array
|
||||
public function to_serialized()
|
||||
{
|
||||
return serialize($this->_data);
|
||||
}
|
||||
|
||||
// Output as a string representing the PHP structure
|
||||
public function to_php()
|
||||
{
|
||||
return var_export($this->_data, TRUE);
|
||||
}
|
||||
|
||||
// Format XML for output
|
||||
protected function _from_xml($string)
|
||||
{
|
||||
return $string ? (array) simplexml_load_string($string, 'SimpleXMLElement', LIBXML_NOCDATA) : array();
|
||||
}
|
||||
|
||||
// Format HTML for output
|
||||
// This function is DODGY! Not perfect CSV support but works with my REST_Controller
|
||||
protected function _from_csv($string)
|
||||
{
|
||||
$data = array();
|
||||
|
||||
// Splits
|
||||
$rows = explode("\n", trim($string));
|
||||
$headings = explode(',', array_shift($rows));
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
// The substr removes " from start and end
|
||||
$data_fields = explode('","', trim(substr($row, 1, -1)));
|
||||
|
||||
if (count($data_fields) == count($headings))
|
||||
{
|
||||
$data[] = array_combine($headings, $data_fields);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// Encode as JSON
|
||||
private function _from_json($string)
|
||||
{
|
||||
return json_decode(trim($string));
|
||||
}
|
||||
|
||||
// Encode as Serialized array
|
||||
private function _from_serialize($string)
|
||||
{
|
||||
return unserialize(trim($string));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file format.php */
|
||||
549
application/libraries/Ion_auth.php
Normal file
549
application/libraries/Ion_auth.php
Normal file
@@ -0,0 +1,549 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Ion Auth
|
||||
* Author: Ben Edmunds
|
||||
* ben.edmunds@gmail.com
|
||||
* @benedmunds
|
||||
*
|
||||
* Added Awesomeness: Phil Sturgeon
|
||||
*
|
||||
* Created: 10.01.2009
|
||||
*
|
||||
* Description: Modified auth system based on redux_auth with extensive customization. This is basically what Redux Auth 2 should be.
|
||||
* Original Author name has been kept but that does not mean that the method has not been modified.
|
||||
*
|
||||
* Requirements: PHP5 or above
|
||||
*
|
||||
* @package CodeIgniter-Ion-Auth
|
||||
* @author Ben Edmunds
|
||||
* @link http://github.com/benedmunds/CodeIgniter-Ion-Auth
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Class Ion_auth
|
||||
*/
|
||||
class Ion_auth
|
||||
{
|
||||
/**
|
||||
* account status ('not_activated', etc ...)
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* extra where
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
public $_extra_where = array();
|
||||
|
||||
/**
|
||||
* extra set
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
public $_extra_set = array();
|
||||
|
||||
/**
|
||||
* caching of users and their groups
|
||||
*
|
||||
* @var array
|
||||
**/
|
||||
public $_cache_user_in_group;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @author Ben
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->config->load('ion_auth', TRUE);
|
||||
$this->load->library(array('email'));
|
||||
$this->lang->load('ion_auth');
|
||||
$this->load->helper(array('cookie', 'language','url'));
|
||||
|
||||
$this->load->library('session');
|
||||
|
||||
$this->load->model('ion_auth_model');
|
||||
|
||||
$this->_cache_user_in_group =& $this->ion_auth_model->_cache_user_in_group;
|
||||
|
||||
$email_config = $this->config->item('email_config', 'ion_auth');
|
||||
|
||||
if ($this->config->item('use_ci_email', 'ion_auth') && isset($email_config) && is_array($email_config))
|
||||
{
|
||||
$this->email->initialize($email_config);
|
||||
}
|
||||
|
||||
$this->ion_auth_model->trigger_events('library_constructor');
|
||||
}
|
||||
|
||||
/**
|
||||
* __call
|
||||
*
|
||||
* Acts as a simple way to call model methods without loads of stupid alias'
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if (!method_exists( $this->ion_auth_model, $method) )
|
||||
{
|
||||
throw new Exception('Undefined method Ion_auth::' . $method . '() called');
|
||||
}
|
||||
if($method == 'create_user')
|
||||
{
|
||||
return call_user_func_array(array($this, 'register'), $arguments);
|
||||
}
|
||||
if($method=='update_user')
|
||||
{
|
||||
return call_user_func_array(array($this, 'update'), $arguments);
|
||||
}
|
||||
return call_user_func_array( array($this->ion_auth_model, $method), $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* __get
|
||||
*
|
||||
* Enables the use of CI super-global without having to define an extra variable.
|
||||
*
|
||||
* I can't remember where I first saw this, so thank you if you are the original author. -Militis
|
||||
*
|
||||
* @param string $var
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($var)
|
||||
{
|
||||
$CI = & get_instance();
|
||||
return isset($CI->$var) ? $CI->$var : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forgotten password feature
|
||||
*
|
||||
* @param string $identity
|
||||
*
|
||||
* @return array|bool
|
||||
* @author Mathew
|
||||
*/
|
||||
public function forgotten_password($identity)
|
||||
{
|
||||
if ($this->ion_auth_model->forgotten_password($identity))
|
||||
{
|
||||
// Get user information
|
||||
$identifier = $this->ion_auth_model->identity_column; // use model identity column, so it can be overridden in a controller
|
||||
$user = $this->where($identifier, $identity)->where('active', 1)->users()->row();
|
||||
|
||||
if ($user)
|
||||
{
|
||||
$data = array(
|
||||
'identity' => $user->{$this->config->item('identity', 'ion_auth')},
|
||||
'forgotten_password_code' => $user->forgotten_password_code
|
||||
);
|
||||
|
||||
if (!$this->config->item('use_ci_email', 'ion_auth'))
|
||||
{
|
||||
$this->set_message('forgot_password_successful');
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $this->load->view($this->config->item('email_templates', 'ion_auth') . $this->config->item('email_forgot_password', 'ion_auth'), $data, TRUE);
|
||||
$this->email->clear();
|
||||
$this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
|
||||
$this->email->to($user->email);
|
||||
$this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject'));
|
||||
$this->email->message($message);
|
||||
|
||||
if ($this->email->send())
|
||||
{
|
||||
$this->set_message('forgot_password_successful');
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set_error('forgot_password_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set_error('forgot_password_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set_error('forgot_password_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* forgotten_password_complete
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return array|bool
|
||||
* @author Mathew
|
||||
*/
|
||||
public function forgotten_password_complete($code)
|
||||
{
|
||||
$this->ion_auth_model->trigger_events('pre_password_change');
|
||||
|
||||
$identity = $this->config->item('identity', 'ion_auth');
|
||||
$profile = $this->where('forgotten_password_code', $code)->users()->row(); // pass the code to profile
|
||||
|
||||
if (!$profile)
|
||||
{
|
||||
$this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_unsuccessful'));
|
||||
$this->set_error('password_change_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$new_password = $this->ion_auth_model->forgotten_password_complete($code, $profile->salt);
|
||||
|
||||
if ($new_password)
|
||||
{
|
||||
$data = array(
|
||||
'identity' => $profile->{$identity},
|
||||
'new_password' => $new_password
|
||||
);
|
||||
if(!$this->config->item('use_ci_email', 'ion_auth'))
|
||||
{
|
||||
$this->set_message('password_change_successful');
|
||||
$this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_successful'));
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $this->load->view($this->config->item('email_templates', 'ion_auth').$this->config->item('email_forgot_password_complete', 'ion_auth'), $data, true);
|
||||
|
||||
$this->email->clear();
|
||||
$this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
|
||||
$this->email->to($profile->email);
|
||||
$this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_new_password_subject'));
|
||||
$this->email->message($message);
|
||||
|
||||
if ($this->email->send())
|
||||
{
|
||||
$this->set_message('password_change_successful');
|
||||
$this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_successful'));
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set_error('password_change_unsuccessful');
|
||||
$this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_unsuccessful'));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$this->ion_auth_model->trigger_events(array('post_password_change', 'password_change_unsuccessful'));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* forgotten_password_check
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return object|bool
|
||||
* @author Michael
|
||||
*/
|
||||
public function forgotten_password_check($code)
|
||||
{
|
||||
$profile = $this->where('forgotten_password_code', $code)->users()->row(); // pass the code to profile
|
||||
|
||||
if (!is_object($profile))
|
||||
{
|
||||
$this->set_error('password_change_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->config->item('forgot_password_expiration', 'ion_auth') > 0)
|
||||
{
|
||||
//Make sure it isn't expired
|
||||
$expiration = $this->config->item('forgot_password_expiration', 'ion_auth');
|
||||
if (time() - $profile->forgotten_password_time > $expiration)
|
||||
{
|
||||
//it has expired
|
||||
$this->ion_auth_model->clear_forgotten_password_code($code);
|
||||
$this->set_error('password_change_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return $profile;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* register
|
||||
*
|
||||
* @param string $identity
|
||||
* @param string $password
|
||||
* @param string $email
|
||||
* @param array $additional_data
|
||||
* @param array $group_ids
|
||||
*
|
||||
* @return int|array|bool The new user's ID if e-mail activation is disabled or Ion-Auth e-mail activation was
|
||||
* completed; or an array of activation details if CI e-mail validation is enabled; or FALSE
|
||||
* if the operation failed.
|
||||
* @author Mathew
|
||||
*/
|
||||
public function register($identity, $password, $email, $additional_data = array(), $group_ids = array())
|
||||
{
|
||||
$this->ion_auth_model->trigger_events('pre_account_creation');
|
||||
|
||||
$email_activation = $this->config->item('email_activation', 'ion_auth');
|
||||
|
||||
$id = $this->ion_auth_model->register($identity, $password, $email, $additional_data, $group_ids);
|
||||
|
||||
if (!$email_activation)
|
||||
{
|
||||
if ($id !== FALSE)
|
||||
{
|
||||
$this->set_message('account_creation_successful');
|
||||
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful'));
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set_error('account_creation_unsuccessful');
|
||||
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful'));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$id)
|
||||
{
|
||||
$this->set_error('account_creation_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// deactivate so the user much follow the activation flow
|
||||
$deactivate = $this->ion_auth_model->deactivate($id);
|
||||
|
||||
// the deactivate method call adds a message, here we need to clear that
|
||||
$this->ion_auth_model->clear_messages();
|
||||
|
||||
|
||||
if (!$deactivate)
|
||||
{
|
||||
$this->set_error('deactivate_unsuccessful');
|
||||
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful'));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$activation_code = $this->ion_auth_model->activation_code;
|
||||
$identity = $this->config->item('identity', 'ion_auth');
|
||||
$user = $this->ion_auth_model->user($id)->row();
|
||||
|
||||
$data = array(
|
||||
'identity' => $user->{$identity},
|
||||
'id' => $user->id,
|
||||
'email' => $email,
|
||||
'activation' => $activation_code,
|
||||
);
|
||||
if(!$this->config->item('use_ci_email', 'ion_auth'))
|
||||
{
|
||||
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful', 'activation_email_successful'));
|
||||
$this->set_message('activation_email_successful');
|
||||
return $data;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = $this->load->view($this->config->item('email_templates', 'ion_auth').$this->config->item('email_activate', 'ion_auth'), $data, true);
|
||||
|
||||
$this->email->clear();
|
||||
$this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
|
||||
$this->email->to($email);
|
||||
$this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_activation_subject'));
|
||||
$this->email->message($message);
|
||||
|
||||
if ($this->email->send() === TRUE)
|
||||
{
|
||||
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_successful', 'activation_email_successful'));
|
||||
$this->set_message('activation_email_successful');
|
||||
return $id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->ion_auth_model->trigger_events(array('post_account_creation', 'post_account_creation_unsuccessful', 'activation_email_unsuccessful'));
|
||||
$this->set_error('activation_email_unsuccessful');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout
|
||||
*
|
||||
* @return true
|
||||
* @author Mathew
|
||||
**/
|
||||
public function logout()
|
||||
{
|
||||
$this->ion_auth_model->trigger_events('logout');
|
||||
|
||||
$identity = $this->config->item('identity', 'ion_auth');
|
||||
|
||||
if (substr(CI_VERSION, 0, 1) == '2')
|
||||
{
|
||||
$this->session->unset_userdata(array($identity => '', 'id' => '', 'user_id' => ''));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->unset_userdata(array($identity, 'id', 'user_id'));
|
||||
}
|
||||
|
||||
// delete the remember me cookies if they exist
|
||||
if (get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))
|
||||
{
|
||||
delete_cookie($this->config->item('identity_cookie_name', 'ion_auth'));
|
||||
}
|
||||
if (get_cookie($this->config->item('remember_cookie_name', 'ion_auth')))
|
||||
{
|
||||
delete_cookie($this->config->item('remember_cookie_name', 'ion_auth'));
|
||||
}
|
||||
|
||||
// Destroy the session
|
||||
$this->session->sess_destroy();
|
||||
|
||||
//Recreate the session
|
||||
if (substr(CI_VERSION, 0, 1) == '2')
|
||||
{
|
||||
$this->session->sess_create();
|
||||
}
|
||||
else
|
||||
{
|
||||
session_start();
|
||||
$this->session->sess_regenerate(TRUE);
|
||||
}
|
||||
|
||||
$this->set_message('logout_successful');
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto logs-in the user if they are remembered
|
||||
* @return bool Whether the user is logged in
|
||||
* @author Mathew
|
||||
**/
|
||||
public function logged_in()
|
||||
{
|
||||
$this->ion_auth_model->trigger_events('logged_in');
|
||||
|
||||
$recheck = $this->ion_auth_model->recheck_session();
|
||||
|
||||
// auto-login the user if they are remembered
|
||||
if (!$recheck && get_cookie($this->config->item('identity_cookie_name', 'ion_auth')) && get_cookie($this->config->item('remember_cookie_name', 'ion_auth')))
|
||||
{
|
||||
$recheck = $this->ion_auth_model->login_remembered_user();
|
||||
}
|
||||
|
||||
return $recheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null The user's ID from the session user data or NULL if not found
|
||||
* @author jrmadsen67
|
||||
**/
|
||||
public function get_user_id()
|
||||
{
|
||||
$user_id = $this->session->userdata('user_id');
|
||||
if (!empty($user_id))
|
||||
{
|
||||
return $user_id;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string|bool $id
|
||||
*
|
||||
* @return bool Whether the user is an administrator
|
||||
* @author Ben Edmunds
|
||||
*/
|
||||
public function is_admin($id = FALSE)
|
||||
{
|
||||
$this->ion_auth_model->trigger_events('is_admin');
|
||||
|
||||
$admin_group = $this->config->item('admin_group', 'ion_auth');
|
||||
|
||||
return $this->in_group($admin_group, $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string|array $check_group group(s) to check
|
||||
* @param int|string|bool $id user id
|
||||
* @param bool $check_all check if all groups is present, or any of the groups
|
||||
*
|
||||
* @return bool Whether the/all user(s) with the given ID(s) is/are in the given group
|
||||
* @author Phil Sturgeon
|
||||
**/
|
||||
public function in_group($check_group, $id = FALSE, $check_all = FALSE)
|
||||
{
|
||||
$this->ion_auth_model->trigger_events('in_group');
|
||||
|
||||
$id || $id = $this->session->userdata('user_id');
|
||||
|
||||
if (!is_array($check_group))
|
||||
{
|
||||
$check_group = array($check_group);
|
||||
}
|
||||
|
||||
if (isset($this->_cache_user_in_group[$id]))
|
||||
{
|
||||
$groups_array = $this->_cache_user_in_group[$id];
|
||||
}
|
||||
else
|
||||
{
|
||||
$users_groups = $this->ion_auth_model->get_users_groups($id)->result();
|
||||
$groups_array = array();
|
||||
foreach ($users_groups as $group)
|
||||
{
|
||||
$groups_array[$group->id] = $group->name;
|
||||
}
|
||||
$this->_cache_user_in_group[$id] = $groups_array;
|
||||
}
|
||||
foreach ($check_group as $key => $value)
|
||||
{
|
||||
$groups = (is_numeric($value)) ? array_keys($groups_array) : $groups_array;
|
||||
|
||||
/**
|
||||
* if !all (default), in_array
|
||||
* if all, !in_array
|
||||
*/
|
||||
if (in_array($value, $groups) xor $check_all)
|
||||
{
|
||||
/**
|
||||
* if !all (default), true
|
||||
* if all, false
|
||||
*/
|
||||
return !$check_all;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if !all (default), false
|
||||
* if all, true
|
||||
*/
|
||||
return $check_all;
|
||||
}
|
||||
|
||||
}
|
||||
733
application/libraries/REST_Controller.php
Normal file
733
application/libraries/REST_Controller.php
Normal file
@@ -0,0 +1,733 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* REST_controller V 2.5.x
|
||||
*
|
||||
* @see https://github.com/philsturgeon/codeigniter-restserver
|
||||
*
|
||||
*/
|
||||
|
||||
class REST_Controller extends CI_Controller
|
||||
{
|
||||
|
||||
protected $rest_format = null; // Set this in a controller to use a default format
|
||||
protected $methods = array(); // contains a list of method properties such as limit, log and level
|
||||
protected $request = null; // Stores accept, language, body, headers, etc
|
||||
protected $response = null; // What is gonna happen in output?
|
||||
public $rest = null; // Stores DB, keys, key level, etc
|
||||
protected $_get_args = array();
|
||||
protected $_post_args = array();
|
||||
protected $_put_args = array();
|
||||
protected $_delete_args = array();
|
||||
protected $_args = array();
|
||||
protected $_allow = true;
|
||||
|
||||
// List all supported methods, the first will be the default format
|
||||
protected $_supported_formats = array(
|
||||
'xml' => 'application/xml',
|
||||
'rawxml' => 'application/xml',
|
||||
'json' => 'application/json',
|
||||
'jsonp' => 'application/javascript',
|
||||
'serialized' => 'application/vnd.php.serialized',
|
||||
'php' => 'text/plain',
|
||||
'html' => 'text/html',
|
||||
'csv' => 'application/csv',
|
||||
);
|
||||
|
||||
// Constructor function
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Lets grab the config and get ready to party
|
||||
$this->load->config('rest');
|
||||
|
||||
if (empty($this->request)) {
|
||||
$this->request = new stdClass;
|
||||
}
|
||||
|
||||
if (empty($this->rest)) {
|
||||
$this->rest = new stdClass;
|
||||
}
|
||||
|
||||
// How is this request being made? POST, DELETE, GET, PUT?
|
||||
$this->request->method = $this->_detect_method();
|
||||
|
||||
// Set up our GET variables
|
||||
$this->_get_args = array_merge($this->_get_args, $this->uri->ruri_to_assoc());
|
||||
|
||||
//$this->load->library('security');
|
||||
|
||||
// This library is bundled with REST_Controller 2.5+, but will eventually be part of CodeIgniter itself
|
||||
$this->load->library('format');
|
||||
|
||||
// Try to find a format for the request (means we have a request body)
|
||||
$this->request->format = $this->_detect_input_format();
|
||||
|
||||
// Some Methods cant have a body
|
||||
$this->request->body = null;
|
||||
|
||||
switch ($this->request->method) {
|
||||
case 'get':
|
||||
// Grab proper GET variables
|
||||
parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $get);
|
||||
|
||||
// If there are any, populate $this->_get_args
|
||||
empty($get) or $this->_get_args = $get;
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$this->_post_args = $_POST;
|
||||
|
||||
$this->request->format and $this->request->body = file_get_contents('php://input');
|
||||
break;
|
||||
|
||||
case 'put':
|
||||
// It might be a HTTP body
|
||||
if ($this->request->format) {
|
||||
$this->request->body = file_get_contents('php://input');
|
||||
}
|
||||
|
||||
// If no file type is provided, this is probably just arguments
|
||||
else {
|
||||
parse_str(file_get_contents('php://input'), $this->_put_args);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
// Set up out DELETE variables (which shouldn't really exist, but sssh!)
|
||||
parse_str(file_get_contents('php://input'), $this->_delete_args);
|
||||
break;
|
||||
}
|
||||
|
||||
// Now we know all about our request, let's try and parse the body if it exists
|
||||
if ($this->request->format and $this->request->body) {
|
||||
$this->request->body = $this->format->factory($this->request->body, $this->request->format)->to_data();
|
||||
}
|
||||
|
||||
// Merge both for one mega-args variable
|
||||
$this->_args = array_merge($this->_get_args, $this->_put_args, $this->_post_args, $this->_delete_args);
|
||||
|
||||
// Which format should the data be returned in?
|
||||
if (empty($this->response)) {
|
||||
$this->response = new stdClass;
|
||||
}
|
||||
|
||||
$this->response->format = $this->_detect_output_format();
|
||||
|
||||
// Which format should the data be returned in?
|
||||
$this->response->lang = $this->_detect_lang();
|
||||
|
||||
// Check if there is a specific auth type for the current class/method
|
||||
$this->auth_override = $this->_auth_override_check();
|
||||
|
||||
// When there is no specific override for the current class/method, use the default auth value set in the config
|
||||
if ($this->auth_override !== true) {
|
||||
if ($this->config->item('rest_auth') == 'basic') {
|
||||
$this->_prepare_basic_auth();
|
||||
} elseif ($this->config->item('rest_auth') == 'digest') {
|
||||
$this->_prepare_digest_auth();
|
||||
}
|
||||
}
|
||||
|
||||
// Load DB if its enabled
|
||||
// if (config_item('rest_database_group') AND (config_item('rest_enable_keys') OR config_item('rest_enable_logging')))
|
||||
// {
|
||||
$this->rest->db = $this->load->database(config_item('rest_database_group'), true);
|
||||
// }
|
||||
|
||||
// Checking for keys? GET TO WORK!
|
||||
if (config_item('rest_enable_keys')) {
|
||||
$this->_allow = $this->_detect_api_key();
|
||||
}
|
||||
|
||||
// only allow ajax requests
|
||||
if (!$this->input->is_ajax_request() and config_item('rest_ajax_only')) {
|
||||
$this->response(array('status' => false, 'error' => 'Only AJAX requests are accepted.'), 505);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remap
|
||||
*
|
||||
* Requests are not made to methods directly The request will be for an "object".
|
||||
* this simply maps the object and method to the correct Controller method.
|
||||
*/
|
||||
public function _remap($object_called, $arguments)
|
||||
{
|
||||
$pattern = '/^(.*)\.(' . implode('|', array_keys($this->_supported_formats)) . ')$/';
|
||||
if (preg_match($pattern, $object_called, $matches)) {
|
||||
$object_called = $matches[1];
|
||||
}
|
||||
|
||||
$controller_method = $object_called . '_' . $this->request->method;
|
||||
|
||||
// Do we want to log this method (if allowed by config)?
|
||||
$log_method = !(isset($this->methods[$controller_method]['log']) and $this->methods[$controller_method]['log'] == false);
|
||||
|
||||
// Use keys for this method?
|
||||
$use_key = !(isset($this->methods[$controller_method]['key']) and $this->methods[$controller_method]['key'] == false);
|
||||
|
||||
// Get that useless shitty key out of here
|
||||
if (config_item('rest_enable_keys') and $use_key and $this->_allow === false) {
|
||||
if (config_item('rest_enable_logging') and $log_method) {
|
||||
$this->_log_request();
|
||||
}
|
||||
|
||||
$this->response(array('status' => false, 'error' => 'Invalid API Key.'), 403);
|
||||
}
|
||||
|
||||
// Sure it exists, but can they do anything with it?
|
||||
if (!method_exists($this, $controller_method)) {
|
||||
$this->response(array('status' => false, 'error' => 'Unknown method.'), 404);
|
||||
}
|
||||
|
||||
// Doing key related stuff? Can only do it if they have a key right?
|
||||
if (config_item('rest_enable_keys') and !empty($this->rest->key)) {
|
||||
// Check the limit
|
||||
if (config_item('rest_enable_limits') and !$this->_check_limit($controller_method)) {
|
||||
$this->response(array('status' => false, 'error' => 'This API key has reached the hourly limit for this method.'), 401);
|
||||
}
|
||||
|
||||
// If no level is set use 0, they probably aren't using permissions
|
||||
$level = isset($this->methods[$controller_method]['level']) ? $this->methods[$controller_method]['level'] : 0;
|
||||
|
||||
// If no level is set, or it is lower than/equal to the key's level
|
||||
$authorized = $level <= $this->rest->level;
|
||||
|
||||
// IM TELLIN!
|
||||
if (config_item('rest_enable_logging') and $log_method) {
|
||||
$this->_log_request($authorized);
|
||||
}
|
||||
|
||||
// They don't have good enough perms
|
||||
$authorized or $this->response(array('status' => false, 'error' => 'This API key does not have enough permissions.'), 401);
|
||||
}
|
||||
|
||||
// No key stuff, but record that stuff is happening
|
||||
else if (config_item('rest_enable_logging') and $log_method) {
|
||||
$this->_log_request($authorized = true);
|
||||
}
|
||||
|
||||
// And...... GO!
|
||||
call_user_func_array(array($this, $controller_method), $arguments);
|
||||
}
|
||||
|
||||
/*
|
||||
* response
|
||||
*
|
||||
* Takes pure data and optionally a status code, then creates the response
|
||||
*/
|
||||
public function response($data = array(), $http_code = null)
|
||||
{
|
||||
// If data is empty and not code provide, error and bail
|
||||
if (empty($data) && $http_code === null) {
|
||||
$http_code = 404;
|
||||
}
|
||||
|
||||
// Otherwise (if no data but 200 provided) or some data, carry on camping!
|
||||
else {
|
||||
is_numeric($http_code) or $http_code = 200;
|
||||
|
||||
// If the format method exists, call and return the output in that format
|
||||
if (method_exists($this, '_format_' . $this->response->format)) {
|
||||
// Set the correct format header
|
||||
header('Content-Type: ' . $this->_supported_formats[$this->response->format]);
|
||||
|
||||
$output = $this->{'_format_' . $this->response->format}($data);
|
||||
}
|
||||
|
||||
// If the format method exists, call and return the output in that format
|
||||
elseif (method_exists($this->format, 'to_' . $this->response->format)) {
|
||||
// Set the correct format header
|
||||
header('Content-Type: ' . $this->_supported_formats[$this->response->format]);
|
||||
|
||||
$output = $this->format->factory($data)->{'to_' . $this->response->format}();
|
||||
}
|
||||
|
||||
// Format not supported, output directly
|
||||
else {
|
||||
$output = $data;
|
||||
}
|
||||
}
|
||||
|
||||
header('HTTP/1.1: ' . $http_code);
|
||||
header('Status: ' . $http_code);
|
||||
header('Content-Length: ' . strlen($output));
|
||||
|
||||
exit($output);
|
||||
}
|
||||
|
||||
protected function res($code = 200, $message = 'Success', $data = null)
|
||||
{
|
||||
$this->response(array('code' => $code, 'message' => $message, 'data' => $data), 200);
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect input format
|
||||
*
|
||||
* Detect which format the HTTP Body is provided in
|
||||
*/
|
||||
protected function _detect_input_format()
|
||||
{
|
||||
if ($this->input->server('CONTENT_TYPE')) {
|
||||
// Check all formats against the HTTP_ACCEPT header
|
||||
foreach ($this->_supported_formats as $format => $mime) {
|
||||
if (strpos($match = $this->input->server('CONTENT_TYPE'), ';')) {
|
||||
$match = current(explode(';', $match));
|
||||
}
|
||||
|
||||
if ($match == $mime) {
|
||||
return $format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect format
|
||||
*
|
||||
* Detect which format should be used to output the data
|
||||
*/
|
||||
protected function _detect_output_format()
|
||||
{
|
||||
$pattern = '/\.(' . implode('|', array_keys($this->_supported_formats)) . ')$/';
|
||||
|
||||
// Check if a file extension is used
|
||||
if (preg_match($pattern, $this->uri->uri_string(), $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
// Check if a file extension is used
|
||||
elseif ($this->_get_args and !is_array(end($this->_get_args)) and preg_match($pattern, end($this->_get_args), $matches)) {
|
||||
// The key of the last argument
|
||||
$last_key = end(array_keys($this->_get_args));
|
||||
|
||||
// Remove the extension from arguments too
|
||||
$this->_get_args[$last_key] = preg_replace($pattern, '', $this->_get_args[$last_key]);
|
||||
$this->_args[$last_key] = preg_replace($pattern, '', $this->_args[$last_key]);
|
||||
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
// A format has been passed as an argument in the URL and it is supported
|
||||
if (isset($this->_get_args['format']) and array_key_exists($this->_get_args['format'], $this->_supported_formats)) {
|
||||
return $this->_get_args['format'];
|
||||
}
|
||||
|
||||
// Otherwise, check the HTTP_ACCEPT (if it exists and we are allowed)
|
||||
if ($this->config->item('rest_ignore_http_accept') === false and $this->input->server('HTTP_ACCEPT')) {
|
||||
// Check all formats against the HTTP_ACCEPT header
|
||||
foreach (array_keys($this->_supported_formats) as $format) {
|
||||
// Has this format been requested?
|
||||
if (strpos($this->input->server('HTTP_ACCEPT'), $format) !== false) {
|
||||
// If not HTML or XML assume its right and send it on its way
|
||||
if ($format != 'html' and $format != 'xml') {
|
||||
|
||||
return $format;
|
||||
}
|
||||
|
||||
// HTML or XML have shown up as a match
|
||||
else {
|
||||
// If it is truely HTML, it wont want any XML
|
||||
if ($format == 'html' and strpos($this->input->server('HTTP_ACCEPT'), 'xml') === false) {
|
||||
return $format;
|
||||
}
|
||||
|
||||
// If it is truely XML, it wont want any HTML
|
||||
elseif ($format == 'xml' and strpos($this->input->server('HTTP_ACCEPT'), 'html') === false) {
|
||||
return $format;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // End HTTP_ACCEPT checking
|
||||
|
||||
// Well, none of that has worked! Let's see if the controller has a default
|
||||
if (!empty($this->rest_format)) {
|
||||
return $this->rest_format;
|
||||
}
|
||||
|
||||
// Just use the default format
|
||||
return config_item('rest_default_format');
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect method
|
||||
*
|
||||
* Detect which method (POST, PUT, GET, DELETE) is being used
|
||||
*/
|
||||
|
||||
protected function _detect_method()
|
||||
{
|
||||
$method = strtolower($this->input->server('REQUEST_METHOD'));
|
||||
|
||||
if ($this->config->item('enable_emulate_request') && $this->input->post('_method')) {
|
||||
$method = $this->input->post('_method');
|
||||
}
|
||||
|
||||
if (in_array($method, array('get', 'delete', 'post', 'put'))) {
|
||||
return $method;
|
||||
}
|
||||
|
||||
return 'get';
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect API Key
|
||||
*
|
||||
* See if the user has provided an API key
|
||||
*/
|
||||
|
||||
protected function _detect_api_key()
|
||||
{
|
||||
|
||||
// Get the api key name variable set in the rest config file
|
||||
$api_key_variable = config_item('rest_key_name');
|
||||
|
||||
// Work out the name of the SERVER entry based on config
|
||||
$key_name = 'HTTP_' . strtoupper(str_replace('-', '_', $api_key_variable));
|
||||
|
||||
$this->rest->key = null;
|
||||
$this->rest->level = null;
|
||||
$this->rest->ignore_limits = false;
|
||||
|
||||
// Find the key from server or arguments
|
||||
if ($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name)) {
|
||||
if (!$row = $this->rest->db->where('key', $key)->get(config_item('rest_keys_table'))->row()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->rest->key = $row->key;
|
||||
|
||||
isset($row->level) and $this->rest->level = $row->level;
|
||||
isset($row->ignore_limits) and $this->rest->ignore_limits = $row->ignore_limits;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// No key has been sent
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect language(s)
|
||||
*
|
||||
* What language do they want it in?
|
||||
*/
|
||||
|
||||
protected function _detect_lang()
|
||||
{
|
||||
if (!$lang = $this->input->server('HTTP_ACCEPT_LANGUAGE')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// They might have sent a few, make it an array
|
||||
if (strpos($lang, ',') !== false) {
|
||||
$langs = explode(',', $lang);
|
||||
|
||||
$return_langs = array();
|
||||
$i = 1;
|
||||
foreach ($langs as $lang) {
|
||||
// Remove weight and strip space
|
||||
list($lang) = explode(';', $lang);
|
||||
$return_langs[] = trim($lang);
|
||||
}
|
||||
|
||||
return $return_langs;
|
||||
}
|
||||
|
||||
// Nope, just return the string
|
||||
return $lang;
|
||||
}
|
||||
|
||||
/*
|
||||
* Log request
|
||||
*
|
||||
* Record the entry for awesomeness purposes
|
||||
*/
|
||||
|
||||
protected function _log_request($authorized = false)
|
||||
{
|
||||
return $this->rest->db->insert(config_item('rest_logs_table'), array(
|
||||
'uri' => $this->uri->uri_string(),
|
||||
'method' => $this->request->method,
|
||||
'params' => serialize($this->_args),
|
||||
'api_key' => isset($this->rest->key) ? $this->rest->key : '',
|
||||
'ip_address' => $this->input->ip_address(),
|
||||
'time' => function_exists('now') ? now() : time(),
|
||||
'authorized' => $authorized,
|
||||
));
|
||||
}
|
||||
|
||||
/*
|
||||
* Log request
|
||||
*
|
||||
* Record the entry for awesomeness purposes
|
||||
*/
|
||||
|
||||
protected function _check_limit($controller_method)
|
||||
{
|
||||
// They are special, or it might not even have a limit
|
||||
if (!empty($this->rest->ignore_limits) or !isset($this->methods[$controller_method]['limit'])) {
|
||||
// On your way sonny-jim.
|
||||
return true;
|
||||
}
|
||||
|
||||
// How many times can you get to this method an hour?
|
||||
$limit = $this->methods[$controller_method]['limit'];
|
||||
|
||||
// Get data on a keys usage
|
||||
$result = $this->rest->db
|
||||
->where('uri', $this->uri->uri_string())
|
||||
->where('api_key', $this->rest->key)
|
||||
->get(config_item('rest_limits_table'))
|
||||
->row();
|
||||
|
||||
// No calls yet, or been an hour since they called
|
||||
if (!$result or $result->hour_started < time() - (60 * 60)) {
|
||||
// Right, set one up from scratch
|
||||
$this->rest->db->insert(config_item('rest_limits_table'), array(
|
||||
'uri' => $this->uri->uri_string(),
|
||||
'api_key' => isset($this->rest->key) ? $this->rest->key : '',
|
||||
'count' => 1,
|
||||
'hour_started' => time(),
|
||||
));
|
||||
}
|
||||
|
||||
// They have called within the hour, so lets update
|
||||
else {
|
||||
// Your luck is out, you've called too many times!
|
||||
if ($result->count >= $limit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->rest->db
|
||||
->where('uri', $this->uri->uri_string())
|
||||
->where('api_key', $this->rest->key)
|
||||
->set('count', 'count + 1', false)
|
||||
->update(config_item('rest_limits_table'));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* Auth override check
|
||||
*
|
||||
* Check if there is a specific auth type set for the current class/method being called
|
||||
*/
|
||||
|
||||
protected function _auth_override_check()
|
||||
{
|
||||
|
||||
// Assign the class/method auth type override array from the config
|
||||
$this->overrides_array = $this->config->item('auth_override_class_method');
|
||||
|
||||
// Check to see if the override array is even populated, otherwise return false
|
||||
if (empty($this->overrides_array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to see if there's an override value set for the current class/method being called
|
||||
if (empty($this->overrides_array[$this->router->class][$this->router->method])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// None auth override found, prepare nothing but send back a true override flag
|
||||
if ($this->overrides_array[$this->router->class][$this->router->method] == 'none') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Basic auth override found, prepare basic
|
||||
if ($this->overrides_array[$this->router->class][$this->router->method] == 'basic') {
|
||||
$this->_prepare_basic_auth();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Digest auth override found, prepare digest
|
||||
if ($this->overrides_array[$this->router->class][$this->router->method] == 'digest') {
|
||||
$this->_prepare_digest_auth();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return false when there is an override value set but it doesn't match 'basic', 'digest', or 'none'. (the value was misspelled)
|
||||
return false;
|
||||
}
|
||||
|
||||
// INPUT FUNCTION --------------------------------------------------------------
|
||||
|
||||
public function get($key = null, $xss_clean = true)
|
||||
{
|
||||
if ($key === null) {
|
||||
return $this->_get_args;
|
||||
}
|
||||
|
||||
return array_key_exists($key, $this->_get_args) ? $this->_xss_clean($this->_get_args[$key], $xss_clean) : false;
|
||||
}
|
||||
|
||||
public function post($key = null, $xss_clean = true)
|
||||
{
|
||||
if ($key === null) {
|
||||
return $this->_post_args;
|
||||
}
|
||||
|
||||
return $this->input->post($key, $xss_clean);
|
||||
}
|
||||
|
||||
public function put($key = null, $xss_clean = true)
|
||||
{
|
||||
if ($key === null) {
|
||||
return $this->_put_args;
|
||||
}
|
||||
|
||||
return array_key_exists($key, $this->_put_args) ? $this->_xss_clean($this->_put_args[$key], $xss_clean) : false;
|
||||
}
|
||||
|
||||
public function delete($key = null, $xss_clean = true)
|
||||
{
|
||||
if ($key === null) {
|
||||
return $this->_delete_args;
|
||||
}
|
||||
|
||||
return array_key_exists($key, $this->_delete_args) ? $this->_xss_clean($this->_delete_args[$key], $xss_clean) : false;
|
||||
}
|
||||
|
||||
protected function _xss_clean($val, $bool)
|
||||
{
|
||||
if (CI_VERSION < 2) {
|
||||
return $bool ? $this->input->xss_clean($val) : $val;
|
||||
} else {
|
||||
return $bool ? $this->security->xss_clean($val) : $val;
|
||||
}
|
||||
}
|
||||
|
||||
public function validation_errors()
|
||||
{
|
||||
$string = strip_tags($this->form_validation->error_string());
|
||||
|
||||
return explode("\n", trim($string, "\n"));
|
||||
}
|
||||
|
||||
// SECURITY FUNCTIONS ---------------------------------------------------------
|
||||
|
||||
protected function _check_login($username = '', $password = null)
|
||||
{
|
||||
if (empty($username)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$valid_logins = &$this->config->item('rest_valid_logins');
|
||||
|
||||
if (!array_key_exists($username, $valid_logins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If actually NULL (not empty string) then do not check it
|
||||
if ($password !== null and $valid_logins[$username] != $password) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function _prepare_basic_auth()
|
||||
{
|
||||
$username = null;
|
||||
$password = null;
|
||||
|
||||
// mod_php
|
||||
if ($this->input->server('PHP_AUTH_USER')) {
|
||||
$username = $this->input->server('PHP_AUTH_USER');
|
||||
$password = $this->input->server('PHP_AUTH_PW');
|
||||
}
|
||||
|
||||
// most other servers
|
||||
elseif ($this->input->server('HTTP_AUTHENTICATION')) {
|
||||
if (strpos(strtolower($this->input->server('HTTP_AUTHENTICATION')), 'basic') === 0) {
|
||||
list($username, $password) = explode(':', base64_decode(substr($this->input->server('HTTP_AUTHORIZATION'), 6)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->_check_login($username, $password)) {
|
||||
$this->_force_login();
|
||||
}
|
||||
}
|
||||
|
||||
protected function _prepare_digest_auth()
|
||||
{
|
||||
$uniqid = uniqid(""); // Empty argument for backward compatibility
|
||||
// We need to test which server authentication variable to use
|
||||
// because the PHP ISAPI module in IIS acts different from CGI
|
||||
if ($this->input->server('PHP_AUTH_DIGEST')) {
|
||||
$digest_string = $this->input->server('PHP_AUTH_DIGEST');
|
||||
} elseif ($this->input->server('HTTP_AUTHORIZATION')) {
|
||||
$digest_string = $this->input->server('HTTP_AUTHORIZATION');
|
||||
} else {
|
||||
$digest_string = "";
|
||||
}
|
||||
|
||||
/* The $_SESSION['error_prompted'] variabile is used to ask
|
||||
the password again if none given or if the user enters
|
||||
a wrong auth. informations. */
|
||||
if (empty($digest_string)) {
|
||||
$this->_force_login($uniqid);
|
||||
}
|
||||
|
||||
// We need to retrieve authentication informations from the $auth_data variable
|
||||
preg_match_all('@(username|nonce|uri|nc|cnonce|qop|response)=[\'"]?([^\'",]+)@', $digest_string, $matches);
|
||||
$digest = array_combine($matches[1], $matches[2]);
|
||||
|
||||
if (!array_key_exists('username', $digest) or !$this->_check_login($digest['username'])) {
|
||||
$this->_force_login($uniqid);
|
||||
}
|
||||
|
||||
$valid_logins = &$this->config->item('rest_valid_logins');
|
||||
$valid_pass = $valid_logins[$digest['username']];
|
||||
|
||||
// This is the valid response expected
|
||||
$A1 = md5($digest['username'] . ':' . $this->config->item('rest_realm') . ':' . $valid_pass);
|
||||
$A2 = md5(strtoupper($this->request->method) . ':' . $digest['uri']);
|
||||
$valid_response = md5($A1 . ':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' . $A2);
|
||||
|
||||
if ($digest['response'] != $valid_response) {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _force_login($nonce = '')
|
||||
{
|
||||
if ($this->config->item('rest_auth') == 'basic') {
|
||||
header('WWW-Authenticate: Basic realm="' . $this->config->item('rest_realm') . '"');
|
||||
} elseif ($this->config->item('rest_auth') == 'digest') {
|
||||
header('WWW-Authenticate: Digest realm="' . $this->config->item('rest_realm') . '" qop="auth" nonce="' . $nonce . '" opaque="' . md5($this->config->item('rest_realm')) . '"');
|
||||
}
|
||||
|
||||
$this->response(array('status' => false, 'error' => 'Not authorized'), 401);
|
||||
}
|
||||
|
||||
// Force it into an array
|
||||
protected function _force_loopable($data)
|
||||
{
|
||||
// Force it to be something useful
|
||||
if (!is_array($data) and !is_object($data)) {
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// FORMATING FUNCTIONS ---------------------------------------------------------
|
||||
|
||||
// Many of these have been moved to the Format class for better separation, but these methods will be checked too
|
||||
|
||||
// Encode as JSONP
|
||||
protected function _format_jsonp($data = array())
|
||||
{
|
||||
return $this->get('callback') . '(' . json_encode($data) . ')';
|
||||
}
|
||||
}
|
||||
62
application/libraries/RadioService.php
Normal file
62
application/libraries/RadioService.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
class RadioService
|
||||
{
|
||||
|
||||
private $CI;
|
||||
|
||||
const TOKEN_MAXAGE = 3600;
|
||||
|
||||
const APP_ID = 75;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->CI = &get_instance();
|
||||
}
|
||||
|
||||
public function getAppId($appId = null) {
|
||||
return $appId ? $appId : self::APP_ID;
|
||||
}
|
||||
|
||||
public function checkToken()
|
||||
{
|
||||
$key = $this->CI->input->server('HTTP_ACCESS_TOKEN');
|
||||
$key = $this->CI->rest->db->where('key', $key)->get(config_item('rest_keys_table'));
|
||||
if ($key->num_rows() == 0) {
|
||||
return 401;
|
||||
} else if ($key->row()->date_created < time() - self::TOKEN_MAXAGE) {
|
||||
return 402;
|
||||
}
|
||||
}
|
||||
|
||||
public function getSchedule($categoryId, $day)
|
||||
{
|
||||
$this->CI->load->model('station_schedule_model');
|
||||
return $this->CI->station_schedule_model->findSchedulesByCategoryIdAndDayName($categoryId, $day)->result();
|
||||
}
|
||||
|
||||
public function getApp($appId)
|
||||
{
|
||||
$this->CI->load->model('app_model');
|
||||
$app = $this->CI->app_model->findByAppId($appId)->row();
|
||||
$customInfos = unserialize($app->customInfo);
|
||||
$app->customInfo = array();
|
||||
for ($i = 0; $i < count($customInfos['link']); $i++) {
|
||||
foreach ($customInfos as $field => $values) {
|
||||
$app->customInfo[$i][$field] = $values[$i];
|
||||
}
|
||||
}
|
||||
$app->customInfo = array_filter($app->customInfo, function ($info) {
|
||||
return count(array_filter(array_values($info)));
|
||||
});
|
||||
return $app;
|
||||
}
|
||||
|
||||
public function getCategory($appId)
|
||||
{
|
||||
$this->CI->load->model('category_model');
|
||||
$categories = $this->CI->category_model->findCategoriesByAppId($appId)->result();
|
||||
return $categories;
|
||||
}
|
||||
}
|
||||
10
application/libraries/index.html
Normal file
10
application/libraries/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
10
application/logs/index.html
Normal file
10
application/logs/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
17
application/models/app_model.php
Normal file
17
application/models/app_model.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class app_model extends MY_Model
|
||||
{
|
||||
private $table = 've_app_config';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function findByAppId($appId)
|
||||
{
|
||||
return $this->rest->db->where('ap_id', $appId)->select('ap_id appId, ap_name name, ap_recommend customInfo')->get($this->table);
|
||||
}
|
||||
}
|
||||
27
application/models/category_model.php
Normal file
27
application/models/category_model.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class category_model extends MY_Model
|
||||
{
|
||||
private $table = 've_category';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function findCategoriesByAppId($appId)
|
||||
{
|
||||
return $this->rest->db->where('ap_id', $appId)->
|
||||
select('cg_id id,
|
||||
ap_id appId,
|
||||
cg_parent parentId,
|
||||
cg_depth depth,
|
||||
cg_name name,
|
||||
cg_subname subname,
|
||||
cg_order sort,
|
||||
cg_image_url imgUrl,
|
||||
cg_station_url stationUrl,
|
||||
cg_station_dptitle dpTitle')->get($this->table);
|
||||
}
|
||||
}
|
||||
10
application/models/index.html
Normal file
10
application/models/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
2643
application/models/ion_auth_model.php
Normal file
2643
application/models/ion_auth_model.php
Normal file
File diff suppressed because it is too large
Load Diff
23
application/models/station_schedule_model.php
Normal file
23
application/models/station_schedule_model.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class station_schedule_model extends MY_Model
|
||||
{
|
||||
private $table = 'app_station_schedule';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function findSchedulesByCategoryIdAndDayName($categoryId, $dayName)
|
||||
{
|
||||
return $this->rest->db->where('categoryId', $categoryId)->where('dayName', $dayName)->get($this->table);
|
||||
}
|
||||
|
||||
public function insertSchedules($categoryId, $dayName, $data) {
|
||||
$this->rest->db->where('categoryId', $categoryId)->where('dayName', $dayName)->delete($this->table);
|
||||
$this->rest->db->insert_batch($this->table, $data);
|
||||
return $this->rest->db->affected_rows();
|
||||
}
|
||||
}
|
||||
10
application/third_party/index.html
vendored
Normal file
10
application/third_party/index.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
application/views/auth/change_password.php
Normal file
25
application/views/auth/change_password.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<h1><?php echo lang('change_password_heading');?></h1>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open("auth/change_password");?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('change_password_old_password_label', 'old_password');?> <br />
|
||||
<?php echo form_input($old_password);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="new_password"><?php echo sprintf(lang('change_password_new_password_label'), $min_password_length);?></label> <br />
|
||||
<?php echo form_input($new_password);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('change_password_new_password_confirm_label', 'new_password_confirm');?> <br />
|
||||
<?php echo form_input($new_password_confirm);?>
|
||||
</p>
|
||||
|
||||
<?php echo form_input($user_id);?>
|
||||
<p><?php echo form_submit('submit', lang('change_password_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
20
application/views/auth/create_group.php
Normal file
20
application/views/auth/create_group.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<h1><?php echo lang('create_group_heading');?></h1>
|
||||
<p><?php echo lang('create_group_subheading');?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open("auth/create_group");?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_group_name_label', 'group_name');?> <br />
|
||||
<?php echo form_input($group_name);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_group_desc_label', 'description');?> <br />
|
||||
<?php echo form_input($description);?>
|
||||
</p>
|
||||
|
||||
<p><?php echo form_submit('submit', lang('create_group_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
57
application/views/auth/create_user.php
Normal file
57
application/views/auth/create_user.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<h1><?php echo lang('create_user_heading');?></h1>
|
||||
<p><?php echo lang('create_user_subheading');?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open("auth/create_user");?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_fname_label', 'first_name');?> <br />
|
||||
<?php echo form_input($first_name);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_lname_label', 'last_name');?> <br />
|
||||
<?php echo form_input($last_name);?>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
if($identity_column!=='email') {
|
||||
echo '<p>';
|
||||
echo lang('create_user_identity_label', 'identity');
|
||||
echo '<br />';
|
||||
echo form_error('identity');
|
||||
echo form_input($identity);
|
||||
echo '</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_company_label', 'company');?> <br />
|
||||
<?php echo form_input($company);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_email_label', 'email');?> <br />
|
||||
<?php echo form_input($email);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_phone_label', 'phone');?> <br />
|
||||
<?php echo form_input($phone);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_password_label', 'password');?> <br />
|
||||
<?php echo form_input($password);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('create_user_password_confirm_label', 'password_confirm');?> <br />
|
||||
<?php echo form_input($password_confirm);?>
|
||||
</p>
|
||||
|
||||
|
||||
<p><?php echo form_submit('submit', lang('create_user_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
18
application/views/auth/deactivate_user.php
Normal file
18
application/views/auth/deactivate_user.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<h1><?php echo lang('deactivate_heading');?></h1>
|
||||
<p><?php echo sprintf(lang('deactivate_subheading'), $user->username);?></p>
|
||||
|
||||
<?php echo form_open("auth/deactivate/".$user->id);?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('deactivate_confirm_y_label', 'confirm');?>
|
||||
<input type="radio" name="confirm" value="yes" checked="checked" />
|
||||
<?php echo lang('deactivate_confirm_n_label', 'confirm');?>
|
||||
<input type="radio" name="confirm" value="no" />
|
||||
</p>
|
||||
|
||||
<?php echo form_hidden($csrf); ?>
|
||||
<?php echo form_hidden(array('id'=>$user->id)); ?>
|
||||
|
||||
<p><?php echo form_submit('submit', lang('deactivate_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
20
application/views/auth/edit_group.php
Normal file
20
application/views/auth/edit_group.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<h1><?php echo lang('edit_group_heading');?></h1>
|
||||
<p><?php echo lang('edit_group_subheading');?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open(current_url());?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_group_name_label', 'group_name');?> <br />
|
||||
<?php echo form_input($group_name);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_group_desc_label', 'description');?> <br />
|
||||
<?php echo form_input($group_description);?>
|
||||
</p>
|
||||
|
||||
<p><?php echo form_submit('submit', lang('edit_group_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
66
application/views/auth/edit_user.php
Normal file
66
application/views/auth/edit_user.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<h1><?php echo lang('edit_user_heading');?></h1>
|
||||
<p><?php echo lang('edit_user_subheading');?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open(uri_string());?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_user_fname_label', 'first_name');?> <br />
|
||||
<?php echo form_input($first_name);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_user_lname_label', 'last_name');?> <br />
|
||||
<?php echo form_input($last_name);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_user_company_label', 'company');?> <br />
|
||||
<?php echo form_input($company);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_user_phone_label', 'phone');?> <br />
|
||||
<?php echo form_input($phone);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_user_password_label', 'password');?> <br />
|
||||
<?php echo form_input($password);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('edit_user_password_confirm_label', 'password_confirm');?><br />
|
||||
<?php echo form_input($password_confirm);?>
|
||||
</p>
|
||||
|
||||
<?php if ($this->ion_auth->is_admin()): ?>
|
||||
|
||||
<h3><?php echo lang('edit_user_groups_heading');?></h3>
|
||||
<?php foreach ($groups as $group):?>
|
||||
<label class="checkbox">
|
||||
<?php
|
||||
$gID=$group['id'];
|
||||
$checked = null;
|
||||
$item = null;
|
||||
foreach($currentGroups as $grp) {
|
||||
if ($gID == $grp->id) {
|
||||
$checked= ' checked="checked"';
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="groups[]" value="<?php echo $group['id'];?>"<?php echo $checked;?>>
|
||||
<?php echo htmlspecialchars($group['name'],ENT_QUOTES,'UTF-8');?>
|
||||
</label>
|
||||
<?php endforeach?>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php echo form_hidden('id', $user->id);?>
|
||||
<?php echo form_hidden($csrf); ?>
|
||||
|
||||
<p><?php echo form_submit('submit', lang('edit_user_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
6
application/views/auth/email/activate.tpl.php
Normal file
6
application/views/auth/email/activate.tpl.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1><?php echo sprintf(lang('email_activate_heading'), $identity);?></h1>
|
||||
<p><?php echo sprintf(lang('email_activate_subheading'), anchor('auth/activate/'. $id .'/'. $activation, lang('email_activate_link')));?></p>
|
||||
</body>
|
||||
</html>
|
||||
6
application/views/auth/email/forgot_password.tpl.php
Normal file
6
application/views/auth/email/forgot_password.tpl.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1><?php echo sprintf(lang('email_forgot_password_heading'), $identity);?></h1>
|
||||
<p><?php echo sprintf(lang('email_forgot_password_subheading'), anchor('auth/reset_password/'. $forgotten_password_code, lang('email_forgot_password_link')));?></p>
|
||||
</body>
|
||||
</html>
|
||||
7
application/views/auth/email/new_password.tpl.php
Normal file
7
application/views/auth/email/new_password.tpl.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1><?php echo sprintf(lang('email_new_password_heading'), $identity);?></h1>
|
||||
|
||||
<p><?php echo sprintf(lang('email_new_password_subheading'), $new_password);?></p>
|
||||
</body>
|
||||
</html>
|
||||
15
application/views/auth/forgot_password.php
Normal file
15
application/views/auth/forgot_password.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<h1><?php echo lang('forgot_password_heading');?></h1>
|
||||
<p><?php echo sprintf(lang('forgot_password_subheading'), $identity_label);?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open("auth/forgot_password");?>
|
||||
|
||||
<p>
|
||||
<label for="identity"><?php echo (($type=='email') ? sprintf(lang('forgot_password_email_label'), $identity_label) : sprintf(lang('forgot_password_identity_label'), $identity_label));?></label> <br />
|
||||
<?php echo form_input($identity);?>
|
||||
</p>
|
||||
|
||||
<p><?php echo form_submit('submit', lang('forgot_password_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
31
application/views/auth/index.php
Normal file
31
application/views/auth/index.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<h1><?php echo lang('index_heading');?></h1>
|
||||
<p><?php echo lang('index_subheading');?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<table cellpadding=0 cellspacing=10>
|
||||
<tr>
|
||||
<th><?php echo lang('index_fname_th');?></th>
|
||||
<th><?php echo lang('index_lname_th');?></th>
|
||||
<th><?php echo lang('index_email_th');?></th>
|
||||
<th><?php echo lang('index_groups_th');?></th>
|
||||
<th><?php echo lang('index_status_th');?></th>
|
||||
<th><?php echo lang('index_action_th');?></th>
|
||||
</tr>
|
||||
<?php foreach ($users as $user):?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($user->first_name,ENT_QUOTES,'UTF-8');?></td>
|
||||
<td><?php echo htmlspecialchars($user->last_name,ENT_QUOTES,'UTF-8');?></td>
|
||||
<td><?php echo htmlspecialchars($user->email,ENT_QUOTES,'UTF-8');?></td>
|
||||
<td>
|
||||
<?php foreach ($user->groups as $group):?>
|
||||
<?php echo anchor("auth/edit_group/".$group->id, htmlspecialchars($group->name,ENT_QUOTES,'UTF-8')) ;?><br />
|
||||
<?php endforeach?>
|
||||
</td>
|
||||
<td><?php echo ($user->active) ? anchor("auth/deactivate/".$user->id, lang('index_active_link')) : anchor("auth/activate/". $user->id, lang('index_inactive_link'));?></td>
|
||||
<td><?php echo anchor("auth/edit_user/".$user->id, 'Edit') ;?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
|
||||
<p><?php echo anchor('auth/create_user', lang('index_create_user_link'))?> | <?php echo anchor('auth/create_group', lang('index_create_group_link'))?></p>
|
||||
28
application/views/auth/login.php
Normal file
28
application/views/auth/login.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<h1><?php echo lang('login_heading');?></h1>
|
||||
<p><?php echo lang('login_subheading');?></p>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open("auth/login");?>
|
||||
|
||||
<p>
|
||||
<?php echo lang('login_identity_label', 'identity');?>
|
||||
<?php echo form_input($identity);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('login_password_label', 'password');?>
|
||||
<?php echo form_input($password);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('login_remember_label', 'remember');?>
|
||||
<?php echo form_checkbox('remember', '1', FALSE, 'id="remember"');?>
|
||||
</p>
|
||||
|
||||
|
||||
<p><?php echo form_submit('submit', lang('login_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
|
||||
<p><a href="forgot_password"><?php echo lang('login_forgot_password');?></a></p>
|
||||
22
application/views/auth/reset_password.php
Normal file
22
application/views/auth/reset_password.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<h1><?php echo lang('reset_password_heading');?></h1>
|
||||
|
||||
<div id="infoMessage"><?php echo $message;?></div>
|
||||
|
||||
<?php echo form_open('auth/reset_password/' . $code);?>
|
||||
|
||||
<p>
|
||||
<label for="new_password"><?php echo sprintf(lang('reset_password_new_password_label'), $min_password_length);?></label> <br />
|
||||
<?php echo form_input($new_password);?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php echo lang('reset_password_new_password_confirm_label', 'new_password_confirm');?> <br />
|
||||
<?php echo form_input($new_password_confirm);?>
|
||||
</p>
|
||||
|
||||
<?php echo form_input($user_id);?>
|
||||
<?php echo form_hidden($csrf); ?>
|
||||
|
||||
<p><?php echo form_submit('submit', lang('reset_password_submit_btn'));?></p>
|
||||
|
||||
<?php echo form_close();?>
|
||||
10
application/views/index.html
Normal file
10
application/views/index.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
88
application/views/welcome_message.php
Normal file
88
application/views/welcome_message.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<!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; }
|
||||
::webkit-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;
|
||||
}
|
||||
|
||||
#body{
|
||||
margin: 0 15px 0 15px;
|
||||
}
|
||||
|
||||
p.footer{
|
||||
text-align: right;
|
||||
font-size: 11px;
|
||||
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;
|
||||
-webkit-box-shadow: 0 0 8px #D0D0D0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
<h1>Welcome to CodeIgniter!</h1>
|
||||
|
||||
<div id="body">
|
||||
<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>
|
||||
|
||||
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
|
||||
</div>
|
||||
|
||||
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
204
public/index.php
Normal file
204
public/index.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
isset($_SERVER['HTTP_HOST']) or die("Unexpected request!");
|
||||
switch ($_SERVER['HTTP_HOST']) {
|
||||
case 'service.cmap.co.kr:8080':
|
||||
$env = 'development';
|
||||
break;
|
||||
case 'localhost':
|
||||
$env = 'production';
|
||||
break;
|
||||
default:
|
||||
$env = 'production';
|
||||
}
|
||||
|
||||
define('ENVIRONMENT', $env);
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* ERROR REPORTING
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* Different environments will require different levels of error reporting.
|
||||
* By default development will show errors but testing and live will hide them.
|
||||
*/
|
||||
|
||||
if (defined('ENVIRONMENT')) {
|
||||
switch (ENVIRONMENT) {
|
||||
case 'development':
|
||||
error_reporting(E_ALL);
|
||||
break;
|
||||
|
||||
case 'testing':
|
||||
case 'production':
|
||||
error_reporting(E_ALL);
|
||||
break;
|
||||
|
||||
default:
|
||||
exit('The application environment is not set correctly.');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SYSTEM FOLDER NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "system" folder.
|
||||
* Include the path if the folder is not in the same directory
|
||||
* as this file.
|
||||
*
|
||||
*/
|
||||
$system_path = 'system';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION FOLDER NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "application"
|
||||
* folder then the default one you can set its name here. The folder
|
||||
* can also be renamed or relocated anywhere on your server. If
|
||||
* you do, use a full server path. For more info please see the user guide:
|
||||
* http://codeigniter.com/user_guide/general/managing_apps.html
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*
|
||||
*/
|
||||
$application_folder = 'application';
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* 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" folder. Leave blank
|
||||
// if your controller is not in a sub-folder within the "controllers" folder
|
||||
// $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 (realpath($system_path) !== false) {
|
||||
$system_path = realpath($system_path) . '/';
|
||||
}
|
||||
|
||||
// ensure there's a trailing slash
|
||||
$system_path = rtrim($system_path, '/') . '/';
|
||||
|
||||
// Is the system path correct?
|
||||
if (!is_dir($system_path)) {
|
||||
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: " . pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* Now that we know the path, set the main path constants
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
// The name of THIS file
|
||||
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
|
||||
// The PHP file extension
|
||||
// this global constant is deprecated.
|
||||
define('EXT', '.php');
|
||||
|
||||
// Path to the system folder
|
||||
define('BASEPATH', str_replace("\\", "/", $system_path));
|
||||
|
||||
// Path to the front controller (this file)
|
||||
define('FCPATH', str_replace(SELF, '', __FILE__));
|
||||
|
||||
// Name of the "system folder"
|
||||
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
|
||||
|
||||
// The path to the "application" folder
|
||||
if (is_dir($application_folder)) {
|
||||
define('APPPATH', $application_folder . '/');
|
||||
} else {
|
||||
if (!is_dir(BASEPATH . $application_folder . '/')) {
|
||||
exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: " . SELF);
|
||||
}
|
||||
|
||||
define('APPPATH', BASEPATH . $application_folder . '/');
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* LOAD THE BOOTSTRAP FILE
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* And away we go...
|
||||
*
|
||||
*/
|
||||
require_once BASEPATH . 'core/CodeIgniter.php';
|
||||
|
||||
/* End of file index.php */
|
||||
/* Location: ./index.php */
|
||||
130
storage/backup/db.sql
Normal file
130
storage/backup/db.sql
Normal file
@@ -0,0 +1,130 @@
|
||||
DROP TABLE IF EXISTS `app_usergroups`;
|
||||
|
||||
#
|
||||
# Table structure for table 'groups'
|
||||
#
|
||||
|
||||
CREATE TABLE `app_usergroups` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(20) NOT NULL,
|
||||
`description` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
#
|
||||
# Dumping data for table 'groups'
|
||||
#
|
||||
|
||||
INSERT INTO `app_usergroups` (`id`, `name`, `description`) VALUES
|
||||
(1,'admin','Administrator'),
|
||||
(2,'members','General User');
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `app_users`;
|
||||
|
||||
#
|
||||
# Table structure for table 'users'
|
||||
#
|
||||
|
||||
CREATE TABLE `app_users` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`ip_address` varchar(45) NOT NULL,
|
||||
`username` varchar(100) NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`salt` varchar(255) DEFAULT NULL,
|
||||
`email` varchar(254) NOT NULL,
|
||||
`activation_code` varchar(40) DEFAULT NULL,
|
||||
`forgotten_password_code` varchar(40) DEFAULT NULL,
|
||||
`forgotten_password_time` int(11) unsigned DEFAULT NULL,
|
||||
`remember_code` varchar(40) DEFAULT NULL,
|
||||
`created_on` int(11) unsigned NOT NULL,
|
||||
`last_login` int(11) unsigned DEFAULT NULL,
|
||||
`active` tinyint(1) unsigned DEFAULT NULL,
|
||||
`first_name` varchar(50) DEFAULT NULL,
|
||||
`last_name` varchar(50) DEFAULT NULL,
|
||||
`company` varchar(100) DEFAULT NULL,
|
||||
`phone` varchar(20) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
#
|
||||
# Dumping data for table 'users'
|
||||
#
|
||||
|
||||
INSERT INTO `app_users` (`id`, `ip_address`, `username`, `password`, `salt`, `email`, `activation_code`, `forgotten_password_code`, `created_on`, `last_login`, `active`, `first_name`, `last_name`, `company`, `phone`) VALUES
|
||||
('1','127.0.0.1','administrator','$2a$07$SeBknntpZror9uyftVopmu61qg0ms8Qv1yV6FG.kQOSM.9QhmTo36','','admin@admin.com','',NULL,'1268889823','1268889823','1', 'Admin','istrator','ADMIN','0');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `app_users_groups`;
|
||||
|
||||
#
|
||||
# Table structure for table 'users_groups'
|
||||
#
|
||||
|
||||
CREATE TABLE `app_users_groups` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) unsigned NOT NULL,
|
||||
`group_id` mediumint(8) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_users_groups_users1_idx` (`user_id`),
|
||||
KEY `fk_users_groups_groups1_idx` (`group_id`),
|
||||
CONSTRAINT `uc_users_groups` UNIQUE (`user_id`, `group_id`),
|
||||
CONSTRAINT `fk_users_groups_users1` FOREIGN KEY (`user_id`) REFERENCES `app_users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_users_groups_groups1` FOREIGN KEY (`group_id`) REFERENCES `app_usergroups` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO `app_users_groups` (`id`, `user_id`, `group_id`) VALUES
|
||||
(1,1,1),
|
||||
(2,1,2);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `app_login_attempts`;
|
||||
|
||||
#
|
||||
# Table structure for table 'login_attempts'
|
||||
#
|
||||
|
||||
CREATE TABLE `app_login_attempts` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`ip_address` varchar(45) NOT NULL,
|
||||
`login` varchar(100) NOT NULL,
|
||||
`time` int(11) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `app_keys`;
|
||||
|
||||
#
|
||||
# Table structure for table 'app_keys'
|
||||
#
|
||||
|
||||
CREATE TABLE `app_keys` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
username varchar(45) not null,
|
||||
`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=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `app_logs`;
|
||||
|
||||
#
|
||||
# Table structure for table 'app_logs'
|
||||
#
|
||||
|
||||
CREATE TABLE `app_logs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`uri` varchar(255) NOT NULL,
|
||||
`method` varchar(6) NOT NULL,
|
||||
`params` text NOT NULL,
|
||||
`api_key` varchar(40) NOT NULL,
|
||||
`ip_address` varchar(15) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
`authorized` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
0
storage/logs/index.html
Normal file
0
storage/logs/index.html
Normal file
Reference in New Issue
Block a user