This commit is contained in:
Fasta_Biqul_Hoirot 2024-07-15 16:30:09 +07:00
parent b035212e43
commit e009419512
706 changed files with 124341 additions and 0 deletions

6
app/.htaccess Normal file
View File

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

15
app/Common.php Normal file
View File

@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter.com/user_guide/extending/common.html
*/

177
app/Config/App.php Normal file
View File

@ -0,0 +1,177 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class App extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* http://example.com/
*/
public string $baseURL = 'http://localhost:8080/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g. When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and
* 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* 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.
*/
public string $indexPage = 'index.php';
/**
* --------------------------------------------------------------------------
* 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!
*/
public string $uriProtocol = 'REQUEST_URI';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = false;
/**
* --------------------------------------------------------------------------
* Supported Locales
* --------------------------------------------------------------------------
*
* If $negotiateLocale is true, this array lists the locales supported
* by the application in descending order of priority. If no match is
* found, the first locale will be used.
*
* IncomingRequest::setLocale() also uses this list.
*
* @var string[]
*/
public array $supportedLocales = ['en'];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones supported by PHP.
*/
public string $appTimezone = 'UTC';
/**
* --------------------------------------------------------------------------
* 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.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security header will be set.
*/
public bool $forceGlobalSecureRequests = 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
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* Content Security Policy
* --------------------------------------------------------------------------
*
* Enables the Response's Content Secure Policy to restrict the sources that
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
* the Response object will populate default values for the policy from the
* `ContentSecurityPolicy.php` file. Controllers can always add to those
* restrictions at run time.
*
* For a better understanding of CSP, see these documents:
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*/
public bool $CSPEnabled = false;
}

99
app/Config/Autoload.php Normal file
View File

@ -0,0 +1,99 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for you.
* you may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* Prototype:
* $psr4 = [
* 'CodeIgniter' => SYSTEMPATH,
* 'App' => APPPATH
* ];
*
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = [];
}

View File

@ -0,0 +1,34 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@ -0,0 +1,23 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

View File

@ -0,0 +1,38 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You cant use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@ -0,0 +1,20 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}

171
app/Config/Cache.php Normal file
View File

@ -0,0 +1,171 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Cache Directory Path
* --------------------------------------------------------------------------
*
* The path to where cache files should be stored, if using a file-based
* system.
*
* @deprecated Use the driver-specific variant under $file
*/
public string $storePath = WRITEPATH . 'cache/';
/**
* --------------------------------------------------------------------------
* 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.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|string[]
*/
public $cacheQueryString = false;
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array<string, int|string|null>
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array<string, bool|int|string>
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array<string, int|string|null>
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
}

94
app/Config/Constants.php Normal file
View File

@ -0,0 +1,94 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| 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') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
*/
define('EVENT_PRIORITY_LOW', 200);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
*/
define('EVENT_PRIORITY_NORMAL', 100);
/**
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
*/
define('EVENT_PRIORITY_HIGH', 10);

View File

@ -0,0 +1,176 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// Sources allowed
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to self if not overridden
*
* @var string|string[]|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var string|string[]
*/
public $scriptSrc = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var string|string[]
*/
public $styleSrc = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var string|string[]
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var string|string[]|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var string|string[]
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var string|string[]
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var string|string[]
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var string|string[]
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var string|string[]|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var array|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var string|string[]|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var string|string[]
*/
public $objectSrc = 'self';
/**
* @var string|string[]|null
*/
public $manifestSrc;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var string|string[]|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var string|string[]|null
*/
public $sandbox;
/**
* Nonce tag for style
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce tag for script
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically
*/
public bool $autoNonce = true;
}

107
app/Config/Cookie.php Normal file
View File

@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @phpstan-var 'None'|'Lax'|'Strict'|''
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

85
app/Config/Database.php Normal file
View File

@ -0,0 +1,85 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations
* and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to
* use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*/
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'numberNative' => false,
];
/**
* This database connection is used when
* running PHPUnit database tests.
*/
public array $tests = [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => '',
'password' => '',
'database' => ':memory:',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
}
}

46
app/Config/DocTypes.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace Config;
/**
* @immutable
*/
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'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">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

121
app/Config/Email.php Normal file
View File

@ -0,0 +1,121 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = '';
/**
* SMTP Username
*/
public string $SMTPUser = '';
/**
* SMTP Password
*/
public string $SMTPPass = '';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'text';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

92
app/Config/Encryption.php Normal file
View File

@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}

55
app/Config/Events.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace Config;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function () {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function () {
(new HotReloader())->run();
});
}
}
});

104
app/Config/Exceptions.php Normal file
View File

@ -0,0 +1,104 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* LOG DEPRECATIONS INSTEAD OF THROWING?
* --------------------------------------------------------------------------
* By default, CodeIgniter converts deprecations into exceptions. Also,
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
* Use this option to temporarily cease the warnings and instead log those.
* This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/*
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}

30
app/Config/Feature.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Enable multiple filters for a route or not.
*
* If you enable this:
* - CodeIgniter\CodeIgniter::handleRequest() uses:
* - CodeIgniter\Filters\Filters::enableFilters(), instead of enableFilter()
* - CodeIgniter\CodeIgniter::tryToRouteIt() uses:
* - CodeIgniter\Router\Router::getFilters(), instead of getFilter()
* - CodeIgniter\Router\Router::handle() uses:
* - property $filtersInfo, instead of $filterInfo
* - CodeIgniter\Router\RouteCollection::getFiltersForRoute(), instead of getFilterForRoute()
*/
public bool $multipleFilters = false;
/**
* Use improved new auto routing instead of the default legacy version.
*/
public bool $autoRoutesImproved = false;
}

69
app/Config/Filters.php Normal file
View File

@ -0,0 +1,69 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseConfig
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>> [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array<string, array<string, array<string, string>>>|array<string, list<string>>
*/
public array $globals = [
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
'toolbar',
// 'honeypot',
// 'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'post' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*/
public array $filters = [];
}

View File

@ -0,0 +1,12 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}

77
app/Config/Format.php Normal file
View File

@ -0,0 +1,77 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\FormatterInterface;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var string[]
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* A Factory method to return the appropriate formatter for the given mime type.
*
* @return FormatterInterface
*
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
*/
public function getFormatter(string $mime)
{
return Services::format()->getFormatter($mime);
}
}

42
app/Config/Generators.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, string>
*/
public array $views = [
'make:cell' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'make:cell_view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

42
app/Config/Honeypot.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

31
app/Config/Images.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

66
app/Config/Kint.php Normal file
View File

@ -0,0 +1,66 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\AbstractRenderer;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint extends BaseConfig
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
public int $richSort = AbstractRenderer::SORT_FULL;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

148
app/Config/Logger.php Normal file
View File

@ -0,0 +1,148 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var array|int
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* 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
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of '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 'log'.
*/
'fileExtension' => '',
/*
* 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.)
*/
'filePermissions' => 0644,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

50
app/Config/Migrations.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* 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
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'Y-m-d-His_';
}

534
app/Config/Mimes.php Normal file
View File

@ -0,0 +1,534 @@
<?php
namespace Config;
/**
* Mimes
*
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*
* @immutable
*/
class Mimes
{
/**
* Map of extensions to mime types.
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'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' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'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' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'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' => [
'application/x-php',
'application/x-httpd-php',
'application/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' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'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' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'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',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'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' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'video/mp4',
'video/x-f4v',
],
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension)
{
$extension = trim(strtolower($extension), '. ');
if (! array_key_exists($extension, static::$mimes)) {
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}

84
app/Config/Modules.php Normal file
View File

@ -0,0 +1,84 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

37
app/Config/Pager.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
}

80
app/Config/Paths.php Normal file
View File

@ -0,0 +1,80 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*
* @immutable
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config/Publisher.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

80
app/Config/Routes.php Normal file
View File

@ -0,0 +1,80 @@
<?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 = array(
'default_controller' => 'main',
'main' => 'main',
'administrator' => 'Administrator',
'agenda' => 'agenda',
'albums' => 'albums',
'berita' => 'berita',
'download' => 'download',
'halaman' => 'halaman',
'hubungi' => 'hubungi',
'kategori' => 'kategori',
'konsultasi' => 'konsultasi',
'kontributor' => 'kontributor',
'playlist' => 'playlist',
'polling' => 'polling',
'tag' => 'tag',
'testimoni' => 'testimoni',
'konfirmasi' => 'konfirmasi',
'produk' => 'produk',
'auth' => 'auth',
'members' => 'members',
'reseller' => 'reseller',
);
$route['(:any)'] = 'news/$1/$2';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['pesanan_selesai'] = 'Reseller/pesanan_selesai';

113
app/Config/Routing.php Normal file
View File

@ -0,0 +1,113 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Home';
/**
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* Whether to translate dashes in URIs to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be either a closure or the controller/method
* name exactly like a route is defined: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* class constructor or the routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = false;
/**
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* Map of URI segments and namespaces. For Auto Routing (Improved).
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array [ uri_segment => namespace ]
*/
public array $moduleRoutes = [];
}

101
app/Config/Security.php Normal file
View File

@ -0,0 +1,101 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_name';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*/
public bool $redirect = false;
/**
* --------------------------------------------------------------------------
* CSRF SameSite
* --------------------------------------------------------------------------
*
* Setting for CSRF SameSite cookie token.
*
* Allowed values are: None - Lax - Strict - ''.
*
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*/
public string $samesite = 'Lax';
}

32
app/Config/Services.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

102
app/Config/Session.php Normal file
View File

@ -0,0 +1,102 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is 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!
*/
public string $savePath = WRITEPATH . 'session';
/**
* --------------------------------------------------------------------------
* Session 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.
*/
public bool $matchIP = false;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session 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.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
}

118
app/Config/Toolbar.php Normal file
View File

@ -0,0 +1,118 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var string[]
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be colleted. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
}

252
app/Config/UserAgents.php Normal file
View File

@ -0,0 +1,252 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* 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.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'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',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => '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',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'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',
];
}

44
app/Config/Validation.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var string[]
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

62
app/Config/View.php Normal file
View File

@ -0,0 +1,62 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type ParserCallable (callable(mixed): mixed)
* @phpstan-type ParserCallableString (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, ParserCallableString>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, array<string>|callable|string>
* @phpstan-var array<string, array<ParserCallableString>|ParserCallableString|ParserCallable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var class-string<ViewDecoratorInterface>[]
*/
public array $decorators = [];
}

263
app/Controllers/Auth.php Normal file
View File

@ -0,0 +1,263 @@
<?php
/*
-- ---------------------------------------------------------------
-- MARKETPLACE MULTI BUYER MULTI SELLER + SUPPORT RESELLER SYSTEM
-- CREATED BY : ROBBY PRIHANDAYA
-- COPYRIGHT : Copyright (c) 2018 - 2019, PHPMU.COM. (https://phpmu.com/)
-- LICENSE : http://opensource.org/licenses/MIT MIT License
-- CREATED ON : 2019-03-26
-- UPDATED ON : 2019-03-27
-- ---------------------------------------------------------------
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Auth extends CI_Controller {
function city(){
$state_id = $this->input->post('stat_id');
$data['kota'] = $this->model_app->view_where_ordering('rb_kota',array('provinsi_id' => $state_id),'kota_id','DESC');
$this->load->view(template().'/reseller/view_city',$data);
}
public function register(){
if (isset($_POST['submit1'])){
$data = array('username'=>$this->input->post('a'),
'password'=>hash("sha512", md5($this->input->post('b'))),
'nama_lengkap'=>$this->input->post('c'),
'email'=>$this->input->post('d'),
'alamat_lengkap'=>$this->input->post('e'),
'kota_id'=>$this->input->post('h'),
'kecamatan'=>$this->input->post('i'),
'no_hp'=>$this->input->post('j'),
'tanggal_daftar'=>date('Y-m-d H:i:s'));
$this->model_app->insert('rb_konsumen',$data);
$id = $this->db->insert_id();
$this->session->set_userdata(array('id_konsumen'=>$id, 'level'=>'konsumen'));
if ($this->session->idp!=''){
$data = array('kode_transaksi'=>$this->session->idp,
'id_pembeli'=>$id,
'id_penjual'=>$this->session->reseller,
'status_pembeli'=>'konsumen',
'status_penjual'=>'reseller',
'waktu_transaksi'=>date('Y-m-d H:i:s'),
'proses'=>'0');
$this->model_app->insert('rb_penjualan',$data);
$idp = $this->db->insert_id();
$keranjang = $this->model_app->view_where('rb_penjualan_temp',array('session'=>$this->session->idp));
foreach ($keranjang->result_array() as $row) {
$dataa = array('id_penjualan'=>$idp,
'id_produk'=>$row['id_produk'],
'jumlah'=>$row['jumlah'],
'harga_jual'=>$row['harga_jual'],
'satuan'=>$row['satuan']);
$this->model_app->insert('rb_penjualan_detail',$dataa);
}
$this->db->query("DELETE FROM rb_penjualan_temp where session='".$this->session->idp."'");
$this->session->unset_userdata('reseller');
$this->session->unset_userdata('idp');
$this->session->set_userdata(array('idp'=>$idp));
}
redirect('members/profile');
}elseif (isset($_POST['submit2'])){
$cek = $this->model_app->view_where('rb_reseller',array('username'=>$this->input->post('a')))->num_rows();
if ($cek >= 1){
$username = $this->input->post('a');
echo "<script>window.alert('Maaf, Username $username sudah dipakai oleh orang lain!');
window.location=('".base_url()."/auth/register')</script>";
}else{
$route = array('administrator','agenda','auth','berita','contact','download','gallery','konfirmasi','main','members','page','produk','reseller','testimoni','video');
if (in_array($this->input->post('a'), $route)){
$username = $this->input->post('a');
echo "<script>window.alert('Maaf, Username $username sudah dipakai oleh orang lain!');
window.location=('".base_url()."/".$this->input->post('i')."')</script>";
}else{
$data = array('username'=>$this->input->post('a'),
'password'=>hash("sha512", md5($this->input->post('b'))),
'nama_reseller'=>$this->input->post('c'),
'jenis_kelamin'=>$this->input->post('d'),
'kota_id'=>$this->input->post('kota'),
'alamat_lengkap'=>$this->input->post('e'),
'no_telpon'=>$this->input->post('f'),
'email'=>$this->input->post('g'),
'kode_pos'=>$this->input->post('h'),
'referral'=>$this->input->post('i'),
'tanggal_daftar'=>date('Y-m-d H:i:s'));
$this->model_app->insert('rb_reseller',$data);
$id = $this->db->insert_id();
$this->session->set_userdata(array('id_reseller'=>$id, 'level'=>'reseller'));
redirect('reseller/home');
}
}
}else{
$data['title'] = 'Formulir Pendaftaran';
$data['provinsi'] = $this->model_app->view_ordering('rb_provinsi','provinsi_id','ASC');
$this->template->load(template().'/template',template().'/reseller/view_register',$data);
}
}
public function login(){
if (isset($_POST['login'])){
$username = strip_tags($this->input->post('a'));
$password = hash("sha512", md5(strip_tags($this->input->post('b'))));
$cek = $this->db->query("SELECT * FROM rb_konsumen where username='".$this->db->escape_str($username)."' AND password='".$this->db->escape_str($password)."'");
$row = $cek->row_array();
$total = $cek->num_rows();
if ($total > 0){
$this->session->set_userdata(array('id_konsumen'=>$row['id_konsumen'], 'level'=>'konsumen'));
if ($this->session->idp!=''){
$data = array('kode_transaksi'=>$this->session->idp,
'id_pembeli'=>$row['id_konsumen'],
'id_penjual'=>$this->session->reseller,
'status_pembeli'=>'konsumen',
'status_penjual'=>'reseller',
'waktu_transaksi'=>date('Y-m-d H:i:s'),
'proses'=>'0');
$this->model_app->insert('rb_penjualan',$data);
$id = $this->db->insert_id();
$query_temp = $this->db->query("SELECT * FROM rb_penjualan_temp where session='".$this->session->idp."'");
foreach ($query_temp->result_array() as $r) {
$data = array('id_penjualan'=>$id,
'id_produk'=>$r['id_produk'],
'jumlah'=>$r['jumlah'],
'diskon'=>$r['diskon'],
'harga_jual'=>$r['harga_jual'],
'satuan'=>$r['satuan']);
$this->model_app->insert('rb_penjualan_detail',$data);
}
$this->db->query("DELETE FROM rb_penjualan_temp where session='".$this->session->idp."'");
$this->session->unset_userdata('reseller');
$this->session->unset_userdata('idp');
$this->session->set_userdata(array('idp'=>$id));
}
redirect('members/profile');
}else{
$data['title'] = 'Gagal Login';
echo $this->session->set_flashdata('message', '<div class="alert alert-danger"><center>Maaf, Username atau password salah!</center></div>');
redirect('auth/login');
}
}else{
$data['title'] = 'User Login';
$this->template->load(template().'/template',template().'/reseller/view_login',$data);
}
}
//lupa password
public function login21(){
if (isset($_POST['login21'])){
$email = strip_tags($this->input->post('n'));
$no_hp = strip_tags($this->input->post('m'));
$cek = $this->db->query("SELECT * FROM rb_konsumen where email='".$this->db->escape_str($email)."' AND no_hp='".$this->db->escape_str($no_hp)."'");
$row = $cek->row_array();
$total = $cek->num_rows();
if ($total > 0){
$this->session->set_userdata(array('id_konsumen'=>$row['id_konsumen'], 'level'=>'konsumen'));
if ($this->session->idp!=''){
$data = array('kode_transaksi'=>$this->session->idp,
'id_pembeli'=>$row['id_konsumen'],
'id_penjual'=>$this->session->reseller,
'status_pembeli'=>'konsumen',
'status_penjual'=>'reseller',
'waktu_transaksi'=>date('Y-m-d H:i:s'),
'proses'=>'0');
$this->model_app->insert('rb_penjualan',$data);
$id = $this->db->insert_id();
$query_temp = $this->db->query("SELECT * FROM rb_penjualan_temp where session='".$this->session->idp."'");
foreach ($query_temp->result_array() as $r) {
$data = array('id_penjualan'=>$id,
'id_produk'=>$r['id_produk'],
'jumlah'=>$r['jumlah'],
'diskon'=>$r['diskon'],
'harga_jual'=>$r['harga_jual'],
'satuan'=>$r['satuan']);
$this->model_app->insert('rb_penjualan_detail',$data);
}
$this->db->query("DELETE FROM rb_penjualan_temp where session='".$this->session->idp."'");
$this->session->unset_userdata('reseller');
$this->session->unset_userdata('idp');
$this->session->set_userdata(array('idp'=>$id));
}
redirect('members/edit_profile');
}else{
$this->session->set_flashdata('error21', 'Data Pemulihan Tidak Ditemukan');
redirect('auth/login');
}
}else{
$data['title'] = 'User Login';
$this->template->load(template().'/template',template().'/reseller/view_login',$data);
}
}
public function lupass(){
if (isset($_POST['lupa'])){
$email = strip_tags($this->input->post('a'));
$cek = $this->db->query("SELECT * FROM rb_konsumen where email='".$this->db->escape_str($email)."'");
$row = $cek->row_array();
$total = $cek->num_rows();
if ($total > 0){
$identitas = $this->db->query("SELECT * FROM identitas where id_identitas='1'")->row_array();
$randompass = generateRandomString(10);
$passwordbaru = hash("sha512", md5($randompass));
$this->db->query("UPDATE rb_konsumen SET password='$passwordbaru' where email='".$this->db->escape_str($email)."'");
if ($row['jenis_kelamin']=='Laki-laki'){ $panggill = 'Bpk.'; }else{ $panggill = 'Ibuk.'; }
$email_tujuan = $row['email'];
$tglaktif = date("d-m-Y H:i:s");
$subject = 'Permintaan Reset Password ...';
$message = "<html><body>Halooo! <b>$panggill ".$row['nama_lengkap']."</b> ... <br> Hari ini pada tanggal <span style='color:red'>$tglaktif</span> Anda Mengirimkan Permintaan untuk Reset Password
<table style='width:100%; margin-left:25px'>
<tr><td style='background:#337ab7; color:#fff; pading:20px' cellpadding=6 colspan='2'><b>Berikut Data Informasi akun Anda : </b></td></tr>
<tr><td><b>Nama Lengkap</b></td> <td> : ".$row['nama_lengkap']."</td></tr>
<tr><td><b>Alamat Email</b></td> <td> : ".$row['email']."</td></tr>
<tr><td><b>No Telpon</b></td> <td> : ".$row['no_hp']."</td></tr>
<tr><td><b>Jenis Kelamin</b></td> <td> : ".$row['jenis_kelamin']." </td></tr>
<tr><td><b>Tempat Lahir</b></td> <td> : ".$row['tempat_lahir']." </td></tr>
<tr><td><b>Tanggal Lahir</b></td> <td> : ".$row['tanggal_lahir']." </td></tr>
<tr><td><b>Alamat Lengkap</b></td> <td> : ".$row['alamat_lengkap']." </td></tr>
<tr><td><b>Waktu Daftar</b></td> <td> : ".$row['tanggal_daftar']."</td></tr>
</table>
<br> Username Login : <b style='color:red'>$row[username]</b>
<br> Password Login : <b style='color:red'>$randompass</b>
<br> Silahkan Login di : <a href='$identitas[url]'>$identitas[url]</a> <br>
Admin, $identitas[nama_website] </body></html> \n";
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = "alamat_email@gmail.com";
$config['smtp_pass'] = "password gmail disini...";
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html';
$config['validation'] = TRUE;
$this->email->initialize($config);
$this->email->from("$identitas[email]", "$identitas[nama_website]");
$this->email->to($email_tujuan);
$this->email->cc('');
$this->email->bcc('');
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
$data['email'] = $email;
$data['title'] = 'Permintaan Reset Password Sudah Terkirim...';
$this->template->load(template().'/template',template().'/view_lupass_error',$data);
}else{
$data['email'] = $email;
$data['title'] = 'Email Tidak Ditemukan...';
$this->template->load(template().'/template',template().'p/view_lupass_error',$data);
}
}
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
* Class BaseController
*
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
* class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = [];
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session();
}
}

11
app/Controllers/Home.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace App\Controllers;
class Home extends BaseController
{
public function index(): string
{
return view('welcome_message');
}
}

1260
app/Controllers/Reseller.php Normal file

File diff suppressed because it is too large Load Diff

View File

View File

0
app/Filters/.gitkeep Normal file
View File

0
app/Helpers/.gitkeep Normal file
View File

0
app/Language/.gitkeep Normal file
View File

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

0
app/Libraries/.gitkeep Normal file
View File

0
app/Models/.gitkeep Normal file
View File

97
app/Models/Model_app.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/*
-- ---------------------------------------------------------------
-- ---------------------------------------------------------------
*/
class Model_app extends CI_model{
public function view($table){
return $this->db->get($table);
}
public function insert($table,$data){
return $this->db->insert($table, $data);
}
public function edit($table, $data){
return $this->db->get_where($table, $data);
}
public function update($table, $data, $where){
return $this->db->update($table, $data, $where);
}
public function delete($table, $where){
return $this->db->delete($table, $where);
}
public function view_where($table,$data){
$this->db->where($data);
return $this->db->get($table);
}
public function view_ordering_limit($table,$order,$ordering,$baris,$dari){
$this->db->select('*');
$this->db->order_by($order,$ordering);
$this->db->limit($dari, $baris);
return $this->db->get($table);
}
public function view_where_ordering_limit($table,$data,$order,$ordering,$baris,$dari){
$this->db->select('*');
$this->db->where($data);
$this->db->order_by($order,$ordering);
$this->db->limit($dari, $baris);
return $this->db->get($table);
}
public function view_ordering($table,$order,$ordering){
$this->db->select('*');
$this->db->from($table);
$this->db->order_by($order,$ordering);
return $this->db->get()->result_array();
}
public function view_where_ordering($table,$data,$order,$ordering){
$this->db->where($data);
$this->db->order_by($order,$ordering);
$query = $this->db->get($table);
return $query->result_array();
}
public function view_join_one($table1,$table2,$field,$order,$ordering){
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1.'.'.$field.'='.$table2.'.'.$field);
$this->db->order_by($order,$ordering);
return $this->db->get()->result_array();
}
public function view_join_where($table1,$table2,$field,$where,$order,$ordering){
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1.'.'.$field.'='.$table2.'.'.$field);
$this->db->where($where);
$this->db->order_by($order,$ordering);
return $this->db->get()->result_array();
}
function umenu_akses($link,$id){
return $this->db->query("SELECT * FROM modul,users_modul WHERE modul.id_modul=users_modul.id_modul AND users_modul.id_session='$id' AND modul.link='$link'")->num_rows();
}
public function cek_login($username,$password,$table){
return $this->db->query("SELECT * FROM $table where username='".$this->db->escape_str($username)."' AND password='".$this->db->escape_str($password)."' AND blokir='N'");
}
function grafik_kunjungan(){
return $this->db->query("SELECT count(*) as jumlah, tanggal FROM statistik GROUP BY tanggal ORDER BY tanggal DESC LIMIT 10");
}
function kategori_populer($limit){
return $this->db->query("SELECT * FROM (SELECT a.*, b.jum_dibaca FROM
(SELECT * FROM kategori) as a left join
(SELECT id_kategori, sum(dibaca) as jum_dibaca FROM berita GROUP BY id_kategori) as b on a.id_kategori=b.id_kategori) as c
where c.aktif='Y' ORDER BY c.jum_dibaca DESC LIMIT $limit");
}
}

