diff --git a/application/.htaccess b/application/.htaccess new file mode 100644 index 0000000..6c63ed4 --- /dev/null +++ b/application/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/application/cache/.htaccess b/application/cache/.htaccess new file mode 100644 index 0000000..6c63ed4 --- /dev/null +++ b/application/cache/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + \ No newline at end of file diff --git a/application/cache/index.html b/application/cache/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/cache/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/config/autoload.php b/application/config/autoload.php new file mode 100644 index 0000000..f939669 --- /dev/null +++ b/application/config/autoload.php @@ -0,0 +1,129 @@ + 'ua'); +*/ +$autoload['libraries'] = array('database', 'twig'); + +/* +| ------------------------------------------------------------------- +| Auto-load Drivers +| ------------------------------------------------------------------- +| These classes are located in system/libraries/ or in your +| application/libraries/ directory, but are also placed inside their +| own subdirectory and they extend the CI_Driver_Library class. They +| offer multiple interchangeable driver options. +| +| Prototype: +| +| $autoload['drivers'] = array('cache'); +*/ +$autoload['drivers'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Helper Files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['helper'] = array('url', 'file'); +*/ +$autoload['helper'] = array('url', 'form', 'inflector'); + +/* +| ------------------------------------------------------------------- +| Auto-load Config files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['config'] = array('config1', 'config2'); +| +| NOTE: This item is intended for use ONLY if you have created custom +| config files. Otherwise, leave it blank. +| +*/ +$autoload['config'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Language files +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['language'] = array('lang1', 'lang2'); +| +| NOTE: Do not include the "_lang" part of your file. For example +| "codeigniter_lang.php" would be referenced as array('codeigniter'); +| +*/ +$autoload['language'] = array(); + +/* +| ------------------------------------------------------------------- +| Auto-load Models +| ------------------------------------------------------------------- +| Prototype: +| +| $autoload['model'] = array('first_model', 'second_model'); +| +| You can also supply an alternative model name to be assigned +| in the controller: +| +| $autoload['model'] = array('first_model' => 'first'); +*/ +$autoload['model'] = array(); diff --git a/application/config/config.php b/application/config/config.php new file mode 100644 index 0000000..1fc83da --- /dev/null +++ b/application/config/config.php @@ -0,0 +1,513 @@ +]+$/i +| +| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!! +| +*/ +$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; + +/* +|-------------------------------------------------------------------------- +| Enable Query Strings +|-------------------------------------------------------------------------- +| +| By default CodeIgniter uses search-engine friendly segment based URLs: +| example.com/who/what/where/ +| +| By default CodeIgniter enables access to the $_GET array. If for some +| reason you would like to disable it, set 'allow_get_array' to FALSE. +| +| You can optionally enable standard query string based URLs: +| example.com?who=me&what=something&where=here +| +| Options are: TRUE or FALSE (boolean) +| +| The other items let you set the query string 'words' that will +| invoke your controllers and its functions: +| example.com/index.php?c=controller&m=function +| +| Please note that some of the helpers won't work as expected when +| this feature is enabled, since CodeIgniter is designed primarily to +| use segment based URLs. +| +*/ +$config['allow_get_array'] = TRUE; +$config['enable_query_strings'] = FALSE; +$config['controller_trigger'] = 'c'; +$config['function_trigger'] = 'm'; +$config['directory_trigger'] = 'd'; + +/* +|-------------------------------------------------------------------------- +| Error Logging Threshold +|-------------------------------------------------------------------------- +| +| You can enable error logging by setting a threshold over zero. The +| threshold determines what gets logged. Threshold options are: +| +| 0 = Disables logging, Error logging TURNED OFF +| 1 = Error Messages (including PHP errors) +| 2 = Debug Messages +| 3 = Informational Messages +| 4 = All Messages +| +| You can also pass an array with threshold levels to show individual error types +| +| array(2) = Debug Messages, without Error Messages +| +| For a live site you'll usually only enable Errors (1) to be logged otherwise +| your log files will fill up very fast. +| +*/ +$config['log_threshold'] = 0; + +/* +|-------------------------------------------------------------------------- +| Error Logging Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/logs/ directory. Use a full server path with trailing slash. +| +*/ +$config['log_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Extension +|-------------------------------------------------------------------------- +| +| The default filename extension for log files. The default 'php' allows for +| protecting the log files via basic scripting, when they are to be stored +| under a publicly accessible directory. +| +| Note: Leaving it blank will default to 'php'. +| +*/ +$config['log_file_extension'] = ''; + +/* +|-------------------------------------------------------------------------- +| Log File Permissions +|-------------------------------------------------------------------------- +| +| The file system permissions to be applied on newly created log files. +| +| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal +| integer notation (i.e. 0700, 0644, etc.) +*/ +$config['log_file_permissions'] = 0644; + +/* +|-------------------------------------------------------------------------- +| Date Format for Logs +|-------------------------------------------------------------------------- +| +| Each item that is logged has an associated date. You can use PHP date +| codes to set your own date formatting +| +*/ +$config['log_date_format'] = 'Y-m-d H:i:s'; + +/* +|-------------------------------------------------------------------------- +| Error Views Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/views/errors/ directory. Use a full server path with trailing slash. +| +*/ +$config['error_views_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/cache/ directory. Use a full server path with trailing slash. +| +*/ +$config['cache_path'] = ''; + +/* +|-------------------------------------------------------------------------- +| Cache Include Query String +|-------------------------------------------------------------------------- +| +| Whether to take the URL query string into consideration when generating +| output cache files. Valid options are: +| +| FALSE = Disabled +| TRUE = Enabled, take all query parameters into account. +| Please be aware that this may result in numerous cache +| files generated for the same page over and over again. +| array('q') = Enabled, but only take into account the specified list +| of query parameters. +| +*/ +$config['cache_query_string'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Encryption Key +|-------------------------------------------------------------------------- +| +| If you use the Encryption class, you must set an encryption key. +| See the user guide for more info. +| +| http://codeigniter.com/user_guide/libraries/encryption.html +| +*/ +$config['encryption_key'] = ''; + +/* +|-------------------------------------------------------------------------- +| Session Variables +|-------------------------------------------------------------------------- +| +| 'sess_driver' +| +| The storage driver to use: files, database, redis, memcached +| +| 'sess_cookie_name' +| +| The session cookie name, must contain only [0-9a-z_-] characters +| +| 'sess_expiration' +| +| The number of SECONDS you want the session to last. +| Setting to 0 (zero) means expire when the browser is closed. +| +| 'sess_save_path' +| +| The location to save sessions to, driver dependent. +| +| For the 'files' driver, it's a path to a writable directory. +| WARNING: Only absolute paths are supported! +| +| For the 'database' driver, it's a table name. +| Please read up the manual for the format with other session drivers. +| +| IMPORTANT: You are REQUIRED to set a valid save path! +| +| 'sess_match_ip' +| +| Whether to match the user's IP address when reading the session data. +| +| WARNING: If you're using the database driver, don't forget to update +| your session table's PRIMARY KEY when changing this setting. +| +| 'sess_time_to_update' +| +| How many seconds between CI regenerating the session ID. +| +| 'sess_regenerate_destroy' +| +| Whether to destroy session data associated with the old session ID +| when auto-regenerating the session ID. When set to FALSE, the data +| will be later deleted by the garbage collector. +| +| Other session cookie settings are shared with the rest of the application, +| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here. +| +*/ +$config['sess_driver'] = 'files'; +$config['sess_cookie_name'] = 'ci_session'; +$config['sess_expiration'] = 7200; +$config['sess_save_path'] = NULL; +$config['sess_match_ip'] = FALSE; +$config['sess_time_to_update'] = 300; +$config['sess_regenerate_destroy'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cookie Related Variables +|-------------------------------------------------------------------------- +| +| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions +| 'cookie_domain' = Set to .your-domain.com for site-wide cookies +| 'cookie_path' = Typically will be a forward slash +| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists. +| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript) +| +| Note: These settings (with the exception of 'cookie_prefix' and +| 'cookie_httponly') will also affect sessions. +| +*/ +$config['cookie_prefix'] = ''; +$config['cookie_domain'] = ''; +$config['cookie_path'] = '/'; +$config['cookie_secure'] = FALSE; +$config['cookie_httponly'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Standardize newlines +|-------------------------------------------------------------------------- +| +| Determines whether to standardize newline characters in input data, +| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value. +| +| This is particularly useful for portability between UNIX-based OSes, +| (usually \n) and Windows (\r\n). +| +*/ +$config['standardize_newlines'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Global XSS Filtering +|-------------------------------------------------------------------------- +| +| Determines whether the XSS filter is always active when GET, POST or +| COOKIE data is encountered +| +| WARNING: This feature is DEPRECATED and currently available only +| for backwards compatibility purposes! +| +*/ +$config['global_xss_filtering'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Cross Site Request Forgery +|-------------------------------------------------------------------------- +| Enables a CSRF cookie token to be set. When set to TRUE, token will be +| checked on a submitted form. If you are accepting user data, it is strongly +| recommended CSRF protection be enabled. +| +| 'csrf_token_name' = The token name +| 'csrf_cookie_name' = The cookie name +| 'csrf_expire' = The number in seconds the token should expire. +| 'csrf_regenerate' = Regenerate token on every submission +| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks +*/ +$config['csrf_protection'] = FALSE; +$config['csrf_token_name'] = 'csrf_test_name'; +$config['csrf_cookie_name'] = 'csrf_cookie_name'; +$config['csrf_expire'] = 7200; +$config['csrf_regenerate'] = TRUE; +$config['csrf_exclude_uris'] = array(); + +/* +|-------------------------------------------------------------------------- +| Output Compression +|-------------------------------------------------------------------------- +| +| Enables Gzip output compression for faster page loads. When enabled, +| the output class will test whether your server supports Gzip. +| Even if it does, however, not all browsers support compression +| so enable only if you are reasonably sure your visitors can handle it. +| +| Only used if zlib.output_compression is turned off in your php.ini. +| Please do not use it together with httpd-level output compression. +| +| VERY IMPORTANT: If you are getting a blank page when compression is enabled it +| means you are prematurely outputting something to your browser. It could +| even be a line of whitespace at the end of one of your scripts. For +| compression to work, nothing can be sent before the output buffer is called +| by the output class. Do not 'echo' any values with compression enabled. +| +*/ +$config['compress_output'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Master Time Reference +|-------------------------------------------------------------------------- +| +| Options are 'local' or any PHP supported timezone. This preference tells +| the system whether to use your server's local time as the master 'now' +| reference, or convert it to the configured one timezone. See the 'date +| helper' page of the user guide for information regarding date handling. +| +*/ +$config['time_reference'] = 'local'; + +/* +|-------------------------------------------------------------------------- +| Rewrite PHP Short Tags +|-------------------------------------------------------------------------- +| +| If your PHP installation does not have short tag support enabled CI +| can rewrite the tags on-the-fly, enabling you to utilize that syntax +| in your view files. Options are TRUE or FALSE (boolean) +| +| Note: You need to have eval() enabled for this to work. +| +*/ +$config['rewrite_short_tags'] = FALSE; + +/* +|-------------------------------------------------------------------------- +| Reverse Proxy IPs +|-------------------------------------------------------------------------- +| +| If your server is behind a reverse proxy, you must whitelist the proxy +| IP addresses from which CodeIgniter should trust headers such as +| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify +| the visitor's IP address. +| +| You can use both an array or a comma-separated list of proxy addresses, +| as well as specifying whole subnets. Here are a few examples: +| +| Comma-separated: '10.0.1.200,192.168.5.0/24' +| Array: array('10.0.1.200', '192.168.5.0/24') +*/ +$config['proxy_ips'] = ''; diff --git a/application/config/constants.php b/application/config/constants.php new file mode 100644 index 0000000..e8d2c00 --- /dev/null +++ b/application/config/constants.php @@ -0,0 +1,85 @@ +db->last_query() and profiling of DB queries. +| When you run a query, with this setting set to TRUE (default), +| CodeIgniter will store the SQL statement for debugging purposes. +| However, this may cause high memory usage, especially if you run +| a lot of SQL queries ... disable this to avoid that problem. +| +| The $active_group variable lets you choose which connection group to +| make active. By default there is only one group (the 'default' group). +| +| The $query_builder variables lets you determine whether or not to load +| the query builder class. +*/ +$active_group = 'default'; +$query_builder = TRUE; + +$db['default'] = array( + 'dsn' => '', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => '', + 'database' => 'ci3hmvc', + 'dbdriver' => 'mysqli', + 'dbprefix' => '', + 'pconnect' => FALSE, + 'db_debug' => (ENVIRONMENT !== 'production'), + 'cache_on' => FALSE, + 'cachedir' => '', + 'char_set' => 'utf8', + 'dbcollat' => 'utf8_general_ci', + 'swap_pre' => '', + 'encrypt' => FALSE, + 'compress' => FALSE, + 'stricton' => FALSE, + 'failover' => array(), + 'save_queries' => TRUE +); diff --git a/application/config/doctypes.php b/application/config/doctypes.php new file mode 100644 index 0000000..59a7991 --- /dev/null +++ b/application/config/doctypes.php @@ -0,0 +1,24 @@ + '', + 'xhtml1-strict' => '', + 'xhtml1-trans' => '', + 'xhtml1-frame' => '', + 'xhtml-basic11' => '', + 'html5' => '', + 'html4-strict' => '', + 'html4-trans' => '', + 'html4-frame' => '', + 'mathml1' => '', + 'mathml2' => '', + 'svg10' => '', + 'svg11' => '', + 'svg11-basic' => '', + 'svg11-tiny' => '', + 'xhtml-math-svg-xh' => '', + 'xhtml-math-svg-sh' => '', + 'xhtml-rdfa-1' => '', + 'xhtml-rdfa-2' => '' +); diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php new file mode 100644 index 0000000..ac406e3 --- /dev/null +++ b/application/config/foreign_chars.php @@ -0,0 +1,103 @@ + 'ae', + '/ö|œ/' => 'oe', + '/ü/' => 'ue', + '/Ä/' => 'Ae', + '/Ü/' => 'Ue', + '/Ö/' => 'Oe', + '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A', + '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a', + '/Б/' => 'B', + '/б/' => 'b', + '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', + '/ç|ć|ĉ|ċ|č/' => 'c', + '/Д/' => 'D', + '/д/' => 'd', + '/Ð|Ď|Đ|Δ/' => 'Dj', + '/ð|ď|đ|δ/' => 'dj', + '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e', + '/Ф/' => 'F', + '/ф/' => 'f', + '/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G', + '/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g', + '/Ĥ|Ħ/' => 'H', + '/ĥ|ħ/' => 'h', + '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I', + '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i', + '/Ĵ/' => 'J', + '/ĵ/' => 'j', + '/Ķ|Κ|К/' => 'K', + '/ķ|κ|к/' => 'k', + '/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L', + '/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l', + '/М/' => 'M', + '/м/' => 'm', + '/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N', + '/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n', + '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O', + '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o', + '/П/' => 'P', + '/п/' => 'p', + '/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R', + '/ŕ|ŗ|ř|ρ|р/' => 'r', + '/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S', + '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', + '/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T', + '/ț|ţ|ť|ŧ|т/' => 't', + '/Þ|þ/' => 'th', + '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', + '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', + '/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y', + '/ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y', + '/В/' => 'V', + '/в/' => 'v', + '/Ŵ/' => 'W', + '/ŵ/' => 'w', + '/Ź|Ż|Ž|Ζ|З/' => 'Z', + '/ź|ż|ž|ζ|з/' => 'z', + '/Æ|Ǽ/' => 'AE', + '/ß/' => 'ss', + '/IJ/' => 'IJ', + '/ij/' => 'ij', + '/Œ/' => 'OE', + '/ƒ/' => 'f', + '/ξ/' => 'ks', + '/π/' => 'p', + '/β/' => 'v', + '/μ/' => 'm', + '/ψ/' => 'ps', + '/Ё/' => 'Yo', + '/ё/' => 'yo', + '/Є/' => 'Ye', + '/є/' => 'ye', + '/Ї/' => 'Yi', + '/Ж/' => 'Zh', + '/ж/' => 'zh', + '/Х/' => 'Kh', + '/х/' => 'kh', + '/Ц/' => 'Ts', + '/ц/' => 'ts', + '/Ч/' => 'Ch', + '/ч/' => 'ch', + '/Ш/' => 'Sh', + '/ш/' => 'sh', + '/Щ/' => 'Shch', + '/щ/' => 'shch', + '/Ъ|ъ|Ь|ь/' => '', + '/Ю/' => 'Yu', + '/ю/' => 'yu', + '/Я/' => 'Ya', + '/я/' => 'ya' +); diff --git a/application/config/hooks.php b/application/config/hooks.php new file mode 100644 index 0000000..2eac5bb --- /dev/null +++ b/application/config/hooks.php @@ -0,0 +1,13 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/config/memcached.php b/application/config/memcached.php new file mode 100644 index 0000000..55949a6 --- /dev/null +++ b/application/config/memcached.php @@ -0,0 +1,19 @@ + array( + 'hostname' => '127.0.0.1', + 'port' => '11211', + 'weight' => '1', + ), +); diff --git a/application/config/migration.php b/application/config/migration.php new file mode 100644 index 0000000..4b585a6 --- /dev/null +++ b/application/config/migration.php @@ -0,0 +1,84 @@ +migration->current() this is the version that schema will +| be upgraded / downgraded to. +| +*/ +$config['migration_version'] = 0; + +/* +|-------------------------------------------------------------------------- +| Migrations Path +|-------------------------------------------------------------------------- +| +| Path to your migrations folder. +| Typically, it will be within your application path. +| Also, writing permission is required within the migrations path. +| +*/ +$config['migration_path'] = APPPATH.'migrations/'; diff --git a/application/config/mimes.php b/application/config/mimes.php new file mode 100644 index 0000000..1f591ba --- /dev/null +++ b/application/config/mimes.php @@ -0,0 +1,158 @@ + array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'), + 'cpt' => 'application/mac-compactpro', + 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'), + 'bin' => array('application/macbinary', 'application/mac-binary', 'application/octet-stream', 'application/x-binary', 'application/x-macbinary'), + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => array('application/octet-stream', 'application/x-msdownload'), + 'class' => 'application/octet-stream', + 'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'), + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'), + 'ai' => array('application/pdf', 'application/postscript'), + 'eps' => 'application/postscript', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => array('application/vnd.ms-excel', 'application/msexcel', 'application/x-msexcel', 'application/x-ms-excel', 'application/x-excel', 'application/x-dos_ms_excel', 'application/xls', 'application/x-xls', 'application/excel', 'application/download', 'application/vnd.ms-office', 'application/msword'), + 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'), + 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'), + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source'), + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => array('application/x-javascript', 'text/plain'), + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'), + 'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'), + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), + 'aif' => array('audio/x-aiff', 'audio/aiff'), + 'aiff' => array('audio/x-aiff', 'audio/aiff'), + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), + 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'), + 'gif' => 'image/gif', + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'png' => array('image/png', 'image/x-png'), + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'css' => array('text/css', 'text/plain'), + 'html' => array('text/html', 'text/plain'), + 'htm' => array('text/html', 'text/plain'), + 'shtml' => array('text/html', 'text/plain'), + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => array('text/plain', 'text/x-log'), + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => array('application/xml', 'text/xml', 'text/plain'), + 'xsl' => array('application/xml', 'text/xsl', 'text/xml'), + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'), + 'movie' => 'video/x-sgi-movie', + 'doc' => array('application/msword', 'application/vnd.ms-office'), + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'), + 'dot' => array('application/msword', 'application/vnd.ms-office'), + 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'), + 'word' => array('application/msword', 'application/octet-stream'), + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => array('application/json', 'text/json'), + 'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'), + 'p10' => array('application/x-pkcs10', 'application/pkcs10'), + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'), + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'), + 'crl' => array('application/pkix-crl', 'application/pkcs-crl'), + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), + '3g2' => 'video/3gpp2', + '3gp' => array('video/3gp', 'video/3gpp'), + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => 'video/mp4', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'), + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => 'audio/ogg', + 'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'), + 'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'), + 'ics' => 'text/calendar', + 'ical' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => array('application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'), + 'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'), + 'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'), + 'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'), + 'svg' => array('image/svg+xml', 'application/xml', 'text/xml'), + 'vcf' => 'text/x-vcard', + 'srt' => array('text/srt', 'text/plain'), + 'vtt' => array('text/vtt', 'text/plain'), + 'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon') +); diff --git a/application/config/profiler.php b/application/config/profiler.php new file mode 100644 index 0000000..b30204e --- /dev/null +++ b/application/config/profiler.php @@ -0,0 +1,14 @@ + my_controller/index +| my-controller/my-method -> my_controller/my_method +*/ +$route['default_controller'] = 'welcome'; +$route['404_override'] = ''; +$route['translate_uri_dashes'] = FALSE; diff --git a/application/config/smileys.php b/application/config/smileys.php new file mode 100644 index 0000000..1eeba47 --- /dev/null +++ b/application/config/smileys.php @@ -0,0 +1,64 @@ + array('grin.gif', '19', '19', 'grin'), + ':lol:' => array('lol.gif', '19', '19', 'LOL'), + ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), + ':)' => array('smile.gif', '19', '19', 'smile'), + ';-)' => array('wink.gif', '19', '19', 'wink'), + ';)' => array('wink.gif', '19', '19', 'wink'), + ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), + ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), + ':-S' => array('confused.gif', '19', '19', 'confused'), + ':wow:' => array('surprise.gif', '19', '19', 'surprised'), + ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), + ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), + '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), + ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), + ':P' => array('raspberry.gif', '19', '19', 'raspberry'), + ':blank:' => array('blank.gif', '19', '19', 'blank stare'), + ':long:' => array('longface.gif', '19', '19', 'long face'), + ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), + ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), + ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), + '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), + ':down:' => array('downer.gif', '19', '19', 'downer'), + ':red:' => array('embarrassed.gif', '19', '19', 'red face'), + ':sick:' => array('sick.gif', '19', '19', 'sick'), + ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), + ':-/' => array('hmm.gif', '19', '19', 'hmmm'), + '>:(' => array('mad.gif', '19', '19', 'mad'), + ':mad:' => array('mad.gif', '19', '19', 'mad'), + '>:-(' => array('angry.gif', '19', '19', 'angry'), + ':angry:' => array('angry.gif', '19', '19', 'angry'), + ':zip:' => array('zip.gif', '19', '19', 'zipper'), + ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), + ':ahhh:' => array('shock.gif', '19', '19', 'shock'), + ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), + ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), + ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), + ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), + ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), + ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), + ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), + ':snake:' => array('snake.gif', '19', '19', 'snake'), + ':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'), + ':question:' => array('question.gif', '19', '19', 'question') + +); diff --git a/application/config/user_agents.php b/application/config/user_agents.php new file mode 100644 index 0000000..1129dba --- /dev/null +++ b/application/config/user_agents.php @@ -0,0 +1,211 @@ + 'Windows 10', + 'windows nt 6.3' => 'Windows 8.1', + 'windows nt 6.2' => 'Windows 8', + 'windows nt 6.1' => 'Windows 7', + 'windows nt 6.0' => 'Windows Vista', + 'windows nt 5.2' => 'Windows 2003', + 'windows nt 5.1' => 'Windows XP', + 'windows nt 5.0' => 'Windows 2000', + 'windows nt 4.0' => 'Windows NT 4.0', + 'winnt4.0' => 'Windows NT 4.0', + 'winnt 4.0' => 'Windows NT', + 'winnt' => 'Windows NT', + 'windows 98' => 'Windows 98', + 'win98' => 'Windows 98', + 'windows 95' => 'Windows 95', + 'win95' => 'Windows 95', + 'windows phone' => 'Windows Phone', + 'windows' => 'Unknown Windows OS', + 'android' => 'Android', + 'blackberry' => 'BlackBerry', + 'iphone' => 'iOS', + 'ipad' => 'iOS', + 'ipod' => 'iOS', + 'os x' => 'Mac OS X', + 'ppc mac' => 'Power PC Mac', + 'freebsd' => 'FreeBSD', + 'ppc' => 'Macintosh', + 'linux' => 'Linux', + 'debian' => 'Debian', + 'sunos' => 'Sun Solaris', + 'beos' => 'BeOS', + 'apachebench' => 'ApacheBench', + 'aix' => 'AIX', + 'irix' => 'Irix', + 'osf' => 'DEC OSF', + 'hp-ux' => 'HP-UX', + 'netbsd' => 'NetBSD', + 'bsdi' => 'BSDi', + 'openbsd' => 'OpenBSD', + 'gnu' => 'GNU/Linux', + 'unix' => 'Unknown Unix OS', + 'symbian' => 'Symbian OS' +); + + +// The order of this array should NOT be changed. Many browsers return +// multiple browser types so we want to identify the sub-type first. +$browsers = array( + 'OPR' => 'Opera', + 'Flock' => 'Flock', + 'Edge' => 'Spartan', + 'Chrome' => 'Chrome', + // Opera 10+ always reports Opera/9.80 and appends Version/ to the user agent string + 'Opera.*?Version' => 'Opera', + 'Opera' => 'Opera', + 'MSIE' => 'Internet Explorer', + 'Internet Explorer' => 'Internet Explorer', + 'Trident.* rv' => 'Internet Explorer', + 'Shiira' => 'Shiira', + 'Firefox' => 'Firefox', + 'Chimera' => 'Chimera', + 'Phoenix' => 'Phoenix', + 'Firebird' => 'Firebird', + 'Camino' => 'Camino', + 'Netscape' => 'Netscape', + 'OmniWeb' => 'OmniWeb', + 'Safari' => 'Safari', + 'Mozilla' => 'Mozilla', + 'Konqueror' => 'Konqueror', + 'icab' => 'iCab', + 'Lynx' => 'Lynx', + 'Links' => 'Links', + 'hotjava' => 'HotJava', + 'amaya' => 'Amaya', + 'IBrowse' => 'IBrowse', + 'Maxthon' => 'Maxthon', + 'Ubuntu' => 'Ubuntu Web Browser' +); + +$mobiles = array( + // legacy array, old values commented out + 'mobileexplorer' => 'Mobile Explorer', +// 'openwave' => 'Open Wave', +// 'opera mini' => 'Opera Mini', +// 'operamini' => 'Opera Mini', +// 'elaine' => 'Palm', + 'palmsource' => 'Palm', +// 'digital paths' => 'Palm', +// 'avantgo' => 'Avantgo', +// 'xiino' => 'Xiino', + 'palmscape' => 'Palmscape', +// 'nokia' => 'Nokia', +// 'ericsson' => 'Ericsson', +// 'blackberry' => 'BlackBerry', +// 'motorola' => 'Motorola' + + // Phones and Manufacturers + 'motorola' => 'Motorola', + 'nokia' => 'Nokia', + 'palm' => 'Palm', + 'iphone' => 'Apple iPhone', + 'ipad' => 'iPad', + 'ipod' => 'Apple iPod Touch', + 'sony' => 'Sony Ericsson', + 'ericsson' => 'Sony Ericsson', + 'blackberry' => 'BlackBerry', + 'cocoon' => 'O2 Cocoon', + 'blazer' => 'Treo', + 'lg' => 'LG', + 'amoi' => 'Amoi', + 'xda' => 'XDA', + 'mda' => 'MDA', + 'vario' => 'Vario', + 'htc' => 'HTC', + 'samsung' => 'Samsung', + 'sharp' => 'Sharp', + 'sie-' => 'Siemens', + 'alcatel' => 'Alcatel', + 'benq' => 'BenQ', + 'ipaq' => 'HP iPaq', + 'mot-' => 'Motorola', + 'playstation portable' => 'PlayStation Portable', + 'playstation 3' => 'PlayStation 3', + 'playstation vita' => 'PlayStation Vita', + 'hiptop' => 'Danger Hiptop', + 'nec-' => 'NEC', + 'panasonic' => 'Panasonic', + 'philips' => 'Philips', + 'sagem' => 'Sagem', + 'sanyo' => 'Sanyo', + 'spv' => 'SPV', + 'zte' => 'ZTE', + 'sendo' => 'Sendo', + 'nintendo dsi' => 'Nintendo DSi', + 'nintendo ds' => 'Nintendo DS', + 'nintendo 3ds' => 'Nintendo 3DS', + 'wii' => 'Nintendo Wii', + 'open web' => 'Open Web', + 'openweb' => 'OpenWeb', + + // Operating Systems + 'android' => 'Android', + 'symbian' => 'Symbian', + 'SymbianOS' => 'SymbianOS', + 'elaine' => 'Palm', + 'series60' => 'Symbian S60', + 'windows ce' => 'Windows CE', + + // Browsers + 'obigo' => 'Obigo', + 'netfront' => 'Netfront Browser', + 'openwave' => 'Openwave Browser', + 'mobilexplorer' => 'Mobile Explorer', + 'operamini' => 'Opera Mini', + 'opera mini' => 'Opera Mini', + 'opera mobi' => 'Opera Mobile', + 'fennec' => 'Firefox Mobile', + + // Other + 'digital paths' => 'Digital Paths', + 'avantgo' => 'AvantGo', + 'xiino' => 'Xiino', + 'novarra' => 'Novarra Transcoder', + 'vodafone' => 'Vodafone', + 'docomo' => 'NTT DoCoMo', + 'o2' => 'O2', + + // Fallback + 'mobile' => 'Generic Mobile', + 'wireless' => 'Generic Mobile', + 'j2me' => 'Generic Mobile', + 'midp' => 'Generic Mobile', + 'cldc' => 'Generic Mobile', + 'up.link' => 'Generic Mobile', + 'up.browser' => 'Generic Mobile', + 'smartphone' => 'Generic Mobile', + 'cellphone' => 'Generic Mobile' +); + +// There are hundreds of bots but these are the most common. +$robots = array( + 'googlebot' => 'Googlebot', + 'msnbot' => 'MSNBot', + 'baiduspider' => 'Baiduspider', + 'bingbot' => 'Bing', + 'slurp' => 'Inktomi Slurp', + 'yahoo' => 'Yahoo', + 'ask jeeves' => 'Ask Jeeves', + 'fastcrawler' => 'FastCrawler', + 'infoseek' => 'InfoSeek Robot 1.0', + 'lycos' => 'Lycos', + 'yandex' => 'YandexBot', + 'mediapartners-google' => 'MediaPartners Google', + 'CRAZYWEBCRAWLER' => 'Crazy Webcrawler', + 'adsbot-google' => 'AdsBot Google', + 'feedfetcher-google' => 'Feedfetcher Google', + 'curious george' => 'Curious George' +); diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php new file mode 100644 index 0000000..256c63b --- /dev/null +++ b/application/controllers/Welcome.php @@ -0,0 +1,34 @@ + + * @see http://codeigniter.com/user_guide/general/urls.html + */ + public function __construct() + { + parent::__construct(); + $this->load->model('welcome_model', 'm'); + } + + public function index() + { + $data['contact'] = $this->m->get_all(); + $this->twig->display('welcome_message', $data); + } +} + +/* End of file welcome.php */ +/* Location: ./application/controllers/welcome.php */ \ No newline at end of file diff --git a/application/controllers/index.html b/application/controllers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/controllers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/core/MY_Loader.php b/application/core/MY_Loader.php new file mode 100644 index 0000000..2fefd3d --- /dev/null +++ b/application/core/MY_Loader.php @@ -0,0 +1,6 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/helpers/index.html b/application/helpers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/helpers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/hooks/index.html b/application/hooks/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/hooks/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/index.html b/application/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/language/english/index.html b/application/language/english/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/language/english/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/language/index.html b/application/language/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/language/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/libraries/Doctrine.php b/application/libraries/Doctrine.php new file mode 100644 index 0000000..7adfe05 --- /dev/null +++ b/application/libraries/Doctrine.php @@ -0,0 +1,61 @@ +register(); + + // Set up caches + $config = new Configuration; + $cache = new ArrayCache; + $config->setMetadataCacheImpl($cache); + $driverImpl = $config->newDefaultAnnotationDriver(array(APPPATH.'models/Entities'), FALSE); + $config->setMetadataDriverImpl($driverImpl); + $config->setQueryCacheImpl($cache); + + $config->setQueryCacheImpl($cache); + + // Proxy configuration + $config->setProxyDir(APPPATH.'/models/proxies'); + $config->setProxyNamespace('Proxies'); + + // Set up logger + $logger = new EchoSQLLogger; + $config->setSQLLogger($logger); + + $config->setAutoGenerateProxyClasses( TRUE ); + + // Database connection information + $connectionOptions = array( + 'driver' => 'pdo_mysql', + 'user' => 'root', + 'password' => '', + 'host' => 'localhost', + 'dbname' => 'ci3hmvc' + ); + + // Create EntityManager + $this->em = EntityManager::create($connectionOptions, $config); + } +} \ No newline at end of file diff --git a/application/libraries/Twig.php b/application/libraries/Twig.php new file mode 100644 index 0000000..3971ede --- /dev/null +++ b/application/libraries/Twig.php @@ -0,0 +1,213 @@ +CI =& get_instance(); + + // default config + $this->config = [ + 'paths' => APPPATH.'modules/'.$this->CI->router->fetch_module().'/views/', + 'cache' => APPPATH . '/cache/twig', + ]; + + $this->config = array_merge($this->config, $params); + } + + protected function resetTwig() + { + $this->twig = null; + $this->createTwig(); + } + + protected function createTwig() + { + // $this->twig is singleton + if ($this->twig !== null) + { + return; + } + + if (ENVIRONMENT === 'production') + { + $debug = FALSE; + } + else + { + $debug = TRUE; + } + + if ($this->loader === null) + { + $this->loader = new \Twig_Loader_Filesystem($this->config['paths']); + } + + $twig = new \Twig_Environment($this->loader, [ + 'cache' => $this->config['cache'], + 'debug' => $debug, + 'autoescape' => TRUE, + ]); + + if ($debug) + { + $twig->addExtension(new \Twig_Extension_Debug()); + } + + $this->twig = $twig; + } + + protected function setLoader($loader) + { + $this->loader = $loader; + } + + /** + * Registers a Global + * + * @param string $name The global name + * @param mixed $value The global value + */ + public function addGlobal($name, $value) + { + $this->createTwig(); + $this->twig->addGlobal($name, $value); + } + + /** + * Renders Twig Template and Set Output + * + * @param string $view Template filename without `.twig` + * @param array $params Array of parameters to pass to the template + */ + public function display($view, $params = []) + { + $CI =& get_instance(); + $CI->output->set_output($this->render($view, $params)); + } + + /** + * Renders Twig Template and Returns as String + * + * @param string $view Template filename without `.twig` + * @param array $params Array of parameters to pass to the template + * @return string + */ + public function render($view, $params = []) + { + $this->createTwig(); + // We call addCIFunctions() here, because we must call addCIFunctions() + // after loading CodeIgniter functions in a controller. + $this->addCIFunctions(); + + $view = $view . '.twig'; + return $this->twig->render($view, $params); + } + + protected function addCIFunctions() + { + // Runs only once + if ($this->add_ci_functions) + { + return; + } + + // as is functions + foreach ($this->functions_asis as $function) + { + if (function_exists($function)) + { + $this->twig->addFunction( + new \Twig_SimpleFunction( + $function, + $function + ) + ); + } + } + + // safe functions + foreach ($this->functions_safe as $function) + { + if (function_exists($function)) + { + $this->twig->addFunction( + new \Twig_SimpleFunction( + $function, + $function, + ['is_safe' => ['html']] + ) + ); + } + } + + // customized functions + if (function_exists('anchor')) + { + $this->twig->addFunction( + new \Twig_SimpleFunction( + 'anchor', + [$this, 'safe_anchor'], + ['is_safe' => ['html']] + ) + ); + } + + $this->add_ci_functions = TRUE; + } + + /** + * @param string $uri + * @param string $title + * @param array $attributes [changed] only array is acceptable + * @return string + */ + protected function safe_anchor($uri = '', $title = '', $attributes = []) + { + $uri = html_escape($uri); + $title = html_escape($title); + + $new_attr = []; + foreach ($attributes as $key => $val) + { + $new_attr[html_escape($key)] = html_escape($val); + } + + return anchor($uri, $title, $new_attr); + } + + /** + * @return \Twig_Environment + */ + public function getTwig() + { + $this->createTwig(); + return $this->twig; + } +} diff --git a/application/libraries/index.html b/application/libraries/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/libraries/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/logs/index.html b/application/logs/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/logs/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/models/Entities/EntityUser.php b/application/models/Entities/EntityUser.php new file mode 100644 index 0000000..e043d2c --- /dev/null +++ b/application/models/Entities/EntityUser.php @@ -0,0 +1,128 @@ +id; + } + + /** + * Set name + * + * @param string $name + * + * @return User + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set email + * + * @param string $email + * + * @return User + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Set address + * + * @param string $address + * + * @return User + */ + public function setAddress($address) + { + $this->address = $address; + + return $this; + } + + /** + * Get address + * + * @return string + */ + public function getAddress() + { + return $this->address; + } +} diff --git a/application/models/Entities/EntityUser.php.ok b/application/models/Entities/EntityUser.php.ok new file mode 100644 index 0000000..6ff1fe5 --- /dev/null +++ b/application/models/Entities/EntityUser.php.ok @@ -0,0 +1,129 @@ +id; + } + + /** + * Set name + * + * @param string $name + * + * @return User + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set email + * + * @param string $email + * + * @return User + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Set address + * + * @param string $address + * + * @return User + */ + public function setAddress($address) + { + $this->address = $address; + + return $this; + } + + /** + * Get address + * + * @return string + */ + public function getAddress() + { + return $this->address; + } +} diff --git a/application/models/Entities/Products.php b/application/models/Entities/Products.php new file mode 100644 index 0000000..ebaf3a1 --- /dev/null +++ b/application/models/Entities/Products.php @@ -0,0 +1,66 @@ +id; + } + + /** + * Set name + * + * @param string $name + * + * @return Products + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } +} diff --git a/application/models/Welcome_model.php b/application/models/Welcome_model.php new file mode 100644 index 0000000..65ed608 --- /dev/null +++ b/application/models/Welcome_model.php @@ -0,0 +1,20 @@ +'test1', 'b'=>'test2'); + return $data; + } +} \ No newline at end of file diff --git a/application/models/index.html b/application/models/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/models/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/index.html b/application/modules/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/user/controllers/User.php b/application/modules/user/controllers/User.php new file mode 100644 index 0000000..8bbc3b7 --- /dev/null +++ b/application/modules/user/controllers/User.php @@ -0,0 +1,39 @@ +load->library('doctrine'); + $this->load->model('user_model'); + } + + public function index() + { + $data['user'] = $this->user_model->get_all(); + echo "test ok"; + + $this->load->view('user', $data); + } + + public function add() + { + $this->user_model->add_user('Eka', 'sri.ikhwati@gmail.com', 'Jepara'); + } + + public function get() + { + $data['user'] = $this->user_model->get_single(1); + } +} + +/* End of file User.php */ +/* Location: ./application/modules/user/controllers/User.php */ \ No newline at end of file diff --git a/application/modules/user/controllers/index.html b/application/modules/user/controllers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/user/controllers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/user/index.html b/application/modules/user/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/user/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/user/models/User_model.php b/application/modules/user/models/User_model.php new file mode 100644 index 0000000..1f2d76d --- /dev/null +++ b/application/modules/user/models/User_model.php @@ -0,0 +1,74 @@ +em = $this->doctrine->em; + } + + /*public function get_all() + { + $data = array('a'=>'test1', 'b'=>'test2'); + return $data; + }*/ + + function get_single($id) + { + try + { + $usr = $this->em->find("EntityUser",$id); + return $usr; + } + catch(Exception $err) + { + return NULL; + } + } + + function get_all() + { + try + { + $usr = $this->em->getRepository("EntityUser")->findAll(); + return $usr; + } + catch(Exception $err) + { + return NULL; + } + } + + function add_user($name, $email, $address) + { + $us = new EntityUser(); + $us->setName($name); + $us->setEmail($email); + $us->setAddress($address); + + try { + //save to database + $this->em->persist($us); + $this->em->flush(); + } + catch(Exception $err){ + + die($err->getMessage()); + } + return true; + } +} + +/* End of file user_model.php */ +/* Location: ./application/modules/user/models/User_model.php */ \ No newline at end of file diff --git a/application/modules/user/models/index.html b/application/modules/user/models/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/user/models/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/user/views/index.html b/application/modules/user/views/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/user/views/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/user/views/user.php b/application/modules/user/views/user.php new file mode 100644 index 0000000..39b5492 --- /dev/null +++ b/application/modules/user/views/user.php @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/application/modules/welcome/controllers/Welcome.php b/application/modules/welcome/controllers/Welcome.php new file mode 100644 index 0000000..ab6ab91 --- /dev/null +++ b/application/modules/welcome/controllers/Welcome.php @@ -0,0 +1,32 @@ + + * @see https://codeigniter.com/user_guide/general/urls.html + */ + public function __construct() + { + parent::__construct(); + } + + public function index() + { + $data = array('name'=>'dandi', 'company'=>'redbuzz.co.id'); + $this->twig->display('welcome', $data); + + } +} diff --git a/application/modules/welcome/controllers/index.html b/application/modules/welcome/controllers/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/welcome/controllers/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/welcome/models/index.html b/application/modules/welcome/models/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/welcome/models/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/welcome/views/index.html b/application/modules/welcome/views/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/modules/welcome/views/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/modules/welcome/views/welcome.twig b/application/modules/welcome/views/welcome.twig new file mode 100644 index 0000000..f1e6399 --- /dev/null +++ b/application/modules/welcome/views/welcome.twig @@ -0,0 +1,4 @@ +
+

SUCCESS!

+

by {{ name }}@{{ company }}

+
diff --git a/application/modules/welcome/views/welcome_message.php b/application/modules/welcome/views/welcome_message.php new file mode 100644 index 0000000..f511563 --- /dev/null +++ b/application/modules/welcome/views/welcome_message.php @@ -0,0 +1,89 @@ + + + + + Welcome to CodeIgniter + + + + + +
+

Welcome to CodeIgniter!

+ +
+

The page you are looking at is being generated dynamically by CodeIgniter.

+ +

If you would like to edit this page you'll find it located at:

+ application/views/welcome_message.php + +

The corresponding controller for this page is found at:

+ application/controllers/Welcome.php + +

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

+
+ + +
+ + + \ No newline at end of file diff --git a/application/third_party/MX/Base.php b/application/third_party/MX/Base.php new file mode 100644 index 0000000..4c19ef5 --- /dev/null +++ b/application/third_party/MX/Base.php @@ -0,0 +1,60 @@ +is_loaded, TRUE)) return $this->item($file); + + $_module OR $_module = CI::$APP->router->fetch_module(); + list($path, $file) = Modules::find($file, $_module, 'config/'); + + if ($path === FALSE) + { + parent::load($file, $use_sections, $fail_gracefully); + return $this->item($file); + } + + if ($config = Modules::load_file($file, $path, 'config')) + { + /* reference to the config array */ + $current_config =& $this->config; + + if ($use_sections === TRUE) + { + if (isset($current_config[$file])) + { + $current_config[$file] = array_merge($current_config[$file], $config); + } + else + { + $current_config[$file] = $config; + } + + } + else + { + $current_config = array_merge($current_config, $config); + } + + $this->is_loaded[] = $file; + unset($config); + return $this->item($file); + } + } +} \ No newline at end of file diff --git a/application/third_party/MX/Controller.php b/application/third_party/MX/Controller.php new file mode 100644 index 0000000..c176dd6 --- /dev/null +++ b/application/third_party/MX/Controller.php @@ -0,0 +1,61 @@ +config->item('controller_suffix'), '', get_class($this)); + log_message('debug', $class." MX_Controller Initialized"); + Modules::$registry[strtolower($class)] = $this; + + /* copy a loader instance and initialize */ + $this->load = clone load_class('Loader'); + $this->load->initialize($this); + + /* autoload module items */ + $this->load->_autoloader($this->autoload); + } + + public function __get($class) + { + return CI::$APP->$class; + } +} \ No newline at end of file diff --git a/application/third_party/MX/Lang.php b/application/third_party/MX/Lang.php new file mode 100644 index 0000000..e33bd4c --- /dev/null +++ b/application/third_party/MX/Lang.php @@ -0,0 +1,73 @@ +load($_lang); + return $this->language; + } + + $deft_lang = CI::$APP->config->item('language'); + $idiom = ($lang == '') ? $deft_lang : $lang; + + if (in_array($langfile.'_lang'.EXT, $this->is_loaded, TRUE)) + return $this->language; + + $_module OR $_module = CI::$APP->router->fetch_module(); + list($path, $_langfile) = Modules::find($langfile.'_lang', $_module, 'language/'.$idiom.'/'); + + if ($path === FALSE) + { + if ($lang = parent::load($langfile, $lang, $return, $add_suffix, $alt_path)) return $lang; + + } + else + { + if($lang = Modules::load_file($_langfile, $path, 'lang')) + { + if ($return) return $lang; + $this->language = array_merge($this->language, $lang); + $this->is_loaded[] = $langfile.'_lang'.EXT; + unset($lang); + } + } + + return $this->language; + } +} \ No newline at end of file diff --git a/application/third_party/MX/Loader.php b/application/third_party/MX/Loader.php new file mode 100644 index 0000000..6f45b64 --- /dev/null +++ b/application/third_party/MX/Loader.php @@ -0,0 +1,481 @@ +_module = CI::$APP->router->fetch_module(); + + if ($controller instanceof MX_Controller) + { + /* reference to the module controller */ + $this->controller = $controller; + + /* references to ci loader variables */ + foreach (get_class_vars('CI_Loader') as $var => $val) + { + if ($var != '_ci_ob_level') + { + $this->$var =& CI::$APP->load->$var; + } + } + } + else + { + parent::initialize(); + + /* autoload module items */ + $this->_autoloader(array()); + } + + /* add this module path to the loader variables */ + $this->_add_module_paths($this->_module); + } + + /** Add a module path loader variables **/ + public function _add_module_paths($module = '') + { + if (empty($module)) return; + + foreach (Modules::$locations as $location => $offset) + { + /* only add a module path if it exists */ + if (is_dir($module_path = $location.$module.'/') && ! in_array($module_path, $this->_ci_model_paths)) + { + array_unshift($this->_ci_model_paths, $module_path); + } + } + } + + /** Load a module config file **/ + public function config($file, $use_sections = FALSE, $fail_gracefully = FALSE) + { + return CI::$APP->config->load($file, $use_sections, $fail_gracefully, $this->_module); + } + + /** Load the database drivers **/ + public function database($params = '', $return = FALSE, $query_builder = NULL) + { + if ($return === FALSE && $query_builder === NULL && + isset(CI::$APP->db) && is_object(CI::$APP->db) && ! empty(CI::$APP->db->conn_id)) + { + return FALSE; + } + + require_once BASEPATH.'database/DB'.EXT; + + if ($return === TRUE) return DB($params, $query_builder); + + CI::$APP->db = DB($params, $query_builder); + + return $this; + } + + /** Load a module helper **/ + public function helper($helper = array()) + { + if (is_array($helper)) return $this->helpers($helper); + + if (isset($this->_ci_helpers[$helper])) return; + + list($path, $_helper) = Modules::find($helper.'_helper', $this->_module, 'helpers/'); + + if ($path === FALSE) return parent::helper($helper); + + Modules::load_file($_helper, $path); + $this->_ci_helpers[$_helper] = TRUE; + return $this; + } + + /** Load an array of helpers **/ + public function helpers($helpers = array()) + { + foreach ($helpers as $_helper) $this->helper($_helper); + return $this; + } + + /** Load a module language file **/ + public function language($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '') + { + CI::$APP->lang->load($langfile, $idiom, $return, $add_suffix, $alt_path, $this->_module); + return $this; + } + + public function languages($languages) + { + foreach($languages as $_language) $this->language($_language); + return $this; + } + + /** Load a module library **/ + public function library($library, $params = NULL, $object_name = NULL) + { + if (is_array($library)) return $this->libraries($library); + + $class = strtolower(basename($library)); + + if (isset($this->_ci_classes[$class]) && $_alias = $this->_ci_classes[$class]) + return $this; + + ($_alias = strtolower($object_name)) OR $_alias = $class; + + list($path, $_library) = Modules::find($library, $this->_module, 'libraries/'); + + /* load library config file as params */ + if ($params == NULL) + { + list($path2, $file) = Modules::find($_alias, $this->_module, 'config/'); + ($path2) && $params = Modules::load_file($file, $path2, 'config'); + } + + if ($path === FALSE) + { + $this->_ci_load_library($library, $params, $object_name); + } + else + { + Modules::load_file($_library, $path); + + $library = ucfirst($_library); + CI::$APP->$_alias = new $library($params); + + $this->_ci_classes[$class] = $_alias; + } + return $this; + } + + /** Load an array of libraries **/ + public function libraries($libraries) + { + foreach ($libraries as $library => $alias) + { + (is_int($library)) ? $this->library($alias) : $this->library($library, NULL, $alias); + } + return $this; + } + + /** Load a module model **/ + public function model($model, $object_name = NULL, $connect = FALSE) + { + if (is_array($model)) return $this->models($model); + + ($_alias = $object_name) OR $_alias = basename($model); + + if (in_array($_alias, $this->_ci_models, TRUE)) + return $this; + + /* check module */ + list($path, $_model) = Modules::find(strtolower($model), $this->_module, 'models/'); + + if ($path == FALSE) + { + /* check application & packages */ + parent::model($model, $object_name, $connect); + } + else + { + class_exists('CI_Model', FALSE) OR load_class('Model', 'core'); + + if ($connect !== FALSE && ! class_exists('CI_DB', FALSE)) + { + if ($connect === TRUE) $connect = ''; + $this->database($connect, FALSE, TRUE); + } + + Modules::load_file($_model, $path); + + $model = ucfirst($_model); + CI::$APP->$_alias = new $model(); + + $this->_ci_models[] = $_alias; + } + return $this; + } + + /** Load an array of models **/ + public function models($models) + { + foreach ($models as $model => $alias) + { + (is_int($model)) ? $this->model($alias) : $this->model($model, $alias); + } + return $this; + } + + /** Load a module controller **/ + public function module($module, $params = NULL) + { + if (is_array($module)) return $this->modules($module); + + $_alias = strtolower(basename($module)); + CI::$APP->$_alias = Modules::load(array($module => $params)); + return $this; + } + + /** Load an array of controllers **/ + public function modules($modules) + { + foreach ($modules as $_module) $this->module($_module); + return $this; + } + + /** Load a module plugin **/ + public function plugin($plugin) + { + if (is_array($plugin)) return $this->plugins($plugin); + + if (isset($this->_ci_plugins[$plugin])) + return $this; + + list($path, $_plugin) = Modules::find($plugin.'_pi', $this->_module, 'plugins/'); + + if ($path === FALSE && ! is_file($_plugin = APPPATH.'plugins/'.$_plugin.EXT)) + { + show_error("Unable to locate the plugin file: {$_plugin}"); + } + + Modules::load_file($_plugin, $path); + $this->_ci_plugins[$plugin] = TRUE; + return $this; + } + + /** Load an array of plugins **/ + public function plugins($plugins) + { + foreach ($plugins as $_plugin) $this->plugin($_plugin); + return $this; + } + + /** Load a module view **/ + public function view($view, $vars = array(), $return = FALSE) + { + list($path, $_view) = Modules::find($view, $this->_module, 'views/'); + + if ($path != FALSE) + { + $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths; + $view = $_view; + } + + return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return)); + } + + protected function &_ci_get_component($component) + { + return CI::$APP->$component; + } + + public function __get($class) + { + return (isset($this->controller)) ? $this->controller->$class : CI::$APP->$class; + } + + public function _ci_load($_ci_data) + { + extract($_ci_data); + + if (isset($_ci_view)) + { + $_ci_path = ''; + + /* add file extension if not provided */ + $_ci_file = (pathinfo($_ci_view, PATHINFO_EXTENSION)) ? $_ci_view : $_ci_view.EXT; + + foreach ($this->_ci_view_paths as $path => $cascade) + { + if (file_exists($view = $path.$_ci_file)) + { + $_ci_path = $view; + break; + } + if ( ! $cascade) break; + } + } + elseif (isset($_ci_path)) + { + + $_ci_file = basename($_ci_path); + if( ! file_exists($_ci_path)) $_ci_path = ''; + } + + if (empty($_ci_path)) + show_error('Unable to load the requested file: '.$_ci_file); + + if (isset($_ci_vars)) + $this->_ci_cached_vars = array_merge($this->_ci_cached_vars, (array) $_ci_vars); + + extract($this->_ci_cached_vars); + + ob_start(); + + if ((bool) @ini_get('short_open_tag') === FALSE && CI::$APP->config->item('rewrite_short_tags') == TRUE) + { + echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace(' $this->_ci_ob_level + 1) + { + ob_end_flush(); + } + else + { + CI::$APP->output->append_output(ob_get_clean()); + } + } + + /** Autoload module items **/ + public function _autoloader($autoload) + { + $path = FALSE; + + if ($this->_module) + { + list($path, $file) = Modules::find('constants', $this->_module, 'config/'); + + /* module constants file */ + if ($path != FALSE) + { + include_once $path.$file.EXT; + } + + list($path, $file) = Modules::find('autoload', $this->_module, 'config/'); + + /* module autoload file */ + if ($path != FALSE) + { + $autoload = array_merge(Modules::load_file($file, $path, 'autoload'), $autoload); + } + } + + /* nothing to do */ + if (count($autoload) == 0) return; + + /* autoload package paths */ + if (isset($autoload['packages'])) + { + foreach ($autoload['packages'] as $package_path) + { + $this->add_package_path($package_path); + } + } + + /* autoload config */ + if (isset($autoload['config'])) + { + foreach ($autoload['config'] as $config) + { + $this->config($config); + } + } + + /* autoload helpers, plugins, languages */ + foreach (array('helper', 'plugin', 'language') as $type) + { + if (isset($autoload[$type])) + { + foreach ($autoload[$type] as $item) + { + $this->$type($item); + } + } + } + + // Autoload drivers + if (isset($autoload['drivers'])) + { + foreach ($autoload['drivers'] as $item => $alias) + { + (is_int($item)) ? $this->driver($alias) : $this->driver($item, $alias); + } + } + + /* autoload database & libraries */ + if (isset($autoload['libraries'])) + { + if (in_array('database', $autoload['libraries'])) + { + /* autoload database */ + if ( ! $db = CI::$APP->config->item('database')) + { + $this->database(); + $autoload['libraries'] = array_diff($autoload['libraries'], array('database')); + } + } + + /* autoload libraries */ + foreach ($autoload['libraries'] as $library => $alias) + { + (is_int($library)) ? $this->library($alias) : $this->library($library, NULL, $alias); + } + } + + /* autoload models */ + if (isset($autoload['model'])) + { + foreach ($autoload['model'] as $model => $alias) + { + (is_int($model)) ? $this->model($alias) : $this->model($model, $alias); + } + } + + /* autoload module controllers */ + if (isset($autoload['modules'])) + { + foreach ($autoload['modules'] as $controller) + { + ($controller != $this->_module) && $this->module($controller); + } + } + } +} + +/** load the CI class for Modular Separation **/ +(class_exists('CI', FALSE)) OR require dirname(__FILE__).'/Ci.php'; \ No newline at end of file diff --git a/application/third_party/MX/Modules.php b/application/third_party/MX/Modules.php new file mode 100644 index 0000000..e85ba8f --- /dev/null +++ b/application/third_party/MX/Modules.php @@ -0,0 +1,242 @@ +item('modules_locations')) OR Modules::$locations = array( + APPPATH.'modules/' => '../modules/', +); + +/* PHP5 spl_autoload */ +spl_autoload_register('Modules::autoload'); + +/** + * Modular Extensions - HMVC + * + * Adapted from the CodeIgniter Core Classes + * @link http://codeigniter.com + * + * Description: + * This library provides functions to load and instantiate controllers + * and module controllers allowing use of modules and the HMVC design pattern. + * + * Install this file as application/third_party/MX/Modules.php + * + * @copyright Copyright (c) 2015 Wiredesignz + * @version 5.5 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + **/ +class Modules +{ + public static $routes, $registry, $locations; + + /** + * Run a module controller method + * Output from module is buffered and returned. + **/ + public static function run($module) + { + $method = 'index'; + + if(($pos = strrpos($module, '/')) != FALSE) + { + $method = substr($module, $pos + 1); + $module = substr($module, 0, $pos); + } + + if($class = self::load($module)) + { + if (method_exists($class, $method)) { + ob_start(); + $args = func_get_args(); + $output = call_user_func_array(array($class, $method), array_slice($args, 1)); + $buffer = ob_get_clean(); + return ($output !== NULL) ? $output : $buffer; + } + } + + log_message('error', "Module controller failed to run: {$module}/{$method}"); + } + + /** Load a module controller **/ + public static function load($module) + { + (is_array($module)) ? list($module, $params) = each($module) : $params = NULL; + + /* get the requested controller class name */ + $alias = strtolower(basename($module)); + + /* create or return an existing controller from the registry */ + if ( ! isset(self::$registry[$alias])) + { + /* find the controller */ + list($class) = CI::$APP->router->locate(explode('/', $module)); + + /* controller cannot be located */ + if (empty($class)) return; + + /* set the module directory */ + $path = APPPATH.'controllers/'.CI::$APP->router->directory; + + /* load the controller class */ + $class = $class.CI::$APP->config->item('controller_suffix'); + self::load_file(ucfirst($class), $path); + + /* create and register the new controller */ + $controller = ucfirst($class); + self::$registry[$alias] = new $controller($params); + } + + return self::$registry[$alias]; + } + + /** Library base class autoload **/ + public static function autoload($class) + { + /* don't autoload CI_ prefixed classes or those using the config subclass_prefix */ + if (strstr($class, 'CI_') OR strstr($class, config_item('subclass_prefix'))) return; + + /* autoload Modular Extensions MX core classes */ + if (strstr($class, 'MX_')) + { + if (is_file($location = dirname(__FILE__).'/'.substr($class, 3).EXT)) + { + include_once $location; + return; + } + show_error('Failed to load MX core class: '.$class); + } + + /* autoload core classes */ + if(is_file($location = APPPATH.'core/'.ucfirst($class).EXT)) + { + include_once $location; + return; + } + + /* autoload library classes */ + if(is_file($location = APPPATH.'libraries/'.ucfirst($class).EXT)) + { + include_once $location; + return; + } + } + + /** Load a module file **/ + public static function load_file($file, $path, $type = 'other', $result = TRUE) + { + $file = str_replace(EXT, '', $file); + $location = $path.$file.EXT; + + if ($type === 'other') + { + if (class_exists($file, FALSE)) + { + log_message('debug', "File already loaded: {$location}"); + return $result; + } + include_once $location; + } + else + { + /* load config or language array */ + include $location; + + if ( ! isset($$type) OR ! is_array($$type)) + show_error("{$location} does not contain a valid {$type} array"); + + $result = $$type; + } + log_message('debug', "File loaded: {$location}"); + return $result; + } + + /** + * Find a file + * Scans for files located within modules directories. + * Also scans application directories for models, plugins and views. + * Generates fatal error if file not found. + **/ + public static function find($file, $module, $base) + { + $segments = explode('/', $file); + + $file = array_pop($segments); + $file_ext = (pathinfo($file, PATHINFO_EXTENSION)) ? $file : $file.EXT; + + $path = ltrim(implode('/', $segments).'/', '/'); + $module ? $modules[$module] = $path : $modules = array(); + + if ( ! empty($segments)) + { + $modules[array_shift($segments)] = ltrim(implode('/', $segments).'/','/'); + } + + foreach (Modules::$locations as $location => $offset) + { + foreach($modules as $module => $subpath) + { + $fullpath = $location.$module.'/'.$base.$subpath; + + if ($base == 'libraries/' OR $base == 'models/') + { + if(is_file($fullpath.ucfirst($file_ext))) return array($fullpath, ucfirst($file)); + } + else + /* load non-class files */ + if (is_file($fullpath.$file_ext)) return array($fullpath, $file); + } + } + + return array(FALSE, $file); + } + + /** Parse module routes **/ + public static function parse_routes($module, $uri) + { + /* load the route file */ + if ( ! isset(self::$routes[$module])) + { + if (list($path) = self::find('routes', $module, 'config/')) + { + $path && self::$routes[$module] = self::load_file('routes', $path, 'route'); + } + } + + if ( ! isset(self::$routes[$module])) return; + + /* parse module routes */ + foreach (self::$routes[$module] as $key => $val) + { + $key = str_replace(array(':any', ':num'), array('.+', '[0-9]+'), $key); + + if (preg_match('#^'.$key.'$#', $uri)) + { + if (strpos($val, '$') !== FALSE AND strpos($key, '(') !== FALSE) + { + $val = preg_replace('#^'.$key.'$#', $val, $uri); + } + return explode('/', $module.'/'.$val); + } + } + } +} \ No newline at end of file diff --git a/application/third_party/MX/Router.php b/application/third_party/MX/Router.php new file mode 100644 index 0000000..be407e8 --- /dev/null +++ b/application/third_party/MX/Router.php @@ -0,0 +1,245 @@ +module; + } + + protected function _set_request($segments = array()) + { + if ($this->translate_uri_dashes === TRUE) + { + foreach(range(0, 2) as $v) + { + isset($segments[$v]) && $segments[$v] = str_replace('-', '_', $segments[$v]); + } + } + + $segments = $this->locate($segments); + + if($this->located == -1) + { + $this->_set_404override_controller(); + return; + } + + if(empty($segments)) + { + $this->_set_default_controller(); + return; + } + + $this->set_class($segments[0]); + + if (isset($segments[1])) + { + $this->set_method($segments[1]); + } + else + { + $segments[1] = 'index'; + } + + array_unshift($segments, NULL); + unset($segments[0]); + $this->uri->rsegments = $segments; + } + + protected function _set_404override_controller() + { + $this->_set_module_path($this->routes['404_override']); + } + + protected function _set_default_controller() + { + if (empty($this->directory)) + { + /* set the default controller module path */ + $this->_set_module_path($this->default_controller); + } + + parent::_set_default_controller(); + + if(empty($this->class)) + { + $this->_set_404override_controller(); + } + } + + /** Locate the controller **/ + public function locate($segments) + { + $this->located = 0; + $ext = $this->config->item('controller_suffix').EXT; + + /* use module route if available */ + if (isset($segments[0]) && $routes = Modules::parse_routes($segments[0], implode('/', $segments))) + { + $segments = $routes; + } + + /* get the segments array elements */ + list($module, $directory, $controller) = array_pad($segments, 3, NULL); + + /* check modules */ + foreach (Modules::$locations as $location => $offset) + { + /* module exists? */ + if (is_dir($source = $location.$module.'/controllers/')) + { + $this->module = $module; + $this->directory = $offset.$module.'/controllers/'; + + /* module sub-controller exists? */ + if($directory) + { + /* module sub-directory exists? */ + if(is_dir($source.$directory.'/')) + { + $source .= $directory.'/'; + $this->directory .= $directory.'/'; + + /* module sub-directory controller exists? */ + if($controller) + { + if(is_file($source.ucfirst($controller).$ext)) + { + $this->located = 3; + return array_slice($segments, 2); + } + else $this->located = -1; + } + } + else + if(is_file($source.ucfirst($directory).$ext)) + { + $this->located = 2; + return array_slice($segments, 1); + } + else $this->located = -1; + } + + /* module controller exists? */ + if(is_file($source.ucfirst($module).$ext)) + { + $this->located = 1; + return $segments; + } + } + } + + if( ! empty($this->directory)) return; + + /* application sub-directory controller exists? */ + if($directory) + { + if(is_file(APPPATH.'controllers/'.$module.'/'.ucfirst($directory).$ext)) + { + $this->directory = $module.'/'; + return array_slice($segments, 1); + } + + /* application sub-sub-directory controller exists? */ + if($controller) + { + if(is_file(APPPATH.'controllers/'.$module.'/'.$directory.'/'.ucfirst($controller).$ext)) + { + $this->directory = $module.'/'.$directory.'/'; + return array_slice($segments, 2); + } + } + } + + /* application controllers sub-directory exists? */ + if (is_dir(APPPATH.'controllers/'.$module.'/')) + { + $this->directory = $module.'/'; + return array_slice($segments, 1); + } + + /* application controller exists? */ + if (is_file(APPPATH.'controllers/'.ucfirst($module).$ext)) + { + return $segments; + } + + $this->located = -1; + } + + /* set module path */ + protected function _set_module_path(&$_route) + { + if ( ! empty($_route)) + { + // Are module/directory/controller/method segments being specified? + $sgs = sscanf($_route, '%[^/]/%[^/]/%[^/]/%s', $module, $directory, $class, $method); + + // set the module/controller directory location if found + if ($this->locate(array($module, $directory, $class))) + { + //reset to class/method + switch ($sgs) + { + case 1: $_route = $module.'/index'; + break; + case 2: $_route = ($this->located < 2) ? $module.'/'.$directory : $directory.'/index'; + break; + case 3: $_route = ($this->located == 2) ? $directory.'/'.$class : $class.'/index'; + break; + case 4: $_route = ($this->located == 3) ? $class.'/'.$method : $method.'/index'; + break; + } + } + } + } + + public function set_class($class) + { + $suffix = $this->config->item('controller_suffix'); + if (strpos($class, $suffix) === FALSE) + { + $class .= $suffix; + } + parent::set_class($class); + } +} \ No newline at end of file diff --git a/application/third_party/index.html b/application/third_party/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/third_party/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php new file mode 100644 index 0000000..6984b61 --- /dev/null +++ b/application/views/errors/cli/error_404.php @@ -0,0 +1,8 @@ + + +An uncaught Exception was encountered + +Type: +Message: +Filename: getFile(), "\n"; ?> +Line Number: getLine(); ?> + + + +Backtrace: +getTrace() as $error): ?> + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php new file mode 100644 index 0000000..6984b61 --- /dev/null +++ b/application/views/errors/cli/error_general.php @@ -0,0 +1,8 @@ + + +A PHP Error was encountered + +Severity: +Message: +Filename: +Line Number: + + + +Backtrace: + + + File: + Line: + Function: + + + + diff --git a/application/views/errors/cli/index.html b/application/views/errors/cli/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/cli/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php new file mode 100644 index 0000000..756ea9d --- /dev/null +++ b/application/views/errors/html/error_404.php @@ -0,0 +1,64 @@ + + + + +404 Page Not Found + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_db.php b/application/views/errors/html/error_db.php new file mode 100644 index 0000000..f5a43f6 --- /dev/null +++ b/application/views/errors/html/error_db.php @@ -0,0 +1,64 @@ + + + + +Database Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_exception.php b/application/views/errors/html/error_exception.php new file mode 100644 index 0000000..8784886 --- /dev/null +++ b/application/views/errors/html/error_exception.php @@ -0,0 +1,32 @@ + + +
+ +

An uncaught Exception was encountered

+ +

Type:

+

Message:

+

Filename: getFile(); ?>

+

Line Number: getLine(); ?>

+ + + +

Backtrace:

+ getTrace() as $error): ?> + + + +

+ File:
+ Line:
+ Function: +

+ + + + + + +
\ No newline at end of file diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php new file mode 100644 index 0000000..fc3b2eb --- /dev/null +++ b/application/views/errors/html/error_general.php @@ -0,0 +1,64 @@ + + + + +Error + + + +
+

+ +
+ + \ No newline at end of file diff --git a/application/views/errors/html/error_php.php b/application/views/errors/html/error_php.php new file mode 100644 index 0000000..b146f9c --- /dev/null +++ b/application/views/errors/html/error_php.php @@ -0,0 +1,33 @@ + + +
+ +

A PHP Error was encountered

+ +

Severity:

+

Message:

+

Filename:

+

Line Number:

+ + + +

Backtrace:

+ + + + +

+ File:
+ Line:
+ Function: +

+ + + + + + + +
\ No newline at end of file diff --git a/application/views/errors/html/index.html b/application/views/errors/html/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/html/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/errors/index.html b/application/views/errors/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/errors/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/index.html b/application/views/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/application/views/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + diff --git a/application/views/welcome_message.php b/application/views/welcome_message.php new file mode 100644 index 0000000..86d82ad --- /dev/null +++ b/application/views/welcome_message.php @@ -0,0 +1,94 @@ + + + + + Welcome to CodeIgniter + + + + + +
+

Welcome to CodeIgniter!

+ + + +
+

The page you are looking at is being generated dynamically by CodeIgniter.

+ +

If you would like to edit this page you'll find it located at:

+ application/views/welcome_message.php + +

The corresponding controller for this page is found at:

+ application/controllers/welcome.php + +

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.

+
+ + +
+ + + \ No newline at end of file