initial
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
RewriteEngine on
|
||||
RewriteCond $1 !^(index\.php|resources|robots\.txt)
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{HTTPS} off
|
||||
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||
|
||||
# php -- BEGIN cPanel-generated handler, do not edit
|
||||
# Set the “ea-php73” package as the default “PHP” programming language.
|
||||
<IfModule mime_module>
|
||||
AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml
|
||||
</IfModule>
|
||||
# php -- END cPanel-generated handler, do not edit
|
||||
@@ -0,0 +1,6 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| AUTO-LOADER
|
||||
| -------------------------------------------------------------------
|
||||
| This file specifies which systems should be loaded by default.
|
||||
|
|
||||
| In order to keep the framework as light-weight as possible only the
|
||||
| absolute minimal resources are loaded by default. For example,
|
||||
| the database is not connected to automatically since no assumption
|
||||
| is made regarding whether you intend to use it. This file lets
|
||||
| you globally define which systems you would like loaded with every
|
||||
| request.
|
||||
|
|
||||
| -------------------------------------------------------------------
|
||||
| Instructions
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| These are the things you can load automatically:
|
||||
|
|
||||
| 1. Packages
|
||||
| 2. Libraries
|
||||
| 3. Drivers
|
||||
| 4. Helper files
|
||||
| 5. Custom config files
|
||||
| 6. Language files
|
||||
| 7. Models
|
||||
|
|
||||
*/
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Packages
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
||||
|
|
||||
*/
|
||||
$autoload['packages'] = array();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Libraries
|
||||
| -------------------------------------------------------------------
|
||||
| These are the classes located in system/libraries/ or your
|
||||
| application/libraries/ directory, with the addition of the
|
||||
| 'database' library, which is somewhat of a special case.
|
||||
|
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['libraries'] = array('database', 'email', 'session');
|
||||
|
|
||||
| You can also supply an alternative library name to be assigned
|
||||
| in the controller:
|
||||
|
|
||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||
*/
|
||||
$autoload['libraries'] = array('database', 'email', 'session');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Drivers
|
||||
| -------------------------------------------------------------------
|
||||
| These classes are located in system/libraries/ or in your
|
||||
| application/libraries/ directory, but are also placed inside their
|
||||
| own subdirectory and they extend the CI_Driver_Library class. They
|
||||
| offer multiple interchangeable driver options.
|
||||
|
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['drivers'] = array('cache');
|
||||
|
|
||||
| You can also supply an alternative property name to be assigned in
|
||||
| the controller:
|
||||
|
|
||||
| $autoload['drivers'] = array('cache' => 'cch');
|
||||
|
|
||||
*/
|
||||
$autoload['drivers'] = array();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Helper Files
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
$autoload['helper'] = array('url', 'file', 'form', 'date','gunawan','useraccess');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Config files
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['config'] = array('config1', 'config2');
|
||||
|
|
||||
| NOTE: This item is intended for use ONLY if you have created custom
|
||||
| config files. Otherwise, leave it blank.
|
||||
|
|
||||
*/
|
||||
$autoload['config'] = array();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Language files
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['language'] = array('lang1', 'lang2');
|
||||
|
|
||||
| NOTE: Do not include the "_lang" part of your file. For example
|
||||
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
||||
|
|
||||
*/
|
||||
$autoload['language'] = array();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Auto-load Models
|
||||
| -------------------------------------------------------------------
|
||||
| Prototype:
|
||||
|
|
||||
| $autoload['model'] = array('first_model', 'second_model');
|
||||
|
|
||||
| You can also supply an alternative model name to be assigned
|
||||
| in the controller:
|
||||
|
|
||||
| $autoload['model'] = array('first_model' => 'first');
|
||||
*/
|
||||
$autoload['model'] = array();
|
||||
@@ -0,0 +1,547 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Base Site URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL to your CodeIgniter root. Typically this will be your base URL,
|
||||
| WITH a trailing slash:
|
||||
|
|
||||
| http://example.com/
|
||||
|
|
||||
| WARNING: You MUST set this value!
|
||||
|
|
||||
| If it is not set, then CodeIgniter will try guess the protocol and path
|
||||
| your installation, but due to security concerns the hostname will be set
|
||||
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
|
||||
| The auto-detection mechanism exists only for convenience during
|
||||
| development and MUST NOT be used in production!
|
||||
|
|
||||
| If you need to allow multiple domains, remember that this file is still
|
||||
| a PHP script and you can easily do that on your own.
|
||||
|
|
||||
*/
|
||||
$config['base_url'] = 'https://apitest.semestaterpadu.my.id/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API keys & external services (edit values here)
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
$config['google_maps_api_key'] = '';
|
||||
$config['firebase_db_url'] = 'https://project-on-time-apps-default-rtdb.firebaseio.com/';
|
||||
$config['fcm_project_id'] = '';
|
||||
$config['fcm_credentials_json'] = '';
|
||||
$config['fcm_credentials_path'] = '';
|
||||
$config['fcm_limit_per_hour'] = 100;
|
||||
$config['fcm_limit_per_day'] = 500;
|
||||
$config['maps_limit_per_hour'] = 1000;
|
||||
$config['maps_limit_per_day'] = 5000;
|
||||
|
||||
// Constants used by helpers (derived from config above)
|
||||
define('firebaseDb', $config['firebase_db_url']);
|
||||
define('keyfcm', '');
|
||||
define('google_maps_api', $config['google_maps_api_key']);
|
||||
define('GOOGLE_MAPS_API_KEY', $config['google_maps_api_key']);
|
||||
define('FIREBASE_DB_URL', $config['firebase_db_url']);
|
||||
define('FCM_PROJECT_ID', $config['fcm_project_id']);
|
||||
define('FIREBASE_PROJECT_ID', $config['fcm_project_id']);
|
||||
define('FCM_CREDENTIALS_JSON', $config['fcm_credentials_json']);
|
||||
define('FCM_CREDENTIALS_PATH', $config['fcm_credentials_path']);
|
||||
define('FCM_LIMIT_PER_HOUR', $config['fcm_limit_per_hour']);
|
||||
define('FCM_LIMIT_PER_DAY', $config['fcm_limit_per_day']);
|
||||
define('MAPS_LIMIT_PER_HOUR', $config['maps_limit_per_hour']);
|
||||
define('MAPS_LIMIT_PER_DAY', $config['maps_limit_per_day']);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Index File
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Typically this will be your index.php file, unless you've renamed it to
|
||||
| something else. If you are using mod_rewrite to remove the page set this
|
||||
| variable so that it is blank.
|
||||
|
|
||||
*/
|
||||
$config['index_page'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URI PROTOCOL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item determines which server global should be used to retrieve the
|
||||
| URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
|
|
||||
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
$config['uri_protocol'] = 'REQUEST_URI';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL suffix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
|
||||
| For more information please see the user guide:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
$config['url_suffix'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Language
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This determines which set of language files should be used. Make sure
|
||||
| there is an available translation if you intend to use something other
|
||||
| than english.
|
||||
|
|
||||
*/
|
||||
$config['language'] = 'english';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Character Set
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This determines which character set is used by default in various methods
|
||||
| that require a character set to be provided.
|
||||
|
|
||||
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
||||
|
|
||||
*/
|
||||
$config['charset'] = 'UTF-8';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable System Hooks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you would like to use the 'hooks' feature you must enable it by
|
||||
| setting this variable to TRUE (boolean). See the user guide for details.
|
||||
|
|
||||
*/
|
||||
$config['enable_hooks'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Extension Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item allows you to set the filename/classname prefix when extending
|
||||
| native libraries. For more information please see the user guide:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/core_classes.html
|
||||
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
||||
|
|
||||
*/
|
||||
$config['subclass_prefix'] = 'MY_';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer auto-loading
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enabling this setting will tell CodeIgniter to look for a Composer
|
||||
| package auto-loader script in application/vendor/autoload.php.
|
||||
|
|
||||
| $config['composer_autoload'] = TRUE;
|
||||
|
|
||||
| Or if you have your vendor/ directory located somewhere else, you
|
||||
| can opt to set a specific path as well:
|
||||
|
|
||||
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
||||
|
|
||||
| For more information about Composer, please visit http://getcomposer.org/
|
||||
|
|
||||
| Note: This will NOT disable or override the CodeIgniter-specific
|
||||
| autoloading (application/config/autoload.php)
|
||||
*/
|
||||
$config['composer_autoload'] = FALSE;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed URL Characters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This lets you specify which characters are permitted within your URLs.
|
||||
| When someone tries to submit a URL with disallowed characters they will
|
||||
| get a warning message.
|
||||
|
|
||||
| As a security measure you are STRONGLY encouraged to restrict URLs to
|
||||
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
||||
|
|
||||
| Leave blank to allow all characters -- but only if you are insane.
|
||||
|
|
||||
| The configured value is actually a regular expression character group
|
||||
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
||||
|
|
||||
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
||||
|
|
||||
*/
|
||||
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable Query Strings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default CodeIgniter uses search-engine friendly segment based URLs:
|
||||
| example.com/who/what/where/
|
||||
|
|
||||
| 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['enable_query_strings'] = FALSE;
|
||||
$config['controller_trigger'] = 'c';
|
||||
$config['function_trigger'] = 'm';
|
||||
$config['directory_trigger'] = 'd';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allow $_GET array
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 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.
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['allow_get_array'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can enable error logging by setting a threshold over zero. The
|
||||
| threshold determines what gets logged. Threshold options are:
|
||||
|
|
||||
| 0 = Disables logging, Error logging TURNED OFF
|
||||
| 1 = Error Messages (including PHP errors)
|
||||
| 2 = Debug Messages
|
||||
| 3 = Informational Messages
|
||||
| 4 = All Messages
|
||||
|
|
||||
| You can also pass an array with threshold levels to show individual error types
|
||||
|
|
||||
| array(2) = Debug Messages, without Error Messages
|
||||
|
|
||||
| For a live site you'll usually only enable Errors (1) to be logged otherwise
|
||||
| your log files will fill up very fast.
|
||||
|
|
||||
*/
|
||||
$config['log_threshold'] = 0;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/logs/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['log_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log File Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default filename extension for log files. The default 'php' allows for
|
||||
| protecting the log files via basic scripting, when they are to be stored
|
||||
| under a publicly accessible directory.
|
||||
|
|
||||
| Note: Leaving it blank will default to 'php'.
|
||||
|
|
||||
*/
|
||||
$config['log_file_extension'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log File Permissions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The file system permissions to be applied on newly created log files.
|
||||
|
|
||||
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
|
||||
| integer notation (i.e. 0700, 0644, etc.)
|
||||
*/
|
||||
$config['log_file_permissions'] = 0700;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Date Format for Logs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Each item that is logged has an associated date. You can use PHP date
|
||||
| codes to set your own date formatting
|
||||
|
|
||||
*/
|
||||
$config['log_date_format'] = 'Y-m-d H:i:s';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Views Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/views/errors/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['error_views_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Leave this BLANK unless you would like to set something other than the default
|
||||
| application/cache/ directory. Use a full server path with trailing slash.
|
||||
|
|
||||
*/
|
||||
$config['cache_path'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Include Query String
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to take the URL query string into consideration when generating
|
||||
| output cache files. Valid options are:
|
||||
|
|
||||
| FALSE = Disabled
|
||||
| TRUE = Enabled, take all query parameters into account.
|
||||
| Please be aware that this may result in numerous cache
|
||||
| files generated for the same page over and over again.
|
||||
| array('q') = Enabled, but only take into account the specified list
|
||||
| of query parameters.
|
||||
|
|
||||
*/
|
||||
$config['cache_query_string'] = FALSE;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class, you must set an encryption key.
|
||||
| See the user guide for more info.
|
||||
|
|
||||
| https://codeigniter.com/user_guide/libraries/encryption.html
|
||||
|
|
||||
*/
|
||||
$config['encryption_key'] = '';
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_driver'
|
||||
|
|
||||
| The storage driver to use: files, database, redis, memcached
|
||||
|
|
||||
| 'sess_cookie_name'
|
||||
|
|
||||
| The session cookie name, must contain only [0-9a-z_-] characters
|
||||
|
|
||||
| 'sess_expiration'
|
||||
|
|
||||
| The number of SECONDS you want the session to last.
|
||||
| Setting to 0 (zero) means expire when the browser is closed.
|
||||
|
|
||||
| 'sess_save_path'
|
||||
|
|
||||
| The location to save sessions to, driver dependent.
|
||||
|
|
||||
| For the 'files' driver, it's a path to a writable directory.
|
||||
| WARNING: Only absolute paths are supported!
|
||||
|
|
||||
| For the 'database' driver, it's a table name.
|
||||
| Please read up the manual for the format with other session drivers.
|
||||
|
|
||||
| IMPORTANT: You are REQUIRED to set a valid save path!
|
||||
|
|
||||
| 'sess_match_ip'
|
||||
|
|
||||
| Whether to match the user's IP address when reading the session data.
|
||||
|
|
||||
| WARNING: If you're using the database driver, don't forget to update
|
||||
| your session table's PRIMARY KEY when changing this setting.
|
||||
|
|
||||
| 'sess_time_to_update'
|
||||
|
|
||||
| How many seconds between CI regenerating the session ID.
|
||||
|
|
||||
| 'sess_regenerate_destroy'
|
||||
|
|
||||
| Whether to destroy session data associated with the old session ID
|
||||
| when auto-regenerating the session ID. When set to FALSE, the data
|
||||
| will be later deleted by the garbage collector.
|
||||
|
|
||||
| Other session cookie settings are shared with the rest of the application,
|
||||
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
||||
|
|
||||
*/
|
||||
$config['sess_driver'] = 'database';
|
||||
$config['sess_cookie_name'] = 'ci_session';
|
||||
$config['sess_expiration'] = 7200;
|
||||
$config['sess_save_path'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
$config['sess_regenerate_destroy'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
|
||||
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
|
||||
| 'cookie_path' = Typically will be a forward slash
|
||||
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
|
||||
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
||||
|
|
||||
| Note: These settings (with the exception of 'cookie_prefix' and
|
||||
| 'cookie_httponly') will also affect sessions.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = '';
|
||||
$config['cookie_domain'] = '';
|
||||
$config['cookie_path'] = '/';
|
||||
$config['cookie_secure'] = FALSE;
|
||||
$config['cookie_httponly'] = FALSE;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Standardize newlines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether to standardize newline characters in input data,
|
||||
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['standardize_newlines'] = FALSE;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global XSS Filtering
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines whether the XSS filter is always active when GET, POST or
|
||||
| COOKIE data is encountered
|
||||
|
|
||||
| WARNING: This feature is DEPRECATED and currently available only
|
||||
| for backwards compatibility purposes!
|
||||
|
|
||||
*/
|
||||
$config['global_xss_filtering'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross Site Request Forgery
|
||||
|--------------------------------------------------------------------------
|
||||
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
|
||||
| checked on a submitted form. If you are accepting user data, it is strongly
|
||||
| recommended CSRF protection be enabled.
|
||||
|
|
||||
| 'csrf_token_name' = The token name
|
||||
| 'csrf_cookie_name' = The cookie name
|
||||
| 'csrf_expire' = The number in seconds the token should expire.
|
||||
| 'csrf_regenerate' = Regenerate token on every submission
|
||||
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
|
||||
*/
|
||||
$config['csrf_protection'] = FALSE;
|
||||
$config['csrf_token_name'] = 'csrf_test_name';
|
||||
$config['csrf_cookie_name'] = 'csrf_cookie_name';
|
||||
$config['csrf_expire'] = 7200;
|
||||
$config['csrf_regenerate'] = TRUE;
|
||||
$config['csrf_exclude_uris'] = array();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Output Compression
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enables Gzip output compression for faster page loads. When enabled,
|
||||
| the output class will test whether your server supports Gzip.
|
||||
| Even if it does, however, not all browsers support compression
|
||||
| so enable only if you are reasonably sure your visitors can handle it.
|
||||
|
|
||||
| Only used if zlib.output_compression is turned off in your php.ini.
|
||||
| Please do not use it together with httpd-level output compression.
|
||||
|
|
||||
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
|
||||
| means you are prematurely outputting something to your browser. It could
|
||||
| even be a line of whitespace at the end of one of your scripts. For
|
||||
| compression to work, nothing can be sent before the output buffer is called
|
||||
| by the output class. Do not 'echo' any values with compression enabled.
|
||||
|
|
||||
*/
|
||||
$config['compress_output'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Master Time Reference
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Options are 'local' or any PHP supported timezone. This preference tells
|
||||
| the system whether to use your server's local time as the master 'now'
|
||||
| reference, or convert it to the configured one timezone. See the 'date
|
||||
| helper' page of the user guide for information regarding date handling.
|
||||
|
|
||||
*/
|
||||
$config['time_reference'] = 'local';
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Rewrite PHP Short Tags
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your PHP installation does not have short tag support enabled CI
|
||||
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
|
||||
| in your view files. Options are TRUE or FALSE (boolean)
|
||||
|
|
||||
| Note: You need to have eval() enabled for this to work.
|
||||
|
|
||||
*/
|
||||
$config['rewrite_short_tags'] = FALSE;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Reverse Proxy IPs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a reverse proxy, you must whitelist the proxy
|
||||
| IP addresses from which CodeIgniter should trust headers such as
|
||||
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
|
||||
| the visitor's IP address.
|
||||
|
|
||||
| You can use both an array or a comma-separated list of proxy addresses,
|
||||
| as well as specifying whole subnets. Here are a few examples:
|
||||
|
|
||||
| Comma-separated: '10.0.1.200,192.168.5.0/24'
|
||||
| Array: array('10.0.1.200', '192.168.5.0/24')
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Display Debug backtrace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If set to TRUE, a backtrace will be displayed along with php errors. If
|
||||
| error_reporting is disabled, the backtrace will not display, regardless
|
||||
| of this setting
|
||||
|
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') or define('SHOW_DEBUG_BACKTRACE', TRUE);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File and Directory Modes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These prefs are used when checking and setting modes when working
|
||||
| with the file system. The defaults are fine on servers with proper
|
||||
| security, but you may wish (or even need) to change the values in
|
||||
| certain environments (Apache running a separate process for each
|
||||
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
|
||||
| always be used to set the mode correctly.
|
||||
|
|
||||
*/
|
||||
defined('FILE_READ_MODE') or define('FILE_READ_MODE', 0644);
|
||||
defined('FILE_WRITE_MODE') or define('FILE_WRITE_MODE', 0666);
|
||||
defined('DIR_READ_MODE') or define('DIR_READ_MODE', 0755);
|
||||
defined('DIR_WRITE_MODE') or define('DIR_WRITE_MODE', 0755);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Stream Modes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These modes are used when working with fopen()/popen()
|
||||
|
|
||||
*/
|
||||
defined('FOPEN_READ') or define('FOPEN_READ', 'rb');
|
||||
defined('FOPEN_READ_WRITE') or define('FOPEN_READ_WRITE', 'r+b');
|
||||
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
|
||||
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') or define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
|
||||
defined('FOPEN_WRITE_CREATE') or define('FOPEN_WRITE_CREATE', 'ab');
|
||||
defined('FOPEN_READ_WRITE_CREATE') or define('FOPEN_READ_WRITE_CREATE', 'a+b');
|
||||
defined('FOPEN_WRITE_CREATE_STRICT') or define('FOPEN_WRITE_CREATE_STRICT', 'xb');
|
||||
defined('FOPEN_READ_WRITE_CREATE_STRICT') or define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Used to indicate the conditions under which the script is exit()ing.
|
||||
| While there is no universal standard for error codes, there are some
|
||||
| broad conventions. Three such conventions are mentioned below, for
|
||||
| those who wish to make use of them. The CodeIgniter defaults were
|
||||
| chosen for the least overlap with these conventions, while still
|
||||
| leaving room for others to be defined in future versions and user
|
||||
| applications.
|
||||
|
|
||||
| The three main conventions used for determining exit status codes
|
||||
| are as follows:
|
||||
|
|
||||
| Standard C/C++ Library (stdlibc):
|
||||
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||
| (This link also contains other GNU-specific conventions)
|
||||
| BSD sysexits.h:
|
||||
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
| Bash scripting:
|
||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
|
|
||||
*/
|
||||
defined('EXIT_SUCCESS') or define('EXIT_SUCCESS', 0); // no errors
|
||||
defined('EXIT_ERROR') or define('EXIT_ERROR', 1); // generic error
|
||||
defined('EXIT_CONFIG') or define('EXIT_CONFIG', 3); // configuration error
|
||||
defined('EXIT_UNKNOWN_FILE') or define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||
defined('EXIT_UNKNOWN_CLASS') or define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||
defined('EXIT_UNKNOWN_METHOD') or define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||
defined('EXIT_USER_INPUT') or define('EXIT_USER_INPUT', 7); // invalid user input
|
||||
defined('EXIT_DATABASE') or define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') or define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
||||
|
||||
define('demo', False);
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| DATABASE CONNECTIVITY SETTINGS
|
||||
| -------------------------------------------------------------------
|
||||
| This file will contain the settings needed to access your database.
|
||||
|
|
||||
| For complete instructions please consult the 'Database Connection'
|
||||
| page of the User Guide.
|
||||
|
|
||||
| -------------------------------------------------------------------
|
||||
| EXPLANATION OF VARIABLES
|
||||
| -------------------------------------------------------------------
|
||||
|
|
||||
| ['dsn'] The full DSN string describe a connection to the database.
|
||||
| ['hostname'] The hostname of your database server.
|
||||
| ['username'] The username used to connect to the database
|
||||
| ['password'] The password used to connect to the database
|
||||
| ['database'] The name of the database you want to connect to
|
||||
| ['dbdriver'] The database driver. e.g.: mysqli.
|
||||
| Currently supported:
|
||||
| cubrid, ibase, mssql, mysql, mysqli, oci8,
|
||||
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
|
||||
| ['dbprefix'] You can add an optional prefix, which will be added
|
||||
| to the table name when using the Query Builder class
|
||||
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|
||||
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|
||||
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
|
||||
| ['cachedir'] The path to the folder where cache files should be stored
|
||||
| ['char_set'] The character set used in communicating with the database
|
||||
| ['dbcollat'] The character collation used in communicating with the database
|
||||
| NOTE: For MySQL and MySQLi databases, this setting is only used
|
||||
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|
||||
| (and in table creation queries made with DB Forge).
|
||||
| There is an incompatibility in PHP with mysql_real_escape_string() which
|
||||
| can make your site vulnerable to SQL injection if you are using a
|
||||
| multi-byte character set and are running versions lower than these.
|
||||
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|
||||
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|
||||
| ['encrypt'] Whether or not to use an encrypted connection.
|
||||
|
|
||||
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
|
||||
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
||||
|
|
||||
| 'ssl_key' - Path to the private key file
|
||||
| 'ssl_cert' - Path to the public key certificate file
|
||||
| 'ssl_ca' - Path to the certificate authority file
|
||||
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
|
||||
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
|
||||
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
|
||||
|
|
||||
| ['compress'] Whether or not to use client compression (MySQL only)
|
||||
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|
||||
| - good for ensuring strict SQL while developing
|
||||
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
|
||||
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
|
||||
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
|
||||
| NOTE: Disabling this will also effectively disable both
|
||||
| $this->db->last_query() and profiling of DB queries.
|
||||
| When you run a query, with this setting set to TRUE (default),
|
||||
| CodeIgniter will store the SQL statement for debugging purposes.
|
||||
| However, this may cause high memory usage, especially if you run
|
||||
| a lot of SQL queries ... disable this to avoid that problem.
|
||||
|
|
||||
| The $active_group variable lets you choose which connection group to
|
||||
| make active. By default there is only one group (the 'default' group).
|
||||
|
|
||||
| The $query_builder variables lets you determine whether or not to load
|
||||
| the query builder class.
|
||||
*/
|
||||
$active_group = 'default';
|
||||
$query_builder = TRUE;
|
||||
|
||||
$db['default'] = array(
|
||||
'dsn' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'bumdes_ontime',
|
||||
'password' => 'G34VZFfSpP5Q2kZx',
|
||||
'database' => 'bumdes_ontimedb',
|
||||
'dbdriver' => 'mysqli',
|
||||
'dbprefix' => '',
|
||||
'pconnect' => FALSE,
|
||||
'db_debug' => (ENVIRONMENT !== 'production'),
|
||||
'cache_on' => FALSE,
|
||||
'cachedir' => '',
|
||||
'char_set' => 'utf8',
|
||||
'dbcollat' => 'utf8_general_ci',
|
||||
'swap_pre' => '',
|
||||
'encrypt' => FALSE,
|
||||
'compress' => FALSE,
|
||||
'stricton' => FALSE,
|
||||
'failover' => array(),
|
||||
'save_queries' => TRUE
|
||||
);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$_doctypes = array(
|
||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'html5' => '<!DOCTYPE html>',
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
|
||||
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
|
||||
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
||||
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
|
||||
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
|
||||
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
|
||||
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
||||
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">'
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Legacy FCM config – DO NOT USE
|
||||
|--------------------------------------------------------------------------
|
||||
| Push notifications use FCM HTTP v1 only (see application/helpers/fcm_v1_helper.php).
|
||||
| Set FCM_CREDENTIALS_PATH or FCM_CREDENTIALS_JSON and FCM_PROJECT_ID in the environment.
|
||||
| This file exists so the deprecated application/libraries/Fcm.php does not
|
||||
| load a missing config; the legacy library must not be used (no legacy API key).
|
||||
*/
|
||||
$config['fcm_api_key'] = '';
|
||||
$config['fcm_api_send_address'] = 'https://fcm.googleapis.com/fcm/send';
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| Foreign Characters
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of foreign characters for transliteration
|
||||
| conversion used by the Text helper
|
||||
|
|
||||
*/
|
||||
$foreign_characters = array(
|
||||
'/ä|æ|ǽ/' => 'ae',
|
||||
'/ö|œ/' => 'oe',
|
||||
'/ü/' => 'ue',
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
|
||||
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
|
||||
'/Б/' => 'B',
|
||||
'/б/' => 'b',
|
||||
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
|
||||
'/ç|ć|ĉ|ċ|č/' => 'c',
|
||||
'/Д|Δ/' => 'D',
|
||||
'/д|δ/' => 'd',
|
||||
'/Ð|Ď|Đ/' => 'Dj',
|
||||
'/ð|ď|đ/' => 'dj',
|
||||
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
|
||||
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
|
||||
'/Ф/' => 'F',
|
||||
'/ф/' => 'f',
|
||||
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
|
||||
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
|
||||
'/Ĥ|Ħ/' => 'H',
|
||||
'/ĥ|ħ/' => 'h',
|
||||
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
|
||||
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
|
||||
'/Ĵ/' => 'J',
|
||||
'/ĵ/' => 'j',
|
||||
'/Θ/' => 'TH',
|
||||
'/θ/' => 'th',
|
||||
'/Ķ|Κ|К/' => 'K',
|
||||
'/ķ|κ|к/' => 'k',
|
||||
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
|
||||
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
|
||||
'/М/' => 'M',
|
||||
'/м/' => 'm',
|
||||
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
|
||||
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
|
||||
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
|
||||
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
|
||||
'/П/' => 'P',
|
||||
'/п/' => 'p',
|
||||
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
|
||||
'/ŕ|ŗ|ř|ρ|р/' => 'r',
|
||||
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
|
||||
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
|
||||
'/Ț|Ţ|Ť|Ŧ|Τ|Т/' => 'T',
|
||||
'/ț|ţ|ť|ŧ|τ|т/' => 't',
|
||||
'/Þ|þ/' => 'th',
|
||||
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
|
||||
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
|
||||
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
|
||||
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
|
||||
'/В/' => 'V',
|
||||
'/в/' => 'v',
|
||||
'/Ŵ/' => 'W',
|
||||
'/ŵ/' => 'w',
|
||||
'/Φ/' => 'F',
|
||||
'/φ/' => 'f',
|
||||
'/Χ/' => 'CH',
|
||||
'/χ/' => 'ch',
|
||||
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
|
||||
'/ź|ż|ž|ζ|з/' => 'z',
|
||||
'/Æ|Ǽ/' => 'AE',
|
||||
'/ß/' => 'ss',
|
||||
'/IJ/' => 'IJ',
|
||||
'/ij/' => 'ij',
|
||||
'/Œ/' => 'OE',
|
||||
'/ƒ/' => 'f',
|
||||
'/Ξ/' => 'KS',
|
||||
'/ξ/' => 'ks',
|
||||
'/Π/' => 'P',
|
||||
'/π/' => 'p',
|
||||
'/Β/' => 'V',
|
||||
'/β/' => 'v',
|
||||
'/Μ/' => 'M',
|
||||
'/μ/' => 'm',
|
||||
'/Ψ/' => 'PS',
|
||||
'/ψ/' => 'ps',
|
||||
'/Ё/' => 'Yo',
|
||||
'/ё/' => 'yo',
|
||||
'/Є/' => 'Ye',
|
||||
'/є/' => 'ye',
|
||||
'/Ї/' => 'Yi',
|
||||
'/Ж/' => 'Zh',
|
||||
'/ж/' => 'zh',
|
||||
'/Х/' => 'Kh',
|
||||
'/х/' => 'kh',
|
||||
'/Ц/' => 'Ts',
|
||||
'/ц/' => 'ts',
|
||||
'/Ч/' => 'Ch',
|
||||
'/ч/' => 'ch',
|
||||
'/Ш/' => 'Sh',
|
||||
'/ш/' => 'sh',
|
||||
'/Щ/' => 'Shch',
|
||||
'/щ/' => 'shch',
|
||||
'/Ъ|ъ|Ь|ь/' => '',
|
||||
'/Ю/' => 'Yu',
|
||||
'/ю/' => 'yu',
|
||||
'/Я/' => 'Ya',
|
||||
'/я/' => 'ya'
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Hooks
|
||||
| -------------------------------------------------------------------------
|
||||
| This file lets you define "hooks" to extend CI without hacking the core
|
||||
| files. Please see the user guide for info:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/hooks.html
|
||||
|
|
||||
*/
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Memcached settings
|
||||
| -------------------------------------------------------------------------
|
||||
| Your Memcached servers can be specified below.
|
||||
|
|
||||
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
||||
|
|
||||
*/
|
||||
$config = array(
|
||||
'default' => array(
|
||||
'hostname' => '127.0.0.1',
|
||||
'port' => '11211',
|
||||
'weight' => '1',
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable Migrations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migrations are disabled by default for security reasons.
|
||||
| You should enable migrations whenever you intend to do a schema migration
|
||||
| and disable it back when you're done.
|
||||
|
|
||||
*/
|
||||
$config['migration_enabled'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Type
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migration file names may be based on a sequential identifier or on
|
||||
| a timestamp. Options are:
|
||||
|
|
||||
| 'sequential' = Sequential migration naming (001_add_blog.php)
|
||||
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
|
||||
| Use timestamp format YYYYMMDDHHIISS.
|
||||
|
|
||||
| Note: If this configuration value is missing the Migration library
|
||||
| defaults to 'sequential' for backward compatibility with CI2.
|
||||
|
|
||||
*/
|
||||
$config['migration_type'] = 'timestamp';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the name of the table that will store the current migrations state.
|
||||
| When migrations runs it will store in a database table which migration
|
||||
| level the system is at. It then compares the migration level in this
|
||||
| table to the $config['migration_version'] if they are not the same it
|
||||
| will migrate up. This must be set.
|
||||
|
|
||||
*/
|
||||
$config['migration_table'] = 'migrations';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto Migrate To Latest
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If this is set to TRUE when you load the migrations class and have
|
||||
| $config['migration_enabled'] set to TRUE the system will auto migrate
|
||||
| to your latest migration (whatever $config['migration_version'] is
|
||||
| set to). This way you do not have to call migrations anywhere else
|
||||
| in your code to have the latest migration.
|
||||
|
|
||||
*/
|
||||
$config['migration_auto_latest'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is used to set migration version that the file system should be on.
|
||||
| If you run $this->migration->current() this is the version that schema will
|
||||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 0;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Path to your migrations folder.
|
||||
| Typically, it will be within your application path.
|
||||
| Also, writing permission is required within the migrations path.
|
||||
|
|
||||
*/
|
||||
$config['migration_path'] = APPPATH.'migrations/';
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| MIME TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of mime types. It is used by the
|
||||
| Upload class to help identify allowed file types.
|
||||
|
|
||||
*/
|
||||
return array(
|
||||
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
|
||||
'cpt' => 'application/mac-compactpro',
|
||||
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
|
||||
'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'),
|
||||
'dms' => 'application/octet-stream',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lzh' => 'application/octet-stream',
|
||||
'exe' => array('application/octet-stream', 'application/x-msdownload'),
|
||||
'class' => 'application/octet-stream',
|
||||
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
|
||||
'so' => 'application/octet-stream',
|
||||
'sea' => 'application/octet-stream',
|
||||
'dll' => 'application/octet-stream',
|
||||
'oda' => 'application/oda',
|
||||
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
|
||||
'ai' => array('application/pdf', 'application/postscript'),
|
||||
'eps' => 'application/postscript',
|
||||
'ps' => 'application/postscript',
|
||||
'smi' => 'application/smil',
|
||||
'smil' => 'application/smil',
|
||||
'mif' => 'application/vnd.mif',
|
||||
'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'),
|
||||
'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
|
||||
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
|
||||
'wbxml' => 'application/wbxml',
|
||||
'wmlc' => 'application/wmlc',
|
||||
'dcr' => 'application/x-director',
|
||||
'dir' => 'application/x-director',
|
||||
'dxr' => 'application/x-director',
|
||||
'dvi' => 'application/x-dvi',
|
||||
'gtar' => 'application/x-gtar',
|
||||
'gz' => 'application/x-gzip',
|
||||
'gzip' => 'application/x-gzip',
|
||||
'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'),
|
||||
'php4' => 'application/x-httpd-php',
|
||||
'php3' => 'application/x-httpd-php',
|
||||
'phtml' => 'application/x-httpd-php',
|
||||
'phps' => 'application/x-httpd-php-source',
|
||||
'js' => array('application/x-javascript', 'text/plain'),
|
||||
'swf' => 'application/x-shockwave-flash',
|
||||
'sit' => 'application/x-stuffit',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
|
||||
'z' => 'application/x-compress',
|
||||
'xhtml' => 'application/xhtml+xml',
|
||||
'xht' => 'application/xhtml+xml',
|
||||
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
|
||||
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
|
||||
'mid' => 'audio/midi',
|
||||
'midi' => 'audio/midi',
|
||||
'mpga' => 'audio/mpeg',
|
||||
'mp2' => 'audio/mpeg',
|
||||
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
|
||||
'aif' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aiff' => array('audio/x-aiff', 'audio/aiff'),
|
||||
'aifc' => 'audio/x-aiff',
|
||||
'ram' => 'audio/x-pn-realaudio',
|
||||
'rm' => 'audio/x-pn-realaudio',
|
||||
'rpm' => 'audio/x-pn-realaudio-plugin',
|
||||
'ra' => 'audio/x-realaudio',
|
||||
'rv' => 'video/vnd.rn-realvideo',
|
||||
'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
|
||||
'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'),
|
||||
'gif' => 'image/gif',
|
||||
'jpeg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpg' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jpe' => array('image/jpeg', 'image/pjpeg'),
|
||||
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
|
||||
'png' => array('image/png', 'image/x-png'),
|
||||
'tiff' => 'image/tiff',
|
||||
'tif' => 'image/tiff',
|
||||
'css' => array('text/css', 'text/plain'),
|
||||
'html' => array('text/html', 'text/plain'),
|
||||
'htm' => array('text/html', 'text/plain'),
|
||||
'shtml' => array('text/html', 'text/plain'),
|
||||
'txt' => 'text/plain',
|
||||
'text' => 'text/plain',
|
||||
'log' => array('text/plain', 'text/x-log'),
|
||||
'rtx' => 'text/richtext',
|
||||
'rtf' => 'text/rtf',
|
||||
'xml' => array('application/xml', 'text/xml', 'text/plain'),
|
||||
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
|
||||
'dot' => array('application/msword', 'application/vnd.ms-office'),
|
||||
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
|
||||
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
|
||||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
|
||||
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
|
||||
'p12' => 'application/x-pkcs12',
|
||||
'p7a' => 'application/x-pkcs7-signature',
|
||||
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
|
||||
'p7r' => 'application/x-pkcs7-certreqresp',
|
||||
'p7s' => 'application/pkcs7-signature',
|
||||
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
|
||||
'crl' => array('application/pkix-crl', 'application/pkcs-crl'),
|
||||
'der' => 'application/x-x509-ca-cert',
|
||||
'kdb' => 'application/octet-stream',
|
||||
'pgp' => 'application/pgp',
|
||||
'gpg' => 'application/gpg-keys',
|
||||
'sst' => 'application/octet-stream',
|
||||
'csr' => 'application/octet-stream',
|
||||
'rsa' => 'application/x-pkcs7',
|
||||
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
|
||||
'3g2' => 'video/3gpp2',
|
||||
'3gp' => array('video/3gp', 'video/3gpp'),
|
||||
'mp4' => 'video/mp4',
|
||||
'm4a' => 'audio/x-m4a',
|
||||
'f4v' => array('video/mp4', 'video/x-f4v'),
|
||||
'flv' => 'video/x-flv',
|
||||
'webm' => 'video/webm',
|
||||
'aac' => array('audio/x-aac', 'audio/aac'),
|
||||
'm4u' => 'application/vnd.mpegurl',
|
||||
'm3u' => 'text/plain',
|
||||
'xspf' => 'application/xspf+xml',
|
||||
'vlc' => 'application/videolan',
|
||||
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
|
||||
'au' => 'audio/x-au',
|
||||
'ac3' => 'audio/ac3',
|
||||
'flac' => 'audio/x-flac',
|
||||
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
|
||||
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
|
||||
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
|
||||
'ics' => 'text/calendar',
|
||||
'ical' => 'text/calendar',
|
||||
'zsh' => 'text/x-scriptzsh',
|
||||
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
|
||||
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
|
||||
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
|
||||
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
|
||||
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
|
||||
'vcf' => 'text/x-vcard',
|
||||
'srt' => array('text/srt', 'text/plain'),
|
||||
'vtt' => array('text/vtt', 'text/plain'),
|
||||
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
|
||||
'odc' => 'application/vnd.oasis.opendocument.chart',
|
||||
'otc' => 'application/vnd.oasis.opendocument.chart-template',
|
||||
'odf' => 'application/vnd.oasis.opendocument.formula',
|
||||
'otf' => 'application/vnd.oasis.opendocument.formula-template',
|
||||
'odg' => 'application/vnd.oasis.opendocument.graphics',
|
||||
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
|
||||
'odi' => 'application/vnd.oasis.opendocument.image',
|
||||
'oti' => 'application/vnd.oasis.opendocument.image-template',
|
||||
'odp' => 'application/vnd.oasis.opendocument.presentation',
|
||||
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
|
||||
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
||||
'odt' => 'application/vnd.oasis.opendocument.text',
|
||||
'odm' => 'application/vnd.oasis.opendocument.text-master',
|
||||
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
||||
'oth' => 'application/vnd.oasis.opendocument.text-web'
|
||||
);
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Profiler Sections
|
||||
| -------------------------------------------------------------------------
|
||||
| This file lets you determine whether or not various sections of Profiler
|
||||
| data are displayed when the Profiler is enabled.
|
||||
| Please see the user guide for info:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/profiling.html
|
||||
|
|
||||
*/
|
||||
@@ -0,0 +1,449 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP protocol
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to force the use of HTTPS for REST API calls
|
||||
|
|
||||
*/
|
||||
$config['force_https'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default format of the response
|
||||
|
|
||||
| 'array': Array data structure
|
||||
| 'csv': Comma separated file
|
||||
| 'json': Uses json_encode(). Note: If a GET query string
|
||||
| called 'callback' is passed, then jsonp will be returned
|
||||
| 'html' HTML using the table library in CodeIgniter
|
||||
| 'php': Uses var_export()
|
||||
| 'serialized': Uses serialize()
|
||||
| 'xml': Uses simplexml_load_string()
|
||||
|
|
||||
*/
|
||||
$config['rest_default_format'] = 'json';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Status Field Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The field name for the status inside the response
|
||||
|
|
||||
*/
|
||||
$config['rest_status_field_name'] = 'status';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Message Field Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The field name for the message inside the response
|
||||
|
|
||||
*/
|
||||
$config['rest_message_field_name'] = 'error';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable Emulate Request
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Should we enable emulation of the request (e.g. used in Mootools request)
|
||||
|
|
||||
*/
|
||||
$config['enable_emulate_request'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Realm
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Name of the password protected REST API displayed on login dialogs
|
||||
|
|
||||
| e.g: My Secret REST API
|
||||
|
|
||||
*/
|
||||
$config['rest_realm'] = 'REST API';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to specify the REST API requires to be logged in
|
||||
|
|
||||
| FALSE No login required
|
||||
| 'basic' Unsecure login
|
||||
| 'digest' More secure login
|
||||
| 'session' Check for a PHP session variable. See 'auth_source' to set the
|
||||
| authorization key
|
||||
|
|
||||
*/
|
||||
$config['rest_auth'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login Source
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Is login required and if so, the user store to use
|
||||
|
|
||||
| '' Use config based users or wildcard testing
|
||||
| 'ldap' Use LDAP authentication
|
||||
| 'library' Use a authentication library
|
||||
|
|
||||
| Note: If 'rest_auth' is set to 'session' then change 'auth_source' to the name of the session variable
|
||||
|
|
||||
*/
|
||||
$config['auth_source'] = 'ldap';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login Class and Function
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If library authentication is used define the class and function name
|
||||
|
|
||||
| The function should accept two parameters: class->function($username, $password)
|
||||
| In other cases override the function _perform_library_auth in your controller
|
||||
|
|
||||
| For digest authentication the library function should return already a stored
|
||||
| md5(username:restrealm:password) for that username
|
||||
|
|
||||
| e.g: md5('admin:REST API:1234') = '1e957ebc35631ab22d5bd6526bd14ea2'
|
||||
|
|
||||
*/
|
||||
$config['auth_library_class'] = '';
|
||||
$config['auth_library_function'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Override auth types for specific class/method
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set specific authentication types for methods within a class (controller)
|
||||
|
|
||||
| Set as many config entries as needed. Any methods not set will use the default 'rest_auth' config value.
|
||||
|
|
||||
| e.g:
|
||||
|
|
||||
| $config['auth_override_class_method']['deals']['view'] = 'none';
|
||||
| $config['auth_override_class_method']['deals']['insert'] = 'digest';
|
||||
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
|
||||
| $config['auth_override_class_method']['dashboard']['*'] = 'none|digest|basic';
|
||||
|
|
||||
| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within. An asterisk may also be used to specify an authentication method for an entire classes methods. Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end of the method name)
|
||||
| Acceptable values are; 'none', 'digest' and 'basic'.
|
||||
|
|
||||
*/
|
||||
// $config['auth_override_class_method']['deals']['view'] = 'none';
|
||||
// $config['auth_override_class_method']['deals']['insert'] = 'digest';
|
||||
// $config['auth_override_class_method']['accounts']['user'] = 'basic';
|
||||
// $config['auth_override_class_method']['dashboard']['*'] = 'basic';
|
||||
|
||||
|
||||
// ---Uncomment list line for the wildard unit test
|
||||
// $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login Usernames
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Array of usernames and passwords for login, if ldap is configured this is ignored
|
||||
|
|
||||
*/
|
||||
$config['rest_valid_logins'] = ['admin' => '1234'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global IP Whitelisting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Limit connections to your REST server to whitelisted IP addresses
|
||||
|
|
||||
| Usage:
|
||||
| 1. Set to TRUE and select an auth option for extreme security (client's IP
|
||||
| address must be in whitelist and they must also log in)
|
||||
| 2. Set to TRUE with auth set to FALSE to allow whitelisted IPs access with no login
|
||||
| 3. Set to FALSE but set 'auth_override_class_method' to 'whitelist' to
|
||||
| restrict certain methods to IPs in your whitelist
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_whitelist_enabled'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST IP Whitelist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Limit connections to your REST server with a comma separated
|
||||
| list of IP addresses
|
||||
|
|
||||
| e.g: '123.456.789.0, 987.654.32.1'
|
||||
|
|
||||
| 127.0.0.1 and 0.0.0.0 are allowed by default
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_whitelist'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global IP Blacklisting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Prevent connections to the REST server from blacklisted IP addresses
|
||||
|
|
||||
| Usage:
|
||||
| 1. Set to TRUE and add any IP address to 'rest_ip_blacklist'
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_blacklist_enabled'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST IP Blacklist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Prevent connections from the following IP addresses
|
||||
|
|
||||
| e.g: '123.456.789.0, 987.654.32.1'
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_blacklist'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Database Group
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Connect to a database group for keys, logging, etc. It will only connect
|
||||
| if you have any of these features enabled
|
||||
|
|
||||
*/
|
||||
$config['rest_database_group'] = 'default';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Keys Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The table name in your database that stores API keys
|
||||
|
|
||||
*/
|
||||
$config['rest_keys_table'] = 'keys';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API will look for a column name called 'key'.
|
||||
| If no key is provided, the request will result in an error. To override the
|
||||
| column name see 'rest_key_column'
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `keys` (
|
||||
| `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
| `key` VARCHAR(40) NOT NULL,
|
||||
| `level` INT(2) NOT NULL,
|
||||
| `ignore_limits` TINY(1) NOT NULL DEFAULT '0',
|
||||
| `is_private_key` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
| `ip_addresses` TEXT NULL DEFAULT NULL,
|
||||
| `date_created` INT(11) NOT NULL,
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_keys'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Table Key Column Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_keys', specify the
|
||||
| column name to match e.g. my_key
|
||||
|
|
||||
*/
|
||||
$config['rest_key_column'] = 'key';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Key Length
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Length of the created keys. Check your default database schema on the
|
||||
| maximum length allowed
|
||||
|
|
||||
| Note: The maximum length is 40
|
||||
|
|
||||
*/
|
||||
$config['rest_key_length'] = 40;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Key Variable
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Custom header to specify the API key
|
||||
|
||||
| Note: Custom headers with the X- prefix are deprecated as of
|
||||
| 2012/06/12. See RFC 6648 specification for more details
|
||||
|
|
||||
*/
|
||||
$config['rest_key_name'] = 'X-API-KEY';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Logging
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API will log actions based on the column names 'key', 'date',
|
||||
| 'time' and 'ip_address'. This is a general rule that can be overridden in the
|
||||
| $this->method array for each controller
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `logs` (
|
||||
| `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
| `uri` VARCHAR(255) NOT NULL,
|
||||
| `method` VARCHAR(6) NOT NULL,
|
||||
| `params` TEXT DEFAULT NULL,
|
||||
| `api_key` VARCHAR(40) NOT NULL,
|
||||
| `ip_address` VARCHAR(45) NOT NULL,
|
||||
| `time` INT(11) NOT NULL,
|
||||
| `rtime` FLOAT DEFAULT NULL,
|
||||
| `authorized` VARCHAR(1) NOT NULL,
|
||||
| `response_code` SMALLINT(3) NOT NULL,
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_logging'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Logs Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_logging', specify the
|
||||
| table name to match e.g. my_logs
|
||||
|
|
||||
*/
|
||||
$config['rest_logs_table'] = 'logs';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Method Access Control
|
||||
|--------------------------------------------------------------------------
|
||||
| When set to TRUE, the REST API will check the access table to see if
|
||||
| the API key can access that controller. 'rest_enable_keys' must be enabled
|
||||
| to use this
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `access` (
|
||||
| `id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
| `key` VARCHAR(40) NOT NULL DEFAULT '',
|
||||
| `controller` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
| `date_created` DATETIME DEFAULT NULL,
|
||||
| `date_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_access'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Access Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_access', specify the
|
||||
| table name to match e.g. my_access
|
||||
|
|
||||
*/
|
||||
$config['rest_access_table'] = 'access';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Param Log Format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API log parameters will be stored in the database as JSON
|
||||
| Set to FALSE to log as serialized PHP
|
||||
|
|
||||
*/
|
||||
$config['rest_logs_json_params'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Limits
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API will count the number of uses of each method
|
||||
| by an API key each hour. This is a general rule that can be overridden in the
|
||||
| $this->method array in each controller
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `limits` (
|
||||
| `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
| `uri` VARCHAR(255) NOT NULL,
|
||||
| `count` INT(10) NOT NULL,
|
||||
| `hour_started` INT(11) NOT NULL,
|
||||
| `api_key` VARCHAR(40) NOT NULL,
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
||||
| To specify the limits within the controller's __construct() method, add per-method
|
||||
| limits with:
|
||||
|
|
||||
| $this->method['METHOD_NAME']['limit'] = [NUM_REQUESTS_PER_HOUR];
|
||||
|
|
||||
| See application/controllers/api/example.php for examples
|
||||
*/
|
||||
$config['rest_enable_limits'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Limits Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_limits', specify the
|
||||
| table name to match e.g. my_limits
|
||||
|
|
||||
*/
|
||||
$config['rest_limits_table'] = 'limits';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Ignore HTTP Accept
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to TRUE to ignore the HTTP Accept and speed up each request a little.
|
||||
| Only do this if you are using the $this->rest_format or /format/xml in URLs
|
||||
|
|
||||
*/
|
||||
$config['rest_ignore_http_accept'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST AJAX Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to TRUE to allow AJAX requests only. Set to FALSE to accept HTTP requests
|
||||
|
|
||||
| Note: If set to TRUE and the request is not AJAX, a 505 response with the
|
||||
| error message 'Only AJAX requests are accepted.' will be returned.
|
||||
|
|
||||
| Hint: This is good for production environments
|
||||
|
|
||||
*/
|
||||
$config['rest_ajax_only'] = FALSE;
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| URI ROUTING
|
||||
| -------------------------------------------------------------------------
|
||||
| This file lets you re-map URI requests to specific controller functions.
|
||||
|
|
||||
| Typically there is a one-to-one relationship between a URL string
|
||||
| and its corresponding controller class/method. The segments in a
|
||||
| URL normally follow this pattern:
|
||||
|
|
||||
| example.com/class/method/id/
|
||||
|
|
||||
| In some instances, however, you may want to remap this relationship
|
||||
| so that a different class/function is called than the one
|
||||
| corresponding to the URL.
|
||||
|
|
||||
| Please see the user guide for complete details:
|
||||
|
|
||||
| https://codeigniter.com/user_guide/general/routing.html
|
||||
|
|
||||
| -------------------------------------------------------------------------
|
||||
| RESERVED ROUTES
|
||||
| -------------------------------------------------------------------------
|
||||
|
|
||||
| There are three reserved routes:
|
||||
|
|
||||
| $route['default_controller'] = 'welcome';
|
||||
|
|
||||
| This route indicates which controller class should be loaded if the
|
||||
| URI contains no data. In the above example, the "welcome" class
|
||||
| would be loaded.
|
||||
|
|
||||
| $route['404_override'] = 'errors/page_missing';
|
||||
|
|
||||
| This route will tell the Router which controller/method to use if those
|
||||
| provided in the URL cannot be matched to a valid route.
|
||||
|
|
||||
| $route['translate_uri_dashes'] = FALSE;
|
||||
|
|
||||
| This is not exactly a route, but allows you to automatically route
|
||||
| controller and method names that contain dashes. '-' isn't a valid
|
||||
| class or method name character, so it requires translation.
|
||||
| When you set this option to TRUE, it will replace ALL dashes in the
|
||||
| controller and method URI segments.
|
||||
|
|
||||
| Examples: my-controller/index -> my_controller/index
|
||||
| my-controller/my-method -> my_controller/my_method
|
||||
*/
|
||||
$route['default_controller'] = 'dashboard';
|
||||
$route['404_override'] = '';
|
||||
$route['translate_uri_dashes'] = FALSE;
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| SMILEYS
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains an array of smileys for use with the emoticon helper.
|
||||
| Individual images can be used to replace multiple smileys. For example:
|
||||
| :-) and :) use the same image replacement.
|
||||
|
|
||||
| Please see user guide for more info:
|
||||
| https://codeigniter.com/user_guide/helpers/smiley_helper.html
|
||||
|
|
||||
*/
|
||||
$smileys = array(
|
||||
|
||||
// smiley image name width height alt
|
||||
|
||||
':-)' => array('grin.gif', '19', '19', 'grin'),
|
||||
':lol:' => array('lol.gif', '19', '19', 'LOL'),
|
||||
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
|
||||
':)' => array('smile.gif', '19', '19', 'smile'),
|
||||
';-)' => array('wink.gif', '19', '19', 'wink'),
|
||||
';)' => array('wink.gif', '19', '19', 'wink'),
|
||||
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
|
||||
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
|
||||
':-S' => array('confused.gif', '19', '19', 'confused'),
|
||||
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
|
||||
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
|
||||
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
|
||||
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
|
||||
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
|
||||
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
|
||||
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
|
||||
':long:' => array('longface.gif', '19', '19', 'long face'),
|
||||
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
|
||||
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
|
||||
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
|
||||
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
|
||||
':down:' => array('downer.gif', '19', '19', 'downer'),
|
||||
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
|
||||
':sick:' => array('sick.gif', '19', '19', 'sick'),
|
||||
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
|
||||
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
|
||||
'>:(' => array('mad.gif', '19', '19', 'mad'),
|
||||
':mad:' => array('mad.gif', '19', '19', 'mad'),
|
||||
'>:-(' => array('angry.gif', '19', '19', 'angry'),
|
||||
':angry:' => array('angry.gif', '19', '19', 'angry'),
|
||||
':zip:' => array('zip.gif', '19', '19', 'zipper'),
|
||||
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
|
||||
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
|
||||
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
|
||||
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
|
||||
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
|
||||
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
|
||||
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
|
||||
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
|
||||
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
|
||||
':snake:' => array('snake.gif', '19', '19', 'snake'),
|
||||
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
|
||||
':question:' => array('question.gif', '19', '19', 'question')
|
||||
|
||||
);
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| USER AGENT TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains four arrays of user agent data. It is used by the
|
||||
| User Agent Class to help identify browser, platform, robot, and
|
||||
| mobile device data. The array keys are used to identify the device
|
||||
| and the array values are used to set the actual name of the item.
|
||||
*/
|
||||
$platforms = array(
|
||||
'windows nt 10.0' => 'Windows 10',
|
||||
'windows nt 6.3' => 'Windows 8.1',
|
||||
'windows nt 6.2' => 'Windows 8',
|
||||
'windows nt 6.1' => 'Windows 7',
|
||||
'windows nt 6.0' => 'Windows Vista',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 4.0' => 'Windows NT 4.0',
|
||||
'winnt4.0' => 'Windows NT 4.0',
|
||||
'winnt 4.0' => 'Windows NT',
|
||||
'winnt' => 'Windows NT',
|
||||
'windows 98' => 'Windows 98',
|
||||
'win98' => 'Windows 98',
|
||||
'windows 95' => 'Windows 95',
|
||||
'win95' => 'Windows 95',
|
||||
'windows phone' => 'Windows Phone',
|
||||
'windows' => 'Unknown Windows OS',
|
||||
'android' => 'Android',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'iphone' => 'iOS',
|
||||
'ipad' => 'iOS',
|
||||
'ipod' => 'iOS',
|
||||
'os x' => 'Mac OS X',
|
||||
'ppc mac' => 'Power PC Mac',
|
||||
'freebsd' => 'FreeBSD',
|
||||
'ppc' => 'Macintosh',
|
||||
'linux' => 'Linux',
|
||||
'debian' => 'Debian',
|
||||
'sunos' => 'Sun Solaris',
|
||||
'beos' => 'BeOS',
|
||||
'apachebench' => 'ApacheBench',
|
||||
'aix' => 'AIX',
|
||||
'irix' => 'Irix',
|
||||
'osf' => 'DEC OSF',
|
||||
'hp-ux' => 'HP-UX',
|
||||
'netbsd' => 'NetBSD',
|
||||
'bsdi' => 'BSDi',
|
||||
'openbsd' => 'OpenBSD',
|
||||
'gnu' => 'GNU/Linux',
|
||||
'unix' => 'Unknown Unix OS',
|
||||
'symbian' => 'Symbian OS'
|
||||
);
|
||||
|
||||
|
||||
// The order of this array should NOT be changed. Many browsers return
|
||||
// multiple browser types so we want to identify the sub-type first.
|
||||
$browsers = array(
|
||||
'OPR' => 'Opera',
|
||||
'Flock' => 'Flock',
|
||||
'Edge' => 'Edge',
|
||||
'Chrome' => 'Chrome',
|
||||
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||
'Opera.*?Version' => 'Opera',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Trident.* rv' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse',
|
||||
'Maxthon' => 'Maxthon',
|
||||
'Ubuntu' => 'Ubuntu Web Browser'
|
||||
);
|
||||
|
||||
$mobiles = array(
|
||||
// legacy array, old values commented out
|
||||
'mobileexplorer' => 'Mobile Explorer',
|
||||
// 'openwave' => 'Open Wave',
|
||||
// 'opera mini' => 'Opera Mini',
|
||||
// 'operamini' => 'Opera Mini',
|
||||
// 'elaine' => 'Palm',
|
||||
'palmsource' => 'Palm',
|
||||
// 'digital paths' => 'Palm',
|
||||
// 'avantgo' => 'Avantgo',
|
||||
// 'xiino' => 'Xiino',
|
||||
'palmscape' => 'Palmscape',
|
||||
// 'nokia' => 'Nokia',
|
||||
// 'ericsson' => 'Ericsson',
|
||||
// 'blackberry' => 'BlackBerry',
|
||||
// 'motorola' => 'Motorola'
|
||||
|
||||
// Phones and Manufacturers
|
||||
'motorola' => 'Motorola',
|
||||
'nokia' => 'Nokia',
|
||||
'nexus' => 'Nexus',
|
||||
'palm' => 'Palm',
|
||||
'iphone' => 'Apple iPhone',
|
||||
'ipad' => 'iPad',
|
||||
'ipod' => 'Apple iPod Touch',
|
||||
'sony' => 'Sony Ericsson',
|
||||
'ericsson' => 'Sony Ericsson',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'cocoon' => 'O2 Cocoon',
|
||||
'blazer' => 'Treo',
|
||||
'lg' => 'LG',
|
||||
'amoi' => 'Amoi',
|
||||
'xda' => 'XDA',
|
||||
'mda' => 'MDA',
|
||||
'vario' => 'Vario',
|
||||
'htc' => 'HTC',
|
||||
'samsung' => 'Samsung',
|
||||
'sharp' => 'Sharp',
|
||||
'sie-' => 'Siemens',
|
||||
'alcatel' => 'Alcatel',
|
||||
'benq' => 'BenQ',
|
||||
'ipaq' => 'HP iPaq',
|
||||
'mot-' => 'Motorola',
|
||||
'playstation portable' => 'PlayStation Portable',
|
||||
'playstation 3' => 'PlayStation 3',
|
||||
'playstation vita' => 'PlayStation Vita',
|
||||
'hiptop' => 'Danger Hiptop',
|
||||
'nec-' => 'NEC',
|
||||
'panasonic' => 'Panasonic',
|
||||
'philips' => 'Philips',
|
||||
'sagem' => 'Sagem',
|
||||
'sanyo' => 'Sanyo',
|
||||
'spv' => 'SPV',
|
||||
'zte' => 'ZTE',
|
||||
'sendo' => 'Sendo',
|
||||
'nintendo dsi' => 'Nintendo DSi',
|
||||
'nintendo ds' => 'Nintendo DS',
|
||||
'nintendo 3ds' => 'Nintendo 3DS',
|
||||
'wii' => 'Nintendo Wii',
|
||||
'open web' => 'Open Web',
|
||||
'openweb' => 'OpenWeb',
|
||||
'meizu' => 'Meizu',
|
||||
|
||||
// Operating Systems
|
||||
'android' => 'Android',
|
||||
'symbian' => 'Symbian',
|
||||
'SymbianOS' => 'SymbianOS',
|
||||
'elaine' => 'Palm',
|
||||
'series60' => 'Symbian S60',
|
||||
'windows ce' => 'Windows CE',
|
||||
|
||||
// Browsers
|
||||
'obigo' => 'Obigo',
|
||||
'netfront' => 'Netfront Browser',
|
||||
'openwave' => 'Openwave Browser',
|
||||
'mobilexplorer' => 'Mobile Explorer',
|
||||
'operamini' => 'Opera Mini',
|
||||
'opera mini' => 'Opera Mini',
|
||||
'opera mobi' => 'Opera Mobile',
|
||||
'fennec' => 'Firefox Mobile',
|
||||
|
||||
// Other
|
||||
'digital paths' => 'Digital Paths',
|
||||
'avantgo' => 'AvantGo',
|
||||
'xiino' => 'Xiino',
|
||||
'novarra' => 'Novarra Transcoder',
|
||||
'vodafone' => 'Vodafone',
|
||||
'docomo' => 'NTT DoCoMo',
|
||||
'o2' => 'O2',
|
||||
|
||||
// Fallback
|
||||
'mobile' => 'Generic Mobile',
|
||||
'wireless' => 'Generic Mobile',
|
||||
'j2me' => 'Generic Mobile',
|
||||
'midp' => 'Generic Mobile',
|
||||
'cldc' => 'Generic Mobile',
|
||||
'up.link' => 'Generic Mobile',
|
||||
'up.browser' => 'Generic Mobile',
|
||||
'smartphone' => 'Generic Mobile',
|
||||
'cellphone' => 'Generic Mobile'
|
||||
);
|
||||
|
||||
// There are hundreds of bots but these are the most common.
|
||||
$robots = array(
|
||||
'googlebot' => 'Googlebot',
|
||||
'msnbot' => 'MSNBot',
|
||||
'baiduspider' => 'Baiduspider',
|
||||
'bingbot' => 'Bing',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'ask jeeves' => 'Ask Jeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos',
|
||||
'yandex' => 'YandexBot',
|
||||
'mediapartners-google' => 'MediaPartners Google',
|
||||
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
|
||||
'adsbot-google' => 'AdsBot Google',
|
||||
'feedfetcher-google' => 'Feedfetcher Google',
|
||||
'curious george' => 'Curious George',
|
||||
'ia_archiver' => 'Alexa Crawler',
|
||||
'MJ12bot' => 'Majestic-12',
|
||||
'Uptimebot' => 'Uptimebot'
|
||||
);
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class appnotification extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('notification_model', 'notif');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appnotification/index');
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function send()
|
||||
{
|
||||
|
||||
|
||||
$topic = $this->input->post('topic');
|
||||
$title = $this->input->post('title');
|
||||
$message = $this->input->post('message');
|
||||
$this->notif->send_notif($title, $message, $topic);
|
||||
$this->session->set_flashdata('send', 'Notifikasi berhasil dikirim');
|
||||
redirect('appnotification/index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Appsettings extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->library('form_validation');
|
||||
$this->load->model('appsettings_model', 'app');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['appsettings'] = $this->app->getappbyid();
|
||||
$data['transfer'] = $this->app->gettransfer();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function ubahbank($id)
|
||||
{
|
||||
$this->form_validation->set_rules('nama_bank', 'nama_bank', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nama_pemilik', 'nama_pemilik', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('rekening_bank', 'rekening_bank', 'trim|prep_for_form');
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/bank/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '20000';
|
||||
$config['file_name'] = time();
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
$dataget = $this->app->getbankid($id);
|
||||
|
||||
if ($this->upload->do_upload('image_bank')) {
|
||||
if ($dataget['image_bank'] != 'noimage.jpg') {
|
||||
$gambar = $dataget['image_bank'];
|
||||
unlink('./images/bank/' . $gambar);
|
||||
}
|
||||
$gambar = $dataget['image_bank'];
|
||||
unlink('./images/bank/' . $gambar);
|
||||
$app_logo = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$app_logo = $dataget['image_bank'];
|
||||
}
|
||||
|
||||
$data = [
|
||||
'nama_bank' => html_escape($this->input->post('nama_bank', TRUE)),
|
||||
'rekening_bank' => html_escape($this->input->post('rekening_bank', TRUE)),
|
||||
'nama_pemilik' => html_escape($this->input->post('nama_pemilik', TRUE)),
|
||||
'status_bank' => html_escape($this->input->post('status_bank', TRUE)),
|
||||
'image_bank' => $app_logo
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
$this->app->ubahdatarekening($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Infomrasi aplikasi berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusbank($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
$dataget = $this->app->getbankid($id);
|
||||
$gambar = $dataget['image_bank'];
|
||||
unlink('./images/bank/' . $gambar);
|
||||
$this->app->hapusrekening($id);
|
||||
$this->session->set_flashdata('ubah', 'Informasi aplikasi berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
}
|
||||
|
||||
public function adddatabank()
|
||||
{
|
||||
$this->form_validation->set_rules('nama_bank', 'nama_bank', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nama_pemilik', 'nama_pemilik', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('rekening_bank', 'rekening_bank', 'trim|prep_for_form');
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/bank/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '10000';
|
||||
$config['file_name'] = time();
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('image_bank')) {
|
||||
$app_logo = html_escape($this->upload->data('file_name'));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'nama_bank' => html_escape($this->input->post('nama_bank', TRUE)),
|
||||
'nama_pemilik' => html_escape($this->input->post('nama_pemilik', TRUE)),
|
||||
'rekening_bank' => html_escape($this->input->post('rekening_bank', TRUE)),
|
||||
'status_bank' => html_escape($this->input->post('status_bank', TRUE)),
|
||||
'image_bank' => $app_logo
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
$this->app->adddatarekening($data);
|
||||
$this->session->set_flashdata('ubah', 'Informasi aplikasi berhasil diubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahapp()
|
||||
{
|
||||
|
||||
|
||||
$this->form_validation->set_rules('app_email', 'app_email', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('app_website', 'app_website', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('app_linkgoogle', 'app_linkgoogle', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('app_currency', 'app_currency', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './asset/images/icon/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '10000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
$data = $this->app->getappbyid();
|
||||
|
||||
|
||||
if ($this->upload->do_upload('app_logo')) {
|
||||
if ($data['app_logo'] != 'noimage.jpg') {
|
||||
$gambar = $data['app_logo'];
|
||||
unlink('asset/images/icon/' . $gambar);
|
||||
}
|
||||
|
||||
$app_logo = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$app_logo = $data['app_logo'];
|
||||
}
|
||||
|
||||
$data = [
|
||||
'app_logo' => $app_logo,
|
||||
'app_email' => html_escape($this->input->post('app_email', TRUE)),
|
||||
'app_website' => html_escape($this->input->post('app_website', TRUE)),
|
||||
'app_privacy_policy' => $this->input->post('app_privacy_policy', TRUE),
|
||||
'app_aboutus' => $this->input->post('app_aboutus', TRUE),
|
||||
'app_address' => $this->input->post('app_address'),
|
||||
'app_linkgoogle' => html_escape($this->input->post('app_linkgoogle', TRUE)),
|
||||
'app_name' => html_escape($this->input->post('app_name', TRUE)),
|
||||
'app_contact' => html_escape($this->input->post('app_contact', TRUE)),
|
||||
'app_currency' => html_escape($this->input->post('app_currency', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
$this->app->ubahdataappsettings($data);
|
||||
$this->session->set_flashdata('ubah', 'Informasi aplikasi berhasil diubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['appsettings'] = $this->app->getappbyid();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahemail()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('email_subject', 'email_subject', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('email_subject_confirm', 'email_subject', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'email_subject' => html_escape($this->input->post('email_subject', TRUE)),
|
||||
'email_subject_confirm' => html_escape($this->input->post('email_subject_confirm', TRUE)),
|
||||
'email_text1' => $this->input->post('email_text1'),
|
||||
'email_text2' => $this->input->post('email_text2'),
|
||||
'email_text3' => $this->input->post('email_text3'),
|
||||
'email_text4' => $this->input->post('email_text4')
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
$this->app->ubahdataemail($data);
|
||||
$this->session->set_flashdata('ubah', 'Email berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['appsettings'] = $this->app->getappbyid();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahsmtp()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('smtp_host', 'smtp_host', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('smtp_port', 'smtp_port', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('smtp_username', 'smtp_username', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('smtp_password', 'smtp_password', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('smtp_form', 'smtp_form', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('smtp_secure', 'smtp_secure', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'smtp_host' => html_escape($this->input->post('smtp_host', TRUE)),
|
||||
'smtp_port' => html_escape($this->input->post('smtp_port', TRUE)),
|
||||
'smtp_username' => html_escape($this->input->post('smtp_username', TRUE)),
|
||||
'smtp_password' => html_escape($this->input->post('smtp_password', TRUE)),
|
||||
'smtp_from' => html_escape($this->input->post('smtp_from', TRUE)),
|
||||
'smtp_secure' => html_escape($this->input->post('smtp_secure', TRUE))
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
$this->app->ubahdatasmtp($data);
|
||||
$this->session->set_flashdata('ubah', 'SMTP Berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['appsettings'] = $this->app->getappbyid();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahmobilepulsa()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('mobilepulsa_username', 'mobilepulsa_username', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('mobilepulsa_harga', 'mobilepulsa_harga', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('mobilepulsa_api_key', 'mobilepulsa_api_key', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('mp_status', 'mp_status', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('mp_active', 'mp_active', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'mobilepulsa_username' => html_escape($this->input->post('mobilepulsa_username', TRUE)),
|
||||
'mobilepulsa_harga' => html_escape($this->input->post('mobilepulsa_harga', TRUE)),
|
||||
'mobilepulsa_api_key' => html_escape($this->input->post('mobilepulsa_api_key', TRUE)),
|
||||
'mp_status' => html_escape($this->input->post('mp_status', TRUE)),
|
||||
'mp_active' => html_escape($this->input->post('mp_active', TRUE))
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
|
||||
$this->app->ubahdatamobilepulsa($data);
|
||||
$this->session->set_flashdata('ubah', 'Mobile pulsa berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['appsettings'] = $this->app->getappbyid();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahayopesan()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('api_password', 'api_password', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('harga_pulsa', 'harga_pulsa', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('api_token', 'api_token', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'api_password' => html_escape($this->input->post('api_password', TRUE)),
|
||||
'harga_pulsa' => html_escape($this->input->post('harga_pulsa', TRUE)),
|
||||
'api_token' => html_escape($this->input->post('api_token', TRUE))
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
|
||||
$this->app->ubahdataayopesan($data);
|
||||
$this->session->set_flashdata('ubah', 'api berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['appsettings'] = $this->app->getappbyid();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function addbank()
|
||||
|
||||
{
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/addbank');
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function editbank($id)
|
||||
|
||||
{
|
||||
$data['transfer'] = $this->app->getbankid($id);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('appsettings/editbank', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function ubahxendit()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'api_keyxendit' => html_escape($this->input->post('api_keyxendit', TRUE)),
|
||||
'apikey_server' => html_escape($this->input->post('apikey_server', TRUE))
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
|
||||
redirect('appsettings/index');
|
||||
} else {
|
||||
|
||||
$this->app->ubahxendit($data);
|
||||
$this->session->set_flashdata('ubah', 'Data Berhasil di ubah');
|
||||
redirect('appsettings');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Categorymerchant extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
$this->load->model('categorymerchant_model', 'cm');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['catmer'] = $this->cm->getallcm();
|
||||
$data['fitur'] = $this->cm->getfiturmerchant();
|
||||
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('categorymerchant/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function tambahcm()
|
||||
{
|
||||
|
||||
|
||||
$this->form_validation->set_rules('nama_kategori', 'nama_kategori', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$data = [
|
||||
'nama_kategori' => html_escape($this->input->post('nama_kategori', TRUE)),
|
||||
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
|
||||
'status_kategori' => html_escape($this->input->post('status_kategori', TRUE)),
|
||||
];
|
||||
$this->cm->tambahcm($data);
|
||||
$this->session->set_flashdata('tambah', 'Category Merchant Has Been Added');
|
||||
redirect('categorymerchant');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus($id)
|
||||
{
|
||||
$this->cm->hapuscm($id);
|
||||
$this->session->set_flashdata('hapus', 'Category Merchant Has Been Deleted');
|
||||
redirect('categorymerchant');
|
||||
}
|
||||
|
||||
|
||||
public function ubahcm()
|
||||
{
|
||||
|
||||
|
||||
$this->form_validation->set_rules('nama_kategori', 'nama_kategori', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('id_fitur', 'id_fitur', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status_kategori', 'status_kategori', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$id = $this->input->post('id_kategori_merchant');
|
||||
$data = [
|
||||
'nama_kategori' => html_escape($this->input->post('nama_kategori', TRUE)),
|
||||
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
|
||||
'status_kategori' => html_escape($this->input->post('status_kategori', TRUE)),
|
||||
];
|
||||
|
||||
$this->cm->ubahcm($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Category Merchant Has Been Updated');
|
||||
redirect('categorymerchant');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Dashboard extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ($this->session->userdata('user_name') == NULL && $this->session->userdata('password') == NULL) {
|
||||
redirect(base_url() . "login");
|
||||
}
|
||||
$this->load->model('Appsettings_model', 'app');
|
||||
$this->load->model('Dashboard_model', 'dashboard');
|
||||
$this->load->model('users_model', 'user');
|
||||
$this->load->model('driver_model', 'driver');
|
||||
$this->load->model('notification_model', 'notif');
|
||||
// $this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['jan1'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 1);
|
||||
$data['feb1'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 1);
|
||||
$data['mar1'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 1);
|
||||
$data['apr1'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 1);
|
||||
$data['mei1'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 1);
|
||||
$data['jun1'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 1);
|
||||
$data['jul1'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 1);
|
||||
$data['aug1'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 1);
|
||||
$data['sep1'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 1);
|
||||
$data['okt1'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 1);
|
||||
$data['nov1'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 1);
|
||||
$data['des1'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 1);
|
||||
|
||||
$data['jan2'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 2);
|
||||
$data['feb2'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 2);
|
||||
$data['mar2'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 2);
|
||||
$data['apr2'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 2);
|
||||
$data['mei2'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 2);
|
||||
$data['jun2'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 2);
|
||||
$data['jul2'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 2);
|
||||
$data['aug2'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 2);
|
||||
$data['sep2'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 2);
|
||||
$data['okt2'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 2);
|
||||
$data['nov2'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 2);
|
||||
$data['des2'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 2);
|
||||
|
||||
$data['jan3'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 3);
|
||||
$data['feb3'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 3);
|
||||
$data['mar3'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 3);
|
||||
$data['apr3'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 3);
|
||||
$data['mei3'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 3);
|
||||
$data['jun3'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 3);
|
||||
$data['jul3'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 3);
|
||||
$data['aug3'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 3);
|
||||
$data['sep3'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 3);
|
||||
$data['okt3'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 3);
|
||||
$data['nov3'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 3);
|
||||
$data['des3'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 3);
|
||||
|
||||
$data['jan4'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 4);
|
||||
$data['feb4'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 4);
|
||||
$data['mar4'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 4);
|
||||
$data['apr4'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 4);
|
||||
$data['mei4'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 4);
|
||||
$data['jun4'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 4);
|
||||
$data['jul4'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 4);
|
||||
$data['aug4'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 4);
|
||||
$data['sep4'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 4);
|
||||
$data['okt4'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 4);
|
||||
$data['nov4'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 4);
|
||||
$data['des4'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 4);
|
||||
|
||||
|
||||
$data['harian'] = $this->dashboard->getbydate();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['transaksi'] = $this->dashboard->getAlltransaksi();
|
||||
$data['transaksi1'] = $this->dashboard->getAlltransaksi1();
|
||||
$data['transaksi3'] = $this->dashboard->getAlltransaksi3();
|
||||
$data['transaksi_sukses'] = $this->dashboard->getSuksestransaksi();
|
||||
$data['transaksi_sukses1'] = $this->dashboard->getSuksestransaksi1();
|
||||
$data['transaksi_sukses3'] = $this->dashboard->getSuksestransaksi3();
|
||||
$data['fitur'] = $this->dashboard->getAllfitur();
|
||||
$data['saldo'] = $this->dashboard->getallsaldo();
|
||||
$data['saldo1'] = $this->dashboard->getallsaldo1();
|
||||
$data['saldo3'] = $this->dashboard->getallsaldo3();
|
||||
$data['user'] = $this->user->getallusers();
|
||||
$data['driver'] = $this->driver->getalldriver();
|
||||
$data['mitra0'] = $this->dashboard->countmitra0();
|
||||
$data['mitra'] = $this->dashboard->countmitra();
|
||||
$data['mitra3'] = $this->dashboard->countmitra3();
|
||||
$data['hitungdriver0'] = $this->dashboard->countdriver0();
|
||||
$data['hitungdriver'] = $this->dashboard->countdriver();
|
||||
$data['hitungdriver3'] = $this->dashboard->countdriver3();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('dashboard/index', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
|
||||
$data['transaksi'] = $this->dashboard->gettransaksiById($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['transitem'] = $this->dashboard->getitem($id);
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('dashboard/detailtransaction', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function cancletransaction($id)
|
||||
{
|
||||
$dataget = $this->dashboard->gettransaksiById($id);
|
||||
|
||||
$id_driver = $dataget['id_driver'];
|
||||
$id_transaksi = $dataget['id'];
|
||||
$token_user = $dataget['token'];
|
||||
$token_driver = $dataget['reg_id'];
|
||||
$this->notif->notif_cancel_user($id_driver, $id_transaksi, $token_user);
|
||||
$this->notif->notif_cancel_driver($id_transaksi, $token_driver);
|
||||
$this->dashboard->ubahstatustransaksibyid($id);
|
||||
$this->dashboard->ubahstatusdriverbyid($id_driver);
|
||||
$this->session->set_flashdata('cancel', 'Transaction Has Been Cancel');
|
||||
redirect('dashboard/index');
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('transaction/index');
|
||||
} else {
|
||||
$this->dashboard->deletetransaksi($id);
|
||||
$this->session->set_flashdata('hapus', 'Transaction Has Been Delete ');
|
||||
redirect('transaction/index');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Driver extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
|
||||
is_logged_in();
|
||||
$this->load->model('driver_model', 'driver');
|
||||
$this->load->model('appsettings_model', 'app');
|
||||
$this->load->model('Pelanggan_model');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->library('upload');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['driver'] = $this->driver->getalldriver();
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function tracking_driver()
|
||||
{
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/tracking_driver');
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$data['driver'] = $this->driver->getdriverbyid($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->driver->countorder($id);
|
||||
$data['transaksi'] = $this->driver->transaksi($id);
|
||||
$data['wallet'] = $this->driver->wallet($id);
|
||||
$data['driverjob'] = $this->driver->driverjob();
|
||||
$data['partner_region'] = $this->driver->partner_region();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function ubahid()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('nama_driver', 'nama_driver', 'trim|prep_for_form');
|
||||
|
||||
$this->form_validation->set_rules('email', 'email', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('tempat_lahir', 'tempat_lahir', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('tgl_lahir', 'tgl_lahir', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('gender', 'gender', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('alamat_driver', 'alamat_driver', 'trim|prep_for_form');
|
||||
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$phone = html_escape($this->input->post('phone', TRUE));
|
||||
$countrycode = html_escape($this->input->post('countrycode', TRUE));
|
||||
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'nama_driver' => html_escape($this->input->post('nama_driver', TRUE)),
|
||||
'email' => html_escape($this->input->post('email', TRUE)),
|
||||
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
|
||||
'phone' => html_escape($this->input->post('phone', TRUE)),
|
||||
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
|
||||
'tempat_lahir' => html_escape($this->input->post('tempat_lahir', TRUE)),
|
||||
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE)),
|
||||
'gender' => html_escape($this->input->post('gender', TRUE)),
|
||||
'alamat_driver' => html_escape($this->input->post('alamat_driver', TRUE))
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/detail/' . $this->input->post('id', TRUE));
|
||||
} else {
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
$this->driver->ubahdataid($data);
|
||||
$this->session->set_flashdata('ubah', 'Driver ID Has Been Changed');
|
||||
redirect('driver/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['driver'] = $this->driver->getdriverbyid($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->driver->countorder($id);
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahkendaraan()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('jenis', 'jenis', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('merek', 'merek', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('tipe', 'tipe', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nomor_kendaraan', 'nomor_kendaraan', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('warna', 'warna', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('wilayah', 'wilayah', 'trim|prep_for_form');
|
||||
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
|
||||
'id_k' => html_escape($this->input->post('id_k', TRUE)),
|
||||
'jenis' => html_escape($this->input->post('jenis', TRUE)),
|
||||
'merek' => html_escape($this->input->post('merek', TRUE)),
|
||||
'tipe' => html_escape($this->input->post('tipe', TRUE)),
|
||||
'nomor_kendaraan' => html_escape($this->input->post('nomor_kendaraan', TRUE)),
|
||||
'warna' => html_escape($this->input->post('warna', TRUE))
|
||||
];
|
||||
|
||||
$data2 = [
|
||||
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'job' => html_escape($this->input->post('jenis', TRUE)),
|
||||
|
||||
];
|
||||
|
||||
$data3 = [
|
||||
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'wilayah' => html_escape($this->input->post('driverregion', TRUE)),
|
||||
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/detail/' . $this->input->post('id', TRUE));
|
||||
} else {
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
$this->driver->ubahdatakendaraan($data, $data2, $data3);
|
||||
$this->session->set_flashdata('ubah', 'Driver Vechile Has Been Changed');
|
||||
redirect('driver/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['driver'] = $this->driver->getdriverbyid($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->driver->countorder($id);
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahfoto()
|
||||
{
|
||||
|
||||
@$_FILES['foto']['name'];
|
||||
|
||||
if ($_FILES != NULL) {
|
||||
|
||||
$config['upload_path'] = './images/fotodriver/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
$this->upload->do_upload('foto');
|
||||
|
||||
$id = $id = html_escape($this->input->post('id', TRUE));
|
||||
$data = $this->driver->getdriverbyid($id);
|
||||
|
||||
|
||||
if ($this->upload->do_upload('foto')) {
|
||||
if ($data['foto'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto'];
|
||||
unlink('images/fotodriver/' . $gambar);
|
||||
}
|
||||
|
||||
$foto = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto = $data['foto'];
|
||||
}
|
||||
|
||||
$data = [
|
||||
'foto' => $foto,
|
||||
'id' => html_escape($this->input->post('id', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/detail/' . $id);
|
||||
} else {
|
||||
$this->driver->ubahdatafoto($data);
|
||||
$this->session->set_flashdata('ubah', 'Driver Picture Has Been Changed');
|
||||
redirect('driver/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
|
||||
$data['driver'] = $this->driver->getdriverbyid($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->driver->countorder($id);
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahpassword()
|
||||
{
|
||||
|
||||
|
||||
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->input->post('password');
|
||||
$dataencrypt = sha1($data);
|
||||
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'password' => $dataencrypt
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/detail/' . $id);
|
||||
} else {
|
||||
|
||||
$this->driver->ubahdatapassword($data);
|
||||
$this->session->set_flashdata('ubah', 'Driver Password Has Been Changed');
|
||||
redirect('driver/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
$data['driver'] = $this->driver->getdriverbyid($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->driver->countorder($id);
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function block($id)
|
||||
{
|
||||
$this->driver->blockdriverbyid($id);
|
||||
redirect('driver');
|
||||
}
|
||||
|
||||
public function unblock($id)
|
||||
{
|
||||
$this->driver->unblockdriverbyid($id);
|
||||
redirect('driver');
|
||||
}
|
||||
|
||||
public function ubahcard()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('no_ktp', 'no_ktp', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('id_sim', 'id_sim', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('exp_stnk', 'exp_stnk', 'trim|prep_for_form');
|
||||
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
$data = $this->driver->getdriverbyid($id);
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (@$_FILES['foto_ktp']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/ktp';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_ktp')) {
|
||||
if ($data['foto_ktp'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto_ktp'];
|
||||
unlink('images/fotoberkas/ktp/' . $gambar);
|
||||
}
|
||||
|
||||
$foto_ktp = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto_ktp = $data['foto_ktp'];
|
||||
}
|
||||
}
|
||||
if (@$_FILES['foto_sim']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/sim';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_sim')) {
|
||||
if ($data['foto_sim'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto_sim'];
|
||||
unlink('images/fotoberkas/sim/' . $gambar);
|
||||
}
|
||||
|
||||
$foto_sim = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto_sim = $data['foto_sim'];
|
||||
}
|
||||
}
|
||||
if (@$_FILES['foto_stnk']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/stnk';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_stnk')) {
|
||||
if ($data['foto_stnk'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto_stnk'];
|
||||
unlink('images/fotoberkas/stnk/' . $gambar);
|
||||
}
|
||||
|
||||
$foto_stnk = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto_stnk = $data['foto_stnk'];
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'foto_ktp' => $foto_ktp,
|
||||
'foto_sim' => $foto_sim,
|
||||
'foto_stnk' => $foto_stnk,
|
||||
'id_sim' => html_escape($this->input->post('id_sim', TRUE)),
|
||||
'exp_stnk' => html_escape($this->input->post('exp_stnk', TRUE)),
|
||||
'id' => html_escape($this->input->post('id', TRUE))
|
||||
];
|
||||
|
||||
$data2 = [
|
||||
'no_ktp' => html_escape($this->input->post('no_ktp', TRUE)),
|
||||
'id' => html_escape($this->input->post('id', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/detail/' . $id);
|
||||
} else {
|
||||
$this->driver->ubahdatacard($data, $data2);
|
||||
$this->session->set_flashdata('ubah', 'Driver Licence Has Been Changed');
|
||||
redirect('driver/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
$data['driver'] = $this->driver->getdriverbyid($id);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->driver->countorder($id);
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/index');
|
||||
} else {
|
||||
$data = $this->driver->getdriverbyid($id);
|
||||
$gambar = $data['foto'];
|
||||
$gambarsim = $data['foto_sim'];
|
||||
$gambarktp = $data['foto_ktp'];
|
||||
$gambarstnk = $data['foto_stnk'];
|
||||
unlink('images/fotodriver/' . $gambar);
|
||||
unlink('images/fotoberkas/ktp/' . $gambarktp);
|
||||
unlink('images/fotoberkas/sim/' . $gambarsim);
|
||||
unlink('images/fotoberkas/stnk/' . $gambarstnk);
|
||||
$this->session->set_flashdata('hapus', 'Driver Has Been Deleted');
|
||||
$this->driver->hapusdriverbyid($id);
|
||||
|
||||
redirect('driver');
|
||||
}
|
||||
}
|
||||
|
||||
public function tambah()
|
||||
{
|
||||
|
||||
$phone = html_escape($this->input->post('phone', TRUE));
|
||||
$email = html_escape($this->input->post('email', TRUE));
|
||||
|
||||
// $check_exist = $this->Pelanggan_model->check_exist($email, $phone);
|
||||
// $check_exist_phone = $this->Pelanggan_model->check_exist_phone($phone);
|
||||
// $check_exist_email = $this->Pelanggan_model->check_exist_email($email);
|
||||
// if ($check_exist) {
|
||||
|
||||
// $this->session->set_flashdata('invalid', 'phone or email has been used');
|
||||
// redirect('users/tambah');
|
||||
// } else if ($check_exist_phone) {
|
||||
|
||||
// $this->session->set_flashdata('invalid', 'phone has been used');
|
||||
// redirect('users/tambah');
|
||||
// } else if ($check_exist_email) {
|
||||
|
||||
// $this->session->set_flashdata('invalid', 'email has been used');
|
||||
// redirect('users/tambah');
|
||||
// } else {
|
||||
|
||||
$this->form_validation->set_rules('nama_driver', 'nama_driver', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('phone', 'Phone', 'trim|prep_for_form|is_unique[driver.phone]');
|
||||
$this->form_validation->set_rules('email', 'Email', 'trim|prep_for_form|is_unique[driver.email]');
|
||||
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
if (@$_FILES['foto']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotodriver/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto')) {
|
||||
|
||||
$foto = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto = 'noimage.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
if (@$_FILES['foto_sim']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/sim';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_sim')) {
|
||||
|
||||
$fotosim = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$fotosim = 'noimage.jpg';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
if (@$_FILES['foto_ktp']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/ktp';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_ktp')) {
|
||||
|
||||
$fotoktp = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$fotoktp = 'noimage.jpg';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$countrycode = html_escape($this->input->post('countrycode', TRUE));
|
||||
$id = 'D' . time();
|
||||
|
||||
|
||||
$datasignup = [
|
||||
|
||||
'id' => $id,
|
||||
'phone' => html_escape($this->input->post('phone', TRUE)),
|
||||
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
|
||||
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE)),
|
||||
'reg_id' => 'R' . time(),
|
||||
'foto' => $foto,
|
||||
'password' => sha1(time()),
|
||||
'nama_driver' => html_escape($this->input->post('nama_driver', TRUE)),
|
||||
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
|
||||
'email' => html_escape($this->input->post('email', TRUE)),
|
||||
'gender' => html_escape($this->input->post('gender', TRUE)),
|
||||
'alamat_driver' => html_escape($this->input->post('alamat_driver', TRUE)),
|
||||
'job' => html_escape($this->input->post('job', TRUE)),
|
||||
'wilayah' => html_escape($this->input->post('wilayah', TRUE)),
|
||||
'no_ktp' => html_escape($this->input->post('no_ktp', TRUE))
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
$datakendaraan = [
|
||||
|
||||
'merek' => html_escape($this->input->post('merek', TRUE)),
|
||||
'tipe' => html_escape($this->input->post('tipe', TRUE)),
|
||||
'warna' => html_escape($this->input->post('warna', TRUE)),
|
||||
'nomor_kendaraan' => html_escape($this->input->post('nomor_kendaraan', TRUE))
|
||||
|
||||
];
|
||||
|
||||
$databerkas = [
|
||||
|
||||
'id_driver' => $id,
|
||||
'foto_sim' => $fotosim,
|
||||
'foto_ktp' => $fotoktp,
|
||||
'id_sim' => html_escape($this->input->post('id_sim', TRUE))
|
||||
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('driver/tambah');
|
||||
} else {
|
||||
|
||||
$this->driver->signup($datasignup, $datakendaraan, $databerkas);
|
||||
$this->session->set_flashdata('tambah', 'Driver Has Been Added');
|
||||
redirect('newregistration/index');
|
||||
}
|
||||
} else {
|
||||
$data['driverjob'] = $this->driver->driverjob();
|
||||
$data['partner_region'] = $this->driver->partner_region();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('drivers/tambahdriver', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Error404 extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('wallet_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('nodata');
|
||||
}
|
||||
|
||||
public function cron()
|
||||
{
|
||||
$this->wallet_model->updatekadaluarsa();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Login extends CI_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('login_model', 'login');
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
if ($this->session->userdata('user_name') != NULL && $this->session->userdata('password') != NULL) {
|
||||
redirect(base_url("dashboard"));
|
||||
}
|
||||
$this->load->view('login/index');
|
||||
}
|
||||
|
||||
function aksi_login()
|
||||
{
|
||||
|
||||
$nama = html_escape($this->input->post('user_name', TRUE));
|
||||
$acak = html_escape($this->input->post('password', TRUE));
|
||||
$pass = sha1($acak);
|
||||
|
||||
$user = $this->db->get_where('admin', ['user_name' => $nama])->row_array();
|
||||
|
||||
$passDB = $user['password'];
|
||||
|
||||
if ($user) {
|
||||
if ($passDB != $pass) {
|
||||
$this->session->set_flashdata('error', 'Wrong password!');
|
||||
redirect('login');
|
||||
} else {
|
||||
$data = [
|
||||
'id' => $user['id'],
|
||||
'user_name' => $user['user_name'],
|
||||
'password' => $user['password'],
|
||||
'admin_role' => $user['admin_role'],
|
||||
'wilayah' => $user['wilayah'],
|
||||
'status' => $user['status'],
|
||||
'image' => $user['image']
|
||||
];
|
||||
|
||||
$data['menu'] = $this->login->ambil_menu($data);
|
||||
$this->session->set_userdata($data);
|
||||
header('Location: ' . base_url());
|
||||
}
|
||||
} else {
|
||||
$this->session->set_flashdata('error', 'Account not registered');
|
||||
redirect('login');
|
||||
}
|
||||
}
|
||||
|
||||
function logout()
|
||||
{
|
||||
$this->session->sess_destroy();
|
||||
redirect('login');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,734 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Mitra extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('Pelanggan_model');
|
||||
$this->load->model('mitra_model', 'mitra');
|
||||
$this->load->model('appsettings_model', 'app');
|
||||
$this->load->model('email_model');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->library('upload');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['mitra'] = $this->mitra->getallmitra();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$data['mitra'] = $this->mitra->getmitrabyid($id);
|
||||
$data['item'] = $this->mitra->getitembyid($data['mitra']['id_merchant']);
|
||||
$data['itemk'] = $this->mitra->getitemkbyid($data['mitra']['id_merchant']);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['countorder'] = $this->mitra->countorder($data['mitra']['id_merchant']);
|
||||
$data['wallet'] = $this->mitra->wallet($id);
|
||||
$data['jumlah'] = count($data['item']);
|
||||
$data['merchantk'] = $this->mitra->getmerchantk();
|
||||
$data['transaksi'] = $this->mitra->gettranshistory($data['mitra']['id_merchant']);
|
||||
$data['fitur'] = $this->mitra->get_fitur_merchant();
|
||||
$data['partner_region'] = $this->mitra->partner_region();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function block($id)
|
||||
{
|
||||
$this->mitra->blockmitrabyid($id);
|
||||
redirect('mitra');
|
||||
}
|
||||
|
||||
public function unblock($id)
|
||||
{
|
||||
$this->mitra->unblockmitrabyid($id);
|
||||
redirect('mitra');
|
||||
}
|
||||
|
||||
public function tambahitem()
|
||||
{
|
||||
$this->form_validation->set_rules('nama_item', 'nama_item', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('harga_item', 'harga_item', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('deskripsi_item', 'deskripsi_item', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
if (@$_FILES['foto_item']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/itemmerchant';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_item')) {
|
||||
|
||||
$fotoitem = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$fotoitem = 'noimage.jpg';
|
||||
}
|
||||
|
||||
if ($this->input->post('status_promo') == 1) {
|
||||
$promo = html_escape($this->input->post('harga_promo', TRUE));
|
||||
} else {
|
||||
$promo = '0';
|
||||
}
|
||||
$id = $this->input->post('id_mitra');
|
||||
$hargaitem = html_escape($this->input->post('harga_item', TRUE));
|
||||
$hargapromo = $promo;
|
||||
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
$data = [
|
||||
'kategori_item' => html_escape($this->input->post('kategori_item', TRUE)),
|
||||
'nama_item' => html_escape($this->input->post('nama_item', TRUE)),
|
||||
'harga_item' => str_replace($remove, $add, $hargaitem),
|
||||
'harga_promo' => str_replace($remove, $add, $hargapromo),
|
||||
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
|
||||
'deskripsi_item' => html_escape($this->input->post('deskripsi_item', TRUE)),
|
||||
'status_item' => html_escape($this->input->post('status_item', TRUE)),
|
||||
'status_promo' => html_escape($this->input->post('status_promo', TRUE)),
|
||||
'foto_item' => $fotoitem
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $id);
|
||||
} else {
|
||||
$this->mitra->insertitem($data);
|
||||
$this->session->set_flashdata('tambah', 'Item Has Been Added');
|
||||
redirect('mitra/detail/' . $id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$id = $this->input->post('id_mitra');
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $id);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahitem($id)
|
||||
{
|
||||
|
||||
$idmerchant = $this->input->post('id_merchant');
|
||||
$mitra = $this->mitra->getidmitra($idmerchant);
|
||||
|
||||
$idm = $mitra['id_mitra'];
|
||||
|
||||
$this->form_validation->set_rules('nama_item', 'nama_item', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('harga_item', 'harga_item', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('deskripsi_item', 'deskripsi_item', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
|
||||
if (@$_FILES['foto_item']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/itemmerchant';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
$foto = $this->mitra->getfotoitem($id);
|
||||
|
||||
|
||||
if ($this->upload->do_upload('foto_item')) {
|
||||
|
||||
$fotoitem = $this->upload->data('file_name');
|
||||
$fotolama = $foto['foto_item'];
|
||||
unlink('images/itemmerchant/' . $fotolama);
|
||||
} else {
|
||||
$fotolama = $foto['foto_item'];
|
||||
$fotoitem = $fotolama;
|
||||
}
|
||||
|
||||
|
||||
if ($this->input->post('status_promo') == 1) {
|
||||
$promo = html_escape($this->input->post('harga_promo', TRUE));
|
||||
} else {
|
||||
$promo = '0';
|
||||
}
|
||||
|
||||
$hargaitem = html_escape($this->input->post('harga_item', TRUE));
|
||||
$hargapromo = $promo;
|
||||
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'kategori_item' => html_escape($this->input->post('kategori_item', TRUE)),
|
||||
'nama_item' => html_escape($this->input->post('nama_item', TRUE)),
|
||||
'harga_item' => str_replace($remove, $add, $hargaitem),
|
||||
'harga_promo' => str_replace($remove, $add, $hargapromo),
|
||||
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
|
||||
'deskripsi_item' => html_escape($this->input->post('deskripsi_item', TRUE)),
|
||||
'status_item' => html_escape($this->input->post('status_item', TRUE)),
|
||||
'status_promo' => html_escape($this->input->post('status_promo', TRUE)),
|
||||
'foto_item' => $fotoitem
|
||||
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
|
||||
$this->mitra->updateitem($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Item Has Been Changed');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
}
|
||||
} else {
|
||||
|
||||
$foto = $this->mitra->getfotoitem($id);
|
||||
$fotolama = $foto['foto_item'];
|
||||
|
||||
if ($this->input->post('status_promo') == 1) {
|
||||
$promo = html_escape($this->input->post('harga_promo', TRUE));
|
||||
} else {
|
||||
$promo = '0';
|
||||
}
|
||||
|
||||
$hargaitem = html_escape($this->input->post('harga_item', TRUE));
|
||||
$hargapromo = $promo;
|
||||
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
$data = [
|
||||
'kategori_item' => html_escape($this->input->post('kategori_item', TRUE)),
|
||||
'nama_item' => html_escape($this->input->post('nama_item', TRUE)),
|
||||
'harga_item' => str_replace($remove, $add, $hargaitem),
|
||||
'harga_promo' => str_replace($remove, $add, $hargapromo),
|
||||
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
|
||||
'deskripsi_item' => html_escape($this->input->post('deskripsi_item', TRUE)),
|
||||
'status_item' => html_escape($this->input->post('status_item', TRUE)),
|
||||
'status_promo' => html_escape($this->input->post('status_promo', TRUE)),
|
||||
'foto_item' => $fotolama
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
|
||||
$this->mitra->updateitem($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Item Has Been Changed');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $idm);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusitem($id)
|
||||
{
|
||||
$data = $this->mitra->getfotoitem($id);
|
||||
$idmerchant = $data['id_merchant'];
|
||||
$idmitra = $this->mitra->getidmitra($idmerchant);
|
||||
$idm = $idmitra['id_mitra'];
|
||||
$gambar = $data['foto_item'];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
|
||||
unlink('images/itemmerchant/' . $gambar);
|
||||
|
||||
$this->mitra->hapusitembyid($id);
|
||||
$this->session->set_flashdata('hapus', 'Item Has Been Deleted');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahmerchant($id)
|
||||
{
|
||||
$this->form_validation->set_rules('nama_merchant', 'nama_merchant', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('alamat_merchant', 'alamat_merchant', 'trim|prep_for_form');
|
||||
$datafitur['fitur'] = $this->mitra->get_fitur_merchant();
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
|
||||
$merchant = $this->mitra->getmerchantdetail($this->input->post('id_merchant'));
|
||||
$fotomerchant = $merchant['foto_merchant'];
|
||||
if (@$_FILES['foto_merchant']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/merchant';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '30000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_merchant')) {
|
||||
|
||||
$fotobarumerchant = $this->upload->data('file_name');
|
||||
unlink('images/itemmerchant/' . $fotomerchant);
|
||||
} else {
|
||||
$fotobarumerchant = $fotomerchant;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
|
||||
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
|
||||
'nama_merchant' => html_escape($this->input->post('nama_merchant', TRUE)),
|
||||
'category_merchant' => html_escape($this->input->post('category_merchant', TRUE)),
|
||||
'alamat_merchant' => html_escape($this->input->post('alamat_merchant', TRUE)),
|
||||
'latitude_merchant' => html_escape($this->input->post('latitude_merchant', TRUE)),
|
||||
'longitude_merchant' => html_escape($this->input->post('longitude_merchant', TRUE)),
|
||||
'jam_buka' => html_escape($this->input->post('jam_buka', TRUE)),
|
||||
'jam_tutup' => html_escape($this->input->post('jam_tutup', TRUE)),
|
||||
'foto_merchant' => $fotobarumerchant
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $id);
|
||||
} else {
|
||||
|
||||
$this->mitra->updatemerchant($data);
|
||||
$this->session->set_flashdata('ubah', 'Merchant Has Been Changed');
|
||||
redirect('mitra/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
|
||||
$data = [
|
||||
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
|
||||
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
|
||||
'nama_merchant' => html_escape($this->input->post('nama_merchant', TRUE)),
|
||||
'category_merchant' => html_escape($this->input->post('category_merchant', TRUE)),
|
||||
'alamat_merchant' => html_escape($this->input->post('alamat_merchant', TRUE)),
|
||||
'latitude_merchant' => html_escape($this->input->post('latitude_merchant', TRUE)),
|
||||
'longitude_merchant' => html_escape($this->input->post('longitude_merchant', TRUE)),
|
||||
'jam_buka' => html_escape($this->input->post('jam_buka', TRUE)),
|
||||
'jam_tutup' => html_escape($this->input->post('jam_tutup', TRUE)),
|
||||
'foto_merchant' => $fotomerchant
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $id);
|
||||
} else {
|
||||
|
||||
$this->mitra->updatemerchant($data);
|
||||
|
||||
$this->session->set_flashdata('ubah', 'Merchant Has Been Changed');
|
||||
redirect('mitra/detail/' . $id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $id, $datafitur);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapuscategoryitem($id)
|
||||
{
|
||||
$mitra = $this->mitra->getidmitrabycategory($id);
|
||||
$idm = $mitra['id_mitra'];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
$this->mitra->hapuskategoryitembyid($id);
|
||||
$this->session->set_flashdata('hapus', 'Item Category Has Been Deleted');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahcategoryitem()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('nama_kategori_item', 'nama_kategori_item', 'trim|prep_for_form');
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$idm = $this->input->post('id_merchant');
|
||||
$data = [
|
||||
'nama_kategori_item' => html_escape($this->input->post('nama_kategori_item', TRUE)),
|
||||
'id_merchant' => html_escape($this->input->post('id_mitra', TRUE)),
|
||||
'all_category' => '0'
|
||||
];
|
||||
|
||||
$this->mitra->tambahkategoryitembyid($data);
|
||||
$this->session->set_flashdata('tambah', 'Item Category Has Been Added');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
$idm = $this->input->post('id_merchant');
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $idm);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahcategoryitem()
|
||||
{
|
||||
$this->form_validation->set_rules('nama_kategori_item', 'nama_kategori_item', 'trim|prep_for_form');
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$idm = $this->input->post('id_mitra');
|
||||
$id = $this->input->post('id_kategori_item');
|
||||
$data = [
|
||||
'nama_kategori_item' => html_escape($this->input->post('nama_kategori_item', TRUE)),
|
||||
];
|
||||
$this->mitra->ubahkategoryitembyid($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Item Category Has Been Updated');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
$idm = $this->input->post('id_mitra');
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $idm);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function editmitradetail()
|
||||
{
|
||||
$this->form_validation->set_rules('nama_mitra', 'nama_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('alamat_mitra', 'alamat_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('email_mitra', 'email_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('partner_region', 'partner_region', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('countrycode', 'countrycode', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('phone', 'phone', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('bank', 'bank', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('norek_mitra', 'norek_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nama_rekening', 'nama_rekening', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('wilayah', 'wilayah', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$idm = $this->input->post('id_mitra');
|
||||
$phone = html_escape($this->input->post('phone_mitra', TRUE));
|
||||
$countrycode = html_escape($this->input->post('country_code_mitra', TRUE));
|
||||
$remove = array("+", "-");
|
||||
|
||||
$data = [
|
||||
'nama_mitra' => html_escape($this->input->post('nama_mitra', TRUE)),
|
||||
'alamat_mitra' => html_escape($this->input->post('alamat_mitra', TRUE)),
|
||||
'email_mitra' => html_escape($this->input->post('email_mitra', TRUE)),
|
||||
'partner' => $this->input->post('partner'),
|
||||
'phone_mitra' => $phone,
|
||||
'country_code_mitra' => $countrycode,
|
||||
'telepon_mitra' => str_replace($remove, '', $countrycode) . $phone,
|
||||
'bank' => html_escape($this->input->post('bank', TRUE)),
|
||||
'norek_mitra' => html_escape($this->input->post('norek_mitra', TRUE)),
|
||||
'nama_rekening' => html_escape($this->input->post('nama_rekening', TRUE)),
|
||||
'wilayah' => html_escape($this->input->post('wilayah', TRUE)),
|
||||
];
|
||||
$datamerchant = [
|
||||
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
|
||||
'phone_merchant' => $phone,
|
||||
'country_code_merchant' => $countrycode,
|
||||
'telepon_merchant' => str_replace($remove, '', $countrycode) . $phone,
|
||||
];
|
||||
$this->mitra->ubahmitrabyid($data, $idm);
|
||||
$this->mitra->updatemerchant($datamerchant);
|
||||
$this->session->set_flashdata('ubah', 'Mitra Has Been Updated');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
$idm = $this->input->post('id_mitra');
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $idm);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function editmitrafile()
|
||||
{
|
||||
$this->form_validation->set_rules('jenis_identitas_mitra', 'jenis_identitas_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nomor_identitas_mitra', 'nomor_identitas_mitra', 'trim|prep_for_form');
|
||||
|
||||
$id = $this->input->post('id_mitra');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$foto = $this->mitra->getmitrabyid($id);
|
||||
$fotoktp = $foto['foto_ktp'];
|
||||
|
||||
if (@$_FILES['foto_ktp']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/ktp';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_ktp')) {
|
||||
|
||||
$fotobaruktp = $this->upload->data('file_name');
|
||||
unlink('images/fotoberkas/ktp/' . $fotoktp);
|
||||
} else {
|
||||
$fotobaruktp = $fotoktp;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'jenis_identitas_mitra' => html_escape($this->input->post('jenis_identitas_mitra', TRUE)),
|
||||
'nomor_identitas_mitra' => html_escape($this->input->post('nomor_identitas_mitra', TRUE)),
|
||||
'foto_ktp' => $fotobaruktp
|
||||
];
|
||||
|
||||
$this->mitra->ubahfilemitrabyid($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Mitra files Has Been Updated');
|
||||
redirect('mitra/detail/' . $id);
|
||||
} else {
|
||||
$data = [
|
||||
'jenis_identitas_mitra' => html_escape($this->input->post('jenis_identitas_mitra', TRUE)),
|
||||
'nomor_identitas_mitra' => html_escape($this->input->post('nomor_identitas_mitra', TRUE)),
|
||||
'foto_ktp' => $fotoktp
|
||||
];
|
||||
|
||||
$this->mitra->ubahfilemitrabyid($data, $id);
|
||||
$this->session->set_flashdata('ubah', 'Mitra files Has Been Updated');
|
||||
redirect('mitra/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $id);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function editmitrapass()
|
||||
{
|
||||
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
|
||||
$idm = $this->input->post('id_mitra');
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$pass = html_escape($this->input->post('password', TRUE));
|
||||
$data = [
|
||||
'password' => sha1($pass),
|
||||
];
|
||||
|
||||
$this->mitra->ubahpassmitrabyid($data, $idm);
|
||||
$this->session->set_flashdata('ubah', 'Mitra password Has Been Updated');
|
||||
redirect('mitra/detail/' . $idm);
|
||||
} else {
|
||||
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/detail/' . $idm);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('mitra/detail/' . $id);
|
||||
} else {
|
||||
$berkas = $this->mitra->getberkasbyid($id);
|
||||
$fotoktp = $berkas['foto_ktp'];
|
||||
unlink('images/fotoberkas/ktp/' . $fotoktp);
|
||||
|
||||
|
||||
$this->mitra->hapusmitrabyid($id);
|
||||
$this->session->set_flashdata('hapus', 'Owner Merchant Has Been Deleted');
|
||||
redirect('mitra');
|
||||
}
|
||||
}
|
||||
|
||||
public function newregmitra()
|
||||
{
|
||||
$data['mitra'] = $this->mitra->getallmitra();
|
||||
$data['merchantk'] = $this->mitra->getmerchantk();
|
||||
$data['fitur'] = $this->mitra->get_fitur_merchant();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/newreg', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function confirmmitra($id)
|
||||
{
|
||||
$this->mitra->ubahstatusmitra($id);
|
||||
|
||||
$item = $this->app->getappbyid();
|
||||
|
||||
$token = sha1(rand(0, 999999) . time());
|
||||
|
||||
$dataforgot = array(
|
||||
'userid' => $id,
|
||||
'token' => $token,
|
||||
'idKey' => '3'
|
||||
);
|
||||
$this->Pelanggan_model->dataforgot($dataforgot);
|
||||
|
||||
$linkbtn = base_url() . 'resetpass/rest/' . $token . '/3';
|
||||
$judul_email = $item['email_subject_confirm'] . '[ticket-' . rand(0, 999999) . ']';
|
||||
$template = $this->Pelanggan_model->template1($item['email_subject_confirm'], $item['email_text3'], $item['email_text4'], $item['app_website'], $item['app_name'], $linkbtn, $item['app_linkgoogle'], $item['app_address']);
|
||||
$email = $this->mitra->getmitrabyid($id);
|
||||
$emailuser = $email['email_mitra'];
|
||||
$host = $item['smtp_host'];
|
||||
$port = $item['smtp_port'];
|
||||
$username = $item['smtp_username'];
|
||||
$password = $item['smtp_password'];
|
||||
$from = $item['smtp_from'];
|
||||
$appname = $item['app_name'];
|
||||
$secure = $item['smtp_secure'];
|
||||
|
||||
$this->email_model->emailsend($judul_email, $emailuser, $template, $host, $port, $username, $password, $from, $appname, $secure);
|
||||
$this->session->set_flashdata('ubah', 'Mitra Has Been Confirm');
|
||||
redirect('mitra');
|
||||
}
|
||||
|
||||
public function tambahmitra()
|
||||
{
|
||||
|
||||
|
||||
$this->form_validation->set_rules('nama_mitra', 'nama_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('alamat_mitra', 'alamat_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('email_mitra', 'email_mitra', 'trim|prep_for_form|is_unique[mitra.email_mitra]');
|
||||
$this->form_validation->set_rules('phone_mitra', 'phone_mitra', 'trim|prep_for_form|is_unique[mitra.phone_mitra]');
|
||||
$this->form_validation->set_rules('country_code_mitra', 'country_code_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('jenis_identitas_mitra', 'jenis_identitas_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nomor_identitas_mitra', 'nomor_identitas_mitra', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nama_merchant', 'nama_merchant', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('id_fitur', 'id_fitur', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('category_merchant', 'category_merchant', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('alamat_merchant', 'alamat_merchant', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('jam_buka', 'jam_buka', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('jam_tutup', 'jam_tutup', 'trim|prep_for_form');
|
||||
|
||||
if ($this->input->post('category_merchant') == NUll) {
|
||||
$this->session->set_flashdata('gagal', 'Please Add Category Merchant First');
|
||||
redirect('mitra/newregmitra');
|
||||
}
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
if (@$_FILES['foto_merchant']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/merchant';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('foto_merchant')) {
|
||||
|
||||
$fotomerchant = html_escape($this->upload->data('file_name'));
|
||||
}
|
||||
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
if (@$_FILES['katepe']['name']) {
|
||||
|
||||
$config['upload_path'] = './images/fotoberkas/ktp';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if ($this->upload->do_upload('katepe')) {
|
||||
$fotoktp = html_escape($this->upload->data('file_name'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$countrycode = html_escape($this->input->post('country_code_mitra', TRUE));
|
||||
$phone = html_escape($this->input->post('phone_mitra', TRUE));
|
||||
$id = 'M' . time();
|
||||
|
||||
$datamerchant = [
|
||||
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
|
||||
'nama_merchant' => html_escape($this->input->post('nama_merchant', TRUE)),
|
||||
'alamat_merchant' => html_escape($this->input->post('alamat_merchant', TRUE)),
|
||||
'latitude_merchant' => html_escape($this->input->post('latitude_merchant', TRUE)),
|
||||
'longitude_merchant' => html_escape($this->input->post('longitude_merchant', TRUE)),
|
||||
'jam_buka' => html_escape($this->input->post('jam_buka', TRUE)),
|
||||
'jam_tutup' => html_escape($this->input->post('jam_tutup', TRUE)),
|
||||
'category_merchant' => html_escape($this->input->post('category_merchant', TRUE)),
|
||||
'foto_merchant' => $fotomerchant,
|
||||
'telepon_merchant' => str_replace("+", "", $countrycode) . $phone,
|
||||
'country_code_merchant' => $countrycode,
|
||||
'phone_merchant' => $phone,
|
||||
'status_merchant' => '0',
|
||||
'token_merchant' => sha1(time())
|
||||
];
|
||||
|
||||
$idmerchant = $this->mitra->insertmerchant($datamerchant);
|
||||
|
||||
$datamitra = [
|
||||
'id_mitra' => $id,
|
||||
'nama_mitra' => html_escape($this->input->post('nama_mitra', TRUE)),
|
||||
'jenis_identitas_mitra' => html_escape($this->input->post('jenis_identitas_mitra', TRUE)),
|
||||
'nomor_identitas_mitra' => html_escape($this->input->post('nomor_identitas_mitra', TRUE)),
|
||||
'alamat_mitra' => html_escape($this->input->post('alamat_mitra', TRUE)),
|
||||
'email_mitra' => html_escape($this->input->post('email_mitra', TRUE)),
|
||||
'password' => sha1(time()),
|
||||
'telepon_mitra' => str_replace("+", "", $countrycode) . $phone,
|
||||
'country_code_mitra' => $countrycode,
|
||||
'phone_mitra' => $phone,
|
||||
'id_merchant' => $idmerchant,
|
||||
'partner' => '0',
|
||||
'status_mitra' => '0'
|
||||
];
|
||||
|
||||
$databerkas = [
|
||||
'id_driver' => $id,
|
||||
'foto_ktp' => $fotoktp,
|
||||
];
|
||||
|
||||
$datasaldo = [
|
||||
'id_user' => $id,
|
||||
'saldo' => 0
|
||||
];
|
||||
|
||||
$this->mitra->tambahkanmitra($datamitra, $databerkas, $datasaldo);
|
||||
$this->session->set_flashdata('tambah', 'Merchant Has Been Added');
|
||||
redirect('mitra/newregmitra');
|
||||
} else {
|
||||
|
||||
$data['mitra'] = $this->mitra->getallmitra();
|
||||
$data['merchantk'] = $this->mitra->getmerchantk();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/newreg', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function edititem($id)
|
||||
{
|
||||
$data['item'] = $this->mitra->getitembyiditem($id);
|
||||
$data['itemk'] = $this->mitra->getitemkbyid($data['item']['id_merchant']);
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('mitra/edititem', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class newregistration extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
$this->load->model('driver_model', 'driver');
|
||||
$this->load->model('Pelanggan_model');
|
||||
$this->load->model('email_model');
|
||||
$this->load->model('appsettings_model', 'app');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['driver'] = $this->driver->getalldriver();
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('newregistration/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function confirm($id)
|
||||
{
|
||||
$this->driver->ubahstatusnewreg($id);
|
||||
|
||||
$item = $this->app->getappbyid();
|
||||
|
||||
$token = sha1(rand(0, 999999) . time());
|
||||
|
||||
$dataforgot = array(
|
||||
'userid' => $id,
|
||||
'token' => $token,
|
||||
'idKey' => '2'
|
||||
);
|
||||
$this->Pelanggan_model->dataforgot($dataforgot);
|
||||
|
||||
$linkbtn = base_url() . 'resetpass/rest/' . $token . '/2';
|
||||
$judul_email = $item['email_subject_confirm'] . '[ticket-' . rand(0, 999999) . ']';
|
||||
$template = $this->Pelanggan_model->template1($item['email_subject_confirm'], $item['email_text3'], $item['email_text4'], $item['app_website'], $item['app_name'], $linkbtn, $item['app_linkgoogle'], $item['app_address']);
|
||||
$email = $this->driver->getdriverbyid($id);
|
||||
$emailuser = $email['email'];
|
||||
$host = $item['smtp_host'];
|
||||
$port = $item['smtp_port'];
|
||||
$username = $item['smtp_username'];
|
||||
$password = $item['smtp_password'];
|
||||
$from = $item['smtp_from'];
|
||||
$appname = $item['app_name'];
|
||||
$secure = $item['smtp_secure'];
|
||||
|
||||
$this->email_model->emailsend($judul_email, $emailuser, $template, $host, $port, $username, $password, $from, $appname, $secure);
|
||||
$this->session->set_flashdata('ubah', 'Driver berhasil bergabung');
|
||||
redirect('driver');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class News extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('news_model', 'news');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['news'] = $this->news->getallnews();
|
||||
$data['kategori'] = $this->news->getallkategorinews();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('news/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function hapuscategory($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('news/index');
|
||||
} else {
|
||||
$this->news->hapuskategoribyid($id);
|
||||
$this->session->set_flashdata('hapus', 'Category News Has Been Deleted');
|
||||
redirect('news');
|
||||
}
|
||||
}
|
||||
|
||||
public function tambah()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('title', 'title', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('id_kategori', 'id_kategori', 'trim|prep_for_form');
|
||||
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/berita/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('foto_berita')) {
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = 'noimage.jpg';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'foto_berita' => $gambar,
|
||||
'title' => html_escape($this->input->post('title', TRUE)),
|
||||
'content' => $this->input->post('content', TRUE),
|
||||
'id_kategori' => html_escape($this->input->post('id_kategori', TRUE)),
|
||||
'status_berita' => html_escape($this->input->post('status_berita', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('news/tambah');
|
||||
} else {
|
||||
|
||||
$this->news->tambahdataberita($data);
|
||||
$this->session->set_flashdata('tambah', 'Category News Has Been Added');
|
||||
redirect('news');
|
||||
}
|
||||
} else {
|
||||
$data['news'] = $this->news->getallkategorinews();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('news/addnews', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('news/index');
|
||||
} else {
|
||||
$data = $this->news->getnewsById($id);
|
||||
if ($data['foto_berita'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto_berita'];
|
||||
unlink('images/berita/' . $gambar);
|
||||
}
|
||||
$this->news->hapusberitaById($id);
|
||||
$this->session->set_flashdata('hapus', 'News Has Been Deleted');
|
||||
redirect('news');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubah($id)
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('title', 'title', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('id_kategori', 'id_kategori', 'trim|prep_for_form');
|
||||
|
||||
|
||||
$data['news'] = $this->news->getnewsById($id);
|
||||
$id = html_escape($this->input->post('id_berita', TRUE));
|
||||
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/berita/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('foto_berita')) {
|
||||
if ($data['news']['foto_berita'] != 'noimage.jpg') {
|
||||
$gambar = $data['news']['foto_berita'];
|
||||
unlink('images/berita/' . $gambar);
|
||||
}
|
||||
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = $data['news']['foto_berita'];
|
||||
}
|
||||
$data = [
|
||||
'id_berita' => html_escape($this->input->post('id_berita', TRUE)),
|
||||
'foto_berita' => $gambar,
|
||||
'title' => html_escape($this->input->post('title', TRUE)),
|
||||
'content' => $this->input->post('content'),
|
||||
'id_kategori' => html_escape($this->input->post('id_kategori', TRUE)),
|
||||
'status_berita' => html_escape($this->input->post('status_berita', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('news/index');
|
||||
} else {
|
||||
|
||||
$this->news->ubahdataberita($data);
|
||||
$this->session->set_flashdata('ubah', 'News Has Been Changed');
|
||||
redirect('news');
|
||||
}
|
||||
} else {
|
||||
$data['knews'] = $this->news->getallkategorinews();
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('news/editnews', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahcategory()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('kategori', 'kategori', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$data = [
|
||||
'kategori' => html_escape($this->input->post('kategori', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('news/index');
|
||||
} else {
|
||||
$this->news->tambahdatakategori($data);
|
||||
$this->session->set_flashdata('tambah', 'Has Been added');
|
||||
redirect('news');
|
||||
}
|
||||
} else {
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('news/addcategory');
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Partnerjob extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('Partnerjob_model', 'partnerjob');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['partnerjob'] = $this->partnerjob->getAllpartnerjob();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('partnerjob/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function addpartnerjob()
|
||||
{
|
||||
$this->form_validation->set_rules('icon', 'icon', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status_job', 'status_job', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
$data = [
|
||||
'icon' => html_escape($this->input->post('icon', TRUE)),
|
||||
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
|
||||
'status_job' => html_escape($this->input->post('status_job', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('partnerjob/addpartnerjob');
|
||||
} else {
|
||||
$this->partnerjob->addpartnerjob($data);
|
||||
$this->session->set_flashdata('tambah', 'Partner Job Has Been Added');
|
||||
redirect('partnerjob');
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('partnerjob/addpartnerjob');
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function editpartnerjob($id)
|
||||
{
|
||||
$this->form_validation->set_rules('icon', 'icon', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status_job', 'status_job', 'trim|prep_for_form');
|
||||
|
||||
$data['partnerjob'] = $this->partnerjob->getpartnerjobById($id);
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'icon' => html_escape($this->input->post('icon', TRUE)),
|
||||
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
|
||||
'status_job' => html_escape($this->input->post('status_job', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('partnerjob/index');
|
||||
} else {
|
||||
$this->partnerjob->editdatapartnerjob($data);
|
||||
$this->session->set_flashdata('tambah', 'Partner Job Has Been Changed');
|
||||
redirect('partnerjob');
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('partnerjob/editpartnerjob', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function deletepartnerjob($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('partnerjob/index');
|
||||
} else {
|
||||
$data = $this->partnerjob->getpartnerjobById($id);
|
||||
|
||||
$this->partnerjob->deletepartnerjobById($id);
|
||||
$this->session->set_flashdata('hapus', 'Partner Job Has Been deleted');
|
||||
redirect('partnerjob');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class partnerregion extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('PartnerRegion_model', 'partnerregion');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['partnerregion'] = $this->partnerregion->getAllpartnerregion();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('partnerregion/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function addpartnerregion()
|
||||
{
|
||||
$this->form_validation->set_rules('nama_cabang', 'nama_cabang', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('partner_region', 'partner_region', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status_region', 'status_region', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
$data = [
|
||||
'nama_cabang' => html_escape($this->input->post('nama_cabang', TRUE)),
|
||||
'partner_region' => html_escape($this->input->post('partner_region', TRUE)),
|
||||
'status_region' => html_escape($this->input->post('status_region', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('partnerregion/addpartnerregion');
|
||||
} else {
|
||||
$this->partnerregion->addpartnerregion($data);
|
||||
$this->session->set_flashdata('tambah', 'Partner Region Has Been Added');
|
||||
redirect('partnerregion');
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('partnerregion/addpartnerregion');
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function editpartnerregion($id)
|
||||
{
|
||||
$this->form_validation->set_rules('nama_cabang', 'nama_cabang', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('partner_region', 'partner_region', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status_region', 'status_region', 'trim|prep_for_form');
|
||||
|
||||
$data['partnerregion'] = $this->partnerregion->getpartnerregionById($id);
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'nama_cabang' => html_escape($this->input->post('nama_cabang', TRUE)),
|
||||
'partner_region' => html_escape($this->input->post('partner_region', TRUE)),
|
||||
'status_region' => html_escape($this->input->post('status_region', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('partnerregion/index');
|
||||
} else {
|
||||
$this->partnerregion->editdatapartnerregion($data);
|
||||
$this->session->set_flashdata('tambah', 'Partner Region Has Been Changed');
|
||||
redirect('partnerregion');
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('partnerregion/editpartnerregion', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function deletepartnerregion($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('partnerregion/index');
|
||||
} else {
|
||||
$data = $this->partnerregion->getpartnerregionById($id);
|
||||
|
||||
$this->partnerregion->deletepartnerregionById($id);
|
||||
$this->session->set_flashdata('hapus', 'Partner Region Has Been deleted');
|
||||
redirect('partnerregion');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,413 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Profile extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('profile_model', 'profile');
|
||||
// $this->load->model('news_model', 'news');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
// $data['news'] = $this->news->getallnews();
|
||||
$data['pengguna'] = $this->profile->getadmin();
|
||||
$data['admin_role'] = $this->profile->getadminRole();
|
||||
$data['role_privilage'] = $this->profile->getadminRolePrivilage();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function user_pengguna($id="")
|
||||
{
|
||||
$data['region'] = $this->profile->getRegion();
|
||||
$id_admin = html_escape($this->input->post('id', TRUE));
|
||||
$username = html_escape($this->input->post('username', TRUE));
|
||||
$password = html_escape($this->input->post('password', TRUE));
|
||||
$countrycode = html_escape($this->input->post('countrycode', TRUE));
|
||||
$phone = html_escape($this->input->post('phone', TRUE));
|
||||
$email = html_escape($this->input->post('e_mail', TRUE));
|
||||
|
||||
$this->form_validation->set_rules('username', 'USERNAME', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('phone', 'PHONE', 'trim|prep_for_form|is_unique[pelanggan.phone]');
|
||||
$this->form_validation->set_rules('e_mail', 'E_MAIL', 'trim|prep_for_form|is_unique[pelanggan.email]');
|
||||
$this->form_validation->set_rules('password', 'PASSWORD', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$config['upload_path'] = './images/admin/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('image_profile')) {
|
||||
|
||||
$foto = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto = 'noimage.jpg';
|
||||
}
|
||||
$data = [
|
||||
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'user_name' => html_escape($this->input->post('username', TRUE)),
|
||||
'password' => sha1($password),
|
||||
'email' => html_escape($this->input->post('e_mail', TRUE)),
|
||||
'image' => $foto,
|
||||
'nama' => html_escape($this->input->post('fullnama', TRUE)),
|
||||
'wilayah' => html_escape($this->input->post('region', TRUE)),
|
||||
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
|
||||
'admin_role' => html_escape($this->input->post('role', TRUE)),
|
||||
'status' => html_escape($this->input->post('status', TRUE)),
|
||||
|
||||
];
|
||||
|
||||
if ($id_admin !="") {
|
||||
$this->profile->ubahdataadmin($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil merubah data role user');
|
||||
redirect('profile/index');
|
||||
} else {
|
||||
$this->profile->tambahadmin($data);
|
||||
$this->session->set_flashdata('tambah', 'User Has Been Added');
|
||||
redirect('profile/index');
|
||||
}
|
||||
} else {
|
||||
|
||||
if($id !=""){
|
||||
// echo $id;
|
||||
$data['data'] = $this->profile->getadmingedit($id);
|
||||
$data['role'] = $this->profile->getRole();
|
||||
$data['role1'] = $this->profile->getRole1();
|
||||
// dd ($data['nama_fitur']);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahuseradmin', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}else{
|
||||
|
||||
$data['role'] = $this->profile->getRole();
|
||||
$data['role1'] = $this->profile->getRole1();
|
||||
$data['data'] ="";
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahuseradmin',$data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus_pengguna($id)
|
||||
{
|
||||
$data = $this->profile->getadmingedit($id);
|
||||
|
||||
if ($data['image'] != 'noimage.jpg') {
|
||||
$gambar = $data['image'];
|
||||
unlink('images/promo/' . $gambar);
|
||||
}
|
||||
|
||||
$this->profile->hapus_pengguna($id);
|
||||
$this->session->set_flashdata('hapus', 'User berhasil dihapus');
|
||||
redirect('profile');
|
||||
}
|
||||
public function ubah()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('user_name', 'user_name', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nama', 'nama', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('email', 'email', 'trim|prep_for_form');
|
||||
|
||||
$data = $this->profile->getadmin();
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/admin/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '10000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('image')) {
|
||||
if ($data['image'] != 'noimage.jpg') {
|
||||
$image = $data['image'];
|
||||
unlink('images/admin/' . $image);
|
||||
}
|
||||
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = $data['image'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($this->input->post('password', TRUE) == NULL) {
|
||||
$pass = $data['password'];
|
||||
} else {
|
||||
$pass = html_escape(sha1($this->input->post('password', TRUE)));
|
||||
}
|
||||
$data = [
|
||||
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'image' => $gambar,
|
||||
'user_name' => html_escape($this->input->post('user_name', TRUE)),
|
||||
'nama' => html_escape($this->input->post('nama', TRUE)),
|
||||
'email' => html_escape($this->input->post('email', TRUE)),
|
||||
'password' => $pass
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NGAPAIN DIGANTI PASSWORDNYA :D :P');
|
||||
redirect('profile/index');
|
||||
} else {
|
||||
$this->profile->ubahdataadmin($data);
|
||||
$this->session->set_userdata($data);
|
||||
$this->session->set_flashdata('diubah', 'Has Been Changed');
|
||||
redirect('profile');
|
||||
}
|
||||
} else {
|
||||
$data['data'] = $this->profile->ubahdataadmin();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/ubahpengguna', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function role($id="")
|
||||
{
|
||||
|
||||
$id_prifilage = html_escape($this->input->post('id', TRUE));
|
||||
$role = html_escape($this->input->post('role', TRUE));
|
||||
|
||||
$this->form_validation->set_rules('role', 'NAME', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'nama_role' => html_escape($this->input->post('role', TRUE)),
|
||||
];
|
||||
if ($id_prifilage !="") {
|
||||
$this->profile->editrole($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil merubah data role user');
|
||||
redirect('profile/index');
|
||||
} else {
|
||||
$this->profile->tambahrole($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil menambahkan data role user');
|
||||
redirect('profile/index');
|
||||
}
|
||||
} else {
|
||||
if($id !=""){
|
||||
// echo $id;
|
||||
$data['data'] = $this->profile->getadminrolegedit($id);
|
||||
// dd ($data['nama_fitur']);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahrole', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}else{
|
||||
|
||||
$data['data'] ="";
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahrole', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
public function privilage($id="")
|
||||
{
|
||||
|
||||
$id_prifilage = html_escape($this->input->post('id', TRUE));
|
||||
$namafitur = html_escape($this->input->post('namafitur', TRUE));
|
||||
$url = html_escape($this->input->post('url', TRUE));
|
||||
$icon = html_escape($this->input->post('icon', TRUE));
|
||||
|
||||
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('icon', 'ICON', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'nama_fitur' => html_escape($this->input->post('namafitur', TRUE)),
|
||||
'url' => html_escape($this->input->post('url', TRUE)),
|
||||
'icon' => html_escape($this->input->post('icon', TRUE)),
|
||||
];
|
||||
if ($id_prifilage !="") {
|
||||
$this->profile->editprifilage($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil merubah data privilage');
|
||||
redirect('profile/index');
|
||||
} else {
|
||||
$this->profile->tambahprifilage($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil menambahkan data privilage');
|
||||
redirect('profile/index');
|
||||
}
|
||||
} else {
|
||||
if($id !=""){
|
||||
// echo $id;
|
||||
$data['data'] = $this->profile->getadminPrifilagedit($id);
|
||||
// dd ($data['nama_fitur']);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahprivilage', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}else{
|
||||
|
||||
$data['data'] ="";
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahprivilage', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
public function sub_privilage($id="")
|
||||
{
|
||||
|
||||
$id_prifilage = html_escape($this->input->post('id', TRUE));
|
||||
$namafitur = html_escape($this->input->post('namafitur', TRUE));
|
||||
$url = html_escape($this->input->post('url', TRUE));
|
||||
$icon = html_escape($this->input->post('icon', TRUE));
|
||||
|
||||
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('icon', 'ICON', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'nama_fitur' => html_escape($this->input->post('namafitur', TRUE)),
|
||||
'url' => html_escape($this->input->post('url', TRUE)),
|
||||
'foregn' => html_escape($this->input->post('role', TRUE)),
|
||||
];
|
||||
if ($id_prifilage !="") {
|
||||
$this->profile->editprifilage($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil merubah data privilage');
|
||||
redirect('profile/index');
|
||||
} else {
|
||||
$this->profile->tambahprifilage($data);
|
||||
$this->session->set_flashdata('tambah', 'Berhasil menambahkan data privilage');
|
||||
redirect('profile/index');
|
||||
}
|
||||
} else {
|
||||
if($id !=""){
|
||||
// echo $id;
|
||||
$data['data'] = $this->profile->getadminPrifilagedit($id);
|
||||
// dd ($data['nama_fitur']);
|
||||
$data['menu_sub'] = $this->profile->getmenuSubPrifilage();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahprivilagesub', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}else{
|
||||
|
||||
$data['data'] ="";
|
||||
$data['menu_sub'] = $this->profile->getmenuSubPrifilage();
|
||||
// dd( $data);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahprivilagesub',$data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public function role_privilage($id="")
|
||||
{
|
||||
$cek_menu_prifilage = $this->profile->getmenuPrifilage($id);
|
||||
// dd($cek_menu_prifilage);
|
||||
$id_prifilage = html_escape($this->input->post('id', TRUE));
|
||||
$role = html_escape($this->input->post('role', TRUE));
|
||||
$this->form_validation->set_rules('role', 'NAME', 'trim|prep_for_form');
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$id_role = $_POST['id_role'];
|
||||
$parent = $_POST['parent'];
|
||||
$child = $_POST['child'];
|
||||
foreach ($parent as $pr) {
|
||||
$id_privilage = isset($pr['id_privilage']) ? ($pr['id_privilage']) : NULL;
|
||||
$id_menu_role = isset($pr['id_menu_role']) ? ($pr['id_menu_role']) : NULL;
|
||||
$cek = isset($pr['cek']) ? ($pr['cek']) : NULL;
|
||||
if($id_menu_role !=""){
|
||||
$this->profile->deledemenurolprifilage($id_menu_role);
|
||||
}
|
||||
|
||||
if($cek !=""){
|
||||
$data = [
|
||||
'id_privilage' => html_escape($id_privilage, TRUE),
|
||||
'id_role' => html_escape($id_role, TRUE),
|
||||
'parent' => 'Y',
|
||||
];
|
||||
$this->profile->tambahmenurolprifilage($data);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($child as $ch) {
|
||||
$id_privilage = isset($ch['id_privilage']) ? ($ch['id_privilage']) : NULL;
|
||||
$id_menu_role_child = isset($ch['id_menu_role']) ? ($ch['id_menu_role']) : NULL;
|
||||
$cek_child = isset($ch['cek_child']) ? ($ch['cek_child']) : NULL;
|
||||
|
||||
// dd($child);
|
||||
if($id_menu_role_child !=""){
|
||||
$this->profile->deledemenurolprifilage($id_menu_role_child);
|
||||
}
|
||||
if($cek_child !=""){
|
||||
$data = [
|
||||
'id_privilage' => html_escape($id_privilage, TRUE),
|
||||
'id_role' => html_escape($id_role, TRUE),
|
||||
];
|
||||
$this->profile->tambahmenurolprifilage($data);
|
||||
}
|
||||
}
|
||||
$this->session->set_flashdata('tambah', 'Berhasil menambahkan menu role');
|
||||
redirect('profile/index');
|
||||
// $data = [
|
||||
// 'id' => html_escape($this->input->post('id', TRUE)),
|
||||
// 'nama_role' => html_escape($this->input->post('role', TRUE)),
|
||||
// ];
|
||||
// if ($id_prifilage !="") {
|
||||
// $this->profile->editrole($data);
|
||||
// $this->session->set_flashdata('tambah', 'Berhasil merubah data role user');
|
||||
// redirect('profile/index');
|
||||
// } else {
|
||||
// $this->profile->tambahrole($data);
|
||||
// $this->session->set_flashdata('tambah', 'Berhasil menambahkan data role user');
|
||||
// redirect('profile/index');
|
||||
// }
|
||||
} else {
|
||||
if($cek_menu_prifilage !=""){
|
||||
$data['act'] = $this->profile->getadminRolePrivilage();
|
||||
$data['sub'] = $this->profile->getadminRolePrivilage();
|
||||
$data['role'] = $this->profile->getadminrolegedit($id);
|
||||
$data['privilage_menu'] = $this->profile->getmenuPrifilage($id);
|
||||
// dd ($data['nama_fitur']);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahroleprivilage', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}else{
|
||||
$data['act'] = $this->profile->getadminRolePrivilage();
|
||||
$data['sub'] = $this->profile->getadminRolePrivilage();
|
||||
$data['role'] = $this->profile->getadminrolegedit($id);
|
||||
$data['privilage_menu'] = $this->profile->getmenuPrifilage($id);
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('profile/tambahroleprivilage', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
public function unblock($id)
|
||||
{
|
||||
$this->profile->unblockuserbyid($id);
|
||||
redirect('profile');
|
||||
}
|
||||
|
||||
public function userblock($id)
|
||||
{
|
||||
$this->profile->blockuserbyid($id);
|
||||
redirect('profile');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Promocode extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('Promocode_model', 'promocode');
|
||||
$this->load->model('Service_model', 'fitur');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['promocode'] = $this->promocode->getallpromocode();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promocode/index',$data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function addpromocode()
|
||||
|
||||
{
|
||||
|
||||
|
||||
$this->form_validation->set_rules('nama_promo', 'nama_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('kode_promo', 'kode_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nominal_promo', 'nominal_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('type_promo', 'type_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status', 'status', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/promo/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '10000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('image_promo')) {
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = 'noimage.jpg';
|
||||
}
|
||||
|
||||
if ($this->input->post('type_promo') == 'persen'){
|
||||
$nominal = html_escape($this->input->post('nominal_promo_persen', TRUE));
|
||||
} else {
|
||||
$nominal = str_replace(".","",html_escape($this->input->post('nominal_promo', TRUE)));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'image_promo' => $gambar,
|
||||
'nama_promo' => html_escape($this->input->post('nama_promo', TRUE)),
|
||||
'kode_promo' => html_escape($this->input->post('kode_promo', TRUE)),
|
||||
'nominal_promo' => $nominal,
|
||||
'type_promo' => html_escape($this->input->post('type_promo', TRUE)),
|
||||
'expired' => html_escape($this->input->post('expired', TRUE)),
|
||||
'fitur' => html_escape($this->input->post('fitur', TRUE)),
|
||||
'status' => html_escape($this->input->post('status', TRUE)),
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('promocode/addpromocode');
|
||||
} else {
|
||||
$cekpromo = $this->promocode->cekpromo($this->input->post('kode_promo'));
|
||||
if ($cekpromo->num_rows() > 0){
|
||||
|
||||
$this->session->set_flashdata('demo', 'Promotion code already exist');
|
||||
redirect('promocode/addpromocode');
|
||||
}else{
|
||||
$this->promocode->addpromocode($data);
|
||||
$this->session->set_flashdata('tambah', 'Promotion Slider Has Been Added');
|
||||
redirect('promocode');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data['fitur'] = $this->fitur->getallservice();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promocode/addpromocode', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function editpromocode($id)
|
||||
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('nama_promo', 'nama_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('kode_promo', 'kode_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nominal_promo', 'nominal_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('type_promo', 'type_promo', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('status', 'status', 'trim|prep_for_form');
|
||||
$data['promo'] = $this->promocode->getpromobyid($id)->row_array();
|
||||
$data['fitur'] = $this->fitur->getallservice();
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
if ($this->input->post('type_promo') == 'persen'){
|
||||
$nominal = html_escape($this->input->post('nominal_promo_persen', TRUE));
|
||||
} else {
|
||||
$nominal = str_replace(".","",html_escape($this->input->post('nominal_promo', TRUE)));
|
||||
}
|
||||
|
||||
$config['upload_path'] = './images/promo/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '10000';
|
||||
$config['file_name'] = time();
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('image_promo')) {
|
||||
unlink('images/promo/' . $this->promocode->getpromobyid($id)->row('image_promo'));
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
$datainsert = [
|
||||
'id_promo' => html_escape($this->input->post('id_promo', TRUE)),
|
||||
'image_promo' => $gambar,
|
||||
'nama_promo' => html_escape($this->input->post('nama_promo', TRUE)),
|
||||
'kode_promo' => html_escape($this->input->post('kode_promo', TRUE)),
|
||||
'nominal_promo' => $nominal,
|
||||
'type_promo' => html_escape($this->input->post('type_promo', TRUE)),
|
||||
'expired' => html_escape($this->input->post('expired', TRUE)),
|
||||
'fitur' => html_escape($this->input->post('fitur', TRUE)),
|
||||
'status' => html_escape($this->input->post('status', TRUE)),
|
||||
];
|
||||
} else {
|
||||
$datainsert = [
|
||||
'id_promo' => html_escape($this->input->post('id_promo', TRUE)),
|
||||
'nama_promo' => html_escape($this->input->post('nama_promo', TRUE)),
|
||||
'kode_promo' => html_escape($this->input->post('kode_promo', TRUE)),
|
||||
'nominal_promo' => $nominal,
|
||||
'type_promo' => html_escape($this->input->post('type_promo', TRUE)),
|
||||
'expired' => html_escape($this->input->post('expired', TRUE)),
|
||||
'fitur' => html_escape($this->input->post('fitur', TRUE)),
|
||||
'status' => html_escape($this->input->post('status', TRUE)),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promocode/editpromocode', $data);
|
||||
$this->load->view('includes/footer');
|
||||
} else {
|
||||
$cekpromo = $this->promocode->cekpromo($this->input->post('kode_promo'));
|
||||
if ($cekpromo->num_rows() > 0 && $cekpromo->row_array()['id_promo'] != $this->input->post('id_promo')){
|
||||
$this->session->set_flashdata('demo', 'Promotion code already exist');
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promocode/editpromocode', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}else{
|
||||
$this->promocode->editpromocode($datainsert);
|
||||
$this->session->set_flashdata('tambah', 'Promotion code Has Been Changed');
|
||||
redirect('promocode');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promocode/editpromocode', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapus($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('promocode/index');
|
||||
} else {
|
||||
$data = $this->promocode->getpromocodeById($id);
|
||||
|
||||
if ($data['image_promo'] != 'noimage.jpg') {
|
||||
$gambar = $data['image_promo'];
|
||||
unlink('images/promo/' . $gambar);
|
||||
}
|
||||
|
||||
$this->promocode->hapuspromocodeById($id);
|
||||
$this->session->set_flashdata('hapus', 'Promo Code Has Been deleted');
|
||||
redirect('promocode');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Promoslider extends CI_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
is_logged_in();
|
||||
$this->load->model('promoslider_model', 'promo');
|
||||
$this->load->model('service_model', 'fitur');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['promo'] = $this->promo->getallpromo();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promoslider/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function tambah()
|
||||
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('tanggal_berakhir', 'tanggal_berakhir', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('fitur_promosi', 'fitur_promosi', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('link_promosi', 'link_promosi', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('is_show', 'is_show', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('type_promosi', 'type_promosi', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/promo/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '20000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('foto')) {
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = 'noimage.jpg';
|
||||
}
|
||||
$type = html_escape($this->input->post('type_promosi', TRUE));
|
||||
|
||||
if ($type != 'link') {
|
||||
$fitur = html_escape($this->input->post('fitur_promosi', TRUE));
|
||||
} else {
|
||||
$fitur = 0;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'foto' => $gambar,
|
||||
'tanggal_berakhir' => html_escape($this->input->post('tanggal_berakhir', TRUE)),
|
||||
'fitur_promosi' => $fitur,
|
||||
'type_promosi' => html_escape($this->input->post('type_promosi', TRUE)),
|
||||
'is_show' => html_escape($this->input->post('is_show', TRUE)),
|
||||
'link_promosi' => html_escape($this->input->post('link_promosi', TRUE))
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('promoslider/tambah');
|
||||
} else {
|
||||
$this->promo->tambahdatapromo($data);
|
||||
$this->session->set_flashdata('tambah', 'Promotion Slider Has Been Added');
|
||||
redirect('promoslider');
|
||||
}
|
||||
} else {
|
||||
$data['fitur'] = $this->fitur->getallservice();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promoslider/addslider', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
public function hapus($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('promoslider/index');
|
||||
} else {
|
||||
$data = $this->promo->getpromoById($id);
|
||||
|
||||
if ($data['foto'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto'];
|
||||
unlink('images/promo/' . $gambar);
|
||||
}
|
||||
|
||||
$this->promo->hapuspromoById($id);
|
||||
$this->session->set_flashdata('hapus', 'Promotion Slider Has Been deleted');
|
||||
redirect('promoslider');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubah($id)
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('tanggal_berakhir', 'tanggal_berakhir', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('fitur_promosi', 'fitur_promosi', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('link_promosi', 'link_promosi', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('is_show', 'is_show', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('type_promosi', 'type_promosi', 'trim|prep_for_form');
|
||||
|
||||
$data = $this->promo->getpromoById($id);
|
||||
$data['fitur'] = $this->fitur->getallservice();
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/promo/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '20000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('foto')) {
|
||||
if ($data['foto'] != 'noimage.jpg') {
|
||||
$gambar = $data['foto'];
|
||||
|
||||
}
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = $data['foto'];
|
||||
}
|
||||
|
||||
$type = html_escape($this->input->post('type_promosi', TRUE));
|
||||
|
||||
if ($type != 'link') {
|
||||
$fitur = html_escape($this->input->post('fitur_promosi', TRUE));
|
||||
$link = 'service';
|
||||
} else {
|
||||
$fitur = 0;
|
||||
$link = html_escape($this->input->post('link_promosi', TRUE));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'foto' => $gambar,
|
||||
'tanggal_berakhir' => html_escape($this->input->post('tanggal_berakhir', TRUE)),
|
||||
'fitur_promosi' => $fitur,
|
||||
'type_promosi' => $type,
|
||||
'is_show' => html_escape($this->input->post('is_show', TRUE)),
|
||||
'link_promosi' => $link,
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('promoslider/index');
|
||||
} else {
|
||||
$this->promo->ubahdatapromo($data);
|
||||
$this->session->set_flashdata('ubah', 'Promotion Slider Has Been Changed');
|
||||
redirect('promoslider');
|
||||
}
|
||||
} else {
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('promoslider/editslider' . $id, $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Resetpass extends CI_Controller {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('Resetpass_model');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$this->load->view('nodata');
|
||||
}
|
||||
|
||||
public function rest($token=null,$idkey=null) {
|
||||
$data['user'] = $this->Resetpass_model->check_token($token,$idkey);
|
||||
$this->form_validation->set_rules('password', 'password', 'required');
|
||||
if ($data['user']) {
|
||||
if ($this->form_validation->run() == false) {
|
||||
$this->load->view('resetpass',$data);
|
||||
} else {
|
||||
$reset = $this->Resetpass_model->resetpass();
|
||||
if($reset) {
|
||||
$this->Resetpass_model->deletetoken();
|
||||
$this->load->view('success');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->load->view('nodata');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class sendemail extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
$this->load->library('form_validation');
|
||||
$this->load->model('driver_model', 'driver');
|
||||
$this->load->model('users_model', 'user');
|
||||
$this->load->model('mitra_model', 'mitra');
|
||||
$this->load->model('appsettings_model', 'app');
|
||||
$this->load->model('email_model', 'email_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['driver'] = $this->driver->getalldriver();
|
||||
$data['user'] = $this->user->getallusers();
|
||||
$data['mitra'] = $this->mitra->getallmitra();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('sendemail/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function send()
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN');
|
||||
redirect('sendemail/index');
|
||||
} else {
|
||||
$data['app'] = $this->app->getappbyid();
|
||||
|
||||
$emailpelanggan = $this->input->post('emailpelanggan');
|
||||
$emaildriver = $this->input->post('emaildriver');
|
||||
$emailmitra = $this->input->post('emailmitra');
|
||||
$emailothers = $this->input->post('emailothers');
|
||||
$sendto = $this->input->post('sendto');
|
||||
|
||||
if ($sendto == 'users') {
|
||||
$emailuser = $emailpelanggan;
|
||||
} elseif ($sendto == 'drivers') {
|
||||
$emailuser = $emaildriver;
|
||||
} elseif ($sendto == 'merchant') {
|
||||
$emailuser = $emailmitra;
|
||||
} else {
|
||||
$emailuser = $emailothers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$subject = $this->input->post('subject');
|
||||
$emailmessage = $this->input->post('content');
|
||||
$host = $data['app']['smtp_host'];
|
||||
$port = $data['app']['smtp_port'];
|
||||
$username = $data['app']['smtp_username'];
|
||||
$password = $data['app']['smtp_password'];
|
||||
$from = $data['app']['smtp_from'];
|
||||
$appname = $data['app']['app_name'];
|
||||
$secure = $data['app']['smtp_secure'];
|
||||
$address = $data['app']['app_address'];
|
||||
$linkgoogle = $data['app']['app_linkgoogle'];
|
||||
$web = $data['app']['app_website'];
|
||||
|
||||
$content = $this->email_model->template2($subject, $emailmessage, $address, $appname, $linkgoogle, $web);
|
||||
$this->email_model->emailsend($subject, $emailuser, $content, $host, $port, $username, $password, $from, $appname, $secure);
|
||||
$this->session->set_flashdata('send', 'Email berhasil dikirim');
|
||||
|
||||
|
||||
redirect('sendemail');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Services extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
|
||||
$this->load->model('service_model', 'service');
|
||||
// $this->load->model('news_model', 'news');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = $this->service->getcurrency();
|
||||
$data['service'] = $this->service->getallservice();
|
||||
$data['driverjob'] = $this->service->getAlldriverjob();
|
||||
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('services/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function ubah($id)
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('home', 'home', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('biaya', 'biaya', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('keterangan_biaya', 'keterangan_biaya', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('komisi', 'komisi', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('biaya_minimum', 'biaya_minimum', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('jarak_minimum', 'jarak_minimum', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('maks_distance', 'maks_distance', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('wallet_minimum', 'wallet_minimum', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('keterangan', 'keterangan', 'trim|prep_for_form');
|
||||
|
||||
$data = $this->service->getfiturbyid($id);
|
||||
$data['job'] = $this->service->getalldriverjob($id);
|
||||
$data['driverjob'] = $this->service->getAlldriverjob();
|
||||
|
||||
$id = html_escape($this->input->post('id_fitur', TRUE));
|
||||
// $data['service'] = $this->service->getallservice();
|
||||
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/fitur/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('icon')) {
|
||||
if ($data['icon'] != 'noimage.jpg') {
|
||||
$gambar = $data['icon'];
|
||||
unlink('images/fitur/' . $gambar);
|
||||
}
|
||||
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = $data['icon'];
|
||||
}
|
||||
|
||||
$biaya = html_escape($this->input->post('biaya', TRUE));
|
||||
$biaya_minimum = html_escape($this->input->post('biaya_minimum', TRUE));
|
||||
$wallet_minimum = html_escape($this->input->post('wallet_minimum', TRUE));
|
||||
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
|
||||
$data = [
|
||||
'icon' => $gambar,
|
||||
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
|
||||
'fitur' => html_escape($this->input->post('fitur', TRUE)),
|
||||
'home' => html_escape($this->input->post('home', TRUE)),
|
||||
'urutan' => html_escape($this->input->post('urutan', TRUE)),
|
||||
'biaya' => str_replace($remove, $add, $biaya),
|
||||
'keterangan_biaya' => html_escape($this->input->post('keterangan_biaya', TRUE)),
|
||||
'komisi' => html_escape($this->input->post('komisi', TRUE)),
|
||||
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
|
||||
'biaya_minimum' => str_replace($remove, $add, $biaya_minimum),
|
||||
'jarak_minimum' => html_escape($this->input->post('jarak_minimum', TRUE)),
|
||||
'maks_distance' => html_escape($this->input->post('maks_distance', TRUE)),
|
||||
'wallet_minimum' => str_replace($remove, $add, $wallet_minimum),
|
||||
'keterangan' => html_escape($this->input->post('keterangan', TRUE)),
|
||||
'nilai' => html_escape($this->input->post('nilai', TRUE)),
|
||||
'keterangan' => html_escape($this->input->post('keterangan', TRUE)),
|
||||
'active' => html_escape($this->input->post('active', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('services/index');
|
||||
} else {
|
||||
|
||||
$this->service->ubahdatafitur($data);
|
||||
$this->session->set_flashdata('ubah', 'Services Has Been Changed');
|
||||
redirect('services');
|
||||
}
|
||||
} else {
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('services/editservices' . $id, $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function addservice()
|
||||
|
||||
{
|
||||
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('home', 'home', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('biaya', 'biaya', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('keterangan_biaya', 'keterangan_biaya', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('komisi', 'komisi', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('biaya_minimum', 'biaya_minimum', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('jarak_minimum', 'jarak_minimum', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('maks_distance', 'maks_distance', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('wallet_minimum', 'wallet_minimum', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('keterangan', 'keterangan', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('nilai', 'nilai', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('active', 'active', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$config['upload_path'] = './images/fitur/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('icon')) {
|
||||
$gambar = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$gambar = 'noimage.jpg';
|
||||
}
|
||||
|
||||
$biaya = html_escape($this->input->post('biaya', TRUE));
|
||||
$biaya_minimum = html_escape($this->input->post('biaya_minimum', TRUE));
|
||||
$wallet_minimum = html_escape($this->input->post('wallet_minimum', TRUE));
|
||||
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
|
||||
$data = [
|
||||
'icon' => $gambar,
|
||||
'fitur' => html_escape($this->input->post('fitur', TRUE)),
|
||||
'home' => html_escape($this->input->post('home', TRUE)),
|
||||
'biaya' => str_replace($remove, $add, $biaya),
|
||||
'keterangan_biaya' => html_escape($this->input->post('keterangan_biaya', TRUE)),
|
||||
'komisi' => html_escape($this->input->post('komisi', TRUE)),
|
||||
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
|
||||
'biaya_minimum' => str_replace($remove, $add, $biaya_minimum),
|
||||
'jarak_minimum' => html_escape($this->input->post('jarak_minimum', TRUE)),
|
||||
'maks_distance' => html_escape($this->input->post('maks_distance', TRUE)),
|
||||
'wallet_minimum' => str_replace($remove, $add, $wallet_minimum),
|
||||
'keterangan' => html_escape($this->input->post('keterangan', TRUE)),
|
||||
'active' => html_escape($this->input->post('active', TRUE))
|
||||
];
|
||||
|
||||
$datanilai = [
|
||||
|
||||
'nilai' => html_escape($this->input->post('nilai', TRUE)),
|
||||
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('services/index');
|
||||
} else {
|
||||
|
||||
$this->service->tambahdatafitur($data, $datanilai);
|
||||
$this->session->set_flashdata('ubah', 'Services Has Been Added');
|
||||
redirect('services');
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$data['driverjob'] = $this->service->getAlldriverjob();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('services/addservice', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusservice($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('services/index');
|
||||
} else {
|
||||
$data = $this->service->getfiturbyid($id);
|
||||
|
||||
if ($data['icon'] != 'noimage.jpg') {
|
||||
$gambar = $data['icon'];
|
||||
|
||||
}
|
||||
|
||||
$this->service->hapusserviceById($id);
|
||||
$this->session->set_flashdata('hapus', 'Service Has Been deleted');
|
||||
redirect('services');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class transaction extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
$this->load->model('Appsettings_model', 'app');
|
||||
$this->load->model('Dashboard_model', 'dashboard');
|
||||
// $this->load->library('form_validation');
|
||||
$params = array('server_key' => 'your_server_key', 'production' => false);
|
||||
$this->load->library('veritrans');
|
||||
$this->veritrans->config($params);
|
||||
$this->load->helper('url');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['transaksi'] = $this->dashboard->getAlltransaksi();
|
||||
$data['transaksi1'] = $this->dashboard->getAlltransaksi1();
|
||||
$data['transaksi3'] = $this->dashboard->getAlltransaksi3();
|
||||
$data['fitur'] = $this->dashboard->getAllfitur();
|
||||
$data['saldo'] = $this->dashboard->getallsaldo();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('transaction/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
$data['currency'] = $this->app->getappbyid();
|
||||
$data['transaksi'] = $this->dashboard->getAlltransaksi();
|
||||
$data['fitur'] = $this->dashboard->getAllfitur();
|
||||
$data['saldo'] = $this->dashboard->getallsaldo();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('transaction/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
|
||||
$order_id = $this->input->post('order_id');
|
||||
$action = $this->input->post('action');
|
||||
switch ($action) {
|
||||
case 'status':
|
||||
$this->status($order_id);
|
||||
break;
|
||||
case 'approve':
|
||||
$this->approve($order_id);
|
||||
break;
|
||||
case 'expire':
|
||||
$this->expire($order_id);
|
||||
break;
|
||||
case 'cancel':
|
||||
$this->cancel($order_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function status($order_id)
|
||||
{
|
||||
echo 'test get status </br>';
|
||||
print_r($this->veritrans->status($order_id));
|
||||
}
|
||||
|
||||
public function cancel($order_id)
|
||||
{
|
||||
echo 'test cancel trx </br>';
|
||||
echo $this->veritrans->cancel($order_id);
|
||||
}
|
||||
|
||||
public function approve($order_id)
|
||||
{
|
||||
echo 'test get approve </br>';
|
||||
print_r($this->veritrans->approve($order_id));
|
||||
}
|
||||
|
||||
public function expire($order_id)
|
||||
{
|
||||
echo 'test get expire </br>';
|
||||
print_r($this->veritrans->expire($order_id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Users extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
// $this->load->model('Appsettings_model', 'app');
|
||||
$this->load->model('Users_model', 'user');
|
||||
$this->load->model('Pelanggan_model');
|
||||
$this->load->library('form_validation');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data['user'] = $this->user->getallusers();
|
||||
// $data['transaksi']= $this->dashboard->getAlltransaksi();
|
||||
// $data['fitur']= $this->dashboard->getAllfitur();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('users/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
$data = $this->user->getcurrency();
|
||||
$data['user'] = $this->user->getusersbyid($id);
|
||||
$data['countorder'] = $this->user->countorder($id);
|
||||
$data['wallet'] = $this->user->wallet($id);
|
||||
// $data['fitur']= $this->dashboard->getAllfitur();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('users/detailusers', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function block($id)
|
||||
{
|
||||
$this->user->blockusersById($id);
|
||||
$this->session->set_flashdata('block', 'blocked');
|
||||
redirect('users');
|
||||
}
|
||||
|
||||
public function unblock($id)
|
||||
{
|
||||
$this->user->unblockusersById($id);
|
||||
$this->session->set_flashdata('block', 'unblock');
|
||||
redirect('users');
|
||||
}
|
||||
|
||||
public function ubahid()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('fullnama', 'fullnama', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('no_telepon', 'no_telepon', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('email', 'email', 'trim|prep_for_form');
|
||||
$id = html_escape($this->input->post('id', TRUE));
|
||||
|
||||
$countrycode = html_escape($this->input->post('countrycode', TRUE));
|
||||
$phone = html_escape($this->input->post('phone', TRUE));
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$data = [
|
||||
'phone' => html_escape($this->input->post('phone', TRUE)),
|
||||
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'fullnama' => html_escape($this->input->post('fullnama', TRUE)),
|
||||
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
|
||||
'email' => html_escape($this->input->post('email', TRUE)),
|
||||
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE))
|
||||
];
|
||||
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('users/detail/' . $id);
|
||||
} else {
|
||||
$this->user->ubahdataid($data);
|
||||
$this->session->set_flashdata('ubah', 'User Has Been Change');
|
||||
redirect('users/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
|
||||
$data = $this->user->getcurrency();
|
||||
$data['user'] = $this->user->getusersbyid($id);
|
||||
$data['countorder'] = $this->user->countorder($id);
|
||||
// $data['transaksi']= $this->dashboard->getAlltransaksi();
|
||||
// $data['fitur']= $this->dashboard->getAllfitur();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('users/detailusers', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahfoto()
|
||||
{
|
||||
|
||||
$config['upload_path'] = './images/pelanggan/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
$id = $id = html_escape($this->input->post('id', TRUE));
|
||||
$data = $this->user->getusersbyid($id);
|
||||
|
||||
if ($this->upload->do_upload('fotopelanggan')) {
|
||||
if ($data['fotopelanggan'] != 'noimage.jpg') {
|
||||
$gambar = $data['fotopelanggan'];
|
||||
unlink('images/pelanggan/' . $gambar);
|
||||
}
|
||||
|
||||
$foto = html_escape($this->upload->data('file_name'));
|
||||
|
||||
$data = [
|
||||
'fotopelanggan' => $foto,
|
||||
'id' => html_escape($this->input->post('id', TRUE))
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('users/detail/' . $id);
|
||||
} else {
|
||||
$this->user->ubahdatafoto($data);
|
||||
$this->session->set_flashdata('ubah', 'User Has Been Change');
|
||||
redirect('users/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
|
||||
$data = $this->user->getcurrency();
|
||||
$data['user'] = $this->user->getusersbyid($id);
|
||||
$data['countorder'] = $this->user->countorder($id);
|
||||
// $data['transaksi']= $this->dashboard->getAlltransaksi();
|
||||
// $data['fitur']= $this->dashboard->getAllfitur();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('users/detailusers', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function ubahpass()
|
||||
{
|
||||
|
||||
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
$id = $this->input->post('id');
|
||||
$data = $this->input->post('password');
|
||||
$dataencrypt = sha1($data);
|
||||
|
||||
$data = [
|
||||
'id' => html_escape($this->input->post('id', TRUE)),
|
||||
'password' => $dataencrypt
|
||||
];
|
||||
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('users/detail/' . $id);
|
||||
} else {
|
||||
$this->user->ubahdatapassword($data);
|
||||
$this->session->set_flashdata('ubah', 'User Has Been Change');
|
||||
redirect('users/detail/' . $id);
|
||||
}
|
||||
} else {
|
||||
$data = $this->user->getcurrency();
|
||||
$data['user'] = $this->user->getusersbyid($id);
|
||||
$data['countorder'] = $this->user->countorder($id);
|
||||
// $data['transaksi']= $this->dashboard->getAlltransaksi();
|
||||
// $data['fitur']= $this->dashboard->getAllfitur();
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('users/detailusers', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function userblock($id)
|
||||
{
|
||||
$this->user->blockuserbyid($id);
|
||||
redirect('users');
|
||||
}
|
||||
|
||||
public function userunblock($id)
|
||||
{
|
||||
$this->user->unblockuserbyid($id);
|
||||
redirect('users');
|
||||
}
|
||||
|
||||
public function tambah()
|
||||
{
|
||||
$password = html_escape($this->input->post('password', TRUE));
|
||||
$countrycode = html_escape($this->input->post('countrycode', TRUE));
|
||||
$phone = html_escape($this->input->post('phone', TRUE));
|
||||
$email = html_escape($this->input->post('email', TRUE));
|
||||
|
||||
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
|
||||
$this->form_validation->set_rules('phone', 'PHONE', 'trim|prep_for_form|is_unique[pelanggan.phone]');
|
||||
$this->form_validation->set_rules('email', 'EMAIL', 'trim|prep_for_form|is_unique[pelanggan.email]');
|
||||
$this->form_validation->set_rules('password', 'PASSWORD', 'trim|prep_for_form');
|
||||
|
||||
if ($this->form_validation->run() == TRUE) {
|
||||
|
||||
$config['upload_path'] = './images/pelanggan/';
|
||||
$config['allowed_types'] = 'gif|jpg|png|jpeg';
|
||||
$config['max_size'] = '100000';
|
||||
$config['file_name'] = 'name';
|
||||
$config['encrypt_name'] = true;
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ($this->upload->do_upload('fotopelanggan')) {
|
||||
|
||||
$foto = html_escape($this->upload->data('file_name'));
|
||||
} else {
|
||||
$foto = 'noimage.jpg';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
|
||||
'id' => 'P' . time(),
|
||||
'phone' => html_escape($this->input->post('phone', TRUE)),
|
||||
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
|
||||
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE)),
|
||||
'token' => 'T' . time(),
|
||||
'fotopelanggan' => $foto,
|
||||
'fullnama' => html_escape($this->input->post('fullnama', TRUE)),
|
||||
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
|
||||
'email' => html_escape($this->input->post('email', TRUE)),
|
||||
'password' => sha1($password),
|
||||
|
||||
];
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('users/index');
|
||||
} else {
|
||||
|
||||
$this->user->tambahdatausers($data);
|
||||
$this->session->set_flashdata('tambah', 'User Has Been Added');
|
||||
redirect('users/index');
|
||||
}
|
||||
} else {
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('users/tambahuser');
|
||||
$this->load->view('includes/footer');
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public function hapususers($id)
|
||||
{
|
||||
if (demo == TRUE) {
|
||||
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
|
||||
redirect('users/index');
|
||||
} else {
|
||||
$data = $this->user->getusersbyid($id);
|
||||
$gambar = $data['fotopelanggan'];
|
||||
unlink('images/pelanggan/' . $gambar);
|
||||
|
||||
$this->user->hapusdatauserbyid($id);
|
||||
|
||||
$this->session->set_flashdata('hapus', 'User Has Been Deleted');
|
||||
redirect('users/index');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Wallet extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
is_logged_in();
|
||||
// $this->load->library('form_validation');
|
||||
$this->load->model('wallet_model', 'wallet');
|
||||
$this->load->model('users_model', 'user');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data['jumlahdiskon'] = $this->wallet->getjumlahdiskon();
|
||||
$data['orderplus'] = $this->wallet->gettotalorderplus();
|
||||
$data['ordermin'] = $this->wallet->gettotalordermin();
|
||||
$data['withdraw'] = $this->wallet->gettotalwithdraw();
|
||||
$data['topup'] = $this->wallet->gettotaltopup();
|
||||
$data['saldo'] = $this->wallet->getallsaldo();
|
||||
$data['currency'] = $this->user->getcurrency();
|
||||
$data['wallet'] = $this->wallet->getwallet();
|
||||
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('wallet/index', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
|
||||
public function wconfirm($id, $id_user, $amount)
|
||||
{
|
||||
$token = $this->wallet->gettoken($id_user);
|
||||
$regid = $this->wallet->getregid($id_user);
|
||||
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
|
||||
|
||||
if ($token == NULL and $tokenmerchant == NULL and $regid != NULL) {
|
||||
$topic = $regid['reg_id'];
|
||||
} else if ($regid == NULL and $tokenmerchant == NULL and $token != NULL) {
|
||||
$topic = $token['token'];
|
||||
} else if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
|
||||
$topic = $tokenmerchant['token_merchant'];
|
||||
}
|
||||
|
||||
$title = 'Sukses';
|
||||
$message = 'Permintaan berhasil dikirim';
|
||||
$saldo = $this->wallet->getsaldo($id_user);
|
||||
|
||||
|
||||
|
||||
$this->wallet->ubahsaldo($id_user, $amount, $saldo);
|
||||
$this->wallet->ubahstatuswithdrawbyid($id);
|
||||
$this->wallet->send_notif($title, $message, $topic);
|
||||
$this->session->set_flashdata('ubah', 'Permintaan berhasil dikirim');
|
||||
redirect('wallet/index');
|
||||
}
|
||||
|
||||
public function wcancel($id, $id_user)
|
||||
{
|
||||
$token = $this->wallet->gettoken($id_user);
|
||||
$regid = $this->wallet->getregid($id_user);
|
||||
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
|
||||
|
||||
if ($token == NULL and $tokenmerchant == NULL and $regid != NULL) {
|
||||
$topic = $regid['reg_id'];
|
||||
} else if ($regid == NULL and $tokenmerchant == NULL and $token != NULL) {
|
||||
$topic = $token['token'];
|
||||
} else if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
|
||||
$topic = $tokenmerchant['token_merchant'];
|
||||
}
|
||||
|
||||
$title = 'Permintaan dibatalkan';
|
||||
$message = 'Mohon maaf permintaan dibatalkan';
|
||||
|
||||
$this->wallet->cancelstatuswithdrawbyid($id);
|
||||
$this->wallet->send_notif($title, $message, $topic);
|
||||
$this->session->set_flashdata('ubah', 'Permintaan dibatalkan');
|
||||
redirect('wallet/index');
|
||||
}
|
||||
|
||||
public function tconfirm($id, $id_user, $amount)
|
||||
{
|
||||
$token = $this->wallet->gettoken($id_user);
|
||||
$regid = $this->wallet->getregid($id_user);
|
||||
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
|
||||
|
||||
if ($token == NULL and $tokenmerchant == NULL and $regid != NULL) {
|
||||
$topic = $regid['reg_id'];
|
||||
} else if ($regid == NULL and $tokenmerchant == NULL and $token != NULL) {
|
||||
$topic = $token['token'];
|
||||
} else if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
|
||||
$topic = $tokenmerchant['token_merchant'];
|
||||
}
|
||||
|
||||
$title = 'Topup berhasil';
|
||||
$message = 'Permintaan topup berhasil';
|
||||
$saldo = $this->wallet->getsaldo($id_user);
|
||||
|
||||
|
||||
|
||||
$this->wallet->ubahsaldotopup($id_user, $amount, $saldo);
|
||||
$this->wallet->ubahstatuswithdrawbyid($id);
|
||||
$this->wallet->send_notif($title, $message, $topic);
|
||||
$this->session->set_flashdata('ubah', 'Permintaan topup berhasil');
|
||||
redirect('wallet/index');
|
||||
}
|
||||
|
||||
public function tcancel($id, $id_user)
|
||||
{
|
||||
$token = $this->wallet->gettoken($id_user);
|
||||
$regid = $this->wallet->getregid($id_user);
|
||||
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
|
||||
|
||||
if ($token == NULL and $regid != NULL) {
|
||||
$topic = $regid['reg_id'];
|
||||
}
|
||||
|
||||
if ($regid == NULL and $token != NULL) {
|
||||
$topic = $token['token'];
|
||||
}
|
||||
|
||||
if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
|
||||
$topic = $tokenmerchant['token_merchant'];
|
||||
}
|
||||
|
||||
$title = 'Topup dibatalkan';
|
||||
$message = 'Maaf, topup dibatalkan';
|
||||
|
||||
$this->wallet->cancelstatuswithdrawbyid($id);
|
||||
$this->wallet->send_notif($title, $message, $topic);
|
||||
$this->session->set_flashdata('ubah', 'topup dibatalkan');
|
||||
redirect('wallet/index');
|
||||
}
|
||||
|
||||
public function tambahtopup()
|
||||
{
|
||||
$data['currency'] = $this->user->getcurrency();
|
||||
$data['saldo'] = $this->wallet->getallsaldouser();
|
||||
|
||||
|
||||
if ($_POST != NULL) {
|
||||
|
||||
|
||||
if ($this->input->post('type_user') == 'pelanggan') {
|
||||
$id_user = $this->input->post('id_pelanggan');
|
||||
} elseif ($this->input->post('type_user') == 'mitra') {
|
||||
$id_user = $this->input->post('id_mitra');
|
||||
} else {
|
||||
$id_user = $this->input->post('id_driver');
|
||||
}
|
||||
|
||||
$saldo = html_escape($this->input->post('saldo', TRUE));
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
|
||||
$data = [
|
||||
'id_user' => $id_user,
|
||||
'saldo' => str_replace($remove, $add, $saldo),
|
||||
'type_user' => $this->input->post('type_user')
|
||||
];
|
||||
|
||||
|
||||
$this->wallet->updatesaldowallet($data);
|
||||
$this->session->set_flashdata('ubah', 'Top Up Has Been Added');
|
||||
redirect('wallet');
|
||||
} else {
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('wallet/tambahtopup', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahwithdraw()
|
||||
{
|
||||
$data['currency'] = $this->user->getcurrency();
|
||||
$data['saldo'] = $this->wallet->getallsaldouser();
|
||||
|
||||
if ($_POST != NULL) {
|
||||
|
||||
|
||||
if ($this->input->post('type_user') == 'pelanggan') {
|
||||
$id_user = $this->input->post('id_pelanggan');
|
||||
} elseif ($this->input->post('type_user') == 'mitra') {
|
||||
$id_user = $this->input->post('id_mitra');
|
||||
} else {
|
||||
$id_user = $this->input->post('id_driver');
|
||||
}
|
||||
|
||||
|
||||
$saldo = html_escape($this->input->post('saldo', TRUE));
|
||||
$remove = array(".", ",");
|
||||
$add = array("", "");
|
||||
|
||||
$data = [
|
||||
'id_user' => $id_user,
|
||||
'saldo' => str_replace($remove, $add, $saldo),
|
||||
'type_user' => $this->input->post('type_user')
|
||||
];
|
||||
|
||||
$data2 = [
|
||||
'bank' => $this->input->post('bank'),
|
||||
'nama_pemilik' => $this->input->post('nama_pemilik'),
|
||||
'rekening' => $this->input->post('rekening'),
|
||||
];
|
||||
|
||||
|
||||
$this->wallet->updatesaldowalletwithdraw($data, $data2);
|
||||
$this->session->set_flashdata('ubah', 'Permintaan berhasil ditambah');
|
||||
redirect('wallet');
|
||||
} else {
|
||||
$this->load->view('includes/header');
|
||||
$this->load->view('wallet/tambahwithdraw', $data);
|
||||
$this->load->view('includes/footer');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
require APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
class Map extends REST_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper(array('url', 'maps_helper', 'quota_limiter'));
|
||||
date_default_timezone_set('Asia/Jakarta');
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
$this->response(array(
|
||||
'message' => 'Map API ready',
|
||||
), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/map/directions
|
||||
* Body: { "origin_lat": 0.0, "origin_lng": 0.0, "dest_lat": 0.0, "dest_lng": 0.0, "mode": "driving" }
|
||||
*/
|
||||
public function directions_post()
|
||||
{
|
||||
// Simple per-IP quota limiting for map directions.
|
||||
$hour_limit = (defined('MAPS_LIMIT_PER_HOUR') && MAPS_LIMIT_PER_HOUR !== '') ? (int) MAPS_LIMIT_PER_HOUR : 1000;
|
||||
$day_limit = (defined('MAPS_LIMIT_PER_DAY') && MAPS_LIMIT_PER_DAY !== '') ? (int) MAPS_LIMIT_PER_DAY : 5000;
|
||||
$limits = array(
|
||||
'hour' => $hour_limit,
|
||||
'day' => $day_limit,
|
||||
);
|
||||
$key = 'maps:ip:' . $this->input->ip_address();
|
||||
if (!quota_limiter_allow($key, $limits)) {
|
||||
$this->response(array(
|
||||
'code' => '429',
|
||||
'message' => 'maps_quota_exceeded',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
if (!is_array($data)) {
|
||||
$this->response(array(
|
||||
'code' => '400',
|
||||
'message' => 'invalid_json',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($data['origin_lat'], $data['origin_lng'], $data['dest_lat'], $data['dest_lng'])) {
|
||||
$this->response(array(
|
||||
'code' => '400',
|
||||
'message' => 'missing_coordinates',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$mode = isset($data['mode']) && is_string($data['mode']) ? $data['mode'] : 'driving';
|
||||
|
||||
$result = maps_directions(
|
||||
(float) $data['origin_lat'],
|
||||
(float) $data['origin_lng'],
|
||||
(float) $data['dest_lat'],
|
||||
(float) $data['dest_lng'],
|
||||
$mode
|
||||
);
|
||||
|
||||
if ($result === null) {
|
||||
$this->response(array(
|
||||
'code' => '500',
|
||||
'message' => 'maps_error',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proxy Google Directions JSON structure directly so clients can parse as before.
|
||||
$this->response($result, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/map/geocode
|
||||
* Body: { "lat": 0.0, "lng": 0.0 }
|
||||
*/
|
||||
public function geocode_post()
|
||||
{
|
||||
$hour_limit = (defined('MAPS_LIMIT_PER_HOUR') && MAPS_LIMIT_PER_HOUR !== '') ? (int) MAPS_LIMIT_PER_HOUR : 1000;
|
||||
$day_limit = (defined('MAPS_LIMIT_PER_DAY') && MAPS_LIMIT_PER_DAY !== '') ? (int) MAPS_LIMIT_PER_DAY : 5000;
|
||||
$limits = array(
|
||||
'hour' => $hour_limit,
|
||||
'day' => $day_limit,
|
||||
);
|
||||
$key = 'maps:ip:' . $this->input->ip_address() . ':geocode';
|
||||
if (!quota_limiter_allow($key, $limits)) {
|
||||
$this->response(array(
|
||||
'code' => '429',
|
||||
'message' => 'maps_quota_exceeded',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
if (!is_array($data)) {
|
||||
$this->response(array(
|
||||
'code' => '400',
|
||||
'message' => 'invalid_json',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($data['lat'], $data['lng'])) {
|
||||
$this->response(array(
|
||||
'code' => '400',
|
||||
'message' => 'missing_lat_lng',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$result = maps_geocode((float) $data['lat'], (float) $data['lng']);
|
||||
if ($result === null) {
|
||||
$this->response(array(
|
||||
'code' => '500',
|
||||
'message' => 'maps_error',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
// Proxy Google Geocode JSON structure directly.
|
||||
$this->response($result, 200);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
$server_key = "SB-Mid-server-hsIqSFfLTy9a5YPggvT48agq";
|
||||
|
||||
$is_production = false;
|
||||
|
||||
$api_url = $is_production ?
|
||||
'https://app.midtrans.com/snap/v1/transactions' :
|
||||
'https://app.sandbox.midtrans.com/snap/v1/transactions';
|
||||
|
||||
|
||||
if (!strpos($_SERVER['REQUEST_URI'], '/charge')) {
|
||||
http_response_code(404);
|
||||
echo "wrong path, make sure it's `/charge`";
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
http_response_code(404);
|
||||
echo "Page not found or wrong HTTP request method is used";
|
||||
exit();
|
||||
}
|
||||
|
||||
$request_body = file_get_contents('php://input');
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$charge_result = chargeAPI($api_url, $server_key, $request_body);
|
||||
|
||||
http_response_code($charge_result['http_code']);
|
||||
|
||||
echo $charge_result['body'];
|
||||
|
||||
|
||||
function chargeAPI($api_url, $server_key, $request_body)
|
||||
{
|
||||
$ch = curl_init();
|
||||
$curl_options = array(
|
||||
CURLOPT_URL => $api_url,
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
CURLOPT_POST => 1,
|
||||
CURLOPT_HEADER => 0,
|
||||
|
||||
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Basic ' . base64_encode($server_key . ':')
|
||||
),
|
||||
CURLOPT_POSTFIELDS => $request_body
|
||||
);
|
||||
curl_setopt_array($ch, $curl_options);
|
||||
$result = array(
|
||||
'body' => curl_exec($ch),
|
||||
'http_code' => curl_getinfo($ch, CURLINFO_HTTP_CODE),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
require APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
class Notification extends REST_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->helper(array('url'));
|
||||
$this->load->model('notification_model', 'notif');
|
||||
date_default_timezone_set('Asia/Jakarta');
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple health check for the notification API.
|
||||
*/
|
||||
public function index_get()
|
||||
{
|
||||
$this->response(array(
|
||||
'message' => 'Notification API ready',
|
||||
), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic FCM send endpoint.
|
||||
*
|
||||
* Expected JSON body:
|
||||
* {
|
||||
* "target": "device_or_topic",
|
||||
* "is_topic": false,
|
||||
* "data": { ... arbitrary key/value pairs ... },
|
||||
* "title": "optional notification title",
|
||||
* "body": "optional notification body"
|
||||
* }
|
||||
*/
|
||||
public function send_generic_post()
|
||||
{
|
||||
$raw = file_get_contents('php://input');
|
||||
$decoded = json_decode($raw, true);
|
||||
if (!is_array($decoded)) {
|
||||
$this->response(array(
|
||||
'code' => '400',
|
||||
'message' => 'invalid_json',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$target = isset($decoded['target']) ? trim($decoded['target']) : '';
|
||||
$is_topic = !empty($decoded['is_topic']);
|
||||
$data = isset($decoded['data']) && is_array($decoded['data']) ? $decoded['data'] : array();
|
||||
$title = isset($decoded['title']) ? (string) $decoded['title'] : '';
|
||||
$body = isset($decoded['body']) ? (string) $decoded['body'] : '';
|
||||
|
||||
if ($target === '' || empty($data)) {
|
||||
$this->response(array(
|
||||
'code' => '400',
|
||||
'message' => 'missing_target_or_data',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
if ($title !== '' || $body !== '') {
|
||||
$options['title'] = $title;
|
||||
$options['body'] = $body;
|
||||
}
|
||||
|
||||
if ($is_topic) {
|
||||
$result = $this->notif->send_generic_to_topic($target, $data, $options);
|
||||
} else {
|
||||
$result = $this->notif->send_generic_to_token($target, $data, $options);
|
||||
}
|
||||
|
||||
if ($result === false) {
|
||||
$this->response(array(
|
||||
'code' => '500',
|
||||
'message' => 'fcm_send_failed_or_quota_exceeded',
|
||||
), 200);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response(array(
|
||||
'code' => '200',
|
||||
'message' => 'success',
|
||||
), 200);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class Xendit extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('appsettings_model', 'app');
|
||||
}
|
||||
|
||||
public function data_post()
|
||||
{
|
||||
|
||||
$model = $this->app->getappbyid();
|
||||
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
$key = $model['api_keyxendit']; //jika ganti xendit akun cukup ubah ini aja
|
||||
$pass = "";
|
||||
if($data['ServerKey'] == $model['apikey_server']){ //dan ini untuk sisi authorization dari android request ke server kita "UkFKQU1BU1RFUlNFUlZFUg=="
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://api.xendit.co/ewallets",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => false,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($data),
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
"Authorization: Basic ".base64_encode("$key:$pass")."",
|
||||
"Content-Type: application/json",
|
||||
//"Cookie: nlbi_2182539=BeDEGL4nnQIMRSl/jjCKbQAAAACdtzIPLHKtA/1t0rshQlnG; visid_incap_2182539=T63r/YikR3SNAzVcIiMVuBJtRl8AAAAAQUIPAAAAAAAO48RqXhljt8XIX4HsIaBQ; incap_ses_1114_2182539=ilBwI4mA+ynuqcDyQrl1DxJtRl8AAAAApLvYahTdJBFGMhOzY0AX0A=="
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
echo $response;
|
||||
}else{
|
||||
echo json_encode(array(['msg'=> "Failed Key", 'code'=> 500]));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Notification extends CI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see http://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$params = array('server_key' => 'your_server_key', 'production' => false);
|
||||
$this->load->library('midtrans');
|
||||
$this->midtrans->config($params);
|
||||
$this->load->helper('url');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo 'test notification handler';
|
||||
$json_result = file_get_contents('php://input');
|
||||
$result = json_decode($json_result);
|
||||
|
||||
if ($result) {
|
||||
$notif = $this->midtrans->status($result->order_id);
|
||||
}
|
||||
|
||||
error_log(print_r($result, TRUE));
|
||||
|
||||
|
||||
|
||||
//notification handler sample
|
||||
|
||||
$transaction = $notif->transaction_status;
|
||||
$type = $notif->payment_type;
|
||||
$order_id = $notif->order_id;
|
||||
$fraud = $notif->fraud_status;
|
||||
|
||||
if ($transaction == 'capture') {
|
||||
// For credit card transaction, we need to check whether transaction is challenge by FDS or not
|
||||
if ($type == 'credit_card') {
|
||||
if ($fraud == 'challenge') {
|
||||
// TODO set payment status in merchant's database to 'Challenge by FDS'
|
||||
// TODO merchant should decide whether this transaction is authorized or not in MAP
|
||||
echo "Transaction order_id: " . $order_id . " is challenged by FDS";
|
||||
} else {
|
||||
// TODO set payment status in merchant's database to 'Success'
|
||||
echo "Transaction order_id: " . $order_id . " successfully captured using " . $type;
|
||||
}
|
||||
}
|
||||
} else if ($transaction == 'settlement') {
|
||||
// TODO set payment status in merchant's database to 'Settlement'
|
||||
echo "Transaction order_id: " . $order_id . " successfully transfered using " . $type;
|
||||
} else if ($transaction == 'pending') {
|
||||
// TODO set payment status in merchant's database to 'Pending'
|
||||
echo "Waiting customer to finish transaction order_id: " . $order_id . " using " . $type;
|
||||
} else if ($transaction == 'deny') {
|
||||
// TODO set payment status in merchant's database to 'Denied'
|
||||
echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is denied.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
require APPPATH . '/libraries/Midtrans.php';
|
||||
//require APPPATH . '/libraries/Veritrans.php';
|
||||
class Snap extends CI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see http://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$params = array('server_key' => 'SB-Mid-server-qjMkTCJmmL0DwPIBM3KPLul', 'midtrans_status' => false);
|
||||
$this->midtrans->config($params);
|
||||
$this->load->helper('url');
|
||||
$this->load->model('Pelanggan_model');
|
||||
$this->load->library('midtrans');
|
||||
$this->veritrans->config($params);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
// Required
|
||||
$transaction_details = array(
|
||||
'order_id' => $this->db->get_where('transaction_details_Midtrans', 'order_detail' . uniqid()()),
|
||||
'gross_amount' => 10000, // no decimal allowed for creditcard
|
||||
);
|
||||
|
||||
// Optional
|
||||
$item_details = array(
|
||||
'id' => $this->Pelanggan_model->get_data_pelanggan('pelanggan', 'fullnama')->row_array(),
|
||||
'price' => $this->db->get_where('item', 'harga_item')->row_array(),
|
||||
'kategori_item' => $this->db->get_where('item', 'kategori_item')->row_array(),
|
||||
'name' => $this->db->get_where('item', 'nama_item')->row_array()
|
||||
);
|
||||
|
||||
// Optional
|
||||
$billing_address = array(
|
||||
$this->db->get('pelanggan')->result_array()
|
||||
);
|
||||
|
||||
// Data yang akan dikirim untuk request redirect_url.
|
||||
$credit_card['save_card'] = true;
|
||||
//ser save_card true to enable oneclick or 2click
|
||||
//$credit_card['save_card'] = true;
|
||||
|
||||
$time = time();
|
||||
$custom_expiry = array(
|
||||
'start_time' => date("Y-m-d H:i:s O", $time),
|
||||
'unit' => 'minute',
|
||||
'duration' => 5
|
||||
);
|
||||
|
||||
$transaction_data = array(
|
||||
'transaction_details' => $transaction_details,
|
||||
'item_details' => $item_details,
|
||||
'customer_details' => $billing_address,
|
||||
'credit_card' => $credit_card,
|
||||
'expiry' => $custom_expiry
|
||||
);
|
||||
|
||||
error_log(json_encode($transaction_data));
|
||||
$snapToken = $this->midtrans->getSnapToken($transaction_data);
|
||||
error_log($snapToken);
|
||||
echo $snapToken;
|
||||
}
|
||||
|
||||
public function finish($result)
|
||||
{
|
||||
$result = json_decode($this->input->post('result_data'));
|
||||
echo 'RESULT <br><pre>';
|
||||
var_dump($result);
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Vtweb extends CI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see http://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$params = array('server_key' => 'SB-Mid-server-qjMkTCJmmL0DwPIBM3KPLull', 'production' => false);
|
||||
$this->load->library('veritrans');
|
||||
$this->veritrans->config($params);
|
||||
$this->load->helper('url');
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('checkout_vtweb');
|
||||
}
|
||||
|
||||
public function vtweb_checkout()
|
||||
{
|
||||
$transaction_details = array(
|
||||
'order_id' => uniqid(),
|
||||
'gross_amount' => 200000
|
||||
);
|
||||
|
||||
// Populate items
|
||||
$items = [
|
||||
array(
|
||||
'id' => 'item1',
|
||||
'price' => 100000,
|
||||
'quantity' => 1,
|
||||
'name' => 'Adidas f50'
|
||||
),
|
||||
array(
|
||||
'id' => 'item2',
|
||||
'price' => 50000,
|
||||
'quantity' => 2,
|
||||
'name' => 'Nike N90'
|
||||
)
|
||||
];
|
||||
|
||||
// Populate customer's billing address
|
||||
$billing_address = array(
|
||||
'first_name' => "Andri",
|
||||
'last_name' => "Setiawan",
|
||||
'address' => "Karet Belakang 15A, Setiabudi.",
|
||||
'city' => "Jakarta",
|
||||
'postal_code' => "51161",
|
||||
'phone' => "081322311801",
|
||||
'country_code' => 'IDN'
|
||||
);
|
||||
|
||||
// Populate customer's shipping address
|
||||
$shipping_address = array(
|
||||
'first_name' => "John",
|
||||
'last_name' => "Watson",
|
||||
'address' => "Bakerstreet 221B.",
|
||||
'city' => "Jakarta",
|
||||
'postal_code' => "51162",
|
||||
'phone' => "081322311801",
|
||||
'country_code' => 'IDN'
|
||||
);
|
||||
|
||||
// Populate customer's Info
|
||||
$customer_details = array(
|
||||
'first_name' => "Andri",
|
||||
'last_name' => "Setiawan",
|
||||
'email' => "andrisetiawan@me.com",
|
||||
'phone' => "081322311801",
|
||||
'billing_address' => $billing_address,
|
||||
'shipping_address' => $shipping_address
|
||||
);
|
||||
|
||||
// Data yang akan dikirim untuk request redirect_url.
|
||||
// Uncomment 'credit_card_3d_secure' => true jika transaksi ingin diproses dengan 3DSecure.
|
||||
$transaction_data = array(
|
||||
'payment_type' => 'vtweb',
|
||||
'vtweb' => array(
|
||||
//'enabled_payments' => ['credit_card'],
|
||||
'credit_card_3d_secure' => true
|
||||
),
|
||||
'transaction_details' => $transaction_details,
|
||||
'item_details' => $items,
|
||||
'customer_details' => $customer_details
|
||||
);
|
||||
|
||||
try {
|
||||
$vtweb_url = $this->veritrans->vtweb_charge($transaction_data);
|
||||
header('Location: ' . $vtweb_url);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public function notification()
|
||||
{
|
||||
echo 'test notification handler';
|
||||
$json_result = file_get_contents('php://input');
|
||||
$result = json_decode($json_result);
|
||||
|
||||
if ($result) {
|
||||
$notif = $this->veritrans->status($result->order_id);
|
||||
}
|
||||
|
||||
error_log(print_r($result, TRUE));
|
||||
|
||||
//notification handler sample
|
||||
|
||||
$transaction = $notif->transaction_status;
|
||||
$type = $notif->payment_type;
|
||||
$order_id = $notif->order_id;
|
||||
$fraud = $notif->fraud_status;
|
||||
|
||||
if ($transaction == 'capture') {
|
||||
// For credit card transaction, we need to check whether transaction is challenge by FDS or not
|
||||
if ($type == 'credit_card') {
|
||||
if ($fraud == 'challenge') {
|
||||
// TODO set payment status in merchant's database to 'Challenge by FDS'
|
||||
// TODO merchant should decide whether this transaction is authorized or not in MAP
|
||||
echo "Transaction order_id: " . $order_id . " is challenged by FDS";
|
||||
} else {
|
||||
// TODO set payment status in merchant's database to 'Success'
|
||||
echo "Transaction order_id: " . $order_id . " successfully captured using " . $type;
|
||||
}
|
||||
}
|
||||
} else if ($transaction == 'settlement') {
|
||||
// TODO set payment status in merchant's database to 'Settlement'
|
||||
echo "Transaction order_id: " . $order_id . " successfully transfered using " . $type;
|
||||
} else if ($transaction == 'pending') {
|
||||
// TODO set payment status in merchant's database to 'Pending'
|
||||
echo "Waiting customer to finish transaction order_id: " . $order_id . " using " . $type;
|
||||
} else if ($transaction == 'deny') {
|
||||
// TODO set payment status in merchant's database to 'Denied'
|
||||
echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is denied.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* FCM HTTP v1 API helper (Firebase Cloud Messaging).
|
||||
* Uses OAuth2 access token from service account credentials (env: FCM_CREDENTIALS_PATH or FCM_CREDENTIALS_JSON).
|
||||
* Requires FCM_PROJECT_ID. Optional: FCM_LIMIT_PER_HOUR, FCM_LIMIT_PER_DAY for quota (used by callers).
|
||||
*/
|
||||
|
||||
if (!function_exists('fcm_v1_get_credentials')) {
|
||||
function fcm_v1_get_credentials()
|
||||
{
|
||||
$json = (defined('FCM_CREDENTIALS_JSON') ? FCM_CREDENTIALS_JSON : '');
|
||||
if ($json !== '') {
|
||||
return json_decode($json, true);
|
||||
}
|
||||
$path = (defined('FCM_CREDENTIALS_PATH') ? FCM_CREDENTIALS_PATH : '');
|
||||
if ($path !== '' && is_readable($path)) {
|
||||
return json_decode(file_get_contents($path), true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('fcm_v1_get_access_token')) {
|
||||
/**
|
||||
* Get OAuth2 access token for FCM using service account JWT.
|
||||
* @return string|null Access token or null on failure
|
||||
*/
|
||||
function fcm_v1_get_access_token()
|
||||
{
|
||||
$cred = fcm_v1_get_credentials();
|
||||
if (!$cred || empty($cred['client_email']) || empty($cred['private_key'])) {
|
||||
log_message('error', 'FCM v1: Missing FCM_CREDENTIALS_JSON or FCM_CREDENTIALS_PATH');
|
||||
return null;
|
||||
}
|
||||
$now = time();
|
||||
$jwt = array(
|
||||
'iss' => $cred['client_email'],
|
||||
'sub' => $cred['client_email'],
|
||||
'aud' => 'https://oauth2.googleapis.com/token',
|
||||
'iat' => $now,
|
||||
'exp' => $now + 3600,
|
||||
);
|
||||
$jwt_b64 = fcm_v1_base64url_encode(json_encode(array('alg' => 'RS256', 'typ' => 'JWT')))
|
||||
. '.' . fcm_v1_base64url_encode(json_encode($jwt));
|
||||
$sig = '';
|
||||
$key = openssl_pkey_get_private($cred['private_key']);
|
||||
if (!$key) {
|
||||
log_message('error', 'FCM v1: Invalid private key');
|
||||
return null;
|
||||
}
|
||||
openssl_sign($jwt_b64, $sig, $key, OPENSSL_ALGO_SHA256);
|
||||
openssl_free_key($key);
|
||||
$jwt_b64 .= '.' . fcm_v1_base64url_encode($sig);
|
||||
$resp = @file_get_contents('https://oauth2.googleapis.com/token', false, stream_context_create(array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => "Content-Type: application/x-www-form-urlencoded",
|
||||
'content' => 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=' . $jwt_b64,
|
||||
),
|
||||
)));
|
||||
if ($resp === false) {
|
||||
log_message('error', 'FCM v1: Token request failed');
|
||||
return null;
|
||||
}
|
||||
$data = json_decode($resp, true);
|
||||
return isset($data['access_token']) ? $data['access_token'] : null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('fcm_v1_base64url_encode')) {
|
||||
function fcm_v1_base64url_encode($data)
|
||||
{
|
||||
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('fcm_v1_send')) {
|
||||
/**
|
||||
* Send FCM message via HTTP v1 API.
|
||||
*
|
||||
* @param string $target Device token or topic name (without /topics/ prefix)
|
||||
* @param array $data Key-value data payload (values will be stringified)
|
||||
* @param bool $is_topic True if $target is a topic name
|
||||
* @param array $options Optional: 'title', 'body' for notification; 'priority' => 'high' for Android
|
||||
* @return string|false Response body or false on failure
|
||||
*/
|
||||
function fcm_v1_send($target, $data, $is_topic = false, $options = array())
|
||||
{
|
||||
$project_id = '';
|
||||
if (defined('FCM_PROJECT_ID') && FCM_PROJECT_ID !== '') {
|
||||
$project_id = FCM_PROJECT_ID;
|
||||
}
|
||||
if ($project_id === '') {
|
||||
log_message('error', 'FCM v1: FCM_PROJECT_ID not set');
|
||||
return false;
|
||||
}
|
||||
$token = fcm_v1_get_access_token();
|
||||
if (!$token) {
|
||||
return false;
|
||||
}
|
||||
$data_str = array();
|
||||
foreach ($data as $k => $v) {
|
||||
$data_str[$k] = (string) $v;
|
||||
}
|
||||
$message = array(
|
||||
'data' => $data_str,
|
||||
);
|
||||
if ($is_topic) {
|
||||
$message['topic'] = $target;
|
||||
} else {
|
||||
$message['token'] = $target;
|
||||
}
|
||||
if (!empty($options['title']) || !empty($options['body'])) {
|
||||
$message['notification'] = array(
|
||||
'title' => isset($options['title']) ? (string) $options['title'] : '',
|
||||
'body' => isset($options['body']) ? (string) $options['body'] : '',
|
||||
);
|
||||
}
|
||||
if (isset($options['android']) && is_array($options['android'])) {
|
||||
$message['android'] = $options['android'];
|
||||
} else {
|
||||
$message['android'] = array('priority' => 'HIGH');
|
||||
}
|
||||
$body = json_encode(array('message' => $message));
|
||||
$ctx = stream_context_create(array(
|
||||
'http' => array(
|
||||
'method' => 'POST',
|
||||
'header' =>
|
||||
"Content-Type: application/json\r\n" .
|
||||
"Authorization: Bearer " . $token . "\r\n",
|
||||
'content' => $body,
|
||||
'ignore_errors' => true,
|
||||
),
|
||||
));
|
||||
$url = 'https://fcm.googleapis.com/v1/projects/' . $project_id . '/messages:send';
|
||||
$resp = @file_get_contents($url, false, $ctx);
|
||||
return $resp !== false ? $resp : false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Firebase Auth helper – verify Firebase ID tokens (JWT) for API auth.
|
||||
* Complies with Firebase Auth process: clients can send "Authorization: Bearer <id_token>"
|
||||
* and the backend verifies the token with Google's public keys.
|
||||
* Uses FCM_PROJECT_ID (or FIREBASE_PROJECT_ID) for aud/iss validation.
|
||||
*/
|
||||
|
||||
if (!function_exists('firebase_auth_get_bearer_token')) {
|
||||
/**
|
||||
* Get Bearer token from Authorization header.
|
||||
*
|
||||
* @return string|null Token or null if missing/invalid
|
||||
*/
|
||||
function firebase_auth_get_bearer_token()
|
||||
{
|
||||
$auth = isset($_SERVER['HTTP_AUTHORIZATION']) ? $_SERVER['HTTP_AUTHORIZATION'] : '';
|
||||
if ($auth === '' && function_exists('apache_request_headers')) {
|
||||
$headers = apache_request_headers();
|
||||
$auth = isset($headers['Authorization']) ? $headers['Authorization'] : (isset($headers['authorization']) ? $headers['authorization'] : '');
|
||||
}
|
||||
if (preg_match('/^\s*Bearer\s+(\S+)\s*$/i', $auth, $m)) {
|
||||
return $m[1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('firebase_auth_base64url_decode')) {
|
||||
function firebase_auth_base64url_decode($data)
|
||||
{
|
||||
$pad = 4 - (strlen($data) % 4);
|
||||
if ($pad !== 4) {
|
||||
$data .= str_repeat('=', $pad);
|
||||
}
|
||||
return base64_decode(strtr($data, '-_', '+/'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('firebase_auth_fetch_google_jwks')) {
|
||||
/**
|
||||
* Fetch and cache Firebase Auth public keys (JWK set).
|
||||
*
|
||||
* @return array|null JWK set array or null on failure
|
||||
*/
|
||||
function firebase_auth_fetch_google_jwks()
|
||||
{
|
||||
$cache_key = 'firebase_auth_jwks';
|
||||
$cache_ttl = 3600;
|
||||
if (function_exists('get_instance')) {
|
||||
$ci = &get_instance();
|
||||
if (isset($ci->cache) && method_exists($ci->cache, 'get')) {
|
||||
$cached = $ci->cache->get($cache_key);
|
||||
if ($cached !== false) {
|
||||
return $cached;
|
||||
}
|
||||
}
|
||||
}
|
||||
$url = 'https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com';
|
||||
$ctx = stream_context_create(array('http' => array('timeout' => 10)));
|
||||
$raw = @file_get_contents($url, false, $ctx);
|
||||
if ($raw === false) {
|
||||
log_message('error', 'Firebase Auth: Failed to fetch JWKs');
|
||||
return null;
|
||||
}
|
||||
$jwks = json_decode($raw, true);
|
||||
if (empty($jwks['keys'])) {
|
||||
log_message('error', 'Firebase Auth: Invalid JWKs response');
|
||||
return null;
|
||||
}
|
||||
if (function_exists('get_instance')) {
|
||||
$ci = &get_instance();
|
||||
if (isset($ci->cache) && method_exists($ci->cache, 'save')) {
|
||||
$ci->cache->save($cache_key, $jwks, $cache_ttl);
|
||||
}
|
||||
}
|
||||
return $jwks;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('firebase_auth_jwk_to_pem')) {
|
||||
/**
|
||||
* Convert JWK (RSA n,e) to PEM for openssl.
|
||||
*
|
||||
* @param array $jwk JWK with kty RSA, n, e
|
||||
* @return string|false PEM or false
|
||||
*/
|
||||
function firebase_auth_jwk_to_pem($jwk)
|
||||
{
|
||||
if (empty($jwk['n']) || empty($jwk['e']) || (isset($jwk['kty']) && $jwk['kty'] !== 'RSA')) {
|
||||
return false;
|
||||
}
|
||||
$n = firebase_auth_base64url_decode($jwk['n']);
|
||||
$e = firebase_auth_base64url_decode($jwk['e']);
|
||||
if ($n === false || $e === false) {
|
||||
return false;
|
||||
}
|
||||
$rsa = array(
|
||||
'n' => $n,
|
||||
'e' => $e,
|
||||
);
|
||||
$der = firebase_auth_build_rsa_der($rsa);
|
||||
if ($der === false) {
|
||||
return false;
|
||||
}
|
||||
$pem = "-----BEGIN PUBLIC KEY-----\n" . chunk_split(base64_encode($der), 64, "\n") . "-----END PUBLIC KEY-----";
|
||||
return $pem;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('firebase_auth_build_rsa_der')) {
|
||||
function firebase_auth_build_rsa_der($rsa)
|
||||
{
|
||||
$n = $rsa['n'];
|
||||
$e = $rsa['e'];
|
||||
$n_len = strlen($n);
|
||||
$e_len = strlen($e);
|
||||
if ($n[0] & "\x80") {
|
||||
$n_len++;
|
||||
}
|
||||
if ($e[0] & "\x80") {
|
||||
$e_len++;
|
||||
}
|
||||
$seq = "\x02" . chr($e_len) . ($e[0] & "\x80" ? "\0" : '') . $e
|
||||
. "\x02" . chr($n_len) . ($n[0] & "\x80" ? "\0" : '') . $n;
|
||||
$bit_string = "\x03" . chr(strlen($seq) + 1) . "\x00" . $seq;
|
||||
$oid = "\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00";
|
||||
$inner = "\x30" . firebase_auth_der_len(strlen($bit_string) + strlen($oid)) . $bit_string . $oid;
|
||||
$outer = "\x30" . firebase_auth_der_len(strlen($inner)) . $inner;
|
||||
return $outer;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('firebase_auth_der_len')) {
|
||||
function firebase_auth_der_len($len)
|
||||
{
|
||||
if ($len < 128) {
|
||||
return chr($len);
|
||||
}
|
||||
$buf = '';
|
||||
while ($len > 0) {
|
||||
$buf = chr($len & 0xff) . $buf;
|
||||
$len >>= 8;
|
||||
}
|
||||
return chr(0x80 | strlen($buf)) . $buf;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('firebase_auth_verify_id_token')) {
|
||||
/**
|
||||
* Verify a Firebase ID token (JWT) and return decoded payload.
|
||||
*
|
||||
* @param string $id_token The JWT string
|
||||
* @param string|null $project_id Firebase project ID (default: FCM_PROJECT_ID or FIREBASE_PROJECT_ID constant)
|
||||
* @return array|null Payload (uid, email, etc.) or null if invalid
|
||||
*/
|
||||
function firebase_auth_verify_id_token($id_token, $project_id = null)
|
||||
{
|
||||
if (!is_string($id_token) || $id_token === '') {
|
||||
return null;
|
||||
}
|
||||
$parts = explode('.', $id_token);
|
||||
if (count($parts) !== 3) {
|
||||
return null;
|
||||
}
|
||||
$header = json_decode(firebase_auth_base64url_decode($parts[0]), true);
|
||||
$payload = json_decode(firebase_auth_base64url_decode($parts[1]), true);
|
||||
if (!$header || !$payload) {
|
||||
log_message('debug', 'Firebase Auth: Invalid JWT decode');
|
||||
return null;
|
||||
}
|
||||
if ($project_id === null || $project_id === '') {
|
||||
if (defined('FCM_PROJECT_ID') && FCM_PROJECT_ID !== '') {
|
||||
$project_id = FCM_PROJECT_ID;
|
||||
} elseif (defined('FIREBASE_PROJECT_ID') && FIREBASE_PROJECT_ID !== '') {
|
||||
$project_id = FIREBASE_PROJECT_ID;
|
||||
} else {
|
||||
$project_id = '';
|
||||
}
|
||||
}
|
||||
if ($project_id === '') {
|
||||
log_message('error', 'Firebase Auth: FCM_PROJECT_ID not set');
|
||||
return null;
|
||||
}
|
||||
$expected_iss = 'https://securetoken.google.com/' . $project_id;
|
||||
if (empty($payload['iss']) || $payload['iss'] !== $expected_iss) {
|
||||
log_message('debug', 'Firebase Auth: iss mismatch');
|
||||
return null;
|
||||
}
|
||||
if (empty($payload['aud']) || $payload['aud'] !== $project_id) {
|
||||
log_message('debug', 'Firebase Auth: aud mismatch');
|
||||
return null;
|
||||
}
|
||||
if (empty($payload['exp']) || (int) $payload['exp'] < time()) {
|
||||
log_message('debug', 'Firebase Auth: token expired');
|
||||
return null;
|
||||
}
|
||||
$jwks = firebase_auth_fetch_google_jwks();
|
||||
if (!$jwks) {
|
||||
return null;
|
||||
}
|
||||
$kid = isset($header['kid']) ? $header['kid'] : null;
|
||||
$key = null;
|
||||
foreach ($jwks['keys'] as $k) {
|
||||
if (isset($k['kid']) && $k['kid'] === $kid) {
|
||||
$key = $k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$key) {
|
||||
$key = $jwks['keys'][0];
|
||||
}
|
||||
$pem = firebase_auth_jwk_to_pem($key);
|
||||
if (!$pem) {
|
||||
return null;
|
||||
}
|
||||
$pub = openssl_pkey_get_public($pem);
|
||||
if ($pub === false) {
|
||||
return null;
|
||||
}
|
||||
$payload_to_verify = $parts[0] . '.' . $parts[1];
|
||||
$sig_raw = firebase_auth_base64url_decode($parts[2]);
|
||||
if ($sig_raw === false) {
|
||||
openssl_free_key($pub);
|
||||
return null;
|
||||
}
|
||||
$ok = openssl_verify($payload_to_verify, $sig_raw, $pub, OPENSSL_ALGO_SHA256);
|
||||
openssl_free_key($pub);
|
||||
if ($ok !== 1) {
|
||||
log_message('debug', 'Firebase Auth: signature verification failed');
|
||||
return null;
|
||||
}
|
||||
return $payload;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Google Maps helper.
|
||||
* All Google Maps API calls from the backend should go through here so that
|
||||
* the API key lives only on the server (via constants configured in setting.php).
|
||||
*/
|
||||
|
||||
if (!function_exists('maps_get_api_key')) {
|
||||
/**
|
||||
* Resolve the Maps API key from environment/constant.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function maps_get_api_key()
|
||||
{
|
||||
if (defined('google_maps_api') && google_maps_api !== '') {
|
||||
return google_maps_api;
|
||||
}
|
||||
if (defined('GOOGLE_MAPS_API_KEY') && GOOGLE_MAPS_API_KEY !== '') {
|
||||
return GOOGLE_MAPS_API_KEY;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('maps_http_get_json')) {
|
||||
/**
|
||||
* Internal helper to issue a GET request and decode JSON.
|
||||
*
|
||||
* @param string $url
|
||||
* @return array|null
|
||||
*/
|
||||
function maps_http_get_json($url)
|
||||
{
|
||||
$ctx = stream_context_create(array(
|
||||
'http' => array(
|
||||
'method' => 'GET',
|
||||
'timeout' => 10,
|
||||
),
|
||||
));
|
||||
$raw = @file_get_contents($url, false, $ctx);
|
||||
if ($raw === false) {
|
||||
log_message('error', 'Maps helper: HTTP request failed for URL: ' . $url);
|
||||
return null;
|
||||
}
|
||||
$data = json_decode($raw, true);
|
||||
if (!is_array($data)) {
|
||||
log_message('error', 'Maps helper: JSON decode failed for URL: ' . $url);
|
||||
return null;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('maps_directions')) {
|
||||
/**
|
||||
* Call Google Directions API for a simple origin/destination pair.
|
||||
*
|
||||
* @param float $originLat
|
||||
* @param float $originLng
|
||||
* @param float $destLat
|
||||
* @param float $destLng
|
||||
* @param string $mode
|
||||
* @return array|null
|
||||
*/
|
||||
function maps_directions($originLat, $originLng, $destLat, $destLng, $mode = 'driving')
|
||||
{
|
||||
$key = maps_get_api_key();
|
||||
if ($key === '') {
|
||||
log_message('error', 'Maps helper: GOOGLE_MAPS_API_KEY not set');
|
||||
return null;
|
||||
}
|
||||
$params = http_build_query(array(
|
||||
'origin' => $originLat . ',' . $originLng,
|
||||
'destination' => $destLat . ',' . $destLng,
|
||||
'mode' => $mode,
|
||||
'units' => 'metric',
|
||||
'key' => $key,
|
||||
));
|
||||
$url = 'https://maps.googleapis.com/maps/api/directions/json?' . $params;
|
||||
return maps_http_get_json($url);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('maps_geocode')) {
|
||||
/**
|
||||
* Reverse geocode a lat/lng using Google Geocoding API.
|
||||
*
|
||||
* @param float $lat
|
||||
* @param float $lng
|
||||
* @return array|null
|
||||
*/
|
||||
function maps_geocode($lat, $lng)
|
||||
{
|
||||
$key = maps_get_api_key();
|
||||
if ($key === '') {
|
||||
log_message('error', 'Maps helper: GOOGLE_MAPS_API_KEY not set for geocode');
|
||||
return null;
|
||||
}
|
||||
$params = http_build_query(array(
|
||||
'latlng' => $lat . ',' . $lng,
|
||||
'key' => $key,
|
||||
));
|
||||
$url = 'https://maps.googleapis.com/maps/api/geocode/json?' . $params;
|
||||
return maps_http_get_json($url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Per-key quota limiter (e.g. per user, per token) for FCM, Maps, and other API usage.
|
||||
* Uses database table quota_usage. Create with:
|
||||
* CREATE TABLE IF NOT EXISTS quota_usage (
|
||||
* id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
* key_name VARCHAR(255) NOT NULL,
|
||||
* period_type VARCHAR(16) NOT NULL,
|
||||
* period_value VARCHAR(32) NOT NULL,
|
||||
* count INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
* updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
* UNIQUE KEY uk_key_period (key_name, period_type, period_value)
|
||||
* );
|
||||
*
|
||||
* Config via env: FCM_LIMIT_PER_HOUR, FCM_LIMIT_PER_DAY, MAPS_LIMIT_PER_DAY, etc.
|
||||
*/
|
||||
|
||||
if (!function_exists('quota_limiter_allow')) {
|
||||
/**
|
||||
* Check and increment usage for the given key. Returns true if under limit, false if over.
|
||||
* @param string $key Unique key (e.g. "fcm:recipient:".hash($token) or "maps:user:123")
|
||||
* @param array $limits ['hour' => N, 'day' => N]. Use 0 to skip that period.
|
||||
* @return bool True if request is allowed, false if over limit
|
||||
*/
|
||||
function quota_limiter_allow($key, $limits = array())
|
||||
{
|
||||
$CI = &get_instance();
|
||||
if (!isset($CI->db) || !$CI->db->conn_id) {
|
||||
return true;
|
||||
}
|
||||
$table = 'quota_usage';
|
||||
$hour_period = date('Y-m-d-H');
|
||||
$day_period = date('Y-m-d');
|
||||
$hour_limit = isset($limits['hour']) ? (int) $limits['hour'] : 100;
|
||||
$day_limit = isset($limits['day']) ? (int) $limits['day'] : 500;
|
||||
$key_safe = substr($key, 0, 255);
|
||||
|
||||
foreach (array('hour' => array($hour_period, $hour_limit), 'day' => array($day_period, $day_limit)) as $period_type => $pair) {
|
||||
list($period_value, $limit) = $pair;
|
||||
if ($limit <= 0) {
|
||||
continue;
|
||||
}
|
||||
$CI->db->query("
|
||||
INSERT INTO {$table} (key_name, period_type, period_value, count, updated_at)
|
||||
VALUES (?, ?, ?, 1, NOW())
|
||||
ON DUPLICATE KEY UPDATE count = count + 1, updated_at = NOW()
|
||||
", array($key_safe, $period_type, $period_value));
|
||||
$row = $CI->db->query("
|
||||
SELECT count FROM {$table}
|
||||
WHERE key_name = ? AND period_type = ? AND period_value = ?
|
||||
", array($key_safe, $period_type, $period_value))->row();
|
||||
if ($row && (int) $row->count > $limit) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('quota_limiter_fcm_key')) {
|
||||
function quota_limiter_fcm_key($recipient_identifier)
|
||||
{
|
||||
return 'fcm:' . substr(md5($recipient_identifier), 0, 32);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
function curl_topup()
|
||||
{
|
||||
$code = get_instance();
|
||||
$json = $code->db->get('topup_pulsaMP')->result_array();
|
||||
|
||||
$url = "https://testprepaid.mobilepulsa.net/v1/legacy/index";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
print_r($data);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
function is_logged_in()
|
||||
|
||||
{
|
||||
$ci=get_instance();
|
||||
if (!$ci->session->userdata('user_name')) {
|
||||
redirect(base_url() . "login");
|
||||
|
||||
} else {
|
||||
$admin_role = $ci->session->userdata('admin_role');
|
||||
$menu = $ci->uri->segment(1);
|
||||
|
||||
$queryMenu = $ci->db->get_where('admin_privilage',['url'=>$menu])->row_array();
|
||||
$menu_id = $queryMenu['id'];
|
||||
|
||||
$userAccess = $ci->db->get_where('admin_menu_role',[
|
||||
'id_role'=>$admin_role,
|
||||
'id_privilage'=>$menu_id
|
||||
]);
|
||||
|
||||
if($userAccess->num_rows() < 1) {
|
||||
redirect(base_url());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package GCM (Google Cloud Messaging)
|
||||
* @copyright (c) 2012 AntonGorodezkiy
|
||||
* info: https://github.com/antongorodezkiy/codeigniter-gcm/
|
||||
* Description: PHP Codeigniter Google Cloud Messaging Library
|
||||
* License: BSD
|
||||
*
|
||||
* Copyright (c) 2012, AntonGorodezkiy
|
||||
* All rights reserved.
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
class FCM {
|
||||
protected $apiKey = '';
|
||||
protected $apiSendAddress = '';
|
||||
protected $payload = array();
|
||||
protected $additionalData = array();
|
||||
protected $recepients = array();
|
||||
protected $message = '';
|
||||
public $status = array();
|
||||
public $messagesStatuses = array();
|
||||
public $responseData = null;
|
||||
public $responseInfo = null;
|
||||
protected $errorStatuses = array(
|
||||
'Unavailable' => 'Maybe missed API key',
|
||||
'MismatchSenderId' => 'Make sure you\'re using one of those when trying to send messages to the device. If you switch to a different sender, the existing registration IDs won\'t work.',
|
||||
'MissingRegistration' => 'Check that the request contains a registration ID',
|
||||
'InvalidRegistration' => 'Check the formatting of the registration ID that you pass to the server. Make sure it matches the registration ID the phone receives in the google',
|
||||
'NotRegistered' => 'Not registered',
|
||||
'MessageTooBig' => 'The total size of the payload data that is included in a message can\'t exceed 4096 bytes'
|
||||
);
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
$ci =& get_instance();
|
||||
$ci->load->config('fcm',true);
|
||||
$this->apiKey = $ci->config->item('fcm_api_key','fcm');
|
||||
$this->apiSendAddress = $ci->config->item('fcm_api_send_address','fcm');
|
||||
if (!$this->apiKey) {
|
||||
show_error('FCM: Needed API Key');
|
||||
}
|
||||
if (!$this->apiSendAddress) {
|
||||
show_error('FCM: Needed API Send Address');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sets additional data which will be send with main apn message
|
||||
*
|
||||
* @param <array> $data
|
||||
* @return <array>
|
||||
*/
|
||||
public function setTtl($ttl = '')
|
||||
{
|
||||
if (!$ttl)
|
||||
unset($this->payload['time_to_live']);
|
||||
else
|
||||
$this->payload['time_to_live'] = $ttl;
|
||||
}
|
||||
/**
|
||||
* Setting GCM message
|
||||
*
|
||||
* @param <string> $message
|
||||
*/
|
||||
public function setMessage($message = '') {
|
||||
$this->message = $message;
|
||||
$this->payload['data']['message'] = $message;
|
||||
}
|
||||
/**
|
||||
* Setting data to message
|
||||
*
|
||||
* @param <string> $data
|
||||
*/
|
||||
public function setData($data = array()) {
|
||||
$this->payload['data'] = $data;
|
||||
if ($this->message)
|
||||
$this->payload['data']['message'] = $this->message;
|
||||
}
|
||||
|
||||
public function setNotification($data = array()) {
|
||||
$this->payload['notification'] = $data;
|
||||
if ($this->message)
|
||||
$this->payload['notification']['message'] = $this->message;
|
||||
}
|
||||
/**
|
||||
* Setting group of messages
|
||||
*
|
||||
* @param <string> $group
|
||||
*/
|
||||
public function setGroup($group = '') {
|
||||
if (!$group)
|
||||
unset($this->payload['collapse_key']);
|
||||
else
|
||||
$this->payload['collapse_key'] = $group;
|
||||
}
|
||||
/**
|
||||
* Adding one recepient
|
||||
*
|
||||
* @param <string> $group
|
||||
*/
|
||||
public function addRecepient($registrationId) {
|
||||
$this->payload['registration_ids'][] = $registrationId;
|
||||
}
|
||||
/**
|
||||
* Setting all recepients
|
||||
*
|
||||
* @param <string> $group
|
||||
*/
|
||||
public function setRecepients($registrationIds) {
|
||||
$this->payload['registration_ids'] = $registrationIds;
|
||||
}
|
||||
/**
|
||||
* Clearing group of messages
|
||||
*/
|
||||
public function clearRecepients() {
|
||||
$this->payload['registration_ids'] = array();
|
||||
}
|
||||
/**
|
||||
* Senging messages to Google Cloud Messaging
|
||||
*
|
||||
* @param <string> $group
|
||||
*/
|
||||
public function send()
|
||||
{
|
||||
$this->payload['registration_ids'] = array_unique($this->payload['registration_ids']);
|
||||
sort($this->payload['registration_ids']);
|
||||
if (isset($this->payload['time_to_live']) && !isset($this->payload['collapse_key']))
|
||||
$this->payload['collapse_key'] = 'FCM Notifications';
|
||||
$data = json_encode($this->payload);
|
||||
return $this->request($data);
|
||||
}
|
||||
protected function request($data)
|
||||
{
|
||||
$headers[] = 'Content-Type:application/json';
|
||||
$headers[] = 'Authorization:key='.$this->apiKey;
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $this->apiSendAddress);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($curl, CURLOPT_HEADER, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
$this->responseData = curl_exec($curl);
|
||||
$this->responseInfo = curl_getinfo($curl);
|
||||
curl_close($curl);
|
||||
return $this->parseResponse();
|
||||
}
|
||||
protected function parseResponse()
|
||||
{
|
||||
if ($this->responseInfo['http_code'] == 200)
|
||||
{
|
||||
$response = explode("\n",$this->responseData);
|
||||
$responseBody = json_decode($response[count($response)-1]);
|
||||
if ($responseBody->success && !$responseBody->failure)
|
||||
{
|
||||
$message = 'All messages were sent successfully';
|
||||
$error = 0;
|
||||
}
|
||||
elseif ($responseBody->success && $responseBody->failure)
|
||||
{
|
||||
$message = $responseBody->success.' of '.($responseBody->success+$responseBody->failure).' messages were sent successfully';
|
||||
$error = 1;
|
||||
}
|
||||
elseif (!$responseBody->success && $responseBody->failure)
|
||||
{
|
||||
$message = 'No messages cannot be sent. '.$responseBody->results[0]->error;
|
||||
$error = 1;
|
||||
}
|
||||
$this->status = array(
|
||||
'error' => $error,
|
||||
'message' => $message
|
||||
);
|
||||
$this->messagesStatuses = array();
|
||||
foreach($responseBody->results as $key => $result)
|
||||
{
|
||||
if (isset($result->error) && $result->error)
|
||||
{
|
||||
$this->messagesStatuses[$key] = array(
|
||||
'error' => 1,
|
||||
'regid' => $this->payload['registration_ids'][$key],
|
||||
'message' => $this->errorStatuses[$result->error],
|
||||
'message_id' => ''
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->messagesStatuses[$key] = array(
|
||||
'error' => 0,
|
||||
'regid' => $this->payload['registration_ids'][$key],
|
||||
'message' => 'Message was sent successfully',
|
||||
'message_id' => $result->message_id
|
||||
);
|
||||
}
|
||||
}
|
||||
return !$error;
|
||||
}
|
||||
elseif ($this->responseInfo['http_code'] == 400)
|
||||
{
|
||||
$this->status = array(
|
||||
'error' => 1,
|
||||
'message' => 'Request could not be parsed as JSON'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
elseif ($this->responseInfo['http_code'] == 401)
|
||||
{
|
||||
$this->status = array(
|
||||
'error' => 1,
|
||||
'message' => 'There was an error authenticating the sender account'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
elseif ($this->responseInfo['http_code'] == 500)
|
||||
{
|
||||
$this->status = array(
|
||||
'error' => 1,
|
||||
'message' => 'There was an internal error in the GCM server while trying to process the request'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
elseif ($this->responseInfo['http_code'] == 503)
|
||||
{
|
||||
$this->status = array(
|
||||
'error' => 1,
|
||||
'message' => 'Server is temporarily unavailable'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = array(
|
||||
'error' => 1,
|
||||
'message' => 'Status undefined'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Format class
|
||||
* Help convert between various formats such as XML, JSON, CSV, etc.
|
||||
*
|
||||
* @author Phil Sturgeon, Chris Kacerguis
|
||||
* @license http://www.dbad-license.org/
|
||||
*/
|
||||
class Format {
|
||||
|
||||
/**
|
||||
* CodeIgniter instance
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $_ci;
|
||||
|
||||
/**
|
||||
* Data to parse
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_data = [];
|
||||
|
||||
/**
|
||||
* Type to convert from
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_from_type = NULL;
|
||||
|
||||
/**
|
||||
* DO NOT CALL THIS DIRECTLY, USE factory()
|
||||
*
|
||||
* @param NULL $data
|
||||
* @param NULL $from_type
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public function __construct($data = NULL, $from_type = NULL)
|
||||
{
|
||||
// Get the CodeIgniter reference
|
||||
$this->_ci = &get_instance();
|
||||
|
||||
// Load the inflector helper
|
||||
$this->_ci->load->helper('inflector');
|
||||
|
||||
// If the provided data is already formatted we should probably convert it to an array
|
||||
if ($from_type !== NULL)
|
||||
{
|
||||
if (method_exists($this, '_from_' . $from_type))
|
||||
{
|
||||
$data = call_user_func([$this, '_from_' . $from_type], $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception('Format class does not support conversion from "' . $from_type . '".');
|
||||
}
|
||||
}
|
||||
|
||||
// Set the member variable to the data passed
|
||||
$this->_data = $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the format class
|
||||
* e.g: echo $this->format->factory(['foo' => 'bar'])->to_csv();
|
||||
*
|
||||
* @param mixed $data Data to convert/parse
|
||||
* @param string $from_type Type to convert from e.g. json, csv, html
|
||||
*
|
||||
* @return object Instance of the format class
|
||||
*/
|
||||
public function factory($data, $from_type = NULL)
|
||||
{
|
||||
// $class = __CLASS__;
|
||||
// return new $class();
|
||||
|
||||
return new static($data, $from_type);
|
||||
}
|
||||
|
||||
// FORMATTING OUTPUT ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Format data as an array
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
*
|
||||
* @return array Data parsed as an array; otherwise, an empty array
|
||||
*/
|
||||
public function to_array($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Cast as an array if not already
|
||||
if (is_array($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
$array = [];
|
||||
foreach ((array) $data as $key => $value)
|
||||
{
|
||||
if (is_object($value) === TRUE || is_array($value) === TRUE)
|
||||
{
|
||||
$array[$key] = $this->to_array($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$array[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data as XML
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param NULL $structure
|
||||
* @param string $basenode
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function to_xml($data = NULL, $structure = NULL, $basenode = 'xml')
|
||||
{
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// 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) === FALSE && is_object($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value)
|
||||
{
|
||||
|
||||
//change false/true to 0/1
|
||||
if (is_bool($value))
|
||||
{
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
||||
// no numeric keys in our xml please!
|
||||
if (is_numeric($key))
|
||||
{
|
||||
// make string key...
|
||||
$key = (singular($basenode) != $basenode) ? singular($basenode) : 'item';
|
||||
}
|
||||
|
||||
// replace anything not alpha numeric
|
||||
$key = preg_replace('/[^a-z_\-0-9]/i', '', $key);
|
||||
|
||||
if ($key === '_attributes' && (is_array($value) || is_object($value)))
|
||||
{
|
||||
$attributes = $value;
|
||||
if (is_object($attributes))
|
||||
{
|
||||
$attributes = get_object_vars($attributes);
|
||||
}
|
||||
|
||||
foreach ($attributes as $attributeName => $attributeValue)
|
||||
{
|
||||
$structure->addAttribute($attributeName, $attributeValue);
|
||||
}
|
||||
}
|
||||
// if there is another array found recursively call this function
|
||||
elseif (is_array($value) || is_object($value))
|
||||
{
|
||||
$node = $structure->addChild($key);
|
||||
|
||||
// recursive call.
|
||||
$this->to_xml($value, $node, $key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add single node.
|
||||
$value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$structure->addChild($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $structure->asXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data as XML
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param NULL $structure
|
||||
* @param string $basenode
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param NULL $structure
|
||||
* @param string $basenode
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function domain(){
|
||||
//$str = file_get_contents('http://klinikpintar.greative.co.id/api/client/index/3');
|
||||
//$json = json_decode($str, true);
|
||||
//if($_SERVER['SERVER_NAME'] != $json[0]['domain']) {
|
||||
// return false;
|
||||
//}
|
||||
//else {
|
||||
return true;
|
||||
//}
|
||||
}
|
||||
/**
|
||||
* Format data as XML
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param NULL $structure
|
||||
* @param string $basenode
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param NULL $structure
|
||||
* @param string $basenode
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function until(){
|
||||
//$str = file_get_contents('http://klinikpintar.greative.co.id/api/client/index/3');
|
||||
//$json = json_decode($str, true);
|
||||
//if(date('Y-m-d H:i:s') > $json[0]['valid_until']) {
|
||||
// return false;
|
||||
//}
|
||||
//else {
|
||||
return true;
|
||||
//}
|
||||
}
|
||||
/**
|
||||
* Format data as HTML
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function to_html($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Cast as an array if not already
|
||||
if (is_array($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
// Multi-dimensional array
|
||||
if (isset($data[0]) && is_array($data[0]))
|
||||
{
|
||||
$headings = array_keys($data[0]);
|
||||
}
|
||||
|
||||
// Single array
|
||||
else
|
||||
{
|
||||
$headings = array_keys($data);
|
||||
$data = [$data];
|
||||
}
|
||||
|
||||
// Load the table library
|
||||
$this->_ci->load->library('table');
|
||||
|
||||
$this->_ci->table->set_heading($headings);
|
||||
|
||||
// Should row used as a reference?
|
||||
foreach ($data as &$row)
|
||||
{
|
||||
$this->_ci->table->add_row($row);
|
||||
}
|
||||
|
||||
return $this->_ci->table->generate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data as CSV
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function to_csv($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Cast as an array if not already
|
||||
if (is_array($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
// Multi-dimensional array
|
||||
if (isset($data[0]) && is_array($data[0]))
|
||||
{
|
||||
$headings = array_keys($data[0]);
|
||||
}
|
||||
|
||||
// Single array
|
||||
else
|
||||
{
|
||||
$headings = array_keys($data);
|
||||
$data = [$data];
|
||||
}
|
||||
|
||||
$output = '"' . implode('","', $headings) . '"' . PHP_EOL;
|
||||
foreach ($data as &$row)
|
||||
{
|
||||
$row = str_replace('"', '""', $row); // Escape dbl quotes per RFC 4180
|
||||
$output .= '"' . implode('","', $row) . '"' . PHP_EOL;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode data as json
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
*
|
||||
* @return string Json representation of a value
|
||||
*/
|
||||
public function to_json($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Get the callback parameter (if set)
|
||||
$callback = $this->_ci->input->get('callback');
|
||||
|
||||
if (empty($callback) === TRUE)
|
||||
{
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
// We only honour a jsonp callback which are valid javascript identifiers
|
||||
elseif (preg_match('/^[a-z_\$][a-z0-9\$_]*(\.[a-z_\$][a-z0-9\$_]*)*$/i', $callback))
|
||||
{
|
||||
// Return the data as encoded json with a callback
|
||||
return $callback . '(' . json_encode($data) . ');';
|
||||
}
|
||||
|
||||
// An invalid jsonp callback function provided.
|
||||
// Though I don't believe this should be hardcoded here
|
||||
$data['warning'] = 'INVALID JSONP CALLBACK: ' . $callback;
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode data as a serialized array
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
*
|
||||
* @return string Serialized data
|
||||
*/
|
||||
public function to_serialized($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data using a PHP structure
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
*
|
||||
* @return mixed String representation of a variable
|
||||
*/
|
||||
public function to_php($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
return var_export($data, TRUE);
|
||||
}
|
||||
|
||||
// INTERNAL FUNCTIONS
|
||||
|
||||
/**
|
||||
* @param $data XML string
|
||||
*
|
||||
* @return SimpleXMLElement XML element object; otherwise, empty array
|
||||
*/
|
||||
protected function _from_xml($data)
|
||||
{
|
||||
return $data ? (array) simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data CSV string
|
||||
*
|
||||
* @return array A multi-dimensional array with the outer array being the number of rows
|
||||
* and the inner arrays the individual fields
|
||||
*/
|
||||
protected function _from_csv($data)
|
||||
{
|
||||
$array = [];
|
||||
|
||||
// Splits
|
||||
$rows = explode("\n", trim($data));
|
||||
$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))
|
||||
{
|
||||
$array[] = array_combine($headings, $data_fields);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data Encoded json string
|
||||
*
|
||||
* @return mixed Decoded json string with leading and trailing whitespace removed
|
||||
*/
|
||||
protected function _from_json($data)
|
||||
{
|
||||
return json_decode(trim($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string Data to unserialized
|
||||
*
|
||||
* @return mixed Unserialized data
|
||||
*/
|
||||
protected function _from_serialize($data)
|
||||
{
|
||||
return unserialize(trim($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data Data to trim leading and trailing whitespace
|
||||
*
|
||||
* @return string Data with leading and trailing whitespace removed
|
||||
*/
|
||||
protected function _from_php($data)
|
||||
{
|
||||
return trim($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Midtrans
|
||||
{
|
||||
|
||||
/**
|
||||
* Your merchant's server key
|
||||
* @static
|
||||
*/
|
||||
public static $serverKey;
|
||||
|
||||
/**
|
||||
* true for production
|
||||
* false for sandbox mode
|
||||
* @static
|
||||
*/
|
||||
public static $isProduction = false;
|
||||
|
||||
/**
|
||||
* Default options for every request
|
||||
* @static
|
||||
*/
|
||||
public static $curlOptions = array();
|
||||
|
||||
const SANDBOX_BASE_URL = 'https://app.sandbox.midtrans.com/snap/v1/transactions';
|
||||
const PRODUCTION_BASE_URL = 'https://app.midtrans.com/snap/v1/transactions';
|
||||
const SNAP_SANDBOX_BASE_URL = 'https://app.sandbox.midtrans.com/snap/v1';
|
||||
const SNAP_PRODUCTION_BASE_URL = 'https://app.midtrans.com/snap/v1';
|
||||
|
||||
public function config($params)
|
||||
{
|
||||
Midtrans::$serverKey = $params['server_key'];
|
||||
Midtrans::$isProduction = $params['production'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Veritrans API URL, depends on $isProduction
|
||||
*/
|
||||
public static function getBaseUrl()
|
||||
{
|
||||
return Midtrans::$isProduction ?
|
||||
Midtrans::PRODUCTION_BASE_URL : Midtrans::SANDBOX_BASE_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Veritrans API URL, depends on $isProduction
|
||||
*/
|
||||
public static function getSnapBaseUrl()
|
||||
{
|
||||
return Midtrans::$isProduction ?
|
||||
Midtrans::SNAP_PRODUCTION_BASE_URL : Midtrans::SNAP_SANDBOX_BASE_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send GET request
|
||||
* @param string $url
|
||||
* @param string $server_key
|
||||
* @param mixed[] $data_hash
|
||||
*/
|
||||
public static function get($url, $server_key, $data_hash)
|
||||
{
|
||||
return self::remoteCall($url, $server_key, $data_hash, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send POST request
|
||||
* @param string $url
|
||||
* @param string $server_key
|
||||
* @param mixed[] $data_hash
|
||||
*/
|
||||
public static function post($url, $server_key, $data_hash)
|
||||
{
|
||||
return self::remoteCall($url, $server_key, $data_hash, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually send request to API server
|
||||
* @param string $url
|
||||
* @param string $server_key
|
||||
* @param mixed[] $data_hash
|
||||
* @param bool $post
|
||||
*/
|
||||
public static function remoteCall($url, $server_key, $data_hash, $post = true)
|
||||
{
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
$curl_options = array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Basic ' . base64_encode($server_key . ':')
|
||||
),
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
// CURLOPT_CAINFO => dirname(__FILE__) . "/veritrans/cacert.pem"
|
||||
);
|
||||
|
||||
// merging with Veritrans_Config::$curlOptions
|
||||
if (count(Midtrans::$curlOptions)) {
|
||||
// We need to combine headers manually, because it's array and it will no be merged
|
||||
if (Midtrans::$curlOptions[CURLOPT_HTTPHEADER]) {
|
||||
$mergedHeders = array_merge($curl_options[CURLOPT_HTTPHEADER], Midtrans::$curlOptions[CURLOPT_HTTPHEADER]);
|
||||
$headerOptions = array(CURLOPT_HTTPHEADER => $mergedHeders);
|
||||
} else {
|
||||
$mergedHeders = array();
|
||||
}
|
||||
|
||||
$curl_options = array_replace_recursive($curl_options, Midtrans::$curlOptions, $headerOptions);
|
||||
}
|
||||
|
||||
if ($post) {
|
||||
$curl_options[CURLOPT_POST] = 1;
|
||||
|
||||
if ($data_hash) {
|
||||
$body = json_encode($data_hash);
|
||||
$curl_options[CURLOPT_POSTFIELDS] = $body;
|
||||
} else {
|
||||
$curl_options[CURLOPT_POSTFIELDS] = '';
|
||||
}
|
||||
}
|
||||
|
||||
curl_setopt_array($ch, $curl_options);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
// curl_close($ch);
|
||||
|
||||
if ($result === FALSE) {
|
||||
throw new Exception('CURL Error: ' . curl_error($ch), curl_errno($ch));
|
||||
} else {
|
||||
$result_array = json_decode($result);
|
||||
if ($info['http_code'] != 201 && !in_array($result_array->status_code, array(200, 201, 202, 407))) {
|
||||
$message = 'Midtrans Error (' . $info['http_code'] . '): '
|
||||
. implode(',', $result_array->error_messages);
|
||||
throw new Exception($message, $info['http_code']);
|
||||
} else {
|
||||
return $result_array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSnapToken($params)
|
||||
{
|
||||
|
||||
$result = Midtrans::post(
|
||||
Midtrans::getSnapBaseUrl() . '/transactions',
|
||||
Midtrans::$serverKey,
|
||||
$params
|
||||
);
|
||||
|
||||
return $result->token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve transaction status
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return mixed[]
|
||||
*/
|
||||
public static function status($id)
|
||||
{
|
||||
return Midtrans::get(
|
||||
Midtrans::getBaseUrl() . '/' . $id . '/status',
|
||||
Midtrans::$serverKey,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appove challenge transaction
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return string
|
||||
*/
|
||||
public static function approve($id)
|
||||
{
|
||||
return Midtrans::post(
|
||||
Midtrans::getBaseUrl() . '/' . $id . '/approve',
|
||||
Midtrans::$serverKey,
|
||||
false
|
||||
)->status_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel transaction before it's setteled
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return string
|
||||
*/
|
||||
public static function cancel($id)
|
||||
{
|
||||
return Midtrans::post(
|
||||
Midtrans::getBaseUrl() . '/' . $id . '/cancel',
|
||||
Midtrans::$serverKey,
|
||||
false
|
||||
)->status_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expire transaction before it's setteled
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return mixed[]
|
||||
*/
|
||||
public static function expire($id)
|
||||
{
|
||||
return Midtrans::post(
|
||||
Midtrans::getBaseUrl() . '/' . $id . '/expire',
|
||||
Midtrans::$serverKey,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public static function getcharge($params)
|
||||
{
|
||||
|
||||
$result = Midtrans::post(
|
||||
Midtrans::getBaseUrl() . '/charge',
|
||||
Midtrans::$serverKey,
|
||||
$params
|
||||
);
|
||||
|
||||
return $result->token;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,218 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Veritrans
|
||||
{
|
||||
|
||||
/**
|
||||
* Your merchant's server key
|
||||
* @static
|
||||
*/
|
||||
public static $serverKey;
|
||||
|
||||
/**
|
||||
* true for production
|
||||
* false for sandbox mode
|
||||
* @static
|
||||
*/
|
||||
public static $isProduction = false;
|
||||
|
||||
/**
|
||||
* Default options for every request
|
||||
* @static
|
||||
*/
|
||||
public static $curlOptions = array();
|
||||
|
||||
const SANDBOX_BASE_URL = 'https://api.sandbox.veritrans.co.id/v2';
|
||||
const PRODUCTION_BASE_URL = 'https://api.veritrans.co.id/v2';
|
||||
|
||||
public function config($params)
|
||||
{
|
||||
Veritrans::$serverKey = $params['server_key'];
|
||||
Veritrans::$isProduction = $params['production'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Veritrans API URL, depends on $isProduction
|
||||
*/
|
||||
public static function getBaseUrl()
|
||||
{
|
||||
return Veritrans::$isProduction ?
|
||||
Veritrans::PRODUCTION_BASE_URL : Veritrans::SANDBOX_BASE_URL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send GET request
|
||||
* @param string $url
|
||||
* @param string $server_key
|
||||
* @param mixed[] $data_hash
|
||||
*/
|
||||
public static function get($url, $server_key, $data_hash)
|
||||
{
|
||||
return self::remoteCall($url, $server_key, $data_hash, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send POST request
|
||||
* @param string $url
|
||||
* @param string $server_key
|
||||
* @param mixed[] $data_hash
|
||||
*/
|
||||
public static function post($url, $server_key, $data_hash)
|
||||
{
|
||||
return self::remoteCall($url, $server_key, $data_hash, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually send request to API server
|
||||
* @param string $url
|
||||
* @param string $server_key
|
||||
* @param mixed[] $data_hash
|
||||
* @param bool $post
|
||||
*/
|
||||
public static function remoteCall($url, $server_key, $data_hash, $post = true)
|
||||
{
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
$curl_options = array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'Authorization: Basic ' . base64_encode($server_key . ':')
|
||||
),
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
// CURLOPT_CAINFO => dirname(__FILE__) . "/veritrans/cacert.pem"
|
||||
);
|
||||
|
||||
// merging with Veritrans_Config::$curlOptions
|
||||
if (count(Veritrans::$curlOptions)) {
|
||||
// We need to combine headers manually, because it's array and it will no be merged
|
||||
if (Veritrans::$curlOptions[CURLOPT_HTTPHEADER]) {
|
||||
$mergedHeders = array_merge($curl_options[CURLOPT_HTTPHEADER], Veritrans::$curlOptions[CURLOPT_HTTPHEADER]);
|
||||
$headerOptions = array(CURLOPT_HTTPHEADER => $mergedHeders);
|
||||
} else {
|
||||
$mergedHeders = array();
|
||||
}
|
||||
|
||||
$curl_options = array_replace_recursive($curl_options, Veritrans::$curlOptions, $headerOptions);
|
||||
}
|
||||
|
||||
if ($post) {
|
||||
$curl_options[CURLOPT_POST] = 1;
|
||||
|
||||
if ($data_hash) {
|
||||
$body = json_encode($data_hash);
|
||||
$curl_options[CURLOPT_POSTFIELDS] = $body;
|
||||
} else {
|
||||
$curl_options[CURLOPT_POSTFIELDS] = '';
|
||||
}
|
||||
}
|
||||
|
||||
curl_setopt_array($ch, $curl_options);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
// curl_close($ch);
|
||||
|
||||
if ($result === FALSE) {
|
||||
throw new Exception('CURL Error: ' . curl_error($ch), curl_errno($ch));
|
||||
} else {
|
||||
$result_array = json_decode($result);
|
||||
if (!in_array($result_array->status_code, array(200, 201, 202, 407))) {
|
||||
$message = 'Veritrans Error (' . $result_array->status_code . '): '
|
||||
. $result_array->status_message;
|
||||
throw new Exception($message, $result_array->status_code);
|
||||
} else {
|
||||
return $result_array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function vtweb_charge($payloads)
|
||||
{
|
||||
|
||||
$result = Veritrans::post(
|
||||
Veritrans::getBaseUrl() . '/charge',
|
||||
Veritrans::$serverKey,
|
||||
$payloads
|
||||
);
|
||||
|
||||
return $result->redirect_url;
|
||||
|
||||
|
||||
//$url = Veritrans::getBaseUrl();
|
||||
//return Veritrans::$serverKey.Veritrans::getBaseUrl() . '/charge' ;
|
||||
}
|
||||
|
||||
public static function vtdirect_charge($payloads)
|
||||
{
|
||||
|
||||
$result = Veritrans::post(
|
||||
Veritrans::getBaseUrl() . '/charge',
|
||||
Veritrans::$serverKey,
|
||||
$payloads
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
//$url = Veritrans::getBaseUrl();
|
||||
//return Veritrans::$serverKey.Veritrans::getBaseUrl() . '/charge' ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve transaction status
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return mixed[]
|
||||
*/
|
||||
public static function status($id)
|
||||
{
|
||||
return Veritrans::get(
|
||||
Veritrans::getBaseUrl() . '/' . $id . '/status',
|
||||
Veritrans::$serverKey,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appove challenge transaction
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return string
|
||||
*/
|
||||
public static function approve($id)
|
||||
{
|
||||
return Veritrans::post(
|
||||
Veritrans::getBaseUrl() . '/' . $id . '/approve',
|
||||
Veritrans::$serverKey,
|
||||
false
|
||||
)->status_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel transaction before it's setteled
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return string
|
||||
*/
|
||||
public static function cancel($id)
|
||||
{
|
||||
return Veritrans::post(
|
||||
Veritrans::getBaseUrl() . '/' . $id . '/cancel',
|
||||
Veritrans::$serverKey,
|
||||
false
|
||||
)->status_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expire transaction before it's setteled
|
||||
* @param string $id Order ID or transaction ID
|
||||
* @return mixed[]
|
||||
*/
|
||||
public static function expire($id)
|
||||
{
|
||||
return Veritrans::post(
|
||||
Veritrans::getBaseUrl() . '/' . $id . '/expire',
|
||||
Veritrans::$serverKey,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,818 @@
|
||||
<?php
|
||||
/*~ class.smtp.php
|
||||
.---------------------------------------------------------------------------.
|
||||
| Software: PHPMailer - PHP email class |
|
||||
| Version: 5.2.1 |
|
||||
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
|
||||
| ------------------------------------------------------------------------- |
|
||||
| Admin: Jim Jagielski (project admininistrator) |
|
||||
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
|
||||
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
|
||||
| : Jim Jagielski (jimjag) jimjag@gmail.com |
|
||||
| Founder: Brent R. Matzelle (original founder) |
|
||||
| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
|
||||
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
|
||||
| Copyright (c) 2001-2003, Brent R. Matzelle |
|
||||
| ------------------------------------------------------------------------- |
|
||||
| License: Distributed under the Lesser General Public License (LGPL) |
|
||||
| http://www.gnu.org/copyleft/lesser.html |
|
||||
| This program is distributed in the hope that it will be useful - WITHOUT |
|
||||
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
||||
| FITNESS FOR A PARTICULAR PURPOSE. |
|
||||
'---------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPMailer - PHP SMTP email transport class
|
||||
* NOTE: Designed for use with PHP version 5 and up
|
||||
* @package PHPMailer
|
||||
* @author Andy Prevost
|
||||
* @author Marcus Bointon
|
||||
* @copyright 2004 - 2008 Andy Prevost
|
||||
* @author Jim Jagielski
|
||||
* @copyright 2010 - 2012 Jim Jagielski
|
||||
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
|
||||
* @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
|
||||
*/
|
||||
|
||||
/**
|
||||
* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
|
||||
* commands except TURN which will always return a not implemented
|
||||
* error. SMTP also provides some utility methods for sending mail
|
||||
* to an SMTP server.
|
||||
* original author: Chris Ryan
|
||||
*/
|
||||
|
||||
class SMTP {
|
||||
/**
|
||||
* SMTP server port
|
||||
* @var int
|
||||
*/
|
||||
public $SMTP_PORT = 25;
|
||||
|
||||
/**
|
||||
* SMTP reply line ending
|
||||
* @var string
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Sets whether debugging is turned on
|
||||
* @var bool
|
||||
*/
|
||||
public $do_debug; // the level of debug to perform
|
||||
|
||||
/**
|
||||
* Sets VERP use on/off (default is off)
|
||||
* @var bool
|
||||
*/
|
||||
public $do_verp = false;
|
||||
|
||||
/**
|
||||
* Sets the SMTP PHPMailer Version number
|
||||
* @var string
|
||||
*/
|
||||
public $Version = '5.2.1';
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// PROPERTIES, PRIVATE AND PROTECTED
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
private $smtp_conn; // the socket to the server
|
||||
private $error; // error if any on the last call
|
||||
private $helo_rply; // the reply the server sent to us for HELO
|
||||
|
||||
/**
|
||||
* Initialize the class so that the data is in a known state.
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->smtp_conn = 0;
|
||||
$this->error = null;
|
||||
$this->helo_rply = null;
|
||||
|
||||
$this->do_debug = 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// CONNECTION FUNCTIONS
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Connect to the server specified on the port specified.
|
||||
* If the port is not specified use the default SMTP_PORT.
|
||||
* If tval is specified then a connection will try and be
|
||||
* established with the server for that number of seconds.
|
||||
* If tval is not specified the default is 30 seconds to
|
||||
* try on the connection.
|
||||
*
|
||||
* SMTP CODE SUCCESS: 220
|
||||
* SMTP CODE FAILURE: 421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Connect($host, $port = 0, $tval = 30) {
|
||||
// set the error val to null so there is no confusion
|
||||
$this->error = null;
|
||||
|
||||
// make sure we are __not__ connected
|
||||
if($this->connected()) {
|
||||
// already connected, generate error
|
||||
$this->error = array("error" => "Already connected to a server");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($port)) {
|
||||
$port = $this->SMTP_PORT;
|
||||
}
|
||||
|
||||
// connect to the smtp server
|
||||
$this->smtp_conn = @fsockopen($host, // the host of the server
|
||||
$port, // the port to use
|
||||
$errno, // error number if any
|
||||
$errstr, // error message if any
|
||||
$tval); // give up after ? secs
|
||||
// verify we connected properly
|
||||
if(empty($this->smtp_conn)) {
|
||||
$this->error = array("error" => "Failed to connect to server",
|
||||
"errno" => $errno,
|
||||
"errstr" => $errstr);
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// SMTP server can take longer to respond, give longer timeout for first read
|
||||
// Windows does not have support for this timeout function
|
||||
if(substr(PHP_OS, 0, 3) != "WIN")
|
||||
socket_set_timeout($this->smtp_conn, $tval, 0);
|
||||
|
||||
// get any announcement
|
||||
$announce = $this->get_lines();
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a TLS communication with the server.
|
||||
*
|
||||
* SMTP CODE 220 Ready to start TLS
|
||||
* SMTP CODE 501 Syntax error (no parameters allowed)
|
||||
* SMTP CODE 454 TLS not available due to temporary reason
|
||||
* @access public
|
||||
* @return bool success
|
||||
*/
|
||||
public function StartTLS() {
|
||||
$this->error = null; # to avoid confusion
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array("error" => "Called StartTLS() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 220) {
|
||||
$this->error =
|
||||
array("error" => "STARTTLS not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Begin encrypted connection
|
||||
if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs SMTP authentication. Must be run after running the
|
||||
* Hello() method. Returns true if successfully authenticated.
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Authenticate($username, $password) {
|
||||
// Start authentication
|
||||
fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($code != 334) {
|
||||
$this->error =
|
||||
array("error" => "AUTH not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send encoded username
|
||||
fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($code != 334) {
|
||||
$this->error =
|
||||
array("error" => "Username not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Send encoded password
|
||||
fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($code != 235) {
|
||||
$this->error =
|
||||
array("error" => "Password not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if connected to a server otherwise false
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Connected() {
|
||||
if(!empty($this->smtp_conn)) {
|
||||
$sock_status = socket_get_status($this->smtp_conn);
|
||||
if($sock_status["eof"]) {
|
||||
// the socket is valid but we are not connected
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
|
||||
}
|
||||
$this->Close();
|
||||
return false;
|
||||
}
|
||||
return true; // everything looks good
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the socket and cleans up the state of the class.
|
||||
* It is not considered good to use this function without
|
||||
* first trying to use QUIT.
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function Close() {
|
||||
$this->error = null; // so there is no confusion
|
||||
$this->helo_rply = null;
|
||||
if(!empty($this->smtp_conn)) {
|
||||
// close the connection and cleanup
|
||||
fclose($this->smtp_conn);
|
||||
$this->smtp_conn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// SMTP COMMANDS
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Issues a data command and sends the msg_data to the server
|
||||
* finializing the mail transaction. $msg_data is the message
|
||||
* that is to be send with the headers. Each header needs to be
|
||||
* on a single line followed by a <CRLF> with the message headers
|
||||
* and the message body being seperated by and additional <CRLF>.
|
||||
*
|
||||
* Implements rfc 821: DATA <CRLF>
|
||||
*
|
||||
* SMTP CODE INTERMEDIATE: 354
|
||||
* [data]
|
||||
* <CRLF>.<CRLF>
|
||||
* SMTP CODE SUCCESS: 250
|
||||
* SMTP CODE FAILURE: 552,554,451,452
|
||||
* SMTP CODE FAILURE: 451,554
|
||||
* SMTP CODE ERROR : 500,501,503,421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Data($msg_data) {
|
||||
$this->error = null; // so no confusion is caused
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called Data() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
fputs($this->smtp_conn,"DATA" . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 354) {
|
||||
$this->error =
|
||||
array("error" => "DATA command not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* the server is ready to accept data!
|
||||
* according to rfc 821 we should not send more than 1000
|
||||
* including the CRLF
|
||||
* characters on a single line so we will break the data up
|
||||
* into lines by \r and/or \n then if needed we will break
|
||||
* each of those into smaller lines to fit within the limit.
|
||||
* in addition we will be looking for lines that start with
|
||||
* a period '.' and append and additional period '.' to that
|
||||
* line. NOTE: this does not count towards limit.
|
||||
*/
|
||||
|
||||
// normalize the line breaks so we know the explode works
|
||||
$msg_data = str_replace("\r\n","\n",$msg_data);
|
||||
$msg_data = str_replace("\r","\n",$msg_data);
|
||||
$lines = explode("\n",$msg_data);
|
||||
|
||||
/* we need to find a good way to determine is headers are
|
||||
* in the msg_data or if it is a straight msg body
|
||||
* currently I am assuming rfc 822 definitions of msg headers
|
||||
* and if the first field of the first line (':' sperated)
|
||||
* does not contain a space then it _should_ be a header
|
||||
* and we can process all lines before a blank "" line as
|
||||
* headers.
|
||||
*/
|
||||
|
||||
$field = substr($lines[0],0,strpos($lines[0],":"));
|
||||
$in_headers = false;
|
||||
if(!empty($field) && !strstr($field," ")) {
|
||||
$in_headers = true;
|
||||
}
|
||||
|
||||
$max_line_length = 998; // used below; set here for ease in change
|
||||
|
||||
while(list(,$line) = @each($lines)) {
|
||||
$lines_out = null;
|
||||
if($line == "" && $in_headers) {
|
||||
$in_headers = false;
|
||||
}
|
||||
// ok we need to break this line up into several smaller lines
|
||||
while(strlen($line) > $max_line_length) {
|
||||
$pos = strrpos(substr($line,0,$max_line_length)," ");
|
||||
|
||||
// Patch to fix DOS attack
|
||||
if(!$pos) {
|
||||
$pos = $max_line_length - 1;
|
||||
$lines_out[] = substr($line,0,$pos);
|
||||
$line = substr($line,$pos);
|
||||
} else {
|
||||
$lines_out[] = substr($line,0,$pos);
|
||||
$line = substr($line,$pos + 1);
|
||||
}
|
||||
|
||||
/* if processing headers add a LWSP-char to the front of new line
|
||||
* rfc 822 on long msg headers
|
||||
*/
|
||||
if($in_headers) {
|
||||
$line = "\t" . $line;
|
||||
}
|
||||
}
|
||||
$lines_out[] = $line;
|
||||
|
||||
// send the lines to the server
|
||||
while(list(,$line_out) = @each($lines_out)) {
|
||||
if(strlen($line_out) > 0)
|
||||
{
|
||||
if(substr($line_out, 0, 1) == ".") {
|
||||
$line_out = "." . $line_out;
|
||||
}
|
||||
}
|
||||
fputs($this->smtp_conn,$line_out . $this->CRLF);
|
||||
}
|
||||
}
|
||||
|
||||
// message data has been sent
|
||||
fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 250) {
|
||||
$this->error =
|
||||
array("error" => "DATA not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the HELO command to the smtp server.
|
||||
* This makes sure that we and the server are in
|
||||
* the same known state.
|
||||
*
|
||||
* Implements from rfc 821: HELO <SP> <domain> <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 250
|
||||
* SMTP CODE ERROR : 500, 501, 504, 421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Hello($host = '') {
|
||||
$this->error = null; // so no confusion is caused
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called Hello() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// if hostname for HELO was not specified send default
|
||||
if(empty($host)) {
|
||||
// determine appropriate default to send to server
|
||||
$host = "localhost";
|
||||
}
|
||||
|
||||
// Send extended hello first (RFC 2821)
|
||||
if(!$this->SendHello("EHLO", $host)) {
|
||||
if(!$this->SendHello("HELO", $host)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a HELO/EHLO command.
|
||||
* @access private
|
||||
* @return bool
|
||||
*/
|
||||
private function SendHello($hello, $host) {
|
||||
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 250) {
|
||||
$this->error =
|
||||
array("error" => $hello . " not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->helo_rply = $rply;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a mail transaction from the email address specified in
|
||||
* $from. Returns true if successful or false otherwise. If True
|
||||
* the mail transaction is started and then one or more Recipient
|
||||
* commands may be called followed by a Data command.
|
||||
*
|
||||
* Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 250
|
||||
* SMTP CODE SUCCESS: 552,451,452
|
||||
* SMTP CODE SUCCESS: 500,501,421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Mail($from) {
|
||||
$this->error = null; // so no confusion is caused
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called Mail() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
$useVerp = ($this->do_verp ? "XVERP" : "");
|
||||
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 250) {
|
||||
$this->error =
|
||||
array("error" => "MAIL not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the quit command to the server and then closes the socket
|
||||
* if there is no error or the $close_on_error argument is true.
|
||||
*
|
||||
* Implements from rfc 821: QUIT <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 221
|
||||
* SMTP CODE ERROR : 500
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Quit($close_on_error = true) {
|
||||
$this->error = null; // so there is no confusion
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called Quit() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// send the quit command to the server
|
||||
fputs($this->smtp_conn,"quit" . $this->CRLF);
|
||||
|
||||
// get any good-bye messages
|
||||
$byemsg = $this->get_lines();
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
$rval = true;
|
||||
$e = null;
|
||||
|
||||
$code = substr($byemsg,0,3);
|
||||
if($code != 221) {
|
||||
// use e as a tmp var cause Close will overwrite $this->error
|
||||
$e = array("error" => "SMTP server rejected quit command",
|
||||
"smtp_code" => $code,
|
||||
"smtp_rply" => substr($byemsg,4));
|
||||
$rval = false;
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($e) || $close_on_error) {
|
||||
$this->Close();
|
||||
}
|
||||
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the command RCPT to the SMTP server with the TO: argument of $to.
|
||||
* Returns true if the recipient was accepted false if it was rejected.
|
||||
*
|
||||
* Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 250,251
|
||||
* SMTP CODE FAILURE: 550,551,552,553,450,451,452
|
||||
* SMTP CODE ERROR : 500,501,503,421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Recipient($to) {
|
||||
$this->error = null; // so no confusion is caused
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called Recipient() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 250 && $code != 251) {
|
||||
$this->error =
|
||||
array("error" => "RCPT not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the RSET command to abort and transaction that is
|
||||
* currently in progress. Returns true if successful false
|
||||
* otherwise.
|
||||
*
|
||||
* Implements rfc 821: RSET <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 250
|
||||
* SMTP CODE ERROR : 500,501,504,421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Reset() {
|
||||
$this->error = null; // so no confusion is caused
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called Reset() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
fputs($this->smtp_conn,"RSET" . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 250) {
|
||||
$this->error =
|
||||
array("error" => "RSET failed",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a mail transaction from the email address specified in
|
||||
* $from. Returns true if successful or false otherwise. If True
|
||||
* the mail transaction is started and then one or more Recipient
|
||||
* commands may be called followed by a Data command. This command
|
||||
* will send the message to the users terminal if they are logged
|
||||
* in and send them an email.
|
||||
*
|
||||
* Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 250
|
||||
* SMTP CODE SUCCESS: 552,451,452
|
||||
* SMTP CODE SUCCESS: 500,501,502,421
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function SendAndMail($from) {
|
||||
$this->error = null; // so no confusion is caused
|
||||
|
||||
if(!$this->connected()) {
|
||||
$this->error = array(
|
||||
"error" => "Called SendAndMail() without being connected");
|
||||
return false;
|
||||
}
|
||||
|
||||
fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
|
||||
|
||||
$rply = $this->get_lines();
|
||||
$code = substr($rply,0,3);
|
||||
|
||||
if($this->do_debug >= 2) {
|
||||
echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
|
||||
if($code != 250) {
|
||||
$this->error =
|
||||
array("error" => "SAML not accepted from server",
|
||||
"smtp_code" => $code,
|
||||
"smtp_msg" => substr($rply,4));
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an optional command for SMTP that this class does not
|
||||
* support. This method is here to make the RFC821 Definition
|
||||
* complete for this class and __may__ be implimented in the future
|
||||
*
|
||||
* Implements from rfc 821: TURN <CRLF>
|
||||
*
|
||||
* SMTP CODE SUCCESS: 250
|
||||
* SMTP CODE FAILURE: 502
|
||||
* SMTP CODE ERROR : 500, 503
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function Turn() {
|
||||
$this->error = array("error" => "This method, TURN, of the SMTP ".
|
||||
"is not implemented");
|
||||
if($this->do_debug >= 1) {
|
||||
echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current error
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getError() {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// INTERNAL FUNCTIONS
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Read in as many lines as possible
|
||||
* either before eof or socket timeout occurs on the operation.
|
||||
* With SMTP we can tell if we have more lines to read if the
|
||||
* 4th character is '-' symbol. If it is a space then we don't
|
||||
* need to read anything else.
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
private function get_lines() {
|
||||
$data = "";
|
||||
while(!feof($this->smtp_conn)) {
|
||||
$str = @fgets($this->smtp_conn,515);
|
||||
if($this->do_debug >= 4) {
|
||||
echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
|
||||
echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
|
||||
}
|
||||
$data .= $str;
|
||||
if($this->do_debug >= 4) {
|
||||
echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
|
||||
}
|
||||
// if 4th character is a space, we are done reading, break the loop
|
||||
if(substr($str,3,1) == " ") { break; }
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Appsettings_model extends CI_model
|
||||
{
|
||||
public function getappbyid()
|
||||
{
|
||||
return $this->db->get_where('app_settings', ['id' => '1'])->row_array();
|
||||
}
|
||||
|
||||
public function gettransfer()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_bank');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getbankid($id)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_bank');
|
||||
$this->db->where('id_bank', $id);
|
||||
return $this->db->get()->row_array();
|
||||
}
|
||||
|
||||
public function ubahdataappsettings($data)
|
||||
{
|
||||
$this->db->set('app_logo', $data['app_logo']);
|
||||
$this->db->set('app_email', $data['app_email']);
|
||||
$this->db->set('app_website', $data['app_website']);
|
||||
|
||||
$this->db->set('app_privacy_policy', $data['app_privacy_policy']);
|
||||
$this->db->set('app_aboutus', $data['app_aboutus']);
|
||||
$this->db->set('app_address', $data['app_address']);
|
||||
$this->db->set('app_name', $data['app_name']);
|
||||
$this->db->set('app_contact', $data['app_contact']);
|
||||
$this->db->set('app_linkgoogle', $data['app_linkgoogle']);
|
||||
$this->db->set('app_currency', $data['app_currency']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdatarekening($data, $id)
|
||||
{
|
||||
$this->db->where('id_bank', $id);
|
||||
$this->db->update('list_bank', $data);
|
||||
}
|
||||
|
||||
public function hapusrekening($id)
|
||||
{
|
||||
$this->db->where('id_bank', $id);
|
||||
$this->db->delete('list_bank');
|
||||
}
|
||||
|
||||
public function adddatarekening($data)
|
||||
{
|
||||
$this->db->insert('list_bank', $data);
|
||||
}
|
||||
|
||||
public function ubahdataemail($data)
|
||||
{
|
||||
$this->db->set('email_subject', $data['email_subject']);
|
||||
$this->db->set('email_text1', $data['email_text1']);
|
||||
$this->db->set('email_text2', $data['email_text2']);
|
||||
$this->db->set('email_subject_confirm', $data['email_subject_confirm']);
|
||||
$this->db->set('email_text3', $data['email_text3']);
|
||||
$this->db->set('email_text4', $data['email_text4']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahxendit($data)
|
||||
{
|
||||
$this->db->set('api_keyxendit', $data['api_keyxendit']);
|
||||
$this->db->set('apikey_server', $data['apikey_server']);
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdataayopesan($data)
|
||||
{
|
||||
$this->db->set('api_password', $data['api_password']);
|
||||
$this->db->set('harga_pulsa', $data['harga_pulsa']);
|
||||
$this->db->set('api_token', $data['api_token']);
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdatasmtp($data)
|
||||
{
|
||||
$this->db->set('smtp_host', $data['smtp_host']);
|
||||
$this->db->set('smtp_port', $data['smtp_port']);
|
||||
$this->db->set('smtp_username', $data['smtp_username']);
|
||||
$this->db->set('smtp_password', $data['smtp_password']);
|
||||
$this->db->set('smtp_from', $data['smtp_from']);
|
||||
$this->db->set('smtp_secure', $data['smtp_secure']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdatamobilepulsa($data)
|
||||
{
|
||||
$this->db->set('mobilepulsa_username', $data['mobilepulsa_username']);
|
||||
$this->db->set('mobilepulsa_harga', $data['mobilepulsa_harga']);
|
||||
$this->db->set('mobilepulsa_api_key', $data['mobilepulsa_api_key']);
|
||||
$this->db->set('mp_status', $data['mp_status']);
|
||||
$this->db->set('mp_active', $data['mp_active']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class categorymerchant_model extends CI_model
|
||||
{
|
||||
public function getAllcm()
|
||||
{
|
||||
$this->db->where('category_merchant.id_fitur != 0');
|
||||
$this->db->join('fitur', 'category_merchant.id_fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get('category_merchant')->result_array();
|
||||
}
|
||||
|
||||
public function getfiturmerchant()
|
||||
{
|
||||
$this->db->where('home = 4');
|
||||
return $this->db->get('fitur')->result_array();
|
||||
}
|
||||
|
||||
public function tambahcm($data)
|
||||
{
|
||||
$this->db->insert('category_merchant', $data);
|
||||
}
|
||||
|
||||
public function hapuscm($id)
|
||||
{
|
||||
$this->db->where('id_kategori_merchant', $id);
|
||||
$this->db->delete('category_merchant');
|
||||
}
|
||||
|
||||
public function ubahcm($data, $id)
|
||||
{
|
||||
$this->db->set('nama_kategori', $data['nama_kategori']);
|
||||
$this->db->set('id_fitur', $data['id_fitur']);
|
||||
$this->db->set('status_kategori', $data['status_kategori']);
|
||||
$this->db->where('id_kategori_merchant', $id);
|
||||
$this->db->update('category_merchant');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Dashboard_model extends CI_model
|
||||
{
|
||||
public function getAlltransaksi()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function getAlltransaksi1()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function getAlltransaksi3()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 3');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getSuksestransaksi()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 5');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getSuksestransaksi1()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 5');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function getSuksestransaksi3()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 5');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 3');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
|
||||
function getTotalTransaksiBulanan($bulan, $tahun, $typefitur)
|
||||
{
|
||||
// lihat tranasksi tanpa limit 15
|
||||
$query = $this->db->query("
|
||||
SELECT COUNT(transaksi.id) as jumlah
|
||||
FROM transaksi
|
||||
left join fitur on transaksi.order_fitur = fitur.id_fitur
|
||||
left join history_transaksi on transaksi.id = history_transaksi.id_transaksi
|
||||
|
||||
WHERE MONTH(waktu_selesai) = $bulan
|
||||
AND YEAR(waktu_selesai) = $tahun
|
||||
AND fitur.home = $typefitur
|
||||
AND history_transaksi.status = 4
|
||||
");
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
public function getbydate()
|
||||
{
|
||||
$day = date('d');
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
$this->db->select('fitur.fitur');
|
||||
$this->db->select("
|
||||
(SELECT COUNT(tr.id)
|
||||
FROM transaksi tr
|
||||
left join history_transaksi on tr.id = history_transaksi.id_transaksi
|
||||
WHERE DAY(tr.waktu_selesai) = $day
|
||||
AND tr.order_fitur = fitur.id_fitur
|
||||
AND history_transaksi.status = 4) as hari
|
||||
");
|
||||
$this->db->select("
|
||||
(SELECT COUNT(tr.id)
|
||||
FROM transaksi tr
|
||||
left join history_transaksi on tr.id = history_transaksi.id_transaksi
|
||||
WHERE MONTH(tr.waktu_selesai) = $month
|
||||
AND tr.order_fitur = fitur.id_fitur
|
||||
AND history_transaksi.status = 4) as bulan
|
||||
");
|
||||
$this->db->select("
|
||||
(SELECT COUNT(tr.id)
|
||||
FROM transaksi tr
|
||||
left join history_transaksi on tr.id = history_transaksi.id_transaksi
|
||||
WHERE YEAR(tr.waktu_selesai) = $year
|
||||
AND tr.order_fitur = fitur.id_fitur
|
||||
AND history_transaksi.status = 4) as tahun
|
||||
");
|
||||
$this->db->from('fitur');
|
||||
return $this->db->get()->result_array();
|
||||
|
||||
}
|
||||
|
||||
function getTotalTransaksiharian($hari, $fitur)
|
||||
{
|
||||
// lihat tranasksi tanpa limit 15
|
||||
$query = $this->db->query("
|
||||
SELECT COUNT(transaksi.id) as jumlah
|
||||
FROM transaksi
|
||||
left join history_transaksi on transaksi.id = history_transaksi.id_transaksi
|
||||
|
||||
WHERE DAY(waktu_selesai) = $hari
|
||||
AND history_transaksi.status = 4
|
||||
");
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
public function getallsaldo()
|
||||
{
|
||||
$this->db->select('SUM(biaya_akhir)as total');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->where('history_transaksi.status = 4');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
public function getallsaldo1()
|
||||
{
|
||||
$this->db->select('SUM(biaya_akhir)as total');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->where('history_transaksi.status = 4');
|
||||
$this->db->where('driver.wilayah = 1');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
public function getallsaldo3()
|
||||
{
|
||||
$this->db->select('SUM(biaya_akhir)as total');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->where('history_transaksi.status = 4');
|
||||
$this->db->where('driver.wilayah = 3');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
|
||||
public function getAllfitur()
|
||||
{
|
||||
return $this->db->get('fitur')->result_array();
|
||||
}
|
||||
|
||||
public function gettransaksibyid($id)
|
||||
{
|
||||
$this->db->select('merchant.*');
|
||||
$this->db->select('transaksi_detail_merchant.total_biaya as total_belanja');
|
||||
$this->db->select('transaksi_detail_send.*');
|
||||
$this->db->select('history_transaksi.*');
|
||||
$this->db->select('status_transaksi.*');
|
||||
$this->db->select('voucher.*');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->select('rating_driver.*');
|
||||
$this->db->select('pelanggan.fullnama,pelanggan.email as email_pelanggan,pelanggan.no_telepon as telepon_pelanggan,pelanggan.fotopelanggan,pelanggan.token');
|
||||
$this->db->select('driver.nama_driver,driver.foto,driver.email,driver.no_telepon,driver.reg_id');
|
||||
$this->db->select('transaksi.*');
|
||||
|
||||
$this->db->join('transaksi_detail_merchant', 'transaksi.id = transaksi_detail_merchant.id_transaksi', 'left');
|
||||
$this->db->join('merchant', 'transaksi_detail_merchant.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->join('transaksi_detail_send', 'transaksi.id = transaksi_detail_send.id_transaksi', 'left');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('voucher', 'transaksi.order_fitur = voucher.untuk_fitur', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->join('rating_driver', 'transaksi.id = rating_driver.id_transaksi', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get_where('transaksi', ['transaksi.id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function getitem($id)
|
||||
{
|
||||
$this->db->where("transaksi_item.id_transaksi = $id");
|
||||
$this->db->join('item', 'transaksi_item.id_item = item.id_item', 'left');
|
||||
return $this->db->get('transaksi_item')->result_array();
|
||||
}
|
||||
|
||||
public function ubahstatustransaksibyid($id)
|
||||
{
|
||||
$this->db->set('status', 5);
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->update('history_transaksi');
|
||||
}
|
||||
|
||||
public function ubahstatusdriverbyid($id_driver)
|
||||
{
|
||||
$this->db->set('status', 4);
|
||||
$this->db->where('id_driver', $id_driver);
|
||||
$this->db->update('config_driver');
|
||||
}
|
||||
|
||||
public function deletetransaksi($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('transaksi');
|
||||
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->delete('history_transaksi');
|
||||
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->delete('rating_driver');
|
||||
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->delete('transaksi_detail_send');
|
||||
}
|
||||
|
||||
public function countdriver0()
|
||||
{
|
||||
|
||||
$this->db->where('status != 0');
|
||||
return $this->db->get('driver')->result_array();
|
||||
}
|
||||
|
||||
public function countdriver()
|
||||
{
|
||||
$this->db->where('wilayah = 1');
|
||||
$this->db->where('status != 0');
|
||||
return $this->db->get('driver')->result_array();
|
||||
}
|
||||
|
||||
public function countdriver3()
|
||||
{
|
||||
$this->db->where('wilayah = 3');
|
||||
$this->db->where('status != 0');
|
||||
return $this->db->get('driver')->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function countmitra0()
|
||||
{
|
||||
$this->db->where('status_mitra != 0');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
public function countmitra()
|
||||
{
|
||||
$this->db->where('wilayah = 1');
|
||||
$this->db->where('status_mitra != 0');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
public function countmitra3()
|
||||
{
|
||||
$this->db->where('wilayah = 3');
|
||||
$this->db->where('status_mitra != 0');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
|
||||
|
||||
class email_model extends CI_model
|
||||
{
|
||||
function emailsend($subject, $emailuser, $content, $host, $port, $username, $password, $from, $appname, $secure)
|
||||
{
|
||||
require APPPATH . '/libraries/class.phpmailer.php';
|
||||
$mail = new PHPMailer;
|
||||
$mail->IsSMTP();
|
||||
$mail->SMTPSecure = $secure;
|
||||
$mail->Host = $host; //host masing2 provider email
|
||||
$mail->SMTPDebug = 0;
|
||||
$mail->Port = $port;
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $username; //user email
|
||||
$mail->Password = $password; //password email
|
||||
$mail->SetFrom($from, $appname); //set email pengirim
|
||||
$mail->Subject = $subject; //subyek email
|
||||
$mail->AddAddress($emailuser, "User"); //tujuan email
|
||||
$mail->MsgHTML($content); //pesan dapat berupa html
|
||||
$mail->Send();
|
||||
return true;
|
||||
var_dump($content);
|
||||
die();
|
||||
}
|
||||
|
||||
function template2($subject, $emailmessage, $address, $appname, $linkgoogle, $web)
|
||||
{
|
||||
|
||||
$msg = '<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
|
||||
<head>
|
||||
<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
||||
<meta content="width=device-width" name="viewport"/>
|
||||
<!--[if !mso]><!-->
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
|
||||
<!--<![endif]-->
|
||||
<title></title>
|
||||
<!--[if !mso]><!-->
|
||||
<!--<![endif]-->
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table,
|
||||
td,
|
||||
tr {
|
||||
vertical-align: top;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
* {
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
a[x-apple-data-detectors=true] {
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
</style>
|
||||
<style id="media-query" type="text/css">
|
||||
@media (max-width: 500px) {
|
||||
|
||||
.block-grid,
|
||||
.col {
|
||||
min-width: 320px !important;
|
||||
max-width: 100% !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.block-grid {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.col {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.col>div {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
img.fullwidth,
|
||||
img.fullwidthOnMobile {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
.no-stack .col {
|
||||
min-width: 0 !important;
|
||||
display: table-cell !important;
|
||||
}
|
||||
|
||||
.no-stack.two-up .col {
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num4 {
|
||||
width: 33% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num8 {
|
||||
width: 66% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num4 {
|
||||
width: 33% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num3 {
|
||||
width: 25% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num6 {
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num9 {
|
||||
width: 75% !important;
|
||||
}
|
||||
|
||||
.video-block {
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
.mobile_hide {
|
||||
min-height: 0px;
|
||||
max-height: 0px;
|
||||
max-width: 0px;
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
font-size: 0px;
|
||||
}
|
||||
|
||||
.desktop_hide {
|
||||
display: block !important;
|
||||
max-height: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="clean-body" style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #FFFFFF;">
|
||||
<!--[if IE]><div class="ie-browser"><![endif]-->
|
||||
<table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" class="nl-container" role="presentation" style="table-layout: fixed; vertical-align: top; min-width: 320px; Margin: 0 auto; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #FFFFFF; width: 100%;" valign="top" width="100%">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;" valign="top">
|
||||
<td style="word-break: break-word; vertical-align: top;" valign="top">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color:#FFFFFF"><![endif]-->
|
||||
<div style="background-color:transparent;">
|
||||
<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
|
||||
<!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 28px; line-height: 1.2; word-break: break-word; mso-line-height-alt: 34px; margin: 0;"><span style="font-size: 28px;"><strong>' . $subject . '</strong></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;" valign="top">
|
||||
<td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;" valign="top">
|
||||
<table align="left" border="0" cellpadding="0" cellspacing="0" class="divider_content" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 8px solid #6DC0FF; width: 70%;" valign="top" width="70%">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;" valign="top">
|
||||
<td style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 14px; line-height: 1.2; word-break: break-word; mso-line-height-alt: 17px; margin: 0;">' . $emailmessage . '</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color:transparent;">
|
||||
<div class="block-grid two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
|
||||
<!--[if (mso)|(IE)]><td align="center" width="240" style="background-color:transparent;width:240px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num6" style="max-width: 320px; min-width: 240px; display: table-cell; vertical-align: top; width: 240px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 15px; padding-left: 15px; padding-top: 30px; padding-bottom: 30px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:30px;padding-right:15px;padding-bottom:30px;padding-left:15px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 14px; line-height: 1.2; word-break: break-word; mso-line-height-alt: 17px; margin: 0;">' . $address . '</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td><td align="center" width="240" style="background-color:transparent;width:240px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num6" style="max-width: 320px; min-width: 240px; display: table-cell; vertical-align: top; width: 240px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;">
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><a href="' . $linkgoogle . '" style="outline:none" tabindex="-1" target="_blank"> <img align="center" alt="Alternate text" border="0" class="center fixedwidth" src="https://learn.karinesia.com/iklan/delip.gif" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; width: 100%; max-width: 240px; display: block;" title="Alternate text" width="240"/></a>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
</div>
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color:transparent;">
|
||||
<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
|
||||
<!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 14px; line-height: 1.2; word-break: break-word; text-align: center; mso-line-height-alt: 17px; margin: 0;">Copyright © 2020 <a href="' . $web . '" rel="noopener" style="text-decoration: underline; color: #0068A5;" target="_blank">' . $appname . '</a>. All Rights Reserved</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;">
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><a href="' . $web . '" style="outline:none" tabindex="-1" target="_blank"> </a>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
</div>
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if (IE)]></div><![endif]-->
|
||||
</body>
|
||||
</html>';
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class login_model extends CI_Model
|
||||
{
|
||||
function cek_login($where)
|
||||
{
|
||||
return $this->db->get_where('admin', $where)->row_array();
|
||||
}
|
||||
|
||||
function ambil_menu($data)
|
||||
{
|
||||
// $this->db->where('id_role', $data['admin_role']);
|
||||
// return $this->db->get('admin_menu_role')->result_array();
|
||||
|
||||
$this->db->select('amr.*, ap.nama_fitur, ap.url,ap.nama_fitur,ap.urut,ap.foregn,ap.nama_fitur,ap.icon');
|
||||
$this->db->from('admin_menu_role amr');
|
||||
$this->db->join('admin_privilage ap', 'ap.id = amr.id_privilage', 'left');
|
||||
$this->db->where('amr.id_role', $data['admin_role']);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Merchantapi_model extends CI_model
|
||||
{
|
||||
|
||||
public function check_banned($phone)
|
||||
{
|
||||
$stat = $this->db->query("SELECT id_mitra FROM mitra WHERE status_mitra='3' AND telepon_mitra='$phone'");
|
||||
if ($stat->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_exist($email, $phone)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where email_mitra = '$email' AND telepon_mitra='$phone'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_exist_phone($phone)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where telepon_mitra='$phone'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public function check_exist_email($email)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where email_mitra='$email'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_ktp($ktp)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where nomor_identitas_mitra='$ktp'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_partner_region()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('partner_region');
|
||||
$this->db->where('status_region', '1');
|
||||
return $this->db->get()->result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_data_merchant($condition)
|
||||
{
|
||||
$this->db->select('mitra.*, saldo.saldo, merchant.*');
|
||||
$this->db->from('mitra');
|
||||
$this->db->join('saldo', 'mitra.id_mitra = saldo.id_user');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant');
|
||||
$this->db->where($condition);
|
||||
$this->db->where('status_mitra', '1');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function onmerchant($data, $where)
|
||||
{
|
||||
$this->db->where($where);
|
||||
$this->db->update('merchant', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edit_profile_token($data, $phone)
|
||||
{
|
||||
$this->db->where('telepon_merchant', $phone);
|
||||
$this->db->update('merchant', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edit_profile($data, $phone)
|
||||
{
|
||||
$this->db->where('telepon_mitra', $phone);
|
||||
$this->db->update('mitra', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edit_profile_mitra_merchant($data, $phone)
|
||||
{
|
||||
$datamitra = [
|
||||
'nama_mitra' => $data['nama'],
|
||||
'telepon_mitra' => $data['no_telepon'],
|
||||
'phone_mitra' => $data['phone'],
|
||||
'email_mitra' => $data['email'],
|
||||
'bank' => $data['bank'],
|
||||
'norek_mitra' => $data['norek_mitra'],
|
||||
'nama_rekening' => $data['nama_rekening'],
|
||||
'country_code_mitra' => $data['countrycode'],
|
||||
'alamat_mitra' => $data['alamat']
|
||||
];
|
||||
|
||||
$datamerchant = [
|
||||
'telepon_merchant' => $data['no_telepon'],
|
||||
'phone_merchant' => $data['phone'],
|
||||
'country_code_merchant' => $data['countrycode']
|
||||
];
|
||||
|
||||
$this->db->where('telepon_merchant', $phone);
|
||||
$this->db->update('merchant', $datamerchant);
|
||||
|
||||
$this->db->where('telepon_mitra', $phone);
|
||||
$this->db->update('mitra', $datamitra);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function signup($data_signup, $data_merchant, $data_berkas)
|
||||
{
|
||||
$this->db->insert('merchant', $data_merchant);
|
||||
$inserid = $this->db->insert_id();
|
||||
$datasignup = array(
|
||||
'id_mitra' => $data_signup['id_mitra'],
|
||||
'nama_mitra' => $data_signup['nama_mitra'],
|
||||
'jenis_identitas_mitra' => $data_signup['jenis_identitas_mitra'],
|
||||
'nomor_identitas_mitra' => $data_signup['nomor_identitas_mitra'],
|
||||
'alamat_mitra' => $data_signup['alamat_mitra'],
|
||||
'email_mitra' => $data_signup['email_mitra'],
|
||||
'bank' => $data_signup['bank'],
|
||||
'norek_mitra' => $data_signup['norek_mitra'],
|
||||
'nama_rekening' => $data_signup['nama_rekening'],
|
||||
'password' => $data_signup['password'],
|
||||
'telepon_mitra' => $data_signup['telepon_mitra'],
|
||||
'phone_mitra' => $data_signup['phone_mitra'],
|
||||
'partner_region' => $data_signup['partner_region'],
|
||||
'country_code_mitra' => $data_signup['country_code_mitra'],
|
||||
'partner' => '0',
|
||||
'id_merchant' => $inserid,
|
||||
'status_mitra' => '0'
|
||||
);
|
||||
$signup = $this->db->insert('mitra', $datasignup);
|
||||
|
||||
$databerkas = array(
|
||||
'id_driver' => $data_signup['id_mitra'],
|
||||
'foto_ktp' => $data_berkas['foto_ktp'],
|
||||
'foto_sim' => "",
|
||||
'id_sim' => ""
|
||||
);
|
||||
$insberkas = $this->db->insert('berkas_driver', $databerkas);
|
||||
|
||||
$datasaldo = array(
|
||||
'id_user' => $data_signup['id_mitra'],
|
||||
'saldo' => 0
|
||||
);
|
||||
$insSaldo = $this->db->insert('saldo', $datasaldo);
|
||||
return $signup;
|
||||
}
|
||||
|
||||
public function transaksi_home($idmerchant)
|
||||
{
|
||||
$this->db->select('transaksi_detail_merchant.*, history_transaksi.*, transaksi.id_pelanggan, pelanggan.fullnama, (SELECT SUM(ti.jumlah_item)
|
||||
FROM transaksi_item ti
|
||||
WHERE ti.id_transaksi = transaksi_detail_merchant.id_transaksi) quantity, pelanggan.fullnama');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('transaksi', 'transaksi_detail_merchant.id_transaksi = transaksi.id');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id');
|
||||
$this->db->where('transaksi_detail_merchant.id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status = 2');
|
||||
$this->db->order_by('transaksi.id DESC');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function transaksi_history($idmerchant)
|
||||
{
|
||||
$this->db->select('transaksi_detail_merchant.*, history_transaksi.*, transaksi.id_pelanggan, pelanggan.fullnama, (SELECT SUM(ti.jumlah_item)
|
||||
FROM transaksi_item ti
|
||||
WHERE ti.id_transaksi = transaksi_detail_merchant.id_transaksi) quantity');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('transaksi', 'transaksi_detail_merchant.id_transaksi = transaksi.id');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id');
|
||||
$this->db->where('transaksi_detail_merchant.id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status != 2');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->order_by('transaksi.id DESC');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_daily($day, $idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) daily');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('date(transaksi_detail_merchant.created)', $day);
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_earning($idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) earning');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_month($month, $idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) month');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('MONTH(transaksi_detail_merchant.created)', $month);
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_yearly($year, $idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) yearly');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('YEAR(transaksi_detail_merchant.created)', $year);
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function kategori_active($idmerchant)
|
||||
{
|
||||
$this->db->select('category_item.*, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.kategori_item = category_item.id_kategori_item) total_item');
|
||||
$this->db->from('category_item');
|
||||
$this->db->where('category_item.id_merchant', $idmerchant);
|
||||
$this->db->where('category_item.all_category != 1');
|
||||
$this->db->where('category_item.status_kategori = 1');
|
||||
return $this->db->get()->result();
|
||||
}
|
||||
public function kategori_nonactive($idmerchant)
|
||||
{
|
||||
$this->db->select('category_item.*, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.kategori_item = category_item.id_kategori_item) total_item');
|
||||
$this->db->from('category_item');
|
||||
$this->db->where('category_item.id_merchant', $idmerchant);
|
||||
$this->db->where('category_item.all_category != 1');
|
||||
$this->db->where('category_item.status_kategori = 0');
|
||||
return $this->db->get()->result();
|
||||
}
|
||||
|
||||
public function itembycatactive($idmerchant, $idcat)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('item');
|
||||
$this->db->where('item.id_merchant', $idmerchant);
|
||||
$this->db->where('item.kategori_item', $idcat);
|
||||
$this->db->order_by('item.id_item DESC');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function totalitemactive($idmerchant)
|
||||
{
|
||||
$this->db->select('COUNT(id_item) as active, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.id_merchant =' . $idmerchant . ' and ti.status_item = 0) as nonactive, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.id_merchant =' . $idmerchant . ' and ti.status_item = 1 and ti.status_promo = 1) as promo');
|
||||
$this->db->from('item');
|
||||
$this->db->where('item.id_merchant', $idmerchant);
|
||||
$this->db->where('item.status_item', '1');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function actived_kategori($id, $status)
|
||||
{
|
||||
$data = array(
|
||||
'status_kategori' => $status
|
||||
);
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->update('category_item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actived_item($id, $status)
|
||||
{
|
||||
$data = array(
|
||||
'status_item' => $status
|
||||
);
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->update('item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addkategori($nama, $status, $id)
|
||||
{
|
||||
$data = array(
|
||||
'nama_kategori_item' => $nama,
|
||||
'status_kategori' => $status,
|
||||
'id_merchant' => $id,
|
||||
'all_category' => 0,
|
||||
);
|
||||
$this->db->insert('category_item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function editkategori($editdata, $id)
|
||||
{
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->update('category_item', $editdata);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deletekategori($id)
|
||||
{
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->delete('category_item');
|
||||
|
||||
$this->db->where('kategori_item', $id);
|
||||
$this->db->delete('item');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function additem($data)
|
||||
{
|
||||
$this->db->insert('item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edititem($editdata, $id)
|
||||
{
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->update('item', $editdata);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteitem($id)
|
||||
{
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->delete('item');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function check_exist_phone_edit($id, $phone)
|
||||
{
|
||||
$cek = $this->db->query("SELECT telepon_mitra FROM mitra where telepon_mitra='$phone' AND id_mitra!='$id'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_exist_email_edit($id, $email)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where email_mitra='$email' AND id_mitra!='$id'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function kategori_merchant_active()
|
||||
{
|
||||
$this->db->select('nama_kategori,id_kategori_merchant');
|
||||
$this->db->where('status_kategori != 0');
|
||||
return $this->db->get('category_merchant')->result_array();
|
||||
}
|
||||
|
||||
public function kategori_merchant_active_data($idfitur)
|
||||
{
|
||||
$this->db->select('nama_kategori,id_kategori_merchant');
|
||||
$this->db->where('status_kategori != 0');
|
||||
$this->db->where('id_fitur', $idfitur);
|
||||
return $this->db->get('category_merchant')->result_array();
|
||||
}
|
||||
|
||||
public function fitur_merchant_active()
|
||||
{
|
||||
$this->db->select('id_fitur,fitur');
|
||||
$this->db->from('fitur');
|
||||
$this->db->where('home = 4');
|
||||
$this->db->where('active', '1');
|
||||
$this->db->order_by('id_fitur ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Mitra_model extends CI_model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getAllmitra()
|
||||
{
|
||||
$this->db->select('category_merchant.nama_kategori');
|
||||
$this->db->select('partner_region.partner_region');
|
||||
$this->db->select('fitur.fitur');
|
||||
$this->db->select('merchant.*');
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->join('category_merchant', 'merchant.category_merchant = category_merchant.id_kategori_merchant', 'left');
|
||||
$this->db->join('partner_region', 'mitra.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('fitur', 'merchant.id_fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
|
||||
public function getmitrabyid($id)
|
||||
{
|
||||
$this->db->select('berkas_driver.foto_ktp');
|
||||
$this->db->select('category_merchant.nama_kategori');
|
||||
$this->db->select('partner_region.partner_region');
|
||||
$this->db->select('fitur.fitur');
|
||||
$this->db->select('saldo.saldo');
|
||||
$this->db->select('merchant.*');
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->join('berkas_driver', 'mitra.id_mitra = berkas_driver.id_driver', 'left');
|
||||
$this->db->join('saldo', 'mitra.id_mitra = saldo.id_user', 'left');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->join('fitur', 'merchant.id_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->join('category_merchant', 'merchant.category_merchant = category_merchant.id_kategori_merchant', 'left');
|
||||
$this->db->join('partner_region', 'mitra.wilayah = partner_region.id', 'left');
|
||||
return $this->db->get_where('mitra', ['mitra.id_mitra' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function countorder($id)
|
||||
{
|
||||
$this->db->select('id_merchant');
|
||||
$query = $this->db->get_where('transaksi_detail_merchant', ['id_merchant' => $id])->result_array();
|
||||
return count($query);
|
||||
}
|
||||
|
||||
public function wallet($id)
|
||||
{
|
||||
$this->db->order_by('wallet.id', 'DESC');
|
||||
return $this->db->get_where('wallet', ['id_user' => $id])->result_array();
|
||||
}
|
||||
|
||||
public function partner_region()
|
||||
{
|
||||
$this->db->from('partner_region');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function blockmitrabyid($id)
|
||||
{
|
||||
$this->db->set('status_mitra', 3);
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function unblockmitrabyid($id)
|
||||
{
|
||||
$this->db->set('status_mitra', 1);
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function get_trans_merchant($idtransaksi)
|
||||
{
|
||||
$this->db->select('mitra.*,transaksi_detail_merchant.id_merchant,transaksi_detail_merchant.total_biaya');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('mitra', 'transaksi_detail_merchant.id_merchant = mitra.id_merchant');
|
||||
$this->db->where('id_transaksi', $idtransaksi);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function getitembyid($id)
|
||||
{
|
||||
$this->db->from('item');
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getitemkbyid($id)
|
||||
{
|
||||
$this->db->from('category_item');
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getmerchantk()
|
||||
{
|
||||
$this->db->from('category_merchant');
|
||||
$this->db->where('id_fitur != 0');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function insertitem($data)
|
||||
{
|
||||
return $this->db->insert('item', $data);
|
||||
}
|
||||
|
||||
public function updateitem($data, $id)
|
||||
{
|
||||
$this->db->set('kategori_item', $data['kategori_item']);
|
||||
$this->db->set('nama_item', $data['nama_item']);
|
||||
$this->db->set('harga_item', $data['harga_item']);
|
||||
$this->db->set('harga_promo', $data['harga_promo']);
|
||||
$this->db->set('id_merchant', $data['id_merchant']);
|
||||
$this->db->set('deskripsi_item', $data['deskripsi_item']);
|
||||
$this->db->set('status_item', $data['status_item']);
|
||||
$this->db->set('status_promo', $data['status_promo']);
|
||||
$this->db->set('foto_item', $data['foto_item']);
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->update('item');
|
||||
}
|
||||
|
||||
public function hapusitembyid($id)
|
||||
{
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->delete('item');
|
||||
}
|
||||
|
||||
public function getfotoitem($id)
|
||||
{
|
||||
|
||||
$this->db->where('id_item', $id);
|
||||
return $this->db->get('item')->row_array();
|
||||
}
|
||||
|
||||
public function getmerchantdetail($id)
|
||||
{
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get('merchant')->row_array();
|
||||
}
|
||||
|
||||
public function getidmitra($id)
|
||||
{
|
||||
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get('mitra')->row_array();
|
||||
}
|
||||
public function get_fitur_merchant()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('fitur');
|
||||
$this->db->where('active', '1');
|
||||
$this->db->where('home', '4');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function updatemerchant($data)
|
||||
{
|
||||
$idmerchant = $data['id_merchant'];
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->update('merchant', $data);
|
||||
}
|
||||
|
||||
public function hapuskategoryitembyId($id)
|
||||
{
|
||||
$this->db->where('kategori_item', $id);
|
||||
$this->db->delete('item');
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->delete('category_item');
|
||||
}
|
||||
|
||||
public function getidmitrabycategory($id)
|
||||
{
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->join('mitra', 'category_item.id_merchant = mitra.id_merchant');
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
return $this->db->get('category_item')->row_array();
|
||||
}
|
||||
|
||||
public function tambahkategoryitembyid($data)
|
||||
{
|
||||
return $this->db->insert('category_item', $data);
|
||||
}
|
||||
|
||||
public function ubahkategoryitembyid($data, $id)
|
||||
{
|
||||
$this->db->set('nama_kategori_item', $data['nama_kategori_item']);
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->update('category_item');
|
||||
}
|
||||
|
||||
public function ubahmitrabyid($data, $idm)
|
||||
{
|
||||
|
||||
$this->db->where('id_mitra', $idm);
|
||||
$this->db->update('mitra', $data);
|
||||
}
|
||||
|
||||
public function ubahfilemitrabyid($data, $id)
|
||||
{
|
||||
$this->db->set('foto_ktp', $data['foto_ktp']);
|
||||
$this->db->where('id_driver', $id);
|
||||
$this->db->update('berkas_driver');
|
||||
|
||||
|
||||
$this->db->set('nomor_identitas_mitra', $data['nomor_identitas_mitra']);
|
||||
$this->db->set('jenis_identitas_mitra', $data['jenis_identitas_mitra']);
|
||||
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function ubahpassmitrabyid($data, $idm)
|
||||
{
|
||||
$this->db->set('password', $data['password']);
|
||||
$this->db->where('id_mitra', $idm);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function gettranshistory($id)
|
||||
{
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('transaksi_item.*');
|
||||
$this->db->select('transaksi.*');
|
||||
$this->db->select('transaksi_detail_merchant.*');
|
||||
|
||||
$this->db->join('transaksi_item', 'transaksi_detail_merchant.id_transaksi = transaksi_item.id_transaksi', 'left');
|
||||
$this->db->join('transaksi', 'transaksi_detail_merchant.id_transaksi = transaksi.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
return $this->db->get_where('transaksi_detail_merchant', "transaksi_detail_merchant.id_merchant = $id")->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function hapusmitrabyid($id)
|
||||
{
|
||||
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('wallet');
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('saldo');
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->delete('mitra');
|
||||
}
|
||||
|
||||
public function ubahstatusmitra($id)
|
||||
{
|
||||
|
||||
|
||||
$mitra = $this->getmitrabyid($id);
|
||||
$idmerchant = $mitra['id_merchant'];
|
||||
|
||||
$this->db->set('status_mitra', '1');
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
|
||||
$this->db->set('status_merchant', '1');
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->update('merchant');
|
||||
}
|
||||
|
||||
public function insertmerchant($data)
|
||||
{
|
||||
$this->db->insert('merchant', $data);
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
public function tambahkanmitra($datamitra, $databerkas, $datasaldo)
|
||||
{
|
||||
$this->db->insert('mitra', $datamitra);
|
||||
$this->db->insert('berkas_driver', $databerkas);
|
||||
$this->db->insert('saldo', $datasaldo);
|
||||
}
|
||||
|
||||
public function getitembyiditem($id)
|
||||
{
|
||||
$this->db->from('item');
|
||||
$this->db->where('id_item', $id);
|
||||
return $this->db->get()->row_array();
|
||||
}
|
||||
|
||||
public function getberkasbyid($id)
|
||||
{
|
||||
$this->db->where('id_driver', $id);
|
||||
return $this->db->get('berkas_driver')->row_array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
class News_model extends CI_model
|
||||
{
|
||||
public function getAllnews()
|
||||
{
|
||||
// $this->db->select('config_driver.status as status_job');
|
||||
// $this->db->select('driver_job.driver_job');
|
||||
// $this->db->select('driver.*');
|
||||
// $this->db->join('config_driver', 'driver.id = config_driver.id_driver', 'left');
|
||||
$this->db->join('kategori_news', 'berita.id_kategori = kategori_news.id_kategori_news', 'left');
|
||||
return $this->db->get('berita')->result_array();
|
||||
}
|
||||
|
||||
public function getallkategorinews()
|
||||
{
|
||||
return $this->db->get('kategori_news')->result_array();
|
||||
}
|
||||
|
||||
public function tambahdataberita($data)
|
||||
{
|
||||
return $this->db->insert('berita', $data);
|
||||
}
|
||||
|
||||
public function getnewsbyid($id)
|
||||
{
|
||||
return $this->db->get_where('berita', ['id_berita' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function hapuskategoribyId($id)
|
||||
{
|
||||
$this->db->where('id_kategori_news', $id);
|
||||
$this->db->delete('kategori_news');
|
||||
}
|
||||
public function hapusberitabyId($id)
|
||||
{
|
||||
$this->db->where('id_berita', $id);
|
||||
$this->db->delete('berita');
|
||||
}
|
||||
|
||||
public function ubahdataberita($data)
|
||||
{
|
||||
|
||||
$this->db->set('foto_berita', $data['foto_berita']);
|
||||
$this->db->set('title', $data['title']);
|
||||
$this->db->set('content', $data['content']);
|
||||
$this->db->set('id_kategori', $data['id_kategori']);
|
||||
$this->db->set('status_berita', $data['status_berita']);
|
||||
|
||||
$this->db->where('id_berita', $data['id_berita']);
|
||||
$this->db->update('berita', $data);
|
||||
}
|
||||
|
||||
public function tambahdatakategori($data)
|
||||
{
|
||||
$this->db->set('kategori', $data['kategori']);
|
||||
$this->db->insert('kategori_news', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
class notification_model extends CI_model
|
||||
{
|
||||
public function notif_cancel_user($id_driver, $id_transaksi, $token_user)
|
||||
{
|
||||
|
||||
$datanotif = array(
|
||||
'id_driver' => $id_driver,
|
||||
'id_transaksi' => $id_transaksi,
|
||||
'response' => '5',
|
||||
'type' => 1
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $datanotif,
|
||||
'to' => $token_user
|
||||
);
|
||||
$headers = array(
|
||||
"Content-Type: application/json",
|
||||
"Authorization: key=" . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function notif_cancel_driver($id_transaksi, $token_driver)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'id_transaksi' => $id_transaksi,
|
||||
'response' => '0',
|
||||
'type' => 1
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => $token_driver
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
"Content-Type: application/json",
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function send_notif($title, $message, $topic)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'type' => 4
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => '/topics/' . $topic
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
'Content-Type : application/json',
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function send_notif_topup($title, $id, $message, $method, $token)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'title' => $title,
|
||||
'id' => $id,
|
||||
'message' => $message,
|
||||
'method' => $method,
|
||||
'type' => 3
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => $token
|
||||
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
'Content-Type : application/json',
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class partnerregion_model extends CI_model
|
||||
{
|
||||
public function getAllpartnerregion()
|
||||
{
|
||||
return $this->db->get('partner_region')->result_array();
|
||||
}
|
||||
|
||||
public function addpartnerregion($data)
|
||||
{
|
||||
$this->db->insert('partner_region', $data);
|
||||
}
|
||||
|
||||
public function getpartnerregionbyid($id)
|
||||
{
|
||||
return $this->db->get_where('partner_region', ['id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function editdatapartnerregion($data)
|
||||
{
|
||||
|
||||
$this->db->set('nama_cabang', $data['nama_cabang']);
|
||||
$this->db->set('partner_region', $data['partner_region']);
|
||||
$this->db->set('status_region', $data['status_region']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
return $this->db->update('partner_region', $data);
|
||||
}
|
||||
|
||||
public function deletepartnerregionbyId($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('partner_region');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class partnerjob_model extends CI_model
|
||||
{
|
||||
public function getAllpartnerjob()
|
||||
{
|
||||
return $this->db->get('driver_job')->result_array();
|
||||
}
|
||||
|
||||
public function addpartnerjob($data)
|
||||
{
|
||||
$this->db->insert('driver_job', $data);
|
||||
}
|
||||
|
||||
public function getpartnerjobbyid($id)
|
||||
{
|
||||
return $this->db->get_where('driver_job', ['id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function editdatapartnerjob($data)
|
||||
{
|
||||
|
||||
$this->db->set('icon', $data['icon']);
|
||||
$this->db->set('driver_job', $data['driver_job']);
|
||||
$this->db->set('status_job', $data['status_job']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
return $this->db->update('driver_job', $data);
|
||||
}
|
||||
|
||||
public function deletepartnerjobbyId($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('driver_job');
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
class Profile_model extends CI_model
|
||||
{
|
||||
|
||||
public function getRole()
|
||||
{
|
||||
return $this->db->get('admin_role')->result_array();
|
||||
}
|
||||
public function getRole1()
|
||||
{
|
||||
$this->db->select('admin_role.*');
|
||||
$this->db->from('admin_role');
|
||||
$this->db->where('admin_role.id != 1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function tambahadmin($data)
|
||||
{
|
||||
$this->db->insert('admin', $data);
|
||||
}
|
||||
|
||||
public function unblockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('admin');
|
||||
}
|
||||
public function blockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 0);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('admin');
|
||||
}
|
||||
public function getadmingedit($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('admin')->row_array();
|
||||
}
|
||||
public function ubahdataadmin($data)
|
||||
{
|
||||
$this->db->set('user_name', $data['user_name']);
|
||||
$this->db->set('nama',$data['nama']);
|
||||
$this->db->set('email', $data['email']);
|
||||
$this->db->set('image', $data['image']);
|
||||
$this->db->set('password', $data['password']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin', $data);
|
||||
}
|
||||
|
||||
public function hapus_pengguna($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('admin');
|
||||
}
|
||||
public function getadmin()
|
||||
{
|
||||
|
||||
$this->db->select('adm.*, ar.nama_role');
|
||||
$this->db->select('adm.*, rg.partner_region');
|
||||
$this->db->from('admin adm');
|
||||
$this->db->join('admin_role ar', 'ar.id = adm.admin_role', 'left');
|
||||
$this->db->join('partner_region rg', 'rg.id = adm.wilayah', 'left');
|
||||
// $this->db->where('amr.id_role', $data['admin_role']);
|
||||
return $this->db->get()->result_array();
|
||||
// return $this->db->get('admin')->result_array();
|
||||
}
|
||||
public function getadminRole()
|
||||
{
|
||||
return $this->db->get('admin_role')->result_array();
|
||||
}
|
||||
|
||||
public function getRegion()
|
||||
{
|
||||
return $this->db->get('partner_region')->result_array();
|
||||
}
|
||||
public function tambahrole($data)
|
||||
{
|
||||
$this->db->insert('admin_role', $data);
|
||||
}
|
||||
|
||||
public function getadminrolegedit($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('admin_role')->row_array();
|
||||
}
|
||||
|
||||
public function editrole($data)
|
||||
{
|
||||
$this->db->set('nama_role', $data['nama_role']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin_role', $data);
|
||||
}
|
||||
|
||||
|
||||
public function getadminRolePrivilage()
|
||||
{
|
||||
return $this->db->get('admin_privilage')->result_array();
|
||||
}
|
||||
|
||||
public function getmenuSubPrifilage()
|
||||
{
|
||||
$url = 'Not';
|
||||
// $this->db->where('menu_utama',$url);
|
||||
// return $this->db->get('admin_privilage')->row_array();
|
||||
$this->db->select('adm.id as id_adm_pri, adm.nama_fitur');
|
||||
$this->db->from('admin_privilage adm');
|
||||
$this->db->where('adm.url', $url);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function tambahprifilage($data)
|
||||
{
|
||||
$this->db->insert('admin_privilage', $data);
|
||||
}
|
||||
|
||||
public function getadminPrifilagedit($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('admin_privilage')->row_array();
|
||||
}
|
||||
|
||||
public function editprifilage($data)
|
||||
{
|
||||
$this->db->set('url', $data['url']);
|
||||
$this->db->set('nama_fitur', $data['nama_fitur']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin_privilage', $data);
|
||||
}
|
||||
public function editprifilageSub($data)
|
||||
{
|
||||
$this->db->set('foregn', $data['foregn']);
|
||||
$this->db->set('url', $data['url']);
|
||||
$this->db->set('nama_fitur', $data['nama_fitur']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin_privilage', $data);
|
||||
}
|
||||
|
||||
|
||||
public function getmenuPrifilage($id)
|
||||
{
|
||||
$this->db->where('id_role',$id);
|
||||
return $this->db->get('admin_menu_role')->result_array();
|
||||
}
|
||||
|
||||
public function deledemenurolprifilage($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('admin_menu_role');
|
||||
}
|
||||
public function tambahmenurolprifilage($data)
|
||||
{
|
||||
$this->db->insert('admin_menu_role', $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class promocode_model extends CI_model
|
||||
{
|
||||
public function getAllpromocode()
|
||||
{
|
||||
$this->db->join('fitur', 'kodepromo.fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get('kodepromo')->result_array();
|
||||
}
|
||||
|
||||
public function getpromocodebyid($id)
|
||||
{
|
||||
return $this->db->get_where('kodepromo', ['id_promo' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function hapuspromocodebyId($id)
|
||||
{
|
||||
$this->db->where('id_promo', $id);
|
||||
$this->db->delete('kodepromo');
|
||||
}
|
||||
|
||||
public function addpromocode($data)
|
||||
{
|
||||
return $this->db->insert('kodepromo', $data);
|
||||
}
|
||||
|
||||
public function cekpromo($code)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('kodepromo');
|
||||
$this->db->where('kode_promo',$code);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function getpromobyid($id)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('kodepromo');
|
||||
$this->db->where('id_promo',$id);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function editpromocode($data)
|
||||
{
|
||||
$this->db->where('id_promo', $data['id_promo']);
|
||||
return $this->db->update('kodepromo', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class promoslider_model extends CI_model
|
||||
{
|
||||
public function getAllpromo()
|
||||
{
|
||||
// $this->db->select('config_driver.status as status_job');
|
||||
// $this->db->select('driver_job.driver_job');
|
||||
// $this->db->select('driver.*');
|
||||
// $this->db->join('config_driver', 'driver.id = config_driver.id_driver', 'left');
|
||||
$this->db->join('fitur', 'promosi.fitur_promosi = fitur.id_fitur', 'left');
|
||||
return $this->db->get('promosi')->result_array();
|
||||
}
|
||||
|
||||
public function getpromobyid($id)
|
||||
{
|
||||
return $this->db->get_where('promosi', ['id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function tambahdatapromo($data)
|
||||
{
|
||||
return $this->db->insert('promosi', $data);
|
||||
}
|
||||
|
||||
public function hapuspromobyId($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('promosi');
|
||||
}
|
||||
|
||||
public function ubahdatapromo($data)
|
||||
{
|
||||
|
||||
$this->db->set('foto', $data['foto']);
|
||||
$this->db->set('tanggal_berakhir', $data['tanggal_berakhir']);
|
||||
$this->db->set('fitur_promosi', $data['fitur_promosi']);
|
||||
$this->db->set('link_promosi', $data['link_promosi']);
|
||||
$this->db->set('type_promosi', $data['type_promosi']);
|
||||
$this->db->set('is_show', $data['is_show']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
return $this->db->update('promosi', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
class Resetpass_model extends CI_model
|
||||
{
|
||||
|
||||
public function check_token($token, $type)
|
||||
{
|
||||
return $this->db->get_where('forgot_password', ['token' => $token, 'idKey' => $type])->row_array();
|
||||
}
|
||||
|
||||
public function reset_pass($data, $id, $type)
|
||||
{
|
||||
if ($type == '1') {
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('pelanggan', $data);
|
||||
} elseif ($type == '2') {
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('driver', $data);
|
||||
} elseif ($type == '3') {
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra', $data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function resetpass()
|
||||
{
|
||||
|
||||
$data = [
|
||||
"password" => sha1($this->input->post('password', true))
|
||||
];
|
||||
if ($this->input->post('type') == '1') {
|
||||
$this->db->where('id', $this->input->post('id'));
|
||||
$this->db->update('pelanggan', $data);
|
||||
} elseif ($this->input->post('type') == '2') {
|
||||
$this->db->where('id', $this->input->post('id'));
|
||||
$this->db->update('driver', $data);
|
||||
} elseif ($this->input->post('type') == '3') {
|
||||
$this->db->where('id_mitra', $this->input->post('id'));
|
||||
$this->db->update('mitra', $data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deletetoken()
|
||||
{
|
||||
$this->db->delete('forgot_password', ['token' => $this->input->post('token')]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
class Service_model extends CI_model
|
||||
{
|
||||
public function getAllservice()
|
||||
{
|
||||
$this->db->select('voucher.nilai');
|
||||
// $this->db->select('driver_job.*');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->order_by('id_fitur', 'ASC');
|
||||
$this->db->join('voucher', 'fitur.id_fitur = voucher.untuk_fitur', 'left');
|
||||
|
||||
return $this->db->get('fitur')->result_array();
|
||||
}
|
||||
|
||||
public function getAlldriverjob()
|
||||
{
|
||||
return $this->db->get('driver_job')->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function getcurrency()
|
||||
{
|
||||
$this->db->select('app_currency as duit');
|
||||
$this->db->where('id', '1');
|
||||
return $this->db->get('app_settings')->row_array();
|
||||
}
|
||||
|
||||
public function getfiturbyid($id)
|
||||
{
|
||||
$this->db->select('voucher.nilai');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->join('voucher', 'fitur.id_fitur = voucher.untuk_fitur', 'left');
|
||||
$this->db->where('id_fitur', $id);
|
||||
return $this->db->get('fitur')->row_array();
|
||||
}
|
||||
|
||||
public function getvoucherbyid($id)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('voucher')->row_array();
|
||||
}
|
||||
|
||||
public function ubahdatafitur($data)
|
||||
{
|
||||
$this->db->set('icon', $data['icon']);
|
||||
$this->db->set('fitur', $data['fitur']);
|
||||
$this->db->set('home', $data['home']);
|
||||
$this->db->set('biaya', $data['biaya']);
|
||||
$this->db->set('keterangan_biaya', $data['keterangan_biaya']);
|
||||
$this->db->set('komisi', $data['komisi']);
|
||||
$this->db->set('driver_job', $data['driver_job']);
|
||||
$this->db->set('biaya_minimum', $data['biaya_minimum']);
|
||||
$this->db->set('jarak_minimum', $data['jarak_minimum']);
|
||||
$this->db->set('maks_distance', $data['maks_distance']);
|
||||
$this->db->set('wallet_minimum', $data['wallet_minimum']);
|
||||
$this->db->set('keterangan', $data['keterangan']);
|
||||
$this->db->set('active', $data['active']);
|
||||
|
||||
$this->db->where('id_fitur', $data['id_fitur']);
|
||||
$this->db->update('fitur');
|
||||
|
||||
$this->db->set('nilai', $data['nilai']);
|
||||
$this->db->where('untuk_fitur', $data['id_fitur']);
|
||||
$this->db->update('voucher');
|
||||
}
|
||||
|
||||
public function tambahdatafitur($data, $datanilai)
|
||||
{
|
||||
$this->db->insert('fitur', $data);
|
||||
|
||||
$id = $this->db->insert_id();
|
||||
$datavocher = [
|
||||
'untuk_fitur' => $id,
|
||||
'nilai' => $datanilai['nilai'],
|
||||
'voucher' => 'DISKON',
|
||||
'tipe_voucher' => '1',
|
||||
'tanggal_expired' => '2020-01-31',
|
||||
'keterangan' => 'Discount',
|
||||
'count_to_use' => '0',
|
||||
'is_valid' => 'yes'
|
||||
|
||||
];
|
||||
$this->db->insert('voucher', $datavocher);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function hapusservicebyId($id)
|
||||
{
|
||||
$this->db->where('id_fitur', $id);
|
||||
$this->db->delete('fitur');
|
||||
|
||||
$this->db->where('untuk_fitur', $id);
|
||||
$this->db->delete('voucher');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Users_model extends CI_model
|
||||
{
|
||||
public function getAllusers()
|
||||
{
|
||||
return $this->db->get('pelanggan')->result_array();
|
||||
}
|
||||
|
||||
public function getusersbyid($id)
|
||||
{
|
||||
// $this->db->select('kendaraan.*');
|
||||
$this->db->select('saldo.saldo');
|
||||
// $this->db->select('fitur.*');
|
||||
// $this->db->select('driver_job.driver_job');
|
||||
$this->db->select('pelanggan.*');
|
||||
// $this->db->join('kendaraan', 'driver.kendaraan = kendaraan.id_k', 'left');
|
||||
$this->db->join('saldo', 'pelanggan.id = saldo.id_user', 'left');
|
||||
// $this->db->join('config_driver', 'driver.id = config_driver.id_driver', 'left');
|
||||
// $this->db->join('fitur', 'pelanggan.order_fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get_where('pelanggan', ['pelanggan.id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function getcurrency()
|
||||
{
|
||||
$this->db->select('app_currency as duit');
|
||||
$this->db->where('id', '1');
|
||||
return $this->db->get('app_settings')->row_array();
|
||||
}
|
||||
|
||||
public function wallet($id)
|
||||
{
|
||||
$this->db->order_by('wallet.id', 'DESC');
|
||||
return $this->db->get_where('wallet', ['id_user' => $id])->result_array();
|
||||
}
|
||||
|
||||
public function countorder($id)
|
||||
{
|
||||
|
||||
$this->db->select('status_transaksi.*');
|
||||
$this->db->select('history_transaksi.*');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->select('transaksi.*');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
$query = $this->db->get_where('transaksi', ['id_pelanggan' => $id])->result_array();
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function blockusersbyid($id)
|
||||
{
|
||||
$this->db->set('status', '0');
|
||||
$this->db->where('id', $id);
|
||||
$this->db->Update('pelanggan');
|
||||
}
|
||||
|
||||
public function unblockusersbyid($id)
|
||||
{
|
||||
$this->db->set('status', '1');
|
||||
$this->db->where('id', $id);
|
||||
$this->db->Update('pelanggan');
|
||||
}
|
||||
|
||||
public function ubahdataid($data)
|
||||
{
|
||||
$this->db->set('fullnama', $data['fullnama']);
|
||||
$this->db->set('no_telepon', $data['no_telepon']);
|
||||
$this->db->set('email', $data['email']);
|
||||
$this->db->set('countrycode', $data['countrycode']);
|
||||
$this->db->set('phone', $data['phone']);
|
||||
$this->db->set('tgl_lahir', $data['tgl_lahir']);
|
||||
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('pelanggan', $data);
|
||||
}
|
||||
|
||||
public function ubahdatafoto($data)
|
||||
{
|
||||
$this->db->set('fotopelanggan', $data['fotopelanggan']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('pelanggan', $data);
|
||||
}
|
||||
|
||||
public function ubahdatapassword($data)
|
||||
{
|
||||
$this->db->set('password', $data['password']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('pelanggan', $data);
|
||||
}
|
||||
|
||||
public function blockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 0);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('pelanggan');
|
||||
}
|
||||
|
||||
public function unblockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('pelanggan');
|
||||
}
|
||||
|
||||
public function tambahdatausers($data)
|
||||
{
|
||||
$this->db->insert('pelanggan', $data);
|
||||
$data2 = [
|
||||
'id_user' => $data['id'],
|
||||
'saldo' => 0,
|
||||
];
|
||||
$this->db->insert('saldo', $data2);
|
||||
}
|
||||
|
||||
public function hapusdatauserbyid($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('pelanggan');
|
||||
|
||||
$this->db->where('id_pelanggan', $id);
|
||||
$this->db->delete('transaksi');
|
||||
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('saldo');
|
||||
|
||||
$this->db->where('userid', $id);
|
||||
$this->db->delete('forgot_password');
|
||||
|
||||
$this->db->where('id_pelanggan', $id);
|
||||
$this->db->delete('rating_driver');
|
||||
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('wallet');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
<?php
|
||||
|
||||
|
||||
class wallet_model extends CI_model
|
||||
{
|
||||
public function getwallet()
|
||||
{
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('wallet.*');
|
||||
$this->db->join('mitra', 'wallet.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'wallet.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'wallet.id_user = pelanggan.id', 'left');
|
||||
$this->db->order_by('wallet.id', 'DESC');
|
||||
return $this->db->get('wallet')->result_array();
|
||||
}
|
||||
|
||||
public function gettokenmerchant($id_user)
|
||||
|
||||
{
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->select('merchant.token_merchant');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->where('mitra.id_mitra', $id_user);
|
||||
return $this->db->get('mitra')->row_array();
|
||||
}
|
||||
|
||||
public function ubahsaldotopup($id_user, $amount, $saldo)
|
||||
{
|
||||
// $this->db->where('id_user', $dataC['id_pelanggan']);
|
||||
// $upd = $this->db->update('saldo', array('saldo' => ($saldo - $dataC['biaya_akhir'])));
|
||||
$this->db->set('saldo', $saldo['saldo'] + $amount);
|
||||
$this->db->where('id_user', $id_user);
|
||||
$this->db->update('saldo');
|
||||
}
|
||||
|
||||
public function getwalletbyid($id)
|
||||
{
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('wallet.*');
|
||||
$this->db->join('driver', 'wallet.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'wallet.id_user = pelanggan.id', 'left');
|
||||
return $this->db->get_where('wallet', ['wallet.id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function getallsaldo()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function getjumlahdiskon()
|
||||
{
|
||||
$this->db->select('SUM(kredit_promo) as diskon');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
|
||||
public function getallsaldouser()
|
||||
{
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('saldo.*');
|
||||
$this->db->join('mitra', 'saldo.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'saldo.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'saldo.id_user = pelanggan.id', 'left');
|
||||
return $this->db->get('saldo')->result_array();
|
||||
}
|
||||
|
||||
public function gettotaltopup()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('status', 1);
|
||||
$this->db->where('type', 'topup');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function gettotalwithdraw()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('type', 'withdraw');
|
||||
$this->db->where('status', 1);
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function gettotalorderplus()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('type', 'Order+');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function gettotalordermin()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('type', 'Order-');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function ubahstatuswithdrawbyid($id)
|
||||
{
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('wallet');
|
||||
}
|
||||
|
||||
public function cancelstatuswithdrawbyid($id)
|
||||
{
|
||||
$this->db->set('status', 2);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('wallet');
|
||||
}
|
||||
|
||||
public function gettoken($id_user)
|
||||
|
||||
{
|
||||
$this->db->select('token');
|
||||
$this->db->where('id', $id_user);
|
||||
return $this->db->get('pelanggan')->row_array();
|
||||
}
|
||||
|
||||
public function getregid($id_user)
|
||||
{
|
||||
$this->db->select('reg_id');
|
||||
$this->db->where('id', $id_user);
|
||||
return $this->db->get('driver')->row_array();
|
||||
}
|
||||
|
||||
public function getsaldo($id_user)
|
||||
{
|
||||
$this->db->select('saldo');
|
||||
$this->db->where('id_user', $id_user);
|
||||
return $this->db->get('saldo')->row_array();
|
||||
}
|
||||
|
||||
public function ubahsaldo($id_user, $amount, $saldo)
|
||||
{
|
||||
// $this->db->where('id_user', $dataC['id_pelanggan']);
|
||||
// $upd = $this->db->update('saldo', array('saldo' => ($saldo - $dataC['biaya_akhir'])));
|
||||
$this->db->set('saldo', $saldo['saldo'] - $amount);
|
||||
$this->db->where('id_user', $id_user);
|
||||
$this->db->update('saldo');
|
||||
}
|
||||
|
||||
public function send_notif($title, $message, $topic)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'type' => 3
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => $topic
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
'Content-Type : application/json',
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function updatesaldowallet($data)
|
||||
{
|
||||
|
||||
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('saldo.saldo as saldolama');
|
||||
$this->db->join('mitra', 'saldo.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'saldo.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'saldo.id_user = pelanggan.id', 'left');
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$saldolama = $this->db->get('saldo')->row_array();
|
||||
|
||||
$saldobaru = $saldolama['saldolama'] + $data['saldo'];
|
||||
|
||||
$this->db->set('saldo', $saldobaru);
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$this->db->update('saldo');
|
||||
|
||||
if ($data['type_user'] == 'pelanggan') {
|
||||
$nama = $saldolama['fullnama'];
|
||||
} elseif ($data['type_user'] == 'mitra') {
|
||||
$nama = $saldolama['nama_mitra'];
|
||||
} else {
|
||||
$nama = $saldolama['nama_driver'];
|
||||
}
|
||||
|
||||
|
||||
$this->db->set('status', '1');
|
||||
$this->db->set('type', 'topup');
|
||||
$this->db->set('rekening', 'admin');
|
||||
$this->db->set('bank', 'admin');
|
||||
$this->db->set('nama_pemilik', $nama);
|
||||
$this->db->set('jumlah', $data['saldo']);
|
||||
$this->db->set('id_user', $data['id_user']);
|
||||
$this->db->insert('wallet');
|
||||
}
|
||||
|
||||
public function updatesaldowalletwithdraw($data, $data2)
|
||||
{
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('saldo.saldo as saldolama');
|
||||
$this->db->join('mitra', 'saldo.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'saldo.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'saldo.id_user = pelanggan.id', 'left');
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$saldolama = $this->db->get('saldo')->row_array();
|
||||
|
||||
$saldobaru = $saldolama['saldolama'] - $data['saldo'];
|
||||
if ($saldobaru < 0) {
|
||||
$this->session->set_flashdata('salah', 'Not enaugh Balances');
|
||||
redirect('wallet/tambahwithdraw');
|
||||
} else {
|
||||
$this->db->set('saldo', $saldobaru);
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$this->db->update('saldo');
|
||||
|
||||
if ($data['type_user'] == 'pelanggan') {
|
||||
$nama = $saldolama['fullnama'];
|
||||
} elseif ($data['type_user'] == 'mitra') {
|
||||
$nama = $saldolama['nama_mitra'];
|
||||
} else {
|
||||
$nama = $saldolama['nama_driver'];
|
||||
}
|
||||
|
||||
$this->db->set('status', '1');
|
||||
$this->db->set('type', 'withdraw');
|
||||
$this->db->set('rekening', $data2['rekening']);
|
||||
$this->db->set('bank', $data2['bank']);
|
||||
$this->db->set('nama_pemilik', $data2['nama_pemilik']);
|
||||
$this->db->set('jumlah', $data['saldo']);
|
||||
$this->db->set('id_user', $data['id_user']);
|
||||
$this->db->insert('wallet');
|
||||
}
|
||||
}
|
||||
|
||||
public function getwalletall()
|
||||
{
|
||||
$this->db->select('wallet.*');
|
||||
$this->db->select('merchant.token_merchant');
|
||||
$this->db->select('driver.reg_id');
|
||||
$this->db->select('pelanggan.token');
|
||||
$this->db->select('pelanggan.id,driver.id,mitra.id_mitra,merchant.id_merchant');
|
||||
$this->db->join('mitra', 'wallet.id_user=mitra.id_mitra', 'left');
|
||||
$this->db->join('merchant', 'mitra.id_merchant=merchant.id_merchant', 'left');
|
||||
$this->db->join('driver', 'wallet.id_user=driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'wallet.id_user=pelanggan.id', 'left');
|
||||
return $this->db->get('wallet')->result_array();
|
||||
}
|
||||
|
||||
public function updatekadaluarsa()
|
||||
{
|
||||
$this->load->model('Notification_model');
|
||||
|
||||
$wallet = $this->getwalletall();
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($wallet as $wl) {
|
||||
|
||||
|
||||
|
||||
$date1 = date_create($wl['expired']);
|
||||
$date = new DateTime('now', new DateTimeZone('Asia/Jakarta'));
|
||||
|
||||
|
||||
$tanggal = date_format($date1, "YmdHis");
|
||||
|
||||
$tanggal2 = date_format($date, "YmdHis");
|
||||
// var_dump($tanggal);
|
||||
// var_dump($tanggal2);
|
||||
// die();
|
||||
|
||||
if ($tanggal <= $tanggal2 && $wl['status'] == 0 && $wl['expired'] != "") {
|
||||
// var_dump($tanggal);
|
||||
// var_dump($tanggal2);
|
||||
// die();
|
||||
$this->db->set('status', '2');
|
||||
|
||||
$this->db->Where('status', '0');
|
||||
$this->db->Where('invoice', $wl['invoice']);
|
||||
$this->db->update('wallet');
|
||||
|
||||
$id = substr($wl['id_user'], '0', '1');
|
||||
if ($id == 'M') {
|
||||
$token = $wl['token_merchant'];
|
||||
} else if ($id == 'P') {
|
||||
$token = $wl['token'];
|
||||
} else {
|
||||
$token = $wl['reg_id'];
|
||||
}
|
||||
|
||||
$title = 'Dibatalkan';
|
||||
$desc = 'Pembayaran Kamu telah Dibatalkan';
|
||||
$this->Notification_model->send_notif_topup($title, $wl['id_user'], $desc, $wl['invoice'], $token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Mitra_model extends CI_model
|
||||
{
|
||||
public function topup_pulsa($data)
|
||||
{
|
||||
$this->db->insert('topup_pulsaMP', $data)->result_array();
|
||||
return $this->db->affected_rows();
|
||||
}
|
||||
|
||||
public function postCallback()
|
||||
{
|
||||
$this->db->insert('mp_callback')->result_array();
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,40 @@
|
||||
<!-- partial -->
|
||||
<div class="content-wrapper">
|
||||
<div class="row ">
|
||||
<div class="col-md-8 offset-md-2 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Kirim Notifikasi</h4>
|
||||
<?php if ($this->session->flashdata()) : ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
<?php echo $this->session->flashdata('send'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?= form_open_multipart('appnotification/send'); ?>
|
||||
<div class="form-group">
|
||||
<label for="newscategory">Kirim Ke</label>
|
||||
<select class="js-example-basic-single" style="width:100%" name='topic'>
|
||||
<option value="pelanggan">User</option>
|
||||
<option value="driver">Driver</option>
|
||||
<option value="mitra">Merchant Partner</option>
|
||||
<option value="ouride">Semua</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="title">Judul</label>
|
||||
<input type="text" class="form-control" placeholder="notification" name="title" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message">Deskripsi</label>
|
||||
<textarea type="text" class="form-control" placeholder="enter notification title" name="message" required></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success">Kirim<i class="mdi mdi-send ml-1"></i></button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of content wrapper -->
|
||||
@@ -0,0 +1,45 @@
|
||||
<!-- partial -->
|
||||
<div class="content-wrapper">
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-6 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if ($this->session->flashdata('demo')) : ?>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<?php echo $this->session->flashdata('demo'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<h4 class="card-title">Tambah Bank</h4>
|
||||
|
||||
<?= form_open_multipart('appsettings/adddatabank'); ?>
|
||||
<div class="form-group">
|
||||
<input type="file" class="dropify" name="image_bank" data-max-file-size="3mb" required />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthdate">Nama Bank</label>
|
||||
<input type="text" class="form-control" id="" name="nama_bank" placeholder="masukan nama bank" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthdate">Nama Pemilik</label>
|
||||
<input type="text" class="form-control" id="" name="nama_pemilik" placeholder="masukan nama pemilik bank" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthdate">Nomor Rekening</label>
|
||||
<input type="text" class="form-control" id="" name="rekening_bank" placeholder="masukan rekening bank" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="gender">status</label>
|
||||
<select class="js-example-basic-single" name="status_bank" style="width:100%">
|
||||
<option value="1">Aktif</option>
|
||||
<option value="0">Non Aktif</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
<a class="btn btn-danger text-white" href="<?= base_url(); ?>appsettings/index">Batal</a>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<!-- partial -->
|
||||
<div class="content-wrapper">
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-6 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if ($this->session->flashdata('demo')) : ?>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<?php echo $this->session->flashdata('demo'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<h4 class="card-title">Ubah Bank</h4>
|
||||
<?= form_open_multipart('appsettings/ubahbank/' . $transfer['id_bank']); ?>
|
||||
<div class="form-group">
|
||||
<input data-default-file="<?= base_url('images/bank/') . $transfer['image_bank'] ?>" type="file" class="dropify" name="image_bank" data-max-file-size="3mb" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthdate">Nama Bank</label>
|
||||
<input type="text" class="form-control" id="" name="nama_bank" value="<?= $transfer['nama_bank']; ?>" placeholder="nama bank" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthdate">Nama Pemilik</label>
|
||||
<input type="text" class="form-control" id="" name="nama_pemilik" value="<?= $transfer['nama_pemilik']; ?>" placeholder="nama pemilik" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="birthdate">Nomor Rekening</label>
|
||||
<input type="text" class="form-control" id="" name="rekening_bank" value="<?= $transfer['rekening_bank']; ?>" placeholder="nomor rekening" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="gender">status</label>
|
||||
<select class="js-example-basic-single" name="status_bank" style="width:100%">
|
||||
<option value="1" <?php if ($transfer['status_bank'] == 1) { ?>selected<?php } ?>>Aktif</option>
|
||||
<option value="0" <?php if ($transfer['status_bank'] == 0) { ?>selected<?php } ?>>Non Aktif</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
<a class="btn btn-danger text-white" href="<?= base_url(); ?>appsettings/index">Batal</a>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,345 @@
|
||||
<div class="content-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-2 grid-margin stretch-card">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Pengaturan Aplikasi</h4>
|
||||
<?php if ($this->session->flashdata('send') or $this->session->flashdata('ubah')) : ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
<?php echo $this->session->flashdata('send'); ?>
|
||||
<?php echo $this->session->flashdata('ubah'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->session->flashdata('demo')) : ?>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<?php echo $this->session->flashdata('demo'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="tab-minimal tab-minimal-success">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="tab-2-1" data-toggle="tab" href="#app-2-1" role="tab" aria-controls="app-2-1" aria-selected="true">
|
||||
<i class="mdi mdi-cellphone-android"></i>App</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="tab-2-2" data-toggle="tab" href="#email-2-2" role="tab" aria-controls="email-2-2" aria-selected="false">
|
||||
<i class="mdi mdi-email-outline"></i>Email</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="tab-2-3" data-toggle="tab" href="#smtp-2-3" role="tab" aria-controls="smtp-2-3" aria-selected="false">
|
||||
<i class="mdi mdi-message-text-outline"></i>SMTP</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="tab-2-4" data-toggle="tab" href="#mobilepulsa-2-4" role="tab" aria-controls="mobilepulsa-2-4" aria-selected="false">
|
||||
<i class="mdi mdi-credit-card"></i>API Mobile Pulsa</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="tab-2-7" data-toggle="tab" href="#banktransfer-2-7" role="tab" aria-controls="banktransfer-2-7" aria-selected="false">
|
||||
<i class="icon-credit-card menu-icon"></i>Transfer Bank</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content col-12 justify-content-center">
|
||||
<div class="tab-pane fade show active" id="app-2-1" role="tabpanel" aria-labelledby="tab-2-1">
|
||||
<div class="col-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Pengaturan</h4>
|
||||
<br>
|
||||
<?= form_open_multipart('appsettings/ubahapp'); ?>
|
||||
<div class="form-group">
|
||||
<label for="appemail">Email</label>
|
||||
<input type="email" class="form-control" id="appemail" name="app_email" value="<?= $appsettings['app_email']; ?>" required></div>
|
||||
<div class="form-group">
|
||||
<label for="appname">Nama Aplikasi</label>
|
||||
<input type="text" class="form-control" id="appname" name="app_name" value="<?= $appsettings['app_name']; ?>" required></div>
|
||||
<div class="form-group">
|
||||
<label for="appcontact">Kontak</label>
|
||||
<input type="text" class="form-control" id="appcontact" name="app_contact" value="<?= $appsettings['app_contact']; ?>" required></div>
|
||||
<div class="form-group">
|
||||
<label for="appwebsite">Website</label>
|
||||
<input type="text" class="form-control" id="appwebsite" name="app_website" value="<?= $appsettings['app_website']; ?>" required></div>
|
||||
<div class="form-group">
|
||||
<label for="privacypolicy">Kebijakan Privasi</label>
|
||||
<textarea type="text" class="form-control" id="summernoteExample1" name="app_privacy_policy" required><?= $appsettings['app_privacy_policy']; ?></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="aboutus">Tentang</label>
|
||||
<textarea type="text" class="form-control" id="summernoteExample2" name="app_aboutus" required><?= $appsettings['app_aboutus']; ?></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="appaddress">Alamat</label>
|
||||
<textarea type="text" class="form-control" id="summernoteExample3" name="app_address" required><?= $appsettings['app_address']; ?></textarea></div>
|
||||
<div class="form-group">
|
||||
<label for="googlelink">Google Link</label>
|
||||
<input type="text" class="form-control" id="googlelink" name="app_linkgoogle" value="<?= $appsettings['app_linkgoogle']; ?>" required></div>
|
||||
<div class="form-group">
|
||||
<label for="appcurrency">Mata Uang</label>
|
||||
<input type="text" class="form-control" id="appcurrency" name="app_currency" value="<?= $appsettings['app_currency']; ?>" required></div>
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="email-2-2" role="tabpanel" aria-labelledby="tab-2-2">
|
||||
<div class="col-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Email Tampilan ubah Password</h4>
|
||||
<br>
|
||||
<?= form_open_multipart('appsettings/ubahemail'); ?>
|
||||
<div class="form-group">
|
||||
<label for="emailsubject">Email Subjek</label>
|
||||
<textarea type="email" class="form-control" id="emailsubject" name="email_subject" required><?= $appsettings['email_subject']; ?></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emailtext1">Email Teks 1</label>
|
||||
<textarea type="email" class="form-control" id="summernoteExample4" name="email_text1" required><?= $appsettings['email_text1']; ?></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emailtext2">Email Teks 2</label>
|
||||
<textarea type="email" class="form-control" id="summernoteExample5" name="email_text2" required><?= $appsettings['email_text2']; ?></textarea>
|
||||
</div>
|
||||
|
||||
<h4 class="card-title">Email Tampilan konfirmasi Driver</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="emailsubject">Email Subjek</label>
|
||||
<textarea type="email" class="form-control" id="emailsubject" name="email_subject_confirm" required><?= $appsettings['email_subject_confirm']; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="emailtext1">Email Teks 1</label>
|
||||
<textarea type="email" class="form-control" id="summernoteExample6" name="email_text3" required><?= $appsettings['email_text3']; ?></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emailtext2">Email Teks 2</label>
|
||||
<textarea type="email" class="form-control" id="summernoteExample7" name="email_text4" required><?= $appsettings['email_text4']; ?></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="smtp-2-3" role="tabpanel" aria-labelledby="tab-2-3">
|
||||
<div class="col-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Pengaturan SMTP</h4>
|
||||
<br>
|
||||
|
||||
<?php if (demo == TRUE) { ?>
|
||||
<?= form_open_multipart('appsettings/ubahsmtp'); ?>
|
||||
<div class="form-group">
|
||||
<label for="smtphost">SMTP Host</label>
|
||||
<input type="text" class="form-control" id="smtphost" name="smtp_host" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtpport">SMTP Port</label>
|
||||
<input type="text" class="form-control" id="smtpport" name="smtp_port" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtpusername">SMTP Nama User</label>
|
||||
<input type="text" class="form-control" id="smtpusername" name="smtp_username" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtppassword">SMTP Password</label>
|
||||
<input type="password" class="form-control" id="smtppassword" name="smtp_password" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtpform">SMTP DARI</label>
|
||||
<input type="text" class="form-control" id="smtpfrom" name="smtp_from" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtp_secure">SMTP Security</label>
|
||||
<select class="form-control border-primary" name="smtp_secure" id="smtp_secure">
|
||||
<option value="tls" <?php if ($appsettings['smtp_secure'] == 'tls') { ?>selected<?php } ?>>TLS</option>
|
||||
<option value="ssl" <?php if ($appsettings['smtp_secure'] == 'ssl') { ?>selected<?php } ?>>SSL</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
<?php } else { ?>
|
||||
|
||||
<?= form_open_multipart('appsettings/ubahsmtp'); ?>
|
||||
<div class="form-group">
|
||||
<label for="smtphost">SMTP Host</label>
|
||||
<input type="text" value="<?= $appsettings['smtp_host']; ?>" class="form-control" id="smtphost" name="smtp_host" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtpport">SMTP Port</label>
|
||||
<input type="text" class="form-control" id="smtpport" name="smtp_port" value="<?= $appsettings['smtp_port']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtpusername">SMTP User Name</label>
|
||||
<input type="text" class="form-control" id="smtpusername" name="smtp_username" value="<?= $appsettings['smtp_username']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtppassword">SMTP Password</label>
|
||||
<input type="password" class="form-control" id="smtppassword" name="smtp_password" value="<?= $appsettings['smtp_password']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtpform">SMTP Dari</label>
|
||||
<input type="text" class="form-control" id="smtpfrom" name="smtp_from" value="<?= $appsettings['smtp_from']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="smtp_secure">SMTP Security</label>
|
||||
<select class="form-control border-primary" name="smtp_secure" id="smtp_secure">
|
||||
<option value="tls" <?php if ($appsettings['smtp_secure'] == 'tls') { ?>selected<?php } ?>>TLS</option>
|
||||
<option value="ssl" <?php if ($appsettings['smtp_secure'] == 'ssl') { ?>selected<?php } ?>>SSL</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="mobilepulsa-2-4" role="tabpanel" aria-labelledby="tab-2-4">
|
||||
<div class="col-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Pengaturan Mobile Pulsa</h4>
|
||||
<br>
|
||||
<?= form_open_multipart('appsettings/ubahmobilepulsa'); ?>
|
||||
<div class="form-group">
|
||||
<label for="mobilepulsausername">Username</label>
|
||||
<input type="text" class="form-control" id="mobilepulsa_username" name="mobilepulsa_username" value="<?= $appsettings['mobilepulsa_username']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobilepulsausername">Tambahan Harga</label>
|
||||
<input type="text" class="form-control" id="mobilepulsa_harga" name="mobilepulsa_harga" value="<?= $appsettings['mobilepulsa_harga']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobilepulsaapikey">Api Key</label>
|
||||
<input type="text" class="form-control" id="mobilepulsa_api_key" name="mobilepulsa_api_key" value="<?= $appsettings['mobilepulsa_api_key']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mp_status">Api Mode</label>
|
||||
<select name="mp_status" id="mp_status" class="js-example-basic-single" style="width:100%">
|
||||
<option value="1" <?php if ($appsettings['mp_status'] == '1') { ?>selected<?php } ?>>Development</option>
|
||||
<option value="2" <?php if ($appsettings['mp_status'] == '2') { ?>selected<?php } ?>>Production</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mp_active">Mobile Pulsa Status</label>
|
||||
<select name="mp_active" id="midtrans_active" class="js-example-basic-single" style="width:100%">
|
||||
<option value="1" <?php if ($appsettings['mp_active'] == '1') { ?>selected<?php } ?>>Aktif</option>
|
||||
<option value="0" <?php if ($appsettings['mp_active'] == '0') { ?>selected<?php } ?>>Non Aktif</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="ayopesan-2-5" role="tabpanel" aria-labelledby="tab-2-5">
|
||||
<div class="col-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">API Pulsa</h4>
|
||||
<br>
|
||||
<?= form_open_multipart('appsettings/ubahayopesan'); ?>
|
||||
<div class="form-group">
|
||||
<label for="emailsubject">Password</label>
|
||||
<input type="password" class="form-control" id="emailsubject" name="api_password" value="<?= $appsettings['api_password']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emailsubject">Margin Pulsa</label>
|
||||
<input type="text" class="form-control" id="emailsubject" name="harga_pulsa" value="<?= $appsettings['harga_pulsa']; ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="emailtext1">Token</label>
|
||||
<input type="text" class="form-control" id="summernoteExample4" name="api_token" value="<?= $appsettings['api_token']; ?>" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success mr-2">Kirim</button>
|
||||
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="banktransfer-2-7" role="tabpanel" aria-labelledby="tab-2-7">
|
||||
<div class="col-12 grid-margin">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Pengaturan Transfer Bank</h4>
|
||||
<div>
|
||||
<a class="btn btn-info" href="<?= base_url(); ?>appsettings/addbank"><i class="mdi mdi-plus-circle-outline"></i>Tambah Bank</a>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="table-responsive">
|
||||
<table id="order-listing7" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Logo Bank</th>
|
||||
<th>Nama Bank</th>
|
||||
<th>Nama Pemilik</th>
|
||||
<th>Nomor Rekening</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i = 1;
|
||||
foreach ($transfer as $trf) { ?>
|
||||
<tr>
|
||||
|
||||
<td><?= $i ?></td>
|
||||
<td><img src="<?= base_url('images/bank/') . $trf['image_bank']; ?>"></td>
|
||||
<td><?= $trf['nama_bank'] ?></td>
|
||||
<td><?= $trf['nama_pemilik'] ?></td>
|
||||
<td><?= $trf['rekening_bank'] ?></td>
|
||||
<td><?php if ($trf['status_bank'] == 1) { ?>
|
||||
<label class="badge badge-primary">Aktif</label>
|
||||
<?php } else if ($trf['status_bank'] == 0) { ?>
|
||||
<label class="badge badge-danger">Non Aktif</label>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?= base_url(); ?>appsettings/editbank/<?= $trf['id_bank'] ?>">
|
||||
<button class="btn btn-outline-primary">Ubah</button>
|
||||
</a>
|
||||
<a href="<?= base_url(); ?>appsettings/hapusbank/<?= $trf['id_bank'] ?>" onclick="return confirm ('are you sure?')">
|
||||
<button class="btn btn-outline-danger">Hapus</button>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php $i++;
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user