View File

@ -0,0 +1,367 @@
<?php
/*
-- ---------------------------------------------------------------
-- MARKETPLACE MULTI BUYER MULTI SELLER + SUPPORT RESELLER SYSTEM
-- CREATED BY : ROBBY PRIHANDAYA
-- COPYRIGHT : Copyright (c) 2018 - 2019, PHPMU.COM. (https://phpmu.com/)
-- LICENSE : http://opensource.org/licenses/MIT MIT License
-- CREATED ON : 2019-03-26
-- UPDATED ON : 2019-03-27
-- ---------------------------------------------------------------
*/
class Model_reseller extends CI_model
{
function top_menu()
{
return $this->db->query("SELECT * FROM menu where position='Top' ORDER BY urutan ASC");
}
function testimoni()
{
return $this->db->query("SELECT a.*, b.nama_lengkap, b.id_konsumen FROM testimoni a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen ORDER BY a.id_testimoni DESC");
}
function testimoni_update()
{
$datadb = array(
'isi_testimoni' => $this->input->post('b'),
'aktif' => $this->input->post('f')
);
$this->db->where('id_testimoni', $this->input->post('id'));
$this->db->update('testimoni', $datadb);
}
function testimoni_edit($id)
{
return $this->db->query("SELECT a.*, b.nama_lengkap, b.id_konsumen FROM testimoni a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen where a.id_testimoni='$id'");
}
function testimoni_delete($id)
{
return $this->db->query("DELETE FROM testimoni where id_testimoni='$id'");
}
function public_testimoni($sampai, $dari)
{
return $this->db->query("SELECT a.*, b.nama_lengkap, b.foto, b.id_konsumen, b.jenis_kelamin FROM testimoni a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen where a.aktif='Y' ORDER BY a.id_testimoni DESC LIMIT $dari, $sampai");
}
function hitung_testimoni()
{
return $this->db->query("SELECT * FROM testimoni where aktif='Y'");
}
function insert_testimoni()
{
$datadb = array(
'id_konsumen' => $this->session->id_konsumen,
'isi_testimoni' => $this->input->post('testimoni'),
'aktif' => 'N',
'waktu_testimoni' => date('Y-m-d H:i:s')
);
$this->db->insert('testimoni', $datadb);
}
function cari_reseller($kata)
{
$pisah_kata = explode(" ", $kata);
$jml_katakan = (integer) count($pisah_kata);
$jml_kata = $jml_katakan - 1;
$cari = "SELECT * FROM rb_reseller a LEFT JOIN rb_kota b ON a.kota_id=b.kota_id WHERE";
for ($i = 0; $i <= $jml_kata; $i++) {
$cari .= " a.nama_reseller LIKE '%" . $pisah_kata[$i] . "%' OR b.nama_kota LIKE '%" . $pisah_kata[$i] . "%' ";
if ($i < $jml_kata) {
$cari .= " OR ";
}
}
$cari .= " ORDER BY a.id_reseller DESC LIMIT 36";
return $this->db->query($cari);
}
public function view_join_rows($table1, $table2, $field, $where, $order, $ordering)
{
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1 . '.' . $field . '=' . $table2 . '.' . $field);
$this->db->where($where);
$this->db->order_by($order, $ordering);
return $this->db->get();
}
function penjualan_list_konsumen($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_konsumen b ON a.id_pembeli=b.id_konsumen where a.status_penjual='$level' AND a.id_penjual='$id' ORDER BY a.id_penjualan DESC");
}
function jual($id)
{
return $this->db->query("SELECT sum(a.jumlah) as jual FROM rb_penjualan_detail a JOIN rb_penjualan b ON a.id_penjualan=b.id_penjualan where a.id_produk='$id' AND b.status_penjual='admin' AND b.proses='1'");
}
function beli($id)
{
return $this->db->query("SELECT sum(a.jumlah_pesan) as beli FROM rb_pembelian_detail a where a.id_produk='$id'");
}
function jual_reseller($penjual, $produk)
{
return $this->db->query("SELECT sum(jumlah) as jual FROM `rb_penjualan` a JOIN rb_penjualan_detail b ON a.id_penjualan=b.id_penjualan where a.status_pembeli='konsumen' AND a.status_penjual='reseller' AND a.id_penjual='$penjual' AND b.id_produk='$produk' AND a.proses='1'");
}
function beli_reseller($pembeli, $produk)
{
return $this->db->query("SELECT sum(jumlah) as beli FROM `rb_penjualan` a JOIN rb_penjualan_detail b ON a.id_penjualan=b.id_penjualan where a.status_pembeli='reseller' AND a.status_penjual='admin' AND a.id_pembeli='$pembeli' AND b.id_produk='$produk' AND a.proses='1'");
}
function penjualan_konsumen_detail($id)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_penjual=b.id_reseller JOIN rb_kota c ON b.kota_id=c.kota_id where a.id_penjualan='$id'");
}
function profile_konsumen($id)
{
return $this->db->query("SELECT a.id_konsumen, a.username, a.nama_lengkap, a.email, a.jenis_kelamin, a.tanggal_lahir, a.tempat_lahir, a.alamat_lengkap, a.kecamatan, a.no_hp, a.tanggal_daftar, b.kota_id, b.nama_kota as kota, c.provinsi_id, c.nama_provinsi as propinsi FROM `rb_konsumen` a LEFT JOIN rb_kota b ON a.kota_id=b.kota_id LEFT JOIN rb_provinsi c ON b.provinsi_id=c.provinsi_id where a.id_konsumen='$id'");
}
function orders_report($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_penjual=b.id_reseller where a.status_penjual='$level' AND a.id_pembeli='$id' ORDER BY a.id_penjualan DESC");
}
function agenda_terbaru($limit)
{
return $this->db->query("SELECT * FROM agenda ORDER BY id_agenda DESC LIMIT $limit");
}
public function view_join_where_one($table1, $table2, $field, $where)
{
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1 . '.' . $field . '=' . $table2 . '.' . $field);
$this->db->where($where);
return $this->db->get();
}
function modupdatefoto()
{
$config['upload_path'] = 'asset/foto_user/';
$config['allowed_types'] = 'gif|jpg|png|JPG|gif|JPEG|jpeg';
$config['max_size'] = '1000'; // kb
$this->load->library('upload', $config);
$this->upload->do_upload();
$hasil = $this->upload->data();
$config['image_library'] = 'gd2';
$config['source_image'] = 'asset/foto_user/' . $hasil['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['height'] = 622;
$this->load->library('image_lib', $config);
$this->image_lib->crop();
$datadb = array('foto' => $hasil['file_name']);
$this->db->where('id_konsumen', $this->session->id_konsumen);
$this->db->update('rb_konsumen', $datadb);
}
function modupdatefotoreseller()
{
$config['upload_path'] = 'asset/foto_user/';
$config['allowed_types'] = 'gif|jpg|png|JPG|gif|JPEG|jpeg';
$config['max_size'] = '1000'; // kb
$this->load->library('upload', $config);
$this->upload->do_upload();
$hasil = $this->upload->data();
$config['image_library'] = 'gd2';
$config['source_image'] = 'asset/foto_user/' . $hasil['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['height'] = 622;
$this->load->library('image_lib', $config);
$this->image_lib->crop();
$datadb = array('foto' => $hasil['file_name']);
$this->db->where('id_reseller', $this->session->id_reseller);
$this->db->update('rb_reseller', $datadb);
}
function profile_update($id)
{
if (trim($this->input->post('a')) != '') {
$datadbd = array(
'username' => $this->db->escape_str(strip_tags($this->input->post('aa'))),
'password' => hash("sha512", md5($this->input->post('a'))),
'nama_lengkap' => $this->db->escape_str(strip_tags($this->input->post('b'))),
'email' => $this->db->escape_str(strip_tags($this->input->post('c'))),
'jenis_kelamin' => $this->db->escape_str($this->input->post('d')),
'tanggal_lahir' => $this->db->escape_str($this->input->post('e')),
'tempat_lahir' => $this->db->escape_str(strip_tags($this->input->post('f'))),
'alamat_lengkap' => $this->db->escape_str(strip_tags($this->input->post('g'))),
'kecamatan' => $this->db->escape_str(strip_tags($this->input->post('k'))),
'kota_id' => $this->db->escape_str(strip_tags($this->input->post('ga'))),
'no_hp' => $this->db->escape_str(strip_tags($this->input->post('l')))
);
} else {
$datadbd = array(
'username' => $this->db->escape_str(strip_tags($this->input->post('aa'))),
'nama_lengkap' => $this->db->escape_str(strip_tags($this->input->post('b'))),
'email' => $this->db->escape_str(strip_tags($this->input->post('c'))),
'jenis_kelamin' => $this->db->escape_str($this->input->post('d')),
'tanggal_lahir' => $this->db->escape_str($this->input->post('e')),
'tempat_lahir' => $this->db->escape_str(strip_tags($this->input->post('f'))),
'alamat_lengkap' => $this->db->escape_str(strip_tags($this->input->post('g'))),
'kecamatan' => $this->db->escape_str(strip_tags($this->input->post('k'))),
'kota_id' => $this->db->escape_str(strip_tags($this->input->post('ga'))),
'no_hp' => $this->db->escape_str(strip_tags($this->input->post('l')))
);
}
$this->db->where('id_konsumen', $id);
$this->db->update('rb_konsumen', $datadbd);
}
function penjualan_list_konsumen_top($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_konsumen b ON a.id_pembeli=b.id_konsumen where a.status_penjual='$level' AND a.id_penjual='$id' ORDER BY a.id_penjualan DESC LIMIT 10");
}
function penjualan_list_pusat_top()
{
return $this->db->query("
SELECT
rp.*,
rpd.*
FROM
rb_penjualan rp
JOIN
rb_penjualan_detail rpd
ON
rp.id_penjualan = rpd.id_penjualan
WHERE
rp.id_pembeli = 10
AND rp.id_penjual = 1
ORDER BY
rp.waktu_transaksi DESC
LIMIT 10
");
}
function reseller_pembelian($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_pembeli=b.id_reseller where a.status_penjual='$level' AND a.id_pembeli='$id' ORDER BY a.id_penjualan DESC");
}
function penjualan_detail($id)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_pembeli=b.id_reseller where a.id_penjualan='$id'");
}
function penjualan_konsumen_detail_reseller($id)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_konsumen b ON a.id_pembeli=b.id_konsumen where a.id_penjualan='$id'");
}
function penjualan_list($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_pembeli=b.id_reseller where a.status_penjual='$level' AND a.id_penjual='$id' ORDER BY a.id_penjualan DESC");
}
function pembelian($id_reseller)
{
return $this->db->query("SELECT sum((b.jumlah*b.harga_jual)-b.diskon) as total FROM rb_penjualan a JOIN rb_penjualan_detail b ON a.id_penjualan=b.id_penjualan where a.status_penjual='admin' AND a.id_pembeli='" . $id_reseller . "' AND a.proses='1'");
}
function penjualan_perusahaan($id_reseller)
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_penjual='reseller' AND b.id_produk_perusahaan!='0' AND id_penjual='" . $id_reseller . "' AND c.proses='1'");
}
function penjualan($id_reseller)
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_penjual='reseller' AND b.id_produk_perusahaan='0' AND id_penjual='" . $id_reseller . "' AND c.proses='1'");
}
function penjualan_1()
{
$today = date('Y-m-d');
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND DATE(c.waktu_transaksi) = '" . $today . "'");
}
function penjualan_7()
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND c.waktu_transaksi BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()");
}
function penjualan_30()
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND c.waktu_transaksi BETWEEN DATE_SUB(CURDATE(), INTERVAL 30 DAY) AND CURDATE()");
}
function penjualan_365()
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND c.waktu_transaksi BETWEEN DATE_SUB(CURDATE(), INTERVAL 365 DAY) AND CURDATE()");
}
function modal_perusahaan($id_reseller)
{
return $this->db->query("SELECT sum(a.jumlah*b.harga_reseller) as total FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_pembeli='konsumen' AND c.proses='1' AND c.id_penjual='" . $id_reseller . "' AND b.id_produk_perusahaan!='0'");
}
function modal_pribadi($id_reseller)
{
return $this->db->query("SELECT sum(a.jumlah*b.harga_beli) as total FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_pembeli='konsumen' AND c.proses='1' AND c.id_penjual='" . $id_reseller . "' AND b.id_produk_perusahaan='0'");
}
function produk_perkategori($id_reseller, $id_produk_perusahaan, $id_kategori_produk, $limit)
{
return $this->db->query("SELECT a.*, b.nama_reseller, c.nama_kota FROM rb_produk a LEFT JOIN rb_reseller b ON a.id_reseller=b.id_reseller
LEFT JOIN rb_kota c ON b.kota_id=c.kota_id where a.id_reseller!='$id_reseller' AND a.id_produk_perusahaan='$id_produk_perusahaan' AND a.id_kategori_produk='$id_kategori_produk' ORDER BY a.id_produk DESC LIMIT $limit");
}
function modal_pribadi2()
{
return $this->db->query("SELECT SUM(harga_konsumen) AS total_harga_konsumen
FROM rb_produk
WHERE id_reseller = 10
");
}
}

0
app/ThirdParty/.gitkeep vendored Normal file
View File

View File

@ -0,0 +1,316 @@
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<?php $usr = $this->model_app->view_where('users', array('username'=> $this->session->username))->row_array();
if (trim($usr['foto'])==''){ $foto = 'blank.png'; }else{ $foto = $usr['foto']; } ?>
<img src="<?php echo base_url(); ?>/asset/foto_user/<?php echo $foto; ?>" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<?php echo "<p>$usr[nama_lengkap]</p>"; ?>
<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header" style='text-transform:uppercase;'>MENU <span class='uppercase'><?php echo $this->session->level; ?></span></li>
<li><a href="<?php echo base_url().$this->uri->segment(1); ?>/home"><i class="fa fa-dashboard"></i> <span>Dashboard</span></a></li>
<li class="treeview">
<a href="#"><i class="fa fa-shopping-cart"></i> <span>Toko / Reseller</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li class="treeview">
<a href="#"><i class="fa fa-circle-o"></i> Master <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("konsumen",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/konsumen'><i class='fa fa-circle-o'></i> Data Konsumen</a></li>";
}
$cek=$this->model_app->umenu_akses("reseller",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/reseller'><i class='fa fa-circle-o'></i> Data Reseller</a></li>";
}
$cek=$this->model_app->umenu_akses("supplier",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/supplier'><i class='fa fa-circle-o'></i> Data Supplier</a></li>";
}
$cek=$this->model_app->umenu_akses("kategori_produk",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/kategori_produk'><i class='fa fa-circle-o'></i> Kategori Produk</a></li>";
}
$cek=$this->model_app->umenu_akses("kategori_produk",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/kategori_produk_sub'><i class='fa fa-circle-o'></i> Sub-Kategori Produk</a></li>";
}
$cek=$this->model_app->umenu_akses("produk",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/produk'><i class='fa fa-circle-o'></i> Data Produk</a></li>";
}
$cek=$this->model_app->umenu_akses("rekening",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/rekening'><i class='fa fa-circle-o'></i> Rekening Perusahaan</a></li>";
}
$cek=$this->model_app->umenu_akses("settingbonus",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/settingbonus'><i class='fa fa-circle-o'></i> Setting Bonus</a></li>";
}
?>
</ul>
</li>
<li class="treeview">
<a href="#"><i class="fa fa-circle-o"></i> Transaksi <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("pembelian",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/pembelian'><i class='fa fa-circle-o'></i> Pembelian ke Supplier</a></li>";
}
$cek=$this->model_app->umenu_akses("penjualan",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/penjualan'><i class='fa fa-circle-o'></i> Penjualan ke Reseller</a></li>";
}
$cek=$this->model_app->umenu_akses("pembayaran_reseller",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/pembayaran_reseller'><i class='fa fa-circle-o'></i> Pembayaran Reseller</a></li>";
}
?>
</ul>
</li>
<li class="treeview">
<a href="#"><i class="fa fa-circle-o"></i> Report <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("keuangan",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/keuangan'><i class='fa fa-circle-o'></i> Keuangan Reseller</a></li>";
}
$cek=$this->model_app->umenu_akses("history_referral",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/history_referral'><i class='fa fa-circle-o'></i> Pembayaran Referral</a></li>";
}
$cek=$this->model_app->umenu_akses("history_reward",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/history_reward'><i class='fa fa-circle-o'></i> Pembayaran Reward</a></li>";
}
?>
</ul>
</li>
</ul>
</li>
<li class="treeview">
<a href="#"><i class="glyphicon glyphicon-th-list"></i> <span>Menu Utama</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("identitaswebsite",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/identitaswebsite'><i class='fa fa-circle-o'></i> Identitas Website</a></li>";
}
$cek=$this->model_app->umenu_akses("menuwebsite",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/menuwebsite'><i class='fa fa-circle-o'></i> Menu Website</a></li>";
}
$cek=$this->model_app->umenu_akses("halamanbaru",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/halamanbaru'><i class='fa fa-circle-o'></i> Halaman Baru</a></li>";
}
?>
</ul>
</li>
<!--<li class="treeview">-->
<!-- <a href="#"><i class="glyphicon glyphicon-pencil"></i> <span>Modul Berita</span><i class="fa fa-angle-left pull-right"></i></a>-->
<!-- <ul class="treeview-menu">-->
<!-- <?php-->
<!-- $cek=$this->model_app->umenu_akses("listberita",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/listberita'><i class='fa fa-circle-o'></i> Berita</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("kategoriberita",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/kategoriberita'><i class='fa fa-circle-o'></i> Kategori Berita</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("tagberita",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/tagberita'><i class='fa fa-circle-o'></i> Tag Berita</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("komentarberita",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/komentarberita'><i class='fa fa-circle-o'></i> Komentar Berita</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("sensorkomentar",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/sensorkomentar'><i class='fa fa-circle-o'></i> Sensor Komentar</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("album",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/album'><i class='fa fa-circle-o'></i> Berita Foto</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("gallery",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/gallery'><i class='fa fa-circle-o'></i> Gallery Berita Foto</a></li>";-->
<!-- }-->
<!-- ?>-->
<!-- </ul>-->
<!--</li>-->
<!-- <li class="treeview">
<a href="#"><i class="glyphicon glyphicon-play"></i> <span>Modul Video</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("playlist",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/playlist'><i class='fa fa-circle-o'></i> Playlist Video</a></li>";
}
$cek=$this->model_app->umenu_akses("video",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/video'><i class='fa fa-circle-o'></i> Video</a></li>";
}
$cek=$this->model_app->umenu_akses("tagvideo",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/tagvideo'><i class='fa fa-circle-o'></i> Tag Video</a></li>";
}
$cek=$this->model_app->umenu_akses("komentarvideo",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/komentarvideo'><i class='fa fa-circle-o'></i> Komentar Video</a></li>";
}
?>
</ul>
</li> -->
<!-- <li class="treeview">
<a href="#"><i class="glyphicon glyphicon-blackboard"></i> <span>Modul Iklan</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("iklanatas",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/iklanatas'><i class='fa fa-circle-o'></i> Iklan Atas</a></li>";
}
$cek=$this->model_app->umenu_akses("iklanhome",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/iklanhome'><i class='fa fa-circle-o'></i> Iklan Home</a></li>";
}
$cek=$this->model_app->umenu_akses("iklansidebar",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/iklansidebar'><i class='fa fa-circle-o'></i> Iklan Sidebar</a></li>";
}
$cek=$this->model_app->umenu_akses("banner",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/banner'><i class='fa fa-circle-o'></i> Iklan Link</a></li>";
}
?>
</ul>
</li> -->
<!-- <li class="treeview">
<a href="#"><i class="glyphicon glyphicon-object-align-left"></i> <span>Modul Web</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("logowebsite",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/logowebsite'><i class='fa fa-circle-o'></i> Logo Website</a></li>";
}
$cek=$this->model_app->umenu_akses("templatewebsite",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/templatewebsite'><i class='fa fa-circle-o'></i> Template Website</a></li>";
}
$cek=$this->model_app->umenu_akses("background",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/background'><i class='fa fa-circle-o'></i> Background Website</a></li>";
}
?>
</ul>
</li> -->
<!--<li class="treeview">-->
<!-- <a href="#"><i class="glyphicon glyphicon-blackboard"></i> <span>Modul Interaksi</span><i class="fa fa-angle-left pull-right"></i></a>-->
<!-- <ul class="treeview-menu">-->
<!-- <?php-->
<!-- $cek=$this->model_app->umenu_akses("agenda",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/agenda'><i class='fa fa-circle-o'></i> Agenda</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("sekilasinfo",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/sekilasinfo'><i class='fa fa-circle-o'></i> Sekilas Info</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("jajakpendapat",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/jajakpendapat'><i class='fa fa-circle-o'></i> Jajak Pendapat</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("ym",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/ym'><i class='fa fa-circle-o'></i> Yahoo Messanger</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("download",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/download'><i class='fa fa-circle-o'></i> Download Area</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("alamat",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/alamat'><i class='fa fa-circle-o'></i> Alamat Kontak</a></li>";-->
<!-- }-->
<!-- $cek=$this->model_app->umenu_akses("pesanmasuk",$this->session->id_session);-->
<!-- if($cek==1 OR $this->session->level=='admin'){-->
<!-- echo "<li><a href='".base_url().$this->uri->segment(1)."/pesanmasuk'><i class='fa fa-circle-o'></i> Pesan Masuk</a></li>";-->
<!-- }-->
<!-- ?>-->
<!-- </ul>-->
<!--</li>-->
<li class="treeview">
<a href="#"><i class="fa fa-users"></i> <span>Modul Users</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
$cek=$this->model_app->umenu_akses("manajemenuser",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/manajemenuser'><i class='fa fa-circle-o'></i> Manajemen User</a></li>";
}
$cek=$this->model_app->umenu_akses("manajemenmodul",$this->session->id_session);
if($cek==1 OR $this->session->level=='admin'){
echo "<li><a href='".base_url().$this->uri->segment(1)."/manajemenmodul'><i class='fa fa-circle-o'></i> Manajemen Modul</a></li>";
}
?>
</ul>
</li>
<li><a href="<?php echo base_url().$this->uri->segment(1); ?>/edit_manajemenuser/<?php echo $this->session->username; ?>"><i class="fa fa-edit"></i> <span>Edit Profile</span></a></li>
<li><a href="<?php echo base_url().$this->uri->segment(1); ?>/logout"><i class="fa fa-power-off"></i> <span>Logout</span></a></li>
</ul>
</section>

View File

@ -0,0 +1,43 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Manajemen Users</h3>
<a class='pull-right btn btn-primary btn-sm' href='<?php echo base_url().$this->uri->segment(1); ?>/tambah_manajemenuser'>Tambahkan Data</a>
</div><!-- /.box-header -->
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th style='width:20px'>No</th>
<th>Username</th>
<th>Nama Lengkap</th>
<th>Email</th>
<th>Foto</th>
<th>Blokir</th>
<th>Level</th>
<th style='width:70px'>Action</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record as $row){
if ($row['foto'] == ''){ $foto ='blank.png'; }else{ $foto = $row['foto']; }
echo "<tr><td>$no</td>
<td>$row[username]</td>
<td>$row[nama_lengkap]</td>
<td>$row[email]</td>
<td><img style='border:1px solid #cecece' width='40px' class='img-circle' src='".base_url()."asset/foto_user/$foto'></td>
<td>$row[blokir]</td>
<td>$row[level]</td>
<td><center>
<a class='btn btn-success btn-xs' title='Edit Data' href='".base_url().$this->uri->segment(1)."/edit_manajemenuser/$row[username]'><span class='glyphicon glyphicon-edit'></span></a>
<a class='btn btn-danger btn-xs' title='Delete Data' href='".base_url().$this->uri->segment(1)."/delete_manajemenuser/$row[username]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>
</center></td>
</tr>";
$no++;
}
?>
</tbody>
</table>
</div>

View File

@ -0,0 +1,51 @@
<?php
echo "<div class='col-md-6'>
<div class='box'>
<div class='box-header'>
<h3 class='box-title'>Selamat Datang di Halaman $users[level]</h3>
</div>
<div class='box-body'>
<p>Silahkan klik menu pilihan yang berada di sebelah kiri untuk mengelola Tulisan anda pada web ini, berikut informasi akun anda saat ini : </p>
<dl class='dl-horizontal'>
<dt>Username</dt>
<dd>$users[username]</dd>
<dt>Password</dt>
<dd>***********</dd>
<dt>Nama Lengkap</dt>
<dd>$users[nama_lengkap]</dd>
<dt>Alamat Email</dt>
<dd>$users[email]</dd>
<dt>No. Telpon</dt>
<dd>$users[no_telp]</dd>
<dt>Level</dt>
<dd>$users[level]</dd>
<dt>Hak Akses</dt>
<dd>";
$hakakses = $this->db->query("SELECT * FROM modul,users_modul WHERE modul.id_modul=users_modul.id_modul AND users_modul.id_session='" . $this->session->id_session . "'");
foreach ($hakakses->result_array() as $mod1) {
echo "<a href='$mod1[link]'>$mod1[nama_modul]</a>, ";
}
echo "</dd>
</dl>
<div class='alert alert-success alert-dismissible'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h4><i class='icon fa fa-info'></i> Info Penting!</h4>
Diharapkan informasi akun sesuai dengan identitas pada Kartu Pengenal anda, Untuk Mengubah informasi Profile anda klik <a href='" . base_url() . $this->uri->segment(1) . "/edit_manajemenuser/" . $this->session->username . "'>disini</a>.
</div>
</div>
</div>
</div>
<section class='col-lg-6 connectedSortable'>";
$feedlist = new rss('https://members.phpmu.com/forum.xml'); /* Ubah link feed disini dengan link feed Anda */
echo $feedlist->display(5, "Forum Swarakalibata"); /* Angka 7 digunakan untuk menampilkan jumlah artikel */
echo "</section>";
?>

View File

@ -0,0 +1,220 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $title; ?></title>
<meta name="author" content="phpmu.com">
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/asset/admin/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/asset/admin/dist/css/AdminLTE.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/asset/admin/plugins/iCheck/square/blue.css">
</head>
<style>
.teks {
font-style: italic;
font-size: 30px;
color: black;
font-weight: bold;
}
.teks.visible {
opacity: 1;
}
.overlay {
position: absolute;
justify-content: center;
align-items: center;
background-color: white;
justify-items: center;
z-index: 3;
color: transparent;
height: 100%;
width: 100%;
opacity: 20%;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(40px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeOut {
from {
opacity: 1;
transform: translateY(0);
}
to {
opacity: 0;
transform: translateY(40px);
}
}
.fadeIn {
animation: fadeIn 3s forwards;
}
.fadeOut {
animation: fadeOut 1s forwards;
}
</style>
</head>
<body>
<center>
<div class="overlay" id="overlay">
<img class="gambar" id="gambar"
src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExbzNudXk2Z2s4eW51MTRrdmhvdHp6YWZhMDdoYXlmb2g0ZHJ5cDcyMSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/Lew6ElbGiIVuIaiwNa/giphy.webp"
alt="">
<p class="teks" id="teks">Bayar Gaji Pegawai Lebih Mudah Menggunakan Aplikasi Dana</p>
</div>
</center>
<script>
document.addEventListener('DOMContentLoaded', () => {
const overlayElement = document.getElementById('overlay');
overlayElement.classList.add('fadeIn');
setTimeout(() => {
overlayElement.classList.remove('fadeIn');
overlayElement.classList.add('fadeOut');
}, 6000);
overlayElement.addEventListener('animationend', () => {
if (overlayElement.classList.contains('fadeOut')) {
overlayElement.style.display = 'none';
}
});
});
</script>
</body>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<a href="#"><b>ADMIN</b> Login</a>
</div><!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Silahkan Login Pada Form dibawah ini</p>
<?php
echo $this->session->flashdata('message');
echo form_open($this->uri->segment(1) . '/index');
?>
<div class="form-group has-feedback">
<input type="text" class="form-control" name='a' placeholder="Username" required>
<span class="glyphicon glyphicon-user form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" name='b' placeholder="Password" required>
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<?php echo $image; ?>
</div>
<div class="form-group has-feedback">
<input type="text" class="form-control" name='security_code' placeholder="Security Code" required>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
<label>
<input type="checkbox"> Remember Me
</label>
</div>
</div><!-- /.col -->
<div class="col-xs-4">
<input name='submit' type="submit" class="btn btn-primary btn-block btn-flat" value='Sign In'>
</div><!-- /.col -->
</div>
</form>
<hr>
<a class='link' data-dismiss="modal" aria-hidden="true" data-toggle='modal' href='#lupapass'
data-target='#lupapass'>Anda Lupa Password?</a>
</div><!-- /.login-box-body -->
</div><!-- /.login-box -->
<!-- jQuery 2.1.4 -->
<script src="<?php echo base_url(); ?>/asset/admin/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="<?php echo base_url(); ?>/asset/admin/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="<?php echo base_url(); ?>/asset/admin/plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
});
</script>
<div class="modal fade" id="lupapass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h5 class="modal-title" id="myModalLabel">Lupa Password Login?</h5>
</div>
<center>
<div class="modal-body">
<?php
$attributes = array('class' => 'form-horizontal');
echo form_open($this->uri->segment(1) . '/lupapassword', $attributes);
?>
<div class="form-group">
<center style='color:red'>Masukkan Email yang terkait dengan akun!</center><br>
<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
<div style='background:#fff;' class="input-group col-sm-8">
<span class="input-group-addon"><i class='fa fa-envelope fa-fw'></i></span>
<input style='text-transform:lowercase;' type="email" class="required form-control" name="email">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3">
<button type="submit" name='lupa' class="btn btn-primary btn-sm">Kirimkan Permintaan</button>
&nbsp; &nbsp; &nbsp;<a data-dismiss="modal" aria-hidden="true" data-toggle='modal' href='#login'
data-target='#login' title="Lupa Password Members">Kembali Login?</a>
</div>
</div>
</form>
<div style='clear:both'></div>
</div>
</center>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,7 @@
<?php
use CodeIgniter\CLI\CLI;
CLI::error('ERROR: ' . $code);
CLI::write($message);
CLI::newLine();

View File

@ -0,0 +1,74 @@
<?php
use CodeIgniter\CLI\CLI;
// The main Exception
CLI::write('[' . get_class($exception) . ']', 'light_gray', 'red');
CLI::write($message);
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
CLI::newLine();
$last = $exception;
while ($prevException = $last->getPrevious()) {
$last = $prevException;
CLI::write(' Caused by:');
CLI::write(' [' . get_class($prevException) . ']', 'red');
CLI::write(' ' . $prevException->getMessage());
CLI::write(' at ' . CLI::color(clean_path($prevException->getFile()) . ':' . $prevException->getLine(), 'green'));
CLI::newLine();
}
// The backtrace
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$backtraces = $last->getTrace();
if ($backtraces) {
CLI::write('Backtrace:', 'green');
}
foreach ($backtraces as $i => $error) {
$padFile = ' '; // 4 spaces
$padClass = ' '; // 7 spaces
$c = str_pad($i + 1, 3, ' ', STR_PAD_LEFT);
if (isset($error['file'])) {
$filepath = clean_path($error['file']) . ':' . $error['line'];
CLI::write($c . $padFile . CLI::color($filepath, 'yellow'));
} else {
CLI::write($c . $padFile . CLI::color('[internal function]', 'yellow'));
}
$function = '';
if (isset($error['class'])) {
$type = ($error['type'] === '->') ? '()' . $error['type'] : $error['type'];
$function .= $padClass . $error['class'] . $type . $error['function'];
} elseif (! isset($error['class']) && isset($error['function'])) {
$function .= $padClass . $error['function'];
}
$args = implode(', ', array_map(static function ($value) {
switch (true) {
case is_object($value):
return 'Object(' . get_class($value) . ')';
case is_array($value):
return count($value) ? '[...]' : '[]';
case $value === null:
return 'null'; // return the lowercased version
default:
return var_export($value, true);
}
}, array_values($error['args'] ?? [])));
$function .= '(' . $args . ')';
CLI::write($function);
CLI::newLine();
}
}

View File

@ -0,0 +1,5 @@
<?php
// On the CLI, we still want errors in productions
// so just use the exception template.
include __DIR__ . '/error_exception.php';

View File

@ -0,0 +1,197 @@
:root {
--main-bg-color: #fff;
--main-text-color: #555;
--dark-text-color: #222;
--light-text-color: #c7c7c7;
--brand-primary-color: #E06E3F;
--light-bg-color: #ededee;
--dark-bg-color: #404040;
}
body {
height: 100%;
background: var(--main-bg-color);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
color: var(--main-text-color);
font-weight: 300;
margin: 0;
padding: 0;
}
h1 {
font-weight: lighter;
letter-spacing: 0.8;
font-size: 3rem;
color: var(--dark-text-color);
margin: 0;
}
h1.headline {
margin-top: 20%;
font-size: 5rem;
}
.text-center {
text-align: center;
}
p.lead {
font-size: 1.6rem;
}
.container {
max-width: 75rem;
margin: 0 auto;
padding: 1rem;
}
.header {
background: var(--light-bg-color);
color: var(--dark-text-color);
}
.header .container {
padding: 1rem 1.75rem 1.75rem 1.75rem;
}
.header h1 {
font-size: 2.5rem;
font-weight: 500;
}
.header p {
font-size: 1.2rem;
margin: 0;
line-height: 2.5;
}
.header a {
color: var(--brand-primary-color);
margin-left: 2rem;
display: none;
text-decoration: none;
}
.header:hover a {
display: inline;
}
.footer {
background: var(--dark-bg-color);
color: var(--light-text-color);
}
.footer .container {
border-top: 1px solid #e7e7e7;
margin-top: 1rem;
text-align: center;
}
.source {
background: #343434;
color: var(--light-text-color);
padding: 0.5em 1em;
border-radius: 5px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 0.85rem;
margin: 0;
overflow-x: scroll;
}
.source span.line {
line-height: 1.4;
}
.source span.line .number {
color: #666;
}
.source .line .highlight {
display: block;
background: var(--dark-text-color);
color: var(--light-text-color);
}
.source span.highlight .number {
color: #fff;
}
.tabs {
list-style: none;
list-style-position: inside;
margin: 0;
padding: 0;
margin-bottom: -1px;
}
.tabs li {
display: inline;
}
.tabs a:link,
.tabs a:visited {
padding: 0rem 1rem;
line-height: 2.7;
text-decoration: none;
color: var(--dark-text-color);
background: var(--light-bg-color);
border: 1px solid rgba(0,0,0,0.15);
border-bottom: 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: inline-block;
}
.tabs a:hover {
background: var(--light-bg-color);
border-color: rgba(0,0,0,0.15);
}
.tabs a.active {
background: var(--main-bg-color);
color: var(--main-text-color);
}
.tab-content {
background: var(--main-bg-color);
border: 1px solid rgba(0,0,0,0.15);
}
.content {
padding: 1rem;
}
.hide {
display: none;
}
.alert {
margin-top: 2rem;
display: block;
text-align: center;
line-height: 3.0;
background: #d9edf7;
border: 1px solid #bcdff1;
border-radius: 5px;
color: #31708f;
}
ul, ol {
line-height: 1.8;
}
table {
width: 100%;
overflow: hidden;
}
th {
text-align: left;
border-bottom: 1px solid #e7e7e7;
padding-bottom: 0.5rem;
}
td {
padding: 0.2rem 0.5rem 0.2rem 0;
}
tr:hover td {
background: #f1f1f1;
}
td pre {
white-space: pre-wrap;
}
.trace a {
color: inherit;
}
.trace table {
width: auto;
}
.trace tr td:first-child {
min-width: 5em;
font-weight: bold;
}
.trace td {
background: var(--light-bg-color);
padding: 0 1rem;
}
.trace td pre {
margin: 0;
}
.args {
display: none;
}

View File

@ -0,0 +1,116 @@
var tabLinks = new Array();
var contentDivs = new Array();
function init()
{
// Grab the tab links and content divs from the page
var tabListItems = document.getElementById('tabs').childNodes;
console.log(tabListItems);
for (var i = 0; i < tabListItems.length; i ++)
{
if (tabListItems[i].nodeName == "LI")
{
var tabLink = getFirstChildWithTagName(tabListItems[i], 'A');
var id = getHash(tabLink.getAttribute('href'));
tabLinks[id] = tabLink;
contentDivs[id] = document.getElementById(id);
}
}
// Assign onclick events to the tab links, and
// highlight the first tab
var i = 0;
for (var id in tabLinks)
{
tabLinks[id].onclick = showTab;
tabLinks[id].onfocus = function () {
this.blur()
};
if (i == 0)
{
tabLinks[id].className = 'active';
}
i ++;
}
// Hide all content divs except the first
var i = 0;
for (var id in contentDivs)
{
if (i != 0)
{
console.log(contentDivs[id]);
contentDivs[id].className = 'content hide';
}
i ++;
}
}
function showTab()
{
var selectedId = getHash(this.getAttribute('href'));
// Highlight the selected tab, and dim all others.
// Also show the selected content div, and hide all others.
for (var id in contentDivs)
{
if (id == selectedId)
{
tabLinks[id].className = 'active';
contentDivs[id].className = 'content';
}
else
{
tabLinks[id].className = '';
contentDivs[id].className = 'content hide';
}
}
// Stop the browser following the link
return false;
}
function getFirstChildWithTagName(element, tagName)
{
for (var i = 0; i < element.childNodes.length; i ++)
{
if (element.childNodes[i].nodeName == tagName)
{
return element.childNodes[i];
}
}
}
function getHash(url)
{
var hashPos = url.lastIndexOf('#');
return url.substring(hashPos + 1);
}
function toggle(elem)
{
elem = document.getElementById(elem);
if (elem.style && elem.style['display'])
{
// Only works with the "style" attr
var disp = elem.style['display'];
}
else if (elem.currentStyle)
{
// For MSIE, naturally
var disp = elem.currentStyle['display'];
}
else if (window.getComputedStyle)
{
// For most other browsers
var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');
}
// Toggle the state of the "display" style
elem.style.display = disp == 'block' ? 'none' : 'block';
return false;
}

View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= lang('Errors.pageNotFound') ?></title>
<style>
div.logo {
height: 200px;
width: 155px;
display: inline-block;
opacity: 0.08;
position: absolute;
top: 2rem;
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: normal;
font-size: 3rem;
margin-top: 0;
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
padding: 2rem;
background: #fff;
text-align: center;
border: 1px solid #efefef;
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
padding: 0.5rem 1rem;
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
padding: 1em 2em 0 2em;
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
</head>
<body>
<div class="wrap">
<h1>404</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,418 @@
<?php
use Config\Services;
use CodeIgniter\CodeIgniter;
$errorId = uniqid('error', true);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= esc($title) ?></title>
<style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
<script>
<?= file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.js') ?>
</script>
</head>
<body onload="init()">
<!-- Header -->
<div class="header">
<div class="container">
<h1><?= esc($title), esc($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
<p>
<?= nl2br(esc($exception->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
</p>
</div>
</div>
<!-- Source -->
<div class="container">
<p><b><?= esc(clean_path($file)) ?></b> at line <b><?= esc($line) ?></b></p>
<?php if (is_file($file)) : ?>
<div class="source">
<?= static::highlightFile($file, $line, 15); ?>
</div>
<?php endif; ?>
</div>
<div class="container">
<?php
$last = $exception;
while ($prevException = $last->getPrevious()) {
$last = $prevException;
?>
<pre>
Caused by:
<?= esc(get_class($prevException)), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
<?= nl2br(esc($prevException->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode(get_class($prevException) . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $prevException->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
<?= esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
</pre>
<?php
}
?>
</div>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) : ?>
<div class="container">
<ul class="tabs" id="tabs">
<li><a href="#backtrace">Backtrace</a></li>
<li><a href="#server">Server</a></li>
<li><a href="#request">Request</a></li>
<li><a href="#response">Response</a></li>
<li><a href="#files">Files</a></li>
<li><a href="#memory">Memory</a></li>
</ul>
<div class="tab-content">
<!-- Backtrace -->
<div class="content" id="backtrace">
<ol class="trace">
<?php foreach ($trace as $index => $row) : ?>
<li>
<p>
<!-- Trace info -->
<?php if (isset($row['file']) && is_file($row['file'])) : ?>
<?php
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once'], true)) {
echo esc($row['function'] . ' ' . clean_path($row['file']));
} else {
echo esc(clean_path($row['file']) . ' : ' . $row['line']);
}
?>
<?php else: ?>
{PHP internal code}
<?php endif; ?>
<!-- Class/Method -->
<?php if (isset($row['class'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;<?= esc($row['class'] . $row['type'] . $row['function']) ?>
<?php if (! empty($row['args'])) : ?>
<?php $argsId = $errorId . 'args' . $index ?>
( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> )
<div class="args" id="<?= esc($argsId, 'attr') ?>">
<table cellspacing="0">
<?php
$params = null;
// Reflection by name is not available for closure function
if (substr($row['function'], -1) !== '}') {
$mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']);
$params = $mirror->getParameters();
}
foreach ($row['args'] as $key => $value) : ?>
<tr>
<td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?></code></td>
<td><pre><?= esc(print_r($value, true)) ?></pre></td>
</tr>
<?php endforeach ?>
</table>
</div>
<?php else : ?>
()
<?php endif; ?>
<?php endif; ?>
<?php if (! isset($row['class']) && isset($row['function'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp; <?= esc($row['function']) ?>()
<?php endif; ?>
</p>
<!-- Source? -->
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
<div class="source">
<?= static::highlightFile($row['file'], $row['line']) ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ol>
</div>
<!-- Server -->
<div class="content" id="server">
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
<?php
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
continue;
} ?>
<h3>$<?= esc($var) ?></h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<!-- Constants -->
<?php $constants = get_defined_constants(true); ?>
<?php if (! empty($constants['user'])) : ?>
<h3>Constants</h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($constants['user'] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Request -->
<div class="content" id="request">
<?php $request = Services::request(); ?>
<table>
<tbody>
<tr>
<td style="width: 10em">Path</td>
<td><?= esc($request->getUri()) ?></td>
</tr>
<tr>
<td>HTTP Method</td>
<td><?= esc(strtoupper($request->getMethod())) ?></td>
</tr>
<tr>
<td>IP Address</td>
<td><?= esc($request->getIPAddress()) ?></td>
</tr>
<tr>
<td style="width: 10em">Is AJAX Request?</td>
<td><?= $request->isAJAX() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is CLI Request?</td>
<td><?= $request->isCLI() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is Secure Request?</td>
<td><?= $request->isSecure() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>User Agent</td>
<td><?= esc($request->getUserAgent()->getAgentString()) ?></td>
</tr>
</tbody>
</table>
<?php $empty = true; ?>
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
<?php
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
continue;
} ?>
<?php $empty = false; ?>
<h3>$<?= esc($var) ?></h3>
<table style="width: 100%">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<?php if ($empty) : ?>
<div class="alert">
No $_GET, $_POST, or $_COOKIE Information to show.
</div>
<?php endif; ?>
<?php $headers = $request->headers(); ?>
<?php if (! empty($headers)) : ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($headers as $header) : ?>
<tr>
<td><?= esc($header->getName(), 'html') ?></td>
<td><?= esc($header->getValueLine(), 'html') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Response -->
<?php
$response = Services::response();
$response->setStatusCode(http_response_code());
?>
<div class="content" id="response">
<table>
<tr>
<td style="width: 15em">Response Status</td>
<td><?= esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?></td>
</tr>
</table>
<?php $headers = $response->headers(); ?>
<?php if (! empty($headers)) : ?>
<?php natsort($headers) ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach (array_keys($headers) as $name) : ?>
<tr>
<td><?= esc($name, 'html') ?></td>
<td><?= esc($response->getHeaderLine($name), 'html') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Files -->
<div class="content" id="files">
<?php $files = get_included_files(); ?>
<ol>
<?php foreach ($files as $file) :?>
<li><?= esc(clean_path($file)) ?></li>
<?php endforeach ?>
</ol>
</div>
<!-- Memory -->
<div class="content" id="memory">
<table>
<tbody>
<tr>
<td>Memory Usage</td>
<td><?= esc(static::describeMemory(memory_get_usage(true))) ?></td>
</tr>
<tr>
<td style="width: 12em">Peak Memory Usage:</td>
<td><?= esc(static::describeMemory(memory_get_peak_usage(true))) ?></td>
</tr>
<tr>
<td>Memory Limit:</td>
<td><?= esc(ini_get('memory_limit')) ?></td>
</tr>
</tbody>
</table>
</div>
</div> <!-- /tab-content -->
</div> <!-- /container -->
<?php endif; ?>
<div class="footer">
<div class="container">
<p>
Displayed at <?= esc(date('H:i:sa')) ?> &mdash;
PHP: <?= esc(PHP_VERSION) ?> &mdash;
CodeIgniter: <?= esc(CodeIgniter::CI_VERSION) ?> --
Environment: <?= ENVIRONMENT ?>
</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= lang('Errors.whoops') ?></title>
<style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
</head>
<body>
<div class="container text-center">
<h1 class="headline"><?= lang('Errors.whoops') ?></h1>
<p class="lead"><?= lang('Errors.weHitASnag') ?></p>
</div>
</body>
</html>

View File

@ -0,0 +1,143 @@
<?php
echo "<div class='wrapper'>
<div class='header-logo'>";
$iden = $this->model_utama->view('identitas')->row_array();
$logo = $this->model_utama->view_ordering_limit('logo','id_logo','DESC',0,1);
foreach ($logo->result_array() as $row) {
echo "<a href='".base_url()."'><img style='height:40px' src='".base_url()."asset/logo/$row[gambar]'/></a>";
}
echo "
</div>
<div class='mainmenu hidden-xs'>
<ul class='mainnav'>
<li class='hassubs first'><a href='#'><span class='glyphicon glyphicon-th-list'></span>&nbsp; Kategori</a>
<ul class='dropdown-phpmu'>";
$kategori = $this->model_app->view('rb_kategori_produk');
foreach ($kategori->result_array() as $rows) {
$sub_kategori = $this->db->query("SELECT * FROM rb_kategori_produk_sub where id_kategori_produk='$rows[id_kategori_produk]'");
if ($sub_kategori->num_rows()>=1){
echo "<li class='subs hassubs'><a href='".base_url()."produk/kategori/$rows[kategori_seo]'> $rows[nama_kategori] <span class='caret caret-right'></span></a>
<ul class='dropdown-phpmu'>";
foreach ($sub_kategori->result_array() as $row) {
echo "<li class='subs'><a href='".base_url()."produk/subkategori/$row[kategori_seo_sub]'>$row[nama_kategori_sub]</a></li>";
}
echo "</ul></li>";
}else{
echo "<li class='subs'><a href='".base_url()."produk/kategori/$rows[kategori_seo]'> <a href='".base_url()."produk/kategori/$rows[kategori_seo]'> $rows[nama_kategori]</a></li>";
}
}
echo "</ul>";
echo "</li>
</ul>
</div>
<div class='header-menu'>
<div class='header-search'>
".form_open('produk/index')."
<input type='text' placeholder='Akun Mau Belanja..'' name='kata' class='search-input' required/>
<input type='submit' value='Search' name='cari' class='search-button'/>
</form>
</div>
</div>
<div class='header-addons'>
<span class='city'>
<b>Hari ini</b> : ".hari_ini(date('w')).", ".tgl_indo(date('Y-m-d')).", <span id='jam'></span></span><br>";
if ($this->session->id_konsumen != ''){
$ksm = $this->db->query("SELECT * FROM rb_konsumen where id_konsumen='".$this->session->id_konsumen."'")->row_array();
}
if ($this->session->id_konsumen != ''){
$isi_keranjang = $this->db->query("SELECT sum(jumlah) as jumlah FROM rb_penjualan_detail where id_penjualan='".$this->session->idp."'")->row_array();
echo "<a class='hidden-xs' href='".base_url()."members/orders_report'>Status Transaksi</a> &nbsp; &nbsp;
<a href='".base_url()."members/keranjang'><b>
<span class='glyphicon glyphicon glyphicon-shopping-cart' style='font-size:19px'></span></b>
<span class='badge badgee'>".rupiah($isi_keranjang['jumlah'])."</span></a> &nbsp;
<a class='btn btn-xs btn-success' style='padding:1px 12px' href='".base_url()."members/profile'>Account</a>
<a class='btn btn-xs btn-danger' style='padding:1px 12px' href='".base_url()."members/logout'>Logout</a><br>";
}else{
$isi_keranjang = $this->db->query("SELECT sum(jumlah) as jumlah FROM rb_penjualan_temp where session='".$this->session->idp."'")->row_array();
echo "<a class='hidden-xs' href='".base_url()."members/orders_report'>Status Transaksi</a> &nbsp;
<a href='".base_url()."produk/keranjang'>
<span class='glyphicon glyphicon glyphicon-shopping-cart' style='font-size:19px'></span></b>
<span class='badge badgee'>".rupiah($isi_keranjang['jumlah'])."</span></a> &nbsp; ";
echo "<a class='btn btn-xs btn-success' style='width:60px' href='".base_url()."auth/login'>Login</a>
<a class='btn btn-xs btn-default' style='width:60px; color:#000' href='".base_url()."auth/register'>Daftar</a>";
}
echo "</div>
</div>
<div class='main-menu sticky'>
<div class='wrapper'>";
function main_menu() {
$ci = & get_instance();
$query = $ci->db->query("SELECT id_menu, nama_menu, link, id_parent FROM menu where aktif='Ya' AND position='Bottom' order by urutan");
$menu = array('items' => array(),'parents' => array());
foreach ($query->result() as $menus) {
$menu['items'][$menus->id_menu] = $menus;
$menu['parents'][$menus->id_parent][] = $menus->id_menu;
}
if ($menu) {
$result = build_main_menu(0, $menu);
return $result;
}else{
return FALSE;
}
}
function build_main_menu($parent, $menu) {
$ci = & get_instance();
$html = "";
if (isset($menu['parents'][$parent])) {
if ($parent=='0'){
$html .= "<ul class='the-menu'>
<li><a href='".base_url()."' style='background: url(".base_url()."asset/images/home.png) no-repeat center; font-size:0; width:34px;'><br></a></li>";
}else{
$html .= "<ul>";
}
foreach ($menu['parents'][$parent] as $itemId) {
if (!isset($menu['parents'][$itemId])) {
if(preg_match("/^http/", $menu['items'][$itemId]->link)) {
$html .= "<li><a target='_BLANK' href='".$menu['items'][$itemId]->link."'>".$menu['items'][$itemId]->nama_menu."</a></li>";
}else{
$html .= "<li><a href='".base_url().''.$menu['items'][$itemId]->link."'>".$menu['items'][$itemId]->nama_menu."</a></li>";
}
}
if (isset($menu['parents'][$itemId])) {
if(preg_match("/^http/", $menu['items'][$itemId]->link)) {
$html .= "<li><a target='_BLANK' href='".$menu['items'][$itemId]->link."'><span>".$menu['items'][$itemId]->nama_menu."</span></a>";
}else{
$html .= "<li><a href='".base_url().''.$menu['items'][$itemId]->link."'><span>".$menu['items'][$itemId]->nama_menu."</span></a>";
}
$html .= build_main_menu($itemId, $menu);
$html .= "</li>";
}
}
if ($parent=='0'){
// Keranjang Bisa Disini...
}
$html .= "</ul>";
}
return $html;
}
echo main_menu();
echo "</div>
</div>";
echo "<div class='secondary-menu'>
<div class='wrapper'>
<ul>";
$tag = $this->model_utama->view_ordering_limit('tag','id_tag','RANDOM',0,14);
foreach ($tag->result_array() as $row) {
echo "<li><a href='".base_url()."tag/detail/$row[tag_seo]'>$row[nama_tag]</a></li>";
}
echo "</ul>
</div>
</div>";

View File

@ -0,0 +1,224 @@
<p class='sidebar-title text-danger produk-title'> Berikut Data Pesanan anda</p>
<div class='col-md-8'>
<?php
echo "<form action='" . base_url() . "members/selesai_belanja' method='POST'>";
echo $error_reseller;
if ($this->session->idp == '') {
echo "<center style='padding:10%'><i class='text-danger'>Maaf, Keranjang belanja anda saat ini masih kosong,...</i><br>
<a class='btn btn-warning btn-sm' href='" . base_url() . "members/reseller'>Klik Disini Untuk mulai Belanja!</a></center>";
} else {
?>
<?php
echo "<a class='btn btn-success btn-sm' href='" . base_url() . "members/produk_reseller/$rows[id_reseller]'>Lanjut Belanja</a>
<a class='btn btn-danger btn-sm' href='" . base_url() . "members/batalkan_transaksi' onclick=\"return confirm('Apa anda yakin untuk Batalkan Transaksi ini?')\">Batalkan Transaksi</a>";
?>
<div style="clear:both"><br></div>
<table class="table table-striped table-condensed">
<tbody>
<?php
$no = 1;
foreach ($record as $row) {
$ex = explode(';', $row['gambar']);
if (trim($ex[0]) == '') {
$foto_produk = 'no-image.png';
} else {
$foto_produk = $ex[0];
}
$sub_total = ($row['harga_jual'] * $row['jumlah']) - $row['diskon'];
echo "<tr><td>$no</td>
<td width='70px'><img style='border:1px solid #cecece; width:60px' src='" . base_url() . "asset/foto_produk/$foto_produk'></td>
<td><a style='color:#ab0534' href='" . base_url() . "produk/detail/$row[produk_seo]'><b>$row[nama_produk]</b></a>
<br>Qty. <b>$row[jumlah]</b>, Harga. Rp " . rupiah($row['harga_jual'] - $row['diskon']) . " / $row[satuan],
<br>Berat. <b>" . ($row['berat'] * $row['jumlah']) . " Gram</b></td>
<td>Rp " . rupiah($sub_total) . "</td>
<td width='30px'><a class='btn btn-danger btn-xs' title='Delete' href='" . base_url() . "members/keranjang_delete/$row[id_penjualan_detail]'><span class='glyphicon glyphicon-remove'></span></a></td>
</tr>";
$no++;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total, sum(b.berat*a.jumlah) as total_berat FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk where a.id_penjualan='" . $this->session->idp . "'")->row_array();
echo "<tr class='success'>
<td colspan='3'><b>Total Berat</b></td>
<td><b>$total[total_berat] Gram</b></td>
<td></td>
</tr>";
echo ($total['total_berat'] > 0 ? '' : '<tr class="danger"><td colspan="5"><i><b>PENTING</b> : Berat 0 Gram, maka akan terhitung minimal ongkir dari jasa Expedisi.</i></td></tr>');
echo "</tbody>
</table>
<p id='teksdiskon' class='btn btn-danger btn-flat btn-sm' style='display: none'>Diskon 10% pembelian diatas 500.000</p>
<div class='col-md-4 pull-right'>
<center>Total Bayar <br><h2 id='totalbayar'></h2>
<button type='submit' name='submit' id='oksimpan' class='btn btn-success btn-flat btn-sm' style='display: none'>Lakukan Pembayaran</button>
</center>
</div>";
$ket = $this->db->query("SELECT * FROM rb_keterangan where id_reseller='" . $rows['id_reseller'] . "'")->row_array();
$diskon_total = '0';
?>
<input type="hidden" name="total" id="total" value="<?php echo $total['total']; ?>" />
<input type="hidden" name="ongkir" id="ongkir" value="0" />
<input type="hidden" name="berat" value="<?php echo $total['total_berat']; ?>" />
<input type="hidden" name="diskonnilai" id="diskonnilai" value="<?php echo $diskon_total; ?>" />
<div class="form-group">
<label class="col-sm-2 control-label" for="">Pilih Kurir</label>
<div class="col-md-10">
<?php
$kurir = array('jne', 'pos', 'tiki');
foreach ($kurir as $rkurir) {
?>
<label class="radio-inline">
<input type="radio" name="kurir" class="kurir" value="<?php echo $rkurir; ?>" />
<?php echo strtoupper($rkurir); ?>
</label>
<?php
}
?>
<label class="radio-inline"><input type="radio" name="kurir" class="kurir"
value="kurir_toko" />Kurir Toko</label>
<label class="radio-inline"><input type="radio" name="kurir" class="kurir" value="cod" /> COD (Cash
on delivery)</label>
</div>
</div>
<div id="kuririnfo" style="display: none;">
<div class="form-group">
<div class="col-md-12">
<div class='alert alert-info' style='padding:5px; border-radius:0px; margin-bottom:0px'>Service
</div>
<p class="form-control-static" id="kurirserviceinfo"></p>
</div>
</div>
</div>
<?php
echo form_close();
?>
<script>
$(document).ready(function () {
$(".kurir").each(function (o_index, o_val) {
$(this).on("change", function () {
var did = $(this).val();
var berat = "<?php echo $total['total_berat']; ?>";
var kota = "<?php echo $rows['kota_id']; ?>";
if (did === 'kurir_toko') {
$("#kurirserviceinfo").html("");
$("#kuririnfo").hide();
} else {
$.ajax({
method: "get",
dataType: "html",
url: "<?php echo base_url(); ?>produk/kurirdata",
data: "kurir=" + did + "&berat=" + berat + "&kota=" + kota,
beforeSend: function () {
$("#oksimpan").hide();
}
})
.done(function (x) {
$("#kurirserviceinfo").html(x);
$("#kuririnfo").show();
})
.fail(function () {
$("#kurirserviceinfo").html("");
$("#kuririnfo").hide();
});
}
calculateOngkir(did, berat); // Call function to calculate COD charges
});
});
$("#diskon").html(toDuit(0));
hitung();
});
function calculateOngkir(kurir, berat) {
if (kurir === 'kurir_toko') {
var biaya_cod = 10000; // Set the cost per 1000 grams for COD
var total_ongkir = Math.ceil(berat / 1000) * biaya_cod;
$("#ongkir").val(total_ongkir);
} else {
$("#ongkir").val(0); // Reset if not COD
}
hitung();
}
function hitung() {
var diskon = $('#diskonnilai').val();
var total = $('#total').val();
var ongkir = $("#ongkir").val();
var bayar = (parseFloat(total) + parseFloat(ongkir));
var diskon2 = false;
// Check if the total payment is greater than or equal to 500,000
if (bayar >= 500000) {
bayar = bayar * 0.9;
diskon2 = true; // Apply a 10% discount
}
if (parseFloat(ongkir) > 0) {
$("#oksimpan").show();
} else {
$("#oksimpan").hide();
}
$("#totalbayar").html(toDuit(bayar));
if (diskon2) {
$("#teksdiskon").show();
} else {
$("#teksdiskon").hide();
}
}
</script>
<?php
echo "<div style='clear:both'></div><hr><br>$ket[keterangan]";
}
?>
</div>
<div class="col-sm-4 colom4">
<?php $res = $this->db->query("SELECT a.*, b.nama_kota, c.nama_provinsi FROM rb_reseller a JOIN rb_kota b ON a.kota_id=b.kota_id
JOIN rb_provinsi c ON b.provinsi_id=c.provinsi_id
where a.id_reseller='$rows[id_reseller]'")->row_array(); ?>
<table class='table table-condensed'>
<tbody>
<tr class='alert alert-info'>
<th scope='row' style='width:90px'>Pengirim</th>
<td><?php echo $res['nama_reseller'] ?></td>
</tr>
<tr class='alert alert-info'>
<th scope='row'>Alamat</th>
<td><?php echo $res['alamat_lengkap'] . ', ' . $res['nama_kota'] . ', ' . $res['nama_provinsi']; ?></td>
</tr>
</tbody>
</table>
<?php $usr = $this->db->query("SELECT a.*, b.nama_kota, c.nama_provinsi FROM rb_konsumen a JOIN rb_kota b ON a.kota_id=b.kota_id
JOIN rb_provinsi c ON b.provinsi_id=c.provinsi_id
where a.id_konsumen='" . $this->session->id_konsumen . "'")->row_array(); ?>
<table class='table table-condensed'>
<tbody>
<tr class='alert alert-danger'>
<th scope='row' style='width:90px'>Penerima</th>
<td><?php echo $usr['nama_lengkap'] ?></td>
</tr>
<tr>
<th scope='row'>Alamat</th>
<td><?php echo $usr['alamat_lengkap'] . ', ' . $usr['nama_kota'] . ', ' . $usr['nama_provinsi']; ?></td>
</tr>
</tbody>
</table>
<img style='width:100%' src='<?php echo base_url(); ?>asset/foto_pasangiklan/ekpedisi2.jpg'>
</div>

View File

@ -0,0 +1,127 @@
<p class='sidebar-title text-danger produk-title'> Detail Pesanan Anda</p>
<div class="col-sm-8">
<table class="table table-striped table-condensed">
<tbody>
<?php
$no = 1;
foreach ($record as $row) {
$ex = explode(';', $row['gambar']);
if (trim($ex[0]) == '') {
$foto_produk = 'no-image.png';
} else {
$foto_produk = $ex[0];
}
$sub_total = ($row['harga_jual'] * $row['jumlah']) - $row['diskon'];
echo "<tr><td>$no</td>
<td width='70px'><img style='border:1px solid #cecece; width:60px' src='" . base_url() . "asset/foto_produk/$foto_produk'></td>
<td><a style='color:#ab0534' href='" . base_url() . "produk/detail/$row[produk_seo]'><b>$row[nama_produk]</b></a>
<br>Qty. <b>$row[jumlah]</b>, Harga. Rp " . rupiah($row['harga_jual'] - $row['diskon']) . " / $row[satuan],
<br>Berat. <b>" . ($row['berat'] * $row['jumlah']) . " Gram</b></td>
<td>Rp " . rupiah($sub_total) . "</td>
</tr>";
$no++;
}
$detail = $this->db->query("SELECT * FROM rb_penjualan where id_penjualan='" . $this->uri->segment(3) . "'")->row_array();
$total = $this->db->query("SELECT sum((a.harga_jual * a.jumlah) - a.diskon) as total, sum(b.berat * a.jumlah) as total_berat FROM rb_penjualan_detail a JOIN rb_produk b ON a.id_produk = b.id_produk where a.id_penjualan='" . $this->uri->segment(3) . "'")->row_array();
// Apply 10% discount if total is greater than or equal to 500000
$discount = 0;
if ($total['total'] >= 500000) {
$discount = 0.1 * $total['total'];
}
$final_total = $total['total'] - $discount;
if ($rows['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
$status = 'Proses';
} elseif ($rows['proses'] == '1') {
$proses = '<i class="text-success">Proses</i>';
} elseif ($rows['proses'] == '2') {
$proses = '<i class="text-success">Konfirmasi</i>';
} elseif ($rows['proses'] == '3') {
$proses = '<i class="text-success">Diterima</i>';
}
echo "
<tr class='success'>
<td colspan='3'><b>Berat</b> <small><i class='pull-right'>(" . terbilang($total['total_berat']) . " Gram)</i></small></td>
<td><b>$total[total_berat] Gram</b></td>
</tr>
<tr>
<td colspan='3'><b><span style='text-transform:uppercase'>$detail[kurir]</span> - $detail[service]</b> <small><i class='pull-right'>(" . terbilang($detail['ongkir']) . ")</i></small></td>
<td><b>Rp " . rupiah($detail['ongkir']) . "</b></td>
</tr>
<tr>
<td colspan='3'><b>Total</b> <small><i class='pull-right'>(" . terbilang($total['total']) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($total['total']) . "</b></td>
</tr>
<tr>
<td colspan='3'><b>Discount</b> <small><i class='pull-right'>(" . terbilang($discount) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($discount) . "</b></td>
</tr>
<tr>
<td colspan='3'><b>Total after Discount</b> <small><i class='pull-right'>(" . terbilang($final_total) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($final_total) . "</b></td>
</tr>
<tr>
<td style='color:Red' colspan='3'><b>Subtotal</b> <small><i class='pull-right'>(" . terbilang($final_total + $detail['ongkir']) . " Rupiah)</i></small></td>
<td style='color:Red'><b>Rp " . rupiah($final_total + $detail['ongkir']) . "</b></td>
</tr>
<tr><td align=center colspan='4'><b>$proses</b></td></tr>
</tbody>
</table>";
?>
</div>
<div class="col-sm-4 colom44">
<?php $res = $this->db->query("SELECT a.*, b.nama_kota, c.nama_provinsi FROM rb_reseller a JOIN rb_kota b ON a.kota_id=b.kota_id
JOIN rb_provinsi c ON b.provinsi_id=c.provinsi_id
where a.id_reseller='$rows[id_reseller]'")->row_array(); ?>
<table class='table table-condensed'>
<tbody>
<tr class='alert alert-info'>
<th scope='row' style='width:90px'>Pengirim</th>
<td><?php echo $res['nama_reseller'] ?></td>
</tr>
<tr class='alert alert-info'>
<th scope='row'>No Telpon</th>
<td><?php echo $res['no_telpon']; ?></td>
</tr>
<tr class='alert alert-info'>
<th scope='row'>Alamat</th>
<td><?php echo $res['alamat_lengkap'] . ', ' . $res['nama_kota'] . ', ' . $res['nama_provinsi']; ?></td>
</tr>
</tbody>
</table>
<?php $usr = $this->db->query("SELECT a.*, b.nama_kota, c.nama_provinsi FROM rb_konsumen a JOIN rb_kota b ON a.kota_id=b.kota_id
JOIN rb_provinsi c ON b.provinsi_id=c.provinsi_id
where a.id_konsumen='" . $this->session->id_konsumen . "'")->row_array(); ?>
<table class='table table-condensed'>
<tbody>
<tr class='alert alert-danger'>
<th scope='row' style='width:90px'>Penerima</th>
<td><?php echo $usr['nama_lengkap'] ?></td>
</tr>
<tr\>
<th scope='row'>No Telpon</th>
<td><?php echo $usr['no_hp']; ?></td>
</tr>
<tr>
<th scope='row'>Alamat</th>
<td><?php echo $usr['alamat_lengkap'] . ', ' . $usr['nama_kota'] . ', ' . $usr['nama_provinsi']; ?></td>
</tr>
</tbody>
</table>
<hr>
</div>
<hr>

View File

@ -0,0 +1,131 @@
<p class='sidebar-title text-danger produk-title'> Laporan Data Pesanan Anda</p>
<?php
if ($this->uri->segment(3) == 'success') {
echo "<div class='alert alert-success'><b>SUCCESS</b> - Terima kasih telah Melakukan Konfirmasi Pembayaran!</div>";
} elseif ($this->uri->segment(3) == 'orders') {
echo "<div class='alert alert-success'><b>SUCCESS</b> - Orderan anda sukses terkirim, silahkan melakukan pembayaran ke rekening reseller pesanan anda dan selanjutnya lakukan konfirmasi pembayaran!</div>";
}
?>
<table id='example2' style='overflow-x:scroll; width:96%' class="table table-striped table-condensed">
<thead>
<tr>
<th width="20px">No</th>
<th>Kode Transaksi</th>
<th>Nama Lapak</th>
<th>Subtotal</th>
<th>Ongkir</th>
<th>Status</th>
<th>Total + Ongkir</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record->result_array() as $row) {
if ($row['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Proses</i>';
} elseif ($row['proses'] == '2') {
$proses = '<i class="text-info">Konfirmasi</i>';
} elseif ($row['proses'] == '3') {
$proses = '<i class="text-info">Diterima</i>';
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM rb_penjualan_detail a where a.id_penjualan='$row[id_penjualan]'")->row_array();
// Apply 10% discount if total is greater than or equal to 500000
$discount = 0;
if ($total['total'] >= 500000) {
$discount = 0.1 * $total['total'];
}
$final_total = $total['total'] - $discount;
echo "<tr><td>$no</td>
<td><span class='text-success'>$row[kode_transaksi]</span></td>
<td><a href='" . base_url() . "members/detail_reseller/$row[id_reseller]'>$row[nama_reseller]</a></td>
<td><span style='color:blue;'>Rp " . rupiah($final_total) . "</span></td>
<td><i style='color:green;'><b style='text-transform:uppercase'>$row[kurir]</b> - Rp " . rupiah($row['ongkir']) . "</i></td>
<td>$proses</td>
<td style='color:red;'>Rp " . rupiah($final_total + $row['ongkir']) . "</td>
<td width='130px'>";
if ($row['proses'] == '0') {
echo "<a style='margin-right:3px' class='btn btn-success btn-xs' title='Konfirmasi Pembayaran' href='" . base_url() . "konfirmasi?kode=$row[kode_transaksi]'>Konfirmasi</a>";
} else {
echo "<a style='margin-right:3px' class='btn btn-default btn-xs' href='" . base_url() . "konfirmasi?kode=$row[kode_transaksi]' onclick=\"return confirm('Maaf, Pembayaran ini sudah dikonfirmasi, ingin konfirmasi ulang? ')\">Konfirmasi</a>";
}
echo "<a class='btn btn-info btn-xs' title='Detail data pesanan' href='" . base_url() . "members/keranjang_detail/$row[id_penjualan]'><span class='glyphicon glyphicon-search'></span></a></td>
<td>";
if ($row['proses'] == '2') {
echo "<button type='button' class='btn btn-primary' onclick='updateDatabase(\"$row[kode_transaksi]\")'>Selesaikan Pesanan</button>";
} elseif ($row['proses'] == '3') {
echo "<button type='button' class='btn btn-warning')'>Pesanan diterima</button>";
}
echo "
</td>
</tr>";
$no++;
}
?>
</tbody>
</table>
<script>
function updateDatabase(kode_transaksi) {
var xhr = new XMLHttpRequest();
xhr.open('POST', '', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
alert('Pesanan Selesai Untuk kode transaksi: ' + kode_transaksi);
location.reload(); // Reload the page to see the changes
}
};
xhr.send('action=update&kode_transaksi=' + kode_transaksi);
}
</script>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']) && $_POST['action'] == 'update') {
$kode_transaksi = $_POST['kode_transaksi'];
// Koneksi ke database (ganti dengan informasi koneksi Anda)
$servername = "localhost";
$username = "dbditsco_bersyukur";
$password = "Bersyukur_123_123_";
$dbname = "dbditsco_marketpong21";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Kueri update ke database
$result = $conn->query("SELECT proses FROM rb_penjualan WHERE kode_transaksi = '$kode_transaksi'");
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
if ($row['proses'] == '3') {
echo 'already_updated';
} else {
// Kueri update ke database
$sql = "UPDATE rb_penjualan SET proses = '3' WHERE kode_transaksi = '$kode_transaksi'";
if ($conn->query($sql) === TRUE) {
echo 'update_successful';
} else {
echo "Error updating record: " . $conn->error;
}
}
}
$conn->close();
}
?>

View File

@ -0,0 +1,52 @@
<p class='sidebar-title block-title'> Konfirmasi Pembayaran Pesanan Anda</p>
<?php
if ($this->uri->segment(3) == 'success') {
echo "<div class='alert alert-success' style='margin:10% 0px'><center>Success Melakukan Konfirmasi pembayaran... <br>
akan segera kami cek dan proses!</center></div>";
} else {
$attributes = array('class' => 'form-horizontal', 'role' => 'form');
$ongk = $this->db->query("SELECT * FROM rb_penjualan where id_penjualan='$rows[id_penjualan]'")->row_array();
echo form_open_multipart('konfirmasi/index', $attributes);
echo "<div class='alert alert-danger'>Masukkan No Invoice atau No Transaksi Terlebih dahulu!</div>
<table class='table table-condensed'>
<tbody>
<input type='hidden' name='id' value='$rows[id_penjualan]'>
<tr><th scope='row' width='120px'>No Invoice</th> <td><input type='text' name='a' class='form-control' style='width:100%' value='$rows[kode_transaksi]' placeholder='TRX-0000000000' required>";
if ($rows['kode_transaksi'] != '') {
$total_amount = $total['total'] + $ongk['ongkir'];
$discount = 0;
if ($total['total'] >= 500000) {
$discount = 0.1 * $total['total'];
}
$final_total = $total_amount - $discount;
echo "<tr><th scope='row'>Total</th> <td><input type='text' name='b' class='form-control' style='width:50%' value='Rp " . rupiah($final_total) . "' required>
<tr><th scope='row'>Transfer Ke</th> <td><select name='c' class='form-control'>";
foreach ($record->result_array() as $row) {
echo "<option value='$row[id_rekening]'>$row[nama_bank] - $row[no_rekening], A/N : $row[pemilik_rekening]</option>";
}
echo "</td></tr>
<tr><th width='130px' scope='row'>Nama Pengirim</th> <td><input type='text' class='form-control' style='width:70%' name='d'></td></tr>
<tr><th scope='row'>Tanggal Transfer</th> <td><input type='text' class='datepicker form-control' style='width:40%' name='e' data-date-format='yyyy-mm-dd' value='" . date('Y-m-d') . "'></td></tr>
<tr><th scope='row'>Bukti Transfer</th> <td><input type='file' name='f'></td></tr>";
}
echo "</tbody>
</table>
<div class='box-footer'>";
if ($rows['kode_transaksi'] != '') {
echo "<button type='submit' name='submit' class='btn btn-info'>Kirimkan</button>";
} else {
echo "<button type='submit' name='submit1' class='btn btn-info'>Cek Invoice</button>";
}
echo "</div>";
echo form_close();
}
?>

View File

@ -0,0 +1,179 @@
<style>
.teks {
font-style: italic;
font-size: 30px;
color: black;
font-weight: bold;
}
.teks.visible {
opacity: 1;
}
.overlay {
position: absolute;
justify-content: center;
align-items: center;
background-color: white;
justify-items: center;
z-index: 3;
color: transparent;
height: 100%;
width: 100%;
opacity: 20%;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(40px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeOut {
from {
opacity: 1;
transform: translateY(0);
}
to {
opacity: 0;
transform: translateY(40px);
}
}
.fadeIn {
animation: fadeIn 3s forwards;
}
.fadeOut {
animation: fadeOut 1s forwards;
}
</style>
</head>
<body>
<center>
<div class="overlay" id="overlay">
<img class="gambar" id="gambar"
src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExbzNudXk2Z2s4eW51MTRrdmhvdHp6YWZhMDdoYXlmb2g0ZHJ5cDcyMSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/Lew6ElbGiIVuIaiwNa/giphy.webp"
alt="">
<p class="teks" id="teks">Bayar Gaji Pegawai Lebih Mudah Menggunakan Aplikasi Dana</p>
</div>
</center>
<script>
document.addEventListener('DOMContentLoaded', () => {
const overlayElement = document.getElementById('overlay');
overlayElement.classList.add('fadeIn');
setTimeout(() => {
overlayElement.classList.remove('fadeIn');
overlayElement.classList.add('fadeOut');
}, 6000);
overlayElement.addEventListener('animationend', () => {
if (overlayElement.classList.contains('fadeOut')) {
overlayElement.style.display = 'none';
}
});
});
</script>
</body>
<p class='sidebar-title text-danger produk-title'> Login Users</p>
<div class='alert alert-info'>Masukkan username dan password pada form berikut untuk login,...</div>
<br>
<?php
echo $this->session->flashdata('message');
$this->session->unset_userdata('message');
?>
<?php if ($this->session->flashdata('error21')): ?>
<center>
<div class="alert alert-danger">
<?php echo $this->session->flashdata('error21'); ?>
</div>
</center>
<?php endif; ?>
<div class="logincontainer">
<form method="post" action="<?php echo base_url(); ?>auth/login" role="form" id='formku'>
<div class="form-group">
<label for="inputEmail">Username</label>
<input type="text" name="a" class="required form-control" placeholder="Masukkan Username" autofocus=""
minlength='5' onkeyup="nospaces(this)" required>
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" name="b" class="form-control required" placeholder="Masukkan Password"
autocomplete="off" required>
</div>
<div align="center">
<input name='login' type="submit" class="btn btn-primary" value="Login"> <a href="#" class="btn btn-default"
data-toggle='modal' data-target='#lupass'>Lupa Password?</a> <br><br> Anda Belum Punya akun? <a
href="<?php echo base_url(); ?>auth/register" title="Mari gabung bersama Kami" class="link">Daftar
Disini.</a>
</div>
<!--<center><a href='<?php echo base_url(); ?>reseller'>Login Reseller</a><center>-->
</form>
</div>
<div class="modal fade" id="lupass" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h5 class="modal-title" id="myModalLabel">Lupa Password Login?</h5>
</div>
<center>
<div class="modal-body">
<?php
$attributes = array('class' => 'form-horizontal');
// echo form_open('auth/lupass',$attributes);
?>
<form method="post" action="<?php echo base_url(); ?>auth/login21">
<div class="form-group">
<center style='color:red'>Masukkan Email yang terkait dengan akun!</center><br>
<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
<div style='background:#fff;' class="input-group col-sm-8">
<span class="input-group-addon"><i class='fa fa-envelope fa-fw'></i></span>
<input style='text-transform:lowercase;' type="email" class="required form-control"
name="n">
</div>
<label for="inputEmail3" class="col-sm-2 control-label">No.Telp</label>
<div style='background:#fff;' class="input-group col-sm-8">
<span class="input-group-addon"><i class='fa fa-envelope fa-fw'></i></span>
<input style='text-transform:lowercase;' type="number" class="required form-control"
name="m" min=0>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3">
<button type="submit" name='login21' class="btn btn-primary btn-sm"
value="Login21">Cek</button>
&nbsp; &nbsp; &nbsp;<a data-dismiss="modal" aria-hidden="true" data-toggle='modal'
href='#login' data-target='#login' title="Lupa Password Members">Kembali Login?</a>
</div>
</div>
</form>
</form>
<div style='clear:both'></div>
</div>
</center>
</div>
</div>
</div>

View File

@ -0,0 +1,96 @@
<p class='sidebar-title block-title'><?php echo $title; ?></p>
<?php
if ($total['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
} elseif ($total['proses'] == '1') {
$proses = '<i class="text-warning">Proses</i>';
} elseif ($total['proses'] == '2') {
$proses = '<i class="text-info">Konfirmasi</i>';
} elseif ($total['proses'] == '3') {
$proses = '<i class="text-info">Diterima</i>';
}
echo "<div class='col-md-8' style='padding:0px'>
<dl class='dl-horizontal'>
<dt>Nama</dt> <dd>$rows[nama_lengkap]</dd>
<dt>No Telpon/Hp</dt> <dd>$rows[no_hp]</dd>
<dt>Email</dt> <dd>$rows[email]</dd>
<dt>Kota</dt> <dd>$rows[nama_kota]</dd>
<dt>Alamat Lengkap</dt> <dd>$rows[alamat_lengkap]</dd>
</dl>
</div>
<div class='col-md-4' style='padding:0px'>
<center>
Total Tagihan
<h4 style='margin:0px;'>Rp " . rupiah($total['total'] + $total['ongkir']) . "<br> <br>
<span style='text-transform:uppercase'>$total[kurir]</span> ($total[service])
</h4>
Status : <i>$proses</i>
</center>
</div>
<table class='table table-striped table-condensed'>
<thead>
<tr bgcolor='#e3e3e3'>
<th width='47%'>Nama Produk</th>
<th>Harga</th>
<th>Qty</th>
<th>Berat</th>
<th>Total</th>
</tr>
</thead>
<tbody>";
$no = 1;
foreach ($record->result_array() as $row) {
$sub_total = (($row['harga_jual'] - $row['diskon']) * $row['jumlah']);
echo "<tr>
<td class='valign'><a href='" . base_url() . "produk/detail/$row[produk_seo]'>$row[nama_produk]</a></td>
<td class='valign'>" . rupiah($row['harga_jual'] - $row['diskon']) . "</td>
<td class='valign'>$row[jumlah]</td>
<td class='valign'>" . ($row['berat'] * $row['jumlah']) . " Gram</td>
<td class='valign'>Rp " . rupiah($sub_total) . "</td>
</tr>";
$no++;
}
// Calculate discount if total is greater than or equal to Rp 500,000
$discount = 0;
if ($total['total'] >= 500000) {
$discount = 0.1 * $total['total'];
}
$final_total = $total['total'] - $discount;
echo "<tr class='success'>
<td colspan='4'><b>Berat</b> <small><i class='pull-right'>(" . terbilang($total['total_berat']) . " Gram)</i></small></td>
<td><b>$total[total_berat] Gram</b></td>
</tr>
<tr class='success'>
<td colspan='4'><b>Ongkos Kirim</b> <small><i class='pull-right'>(" . terbilang($total['ongkir']) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($total['ongkir']) . "</b></td>
</tr>
<tr class='success'>
<td colspan='4'><b>Total</b> <small><i class='pull-right'>(" . terbilang($total['total']) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($total['total']) . "</b></td>
</tr>
<tr class='success'>
<td colspan='4'><b>Discount</b> <small><i class='pull-right'>(" . terbilang($discount) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($discount) . "</b></td>
</tr>
<tr class='success'>
<td colspan='4'><b>Total after Discount</b> <small><i class='pull-right'>(" . terbilang($final_total) . " Rupiah)</i></small></td>
<td><b>Rp " . rupiah($final_total) . "</b></td>
</tr>
<tr class='danger'>
<td style='color:Red' colspan='4'><b>Subtotal</b> <small><i class='pull-right'>(" . terbilang($final_total + $total['ongkir']) . " Rupiah)</i></small></td>
<td style='color:Red'><b>Rp " . rupiah($final_total + $total['ongkir']) . "</b></td>
</tr>
</tbody>
</table><br>";
?>

View File

@ -0,0 +1,143 @@
<section class="sidebar">
<!-- Sidebar user panel -->
<?php
$log = $this->model_app->edit('rb_reseller', array('id_reseller' => $this->session->id_reseller))->row_array();
if ($log['foto'] == '') {
$foto = 'blank.png';
} else {
$foto = $log['foto'];
}
echo "<div class='user-panel'>
<div class='pull-left image'>
<img src='" . base_url() . "asset/foto_user/$foto' class='img-circle' alt='User Image'>
</div>
<div class='pull-left info'>
<p>$log[nama_reseller]</p>
<a href=''><i class='fa fa-circle text-success'></i> Online</a>
</div>
</div>";
?>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header" style='text-transform:uppercase; border-bottom:2px solid #00c0ef'>MENU PELAPAK</li>
<li><a href="<?php echo base_url() . $this->uri->segment(1); ?>/home"><i class="fa fa-dashboard"></i>
<span>Dashboard</span></a></li>
<li class="treeview">
<a href="#"><i class="fa fa-th-large"></i> <span>Referensi</span> <i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/rekening'><i class='fa fa-circle-o'></i> No Rekening Anda</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/keterangan'><i class='fa fa-circle-o'></i> Info/Keterangan</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/produk'><i class='fa fa-circle-o'></i> Data Produk Anda</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/alamat_cod'><i class='fa fa-circle-o'></i> Alamat COD</a></li>";
?>
</ul>
</li>
<li class="treeview">
<a href="#"><i class="fa fa-shopping-cart"></i> <span>Transaksi</span> <i
class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/pembelian'><i class='fa fa-circle-o'></i> Pembelian Ke Pusat</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/penjualan'><i class='fa fa-circle-o'></i> Penjualan ke Konsumen</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/pembayaran_konsumen'><i class='fa fa-circle-o'></i> Pembayaran Konsumen</a></li>";
?>
</ul>
</li>
<!-- <li class="treeview">
<a href="#"><i class="fa fa-shopping-cart"></i> <span>Toko / Reseller</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<li class="treeview">
<a href="#"><i class="fa fa-circle-o"></i> Master <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
<ul class="treeview-menu">
<?php {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/produk'><i class='fa fa-circle-o'></i> Data Produk</a></li>";
}
?>
</ul>
</li>
<li class="treeview">
<a href="#"><i class="fa fa-circle-o"></i> Transaksi <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
<ul class="treeview-menu">
<?php
$cek = $this->model_app->umenu_akses("pembelian", $this->session->id_session);
if ($cek == 1 or $this->session->level == 'admin') {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/pembelian'><i class='fa fa-circle-o'></i> Pembelian ke Supplier</a></li>";
}
$cek = $this->model_app->umenu_akses("penjualan", $this->session->id_session);
if ($cek == 1 or $this->session->level == 'admin') {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/penjualan'><i class='fa fa-circle-o'></i> Penjualan ke Reseller</a></li>";
}
$cek = $this->model_app->umenu_akses("pembayaran_reseller", $this->session->id_session);
if ($cek == 1 or $this->session->level == 'admin') {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/pembayaran_reseller'><i class='fa fa-circle-o'></i> Pembayaran Reseller</a></li>";
}
?>
</ul>
</li>
<li class="treeview">
<a href="#"><i class="fa fa-circle-o"></i> Report <span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>
<ul class="treeview-menu">
<?php
$cek = $this->model_app->umenu_akses("keuangan", $this->session->id_session);
if ($cek == 1 or $this->session->level == 'admin') {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/keuangan'><i class='fa fa-circle-o'></i> Keuangan Reseller</a></li>";
}
$cek = $this->model_app->umenu_akses("history_referral", $this->session->id_session);
if ($cek == 1 or $this->session->level == 'admin') {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/history_referral'><i class='fa fa-circle-o'></i> Pembayaran Referral</a></li>";
}
$cek = $this->model_app->umenu_akses("history_reward", $this->session->id_session);
if ($cek == 1 or $this->session->level == 'admin') {
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/history_reward'><i class='fa fa-circle-o'></i> Pembayaran Reward</a></li>";
}
?>
</ul>
</li>
</ul>
</li> -->
<!-- sampek sini -->
<li class="treeview">
<a href="#"><i class="glyphicon glyphicon-object-align-left"></i> <span>Modul Web</span><i
class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/logowebsite'><i class='fa fa-circle-o'></i> Logo Website</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/templatewebsite'><i class='fa fa-circle-o'></i> Template Website</a></li>";
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/background'><i class='fa fa-circle-o'></i> Background Website</a></li>";
?>
</ul>
</li>
<!-- <li class="treeview">
<a href="#"><i class="fa fa-users"></i> <span>Modul Users</span><i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/manajemenuser'><i class='fa fa-circle-o'></i> Manajemen User</a></li>";
?>
</ul>
</li> -->
<!-- <li class="treeview">
<a href="#"><i class="fa fa-book"></i> <span>Laporan</span> <i class="fa fa-angle-left pull-right"></i></a>
<ul class="treeview-menu">
<?php
echo "<li><a href='" . base_url() . $this->uri->segment(1) . "/keuangan'><i class='fa fa-circle-o'></i> Data Keuangan</a></li>";
?>
</ul>
</li> -->
<li><a href="<?php echo base_url(); ?>reseller/edit_reseller/<?php echo $this->session->id_reseller; ?>"><i
class="fa fa-user"></i> <span>Edit Profile</span></a></li>
<li><a href="<?php echo base_url(); ?>reseller/logout"><i class="fa fa-power-off"></i> <span>Logout</span></a></li>
</ul>
</section>

View File

@ -0,0 +1,53 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Data Konfirmasi Pembayaran Konsumen</h3>
</div><!-- /.box-header -->
<div class="box-body">
<div class='table-responsive'>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th style='width:30px'>No</th>
<th>Kode Transaksi</th>
<th>Total Tagihan</th>
<th>Total Transfer</th>
<th>Ke Rekening</th>
<th>Nama Pengirim</th>
<th>Tanggal Transfer</th>
<th>Bukti Transfer</th>
<th>Status Transaksi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record->result_array() as $row) {
if ($row['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Selesai</i>';
} else {
$proses = '<i class="text-info">Konfirmasi</i>';
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='$row[id_penjualan]'")->row_array();
echo "<tr>
<td>$no</td>
<td><a href='" . base_url() . $this->uri->segment(1) . "/detail_penjualan/$row[id_penjualan]'>$row[kode_transaksi]</a></td>
<td>$row[total_transfer]</td>
<td>Rp " . rupiah($total['total'] + $row['ongkir']) . "</td>
<td>$row[nama_bank]</td>
<td>$row[nama_pengirim]</td>
<td>" . tgl_indo($row['tanggal_transfer']) . "</td>
<td><a href='" . base_url() . "reseller/download/$row[bukti_transfer]'>Download File</a></td>
<td>$proses</td>
</tr>";
$no++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,68 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Data Pembelian Ke Pusat + History Stok Produk anda</h3>
<a class='pull-right btn btn-info btn-sm' style='margin-left:5px' data-toggle='modal'
data-target='#rekening'>Rekening Pembayaran</a>
<a class='pull-right btn btn-primary btn-sm'
href='<?php echo base_url() . $this->uri->segment(1); ?>/tambah_pembelian'>Tambah Pembelian</a>
</div><!-- /.box-header -->
<div class="box-body">
<div class='table-responsive'>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Kode Transaksi</th>
<th>Waktu Transaksi</th>
<th>Status</th>
<th>Total Tagihan</th>
<th>Proses</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record->result_array() as $row) {
if ($row['proses'] == '0') {
$proses = '<i class="text-danger">Menunggu Konfirmasi</i>';
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Selesai</i>';
} else {
$proses = '<i class="text-info">Selesai</i>';
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='$row[id_penjualan]'")->row_array();
if ($row['service'] == '') {
$service = "<i style='color:green'>Pembelian ke Pusat</i>";
} else {
$service = "<i style='color:blue'>$row[service]</i>";
}
echo "<tr><td>$no</td>
<td>$row[kode_transaksi]</td>
<td>$row[waktu_transaksi]</td>
<td>$proses</td>
<td style='color:red;'>Rp " . rupiah($total['total']) . "</td>
<td>$service</td>
<td><center>
<a style='margin-right:3px' class='btn btn-info btn-xs' title='Detail Data' href='" . base_url() . $this->uri->segment(1) . "/detail_pembelian/$row[id_penjualan]'><span class='glyphicon glyphicon-search'></span> Detail</a>";
if ($row['proses'] == '0') {
echo "<a class='btn btn-success btn-xs' title='Konfirmasi Pemabayaran' href='" . base_url() . $this->uri->segment(1) . "/konfirmasi_pembayaran/$row[id_penjualan]'> Konfirmasi Pembayaran</a>
<a class='btn btn-warning btn-xs' title='Edit Data' href='" . base_url() . $this->uri->segment(1) . "/edit_pembelian/$row[id_penjualan]'><span class='glyphicon glyphicon-edit'></span></a>
<a class='btn btn-danger btn-xs' title='Delete Data' href='" . base_url() . $this->uri->segment(1) . "/delete_pembelian/$row[id_penjualan]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>";
} else {
echo "<a class='btn btn-default btn-xs' title='Konfirmasi Pemabayaran' href='#' onclick=\"return alert('Maaf, Transaksi ini sudah di konfirmasi untuk pembayarannya!')\"> Konfirmasi Pembayaran</a>
<a class='btn btn-default btn-xs' title='Edit Data' href='#' onclick=\"return alert('Maaf, Transaksi ini sudah di proses dan tidak bisa di-edit!')\"><span class='glyphicon glyphicon-edit'></span></a>
<a class='btn btn-default btn-xs' title='Delete Data' href='#' onclick=\"return alert('Maaf, Transaksi ini sudah di proses dan tidak bisa di-hapus!')\"><span class='glyphicon glyphicon-remove'></span></a>";
}
echo "</center></td>
</tr>";
$no++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,72 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Data Detail Transaksi Penjualan</h3>
<a class='pull-right btn btn-default btn-sm'
href='<?php echo base_url() . $this->uri->segment(1); ?>/pembelian'>Kembali</a>
</div><!-- /.box-header -->
<div class="box-body">
<table class='table table-condensed table-bordered'>
<tbody>
<?php if ($rows['proses'] == '0') {
$proses = '<i class="text-danger">Menunggu Konfirmasi</i>';
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Selesai</i>';
} else {
$proses = '<i class="text-info">Selesai</i>';
} ?>
<tr>
<th width='140px' scope='row'>Kode Pembelian</th>
<td><?php echo "$rows[kode_transaksi]"; ?></td>
</tr>
<tr>
<th scope='row'>Nama Reseller</th>
<td><?php echo "$rows[nama_reseller]"; ?></td>
</tr>
<tr>
<th scope='row'>Waktu Transaksi</th>
<td><?php echo "$rows[waktu_transaksi]"; ?></td>
</tr>
<tr>
<th scope='row'>Proses</th>
<td><?php echo "$proses"; ?></td>
</tr>
</tbody>
</table>
<hr>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Nama Produk</th>
<th>Harga Jual</th>
<th>Jumlah Jual</th>
<th>Diskon</th>
<th>Satuan</th>
<th>Sub Total</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record as $row) {
$sub_total = ($row['harga_jual'] * $row['jumlah']) - $row['diskon'];
echo "<tr><td>$no</td>
<td>$row[nama_produk]</td>
<td>Rp " . rupiah($row['harga_jual']) . "</td>
<td>$row[jumlah]</td>
<td>Rp " . rupiah($row['diskon']) . "</td>
<td>$row[satuan]</td>
<td>Rp " . rupiah($sub_total) . "</td>
</tr>";
$no++;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='" . $this->uri->segment(3) . "'")->row_array();
echo "<tr class='success'>
<td colspan='6'><b>Total</b></td>
<td><b>Rp " . rupiah($total['total']) . "</b></td>
</tr>";
?>
</tbody>
</table>
</div>

View File

@ -0,0 +1,89 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Tambah Transaksi Pembelian</h3>
</div><!-- /.box-header -->
<div class="box-body">
<?php
$attributes = array('class'=>'form-horizontal','role'=>'form');
echo form_open_multipart('reseller/tambah_pembelian',$attributes);
?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Nama Produk</th>
<th width='120px'>Harga</th>
<th width='80px'>Jumlah</th>
<th width='80px'>Satuan</th>
<th>Sub Total</th>
<th width='80px'>Action</th>
</tr>
</thead>
<?php
echo "<tr>
<td></td>
<input type='hidden' value='".$this->uri->segment(3)."' name='idpd'>
<td><select name='aa' class='combobox form-control' onchange=\"changeValue(this.value)\" autofocus>
<option value='' selected> Cari Barang </option>";
$jsArray = "var prdName = new Array();\n";
foreach ($barang as $r){
if ($r['id_produk']==$row['id_produk']){
echo "<option value='$r[id_produk]' selected>$r[nama_produk]</option>";
$jsArray .= "prdName['" . $r['id_produk'] . "'] = {name:'" . addslashes($r['harga_reseller']) . "',desc:'".addslashes($r['satuan'])."'};\n";
}else{
echo "<option value='$r[id_produk]'>$r[nama_produk]</option>";
$jsArray .= "prdName['" . $r['id_produk'] . "'] = {name:'" . addslashes($r['harga_reseller']) . "',desc:'".addslashes($r['satuan'])."'};\n";
}
}
echo "</select></td>
<td><input class='form-control' type='number' name='bb' value='$row[harga_jual]' id='harga' readonly='on'> </td>
<td><input class='form-control' type='number' name='dd' value='$row[jumlah]'></td>
<td><input class='form-control' type='text' name='ee' id='satuan' value='$row[satuan]' readonly='on'> </td>
<td></td>
<td><button type='submit' name='submit' class='btn btn-success btn-xs'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span></button>
</td>
</tr>";
?>
<tbody>
<?php
$no = 1;
foreach ($record as $row){
$sub_total = ($row['harga_jual']*$row['jumlah'])-$row['diskon'];
echo "<tr><td>$no</td>
<td>$row[nama_produk]</td>
<td>Rp ".rupiah($row['harga_jual'])."</td>
<td>$row[jumlah]</td>
<td>$row[satuan]</td>
<td>Rp ".rupiah($sub_total)."</td>
<td>
<a class='btn btn-danger btn-xs' title='Delete Data' href='".base_url().$this->uri->segment(1)."/delete_pembelian_tambah_detail/$row[id_penjualan_detail]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>
</td>
</tr>";
$no++;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='".$this->session->idp."'")->row_array();
echo "<tr class='success'>
<td colspan='5'><b>Total</b></td>
<td><b>Rp ".rupiah($total['total'])."</b></td>
</tr>";
?>
</tbody>
</table>
<a class='btn btn-primary btn-sm' href='<?php echo base_url(); ?>reseller/pembelian'>Selesai / Kembali</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('harga').value = prdName[id].name;
document.getElementById('satuan').value = prdName[id].desc;
};
</script>

View File

@ -0,0 +1,139 @@
<?php
$penjualan = $this->model_reseller->penjualan($this->session->id_reseller)->row_array();
$penjualan_1 = $this->model_reseller->penjualan_1()->row_array();
$penjualan_7 = $this->model_reseller->penjualan_7()->row_array();
$penjualan_30 = $this->model_reseller->penjualan_30()->row_array();
$penjualan_365 = $this->model_reseller->penjualan_365()->row_array();
?>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="glyphicon glyphicon-sound-5-1"></i></span>
<div class="info-box-content">
<span class="info-box-text">Pendapatan Hari Ini</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($penjualan_1['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="glyphicon glyphicon-sound-6-1"></i></span>
<div class="info-box-content">
<span class="info-box-text">Pendapatan Minggu Ini</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($penjualan_7['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="glyphicon glyphicon-sound-7-1"></i></span>
<div class="info-box-content">
<span class="info-box-text">Pendapatan bulan Ini</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($penjualan_30['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="glyphicon glyphicon-copyright-mark"></i></span>
<div class="info-box-content">
<span class="info-box-text">Pendapatan tahun Ini</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($penjualan_365['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Data Transaksi Penjualan / Orderan Konsumen</h3>
<a class='pull-right btn btn-primary btn-sm' href='<?php echo base_url(); ?>reseller/tambah_penjualan'>Tambah
Penjualan</a>
</div><!-- /.box-header -->
<div class="box-body">
<div class='table-responsive'>
<table id="example1" class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Kode Transaksi</th>
<th>Nama Konsumen</th>
<th>Kurir</th>
<th>Status</th>
<th>Total + Ongkir</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record->result_array() as $row) {
if ($row['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
$status = 'Proses';
$icon = 'star-empty';
$ubah = 1;
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Proses</i>';
$status = 'Pending';
$icon = 'star text-yellow';
$ubah = 0;
} elseif ($row['proses'] == '2') {
$proses = '<i class="text-info">Konfirmasi</i>';
$status = 'Proses';
$icon = 'star';
$ubah = 1;
} elseif ($row['proses'] == '3') {
$proses = '<i class="text-info">Selesai</i>';
$status = 'Selesai';
$icon = 'ok';
$ubah = 1;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='$row[id_penjualan]'")->row_array();
echo "<tr><td>$no</td>
<td>$row[kode_transaksi]</td>
<td><a href='" . base_url() . "reseller/detail_konsumen/$row[id_konsumen]'>$row[nama_lengkap]</a></td>
<td><span style='text-transform:uppercase'>$row[kurir]</span> - $row[service]</td>
<td>$proses</td>
<td style='color:red;'>Rp " . rupiah($total['total'] + $row['ongkir']) . "</td>
<td><center>
<a class='btn btn-success btn-xs' title='Detail Data' href='" . base_url() . "reseller/detail_penjualan/$row[id_penjualan]'><span class='glyphicon glyphicon-search'></span> Detail</a>";
if ($row['proses'] == '2' || $row['proses'] == '1' || $row['proses'] == '0') {
echo " <a class='btn btn-primary btn-xs' title='$status Data' href='" . base_url() . "reseller/proses_penjualan/$row[id_penjualan]/$ubah' onclick=\"return confirm('Apa anda yakin untuk ubah status jadi $status?')\"><span class='glyphicon glyphicon-$icon'></span></a>";
} elseif ($row['proses'] == '3') {
echo " <a class='btn btn-primary btn-xs' title='$status Data'><span class='glyphicon glyphicon-$icon'></span></a>";
}
echo "
<a class='btn btn-warning btn-xs' title='Edit Data' href='" . base_url() . "reseller/edit_penjualan/$row[id_penjualan]'><span class='glyphicon glyphicon-edit'></span></a>
<a class='btn btn-danger btn-xs' title='Delete Data' href='" . base_url() . "reseller/delete_penjualan/$row[id_penjualan]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>
</center></td>
</tr>";
$no++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,108 @@
<?php $detail = $this->db->query("SELECT * FROM rb_penjualan where id_penjualan='" . $this->uri->segment(3) . "'")->row_array(); ?>
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Data Detail Transaksi Penjualan</h3>
<a class='pull-right btn btn-default btn-sm'
href='<?php echo base_url() . $this->uri->segment(1); ?>/penjualan'>Kembali</a>
</div><!-- /.box-header -->
<div class="box-body">
<table class='table table-condensed table-bordered'>
<tbody>
<tr>
<th width='140px' scope='row'>Kode Pembelian</th>
<td><?php echo "$rows[kode_transaksi]"; ?></td>
</tr>
<tr>
<th scope='row'>Nama Konsumen</th>
<td>
<?php echo "<a href='" . base_url() . $this->uri->segment(1) . "/detail_konsumen/$rows[id_konsumen]'>$rows[nama_lengkap]</a>"; ?>
</td>
</tr>
<tr>
<th scope='row'>Waktu Transaksi</th>
<td><?php echo "$rows[waktu_transaksi]"; ?></td>
</tr>
<tr>
<th scope='row'>Kurir</th>
<td><?php echo "<span style='text-transform:uppercase'>$detail[kurir]</span> - $detail[service]"; ?></td>
</tr>
<tr>
<th scope='row'>Status</th>
<td>
<?php
if ($rows['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
$status = 'Proses';
$icon = 'star-empty';
$ubah = 1;
} elseif ($rows['proses'] == '1') {
$proses = '<i class="text-success">Proses</i>';
$status = 'Pending';
$icon = 'star text-yellow';
$ubah = 0;
} elseif ($rows['proses'] == '2') {
$proses = '<i class="text-success">Konfirmasi</i>';
$status = 'Proses';
$icon = 'star text-yellow';
$ubah = 0;
} elseif ($rows['proses'] == '3') {
$proses = '<i class="text-success">Selesai</i>';
$status = 'Selesai';
$icon = 'ok';
$ubah = 0;
}
if ($rows['proses'] == '0' || $rows['proses'] == '1' || $rows['proses'] == '2') {
echo "$proses <a class='btn btn-primary btn-xs' style='margin-left:5px' title='$status Data' href='" . base_url() . $this->uri->segment(1) . "/proses_penjualan_detail/$rows[id_penjualan]/$ubah' onclick=\"return confirm('Apa anda yakin untuk ubah status jadi $status?')\"><span class='glyphicon glyphicon-$icon'></span> Ubah Status</a>";
} elseif ($rows['proses'] == '3') {
echo "$proses <a class='btn btn-primary btn-xs' style='margin-left:5px' title='$status Data'><span class='glyphicon glyphicon-$icon'></span> Selesai</a>";
}
?>
</td>
</tr>
</tbody>
</table>
<hr>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Nama Produk</th>
<th>Harga Jual</th>
<th>Jumlah Jual</th>
<th>Satuan</th>
<th>Sub Total</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($record as $row) {
$sub_total = ($row['harga_jual'] * $row['jumlah']) - $row['diskon'];
echo "<tr><td>$no</td>
<td>$row[nama_produk]</td>
<td>Rp " . rupiah($row['harga_jual']) . "</td>
<td>$row[jumlah]</td>
<td>$row[satuan]</td>
<td>Rp " . rupiah($sub_total) . "</td>
</tr>";
$no++;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='" . $this->uri->segment(3) . "'")->row_array();
echo "<tr class='warning'>
<td colspan='5'><b>Ongkir</b></td>
<td><b>Rp " . rupiah($detail['ongkir']) . "</b></td>
</tr>
<tr class='warning'>
<td colspan='5'><b>Belanja</b></td>
<td><b>Rp " . rupiah($total['total']) . "</b></td>
</tr>
<tr class='success'>
<td colspan='5'><b>Total</b></td>
<td><b>Rp " . rupiah($total['total'] + $detail['ongkir']) . "</b></td>
</tr>";
?>
</tbody>
</table>
</div>

View File

@ -0,0 +1,203 @@
<?php
$pembelian = $this->model_reseller->pembelian($this->session->id_reseller)->row_array();
$penjualan_perusahaan = $this->model_reseller->penjualan_perusahaan($this->session->id_reseller)->row_array();
$penjualan = $this->model_reseller->penjualan($this->session->id_reseller)->row_array();
$modal_perusahaan = $this->model_reseller->modal_perusahaan($this->session->id_reseller)->row_array();
$modal_pribadi = $this->model_reseller->modal_pribadi($this->session->id_reseller)->row_array();
$modal_pribadi2 = $this->model_reseller->modal_pribadi2()->row_array();
$set = $this->db->query("SELECT * FROM rb_setting where aktif='Y'")->row_array();
?>
<div class="row">
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="fa fa-folder-open"></i></span>
<div class="info-box-content">
<span class="info-box-text">Total Belanja</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($pembelian['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-green"><i class="fa fa-shopping-cart"></i></span>
<div class="info-box-content">
<span class="info-box-text">Total Penjualan</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($penjualan_perusahaan['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="glyphicon glyphicon-briefcase"></i></span>
<div class="info-box-content">
<span class="info-box-text">Modal Penjualan</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($modal_perusahaan['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="glyphicon glyphicon-star"></i></span>
<div class="info-box-content">
<span class="info-box-text">Produk Pribadi</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($penjualan['total']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
<a style='color:#000' href='#'>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-red"><i class="glyphicon glyphicon-star"></i></span>
<div class="info-box-content">
<span class="info-box-text">Modal Pribadi</span>
<span class="info-box-number"><?php echo "Rp " . rupiah($modal_pribadi2['total_harga_konsumen']); ?></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div><!-- /.col -->
</a>
</div><!-- /.row -->
<section class="col-lg-6 connectedSortable">
<div class="box box-success">
<div class="box-header">
<i class="fa fa-th-list"></i>
<h3 class="box-title">10 Transaksi Pembelian Terbaru</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i
class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Kode Transaksi</th>
<th>Kurir</th>
<th>Status</th>
<th>Total + Ongkir</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$record = $this->model_reseller->penjualan_list_pusat_top();
foreach ($record->result_array() as $row) {
if ($row['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
$status = 'Menunggu Konfirmasi';
$icon = 'star-empty';
$ubah = 1;
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Selesai</i>';
$status = 'Selesai';
$icon = 'star text-yellow';
$ubah = 0;
} elseif ($row['proses'] == '2') {
$proses = '<i class="text-success">Selesai</i>';
$status = 'Selesai';
$icon = 'star text-yellow';
$ubah = 0;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='$row[id_penjualan]'")->row_array();
echo "<tr><td>$no</td>
<td><a href='" . base_url() . $this->uri->segment(1) . "/detail_penjualan/$row[id_penjualan]'>$row[kode_transaksi]</a></td>
<td><span style='text-transform:uppercase'>$row[kurir]</span> - $row[service]</td>
<td>$proses</td>
<td style='color:red;'>Rp " . rupiah($total['total'] + $row['ongkir']) . "</td>
</tr>";
$no++;
}
?>
</tbody>
</table>
<a class='btn btn-default btn-block' href='<?php echo base_url() . $this->uri->segment(1); ?>/pembelian'>Lihat
Semua</a>
</div>
</div>
</section><!-- /.Left col -->
<section class="col-lg-6 connectedSortable">
<div class="box box-success">
<div class="box-header">
<i class="fa fa-th-list"></i>
<h3 class="box-title">10 Transaksi Penjualan Terbaru</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i
class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove"><i
class="fa fa-times"></i></button>
</div>
</div>
<div class="box-body">
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th style='width:40px'>No</th>
<th>Kode Transaksi</th>
<th>Kurir</th>
<th>Status</th>
<th>Total + Ongkir</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
$record = $this->model_reseller->penjualan_list_konsumen_top($this->session->id_reseller, 'reseller');
foreach ($record->result_array() as $row) {
if ($row['proses'] == '0') {
$proses = '<i class="text-danger">Pending</i>';
$status = 'Proses';
$icon = 'star-empty';
$ubah = 1;
} elseif ($row['proses'] == '1') {
$proses = '<i class="text-success">Proses</i>';
$status = 'Pending';
$icon = 'star text-yellow';
$ubah = 0;
} elseif ($row['proses'] == '2') {
$proses = '<i class="text-success">Konfirmasi</i>';
$status = 'Proses';
$icon = 'star text-yellow';
$ubah = 0;
} elseif ($row['proses'] == '3') {
$proses = '<i class="text-success">Selesai</i>';
$status = 'Selesai';
$icon = 'star text-yellow';
$ubah = 0;
}
$total = $this->db->query("SELECT sum((a.harga_jual*a.jumlah)-a.diskon) as total FROM `rb_penjualan_detail` a where a.id_penjualan='$row[id_penjualan]'")->row_array();
echo "<tr><td>$no</td>
<td><a href='" . base_url() . $this->uri->segment(1) . "/detail_penjualan/$row[id_penjualan]'>$row[kode_transaksi]</a></td>
<td><span style='text-transform:uppercase'>$row[kurir]</span> - $row[service]</td>
<td>$proses</td>
<td style='color:red;'>Rp " . rupiah($total['total'] + $row['ongkir']) . "</td>
</tr>";
$no++;
}
?>
</tbody>
</table>
<a class='btn btn-default btn-block' href='<?php echo base_url() . $this->uri->segment(1); ?>/penjualan'>Lihat
Semua</a>
</div>
</div>
</section><!-- right col -->

View File

@ -0,0 +1,162 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $title; ?></title>
<meta name="author" content="phpmu.com">
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/asset/admin/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/asset/admin/dist/css/AdminLTE.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="<?php echo base_url(); ?>/asset/admin/plugins/iCheck/square/blue.css">
</head>
<style>
.teks {
font-style: italic;
font-size: 30px;
color: black;
font-weight: bold;
}
.teks.visible {
opacity: 1;
}
.overlay {
position: absolute;
justify-content: center;
align-items: center;
background-color: white;
justify-items: center;
z-index: 3;
color: transparent;
height: 100%;
width: 100%;
opacity: 20%;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(40px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeOut {
from {
opacity: 1;
transform: translateY(0);
}
to {
opacity: 0;
transform: translateY(40px);
}
}
.fadeIn {
animation: fadeIn 3s forwards;
}
.fadeOut {
animation: fadeOut 1s forwards;
}
</style>
</head>
<body>
<center>
<div class="overlay" id="overlay">
<img class="gambar" id="gambar"
src="https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExbzNudXk2Z2s4eW51MTRrdmhvdHp6YWZhMDdoYXlmb2g0ZHJ5cDcyMSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9cw/Lew6ElbGiIVuIaiwNa/giphy.webp"
alt="">
<p class="teks" id="teks">Bayar Gaji Pegawai Lebih Mudah Menggunakan Aplikasi Dana</p>
</div>
</center>
<script>
document.addEventListener('DOMContentLoaded', () => {
const overlayElement = document.getElementById('overlay');
overlayElement.classList.add('fadeIn');
setTimeout(() => {
overlayElement.classList.remove('fadeIn');
overlayElement.classList.add('fadeOut');
}, 6000);
overlayElement.addEventListener('animationend', () => {
if (overlayElement.classList.contains('fadeOut')) {
overlayElement.style.display = 'none';
}
});
});
</script>
</body>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<a href="#"><b>Pelapak </b> Login</a>
</div><!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Silahkan Login Pada Form dibawah ini</p>
<form action="" method="post">
<div class="form-group has-feedback">
<input type="text" class="form-control" name='a' placeholder="Username" required>
<span class="glyphicon glyphicon-user form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" name='b' placeholder="Password" required>
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
<label>
<input type="checkbox"> Remember Me
</label>
</div>
</div><!-- /.col -->
<div class="col-xs-4">
<button name='submit' type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
</div><!-- /.col -->
</div>
</form>
</div><!-- /.login-box-body -->
</div><!-- /.login-box -->
<!-- jQuery 2.1.4 -->
<script src="<?php echo base_url(); ?>/asset/admin/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="<?php echo base_url(); ?>/asset/admin/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="<?php echo base_url(); ?>/asset/admin/plugins/iCheck/icheck.min.js"></script>
<script>
$(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

11
app/index.html Normal file
View File

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

67
composer.json Normal file
View File

@ -0,0 +1,67 @@
{
"name": "codeigniter4/framework",
"description": "The CodeIgniter framework v4",
"license": "MIT",
"type": "project",
"homepage": "https://codeigniter.com",
"support": {
"forum": "https://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^7.4 || ^8.0",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"laminas/laminas-escaper": "^2.9",
"psr/log": "^1.1"
},
"require-dev": {
"codeigniter/coding-standard": "^1.7",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "^3.47.1",
"kint-php/kint": "^5.0.4",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0"
},
"suggest": {
"ext-curl": "If you use CURLRequest class",
"ext-dom": "If you use TestResponse",
"ext-exif": "If you run Image class tests",
"ext-fileinfo": "Improves mime type detection for files",
"ext-gd": "If you use Image class GDHandler",
"ext-imagick": "If you use Image class ImageMagickHandler",
"ext-libxml": "If you use TestResponse",
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
"ext-mysqli": "If you use MySQL",
"ext-oci8": "If you use Oracle Database",
"ext-pgsql": "If you use PostgreSQL",
"ext-readline": "Improves CLI::input() usability",
"ext-redis": "If you use Cache class RedisHandler",
"ext-simplexml": "If you format XML",
"ext-sodium": "If you use Encryption SodiumHandler",
"ext-sqlite3": "If you use SQLite3",
"ext-sqlsrv": "If you use SQL Server",
"ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()"
},
"autoload": {
"psr-4": {
"CodeIgniter\\": "system/"
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"scripts": {
"test": "phpunit"
}
}

80
config/routes.php Normal file
View File

@ -0,0 +1,80 @@
<?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 = array(
'default_controller' => 'main',
'main' => 'main',
'administrator' => 'Administrator',
'agenda' => 'agenda',
'albums' => 'albums',
'berita' => 'berita',
'download' => 'download',
'halaman' => 'halaman',
'hubungi' => 'hubungi',
'kategori' => 'kategori',
'konsultasi' => 'konsultasi',
'kontributor' => 'kontributor',
'playlist' => 'playlist',
'polling' => 'polling',
'tag' => 'tag',
'testimoni' => 'testimoni',
'konfirmasi' => 'konfirmasi',
'produk' => 'produk',
'auth' => 'auth',
'members' => 'members',
'reseller' => 'reseller',
);
$route['(:any)'] = 'news/$1/$2';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['pesanan_selesai'] = 'Reseller/pesanan_selesai';

263
controllers/Auth.php Normal file
View File

@ -0,0 +1,263 @@
<?php
/*
-- ---------------------------------------------------------------
-- MARKETPLACE MULTI BUYER MULTI SELLER + SUPPORT RESELLER SYSTEM
-- CREATED BY : ROBBY PRIHANDAYA
-- COPYRIGHT : Copyright (c) 2018 - 2019, PHPMU.COM. (https://phpmu.com/)
-- LICENSE : http://opensource.org/licenses/MIT MIT License
-- CREATED ON : 2019-03-26
-- UPDATED ON : 2019-03-27
-- ---------------------------------------------------------------
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Auth extends CI_Controller {
function city(){
$state_id = $this->input->post('stat_id');
$data['kota'] = $this->model_app->view_where_ordering('rb_kota',array('provinsi_id' => $state_id),'kota_id','DESC');
$this->load->view(template().'/reseller/view_city',$data);
}
public function register(){
if (isset($_POST['submit1'])){
$data = array('username'=>$this->input->post('a'),
'password'=>hash("sha512", md5($this->input->post('b'))),
'nama_lengkap'=>$this->input->post('c'),
'email'=>$this->input->post('d'),
'alamat_lengkap'=>$this->input->post('e'),
'kota_id'=>$this->input->post('h'),
'kecamatan'=>$this->input->post('i'),
'no_hp'=>$this->input->post('j'),
'tanggal_daftar'=>date('Y-m-d H:i:s'));
$this->model_app->insert('rb_konsumen',$data);
$id = $this->db->insert_id();
$this->session->set_userdata(array('id_konsumen'=>$id, 'level'=>'konsumen'));
if ($this->session->idp!=''){
$data = array('kode_transaksi'=>$this->session->idp,
'id_pembeli'=>$id,
'id_penjual'=>$this->session->reseller,
'status_pembeli'=>'konsumen',
'status_penjual'=>'reseller',
'waktu_transaksi'=>date('Y-m-d H:i:s'),
'proses'=>'0');
$this->model_app->insert('rb_penjualan',$data);
$idp = $this->db->insert_id();
$keranjang = $this->model_app->view_where('rb_penjualan_temp',array('session'=>$this->session->idp));
foreach ($keranjang->result_array() as $row) {
$dataa = array('id_penjualan'=>$idp,
'id_produk'=>$row['id_produk'],
'jumlah'=>$row['jumlah'],
'harga_jual'=>$row['harga_jual'],
'satuan'=>$row['satuan']);
$this->model_app->insert('rb_penjualan_detail',$dataa);
}
$this->db->query("DELETE FROM rb_penjualan_temp where session='".$this->session->idp."'");
$this->session->unset_userdata('reseller');
$this->session->unset_userdata('idp');
$this->session->set_userdata(array('idp'=>$idp));
}
redirect('members/profile');
}elseif (isset($_POST['submit2'])){
$cek = $this->model_app->view_where('rb_reseller',array('username'=>$this->input->post('a')))->num_rows();
if ($cek >= 1){
$username = $this->input->post('a');
echo "<script>window.alert('Maaf, Username $username sudah dipakai oleh orang lain!');
window.location=('".base_url()."/auth/register')</script>";
}else{
$route = array('administrator','agenda','auth','berita','contact','download','gallery','konfirmasi','main','members','page','produk','reseller','testimoni','video');
if (in_array($this->input->post('a'), $route)){
$username = $this->input->post('a');
echo "<script>window.alert('Maaf, Username $username sudah dipakai oleh orang lain!');
window.location=('".base_url()."/".$this->input->post('i')."')</script>";
}else{
$data = array('username'=>$this->input->post('a'),
'password'=>hash("sha512", md5($this->input->post('b'))),
'nama_reseller'=>$this->input->post('c'),
'jenis_kelamin'=>$this->input->post('d'),
'kota_id'=>$this->input->post('kota'),
'alamat_lengkap'=>$this->input->post('e'),
'no_telpon'=>$this->input->post('f'),
'email'=>$this->input->post('g'),
'kode_pos'=>$this->input->post('h'),
'referral'=>$this->input->post('i'),
'tanggal_daftar'=>date('Y-m-d H:i:s'));
$this->model_app->insert('rb_reseller',$data);
$id = $this->db->insert_id();
$this->session->set_userdata(array('id_reseller'=>$id, 'level'=>'reseller'));
redirect('reseller/home');
}
}
}else{
$data['title'] = 'Formulir Pendaftaran';
$data['provinsi'] = $this->model_app->view_ordering('rb_provinsi','provinsi_id','ASC');
$this->template->load(template().'/template',template().'/reseller/view_register',$data);
}
}
public function login(){
if (isset($_POST['login'])){
$username = strip_tags($this->input->post('a'));
$password = hash("sha512", md5(strip_tags($this->input->post('b'))));
$cek = $this->db->query("SELECT * FROM rb_konsumen where username='".$this->db->escape_str($username)."' AND password='".$this->db->escape_str($password)."'");
$row = $cek->row_array();
$total = $cek->num_rows();
if ($total > 0){
$this->session->set_userdata(array('id_konsumen'=>$row['id_konsumen'], 'level'=>'konsumen'));
if ($this->session->idp!=''){
$data = array('kode_transaksi'=>$this->session->idp,
'id_pembeli'=>$row['id_konsumen'],
'id_penjual'=>$this->session->reseller,
'status_pembeli'=>'konsumen',
'status_penjual'=>'reseller',
'waktu_transaksi'=>date('Y-m-d H:i:s'),
'proses'=>'0');
$this->model_app->insert('rb_penjualan',$data);
$id = $this->db->insert_id();
$query_temp = $this->db->query("SELECT * FROM rb_penjualan_temp where session='".$this->session->idp."'");
foreach ($query_temp->result_array() as $r) {
$data = array('id_penjualan'=>$id,
'id_produk'=>$r['id_produk'],
'jumlah'=>$r['jumlah'],
'diskon'=>$r['diskon'],
'harga_jual'=>$r['harga_jual'],
'satuan'=>$r['satuan']);
$this->model_app->insert('rb_penjualan_detail',$data);
}
$this->db->query("DELETE FROM rb_penjualan_temp where session='".$this->session->idp."'");
$this->session->unset_userdata('reseller');
$this->session->unset_userdata('idp');
$this->session->set_userdata(array('idp'=>$id));
}
redirect('members/profile');
}else{
$data['title'] = 'Gagal Login';
echo $this->session->set_flashdata('message', '<div class="alert alert-danger"><center>Maaf, Username atau password salah!</center></div>');
redirect('auth/login');
}
}else{
$data['title'] = 'User Login';
$this->template->load(template().'/template',template().'/reseller/view_login',$data);
}
}
//lupa password
public function login21(){
if (isset($_POST['login21'])){
$email = strip_tags($this->input->post('n'));
$no_hp = strip_tags($this->input->post('m'));
$cek = $this->db->query("SELECT * FROM rb_konsumen where email='".$this->db->escape_str($email)."' AND no_hp='".$this->db->escape_str($no_hp)."'");
$row = $cek->row_array();
$total = $cek->num_rows();
if ($total > 0){
$this->session->set_userdata(array('id_konsumen'=>$row['id_konsumen'], 'level'=>'konsumen'));
if ($this->session->idp!=''){
$data = array('kode_transaksi'=>$this->session->idp,
'id_pembeli'=>$row['id_konsumen'],
'id_penjual'=>$this->session->reseller,
'status_pembeli'=>'konsumen',
'status_penjual'=>'reseller',
'waktu_transaksi'=>date('Y-m-d H:i:s'),
'proses'=>'0');
$this->model_app->insert('rb_penjualan',$data);
$id = $this->db->insert_id();
$query_temp = $this->db->query("SELECT * FROM rb_penjualan_temp where session='".$this->session->idp."'");
foreach ($query_temp->result_array() as $r) {
$data = array('id_penjualan'=>$id,
'id_produk'=>$r['id_produk'],
'jumlah'=>$r['jumlah'],
'diskon'=>$r['diskon'],
'harga_jual'=>$r['harga_jual'],
'satuan'=>$r['satuan']);
$this->model_app->insert('rb_penjualan_detail',$data);
}
$this->db->query("DELETE FROM rb_penjualan_temp where session='".$this->session->idp."'");
$this->session->unset_userdata('reseller');
$this->session->unset_userdata('idp');
$this->session->set_userdata(array('idp'=>$id));
}
redirect('members/edit_profile');
}else{
$this->session->set_flashdata('error21', 'Data Pemulihan Tidak Ditemukan');
redirect('auth/login');
}
}else{
$data['title'] = 'User Login';
$this->template->load(template().'/template',template().'/reseller/view_login',$data);
}
}
public function lupass(){
if (isset($_POST['lupa'])){
$email = strip_tags($this->input->post('a'));
$cek = $this->db->query("SELECT * FROM rb_konsumen where email='".$this->db->escape_str($email)."'");
$row = $cek->row_array();
$total = $cek->num_rows();
if ($total > 0){
$identitas = $this->db->query("SELECT * FROM identitas where id_identitas='1'")->row_array();
$randompass = generateRandomString(10);
$passwordbaru = hash("sha512", md5($randompass));
$this->db->query("UPDATE rb_konsumen SET password='$passwordbaru' where email='".$this->db->escape_str($email)."'");
if ($row['jenis_kelamin']=='Laki-laki'){ $panggill = 'Bpk.'; }else{ $panggill = 'Ibuk.'; }
$email_tujuan = $row['email'];
$tglaktif = date("d-m-Y H:i:s");
$subject = 'Permintaan Reset Password ...';
$message = "<html><body>Halooo! <b>$panggill ".$row['nama_lengkap']."</b> ... <br> Hari ini pada tanggal <span style='color:red'>$tglaktif</span> Anda Mengirimkan Permintaan untuk Reset Password
<table style='width:100%; margin-left:25px'>
<tr><td style='background:#337ab7; color:#fff; pading:20px' cellpadding=6 colspan='2'><b>Berikut Data Informasi akun Anda : </b></td></tr>
<tr><td><b>Nama Lengkap</b></td> <td> : ".$row['nama_lengkap']."</td></tr>
<tr><td><b>Alamat Email</b></td> <td> : ".$row['email']."</td></tr>
<tr><td><b>No Telpon</b></td> <td> : ".$row['no_hp']."</td></tr>
<tr><td><b>Jenis Kelamin</b></td> <td> : ".$row['jenis_kelamin']." </td></tr>
<tr><td><b>Tempat Lahir</b></td> <td> : ".$row['tempat_lahir']." </td></tr>
<tr><td><b>Tanggal Lahir</b></td> <td> : ".$row['tanggal_lahir']." </td></tr>
<tr><td><b>Alamat Lengkap</b></td> <td> : ".$row['alamat_lengkap']." </td></tr>
<tr><td><b>Waktu Daftar</b></td> <td> : ".$row['tanggal_daftar']."</td></tr>
</table>
<br> Username Login : <b style='color:red'>$row[username]</b>
<br> Password Login : <b style='color:red'>$randompass</b>
<br> Silahkan Login di : <a href='$identitas[url]'>$identitas[url]</a> <br>
Admin, $identitas[nama_website] </body></html> \n";
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = "alamat_email@gmail.com";
$config['smtp_pass'] = "password gmail disini...";
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html';
$config['validation'] = TRUE;
$this->email->initialize($config);
$this->email->from("$identitas[email]", "$identitas[nama_website]");
$this->email->to($email_tujuan);
$this->email->cc('');
$this->email->bcc('');
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
$data['email'] = $email;
$data['title'] = 'Permintaan Reset Password Sudah Terkirim...';
$this->template->load(template().'/template',template().'/view_lupass_error',$data);
}else{
$data['email'] = $email;
$data['title'] = 'Email Tidak Ditemukan...';
$this->template->load(template().'/template',template().'p/view_lupass_error',$data);
}
}
}
}

1260
controllers/Reseller.php Normal file

File diff suppressed because it is too large Load Diff

143
env Normal file
View File

@ -0,0 +1,143 @@
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
# CI_ENVIRONMENT = production
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
# app.baseURL = ''
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
# app.CSPEnabled = false
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
# database.default.hostname = localhost
# database.default.database = ci4
# database.default.username = root
# database.default.password = root
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = localhost
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
#--------------------------------------------------------------------
# CONTENT SECURITY POLICY
#--------------------------------------------------------------------
# contentsecuritypolicy.reportOnly = false
# contentsecuritypolicy.defaultSrc = 'none'
# contentsecuritypolicy.scriptSrc = 'self'
# contentsecuritypolicy.styleSrc = 'self'
# contentsecuritypolicy.imageSrc = 'self'
# contentsecuritypolicy.baseURI = null
# contentsecuritypolicy.childSrc = null
# contentsecuritypolicy.connectSrc = 'self'
# contentsecuritypolicy.fontSrc = null
# contentsecuritypolicy.formAction = null
# contentsecuritypolicy.frameAncestors = null
# contentsecuritypolicy.frameSrc = null
# contentsecuritypolicy.mediaSrc = null
# contentsecuritypolicy.objectSrc = null
# contentsecuritypolicy.pluginTypes = null
# contentsecuritypolicy.reportURI = null
# contentsecuritypolicy.sandbox = false
# contentsecuritypolicy.upgradeInsecureRequests = false
# contentsecuritypolicy.styleNonceTag = '{csp-style-nonce}'
# contentsecuritypolicy.scriptNonceTag = '{csp-script-nonce}'
# contentsecuritypolicy.autoNonce = true
#--------------------------------------------------------------------
# COOKIE
#--------------------------------------------------------------------
# cookie.prefix = ''
# cookie.expires = 0
# cookie.path = '/'
# cookie.domain = ''
# cookie.secure = false
# cookie.httponly = false
# cookie.samesite = 'Lax'
# cookie.raw = false
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
# encryption.key =
# encryption.driver = OpenSSL
# encryption.blockSize = 16
# encryption.digest = SHA512
#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------
# honeypot.hidden = 'true'
# honeypot.label = 'Fill This Field'
# honeypot.name = 'honeypot'
# honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
# honeypot.container = '<div style="display:none">{template}</div>'
#--------------------------------------------------------------------
# SECURITY
#--------------------------------------------------------------------
# security.csrfProtection = 'cookie'
# security.tokenRandomize = false
# security.tokenName = 'csrf_token_name'
# security.headerName = 'X-CSRF-TOKEN'
# security.cookieName = 'csrf_cookie_name'
# security.expires = 7200
# security.regenerate = true
# security.redirect = false
# security.samesite = 'Lax'
#--------------------------------------------------------------------
# SESSION
#--------------------------------------------------------------------
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
# session.cookieName = 'ci_session'
# session.expiration = 7200
# session.savePath = null
# session.matchIP = false
# session.timeToUpdate = 300
# session.regenerateDestroy = false
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------
# logger.threshold = 4
#--------------------------------------------------------------------
# CURLRequest
#--------------------------------------------------------------------
# curlrequest.shareOptions = false

97
models/Model_app.php Normal file
View File

@ -0,0 +1,97 @@
<?php
/*
-- ---------------------------------------------------------------
-- ---------------------------------------------------------------
*/
class Model_app extends CI_model{
public function view($table){
return $this->db->get($table);
}
public function insert($table,$data){
return $this->db->insert($table, $data);
}
public function edit($table, $data){
return $this->db->get_where($table, $data);
}
public function update($table, $data, $where){
return $this->db->update($table, $data, $where);
}
public function delete($table, $where){
return $this->db->delete($table, $where);
}
public function view_where($table,$data){
$this->db->where($data);
return $this->db->get($table);
}
public function view_ordering_limit($table,$order,$ordering,$baris,$dari){
$this->db->select('*');
$this->db->order_by($order,$ordering);
$this->db->limit($dari, $baris);
return $this->db->get($table);
}
public function view_where_ordering_limit($table,$data,$order,$ordering,$baris,$dari){
$this->db->select('*');
$this->db->where($data);
$this->db->order_by($order,$ordering);
$this->db->limit($dari, $baris);
return $this->db->get($table);
}
public function view_ordering($table,$order,$ordering){
$this->db->select('*');
$this->db->from($table);
$this->db->order_by($order,$ordering);
return $this->db->get()->result_array();
}
public function view_where_ordering($table,$data,$order,$ordering){
$this->db->where($data);
$this->db->order_by($order,$ordering);
$query = $this->db->get($table);
return $query->result_array();
}
public function view_join_one($table1,$table2,$field,$order,$ordering){
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1.'.'.$field.'='.$table2.'.'.$field);
$this->db->order_by($order,$ordering);
return $this->db->get()->result_array();
}
public function view_join_where($table1,$table2,$field,$where,$order,$ordering){
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1.'.'.$field.'='.$table2.'.'.$field);
$this->db->where($where);
$this->db->order_by($order,$ordering);
return $this->db->get()->result_array();
}
function umenu_akses($link,$id){
return $this->db->query("SELECT * FROM modul,users_modul WHERE modul.id_modul=users_modul.id_modul AND users_modul.id_session='$id' AND modul.link='$link'")->num_rows();
}
public function cek_login($username,$password,$table){
return $this->db->query("SELECT * FROM $table where username='".$this->db->escape_str($username)."' AND password='".$this->db->escape_str($password)."' AND blokir='N'");
}
function grafik_kunjungan(){
return $this->db->query("SELECT count(*) as jumlah, tanggal FROM statistik GROUP BY tanggal ORDER BY tanggal DESC LIMIT 10");
}
function kategori_populer($limit){
return $this->db->query("SELECT * FROM (SELECT a.*, b.jum_dibaca FROM
(SELECT * FROM kategori) as a left join
(SELECT id_kategori, sum(dibaca) as jum_dibaca FROM berita GROUP BY id_kategori) as b on a.id_kategori=b.id_kategori) as c
where c.aktif='Y' ORDER BY c.jum_dibaca DESC LIMIT $limit");
}
}

367
models/Model_reseller.php Normal file
View File

@ -0,0 +1,367 @@
<?php
/*
-- ---------------------------------------------------------------
-- MARKETPLACE MULTI BUYER MULTI SELLER + SUPPORT RESELLER SYSTEM
-- CREATED BY : ROBBY PRIHANDAYA
-- COPYRIGHT : Copyright (c) 2018 - 2019, PHPMU.COM. (https://phpmu.com/)
-- LICENSE : http://opensource.org/licenses/MIT MIT License
-- CREATED ON : 2019-03-26
-- UPDATED ON : 2019-03-27
-- ---------------------------------------------------------------
*/
class Model_reseller extends CI_model
{
function top_menu()
{
return $this->db->query("SELECT * FROM menu where position='Top' ORDER BY urutan ASC");
}
function testimoni()
{
return $this->db->query("SELECT a.*, b.nama_lengkap, b.id_konsumen FROM testimoni a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen ORDER BY a.id_testimoni DESC");
}
function testimoni_update()
{
$datadb = array(
'isi_testimoni' => $this->input->post('b'),
'aktif' => $this->input->post('f')
);
$this->db->where('id_testimoni', $this->input->post('id'));
$this->db->update('testimoni', $datadb);
}
function testimoni_edit($id)
{
return $this->db->query("SELECT a.*, b.nama_lengkap, b.id_konsumen FROM testimoni a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen where a.id_testimoni='$id'");
}
function testimoni_delete($id)
{
return $this->db->query("DELETE FROM testimoni where id_testimoni='$id'");
}
function public_testimoni($sampai, $dari)
{
return $this->db->query("SELECT a.*, b.nama_lengkap, b.foto, b.id_konsumen, b.jenis_kelamin FROM testimoni a JOIN rb_konsumen b ON a.id_konsumen=b.id_konsumen where a.aktif='Y' ORDER BY a.id_testimoni DESC LIMIT $dari, $sampai");
}
function hitung_testimoni()
{
return $this->db->query("SELECT * FROM testimoni where aktif='Y'");
}
function insert_testimoni()
{
$datadb = array(
'id_konsumen' => $this->session->id_konsumen,
'isi_testimoni' => $this->input->post('testimoni'),
'aktif' => 'N',
'waktu_testimoni' => date('Y-m-d H:i:s')
);
$this->db->insert('testimoni', $datadb);
}
function cari_reseller($kata)
{
$pisah_kata = explode(" ", $kata);
$jml_katakan = (integer) count($pisah_kata);
$jml_kata = $jml_katakan - 1;
$cari = "SELECT * FROM rb_reseller a LEFT JOIN rb_kota b ON a.kota_id=b.kota_id WHERE";
for ($i = 0; $i <= $jml_kata; $i++) {
$cari .= " a.nama_reseller LIKE '%" . $pisah_kata[$i] . "%' OR b.nama_kota LIKE '%" . $pisah_kata[$i] . "%' ";
if ($i < $jml_kata) {
$cari .= " OR ";
}
}
$cari .= " ORDER BY a.id_reseller DESC LIMIT 36";
return $this->db->query($cari);
}
public function view_join_rows($table1, $table2, $field, $where, $order, $ordering)
{
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1 . '.' . $field . '=' . $table2 . '.' . $field);
$this->db->where($where);
$this->db->order_by($order, $ordering);
return $this->db->get();
}
function penjualan_list_konsumen($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_konsumen b ON a.id_pembeli=b.id_konsumen where a.status_penjual='$level' AND a.id_penjual='$id' ORDER BY a.id_penjualan DESC");
}
function jual($id)
{
return $this->db->query("SELECT sum(a.jumlah) as jual FROM rb_penjualan_detail a JOIN rb_penjualan b ON a.id_penjualan=b.id_penjualan where a.id_produk='$id' AND b.status_penjual='admin' AND b.proses='1'");
}
function beli($id)
{
return $this->db->query("SELECT sum(a.jumlah_pesan) as beli FROM rb_pembelian_detail a where a.id_produk='$id'");
}
function jual_reseller($penjual, $produk)
{
return $this->db->query("SELECT sum(jumlah) as jual FROM `rb_penjualan` a JOIN rb_penjualan_detail b ON a.id_penjualan=b.id_penjualan where a.status_pembeli='konsumen' AND a.status_penjual='reseller' AND a.id_penjual='$penjual' AND b.id_produk='$produk' AND a.proses='1'");
}
function beli_reseller($pembeli, $produk)
{
return $this->db->query("SELECT sum(jumlah) as beli FROM `rb_penjualan` a JOIN rb_penjualan_detail b ON a.id_penjualan=b.id_penjualan where a.status_pembeli='reseller' AND a.status_penjual='admin' AND a.id_pembeli='$pembeli' AND b.id_produk='$produk' AND a.proses='1'");
}
function penjualan_konsumen_detail($id)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_penjual=b.id_reseller JOIN rb_kota c ON b.kota_id=c.kota_id where a.id_penjualan='$id'");
}
function profile_konsumen($id)
{
return $this->db->query("SELECT a.id_konsumen, a.username, a.nama_lengkap, a.email, a.jenis_kelamin, a.tanggal_lahir, a.tempat_lahir, a.alamat_lengkap, a.kecamatan, a.no_hp, a.tanggal_daftar, b.kota_id, b.nama_kota as kota, c.provinsi_id, c.nama_provinsi as propinsi FROM `rb_konsumen` a LEFT JOIN rb_kota b ON a.kota_id=b.kota_id LEFT JOIN rb_provinsi c ON b.provinsi_id=c.provinsi_id where a.id_konsumen='$id'");
}
function orders_report($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_penjual=b.id_reseller where a.status_penjual='$level' AND a.id_pembeli='$id' ORDER BY a.id_penjualan DESC");
}
function agenda_terbaru($limit)
{
return $this->db->query("SELECT * FROM agenda ORDER BY id_agenda DESC LIMIT $limit");
}
public function view_join_where_one($table1, $table2, $field, $where)
{
$this->db->select('*');
$this->db->from($table1);
$this->db->join($table2, $table1 . '.' . $field . '=' . $table2 . '.' . $field);
$this->db->where($where);
return $this->db->get();
}
function modupdatefoto()
{
$config['upload_path'] = 'asset/foto_user/';
$config['allowed_types'] = 'gif|jpg|png|JPG|gif|JPEG|jpeg';
$config['max_size'] = '1000'; // kb
$this->load->library('upload', $config);
$this->upload->do_upload();
$hasil = $this->upload->data();
$config['image_library'] = 'gd2';
$config['source_image'] = 'asset/foto_user/' . $hasil['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['height'] = 622;
$this->load->library('image_lib', $config);
$this->image_lib->crop();
$datadb = array('foto' => $hasil['file_name']);
$this->db->where('id_konsumen', $this->session->id_konsumen);
$this->db->update('rb_konsumen', $datadb);
}
function modupdatefotoreseller()
{
$config['upload_path'] = 'asset/foto_user/';
$config['allowed_types'] = 'gif|jpg|png|JPG|gif|JPEG|jpeg';
$config['max_size'] = '1000'; // kb
$this->load->library('upload', $config);
$this->upload->do_upload();
$hasil = $this->upload->data();
$config['image_library'] = 'gd2';
$config['source_image'] = 'asset/foto_user/' . $hasil['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['height'] = 622;
$this->load->library('image_lib', $config);
$this->image_lib->crop();
$datadb = array('foto' => $hasil['file_name']);
$this->db->where('id_reseller', $this->session->id_reseller);
$this->db->update('rb_reseller', $datadb);
}
function profile_update($id)
{
if (trim($this->input->post('a')) != '') {
$datadbd = array(
'username' => $this->db->escape_str(strip_tags($this->input->post('aa'))),
'password' => hash("sha512", md5($this->input->post('a'))),
'nama_lengkap' => $this->db->escape_str(strip_tags($this->input->post('b'))),
'email' => $this->db->escape_str(strip_tags($this->input->post('c'))),
'jenis_kelamin' => $this->db->escape_str($this->input->post('d')),
'tanggal_lahir' => $this->db->escape_str($this->input->post('e')),
'tempat_lahir' => $this->db->escape_str(strip_tags($this->input->post('f'))),
'alamat_lengkap' => $this->db->escape_str(strip_tags($this->input->post('g'))),
'kecamatan' => $this->db->escape_str(strip_tags($this->input->post('k'))),
'kota_id' => $this->db->escape_str(strip_tags($this->input->post('ga'))),
'no_hp' => $this->db->escape_str(strip_tags($this->input->post('l')))
);
} else {
$datadbd = array(
'username' => $this->db->escape_str(strip_tags($this->input->post('aa'))),
'nama_lengkap' => $this->db->escape_str(strip_tags($this->input->post('b'))),
'email' => $this->db->escape_str(strip_tags($this->input->post('c'))),
'jenis_kelamin' => $this->db->escape_str($this->input->post('d')),
'tanggal_lahir' => $this->db->escape_str($this->input->post('e')),
'tempat_lahir' => $this->db->escape_str(strip_tags($this->input->post('f'))),
'alamat_lengkap' => $this->db->escape_str(strip_tags($this->input->post('g'))),
'kecamatan' => $this->db->escape_str(strip_tags($this->input->post('k'))),
'kota_id' => $this->db->escape_str(strip_tags($this->input->post('ga'))),
'no_hp' => $this->db->escape_str(strip_tags($this->input->post('l')))
);
}
$this->db->where('id_konsumen', $id);
$this->db->update('rb_konsumen', $datadbd);
}
function penjualan_list_konsumen_top($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_konsumen b ON a.id_pembeli=b.id_konsumen where a.status_penjual='$level' AND a.id_penjual='$id' ORDER BY a.id_penjualan DESC LIMIT 10");
}
function penjualan_list_pusat_top()
{
return $this->db->query("
SELECT
rp.*,
rpd.*
FROM
rb_penjualan rp
JOIN
rb_penjualan_detail rpd
ON
rp.id_penjualan = rpd.id_penjualan
WHERE
rp.id_pembeli = 10
AND rp.id_penjual = 1
ORDER BY
rp.waktu_transaksi DESC
LIMIT 10
");
}
function reseller_pembelian($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_pembeli=b.id_reseller where a.status_penjual='$level' AND a.id_pembeli='$id' ORDER BY a.id_penjualan DESC");
}
function penjualan_detail($id)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_pembeli=b.id_reseller where a.id_penjualan='$id'");
}
function penjualan_konsumen_detail_reseller($id)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_konsumen b ON a.id_pembeli=b.id_konsumen where a.id_penjualan='$id'");
}
function penjualan_list($id, $level)
{
return $this->db->query("SELECT * FROM `rb_penjualan` a JOIN rb_reseller b ON a.id_pembeli=b.id_reseller where a.status_penjual='$level' AND a.id_penjual='$id' ORDER BY a.id_penjualan DESC");
}
function pembelian($id_reseller)
{
return $this->db->query("SELECT sum((b.jumlah*b.harga_jual)-b.diskon) as total FROM rb_penjualan a JOIN rb_penjualan_detail b ON a.id_penjualan=b.id_penjualan where a.status_penjual='admin' AND a.id_pembeli='" . $id_reseller . "' AND a.proses='1'");
}
function penjualan_perusahaan($id_reseller)
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_penjual='reseller' AND b.id_produk_perusahaan!='0' AND id_penjual='" . $id_reseller . "' AND c.proses='1'");
}
function penjualan($id_reseller)
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_penjual='reseller' AND b.id_produk_perusahaan='0' AND id_penjual='" . $id_reseller . "' AND c.proses='1'");
}
function penjualan_1()
{
$today = date('Y-m-d');
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND DATE(c.waktu_transaksi) = '" . $today . "'");
}
function penjualan_7()
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND c.waktu_transaksi BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()");
}
function penjualan_30()
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND c.waktu_transaksi BETWEEN DATE_SUB(CURDATE(), INTERVAL 30 DAY) AND CURDATE()");
}
function penjualan_365()
{
return $this->db->query("SELECT sum((a.jumlah*a.harga_jual)-a.diskon) as total, sum(a.jumlah) as produk
FROM `rb_penjualan_detail` a
JOIN rb_produk b ON a.id_produk=b.id_produk
JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan
WHERE c.status_penjual='reseller'
AND b.id_produk_perusahaan='0'
AND id_penjual='" . 10 . "'
AND c.proses='1'
AND c.waktu_transaksi BETWEEN DATE_SUB(CURDATE(), INTERVAL 365 DAY) AND CURDATE()");
}
function modal_perusahaan($id_reseller)
{
return $this->db->query("SELECT sum(a.jumlah*b.harga_reseller) as total FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_pembeli='konsumen' AND c.proses='1' AND c.id_penjual='" . $id_reseller . "' AND b.id_produk_perusahaan!='0'");
}
function modal_pribadi($id_reseller)
{
return $this->db->query("SELECT sum(a.jumlah*b.harga_beli) as total FROM `rb_penjualan_detail` a JOIN rb_produk b ON a.id_produk=b.id_produk JOIN rb_penjualan c ON a.id_penjualan=c.id_penjualan where c.status_pembeli='konsumen' AND c.proses='1' AND c.id_penjual='" . $id_reseller . "' AND b.id_produk_perusahaan='0'");
}
function produk_perkategori($id_reseller, $id_produk_perusahaan, $id_kategori_produk, $limit)
{
return $this->db->query("SELECT a.*, b.nama_reseller, c.nama_kota FROM rb_produk a LEFT JOIN rb_reseller b ON a.id_reseller=b.id_reseller
LEFT JOIN rb_kota c ON b.kota_id=c.kota_id where a.id_reseller!='$id_reseller' AND a.id_produk_perusahaan='$id_produk_perusahaan' AND a.id_kategori_produk='$id_kategori_produk' ORDER BY a.id_produk DESC LIMIT $limit");
}
function modal_pribadi2()
{
return $this->db->query("SELECT SUM(harga_konsumen) AS total_harga_konsumen
FROM rb_produk
WHERE id_reseller = 10
");
}
}

57
phpunit.xml.dist Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="system/Test/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true" processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
<exclude>
<directory suffix=".php">./app/Views</directory>
<file>./app/Config/Routes.php</file>
</exclude>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/logs/html"/>
<php outputFile="build/logs/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>
<testsuites>
<testsuite name="App">
<directory>./tests</directory>
</testsuite>
</testsuites>
<logging>
<testdoxHtml outputFile="build/logs/testdox.html"/>
<testdoxText outputFile="build/logs/testdox.txt"/>
<junit outputFile="build/logs/logfile.xml"/>
</logging>
<php>
<server name="app.baseURL" value="http://example.com/"/>
<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>
<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="./app/Config/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>
<!-- Database configuration -->
<!-- Uncomment to provide your own database for testing
<env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="tests"/>
<env name="database.tests.username" value="tests_user"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
</phpunit>

113
preload.php Normal file
View File

@ -0,0 +1,113 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
/*
*---------------------------------------------------------------
* Sample file for Preloading
*---------------------------------------------------------------
* See https://www.php.net/manual/en/opcache.preloading.php
*
* How to Use:
* 0. Copy this file to your project root folder.
* 1. Set the $paths property of the preload class below.
* 2. Set opcache.preload in php.ini.
* php.ini:
* opcache.preload=/path/to/preload.php
*/
// Load the paths config file
require __DIR__ . '/app/Config/Paths.php';
// Path to the front controller
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
/**
* See https://www.php.net/manual/en/function.str-contains.php#126277
*/
if (! function_exists('str_contains')) {
/**
* Polyfill of str_contains()
*/
function str_contains(string $haystack, string $needle): bool
{
return empty($needle) || strpos($haystack, $needle) !== false;
}
}
class preload
{
/**
* @var array Paths to preload.
*/
private array $paths = [
[
'include' => __DIR__ . '/vendor/codeigniter4/framework/system',
'exclude' => [
// Not needed if you don't use them.
'/system/Database/OCI8/',
'/system/Database/Postgre/',
'/system/Database/SQLSRV/',
// Not needed.
'/system/Database/Seeder.php',
'/system/Test/',
'/system/Language/',
'/system/CLI/',
'/system/Commands/',
'/system/Publisher/',
'/system/ComposerScripts.php',
'/Views/',
// Errors occur.
'/system/Config/Routes.php',
'/system/ThirdParty/',
],
],
];
public function __construct()
{
$this->loadAutoloader();
}
private function loadAutoloader()
{
$paths = new Config\Paths();
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
}
/**
* Load PHP files.
*/
public function load()
{
foreach ($this->paths as $path) {
$directory = new RecursiveDirectoryIterator($path['include']);
$fullTree = new RecursiveIteratorIterator($directory);
$phpFiles = new RegexIterator(
$fullTree,
'/.+((?<!Test)+\.php$)/i',
RecursiveRegexIterator::GET_MATCH
);
foreach ($phpFiles as $key => $file) {
foreach ($path['exclude'] as $exclude) {
if (str_contains($file[0], $exclude)) {
continue 2;
}
}
require_once $file[0];
echo 'Loaded: ' . $file[0] . "\n";
}
}
}
}
(new preload())->load();

49
public/.htaccess Normal file
View File

@ -0,0 +1,49 @@
# Disable directory browsing
Options -Indexes
# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
# Disable server signature start
ServerSignature Off
# Disable server signature end

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

87
public/index.php Normal file
View File

@ -0,0 +1,87 @@
<?php
// Check PHP version.
$minPhpVersion = '7.4'; // If you update this, don't forget to update `spark`.
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
$message = sprintf(
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
$minPhpVersion,
PHP_VERSION
);
exit($message);
}
// Path to the front controller (this file)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
// Ensure the current directory is pointing to the front controller's directory
if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) {
chdir(FCPATH);
}
/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
*---------------------------------------------------------------
* This process sets up the path constants, loads and registers
* our autoloader, along with Composer's, loads our constants
* and fires up an environment-specific bootstrapping.
*/
// Load our paths config file
// This is the line that might need to be changed, depending on your folder structure.
require FCPATH . '../app/Config/Paths.php';
// ^^^ Change this line if you move your application folder
$paths = new Config\Paths();
// Location of the framework bootstrap file.
require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
// Load environment settings from .env files into $_SERVER and $_ENV
require_once SYSTEMPATH . 'Config/DotEnv.php';
(new CodeIgniter\Config\DotEnv(ROOTPATH))->load();
// Define ENVIRONMENT
if (! defined('ENVIRONMENT')) {
define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production'));
}
// Load Config Cache
// $factoriesCache = new \CodeIgniter\Cache\FactoriesCache();
// $factoriesCache->load('config');
// ^^^ Uncomment these lines if you want to use Config Caching.
/*
* ---------------------------------------------------------------
* GRAB OUR CODEIGNITER INSTANCE
* ---------------------------------------------------------------
*
* The CodeIgniter class contains the core functionality to make
* the application run, and does all the dirty work to get
* the pieces all working together.
*/
$app = Config\Services::codeigniter();
$app->initialize();
$context = is_cli() ? 'php-cli' : 'web';
$app->setContext($context);
/*
*---------------------------------------------------------------
* LAUNCH THE APPLICATION
*---------------------------------------------------------------
* Now that everything is set up, it's time to actually fire
* up the engines and make this app do its thang.
*/
$app->run();
// Save Config Cache
// $factoriesCache->save('config');
// ^^^ Uncomment this line if you want to use Config Caching.
// Exits the application, setting the exit code for CLI-based applications
// that might be watching.
exit(EXIT_SUCCESS);

2
public/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

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